summaryrefslogtreecommitdiffstats
path: root/hooks
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2020-04-01 13:22:15 +0100
committerRoy Marples <roy@marples.name>2020-04-01 13:22:15 +0100
commit90291fe07cd55b5cd0d6b867c535075e29c5ff56 (patch)
tree2c657f6b7cf46d89d8a5a755595273b38056c94b /hooks
parent2800dea7ac3fb73e4eef24e98d1f3b86a9b58376 (diff)
downloaddhcpcd-90291fe07cd55b5cd0d6b867c535075e29c5ff56.tar.xz
resolv.conf: Uniquify contents
We might have >1 router that broadcasts the same DNS information. While resolvconf(8) can easily take care of uniqifying the data, not all systems have this nice tool so do the job here as well.
Diffstat (limited to 'hooks')
-rw-r--r--hooks/20-resolv.conf4
1 files changed, 3 insertions, 1 deletions
diff --git a/hooks/20-resolv.conf b/hooks/20-resolv.conf
index 422d815a..03e846fa 100644
--- a/hooks/20-resolv.conf
+++ b/hooks/20-resolv.conf
@@ -42,7 +42,7 @@ build_resolv_conf()
# Build the nameserver list
srvs=$(cd "$resolv_conf_dir"; \
key_get_value "nameserver " ${interfaces})
- for x in $(uniqify ${srvs}); do
+ for x in $(uniqify $srvs); do
servers="${servers}nameserver $x$NL"
done
fi
@@ -152,6 +152,7 @@ add_resolv_conf()
fi
fi
if [ -n "$new_domain_search" ]; then
+ new_domain_search=$(uniqify $new_domain_search)
if valid_domainname_list $new_domain_search; then
conf="${conf}search $new_domain_search$NL"
elif ! $warn; then
@@ -159,6 +160,7 @@ add_resolv_conf()
"$new_domain_search"
fi
fi
+ new_domain_name_servers=$(uniqify $new_domain_name_servers)
for x in ${new_domain_name_servers}; do
conf="${conf}nameserver $x$NL"
done