diff options
author | Simon Rettberg | 2024-03-01 15:01:56 +0100 |
---|---|---|
committer | Simon Rettberg | 2024-03-01 15:01:56 +0100 |
commit | 52086c9f22d2e95a96e2a27c96fa4f184dca986e (patch) | |
tree | b0b941f978ba095e520510d116e8912f2c1459c1 | |
parent | [slx-network] Fix escaping in awk script (diff) | |
download | systemd-init-52086c9f22d2e95a96e2a27c96fa4f184dca986e.tar.gz systemd-init-52086c9f22d2e95a96e2a27c96fa4f184dca986e.tar.xz systemd-init-52086c9f22d2e95a96e2a27c96fa4f184dca986e.zip |
[slx-network] Get rid of rdns
-rwxr-xr-x | modules.d/slx-network/hooks/s3-copy-network-files.sh | 8 | ||||
-rwxr-xr-x | modules.d/slx-network/module-setup.sh | 1 | ||||
-rwxr-xr-x | modules.d/slx-network/scripts/udhcpc-trigger.stage4 | 11 |
3 files changed, 10 insertions, 10 deletions
diff --git a/modules.d/slx-network/hooks/s3-copy-network-files.sh b/modules.d/slx-network/hooks/s3-copy-network-files.sh index 46f4ab38..0b8577c0 100755 --- a/modules.d/slx-network/hooks/s3-copy-network-files.sh +++ b/modules.d/slx-network/hooks/s3-copy-network-files.sh @@ -19,12 +19,4 @@ mkdir -p "${NEWROOT}/opt/openslx" mv "${NEWROOT}/etc/resolv.conf" "${NEWROOT}/opt/openslx/resolv.conf" ln -nfs "/opt/openslx/resolv.conf" "${NEWROOT}/etc/resolv.conf" -# HACK: finally make sure we have rdns helper -# This should be done more elegantly one day... -rdns="$( command -p rdns )" -if [ -n "$rdns" ]; then - mkdir -p "${NEWROOT}/opt/openslx/bin" - cp -f "$rdns" "${NEWROOT}/opt/openslx/bin" -fi - exit 0 diff --git a/modules.d/slx-network/module-setup.sh b/modules.d/slx-network/module-setup.sh index d907da51..3684d161 100755 --- a/modules.d/slx-network/module-setup.sh +++ b/modules.d/slx-network/module-setup.sh @@ -27,7 +27,6 @@ install() { inst "${moddir}/scripts/udhcpc-trigger.stage3" "/usr/local/bin/udhcpc-trigger" # files for stage4, park them in /opt/openslx - gcc -o "${initdir}/usr/local/bin/rdns" "${moddir}/rdns.c" inst "${moddir}/scripts/s3-setup-bootif-network.stage4" "/opt/openslx/scripts/s3-setup-bootif-network.stage4" inst "${moddir}/scripts/udhcpc-trigger.stage4" "/opt/openslx/scripts/udhcpc-trigger.stage4" inst "${moddir}/services/udhcpc-bootif-stage4.service" "/opt/openslx/services/udhcpc-bootif.service" 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 |