From a0dfc3343aced2baaab844d599f0e6a38ad18310 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Wed, 22 Jul 2026 19:41:28 -0300 Subject: [PATCH] fix(ddns): recognize a routed local nameserver address The DNS-managed-networks check used my_ip_facing($net->{net}), which only returns local addresses on the interface directly facing that network. A nameserver that is a local address reachable via a different (routed) interface was therefore treated as external, and the network was wrongly dropped from ddns management. Use thishostisnot(), which recognizes any local address regardless of the interface, and keep the existing and site-nameserver special cases. Recovered from the unmerged lenovobuild branch (original 3c343f83), adapted to preserve those special cases: lab validation showed the original replaced them wholesale, which would exclude any network whose nameserver is the literal token (thishostisnot('') is true). Co-authored-by: Jarrod Johnson <10814490+jjohnson42@users.noreply.github.com> --- xCAT-server/lib/xcat/plugins/ddns.pm | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/ddns.pm b/xCAT-server/lib/xcat/plugins/ddns.pm index f1af338c8..73d1f79a4 100644 --- a/xCAT-server/lib/xcat/plugins/ddns.pm +++ b/xCAT-server/lib/xcat/plugins/ddns.pm @@ -443,18 +443,17 @@ sub process_request { if ($net and $net->{nameservers}) { my $valid = 0; - my @myips; - my @myipsd = xCAT::NetworkUtils->my_ip_facing($net->{net}); - my $myipsd_l = @myipsd; - unless ($myipsd[0]) { @myips = @myipsd[ 1 .. ($myipsd_l - 1) ]; } foreach (split /,/, $net->{nameservers}) { chomp $_; - foreach my $myip (@myips) { - if (($_ eq $myip) || ($_ eq '') || ($_ eq $sitens)) - { - $valid += 1; - } + # my_ip_facing() only returns addresses on the interface directly + # facing this network, so a nameserver that is a local address on + # another (routed) interface was wrongly treated as external. + # thishostisnot() recognizes any local address; keep the existing + # and site-nameserver special cases. + if (!xCAT::NetworkUtils->thishostisnot($_) || $_ eq '' || $_ eq $sitens) + { + $valid += 1; } } unless ($valid > 0)