summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2022-11-10 10:58:58 +0100
committerGitHub <noreply@github.com>2022-11-10 10:58:58 +0100
commitaabfb09e42079eb735904ced2fab600de5a550f3 (patch)
treecc34e9671d22bbf6cd6668c483a4e3d02e06a03c
parent6b574943d77a03cb1011d914d4ab8faf5ffdb0bc (diff)
parent2f105b1b22de382927699d2f3a1ec6f00cb4ecbe (diff)
downloadvyos-1x-aabfb09e42079eb735904ced2fab600de5a550f3.tar.gz
vyos-1x-aabfb09e42079eb735904ced2fab600de5a550f3.zip
Merge pull request #1650 from Zen3515/current-add-pdns-local-port
dns: T738: add CLI option for PowerDNS local-port
-rw-r--r--data/templates/dns-forwarding/recursor.conf.j23
-rw-r--r--interface-definitions/dns-forwarding.xml.in4
-rwxr-xr-xsmoketest/scripts/cli/test_service_dns_forwarding.py21
3 files changed, 28 insertions, 0 deletions
diff --git a/data/templates/dns-forwarding/recursor.conf.j2 b/data/templates/dns-forwarding/recursor.conf.j2
index ce1b676d1..e02e6c13d 100644
--- a/data/templates/dns-forwarding/recursor.conf.j2
+++ b/data/templates/dns-forwarding/recursor.conf.j2
@@ -29,6 +29,9 @@ export-etc-hosts={{ 'no' if ignore_hosts_file is vyos_defined else 'yes' }}
# listen-address
local-address={{ listen_address | join(',') }}
+# listen-port
+local-port={{ port }}
+
# dnssec
dnssec={{ dnssec }}
diff --git a/interface-definitions/dns-forwarding.xml.in b/interface-definitions/dns-forwarding.xml.in
index 3de0dc0eb..409028572 100644
--- a/interface-definitions/dns-forwarding.xml.in
+++ b/interface-definitions/dns-forwarding.xml.in
@@ -605,6 +605,10 @@
</properties>
</leafNode>
#include <include/listen-address.xml.i>
+ #include <include/port-number.xml.i>
+ <leafNode name="port">
+ <defaultValue>53</defaultValue>
+ </leafNode>
<leafNode name="negative-ttl">
<properties>
<help>Maximum amount of time negative entries are cached</help>
diff --git a/smoketest/scripts/cli/test_service_dns_forwarding.py b/smoketest/scripts/cli/test_service_dns_forwarding.py
index 65b676451..8e9b7ef43 100755
--- a/smoketest/scripts/cli/test_service_dns_forwarding.py
+++ b/smoketest/scripts/cli/test_service_dns_forwarding.py
@@ -32,6 +32,7 @@ base_path = ['service', 'dns', 'forwarding']
allow_from = ['192.0.2.0/24', '2001:db8::/32']
listen_adress = ['127.0.0.1', '::1']
+listen_ports = ['53', '5353']
def get_config_value(key, file=CONFIG_FILE):
tmp = read_file(file)
@@ -224,5 +225,25 @@ class TestServicePowerDNS(VyOSUnitTestSHIM.TestCase):
tmp = get_config_value('dns64-prefix')
self.assertEqual(tmp, dns_prefix)
+ def test_listening_port(self):
+ # only one port can be listen
+ for port in listen_ports:
+ self.cli_set(base_path + ['port', port])
+ for network in allow_from:
+ self.cli_set(base_path + ['allow-from', network])
+ for address in listen_adress:
+ self.cli_set(base_path + ['listen-address', address])
+
+ # commit changes
+ self.cli_commit()
+
+ # verify local-port configuration
+ tmp = get_config_value('local-port')
+ self.assertEqual(tmp, port)
+
+ # reset to test differnt port
+ self.cli_delete(base_path)
+ self.cli_commit()
+
if __name__ == '__main__':
unittest.main(verbosity=2)