Skip to content
Snippets Groups Projects
Commit 2417ef72 authored by root's avatar root
Browse files

Keep Segment setting if DNS is temporary not available.

parent caff6fa7
No related branches found
No related tags found
No related merge requests found
...@@ -8,6 +8,7 @@ start () { ...@@ -8,6 +8,7 @@ start () {
/etc/init.d/fastd restart /etc/init.d/fastd restart
fi fi
rm /tmp/.seg.ffs
/etc/init.d/micrond enable /etc/init.d/micrond enable
/etc/init.d/micrond restart /etc/init.d/micrond restart
} }
......
#!/bin/sh #!/bin/sh
SEGSET=/tmp/.seg.ffs
ME=$(basename $0) ME=$(basename $0)
if [ $(ps | grep -c "$ME") -gt 4 ]; then if [ $(ps | grep -c "$ME") -gt 4 ]; then
logger -s -t $ME "started twice" logger -s -t $ME "started twice"
...@@ -23,12 +25,18 @@ BATSEG=$(batctl gwl | grep '02:00:3' | tail -1 | sed 's/:0/:/g' | cut -d':' -f4) ...@@ -23,12 +25,18 @@ BATSEG=$(batctl gwl | grep '02:00:3' | tail -1 | sed 's/:0/:/g' | cut -d':' -f4)
GITSEG=$(nslookup ffs-${NODEID}-${PUBKEY}.segassign.freifunk-stuttgart.de ::1#54 | grep "2001:2:0:711::" | cut -d':' -f7) GITSEG=$(nslookup ffs-${NODEID}-${PUBKEY}.segassign.freifunk-stuttgart.de ::1#54 | grep "2001:2:0:711::" | cut -d':' -f7)
if [ -z "$GITSEG" ]; then if [ -z "$GITSEG" ]; then
logger -t $ME "Node not registered" if [ -f $SEGSET ]; then
GITSEG=99 GITSEG=$(cat $SEGSET)
logger -t $ME "Node is in Segment: $GITSEG"
else
logger -t $ME "Node not registered"
GITSEG=99
fi
else else
if [ -n "$BATSEG" ] && [ "$BATSEG" != "$GITSEG" ]; then if [ -n "$BATSEG" ] && [ "$BATSEG" != "$GITSEG" ]; then
logger -t $ME "Avoiding Shortcut" logger -t $ME "Avoiding Shortcut"
GITSEG=99 GITSEG=99
rm $SEGSET
fi fi
fi fi
...@@ -51,6 +59,7 @@ if [ "$CHANGED" = "1" ]; then ...@@ -51,6 +59,7 @@ if [ "$CHANGED" = "1" ]; then
/sbin/ifdown client /sbin/ifdown client
/etc/init.d/fastd restart /etc/init.d/fastd restart
/sbin/ifup client /sbin/ifup client
echo $GITSEG >$SEGSET
logger -t $ME "Set Segment: $GITSEG" logger -t $ME "Set Segment: $GITSEG"
else else
logger -t $ME "No changes" logger -t $ME "No changes"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment