From 91ae9c3db2d60c1b9fc83635fbc2423fbaae345b Mon Sep 17 00:00:00 2001 From: Fabiano Correa Mercer Date: Thu, 28 Mar 2024 15:33:58 -0300 Subject: [PATCH] Fix ipv4/ipv6 scenario detection Due to the alias in the /etc/dnsmasq.conf: ``` cname=controller,controller.internal cname=controller-0,controller-0.internal cname=controller-1,controller-1.internal ``` The DNS answers the value: "controller.internal." for the IPv6 dig command: "dig +short AAAA controller" even for an IPv4 scenario What makes the code to set the IPv6 parameters instead if the IPv4. So it is necessary to check if the dig result has an IPv6 address and not just the "controller.internal." Tests dome: IPv4 AIO-SX fresh install IPv4 AIO-DX fresh install IPv4 AIO-DX with mgmt in vlan fresh install IPv6 AIO-DX with mgmt in vlan fresh install IPv4 AIO-DX swact IPv6 AIO-DX swact Closes-Bug: #2059722 Change-Id: I92978263646fe6d07e96edd2054d42bed6d389b1 Signed-off-by: Fabiano Correa Mercer --- kickstart/files/kickstart.cfg | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/kickstart/files/kickstart.cfg b/kickstart/files/kickstart.cfg index f0e044fb..6f179900 100644 --- a/kickstart/files/kickstart.cfg +++ b/kickstart/files/kickstart.cfg @@ -2726,6 +2726,13 @@ else # vlan # 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}" ]]