diff options
author | David Beitey <david@davidjb.com> | 2018-12-21 02:51:56 +0000 |
---|---|---|
committer | David Beitey <david@davidjb.com> | 2018-12-21 12:54:54 +1000 |
commit | cfe4ae16689fc842d043ce6beba1d4ebe3e5e7b3 (patch) | |
tree | e5c2ff2fa9922ee1b57410b2514a2f8c74219ba4 /applications/luci-app-ddns/luasrc/tools | |
parent | 49c558a693fd7f1008edbb53b2115806a2f9ea77 (diff) |
luci-app-ddns: check existence of nslookup util rather than making DNS request
This saves a DNS request whenever the check is performed. For systems with nameservers configured in `/etc/resolv.conf`, nslookup will sent a request to those servers (eg bypassing /etc/hosts), thus taking a lot more time than necessary. For servers that are remote, this will take a *lot* longer than just checking if the nslookup util exists.
This change follows in the same vein as all the other checks and just using `which` without actually invoking the util's functionality.
Signed-off-by: David Beitey <david@davidjb.com>
Diffstat (limited to 'applications/luci-app-ddns/luasrc/tools')
-rwxr-xr-x | applications/luci-app-ddns/luasrc/tools/ddns.lua | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/applications/luci-app-ddns/luasrc/tools/ddns.lua b/applications/luci-app-ddns/luasrc/tools/ddns.lua index 6f0c7f0952..2b92e3e636 100755 --- a/applications/luci-app-ddns/luasrc/tools/ddns.lua +++ b/applications/luci-app-ddns/luasrc/tools/ddns.lua @@ -103,7 +103,7 @@ function env_info(type) end local function has_nslookup() - return (SYS.call( [[$(which nslookup) localhost 2>&1 | grep -qF "(null)"]] ) ~= 0) + return (SYS.call( [[which nslookup >/dev/null 2>&1]] ) == 0) end if type == "has_bindhost" then |