mirror of
https://github.com/linux-system-roles/network.git
synced 2026-01-23 02:15:17 +00:00
feat: Support ipv4_ignore_auto_dns and ipv6_ignore_auto_dns settings
reason: The user wants to ignore automatically configured name servers and search domains (e.g. dns record from DHCP), and only use the name servers and search domains specified in the `dns` and `dns_search` properties. result: The user is able to ignore automatically configured name servers and search domains. Notice that there are two settings here distinguished by the address families, which aims to be compatible with NetworkManager (`ipv4.ignore-auto-dns` and `ipv6.ignore-auto-dns`)and Nmstate (setting `auto-dns` on `ipv4` or `ipv6` section). Also, the users can get auto DNS from DHCPv4, DHCPv6, modem etc, and they may want to ignore auto DNS on Ipv4 but not on IPv6, in this case, it is better to have two settings distinguished by the address families. Signed-off-by: Wen Liang <liangwen12year@gmail.com>
This commit is contained in:
parent
2ce6f3afa7
commit
ffe01a5f8b
8 changed files with 258 additions and 0 deletions
|
|
@ -867,6 +867,8 @@ class ArgValidator_DictIP(ArgValidatorDict):
|
|||
"route_metric4", val_min=-1, val_max=UINT32_MAX, default_value=None
|
||||
),
|
||||
ArgValidatorBool("auto6", default_value=None),
|
||||
ArgValidatorBool("ipv4_ignore_auto_dns", default_value=None),
|
||||
ArgValidatorBool("ipv6_ignore_auto_dns", default_value=None),
|
||||
ArgValidatorBool("ipv6_disabled", default_value=None),
|
||||
ArgValidatorIP("gateway6", family=socket.AF_INET6),
|
||||
ArgValidatorNum(
|
||||
|
|
@ -918,6 +920,8 @@ class ArgValidator_DictIP(ArgValidatorDict):
|
|||
"gateway4": None,
|
||||
"route_metric4": None,
|
||||
"auto6": True,
|
||||
"ipv4_ignore_auto_dns": None,
|
||||
"ipv6_ignore_auto_dns": None,
|
||||
"ipv6_disabled": False,
|
||||
"gateway6": None,
|
||||
"route_metric6": None,
|
||||
|
|
@ -2461,6 +2465,19 @@ class ArgValidator_ListConnections(ArgValidatorList):
|
|||
"if you need to use initscripts.",
|
||||
)
|
||||
|
||||
# initscripts does not support ip.ipv4_ignore_auto_dns or
|
||||
# ip.ipv6_ignore_auto_dns, so raise errors when network
|
||||
# provider is initscripts
|
||||
if (
|
||||
connection["ip"]["ipv4_ignore_auto_dns"] is not None
|
||||
or connection["ip"]["ipv6_ignore_auto_dns"] is not None
|
||||
):
|
||||
if mode == self.VALIDATE_ONE_MODE_INITSCRIPTS:
|
||||
raise ValidationError.from_connection(
|
||||
idx,
|
||||
"ip.ipv4_ignore_auto_dns or ip.ipv6_ignore_auto_dns is not "
|
||||
"supported by initscripts.",
|
||||
)
|
||||
# initscripts does not support ip.dns_options, so raise errors when network
|
||||
# provider is initscripts
|
||||
if connection["ip"]["dns_options"]:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue