summaryrefslogtreecommitdiff
path: root/src/conf_mode/host_name.py
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2019-07-09 18:07:50 +0200
committerDaniil Baturin <daniil@baturin.org>2019-07-09 18:07:50 +0200
commit02e5bb55d3922516cfe53016202d58924b72950a (patch)
tree999d5b255a854a5a37b1f38d6f04753d282b4a43 /src/conf_mode/host_name.py
parent14b4fa607f37b051957abc9cbe01014a610adc81 (diff)
downloadvyos-1x-02e5bb55d3922516cfe53016202d58924b72950a.tar.gz
vyos-1x-02e5bb55d3922516cfe53016202d58924b72950a.zip
T1497: remove duplicate name servers and search domains obtained from DHCP.
Diffstat (limited to 'src/conf_mode/host_name.py')
-rwxr-xr-xsrc/conf_mode/host_name.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/conf_mode/host_name.py b/src/conf_mode/host_name.py
index 6fb7031a8..eb4b339e9 100755
--- a/src/conf_mode/host_name.py
+++ b/src/conf_mode/host_name.py
@@ -209,6 +209,12 @@ def generate(config):
config['nameserver'] += dhcp_ns
config['domain_search'] += dhcp_sd
+ # Prune duplicate values
+ # Not order preserving, but then when multiple DHCP clients are used,
+ # there can't be guarantees about the order anyway
+ dhcp_ns = list(set(dhcp_ns))
+ dhcp_sd = list(set(dhcp_sd))
+
# We have third party scripts altering /etc/hosts, too.
# One example are the DHCP hostname update scripts thus we need to cache in
# every modification first - so changing domain-name, domain-search or hostname