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 <mahatma@bspu.unibel.by>.

X-Gentoo-Bug: #431204
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=431204
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
This commit is contained in:
Robin H. Johnson 2012-10-10 00:07:26 +00:00
parent b68d4b3580
commit 9a9c2acd8d
2 changed files with 7 additions and 8 deletions

View File

@ -119,10 +119,8 @@ bridge_pre_start()
return 1 return 1
fi fi
# The interface is known to exist now # The interface is known to exist now
_set_flag promisc
_up _up
if ! brctl addif "${BR_IFACE}" "${x}"; then if ! brctl addif "${BR_IFACE}" "${x}"; then
_set_flag -promisc
eend 1 eend 1
return 1 return 1
fi fi
@ -144,6 +142,7 @@ bridge_pre_start()
) || return 1 ) || return 1
# Bring up the bridge # Bring up the bridge
_set_flag promisc
_up _up
} }

View File

@ -10,12 +10,12 @@ iproute2_depend()
_up() _up()
{ {
ip link set "${IFACE}" up ip link set dev "${IFACE}" up
} }
_down() _down()
{ {
ip link set "${IFACE}" down ip link set dev "${IFACE}" down
} }
_exists() _exists()
@ -57,7 +57,7 @@ _set_flag()
flag=${flag#-} flag=${flag#-}
opt="off" opt="off"
fi fi
ip link set "${IFACE}" "${flag}" "${opt}" ip link set dev "${IFACE}" "${flag}" "${opt}"
} }
_get_mac_address() _get_mac_address()
@ -79,7 +79,7 @@ _get_mac_address()
_set_mac_address() _set_mac_address()
{ {
ip link set "${IFACE}" address "$1" ip link set dev "${IFACE}" address "$1"
} }
_get_inet_addresses() _get_inet_addresses()
@ -274,12 +274,12 @@ iproute2_pre_start()
# MTU support # MTU support
local mtu= local mtu=
eval mtu=\$mtu_${IFVAR} 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 # TX Queue Length support
local len= local len=
eval len=\$txqueuelen_${IFVAR} eval len=\$txqueuelen_${IFVAR}
[ -n "${len}" ] && ip link set "${IFACE}" txqueuelen "${len}" [ -n "${len}" ] && ip link set dev "${IFACE}" txqueuelen "${len}"
return 0 return 0
} }