Update subnet-up.tmpl
This commit is contained in:
parent
8a128621ae
commit
92ae69cb63
@ -1,20 +1,17 @@
|
|||||||
#!/bin/ash
|
#!/bin/ash
|
||||||
echo "Route up: \$SUBNET weight \$WEIGHT via \$NODE (\$REMOTEADDRESS:\$REMOTEPORT)"
|
echo "Route up: \$SUBNET weight \$WEIGHT via \$NODE (\$REMOTEADDRESS:\$REMOTEPORT)"
|
||||||
nonMACChars=`echo \$SUBNET | tr -d "[:digit:]" | tr -d [:ABCDEFabcdef]`
|
nonMACChars=`echo \$SUBNET | tr -d "[:digit:]" | tr -d [:ABCDEFabcdef]`
|
||||||
macFile="/tmp/tinc_peer_mac_\$NODE"
|
date=`date -u`
|
||||||
|
|
||||||
if [ -z "\$nonMACChars" ]; then
|
if [ -z "\$nonMACChars" ]; then
|
||||||
# This subnet is a MAC
|
# This subnet is a MAC
|
||||||
echo "\$SUBNET" > \$macFile
|
echo "\$NODE mac \$SUBNET \$WEIGHT \$REMOTEADDRESS:\$REMOTEPORT \$date" > /tmp/tinc_peer_mac_\$NODE_\$SUBNET
|
||||||
else
|
else
|
||||||
|
# This subnet is an IP address
|
||||||
if echo "\$SUBNET" | grep -q -E ".+/32\$"; then
|
if echo "\$SUBNET" | grep -q -E ".+/32\$"; then
|
||||||
# This subnet is likely an IP address, add it to the ARP table
|
address=`echo "\$SUBNET" | cut -d '/' -f 1`
|
||||||
if test -f "\$macFile"; then
|
echo "\$NODE ip \$SUBNET \$WEIGHT \$REMOTEADDRESS:\$REMOTEPORT \$date" > /tmp/tinc_peer_mac_\$NODE_\$address
|
||||||
mac=`cat \$macFile`
|
|
||||||
address=`echo "\$SUBNET" | cut -d '/' -f 1`
|
|
||||||
echo "Mapping \$address <=> \$mac in ARP table"
|
|
||||||
arp -s "\$address" "\$mac"
|
|
||||||
else
|
|
||||||
echo "[WARNING] No MAC known for node \$NODE, can't route \$SUBNET. This is only a problem if this is a remote route."
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
./check-node
|
||||||
|
Loading…
x
Reference in New Issue
Block a user