summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2019-07-09 18:10:32 +0200
committerDaniil Baturin <daniil@baturin.org>2019-07-09 18:10:32 +0200
commitdff8ab9d27726d380eb3d5eb8e4262929903e948 (patch)
treee7d6a9cc8f68ac23e641bc556adafb12e5106809
parent390052173f031ddab4e460809147dd28c6f7ff3d (diff)
downloadvyos-1x-dff8ab9d27726d380eb3d5eb8e4262929903e948.tar.gz
vyos-1x-dff8ab9d27726d380eb3d5eb8e4262929903e948.zip
T1497: remove duplicate values from name servers and search domains obtained from DHCP.
-rwxr-xr-xsrc/conf_mode/host_name.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/conf_mode/host_name.py b/src/conf_mode/host_name.py
index 5055faa65..27cc336d8 100755
--- a/src/conf_mode/host_name.py
+++ b/src/conf_mode/host_name.py
@@ -172,6 +172,11 @@ def generate(config):
dhcp_ns.extend(ns)
sd = [d for d in value if key == 'domains']
dhcp_sd.extend(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))
if not config['no_dhcp_ns']:
config['nameserver'] += dhcp_ns