From 301bc3290df394bd39373ffc081818b56092b05f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibaut=20VAR=C3=88NE?= Date: Sun, 19 Apr 2020 12:09:20 +0200 Subject: ath79/mikrotik: don't use mtd-mac-address in DTS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As evidenced here[1] the device MAC address can be stored at a random offset in the hard_config partition. Rely on sysfs to update the MAC address correctly. To match sticker and vendor OS behavior, WAN MAC is set to the device base MAC and LAN MAC is incremented from that. Note: this will trigger a harmless kernel message during boot: ag71xx 19000000.eth: invalid MAC address, using random address There is no clean workaround to prevent this message from being emitted. [1] https://github.com/openwrt/openwrt/pull/2850#issuecomment-610809021 Signed-off-by: Thibaut VARĂˆNE --- target/linux/ath79/mikrotik/base-files/etc/board.d/02_network | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'target/linux/ath79/mikrotik/base-files/etc') diff --git a/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network b/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network index ee795c7496..7f8327f764 100755 --- a/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network +++ b/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network @@ -21,8 +21,17 @@ ath79_setup_interfaces() ath79_setup_macs() { local board="$1" + local lan_mac="" + local wan_mac="" + local label_mac="" + local mac_base="$(cat /sys/firmware/mikrotik/hard_config/mac_base)" case "$board" in + *) + label_mac="$mac_base" + wan_mac="$mac_base" + lan_mac=$(macaddr_add $mac_base 1) + ;; esac [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac -- cgit v1.2.3