Bug#851388: IPv6 resolving broken
On Sat, Jan 14, 2017 at 02:25:51PM +, Mike Gabriel wrote: > Package: libnetaddr-ip-perl > Severity: important > Version: 4.079+dfsg-1 > > Resolving DNS names to IPv6 addresses with NetAddr::IP->new6($hostname) > fails and results in some IPv4'ish address with IPv6 syntax. > 0:0:0:0:0:0:808:808/128 <- WTF??? > 8.8.8.8/32 [ The first address is in the "IPv4-Compatible IPv6 Address" format (nowadays deprecated in favour of the "IPv4-Mapped IPv6 Address" format), see https://tools.ietf.org/html/rfc4291#section-2.5.5 ] FWIW it looks to me like this is more or less intentional behaviour. >From the documentation of the new6() method: "->new6" and "->new_cis6" mark the address as being in ipV6 address space even if the format would suggest otherwise. i.e. ->new6('1.2.3.4') will result in ::102:304 [...] $addr can be any of the following and possibly more... [..] Fully Qualified Domain Name which returns an ipV4 address or an ipV6 address, embodied in that order. This seems to match the code as well, see http://sources.debian.net/src/libnetaddr-ip-perl/4.079%2Bdfsg-1/Lite/Lite.pm/#L1023 So it looks for an IPv4 address first as documented, and then makes an IPv6 address out of that, again as documented. Of course, whether this behaviour is useful/expected is another matter entirely (and I certainly agree it's unexpected.) As noted on IRC, I suspect you're better off doing the resolving step separately. -- Niko Tyni nt...@debian.org
Bug#851388: IPv6 resolving broken
Hi, On So 15 Jan 2017 15:20:27 CET, Niko Tyni wrote: On Sat, Jan 14, 2017 at 02:25:51PM +, Mike Gabriel wrote: Package: libnetaddr-ip-perl Severity: important Version: 4.079+dfsg-1 Resolving DNS names to IPv6 addresses with NetAddr::IP->new6($hostname) fails and results in some IPv4'ish address with IPv6 syntax. 0:0:0:0:0:0:808:808/128 <- WTF??? 8.8.8.8/32 [ The first address is in the "IPv4-Compatible IPv6 Address" format (nowadays deprecated in favour of the "IPv4-Mapped IPv6 Address" format), see https://tools.ietf.org/html/rfc4291#section-2.5.5 ] FWIW it looks to me like this is more or less intentional behaviour. From the documentation of the new6() method: "->new6" and "->new_cis6" mark the address as being in ipV6 address space even if the format would suggest otherwise. i.e. ->new6('1.2.3.4') will result in ::102:304 [...] $addr can be any of the following and possibly more... [..] Fully Qualified Domain Name which returns an ipV4 address or an ipV6 address, embodied in that order. This seems to match the code as well, see http://sources.debian.net/src/libnetaddr-ip-perl/4.079%2Bdfsg-1/Lite/Lite.pm/#L1023 So it looks for an IPv4 address first as documented, and then makes an IPv6 address out of that, again as documented. Of course, whether this behaviour is useful/expected is another matter entirely (and I certainly agree it's unexpected.) As noted on IRC, I suspect you're better off doing the resolving step separately. Personally, I feel that instatiating an IPv6 address object from a DNS host name should end up with the real IPv6 address of that host (i.e. what you find in records of the FQDN, after resolving all CNAME references). Everything else feels like bogus behaviour... Just my 2ยข, Meanwhile, I implemented DNS resolution via Socket in UIF. So this issue is not bugging me that much anymore... Greets, Mike -- DAS-NETZWERKTEAM mike gabriel, herweg 7, 24357 fleckeby mobile: +49 (1520) 1976 148 landline: +49 (4354) 8390 139 GnuPG Fingerprint: 9BFB AEE8 6C0A A5FF BF22 0782 9AF4 6B30 2577 1B31 mail: mike.gabr...@das-netzwerkteam.de, http://das-netzwerkteam.de pgpvTq00Kab40.pgp Description: Digitale PGP-Signatur
Bug#851388: IPv6 resolving broken
Package: libnetaddr-ip-perl Severity: important Version: 4.079+dfsg-1 Resolving DNS names to IPv6 addresses with NetAddr::IP->new6($hostname) fails and results in some IPv4'ish address with IPv6 syntax. ``` #!/usr/bin/perl use NetAddr::IP; my $hostname = "google-public-dns-a.google.com"; my $ip6 = NetAddr::IP->new6($hostname); my $ip4 = NetAddr::IP->new($hostname); print "$ip6 <- WTF???\n"; print "$ip4\n"; exit(0); ``` ... gives... ``` [mike@minobo ~]$ ./netaddr-ip_resolv-ipv6.pl 0:0:0:0:0:0:808:808/128 <- WTF??? 8.8.8.8/32 ``` This issues currently causes this upstream bug in UIF [1]. Greets, Mike https://github.com/cajus/uif/issues/2 -- DAS-NETZWERKTEAM mike gabriel, herweg 7, 24357 fleckeby mobile: +49 (1520) 1976 148 landline: +49 (4354) 8390 139 GnuPG Fingerprint: 9BFB AEE8 6C0A A5FF BF22 0782 9AF4 6B30 2577 1B31 mail: mike.gabr...@das-netzwerkteam.de, http://das-netzwerkteam.de Digitale_PGP_Signatur Description: PGP signature pgpP87bFPXkwu.pgp Description: Digitale PGP-Signatur