mysql - IPv6 SQL to Perl -


i have field in mysql table varbinary(16), stores binary ipv6 addresses.

while toying around code , testing stuff, filled 1 of records binary value for:

0fff0fff0fff0fff0fff0fff0fe00000 

(this value see in phpmyadmin)

when call value query:

select inet6_ntoa(value) table 

the return value

fff:fff:fff:fff:fff:fff:fe0:: 

in perl, when try put net::ip-object:

$ip = new net::ip('fff:fff:fff:fff:fff:fff:fe0::', 6); 

it returns undefined.

my questions:

  • who or wrong here?
  • why?
  • what can make perl understand ip address i'm giving it?

apparently mysql , net::ip not agree on use of :: represent trailing :0.

as far understand rfc4191, fff:fff:fff:fff:fff:fff:fe0:: should valid ipv6 address (expanded 0fff:0fff:0fff:0fff:0fff:0fff:0fe0:0000), net::ip not seem agree.

net::ip seems agree on using :: trailing :0:0, not :0. ok :: replacing single :0: anywhere else. looks bug. can traced down ip_is_ipv6 thinks ipv6 address cannot have 8 :s (which true in cases single leading or trailing 0 replaced ::).

you bit of preprocessing replace trailing :: :0 , leading :: 0: if there 8 colons in ip.

edit

it turns out rfc5952 says single 0 (and hence trailing :0) should not replaced :: in output, mysql inet6_ntoa @ fault, still says rfc4191-compliant addresses should accepted input, net::ip should accept nonetheless. fixing bug on either side address issue.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -