diff options
author | Kyle Fuller <inbox@kylefuller.co.uk> | 2011-07-12 04:44:47 +0200 |
---|---|---|
committer | Kyle Fuller <inbox@kylefuller.co.uk> | 2011-07-12 04:44:47 +0200 |
commit | e6b95df3a80a92480a5ee062a13f5c844802098a (patch) | |
tree | e9bb8e748bf287e1ecf6600ec36c33f11cb0e947 /src/connections | |
parent | 4ff803521951463582e4fc522c5965c05233883b (diff) | |
download | netctl-e6b95df3a80a92480a5ee062a13f5c844802098a.tar.gz netctl-e6b95df3a80a92480a5ee062a13f5c844802098a.tar.xz |
Add support for tunnels
Diffstat (limited to 'src/connections')
-rw-r--r-- | src/connections/tunnel | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/connections/tunnel b/src/connections/tunnel new file mode 100644 index 0000000..613cc67 --- /dev/null +++ b/src/connections/tunnel @@ -0,0 +1,41 @@ +#! /bin/bash +. /usr/lib/network/network + +tunnel_up() { + load_profile "$1" + + if [ -e "/sys/class/net/$INTERFACE" ]; then + report_fail "Interface $INTERFACE already exists." + exit 1 + else + ip tunnel add "$INTERFACE" mode "$MODE" remote "$REMOTE" + fi + + if [[ -n "$LOCAL" ]]; then + ip tunnel change "$INTERFACE" local "$LOCAL" + fi + + bring_interface up "$INTERFACE" + + "$CONN_DIR/ethernet" up "$1" + return 0 +} + +tunnel_down() { + load_profile "$1" + + "$CONN_DIR/ethernet" down "$1" + bring_interface down "$INTERFACE" + ip tunnel del "$INTERFACE" + + return 0 +} + +tunnel_status() { + true +} + +tunnel_$1 "$2" +exit $? + +# vim: set ts=4 et sw=4: |