Update and rename subnet-up.tmpl to subnet-up

This commit is contained in:
Manevolent 2023-04-13 00:08:27 -06:00 committed by GitHub
parent 271b982bc5
commit e6789c6554
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 19 deletions

19
tinc/subnet-up Normal file
View 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

View File

@ -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