in reply to Net::DNS::Resolver using IPv6 transport in nameservers

I can't explain this behaviour...
#!/usr/bin/perl use Net::DNS; #use IO::Socket::IP; $testcandidate="cl"; print "IPV4 test...\n"; $res = new Net::DNS::Resolver; $res->tcp_timeout (1) ; $res->retry (1) ; $res->retrans (1) ; $query = $res->nameservers('162.219.53.120'); $query = $res->query($testcandidate, "SOA"); print "What's in the array: \n"; print join ' ', $res->nameservers(); print "\n"; my $serial=($query->answer)[0]->serial, if ($query); print "serial: $serial\n"; print "\n\nIPV6 test...\n"; $res = new Net::DNS::Resolver; $res->tcp_timeout (1) ; $res->retry (1) ; $res->retrans (1) ; $query = $res->nameservers('2620:10a:80d1:1053::120'); $query = $res->query($testcandidate, "SOA"); print "What's in the array: \n"; print join ' ', $res->nameservers(); print "\n"; my $serial=($query->answer)[0]->serial, if ($query); print "serial: $serial\n";
Which outputs...
[root@ns01 jzack]# ./snippet IPV4 test... What's in the array: 162.219.53.120 serial: 2020070925 IPV6 test... What's in the array: serial:
How is it that the IPv6 address isn't even being mentioned when I print the array elements? I thought I was debugging a Net::DNS issue...but it seems I must be doing something wrong with arrays in general? When I throw this into debug, I see: IPV6 test... ;; query(cl, SOA) ;; setting up an AF_INET() family type UDP socket So how do I get it to not use AF_INET?

Replies are listed 'Best First'.
Re^2: Net::DNS::Resolver using IPv6 transport in nameservers
by elsifsheep (Novice) on Jul 09, 2020 at 17:42 UTC
    The answer to my question was: The Net::DNS::Resolver library will use IPv6 transport if the appropriate libraries (Socket6 and IO::Socket::INET6) are available and the address the server tries to connect to is an IPv6 address. Self-solved.
      >Self-solved.

      Congrats, that's always the best kind of solved. =D Just replying so you didn't look like you were talking to yourself any more than the rest of us.