diff options
author | Jouke Witteveen <j.witteveen@gmail.com> | 2012-12-28 02:43:13 +0100 |
---|---|---|
committer | Jouke Witteveen <j.witteveen@gmail.com> | 2012-12-28 02:57:35 +0100 |
commit | 27c11787d7c58b02f12d7afd476ea66abfeecaaf (patch) | |
tree | e203812a9e6d2a901568ca36de3b1fc7380a369b /src/lib/connections/tunnel | |
parent | 4e457e0efd0e5fd5df24c7e9ed63b02d0196ea8d (diff) | |
download | netctl-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/tunnel')
-rw-r--r-- | src/lib/connections/tunnel | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/src/lib/connections/tunnel b/src/lib/connections/tunnel index 6cefc5c..f202371 100644 --- a/src/lib/connections/tunnel +++ b/src/lib/connections/tunnel @@ -1,34 +1,28 @@ -#! /bin/bash -. /usr/lib/network/network +# Contributed by: Kyle Fuller <inbox@kylefuller.co.uk> -tunnel_up() { - load_profile "$1" +. "$SUBR_DIR/ip" - if [[ -e "/sys/class/net/$INTERFACE" ]]; then - report_fail "Interface $INTERFACE already exists." - exit 1 +tunnel_up() { + if is_interface "$Interface"; then + report_error "Interface '$Interface' already exists" + return 1 else - ip tunnel add "$INTERFACE" mode "$MODE" remote "$REMOTE" + ip tunnel add "$Interface" mode "$Mode" remote "$Remote" fi - if [[ -n "$LOCAL" ]]; then - ip tunnel change "$INTERFACE" local "$LOCAL" + if [[ -n "$Local" ]]; then + ip tunnel change "$Interface" local "$Local" fi - "$CONN_DIR/ethernet" up "$1" - return 0 + bring_interface_up "$Interface" + ip_set } tunnel_down() { - load_profile "$1" - - "$CONN_DIR/ethernet" down "$1" - ip tunnel del "$INTERFACE" - - return 0 + ip_unset + bring_interface_down "$Interface" + ip tunnel del "$Interface" } -tunnel_$1 "$2" -exit $? # vim: set ts=4 et sw=4: |