From 4e457e0efd0e5fd5df24c7e9ed63b02d0196ea8d Mon Sep 17 00:00:00 2001 From: Jouke Witteveen Date: Fri, 28 Dec 2012 02:38:58 +0100 Subject: Forking netcfg to netctl (1/2) This commit contains the moving of files. --- src/lib/connections/vlan | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/lib/connections/vlan (limited to 'src/lib/connections/vlan') diff --git a/src/lib/connections/vlan b/src/lib/connections/vlan new file mode 100644 index 0000000..75c7fa9 --- /dev/null +++ b/src/lib/connections/vlan @@ -0,0 +1,28 @@ +#! /bin/bash +. /usr/lib/network/network + +vlan_up() { + load_profile "$1" + + if [[ -e "/sys/class/net/$INTERFACE" ]]; then + report_fail "Interface $INTERFACE already exists." + exit 1 + else + bring_interface up "$VLAN_PHYS_DEV" + ip link add link "$VLAN_PHYS_DEV" name "$INTERFACE" type vlan id "$VLAN_ID" + fi + "$CONN_DIR/ethernet" up "$1" + return 0 +} + +vlan_down() { + load_profile "$1" + + "$CONN_DIR/ethernet" down "$1" + ip link delete "$INTERFACE" + return 0 +} + +vlan_$1 "$2" +exit $? +# vim: set ts=4 et sw=4: -- cgit v1.2.3-24-g4f1b