From 266606c4b35bd6744b226960255aa014a85332f3 Mon Sep 17 00:00:00 2001 From: Carl Vuosalo Date: Fri, 7 Mar 2025 23:28:30 +0100 Subject: [PATCH] Correct ipv6 host name for EL8 and EL9 --- wwwroot/cgi-bin/plugins/ipv6.pm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/wwwroot/cgi-bin/plugins/ipv6.pm b/wwwroot/cgi-bin/plugins/ipv6.pm index 14857ee5..fe4cb8e5 100644 --- a/wwwroot/cgi-bin/plugins/ipv6.pm +++ b/wwwroot/cgi-bin/plugins/ipv6.pm @@ -63,8 +63,12 @@ sub GetResolvedIP_ipv6 { my $query = $resolver->query($reverseip, "PTR"); if (! defined($query)) { return; } my @result=split(/\s/, ($query->answer)[0]->string); - chop($result[4]); # Remove the trailing dot of the answer. - return $result[4]; + my $hostindex = 6; + # Host name appears at index 6 on EL8 and EL9. + # On older operating systems, it appears at index 4 at the array's end. + if ($hostindex > $#result) { $hostindex = $#result; } + chop($result[$hostindex]); # Remove the trailing dot of the answer. + return $result[$hostindex]; # -----> } -- 2.47.2