network-bridge: Fix for bonding

If ${netdev} is bonding, brctl addif ${bridge} ${pdev} fails:
  can't add ${pdev} to bridge ${bridge}: Invalid argument
Because ${pdev} has no slaves at this point.=20
# Notice that ifdown ${netdev} clears slaves of ${netdev}.

This patch restores slaves before add_to_bridge2 ${bridge} ${pdev}.

Signed-off-by: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
This commit is contained in:
Keir Fraser committed 2009-04-22 11:26:37 +01:00
1 parent 946a02890c
commit 744ba6479a
1 file changed
+9
+9
View File
@@ -223,6 +223,10 @@ op_start () {
preiftransfer ${netdev}
transfer_addrs ${netdev} ${tdev}
# Remember slaves for bonding interface.
if [ -e /sys/class/net/${netdev}/bonding/slaves ]; then
slaves=`cat /sys/class/net/${netdev}/bonding/slaves`
fi
# Remember the IP details for do_ifup.
get_ip_info ${netdev}
if ! ifdown ${netdev}; then
@@ -234,6 +238,11 @@ op_start () {
setup_bridge_port ${pdev}
# Restore slaves
if [ -n "${slaves}" ]; then
ip link set ${pdev} up
ifenslave ${pdev} ${slaves}
fi
add_to_bridge2 ${bridge} ${pdev}
do_ifup ${bridge}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.