Update and rename subnet-up.tmpl to subnet-up
This commit is contained in:
parent
271b982bc5
commit
e6789c6554
19
tinc/subnet-up
Normal file
19
tinc/subnet-up
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#!/bin/ash
|
||||||
|
echo "Route up: $SUBNET weight $WEIGHT via $NODE ($REMOTEADDRESS:$REMOTEPORT)"
|
||||||
|
nonMACChars=`echo $SUBNET | tr -d "[:digit:]" | tr -d [:ABCDEFabcdef]`
|
||||||
|
date=`date -u`
|
||||||
|
|
||||||
|
if [ -z "$nonMACChars" ]; then
|
||||||
|
# This subnet is a MAC
|
||||||
|
echo "$NODE mac $SUBNET $WEIGHT $REMOTEADDRESS:$REMOTEPORT $date" > /tmp/tinc_peer/$NODE_mac_$SUBNET
|
||||||
|
else
|
||||||
|
# This subnet is an IP address
|
||||||
|
if echo "$SUBNET" | grep -q -E ".+/32\$"; then
|
||||||
|
address=`echo "\$SUBNET" | cut -d '/' -f 1`
|
||||||
|
echo "$NODE ip $SUBNET $WEIGHT $REMOTEADDRESS:$REMOTEPORT $date" > /tmp/tinc_peer/$NODE_ip_$address
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
SCRIPT=$(readlink -f "$0")
|
||||||
|
SCRIPTPATH=$(dirname "$SCRIPT")
|
||||||
|
$SCRIPTPATH/check-node
|
@ -1,19 +0,0 @@
|
|||||||
#!/bin/ash
|
|
||||||
echo "Route up: \$SUBNET weight \$WEIGHT via \$NODE (\$REMOTEADDRESS:\$REMOTEPORT)"
|
|
||||||
nonMACChars=`echo \$SUBNET | tr -d "[:digit:]" | tr -d [:ABCDEFabcdef]`
|
|
||||||
date=`date -u`
|
|
||||||
|
|
||||||
if [ -z "\$nonMACChars" ]; then
|
|
||||||
# This subnet is a MAC
|
|
||||||
echo "\$NODE mac \$SUBNET \$WEIGHT \$REMOTEADDRESS:\$REMOTEPORT \$date" > /tmp/tinc_peer_mac_\$NODE_\$SUBNET
|
|
||||||
else
|
|
||||||
# This subnet is an IP address
|
|
||||||
if echo "\$SUBNET" | grep -q -E ".+/32\$"; then
|
|
||||||
address=`echo "\$SUBNET" | cut -d '/' -f 1`
|
|
||||||
echo "\$NODE ip \$SUBNET \$WEIGHT \$REMOTEADDRESS:\$REMOTEPORT \$date" > /tmp/tinc_peer_mac_\$NODE_\$address
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
SCRIPT=$(readlink -f "$0")
|
|
||||||
SCRIPTPATH=$(dirname "$SCRIPT")
|
|
||||||
\$SCRIPTPATH/check-node
|
|
Loading…
x
Reference in New Issue
Block a user