From 20c66d6499f22adad6c1dae854a627f061c5fbcb Mon Sep 17 00:00:00 2001 From: Jouke Witteveen Date: Wed, 24 Jul 2013 10:57:48 +0200 Subject: Use iproute2 for bridging (FS#36165) This sheds the dependency on the old bridge-utils (brctl). --- contrib/PKGBUILD.in | 1 - docs/examples/bridge | 6 ++---- docs/netctl.profile.5.txt | 10 ++++------ src/lib/connections/bridge | 19 +++++++++---------- 4 files changed, 15 insertions(+), 21 deletions(-) diff --git a/contrib/PKGBUILD.in b/contrib/PKGBUILD.in index b4e31f0..5375b36 100644 --- a/contrib/PKGBUILD.in +++ b/contrib/PKGBUILD.in @@ -17,7 +17,6 @@ optdepends=('dialog: for the menu based wifi assistant' 'ifplugd: for automatic wired connections through netctl-ifplugd' 'wpa_actiond: for automatic wireless connections through netctl-auto' 'ifenslave: for bond connections' - 'bridge-utils: for bridge connections' 'ppp: for pppoe connections' ) source=(ftp://ftp.archlinux.org/other/packages/netctl/netctl-${pkgver}.tar.xz{,.sig}) diff --git a/docs/examples/bridge b/docs/examples/bridge index 19cb0bd..3f38d7a 100644 --- a/docs/examples/bridge +++ b/docs/examples/bridge @@ -3,7 +3,5 @@ Interface=br0 Connection=bridge BindsToInterfaces=(eth0 eth1 tap0) IP=dhcp -## sets forward delay time -#FwdDelay=0 -## sets max age of hello message -#MaxAge=10 +## Ignore (R)STP and immediately activate the bridge +#SkipForwardingDelay=yes diff --git a/docs/netctl.profile.5.txt b/docs/netctl.profile.5.txt index fe0073e..ec36f47 100644 --- a/docs/netctl.profile.5.txt +++ b/docs/netctl.profile.5.txt @@ -286,14 +286,12 @@ connections of the `bond' type. OPTIONS FOR `bridge' CONNECTIONS -------------------------------- The interfaces of 'BindsToInterfaces' take part in the bridge named by -'Interface'. Next to the *ip options*, the following are understood for +'Interface'. Next to the *ip options*, the following is understood for connections of the `bridge' type: -'FwdDelay=':: - Forward delay of the bridge. See *brctl*(8) for details. - -'MaxAge=':: - Maximum age parameter. See *brctl*(8) for details. +'SkipForwardingDelay=':: + Skip \(R)STP and immediately activate all bridge members. This can + be useful when DHCP is used on the bridge. OPTIONS FOR `pppoe' CONNECTIONS diff --git a/src/lib/connections/bridge b/src/lib/connections/bridge index 94a9b64..3b0a94b 100644 --- a/src/lib/connections/bridge +++ b/src/lib/connections/bridge @@ -2,7 +2,6 @@ . "$SUBR_DIR/ip" -: ${BRCTL:=brctl} declare -ag BindsToInterfaces bridge_up() { @@ -12,17 +11,17 @@ bridge_up() { return 1 fi else - $BRCTL addbr "$Interface" + ip link add name "$Interface" type bridge fi for member in "${BindsToInterfaces[@]}"; do - ip link set "$member" promisc on up - ip addr flush dev "$member" - $BRCTL addif "$Interface" "$member" + ip link set dev "$member" promisc on up + ip addr flush dev "$member" scope host &>/dev/null + ip addr flush dev "$member" scope site &>/dev/null + ip addr flush dev "$member" scope global &>/dev/null + ip link set dev "member" master "$Interface" + is_yes "${SkipForwardingDelay:-no}" && bridge link set dev "$member" state 3 done - # Set options - [[ "$FwdDelay" ]] && $BRCTL setfd "$Interface" "$FwdDelay" - [[ "$MaxAge" ]] && $BRCTL setmaxage "$Interface" "$MaxAge" bring_interface_up "$Interface" ip_set @@ -31,12 +30,12 @@ bridge_up() { bridge_down() { for member in "${BindsToInterfaces[@]}"; do ip link set "$member" promisc off down - $BRCTL delif "$Interface" "$member" + ip link set dev "$member" nomaster done ip_unset bring_interface_down "$Interface" - $BRCTL delbr "$Interface" + ip link delete "$Interface" type bridge } -- cgit v1.2.3-24-g4f1b