Hi, On So 15 Jan 2017 15:20:27 CET, Niko Tyni wrote:
On Sat, Jan 14, 2017 at 02:25:51PM +0000, 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, seehttp://sources.debian.net/src/libnetaddr-ip-perl/4.079%2Bdfsg-1/Lite/Lite.pm/#L1023So 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 AAAA 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