firmware/general/overlay/etc/network/if-pre-up.d/bridge

40 lines
781 B
Bash
Executable File

#!/bin/sh
# You don't usually need to touch this file at all, the full configuration
# of the bridge can be done in a standard way on /etc/network/interfaces.
# Have a look at /usr/share/doc/bridge-utils/README.Debian.gz if you want
# more info about the way on wich a bridge is set up on Debian.
if [ ! -x /usr/sbin/brctl ]
then
exit 0
fi
case "$IF_BRIDGE_PORTS" in
"")
exit 0
;;
none)
INTERFACES=""
;;
all)
INTERFACES=`grep eth /proc/net/dev|sed 's/\(\ *\)\(eth[^:]*\)\(.*\)/\2/'`
;;
*)
INTERFACES="$IF_BRIDGE_PORTS"
;;
esac
brctl addbr $IFACE &&
for i in $INTERFACES
do
if [ -x /etc/network/if-pre-up.d/vlan ]; then
env IFACE=$i /etc/network/if-pre-up.d/vlan
fi
brctl addif $IFACE $i && ip link set dev $i up
done
brctl stp $IFACE off