From 9b3dfbf65231bfb5b82b315a10f2d1b2428d655b Mon Sep 17 00:00:00 2001 From: Manevolent Date: Wed, 12 Apr 2023 22:28:42 -0600 Subject: [PATCH] Update subnet-up.tmpl --- tinc/subnet-up.tmpl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tinc/subnet-up.tmpl b/tinc/subnet-up.tmpl index 866536d..a64840c 100644 --- a/tinc/subnet-up.tmpl +++ b/tinc/subnet-up.tmpl @@ -1,2 +1,12 @@ #!/bin/ash echo "Route up: \$SUBNET weight \$WEIGHT via \$NODE (\$REMOTEADDRESS:\$REMOTEPORT)" +nonMACChars=`echo \$SUBNET | tr -d "[:digit:]" | tr -d [:ABCDEF]` +macFile="/tmp/tinc_peer_mac_\$NODE" +if [ -z "\$nonMACChars" ]; then + # This subnet is a MAC + echo "\$SUBNET" > \$macFile +else + # This subnet is likely an IP address, add it to the ARP table + mac=`cat \$macFile` + arp -s "\$SUBNET" "\$mac" +fi