bcm53xx: fix LAN MAC address for devices that use eth2 originally
authorRafał Miłecki <rafal@milecki.pl>
Tue, 31 Jan 2017 12:53:46 +0000 (13:53 +0100)
committerRafał Miłecki <rafal@milecki.pl>
Wed, 1 Feb 2017 14:27:18 +0000 (15:27 +0100)
We override default Ethernet interface with eth0 which often uses random
MAC due to missing proper NVRAM entry. Fix this by manually assigning
MAC in the config.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
target/linux/bcm53xx/base-files/etc/board.d/02_network

index 672b1349dfbae145ef1efee135b792a45ca259d5..0a055f4d1ffe28a0218ed58a96885b557347a6cf 100755 (executable)
@@ -50,6 +50,12 @@ netgear,r8500)
        ifname=eth0
        ucidef_add_switch "switch0" \
                "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "5t@$ifname"
+
+       # These devices should use eth2 so their eth0 interface often has no MAC
+       # assigned. Manually assign eth2's MAC to the LAN.
+       et2macaddr="$(nvram get et2macaddr)"
+       [ -n "$et2macaddr" ] && ucidef_set_interface_macaddr "lan" "$et2macaddr"
+
        board_config_flush
        exit 0
        ;;