19 lines
651 B
Bash
19 lines
651 B
Bash
#!/bin/ash
|
|
echo "Route up: \$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
|
|
echo "\$SUBNET" > \$macFile
|
|
else
|
|
if echo "\$SUBNET" | grep -q -E ".+/32$"; then
|
|
# This subnet is likely an IP address, add it to the ARP table
|
|
if test -f "\$macFile"; then
|
|
mac=`cat \$macFile`
|
|
arp -s "\$SUBNET" "\$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
|