#!/bin/ash # # Network interface(s) init script # # config: /etc/network.conf # /etc/network.d/interface.[devname] . /etc/rc.d/init.d/functions . /etc/network.conf if [ "$NETWORKING" != "yes" ] || [ "${BRIDGE_INTERFACES}" = "" ]; then exit 0 fi if [ ! -x /usr/sbin/brctl ]; then echo -n "Setting up bridge: /usr/sbin/brctl not found " false check_status fi case "$1" in start) echo -n "Adding bridge br0: " brctl addbr br0 check_status for n in ${BRIDGE_INTERFACES}; do echo -n "Adding ${n} to bridge: " brctl addif br0 ${n} # Bring up the interface unless its wireless # Wireless has to be configured before you can put it up if [ $? = 0 ] && [ ${n} != wlan0 ]; then ifconfig ${n} up; fi check_status done ;; stop) for n in ${BRIDGE_INTERFACES}; do echo -n "Removing ${n} from bridge br0: " ifconfig ${n} down 2>/dev/null brctl delif br0 ${n} check_status done echo -n "Removing bridge br0: " ifconfig br0 down 2>/dev/null brctl delbr br0 check_status ;; restart) $0 stop $0 start ;; status) brctl show ;; *) echo "Usage: $0 {start|stop|restart|status}" exit 1 esac