tinc_gui icon indicating copy to clipboard operation
tinc_gui copied to clipboard

Android tinc wrong host-up

Open rogerou opened this issue 6 years ago • 0 comments

#!/system/bin/sh 
echo $REMOTEADDRESS
echo $INTERFACE 
VPN_GATEWAY=10.0.0.254
# Fetch the first default gateway from the current routing tables
ORIGINAL_GATEWAY=$(for a in $(ip rule show | grep lookup | sed -r 's/.* lookup ([^ ]+).*/\1/'); do ip route show table $a | grep ^default | cut -d ' ' -f 2-5; done | head -1)
echo $ORIGINAL_GATEWAY

# Use new routing table 100, to have higher priority than lollipop's ones
ip rule add prio 100 from all lookup 100
ip route add table 100 $REMOTEADDRESS $ORIGINAL_GATEWAY 
ip route add table 100 $VPN_GATEWAY dev $INTERFACE 
ip route add table 100 0.0.0.0/1 via $VPN_GATEWAY dev $INTERFACE 
ip route add table 100 128.0.0.0/1 via $VPN_GATEWAY dev $INTERFACE

cmd not complete ,should be replaced with

#!/system/bin/sh 
echo $REMOTEADDRESS
echo $INTERFACE 
VPN_GATEWAY=10.0.0.254
# Fetch the first default gateway from the current routing tables
ORIGINAL_GATEWAY=$(for TABLE in $(ip rule show | grep lookup | sed -r 's/.* lookup ([^ ]+).*/\1/') ; do ip route show table $TABLE | grep ^default | cut -d ' ' -f 2-5 ; done | grep -v dummy | head -1)
echo $ORIGINAL_GATEWAY

# Use new routing table 100, to have higher priority than lollipop's ones
ip rule add prio 100 from all lookup 100
ip route add table 100 $REMOTEADDRESS $ORIGINAL_GATEWAY 
ip route add table 100 $VPN_GATEWAY dev $INTERFACE 
ip route add table 100 0.0.0.0/1 via $VPN_GATEWAY dev $INTERFACE 
ip route add table 100 128.0.0.0/1 via $VPN_GATEWAY dev $INTERFACE

rogerou avatar Aug 28 '18 12:08 rogerou