summaryrefslogtreecommitdiffstats
path: root/src/lib/connections/vlan
diff options
context:
space:
mode:
authorJouke Witteveen <j.witteveen@gmail.com>2012-12-28 02:43:13 +0100
committerJouke Witteveen <j.witteveen@gmail.com>2012-12-28 02:57:35 +0100
commit27c11787d7c58b02f12d7afd476ea66abfeecaaf (patch)
treee203812a9e6d2a901568ca36de3b1fc7380a369b /src/lib/connections/vlan
parent4e457e0efd0e5fd5df24c7e9ed63b02d0196ea8d (diff)
downloadnetctl-27c11787d7c58b02f12d7afd476ea66abfeecaaf.tar.gz
netctl-27c11787d7c58b02f12d7afd476ea66abfeecaaf.tar.xz
Forking netcfg to netctl (2/2)
This commit contains the refactoring and rewriting of code.
Diffstat (limited to 'src/lib/connections/vlan')
-rw-r--r--src/lib/connections/vlan34
1 files changed, 16 insertions, 18 deletions
diff --git a/src/lib/connections/vlan b/src/lib/connections/vlan
index 75c7fa9..86d1a2d 100644
--- a/src/lib/connections/vlan
+++ b/src/lib/connections/vlan
@@ -1,28 +1,26 @@
-#! /bin/bash
-. /usr/lib/network/network
+# Contributed by: Thomas S Hatch <thatch45@gmail.com>
-vlan_up() {
- load_profile "$1"
+. "$CONN_DIR/ethernet"
- if [[ -e "/sys/class/net/$INTERFACE" ]]; then
- report_fail "Interface $INTERFACE already exists."
- exit 1
+vlan_up() {
+ if [[ ${#BindsToInterfaces} -ne 1 ]]; then
+ report_error "No unique physical device for VLAN interface '$Interface' specified"
+ return 1
+ fi
+ if is_interface "$Interface"; then
+ report_error "Interface '$Interface' already exists"
+ return 1
else
- bring_interface up "$VLAN_PHYS_DEV"
- ip link add link "$VLAN_PHYS_DEV" name "$INTERFACE" type vlan id "$VLAN_ID"
+ bring_interface_up "$BindsToInterfaces"
+ ip link add link "$BindsToInterfaces" name "$Interface" type vlan id "$VLANID"
fi
- "$CONN_DIR/ethernet" up "$1"
- return 0
+
+ ethernet_up
}
vlan_down() {
- load_profile "$1"
-
- "$CONN_DIR/ethernet" down "$1"
- ip link delete "$INTERFACE"
- return 0
+ ethernet_down
+ ip link delete "$Interface"
}
-vlan_$1 "$2"
-exit $?
# vim: set ts=4 et sw=4: