summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--update-ddns.in11
1 files changed, 10 insertions, 1 deletions
diff --git a/update-ddns.in b/update-ddns.in
index 6626ed4..063350d 100644
--- a/update-ddns.in
+++ b/update-ddns.in
@@ -30,10 +30,12 @@ do
then
dnsVer="A"
inetVer="inet"
+ ipCmdVer='-4'
elif [ "${ipVer}" == "6" ]
then
dnsVer="AAAA"
inetVer="inet6"
+ ipCmdVer='-6'
else
>&2 echo 'Error: First column in "#ETCDIR#/update-ddns.conf" needs to be "4" or "6"!'
exit 1
@@ -55,8 +57,15 @@ do
sort -u
)"
+ if [ "${dev}" == "-" ]
+ then
+ unset dev
+ else
+ dev="dev ${dev}"
+ fi
+
ips="$(
- "${ipCmd}" addr show dev "${dev}" | \
+ "${ipCmd}" "${ipCmdVer}" addr show ${dev} scope global | \
grep "^\s*${inetVer}\s.*\sscope\sglobal\s" | \
awk '{print $2}' | \
cut -d/ -f1 | \