summaryrefslogtreecommitdiffstats
path: root/retiolum/openwrt/tinc-up
blob: 3b8bb9784cca0735a24f9c3a04f64574225876e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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