06_set_iface_mac 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #
  2. # Copyright (C) 2014-2015 OpenWrt.org
  3. # Copyright (C) 2016 LEDE-Project.org
  4. #
  5. preinit_set_mac_address() {
  6. local mac
  7. . /lib/functions.sh
  8. case $(board_name) in
  9. armada-xp-linksys-mamba)
  10. mac=$(mtd_get_mac_ascii devinfo hw_mac_addr)
  11. ifconfig eth0 hw ether $mac 2>/dev/null
  12. ifconfig eth1 hw ether $mac 2>/dev/null
  13. ;;
  14. armada-385-linksys-caiman|armada-385-linksys-cobra|armada-385-linksys-rango|armada-385-linksys-shelby)
  15. # rename interfaces back to the way they were with 4.4
  16. case "$(readlink /sys/class/net/eth0)" in
  17. *f1070000*)
  18. ip link set eth0 name tmp0
  19. ip link set eth1 name eth0
  20. ip link set tmp0 name eth1
  21. ;;
  22. esac
  23. mac=$(mtd_get_mac_ascii devinfo hw_mac_addr)
  24. mac_wan=$(macaddr_setbit_la "$mac")
  25. ifconfig eth1 hw ether $mac 2>/dev/null
  26. ifconfig eth0 hw ether $mac_wan 2>/dev/null
  27. ;;
  28. armada-385-db-ap|armada-388-clearfog)
  29. # rename interfaces back to the way they were with 4.4
  30. case "$(readlink /sys/class/net/eth0)" in
  31. *f1070000*)
  32. ip link set eth0 name tmp0
  33. ip link set eth1 name eth0
  34. ip link set eth2 name eth1
  35. ip link set tmp0 name eth2
  36. ;;
  37. esac
  38. ;;
  39. esac
  40. }
  41. boot_hook_add preinit_main preinit_set_mac_address