This will ensure that bridge devices will stick to the MAC address of the first added slave interface as otherwise the MAC address could change when adding additional slave interfaces later. This prevents trouble in the following situation:
- Setup br-lan with just eth0 (br-lan will get the same MAC as eth0) - DHCP on br-lan - Start wifi (br-lan might switch its MAC to the one of wlan0 if it is lower then the previous one) - DHCP lease time expired -> New IP address as the MAC changed Setting the MAC address of the first slave interface to the bridge as well will make the bridge MAC address sticky. Signed-off-by: Helmut Schaa <[email protected]> --- package/base-files/files/lib/network/config.sh | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/package/base-files/files/lib/network/config.sh b/package/base-files/files/lib/network/config.sh index d285da2..94c7ccd 100755 --- a/package/base-files/files/lib/network/config.sh +++ b/package/base-files/files/lib/network/config.sh @@ -166,6 +166,7 @@ prepare_interface() { [ -x /usr/sbin/brctl ] && { # Remove IPv6 link local addr before adding the iface to the bridge local llv6="$(ifconfig "$iface")" + local initial=0 case "$llv6" in *fe80:*/64*) llv6="${llv6#* fe80:}" @@ -192,11 +193,18 @@ prepare_interface() { $DEBUG ifconfig "$iface" 0.0.0.0 $DEBUG brctl addif "br-$config" "$iface" $DEBUG brctl stp "br-$config" $stp + initial=1 # Creating the bridge here will have triggered a hotplug event, which will # result in another setup_interface() call, so we simply stop processing # the current event at this point. } ifconfig "$iface" ${macaddr:+hw ether "${macaddr}"} up 2>/dev/null >/dev/null + + # Make bridge MAC address sticky + [ "$initial" = "1" ] && + ifconfig "br-$config" ${macaddr:+hw ether "${macaddr}"} 2>/dev/null >/dev/null + + return 1 } ;; -- 1.7.1 _______________________________________________ openwrt-devel mailing list [email protected] https://lists.openwrt.org/mailman/listinfo/openwrt-devel
