diff options
author | Waldemar Brodkorb <wbx@openadk.org> | 2009-12-29 22:25:14 +0100 |
---|---|---|
committer | Waldemar Brodkorb <wbx@openadk.org> | 2009-12-29 22:25:14 +0100 |
commit | 8d7b67dcc1e0f49d11bb98614dc1aad30ddfb4a1 (patch) | |
tree | 06f907b074ad1c5181b9ee2904d849235ef2704b /package/base-files | |
parent | 48ed66e5cb97df911aaf2d45200b5f1113e8261d (diff) |
make vlan configuration work with ifup/ifdown
Diffstat (limited to 'package/base-files')
-rwxr-xr-x | package/base-files/extra/etc/network/if-post-down.d/01-bridge | 2 | ||||
-rwxr-xr-x | package/base-files/extra/etc/network/if-post-down.d/02-vlan | 10 | ||||
-rwxr-xr-x | package/base-files/extra/etc/network/if-pre-up.d/01-atm | 6 | ||||
-rwxr-xr-x | package/base-files/extra/etc/network/if-pre-up.d/02-vlan | 35 | ||||
-rwxr-xr-x | package/base-files/extra/etc/network/if-pre-up.d/03-bridge (renamed from package/base-files/extra/etc/network/if-pre-up.d/02-bridge) | 5 | ||||
-rwxr-xr-x[-rw-r--r--] | package/base-files/extra/etc/network/if-up.d/01-bridge | 1 |
6 files changed, 51 insertions, 8 deletions
diff --git a/package/base-files/extra/etc/network/if-post-down.d/01-bridge b/package/base-files/extra/etc/network/if-post-down.d/01-bridge index eda1fe3bf..47f3c976b 100755 --- a/package/base-files/extra/etc/network/if-post-down.d/01-bridge +++ b/package/base-files/extra/etc/network/if-post-down.d/01-bridge @@ -22,3 +22,5 @@ for IF in $INTERFACES; do done ip link set down dev $IFACE || exit 1 +brctl delbr $IFACE +exit 0 diff --git a/package/base-files/extra/etc/network/if-post-down.d/02-vlan b/package/base-files/extra/etc/network/if-post-down.d/02-vlan new file mode 100755 index 000000000..e448a7641 --- /dev/null +++ b/package/base-files/extra/etc/network/if-post-down.d/02-vlan @@ -0,0 +1,10 @@ +#!/bin/sh + +[ -x /sbin/vconfig ] || exit 0 + +[ -e /proc/net/vlan/$IFACE ] && ( + ip link set down dev $IFACE + vconfig rem $IFACE +) + +exit 0 diff --git a/package/base-files/extra/etc/network/if-pre-up.d/01-atm b/package/base-files/extra/etc/network/if-pre-up.d/01-atm index 0abf9d368..5c168c001 100755 --- a/package/base-files/extra/etc/network/if-pre-up.d/01-atm +++ b/package/base-files/extra/etc/network/if-pre-up.d/01-atm @@ -1,9 +1,6 @@ #!/bin/sh -if [ ! -x /usr/sbin/br2684ctl ] -then - exit 0 -fi +[ -x /usr/sbin/br2684ctl ] || exit 0 [ "${IFACE%%[0-9]*}" = "nas" ] || exit 0 @@ -40,4 +37,5 @@ esac br2684ctl -b -c ${IFACE##*[a-z]} -e $encap -p $payload -a $IF_ATM_VPI.$IF_ATM_VCI ifconfig nas${IFACE##*[a-z]} up + exit 0 diff --git a/package/base-files/extra/etc/network/if-pre-up.d/02-vlan b/package/base-files/extra/etc/network/if-pre-up.d/02-vlan new file mode 100755 index 000000000..09b9cf0da --- /dev/null +++ b/package/base-files/extra/etc/network/if-pre-up.d/02-vlan @@ -0,0 +1,35 @@ +#!/bin/sh + +[ -x /sbin/vconfig ] || exit 0 + +case "$IFACE" in + vlan*) + vconfig set_name_type VLAN_PLUS_VID_NO_PAD + VLANID=`echo $IFACE|sed "s/vlan*//"` + ;; + eth*.*) + vconfig set_name_type DEV_PLUS_VID_NO_PAD + VLANID=`echo $IFACE|sed "s/eth[0-9][0-9]*\.*//g"` + IF_VLAN_RAW_DEVICE=`echo $IFACE|sed "s/\(eth[0-9][0-9]*\)\..*/\1/"` + ;; + *) + exit 0 + ;; +esac + +if [ "$IF_VLAN_RAW_DEVICE" != "" ]; then + if ! grep -q "$IF_VLAN_RAW_DEVICE" /proc/net/dev + then + echo "$IF_VLAN_RAW_DEVICE does not exist, unable to create $IFACE" + exit 1 + fi + ip link set up dev $IF_VLAN_RAW_DEVICE + vconfig add $IF_VLAN_RAW_DEVICE $VLANID + if [ "$IF_MAC_ADDRESS" != "" ] + then + ip link set $IF_VLAN_RAW_DEVICE.$VLANID address $IF_MAC_ADDRESS + fi + ip link set up dev $IF_VLAN_RAW_DEVICE.$VLANID +fi + +exit 0 diff --git a/package/base-files/extra/etc/network/if-pre-up.d/02-bridge b/package/base-files/extra/etc/network/if-pre-up.d/03-bridge index 766084de1..41ddb2b58 100755 --- a/package/base-files/extra/etc/network/if-pre-up.d/02-bridge +++ b/package/base-files/extra/etc/network/if-pre-up.d/03-bridge @@ -1,9 +1,6 @@ #!/bin/sh -if [ ! -x /usr/sbin/brctl ] -then - exit 0 -fi +[ -x /usr/sbin/brctl ] || exit 0 case "$IF_BRIDGE_PORTS" in "") diff --git a/package/base-files/extra/etc/network/if-up.d/01-bridge b/package/base-files/extra/etc/network/if-up.d/01-bridge index 786efe0f8..e5962f12f 100644..100755 --- a/package/base-files/extra/etc/network/if-up.d/01-bridge +++ b/package/base-files/extra/etc/network/if-up.d/01-bridge @@ -1,3 +1,4 @@ #!/bin/sh [ "${IFACE%%[0-9]*}" = "br" ] && ip link set up dev $IFACE +exit 0 |