From 835872e6813ccc7d57ba93ab5e0a52da418430d4 Mon Sep 17 00:00:00 2001 From: Wen Liang Date: Mon, 22 May 2023 20:04:52 -0400 Subject: [PATCH] feat: Support "no-aaaa" DNS option reason: The administrator wants to suppress the AAAA queries made by the stub resolver, including AAAA lookups triggered by NSS-based interfaces such as getaddrinfo. Only the DNS lookups are affected. result: The administrator is able to suppress AAAA queries made by the stub resolver. Signed-off-by: Wen Liang --- README.md | 1 + module_utils/network_lsr/argument_validator.py | 1 + tests/playbooks/tests_eth_dns_support.yml | 3 +++ tests/unit/test_network_connections.py | 6 ++++++ 4 files changed, 11 insertions(+) diff --git a/README.md b/README.md index ccd2a93..8253193 100644 --- a/README.md +++ b/README.md @@ -511,6 +511,7 @@ The IP configuration supports the following options: - `ip6-bytestring` - `ip6-dotint` - `ndots:n` + - `no-aaaa` - `no-check-names` - `no-ip6-dotint` - `no-reload` diff --git a/module_utils/network_lsr/argument_validator.py b/module_utils/network_lsr/argument_validator.py index 0919110..5c58ffb 100644 --- a/module_utils/network_lsr/argument_validator.py +++ b/module_utils/network_lsr/argument_validator.py @@ -843,6 +843,7 @@ class ArgValidator_DictIP(ArgValidatorDict): r"^ip6-bytestring$", r"^ip6-dotint$", r"^ndots:([1-9]\d*|0)$", + r"^no-aaaa$", r"^no-check-names$", r"^no-ip6-dotint$", r"^no-reload$", diff --git a/tests/playbooks/tests_eth_dns_support.yml b/tests/playbooks/tests_eth_dns_support.yml index ac4ba2b..a528efa 100644 --- a/tests/playbooks/tests_eth_dns_support.yml +++ b/tests/playbooks/tests_eth_dns_support.yml @@ -44,6 +44,7 @@ - example.com - example.org dns_options: + - no-aaaa - rotate - timeout:1 @@ -104,8 +105,10 @@ - name: "Assert that DNS options are configured correctly" assert: that: + - "'no-aaaa' in ipv4_dns.stdout" - "'rotate' in ipv4_dns.stdout" - "'timeout:1' in ipv4_dns.stdout" + - "'no-aaaa' in ipv6_dns.stdout" - "'rotate' in ipv6_dns.stdout" - "'timeout:1' in ipv6_dns.stdout" msg: "DNS options are configured incorrectly" diff --git a/tests/unit/test_network_connections.py b/tests/unit/test_network_connections.py index 3aac891..63a81dd 100644 --- a/tests/unit/test_network_connections.py +++ b/tests/unit/test_network_connections.py @@ -4175,6 +4175,9 @@ class TestValidator(Python26CompatTestCase): true_testcase_12 = { "dns_options": ["use-vc"], } + true_testcase_13 = { + "dns_options": ["no-aaaa"], + } self.assertEqual( validator.validate(true_testcase_1)["dns_options"], ["attempts:3"] @@ -4210,6 +4213,9 @@ class TestValidator(Python26CompatTestCase): self.assertEqual( validator.validate(true_testcase_12)["dns_options"], ["use-vc"] ) + self.assertEqual( + validator.validate(true_testcase_13)["dns_options"], ["no-aaaa"] + ) def test_ipv4_dns_without_ipv4_config(self): """