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 <liangwen12year@gmail.com>
This commit is contained in:
Wen Liang 2023-05-22 20:04:52 -04:00 committed by Fernando Fernández Mancera
parent 4371036f14
commit 835872e681
4 changed files with 11 additions and 0 deletions

View file

@ -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`

View file

@ -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$",

View file

@ -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"

View file

@ -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):
"""