lixonet-ee/tinc/check-node
2023-04-13 01:16:16 -06:00

15 lines
385 B
Bash

#!/bin/ash
num_macs=`ls /tmp/tinc/peer/$NODE/mac | wc -l`
num_ips=`ls /tmp/tinc/peer/$NODE/ip | wc -l`
if [ "$num_macs" = "1" ]; then
if [ "$num_ips" = "0" ]; then
exit 0
fi
mac=`ls /tmp/tinc/peer/$NODE/mac`
ips=`ls /tmp/tinc/peer/$NODE/ip`
echo $ips | xargs -n 1 -I {} echo "[ARP] Adding {} <=> $mac to the table..."
echo $ips | xargs -n 1 -I {} arp -s {} $mac
fi