Re: Cygwin/Win32 utility function to convert "raw" IPv6 address string into *.ipv6-literal.net string ?

2023-09-28 Thread Jeffrey Altman via Cygwin

On 9/28/2023 1:56 PM, Lavrentiev, Anton (NIH/NLM/NCBI) [C] via Cygwin wrote:

What do you think that output is - the PTR is resolved to "localhost."

You obviously did not get the point that I was making.  Using ip6.arpa *is* the 
standard
way to get around with "DNS-like" IPv6 addresses, as it would be "understood".  
Using
the "ipv6-literal.net" domain is not portable and would result in NXDOMAIN 
anywhere
but Windows (where the resolver seems to intercept and convert them internally).


The ip6.arpa names are used to lookup PTR records which contain hostnames.

The ipv6-literal.net names are used to simulate  records and map the 
name to an IPv6 address (with an optional address scope).


For those that are unaware of the history[1][2][3], UNC names support 
the use of IPv4 addresses as an alternative to SMB server names or DNS 
host names. End users expect to be able to specify a UNC path such as \\2001:db8:85a3:8d3:1319:8a2e:370:7348\share


or

  \\[2001:db8:85a3:8d3:1319:8a2e:370:7348]\share

However, colons are illegal in UNC paths and therefore standard IPv6 
representations cannot be used. The .ipv6-literal.net 
server name is a method of representing an IPv6 address as a UNC server 
name such that it can be locally translated by getaddrinfo() into an 
IPv6 address without querying DNS. \\2001-db8-85a3-8d3-1319-8a2e-370-7348.ipv6-literal.net\share


If the ipv6.arpa 
representation\\8.4.3.7.0.7.3.0.e.2.a.8.9.1.3.1.3.d.8.0.3.a.5.8.8.b.d.0.1.0.0.2.ip6.arpa\path

was used as a server name and treated as a DNS  lookup that would be harder 
for
humans to construct and no more portable.   The ip6.arpa representation would 
also
be unable to represent IPv6 address scopes which are supported by 
ipv6-literal.net
names.

I am unaware of any Microsoft Windows APIs that can be called to translate from
an IPv6 address to an ipv6-literal.net string.

[1] 
https://en.wikipedia.org/wiki/IPv6_address#Literal_IPv6_addresses_in_UNC_path_names 
[2] https://devblogs.microsoft.com/oldnewthing/20100915-00/?p=12863 [3] 
https://learn.microsoft.com/en-us/windows/win32/api/winnetwk/nf-winnetwk-wnetaddconnection3a 





smime.p7s
Description: S/MIME Cryptographic Signature

-- 
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


RE: [EXTERNAL] Re: Cygwin/Win32 utility function to convert "raw" IPv6 address string into *.ipv6-literal.net string ?

2023-09-28 Thread Lavrentiev, Anton (NIH/NLM/NCBI) [C] via Cygwin
> What do you think that output is - the PTR is resolved to "localhost."

You obviously did not get the point that I was making.  Using ip6.arpa *is* the 
standard
way to get around with "DNS-like" IPv6 addresses, as it would be "understood".  
Using
the "ipv6-literal.net" domain is not portable and would result in NXDOMAIN 
anywhere
but Windows (where the resolver seems to intercept and convert them internally).

Anton Lavrentiev
Contractor NIH/NLM/NCBI


-- 
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


Re: [EXTERNAL] Re: Cygwin/Win32 utility function to convert "raw" IPv6 address string into *.ipv6-literal.net string ?

2023-09-28 Thread Brian Inglis via Cygwin

On 2023-09-27 17:56, Lavrentiev, Anton (NIH/NLM/NCBI) [C] wrote:

$ 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.



I was talking about resolving the .ipv6-literal.net names via DNS.
Such as "fe80--219-99ff-feae-73ce.ipv6-literal.net"


What do you think that output is - the PTR is resolved to "localhost."

I find *host* easier to use, script, and more tersely informative than the other 
bind DNS utilities: the bind-utils Cygwin package contains DNS utilities:


delv
dig
host
mdig
named-rrchecker
nslookup
nsupdate

and the lookups support most of the same arguments and options, with different 
names and defaults: host defaults to -t A -t  -t MX, but host and nslookup 
only accept a single type, while dig accepts -t ANY; delv and mdig will do deep 
dives for DNSSEC and DNS; while named-rrchecker validates DNS RR inputs.


--
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


RE: [EXTERNAL] Re: Cygwin/Win32 utility function to convert "raw" IPv6 address string into *.ipv6-literal.net string ?

2023-09-27 Thread Lavrentiev, Anton (NIH/NLM/NCBI) [C] via Cygwin
> $ host -t ptr

I was talking about resolving the .ipv6-literal.net names via DNS.

Such as "fe80--219-99ff-feae-73ce.ipv6-literal.net"

Anton Lavrentiev
Contractor NIH/NLM/NCBI


-- 
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


Re: Cygwin/Win32 utility function to convert "raw" IPv6 address string into *.ipv6-literal.net string ?

2023-09-27 Thread Brian Inglis via Cygwin

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 ":...:" 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 ->
:::::::0001 -> 
1000::::::: ->

1000 ->
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


RE: Cygwin/Win32 utility function to convert "raw" IPv6 address string into *.ipv6-literal.net string ?

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

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).

HTH,

Anton Lavrentiev
Contractor NIH/NLM/NCBI

-- 
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