diff options
author | Thomas S Hatch <thatch45@gmail.com> | 2011-02-05 19:20:26 +0100 |
---|---|---|
committer | Thomas Bächler <thomas@archlinux.org> | 2011-02-05 19:34:35 +0100 |
commit | a9d39a075bed12243e6571f475ddf1c2ee0b078b (patch) | |
tree | de132c8ddde89740067341c7aaf2dba821f13ad5 /src/connections | |
parent | 1c947900003ba1daf20ff3ccbf77fc945c98f836 (diff) | |
download | netctl-a9d39a075bed12243e6571f475ddf1c2ee0b078b.tar.gz netctl-a9d39a075bed12243e6571f475ddf1c2ee0b078b.tar.xz |
Add vlan support to netcfg
Diffstat (limited to 'src/connections')
-rwxr-xr-x | src/connections/vlan | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/connections/vlan b/src/connections/vlan new file mode 100755 index 0000000..7b81e7f --- /dev/null +++ b/src/connections/vlan @@ -0,0 +1,40 @@ +#! /bin/bash +. /usr/lib/network/network + +vlan_up() { + local vlan_interface + load_profile "$1" + + if [ -e /sys/class/net/$INTERFACE ]; then + report_fail "Interface $INTERFACE already exists." + exit 1 + else + ip link set $VLAN_PHYS_DEV up + ip link add link $VLAN_PHYS_DEV name $INTERFACE type vlan id $VLAN_ID >/dev/null 2>&1 + fi + bring_interface up "$INTERFACE" + "$CONN_DIR/ethernet" up "$1" + return 0 +} + +vlan_down() { + local vlan_interface + load_profile "$1" + + "$CONN_DIR/ethernet" down "$1" + bring_interface down "$INTERFACE" + ip link delete $INTERFACE >/dev/null 2>&1 + return 0 +} + +vlan_status() { + if [ -e /sys/class/net/$INTERFACE ]; then + return 0 + else + return 1 + fi +} + +vlan_$1 "$2" +exit $? +# vim: set ts=4 et sw=4: |