diff options
author | Paweł Owoc <frut3k7@gmail.com> | 2024-01-06 17:05:40 +0100 |
---|---|---|
committer | Christian Marangi <ansuelsmth@gmail.com> | 2024-01-15 16:52:08 +0100 |
commit | 7173a52f6aea971ae90610f10fd2f184dd29755c (patch) | |
tree | b3d7ac5078673f7aa9598b8233ea1360cf1d8cf0 | |
parent | 45f86a12787d6d0deadcaedd67fed8bbb541743b (diff) |
ipq807x: use devinfo MAC for Linksys MX4200
Some devices (MX42CF) have a wrong MAC address configuration. The correct one is located only on the devinfo partition.
Signed-off-by: Paweł Owoc <frut3k7@gmail.com>
-rw-r--r-- | target/linux/qualcommax/ipq807x/base-files/etc/board.d/02_network | 24 | ||||
-rw-r--r-- | target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac | 7 |
2 files changed, 31 insertions, 0 deletions
diff --git a/target/linux/qualcommax/ipq807x/base-files/etc/board.d/02_network b/target/linux/qualcommax/ipq807x/base-files/etc/board.d/02_network index 1e0719cf00..f38c4b6698 100644 --- a/target/linux/qualcommax/ipq807x/base-files/etc/board.d/02_network +++ b/target/linux/qualcommax/ipq807x/base-files/etc/board.d/02_network @@ -57,9 +57,33 @@ ipq807x_setup_interfaces() esac } +ipq807x_setup_macs() +{ + local board="$1" + local lan_mac="" + local wan_mac="" + local label_mac="" + + case "$board" in + linksys,mx4200v1|\ + linksys,mx4200v2) + label_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr) + for i in $(seq 3 5); do + [ "$(mtd_get_mac_ascii u_env eth${i}addr)" != "$label_mac" ] && lan_mac=$label_mac + done + [ "$(mtd_get_mac_ascii u_env eth2addr)" != "$label_mac" ] && wan_mac=$label_mac + ;; + esac + + [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac + [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac + [ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac +} + board_config_update board=$(board_name) ipq807x_setup_interfaces $board +ipq807x_setup_macs $board board_config_flush exit 0 diff --git a/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac b/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac index f951d925ab..343e42d634 100644 --- a/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac +++ b/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac @@ -18,6 +18,13 @@ case "$board" in [ "$PHYNBR" = "0" ] && macaddr_add $(get_mac_label) 8 > /sys${DEVPATH}/macaddress [ "$PHYNBR" = "1" ] && macaddr_add $(get_mac_label) 16 > /sys${DEVPATH}/macaddress ;; + linksys,mx4200v1|\ + linksys,mx4200v2) + label_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr) + [ "$PHYNBR" = "0" ] && macaddr_add $label_mac 2 > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && macaddr_add $label_mac 1 > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "2" ] && macaddr_add $label_mac 3 > /sys${DEVPATH}/macaddress + ;; zte,mf269) [ "$PHYNBR" = "0" ] && macaddr_add $(get_mac_label) 2 > /sys${DEVPATH}/macaddress [ "$PHYNBR" = "1" ] && macaddr_add $(get_mac_label) 3 > /sys${DEVPATH}/macaddress |