bridge: use iproute commands to create and assign bridge ports
This commit is contained in:
parent
80a590ca33
commit
e7ee26ac19
1 changed files with 4 additions and 4 deletions
|
@ -58,7 +58,7 @@ add_ports() {
|
||||||
if [ -n "$IF_BRIDGE_HW" ]; then
|
if [ -n "$IF_BRIDGE_HW" ]; then
|
||||||
ip link set dev $port addr $IF_BRIDGE_HW
|
ip link set dev $port addr $IF_BRIDGE_HW
|
||||||
fi
|
fi
|
||||||
brctl addif $IFACE $port && ip link set dev $port up
|
ip link set dev $port master $IFACE && ip link set dev $port up
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ del_ports() {
|
||||||
local port=
|
local port=
|
||||||
for port in $PORTS; do
|
for port in $PORTS; do
|
||||||
ip link set dev $port down
|
ip link set dev $port down
|
||||||
brctl delif $IFACE $port
|
ip link set dev $port nomaster
|
||||||
if [ -x /etc/network/ip-post-down.d/vlan ]; then
|
if [ -x /etc/network/ip-post-down.d/vlan ]; then
|
||||||
env IFACE=$port /etc/network/if-post-down.d/vlan
|
env IFACE=$port /etc/network/if-post-down.d/vlan
|
||||||
fi
|
fi
|
||||||
|
@ -140,7 +140,7 @@ depend)
|
||||||
;;
|
;;
|
||||||
create)
|
create)
|
||||||
if [ ! -d "/sys/class/net/${IFACE}" ]; then
|
if [ ! -d "/sys/class/net/${IFACE}" ]; then
|
||||||
brctl addbr "${IFACE}"
|
ip link add "${IFACE}" type bridge
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
pre-up)
|
pre-up)
|
||||||
|
@ -155,7 +155,7 @@ post-down)
|
||||||
;;
|
;;
|
||||||
destroy)
|
destroy)
|
||||||
if [ -d "/sys/class/net/${IFACE}" ]; then
|
if [ -d "/sys/class/net/${IFACE}" ]; then
|
||||||
brctl delbr "${IFACE}"
|
ip link del "${IFACE}"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
Loading…
Reference in a new issue