From 9a9c2acd8d0a44799c1c0199bf7e14640f6a86f3 Mon Sep 17 00:00:00 2001 From: "Robin H. Johnson" Date: Wed, 10 Oct 2012 00:07:26 +0000 Subject: [PATCH] net/{bridge,iproute2}: Stricter iproute2 ip link syntax & promisc handling The 'dev' argument is only optional for ethX devices, for others it is mandatory, so we should always include it. Also tweak when promisc mode is applied to bridges. Patches submitted by Denis Kaganovich . X-Gentoo-Bug: #431204 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=431204 Signed-off-by: Robin H. Johnson --- net/bridge.sh | 3 +-- net/iproute2.sh | 12 ++++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/net/bridge.sh b/net/bridge.sh index 4f3618aa..60d3eebc 100644 --- a/net/bridge.sh +++ b/net/bridge.sh @@ -119,10 +119,8 @@ bridge_pre_start() return 1 fi # The interface is known to exist now - _set_flag promisc _up if ! brctl addif "${BR_IFACE}" "${x}"; then - _set_flag -promisc eend 1 return 1 fi @@ -144,6 +142,7 @@ bridge_pre_start() ) || return 1 # Bring up the bridge + _set_flag promisc _up } diff --git a/net/iproute2.sh b/net/iproute2.sh index eb311c87..3bab7b74 100644 --- a/net/iproute2.sh +++ b/net/iproute2.sh @@ -10,12 +10,12 @@ iproute2_depend() _up() { - ip link set "${IFACE}" up + ip link set dev "${IFACE}" up } _down() { - ip link set "${IFACE}" down + ip link set dev "${IFACE}" down } _exists() @@ -57,7 +57,7 @@ _set_flag() flag=${flag#-} opt="off" fi - ip link set "${IFACE}" "${flag}" "${opt}" + ip link set dev "${IFACE}" "${flag}" "${opt}" } _get_mac_address() @@ -79,7 +79,7 @@ _get_mac_address() _set_mac_address() { - ip link set "${IFACE}" address "$1" + ip link set dev "${IFACE}" address "$1" } _get_inet_addresses() @@ -274,12 +274,12 @@ iproute2_pre_start() # MTU support local mtu= eval mtu=\$mtu_${IFVAR} - [ -n "${mtu}" ] && ip link set "${IFACE}" mtu "${mtu}" + [ -n "${mtu}" ] && ip link set dev "${IFACE}" mtu "${mtu}" # TX Queue Length support local len= eval len=\$txqueuelen_${IFVAR} - [ -n "${len}" ] && ip link set "${IFACE}" txqueuelen "${len}" + [ -n "${len}" ] && ip link set dev "${IFACE}" txqueuelen "${len}" return 0 }