diff options
author | Bill Nottingham <notting@redhat.com> | 2003-09-09 04:47:02 +0000 |
---|---|---|
committer | Bill Nottingham <notting@redhat.com> | 2003-09-09 04:47:02 +0000 |
commit | c91600dea4d59ce0812fe66e2688ad7f01e281a0 (patch) | |
tree | a17080dd8b57186dc24fec3b05b9da01e1b604f4 | |
parent | 196aeeca3e1e15b24bd9b38af8eb9b159639d90b (diff) | |
download | initscripts-c91600dea4d59ce0812fe66e2688ad7f01e281a0.tar initscripts-c91600dea4d59ce0812fe66e2688ad7f01e281a0.tar.gz initscripts-c91600dea4d59ce0812fe66e2688ad7f01e281a0.tar.bz2 initscripts-c91600dea4d59ce0812fe66e2688ad7f01e281a0.tar.xz initscripts-c91600dea4d59ce0812fe66e2688ad7f01e281a0.zip |
bridging support (<dwmw2@redhat.com>)
-rwxr-xr-x | rc.d/init.d/network | 21 | ||||
-rwxr-xr-x | sysconfig/network-scripts/ifdown | 10 | ||||
-rwxr-xr-x | sysconfig/network-scripts/ifup | 17 |
3 files changed, 42 insertions, 6 deletions
diff --git a/rc.d/init.d/network b/rc.d/init.d/network index fabf2ff4..3cbf9c7c 100755 --- a/rc.d/init.d/network +++ b/rc.d/init.d/network @@ -98,12 +98,14 @@ case "$1" in cipeinterfaces="" xdslinterfaces="" + bridgeinterfaces="" # bring up all other interfaces configured to come up at boot time for i in $interfaces; do eval $(LANG=C fgrep "DEVICE=" ifcfg-$i) eval $(LANG=C fgrep "TYPE=" ifcfg-$i) eval $(LANG=C fgrep "SLAVE=" ifcfg-$i) + eval $(LANG=C fgrep "BRIDGE=" ifcfg-$i) if [ -z "$DEVICE" ] ; then DEVICE="$i"; fi @@ -116,6 +118,11 @@ case "$1" in continue fi + if [ -n "$BRIDGE" ]; then + bridgeinterfaces="$bridgeinterfaces $DEVICE" + continue + fi + if [ "$SLAVE" = "yes" ]; then continue fi @@ -134,7 +141,7 @@ case "$1" in done # Bring up xDSL and CIPE interfaces - for i in $xdslinterfaces $cipeinterfaces ; do + for i in $bridgeinterfaces $xdslinterfaces $cipeinterfaces ; do if ! LANG=C egrep -L "^ONBOOT=['\"]?[Nn][Oo]['\"]?" ifcfg-$i >/dev/null 2>&1 ; then # If we're in confirmation mode, get user confirmation. if [ -f /var/run/confirm ]; then @@ -186,22 +193,24 @@ case "$1" in fi cipeinterfaces="" - bondinterfaces="" xdslinterfaces="" + bridgeinterfaces="" # get list of bonding, cipe, and xdsl interfaces for i in $interfaces; do eval $(LANG=C fgrep "DEVICE=" ifcfg-$i) eval $(LANG=C fgrep "TYPE=" ifcfg-$i) + eval $(LANG=C fgrep "BRIDGE=" ifcfg-$i) + if [ -z "$DEVICE" ] ; then DEVICE="$i"; fi if [ "${DEVICE##cipcb}" != "$DEVICE" ] ; then cipeinterfaces="$cipeinterfaces $DEVICE" continue fi - if [ "${DEVICE##bond}" != "$DEVICE" ] ; then - bondinterfaces="$bondinterfaces $DEVICE" - continue + if [ -n "$BRIDGE" ]; then + bridgeinterfaces="$bridgeinterfaces $DEVICE" + continue fi if [ "$TYPE" = "xDSL" ]; then xdslinterfaces="$xdslinterfaces $DEVICE" @@ -209,7 +218,7 @@ case "$1" in fi done - for i in $bondinterfaces $cipeinterfaces $xdslinterfaces ; do + for i in $cipeinterfaces $xdslinterfaces $bridgeinterfaces ; do eval $(fgrep "DEVICE=" ifcfg-$i) if [ -z "$DEVICE" ] ; then DEVICE="$i"; fi diff --git a/sysconfig/network-scripts/ifdown b/sysconfig/network-scripts/ifdown index 65ef52e1..9622f0ca 100755 --- a/sysconfig/network-scripts/ifdown +++ b/sysconfig/network-scripts/ifdown @@ -44,6 +44,12 @@ if [ -x $OTHERSCRIPT ]; then exec $OTHERSCRIPT $CONFIG $2 fi +if [ -n "${BRIDGE}" -a -x /usr/sbin/brctl ]; then + /sbin/ip link set ${DEVICE} down + /usr/sbin/brctl delif ${BRIDGE} ${DEVICE} + exit 0 +fi + . /etc/sysconfig/network # Check to make sure the device is actually up @@ -122,6 +128,10 @@ if [ "$retcode" = 0 ] ; then # the interface went down. fi +if [ "$TYPE" = "Bridge" -a -x /usr/sbin/brctl ]; then + /usr/sbin/brctl delbr ${DEVICE} +fi + if [ -n "$VLAN" -a -x /sbin/vconfig ]; then # 802.1q VLAN if echo ${DEVICE} | LANG=C egrep -v '(:)' | LANG=C egrep -q 'eth[0-9][0-9]*\.[0-9][0-9]?[0-9]?[0-9]?' ; then diff --git a/sysconfig/network-scripts/ifup b/sysconfig/network-scripts/ifup index d50380b2..96f7128e 100755 --- a/sysconfig/network-scripts/ifup +++ b/sysconfig/network-scripts/ifup @@ -53,6 +53,8 @@ then exit 0 fi +[ "${TYPE}" = "Bridge" ] && exit 0 + # Ethernet 802.1Q VLAN support if [ -x /sbin/vconfig -a "${VLAN}" = "yes" ]; then if echo ${DEVICE} | LANG=C egrep -v '(:)' | LANG=C egrep -q 'eth[0-9][0-9]*\.[0-9][0-9]?[0-9]?[0-9]?' ; then @@ -151,6 +153,21 @@ if [ -n "${HWADDR}" ]; then fi fi +if [ "${TYPE}" = "Bridge" -a -x /usr/sbin/brctl ]; then + /sbin/ip link set ${DEVICE} down 2>/dev/null + /usr/sbin/brctl delbr ${DEVICE} 2>/dev/null + /usr/sbin/brctl addbr ${DEVICE} + [ -n "${DELAY}" ] && /usr/sbin/brctl setfd ${DEVICE} ${DELAY} + [ -n "${GCINT}" ] && /usr/sbin/brctl setgcint ${DEVICE} ${GCINT} +fi + +if [ -n "${BRIDGE}" -a -x /usr/sbin/brctl ]; then + /sbin/ip addr flush dev ${DEVICE} 2>/dev/null + /sbin/ip link set ${DEVICE} up + /usr/sbin/brctl addif ${BRIDGE} ${DEVICE} + exit $? +fi + # now check the real state is_available ${REALDEVICE} || { if [ "$?" = "1" ] ; then |