On 2023-09-27 11:02, Lavrentiev, Anton (NIH/NLM/NCBI) [C] via Cygwin wrote:
Does Cygwin (or Win32) have a function to convert "raw" ASCII IPv6 addresses 
into *.ipv6-
literal.net per

Not hard to change ":" to "-" and append .ipv6-literal.net - in bash:

        ${addrv6//:/-}.ipv6-literal.net

        $ getent ahosts -- --1.ipv6-literal.net
        ::1             STREAM ::1
        ::1             DGRAM  ::1

If Windows API is documented to have such a function, you should be able find
it in the w32api package in Cygwin.
As for the "literal" representation, the only "standard" and documented IPv6 DNS notation is in the .ip6.arpa domain (the analog for IPv4's "in-addr.arpa").
Microsoft seems to have uniquely "enhanced" that convention to use a more
compact notation... > Even though it says it resolves internally without DNS on 
Windows, this
convention is not likely portable (and will cause an actual DNS hit on other
platforms that do not specially recognize ".ipv6-literal.net" -- unlike the
treatment of ".ip6.arpa").
And a likely result of that is going to be "NXDOMAIN" (domain does not
exist).
Just have to unstuff any "::" to enough ":0000...:" to make 8 groups, fill to 4 hex digits each, strip the ":"s then reverse the (hex) digits or vice versa, add "."s after each, and add ip6.arpa e.g.

::1 ->
0000:0000:0000:0000:0000:0000:0000:0001 -> 1000:0000:0000:0000:0000:0000:0000:0000 ->
10000000000000000000000000000000 ->
1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa

$ host -t ptr \
        1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa
1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa domain name pointer localhost.

but there may be few PTR records set up or recognized for IP V6 addresses.

--
Take care. Thanks, Brian Inglis              Calgary, Alberta, Canada

La perfection est atteinte                   Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter  not when there is no more to add
mais lorsqu'il n'y a plus rien à retirer     but when there is no more to cut
                                -- Antoine de Saint-Exupéry


--
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

Reply via email to