summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2015-06-17 18:51:07 +0200
committerIsmaël Bouya <ismael.bouya@normalesup.org>2015-06-17 18:51:07 +0200
commitbbe3d612a4a5e1ef32c26b5cb49fc549762d4b35 (patch)
treef73e014bc59acadb0b8692dc8004310563773abf
parent5618bf796685355b38edade948221e713f0f99f8 (diff)
downloadhosts-bbe3d612a4a5e1ef32c26b5cb49fc549762d4b35.tar.gz
hosts-bbe3d612a4a5e1ef32c26b5cb49fc549762d4b35.tar.zst
hosts-bbe3d612a4a5e1ef32c26b5cb49fc549762d4b35.zip
Android scripts
-rw-r--r--[-rwxr-xr-x]ImmaeEu-down11
-rw-r--r--[-rwxr-xr-x]ImmaeEu-up28
2 files changed, 15 insertions, 24 deletions
diff --git a/ImmaeEu-down b/ImmaeEu-down
index 8e562a4..db41301 100755..100644
--- a/ImmaeEu-down
+++ b/ImmaeEu-down
@@ -1,11 +1,12 @@
1#!/bin/sh 1#!/bin/sh
2# This file closes down the tap device. 2# This file closes down the tap device.
3 3
4source /tmp/tinc_$NETNAME 4source /sdcard/.tinc/vars
5rm -f /tmp/tinc_$NETNAME 5rm /sdcard/.tinc/vars
6
6ip -6 route del default via $GWIP 7ip -6 route del default via $GWIP
7for MYIP in $MYIPS; do 8for MYIP in $MYIPS; do
8 ip -6 addr del $MYIP/96 dev $INTERFACE 9 ip -6 addr del $MYIP/96 dev vpn6
9done 10done
10ip -6 link set $INTERFACE down 11ip -6 link set vpn6 down
11 12
diff --git a/ImmaeEu-up b/ImmaeEu-up
index 00eb60f..95004f3 100755..100644
--- a/ImmaeEu-up
+++ b/ImmaeEu-up
@@ -1,23 +1,13 @@
1#!/bin/sh 1#!/system/xbin/sh
2# This file sets up the tap device.
3# It gives you the freedom to do anything you want with it.
4# Use the correct name for the tap device:
5# The environment variable $INTERFACE is set to the right name
6# on most platforms, but if it doesn't work try to set it manually.
7 2
8# Give it the right ip and netmask. Remember, the subnet of the 3SUBDOMAIN=$(cat /sdcard/.tinc/tinc_domaine | tr -c -d "[a-zA-Z0-9.]")
9# tap device must be larger than that of the individual Subnets 4
10# as defined in the host configuration file! 5MYIPS=$(nslookup $SUBDOMAIN.immae.eu |sed -n "/$SUBDOMAIN.immae.eu/"',$p' | grep ^Address | sed -e "s/^[^:]*:[^0-9]*//" | tr '\n' ' ')
11SUBDOMAIN=`cat /etc/tinc/$NETNAME/tinc_domaine` 6GWIP=$(nslookup vpn.immae.eu |sed -n "/vpn.immae.eu/"',$p' | grep ^Address | head -n1 | sed -e "s/^[^:]*:[^0-9]*//" | tr '\n' ' ')
12while [ -z "$MYIPS" -o -z "$GWIP" ]; do 7
13 MYIPS=`getent hosts ${SUBDOMAIN}.immae.eu | cut -d' ' -f1 | tr "\\n" ' '` 8echo -e "MYIPS=\"$MYIPS\"\nGWIP=\"$GWIP\"" > /sdcard/.tinc/vars
14 GWIP=`getent hosts vpn.immae.eu | head -n1 | cut -d' ' -f1` 9ip -6 link set vpn6 up mtu 1280
15 sleep 5
16done
17rm -f /tmp/tinc_$NETNAME
18echo -e "MYIPS=\"$MYIPS\"\nGWIP=\"$GWIP\"" > /tmp/tinc_$NETNAME
19ip -6 link set $INTERFACE up mtu 1280
20for MYIP in $MYIPS; do 10for MYIP in $MYIPS; do
21 ip -6 addr add $MYIP/96 dev $INTERFACE 11 ip -6 addr add $MYIP/96 dev vpn6
22done 12done
23ip -6 route add default via $GWIP 13ip -6 route add default via $GWIP