[openwrt/openwrt] realtek: don't implicitly configure port MAC addresses

LEDE Commits lede-commits at lists.infradead.org
Mon Feb 9 16:40:27 PST 2026


hauke pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/0686fed2b40512bfa0fa859433fe533b0260f18c

commit 0686fed2b40512bfa0fa859433fe533b0260f18c
Author: Jan Hoffmann <jan at 3e8.eu>
AuthorDate: Thu Jan 22 20:21:35 2026 +0100

    realtek: don't implicitly configure port MAC addresses
    
    Currently, the 02_network script always configures MAC addresses for
    each individual LAN port unless "lan_mac_start" is set to "skip". This
    behaviour can be unexpected, and is also somewhat broken, as it even
    continues to do so when "lan_mac_start" is empty.
    
    Change it to only do the configuration if "lan_mac_start" is non-empty,
    and also remove the fallback to "lan_mac", making this more obvious and
    less error-prone.
    
    Signed-off-by: Jan Hoffmann <jan at 3e8.eu>
    Link: https://github.com/openwrt/openwrt/pull/21644
    Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
 target/linux/realtek/base-files/etc/board.d/02_network | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/target/linux/realtek/base-files/etc/board.d/02_network b/target/linux/realtek/base-files/etc/board.d/02_network
index 32b41da0a9..f08579281e 100644
--- a/target/linux/realtek/base-files/etc/board.d/02_network
+++ b/target/linux/realtek/base-files/etc/board.d/02_network
@@ -60,6 +60,7 @@ realtek_setup_macs()
 	xikestor,sks8300-12e2t2x)
 		label_mac=$(get_mac_label)
 		lan_mac="$label_mac"
+		lan_mac_start=$lan_mac
 		;;
 	hpe,1920-8g|\
 	hpe,1920-8g-poe-65w|\
@@ -83,26 +84,29 @@ realtek_setup_macs()
 	plasmacloud,psx8|\
 	plasmacloud,psx10|\
 	plasmacloud,psx28)
-		lan_mac_start=skip
 		lan_mac="$(get_mac_label)"
 		;;
 	tplink,tl-st1008f-v2|\
 	zyxel,xgs1010-12-a1)
 		lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
 		[ -z "$lan_mac" ] || [ "$lan_mac" = "00:e0:4c:00:00:00" ] && lan_mac=$(macaddr_random)
+		lan_mac_start=$lan_mac
 		;;
 	xikestor,sks8300-8x)
 		lan_mac=$(mtd_get_mac_binary board-info 0x1f1)
+		lan_mac_start=$lan_mac
 		;;
 	xikestor,sks8310-8x)
 		lan_mac=$(mtd_get_mac_binary factory 0x80)
 		label_mac="$lan_mac"
+		lan_mac_start=$lan_mac
 		;;
 	*)
 		lan_mac=$(mtd_get_mac_ascii u-boot-env2 mac_start)
 		lan_mac_end=$(mtd_get_mac_ascii u-boot-env2 mac_end)
 		label_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
 		[ -z "$lan_mac" ] && lan_mac=$label_mac
+		lan_mac_start=$lan_mac
 		;;
 	esac
 
@@ -110,8 +114,7 @@ realtek_setup_macs()
 	[ -n "$lan_mac" ] && ucidef_set_bridge_mac "$lan_mac"
 	[ -n "$lan_mac" ] && ucidef_set_network_device_mac eth0 $lan_mac
 
-	[ -z "$lan_mac_start" -a -n "$lan_mac" ] && lan_mac_start=$lan_mac
-	[ "$lan_mac_start" != "skip" ] && realtek_setup_macs_lan "$lan_list" "$lan_mac_start" "$lan_mac_end"
+	[ -n "$lan_mac_start" ] && realtek_setup_macs_lan "$lan_list" "$lan_mac_start" "$lan_mac_end"
 
 	[ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac
 }




More information about the lede-commits mailing list