summaryrefslogtreecommitdiffstats
path: root/retiolum/openwrt/tinc-up
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2012-03-10 01:01:34 +0100
committermakefu <github@syntax-fehler.de>2012-03-10 01:01:34 +0100
commit1acf286d996776fd833055ece0eb0887e750567e (patch)
treecaaa055fe0330af1d9ccc1a7df75b717a7af541d /retiolum/openwrt/tinc-up
parentfe7570c86536b6ca84aad115bc516b5e4f9c3990 (diff)
parenta427ce7b035ebc7cef6bc5954fa73edf24e9b116 (diff)
Merge branch 'master' of github.com:krebscode/painload
Diffstat (limited to 'retiolum/openwrt/tinc-up')
-rwxr-xr-xretiolum/openwrt/tinc-up19
1 files changed, 19 insertions, 0 deletions
diff --git a/retiolum/openwrt/tinc-up b/retiolum/openwrt/tinc-up
new file mode 100755
index 00000000..3b8bb978
--- /dev/null
+++ b/retiolum/openwrt/tinc-up
@@ -0,0 +1,19 @@
+# source: krebscode/painload/retiolum/scripts/tinc_setup/tinc-up
+
+dirname="`dirname "$0"`"
+
+conf=$dirname/tinc.conf
+
+name=`sed -n 's|^ *Name *= *\([^ ]*\) *$|\1|p' $conf`
+
+host=$dirname/hosts/$name
+
+addr4=`sed -n 's|^ *Subnet *= *\(10[.][^ ]*\) *$|\1|p' $host`
+if [ "$addr4" != '' ];then
+ ifconfig $INTERFACE $addr4
+ route add -net 10.243.0.0 netmask 255.255.0.0 dev retiolum
+else
+ addr4=`sed -n 's|^ *Subnet *= *\(42[.][^ ]*\) *$|\1|p' $host`
+ ifconfig $INTERFACE $addr4
+ route add -net 42.0.0.0 netmask 255.0.0.0 dev retiolum
+fi