Commit 80ad74f0 authored by root's avatar root

removed mtu glue, added avoidance of duplicate IPv6 Node Address on changing...

removed mtu glue, added avoidance of duplicate IPv6 Node Address on changing segment. Prepared for additional info in DNS-Response.
parent ba16b8bd
#!/bin/sh
if [ $(ps | grep -c "{$(basename $0)}") -gt 4 ]; then
echo started twice
exit 1
if [ $(ps | grep -c "{$(basename $0)}") -gt 4 ]; then
echo started twice
exit 1
fi
if [ $(ps | grep -c "fastd") -lt 2 ]; then
echo fastd not running
exit 0
if [ $(ps | grep -c "fastd") -lt 2 ]; then
echo fastd not running
exit 0
fi
if [ "$(uci get fastd.mesh_vpn_backbone.auto_segment)" = "0" ]; then
echo auto_segment disabled
exit 0
fi
echo auto_segment disabled
exit 0
fi
NODEID=`uci get network.bat0.macaddr | sed 's/://g'`
PUBKEY=`/etc/init.d/fastd show_key mesh_vpn | cut -c1-12`
SEGINFO=`nslookup ffs-$NODEID-$PUBKEY.segassign.freifunk-stuttgart.de [::1]:54 | tail -n1`
NODEID=$(uci get network.bat0.macaddr | sed 's/://g')
PUBKEY=$(/etc/init.d/fastd show_key mesh_vpn | cut -c1-12)
SEGINFO=$(nslookup ffs-$NODEID-$PUBKEY.segassign.freifunk-stuttgart.de [::1]:54 | tail -n1)
if [ -z "$SEGINFO" ]; then
echo Node not known
exit 1
echo Node not known
exit 1
fi
SEGINFO=${SEGINFO/Address 1: 2001:2:0:711::/}
NEWMTU=$(echo $SEGINFO | cut -d':' -s -f1)
SEGMENT=$(echo $SEGINFO | cut -d':' -f2)
let PORT=SEGMENT+10040
......@@ -30,27 +27,21 @@ SEGNUM=$(printf "%02d" $SEGMENT)
CHANGED=0
for i in `seq 1 10`;
do
GW=$(printf "gw%02d" $i)
OLDPEER=`uci get fastd.mesh_vpn_backbone_peer_$GW.remote`
NEWPEER="\"${GW}s$SEGNUM.freifunk-stuttgart.de\" port $PORT"
GW=$(printf "gw%02d" $i)
OLDPEER=$(uci get fastd.mesh_vpn_backbone_peer_$GW.remote)
NEWPEER="\"${GW}s$SEGNUM.freifunk-stuttgart.de\" port $PORT"
if [ "$NEWPEER" != "$OLDPEER" ]; then
uci set fastd.mesh_vpn_backbone_peer_$GW.remote="$NEWPEER"
CHANGED=1
fi
if [ "$NEWPEER" != "$OLDPEER" ]; then
uci set fastd.mesh_vpn_backbone_peer_$GW.remote="$NEWPEER"
CHANGED=1
fi
done
if [ -n "$NEWMTU" ]; then
OLDMTU=`uci get fastd.mesh_vpn.mtu`
if [ "$NEWMTU" != "$OLDMTU" ]; then
uci set fastd.mesh_vpn.mtu="$NEWMTU"
CHANGED=1
fi
fi
if [ "$CHANGED" = "1" ]; then
/etc/init.d/fastd restart
echo Set Segment: $SEGNUM, MTU: $NEWMTU
/sbin/ifdown client
/etc/init.d/fastd restart
/sbin/ifup client
echo Set Segment: $SEGNUM
else
echo No changes
echo No changes
fi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment