Hopefully fixed it

master
Keith Irwin 2022-09-09 22:06:48 -06:00
parent 61239e55fd
commit a3cd56aafd
Signed by: ki9
GPG Key ID: DF773B3F4A88DA86
1 changed files with 3 additions and 4 deletions

View File

@ -70,10 +70,9 @@ hostnames="$(<<<"${peers}" awk '{print $1}' | cut -d'.' -f1)"
ipv4s="$(<<<"${peers}" awk '{print $2}')"
ipv6s="$(<<<"${peers}" awk '{print $3}')"
usernumber="$(<<<"${ipv4s}" head -n1 | cut -d'.' -f3)"
used_ips="$(<<<"${ipv4s}" cut -d'.' -f3)\n$(<<<"${ipv6s}" cut -d'.' -f3)"
used_hostnumbers="$(<<<"${used_ips}" sort | uniq)"
hostnumber=1
while printf '%s' "${used_hostnumbers}" | grep "${hostnumber}"
# Increment hostnumber from 1 until an unused one is found
used_hostnumbers="$(<<<"${ipv4s}" cut -d'.' -f4 | sort | uniq)"
hostnumber=1; while printf <<<"${used_hostnumbers}" grep "${hostnumber}"
do ((hostnumber++))
done
ipv4="${IPV4_NET%.*.*}.${usernumber}.${hostnumber}"