Re: [OpenWrt-Devel] [PATCH] base-files: Make bridge MAC address sticky

2011-04-13 Thread Helmut Schaa
Am Dienstag, 12. April 2011 schrieb Jo-Philipp Wich:
> is this patch still applicable after
>   https://dev.openwrt.org/changeset/26426 ?

Haven't tested but I think it's still needed. Setting a fixed MAC
address for a bridge interface will force the kernel to make it sticky.

Even with changeset 26426 the bridge MAC address can change when a second
interface (with a lower MAC addr) is added to the bridge later (by running
"wifi up" for example).

Helmut
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] base-files: Make bridge MAC address sticky

2011-04-12 Thread Jo-Philipp Wich
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi,

is this patch still applicable after
  https://dev.openwrt.org/changeset/26426 ?

~ Jow
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk2kti0ACgkQdputYINPTPMj+ACfYfKvrAKRsCDM3oRkxKY+mRlr
6ZIAn2FBtgV94pVXvMa9Lm0sbup2HWvf
=xfM8
-END PGP SIGNATURE-
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] base-files: Make bridge MAC address sticky

2010-12-03 Thread Helmut Schaa
Any update regarding this patch?

Thanks,
Helmut

Am Montag 15 November 2010 schrieb Helmut Schaa:
> 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 
> ---
>  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
>   }
>   ;;
> 

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] base-files: Make bridge MAC address sticky

2010-11-15 Thread Helmut Schaa
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 
---
 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
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel