From 436a859d3b2d3c1fd6eef246b9aacd8e870697aa Mon Sep 17 00:00:00 2001 From: FFS-Roland <roland.volkmann@t-online.de> Date: Wed, 28 Dec 2016 01:02:39 +0100 Subject: [PATCH] DNS Request with NodeID + Fastd-Key, prepared for reply with MTU. --- ffs-set-segment/files/usr/sbin/ffs-set-segment | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/ffs-set-segment/files/usr/sbin/ffs-set-segment b/ffs-set-segment/files/usr/sbin/ffs-set-segment index 7ace458..05abd27 100755 --- a/ffs-set-segment/files/usr/sbin/ffs-set-segment +++ b/ffs-set-segment/files/usr/sbin/ffs-set-segment @@ -16,15 +16,17 @@ fi NODEID=`uci get network.bat0.macaddr | sed 's/://g'` PUBKEY=`/etc/init.d/fastd show_key mesh_vpn | cut -c1-12` -SEGMENT=`nslookup ffs-$NODEID-$PUBKEY.segassign.freifunk-stuttgart.de [::1]:54 | tail -n1` -if [[ -z "${SEGMENT// }" ]]; then +SEGINFO=`nslookup ffs-$NODEID-$PUBKEY.segassign.freifunk-stuttgart.de [::1]:54 | tail -n1` +if [ -z "$SEGINFO" ]; then echo Node not known exit 1 fi -SEGMENT=${SEGMENT/Address 1: 2001:2:0:711::/} +SEGINFO=${SEGINFO/Address 1: 2001:2:0:711::/} +VPNMTU=$(echo $SEGINFO | cut -d':' -s -f1) +SEGMENT=$(echo $SEGINFO | cut -d':' -f2) + let PORT=SEGMENT+10040 SEGNUM=$(printf "%02d" $SEGMENT) - CHANGED=0 for i in `seq 1 10`; do @@ -39,6 +41,10 @@ do done if [ "$CHANGED" = "1" ]; then + if [ -n "$VPNMTU" ]; then + uci set fastd.mesh_vpn.mtu="$VPNMTU" + echo MTU set to $VPNMTU + fi /etc/init.d/fastd restart echo Segment set to $SEGNUM fi -- GitLab