Update subnet-down.tmpl

This commit is contained in:
Manevolent 2023-04-12 22:49:10 -06:00 committed by GitHub
parent 7c67102934
commit 3c2f3c2fa2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,2 +1,17 @@
#!/bin/ash
echo "Route down: \$SUBNET weight \$WEIGHT via \$NODE (\$REMOTEADDRESS:\$REMOTEPORT)"
nonMACChars=`echo \$SUBNET | tr -d "[:digit:]" | tr -d [:ABCDEFabcdef]`
macFile="/tmp/tinc_peer_mac_\$NODE"
if [ -z "\$nonMACChars" ]; then
# This subnet is a MAC
if test -f "\$macFile"; then
rm \$macFile
fi
else
if echo "\$SUBNET" | grep -q -E ".+/32\$"; then
# This subnet is likely an IP address, remove it from the ARP table
address=`echo "\$SUBNET" | cut -d '/' -f 1`
echo "Unmapping \$address <=> \$mac from ARP table"
arp -s "\$address"
fi
fi