summaryrefslogtreecommitdiffstats
path: root/modules.d/slx-network/scripts/udhcpc-trigger.stage4
diff options
context:
space:
mode:
authorSimon Rettberg2024-03-01 15:01:56 +0100
committerSimon Rettberg2024-03-01 15:01:56 +0100
commit52086c9f22d2e95a96e2a27c96fa4f184dca986e (patch)
treeb0b941f978ba095e520510d116e8912f2c1459c1 /modules.d/slx-network/scripts/udhcpc-trigger.stage4
parent[slx-network] Fix escaping in awk script (diff)
downloadsystemd-init-52086c9f22d2e95a96e2a27c96fa4f184dca986e.tar.gz
systemd-init-52086c9f22d2e95a96e2a27c96fa4f184dca986e.tar.xz
systemd-init-52086c9f22d2e95a96e2a27c96fa4f184dca986e.zip
[slx-network] Get rid of rdns
Diffstat (limited to 'modules.d/slx-network/scripts/udhcpc-trigger.stage4')
-rwxr-xr-xmodules.d/slx-network/scripts/udhcpc-trigger.stage411
1 files changed, 10 insertions, 1 deletions
diff --git a/modules.d/slx-network/scripts/udhcpc-trigger.stage4 b/modules.d/slx-network/scripts/udhcpc-trigger.stage4
index c2ea566a..5c02190b 100755
--- a/modules.d/slx-network/scripts/udhcpc-trigger.stage4
+++ b/modules.d/slx-network/scripts/udhcpc-trigger.stage4
@@ -59,6 +59,15 @@ check_env() {
fi
}
+reverse_lookup() {
+ [ -z "$1" ] && return
+ timeout 3 nslookup "$1" | awk '{
+ if ($2 == "name") { print gensub("\\.$", "", 1, $4); exit; }
+ if ($1 == "Name:") { ok = 1 }
+ if (ok && $1 == "Address") { print gensub("\\.$", "", 1, $4); exit; }
+ }'
+}
+
case "$1" in
bound|renew)
check_env "$1"
@@ -74,7 +83,7 @@ case "$1" in
fi
# get domain, hostname and thus fqdn from DNS
- dns_fqdn=$(busybox timeout 3 rdns "$ip")
+ dns_fqdn=$( reverse_lookup "$ip" )
dns_short="${dns_fqdn%%.*}"
# check if it is fqdn
if [ "$dns_fqdn" == "$dns_short" ]; then