06_set_iface_mac 655 B

1234567891011121314151617181920212223242526
  1. #
  2. # Copyright (C) 2014-2015 OpenWrt.org
  3. #
  4. preinit_set_mac_address() {
  5. local mac
  6. . /lib/functions.sh
  7. . /lib/mvebu.sh
  8. case $(mvebu_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. mac=$(mtd_get_mac_ascii devinfo hw_mac_addr)
  16. mac_wan=$(macaddr_setbit_la "$mac")
  17. ifconfig eth1 hw ether $mac 2>/dev/null
  18. ifconfig eth0 hw ether $mac_wan 2>/dev/null
  19. ;;
  20. esac
  21. }
  22. boot_hook_add preinit_main preinit_set_mac_address