--- trunk/magellan-initscripts/etc/rc.d/init.d/network 2007/08/18 18:44:15 522 +++ trunk/magellan-initscripts/etc/rc.d/init.d/network 2007/12/13 12:06:22 636 @@ -1,5 +1,5 @@ #!/bin/bash -# $Header: /home/cvsd/magellan-cvs/magellan-src/magellan-initscripts/etc/rc.d/init.d/network,v 1.13 2007-08-18 18:44:15 niro Exp $ +# $Header: /home/cvsd/magellan-cvs/magellan-src/magellan-initscripts/etc/rc.d/init.d/network,v 1.14 2007-12-13 12:06:22 niro Exp $ #%rlevels: 0:k 1:k 2:k 3:s 4:s 5:s 6:k #%start: 20 @@ -60,6 +60,10 @@ local WIRELESS_NICK local WIRELESS_NWID local WIRELESS_POWER + local WIRELESS_WPA_DRIVER + + local BRIDGE_INTERFACES + local BRIDGE_STP source ${file} eval value=\$$(echo ${var}) @@ -68,7 +72,7 @@ checkconfig() { - if [ -z "${NETWORKING}" ] + if [[ -z ${NETWORKING} ]] then echo "NETWORKING missing in net.${interface}, aborted" exit 1 @@ -76,20 +80,20 @@ case "${NETWORKING}" in static) - if [ -z "${IP}" ] + if [[ -z ${IP} ]] then echo "IP missing in net.${interface}, aborted" exit 1 fi - if [ -z "${NETMASK}" ] + if [[ -z ${NETMASK} ]] then echo -n "NETMASK missing in net.${interface}, " echo "using 255.255.255.0" NETMASK=255.255.255.0 fi - if [ -z "${BROADCAST}" ] + if [[ -z ${BROADCAST} ]] then echo -n "BROADCAST missing in net.${interface}, " echo "using default address" @@ -97,7 +101,7 @@ ;; dhcp) - if [ -z "${DHCP_PROG}" ] + if [[ -z ${DHCP_PROG} ]] then echo "DHCP_PROG missing in net.${interface}, aborted" exit 1 @@ -251,6 +255,7 @@ { local iface="$1" local method="$2" + local bport if [[ -z ${iface} ]] then @@ -282,23 +287,35 @@ add) # setup the bridge device brctl addbr ${iface} - # enter promiscous mode - ifconfig ${BRIDGE_INTERFACE} 0.0.0.0 promisc - # now setup the bridge - brctl addif ${iface} ${BRIDGE_INTERFACE} + for bport in ${BRIDGE_INTERFACES} + do + # enter promiscous mode + ifconfig ${bport} 0.0.0.0 promisc + # now setup the bridge + brctl addif ${iface} ${bport} + done + # enable spanning-tree protocol + case BRIDGE_STP in + on|off) brctl stp ${iface} ${BRIDGE_STP} ;; + *) echo "BRIDGE: unkown value \$BRIDGE_STP='$BRIDGE_STP'."; return 1 ;; + esac ;; + remove) - # bring the interface down - ifconfig ${BRIDGE_INTERFACE} down - # remove the interface from the bridge - brctl delif ${iface} ${BRIDGE_INTERFACE} + for bport in ${BRIDGE_INTERFACE} + do + # bring the interface down + ifconfig ${bport} down + # remove the interface from the bridge + brctl delif ${iface} ${bport} + done # bring the bridge down brctl delbr ${iface} ;; esac - + # unset the bridge variable to be safe - unset BRIDGE_INTERFACE + unset BRIDGE_INTERFACES # continue to setup generic networking }