Update subnet-down
This commit is contained in:
parent
672dc860a2
commit
9357eab491
@ -2,19 +2,23 @@
|
||||
echo "[ROUTE] down: $SUBNET weight $WEIGHT via $NODE ($REMOTEADDRESS:$REMOTEPORT)"
|
||||
nonMACChars=`echo $SUBNET | tr -d "[:digit:]" | tr -d [:ABCDEFabcdef]`
|
||||
date=`date -u`
|
||||
|
||||
arpEntries=`arp -an`
|
||||
if [ -z "$nonMACChars" ]; then
|
||||
# This subnet is a MAC
|
||||
rm -f /tmp/tinc_peer_mac_$NODE_$SUBNET
|
||||
|
||||
rm -f /tmp/tinc/$NODE_mac_$SUBNET
|
||||
|
||||
if echo $arpEntries | grep -q -E "at $SUBNET "; then
|
||||
echo ""
|
||||
echo $arpEntries | grep -E "at 0?*$SUBNET0?* " | sed -r 's/^.+\((.+)\).+$/\1/g' | xargs -n1 echo "[ARP] Removing from table: "
|
||||
echo $arpEntries | grep -E "at 0?*$SUBNET0?* " | sed -r 's/^.+\((.+)\).+$/\1/g' | xargs -n1 arp -d
|
||||
fi
|
||||
else
|
||||
# This subnet is an IP address
|
||||
if echo "$SUBNET" | grep -q -E ".+/32$"; then
|
||||
address=`echo "$SUBNET" | cut -d '/' -f 1`
|
||||
rm -f /tmp/tinc_peer_mac_$NODE_$address
|
||||
if arp -an | grep -q "\($address\)"; then
|
||||
echo "[ARP] Unmapping $addresss from ARP table"
|
||||
rm -f /tmp/tinc/$NODE_ip_$address
|
||||
if echo $arpEntries | grep -q "\($address\)"; then
|
||||
echo "[ARP] Removing from table: $addresss"
|
||||
arp -d $address
|
||||
fi
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user