DDNS: Fix duplicated config variable

This commit is contained in:
Jannik Beyerstedt 2021-05-08 18:22:48 +02:00
parent 22dd9bfb3d
commit ec961db180
3 changed files with 5 additions and 4 deletions

View file

@ -13,7 +13,8 @@ fi
ip6addr=''
ip4addr=''
if [ $platform = 'linux' ]; then
ip6addr=$(ip -6 addr show scope global | grep inet6 | tail -1 | egrep -o '([0-9abcdef]{4}[0-9:abcdef]*)')
# only accept global IPv6 addresses (starting with 2 or 3)
ip6addr=$(ip -6 addr show scope global | grep inet6 | tail -1 | egrep -o '([0-9abcdef]{4}[0-9:abcdef]*)' | egrep '^[2,3]')
# filter local IPv4 address ranges (172.16.0.0/12, 10.0.0.0/8, 192.168.0.0/16)
ip4addr=$(ip -4 addr show scope global | grep inet | egrep -o '([0-9]{1,3}\.){3}[0-9]{1,3}' | grep -Ev '172.(1[6-9]|2[0-9]|3[0-1])' | grep -Ev '10.' | grep -Ev '192.168.' | head -n 1)
elif [ $platform = 'freebsd' ]; then