[openwrt/openwrt] realtek: Avoid empty lan mac in initial network setup

LEDE Commits lede-commits at lists.infradead.org
Sun Oct 12 06:53:09 PDT 2025


hauke pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/18e1929401bed72a6e4f7b9b4ccee81cc67a47d6

commit 18e1929401bed72a6e4f7b9b4ccee81cc67a47d6
Author: Sven Eckelmann <se at simonwunderlich.de>
AuthorDate: Sun Oct 5 09:00:08 2025 +0200

    realtek: Avoid empty lan mac in initial network setup
    
    If the lan_mac cannot be found, it is still used (as empty string) in
    various operations. This is not valid and other 02_network scripts checking
    for a non-empty string before using it. This should also be adopted for the
    realtek 02_network.
    
    Signed-off-by: Sven Eckelmann <se at simonwunderlich.de>
    Link: https://github.com/openwrt/openwrt/pull/20241
    Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
 target/linux/realtek/base-files/etc/board.d/02_network | 8 ++++----
 1 file changed, 4 insertions(+), 4 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 79c140c32a..464ff976cf 100644
--- a/target/linux/realtek/base-files/etc/board.d/02_network
+++ b/target/linux/realtek/base-files/etc/board.d/02_network
@@ -97,11 +97,11 @@ realtek_setup_macs()
 		;;
 	esac
 
-	ucidef_set_interface_macaddr "lan" $lan_mac
-	ucidef_set_bridge_mac "$lan_mac"
-	ucidef_set_network_device_mac eth0 $lan_mac
+	[ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
+	[ -n "$lan_mac" ] && ucidef_set_bridge_mac "$lan_mac"
+	[ -n "$lan_mac" ] && ucidef_set_network_device_mac eth0 $lan_mac
 
-	[ -z "$lan_mac_start" ] && lan_mac_start=$lan_mac
+	[ -z "$lan_mac_start" -a -n "$lan_mac" ] && lan_mac_start=$lan_mac
 	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