From 9821652bc8174cc8a037b160421af23992a7dc7e Mon Sep 17 00:00:00 2001 From: Tara Subedi Date: Fri, 22 Mar 2024 11:37:48 -0400 Subject: [PATCH] Implement DNS resolution for secondary pool addresses Once we implement dual-stack, by adding secondary pool addresses, dns resolution returns both A and AAAA records for a hostname e.g. controller. This will break the current single-stack logic of determining boot_address_family of a IP based on presence/absence of AAAA record. This commit changes the logic to determine the boot_address_family, solely depending upon the IP itself. Test Plan: [PASS] AIO-SX/DX IPv4 bootstrap without issues [PASS] AIO-SX/DX IPv6 bootstrap without issues Story: 2011027 Task: 49768 Change-Id: I30ea3a26a5b46a9aad082e89fba83aa476c50079 Signed-off-by: Tara Nath Subedi --- kickstart/files/kickstart.cfg | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/kickstart/files/kickstart.cfg b/kickstart/files/kickstart.cfg index 6f179900..16ac6331 100644 --- a/kickstart/files/kickstart.cfg +++ b/kickstart/files/kickstart.cfg @@ -2719,31 +2719,16 @@ else # vlan ilog "Configuring vlan: boot_iface=vlan${mgmt_vlan}" # Check whether to use inet or inet6 - ipv6_addr=$(dig +short AAAA controller.internal) - - if [[ -z "${ipv6_addr}" ]] + # Check for IPv4 format (3 digits followed by a dot, repeated 3 times, and another 3 digits) + if [[ $mgmt_ip =~ ^([0-9]{1,3}\.){3}[0-9]{1,3}$ ]]; then - # during an upgrade the controller.internal may not be defined - # but the scenario could be IPv6. So try to resolve the controller - ipv6_addr=$(dig +short AAAA controller) - - # due to the alias in the /etc/dnsmasq.conf: - # cname=controller,controller.internal - # An IPv4 scenario may answer "controller.internal." even for an IPv6 DIG - # for this reason, remove the "controller.internal." from the result - fqdn_pattern="controller.internal." - ipv6_addr=${ipv6_addr/${fqdn_pattern}/} - fi - - if [[ -n "${ipv6_addr}" ]] - then - boot_address_family=inet6 - ipv6init=yes - dhcpv6c=yes - else boot_address_family=inet ipv6init=no dhcpv6c=no + else + boot_address_family=inet6 + ipv6init=yes + dhcpv6c=yes fi # Persist the boot device to the platform configuration. This will get