[openwrt/openwrt] base-files: set MAC for bridge ports (devices) instead of bridge itself

LEDE Commits lede-commits at lists.infradead.org
Mon Jun 21 23:39:31 PDT 2021


rmilecki pushed a commit to openwrt/openwrt.git, branch openwrt-21.02:
https://git.openwrt.org/125deb4d783e548228e68f6e4b42b5eb84ba8b8c

commit 125deb4d783e548228e68f6e4b42b5eb84ba8b8c
Author: Rafał Miłecki <rafal at milecki.pl>
AuthorDate: Mon Jun 14 20:18:14 2021 +0200

    base-files: set MAC for bridge ports (devices) instead of bridge itself
    
    This restores the original config_generate behaviour. With MAC set for
    bridged devices the bridge automatically gets its MAC adjusted (it picks
    the lowest MAC of bridged devices).
    
    This fixes confusing interfaces setup (bridge ports not having custom
    MAC assigned).
    
    Reported-by: Koen Vandeputte <koen.vandeputte at citymesh.com>
    Fixes: c2139eef279e ("base-files: simplify setting device MAC")
    Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
    (cherry picked from commit c8d8eb9d13fc6fc8b394a620c27995ee71d29c4d)
---
 package/base-files/files/bin/config_generate | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/package/base-files/files/bin/config_generate b/package/base-files/files/bin/config_generate
index 0dca5549e8..b3752c5430 100755
--- a/package/base-files/files/bin/config_generate
+++ b/package/base-files/files/bin/config_generate
@@ -114,9 +114,17 @@ generate_network() {
 			add network device
 			set network. at device[-1].name='br-$1'
 			set network. at device[-1].type='bridge'
-			set network. at device[-1].macaddr='$macaddr'
 		EOF
 		for port in $ports; do uci add_list network. at device[-1].ports="$port"; done
+		[ -n "macaddr" ] && {
+			for port in $ports; do
+				uci -q batch <<-EOF
+					add network device
+					set network. at device[-1].name='$port'
+					set network. at device[-1].macaddr='$macaddr'
+				EOF
+			done
+		}
 		device=br-$1
 		type=
 		macaddr=""



More information about the lede-commits mailing list