From 259d0cd0d0296726d02f4613de20cadb5505ea7c Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Wed, 5 May 2021 21:36:49 +0200 Subject: smoketest: dns: T3277: add testcase for "serve rfc1918" zones --- .../scripts/cli/test_service_dns_forwarding.py | 24 +++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'smoketest/scripts') diff --git a/smoketest/scripts/cli/test_service_dns_forwarding.py b/smoketest/scripts/cli/test_service_dns_forwarding.py index 28336fd43..45ca618cb 100755 --- a/smoketest/scripts/cli/test_service_dns_forwarding.py +++ b/smoketest/scripts/cli/test_service_dns_forwarding.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -# Copyright (C) 2019-2020 VyOS maintainers and contributors +# Copyright (C) 2019-2021 VyOS maintainers and contributors # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 or later as @@ -97,6 +97,10 @@ class TestServicePowerDNS(VyOSUnitTestSHIM.TestCase): tmp = get_config_value('export-etc-hosts') self.assertEqual(tmp, 'no') + # RFC1918 addresses are looked up by default + tmp = get_config_value('serve-rfc1918') + self.assertEqual(tmp, 'yes') + # Check for running process self.assertTrue(process_named_running(PROCESS_NAME)) @@ -186,6 +190,24 @@ class TestServicePowerDNS(VyOSUnitTestSHIM.TestCase): # Check for running process self.assertTrue(process_named_running(PROCESS_NAME)) + def test_no_rfc1918_forwarding(self): + 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]) + + self.cli_set(base_path + ['no-serve-rfc1918']) + + # commit changes + self.cli_commit() + + # verify configuration + tmp = get_config_value('serve-rfc1918') + self.assertEqual(tmp, 'no') + + # Check for running process + self.assertTrue(process_named_running(PROCESS_NAME)) + if __name__ == '__main__': unittest.main(verbosity=2) -- cgit v1.2.3