summaryrefslogtreecommitdiffstats
path: root/src/lib/connections/tuntap
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/tuntap
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/tuntap')
-rw-r--r--src/lib/connections/tuntap32
1 files changed, 14 insertions, 18 deletions
diff --git a/src/lib/connections/tuntap b/src/lib/connections/tuntap
index 6985c8c..1ff5203 100644
--- a/src/lib/connections/tuntap
+++ b/src/lib/connections/tuntap
@@ -1,28 +1,24 @@
-#! /bin/bash
-. /usr/lib/network/network
+# Contributed by: Rémy Oudompheng <remy@archlinux.org>
-tuntap_up() {
- load_profile "$1"
+. "$SUBR_DIR/ip"
- if [[ -e /sys/class/net/$INTERFACE ]]; then
- report_fail "Interface $INTERFACE already exists."
- exit 1
+tuntap_up() {
+ if is_interface "$Interface"; then
+ report_error "Interface '$Interface' already exists"
+ return 1
else
- ip tuntap add dev "$INTERFACE" mode "$MODE" \
- user "$USER" group "$GROUP"
+ ip tuntap add dev "$Interface" mode "$Mode" \
+ user "$User" group "$Group"
fi
- IP=${IP-no} "$CONN_DIR/ethernet" up "$1"
- return 0
+ bring_interface_up "$Interface"
+ IP=${IP-no} ip_set
}
tuntap_down() {
- load_profile "$1"
-
- "$CONN_DIR/ethernet" down "$1"
- ip tuntap del dev "$INTERFACE" mode "$MODE"
- return 0
+ ip_unset
+ bring_interface_down "$Interface"
+ ip tuntap del dev "$Interface" mode "$Mode"
}
-tuntap_$1 "$2"
-exit $?
+
# vim: set ts=4 et sw=4 tw=0: