summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaim Gelfenbeyn <haim@g8n.me>2024-05-30 09:30:27 -0400
committerMergify <37929162+mergify[bot]@users.noreply.github.com>2024-05-31 09:40:05 +0000
commitf6be514d5500ad3242b25aef8c4ec5ff7257379f (patch)
tree3783dde2169f3f0d318236643a66740bc7ff60fb
parent173deaa76ebaea2048e5f342013af6844979151f (diff)
downloadvyos-1x-f6be514d5500ad3242b25aef8c4ec5ff7257379f.tar.gz
vyos-1x-f6be514d5500ad3242b25aef8c4ec5ff7257379f.zip
dns: T6422: allow multiple redundant NS records
NS is unlike CNAME or PTR, multiple NS records are perfectly valid and is a common use case: multiple redundant DNS servers is a common configuration and should be supported. (cherry picked from commit 19d8415512dcf87dc3a87feabf128652ffc74594)
-rw-r--r--interface-definitions/service_dns_forwarding.xml.in1
-rwxr-xr-xsrc/conf_mode/service_dns_forwarding.py15
2 files changed, 15 insertions, 1 deletions
diff --git a/interface-definitions/service_dns_forwarding.xml.in b/interface-definitions/service_dns_forwarding.xml.in
index b52b4bda3..5667028b7 100644
--- a/interface-definitions/service_dns_forwarding.xml.in
+++ b/interface-definitions/service_dns_forwarding.xml.in
@@ -311,6 +311,7 @@
<constraint>
<regex>[-_a-zA-Z0-9.]{1,63}(?&lt;!\.)</regex>
</constraint>
+ <multi/>
</properties>
</leafNode>
#include <include/dns/time-to-live.xml.i>
diff --git a/src/conf_mode/service_dns_forwarding.py b/src/conf_mode/service_dns_forwarding.py
index 7e863073a..e8318a83e 100755
--- a/src/conf_mode/service_dns_forwarding.py
+++ b/src/conf_mode/service_dns_forwarding.py
@@ -102,7 +102,7 @@ def get_config(config=None):
'ttl': rdata['ttl'],
'value': address
})
- elif rtype in ['cname', 'ptr', 'ns']:
+ elif rtype in ['cname', 'ptr']:
if not 'target' in rdata:
dns['authoritative_zone_errors'].append(f'{subnode}.{node}: target is required')
continue
@@ -113,6 +113,19 @@ def get_config(config=None):
'ttl': rdata['ttl'],
'value': '{}.'.format(rdata['target'])
})
+ elif rtype == 'ns':
+ if not 'target' in rdata:
+ dns['authoritative_zone_errors'].append(f'{subnode}.{node}: at leaast one target is required')
+ continue
+
+ for target in rdata['target']:
+ zone['records'].append({
+ 'name': subnode,
+ 'type': rtype.upper(),
+ 'ttl': rdata['ttl'],
+ 'value': '{}.'.format(target)
+ })
+
elif rtype == 'mx':
if not 'server' in rdata:
dns['authoritative_zone_errors'].append(f'{subnode}.{node}: at least one server is required')