summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRémy Oudompheng <remy@archlinux.org>2011-07-14 16:07:25 +0200
committerRémy Oudompheng <remy@archlinux.org>2011-07-14 16:07:25 +0200
commitbe77b6956ed852aedd79c58a0c94944aa6832839 (patch)
tree88327e215cd7157180260f0ad7f98b5fdec933f7
parentc8bcc10c322cb281ab3abb78483eebf189aeede4 (diff)
parente6b95df3a80a92480a5ee062a13f5c844802098a (diff)
downloadnetctl-be77b6956ed852aedd79c58a0c94944aa6832839.tar.gz
netctl-be77b6956ed852aedd79c58a0c94944aa6832839.tar.xz
Merge remote-tracking branch 'kylef/tunnel'
-rw-r--r--docs/examples/tunnel-he-ipv611
-rw-r--r--src/connections/tunnel41
2 files changed, 52 insertions, 0 deletions
diff --git a/docs/examples/tunnel-he-ipv6 b/docs/examples/tunnel-he-ipv6
new file mode 100644
index 0000000..21b4579
--- /dev/null
+++ b/docs/examples/tunnel-he-ipv6
@@ -0,0 +1,11 @@
+CONNECTION='tunnel'
+DESCRIPTION='A example ipv6 tunnel with Hurricane Electric'
+
+INTERFACE='he-ipv6'
+MODE='sit'
+REMOTE='216.66.80.26'
+#LOCAL='172.16.0.1'
+
+IP6='static'
+ADDR6='2001:470:1f08:d87::2/64'
+ROUTES6=('::/0')
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: