public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Brian Inglis <Brian.Inglis@Shaw.ca>
To: cygwin@cygwin.com
Subject: Re: Cygwin/Win32 utility function to convert "raw" IPv6 address string into *.ipv6-literal.net string ?
Date: Wed, 27 Sep 2023 16:35:27 -0600	[thread overview]
Message-ID: <9bea176a-40d9-d7e0-9874-1fd625333940@Shaw.ca> (raw)
In-Reply-To: <DM8PR09MB70953E1499A9EE95DEA12121A5C2A@DM8PR09MB7095.namprd09.prod.outlook.com>

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


  reply	other threads:[~2023-09-27 22:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <a0f1e420-ae48-49a3-9300-c56f1948ad9b.8d485f54-9f47-42b0-bdcb-9635fbf663c3.1953b09c-03d1-4289-80f4-778eacaeb398@emailsignatures365.codetwo.com>
     [not found] ` <a0f1e420-ae48-49a3-9300-c56f1948ad9b.93e247b8-206a-49dd-b71c-9240681180cb.af28cea3-9945-4ab0-bb94-5ee9947bdc30@emailsignatures365.codetwo.com>
     [not found]   ` <a0f1e420-ae48-49a3-9300-c56f1948ad9b.e52b7f5f-5a09-4346-99f8-a6591191169c.56a70ab3-2a48-435e-a1d6-57e7829aa764@emailsignatures365.codetwo.com>
2023-09-27 16:40     ` Mainz, Roland
2023-09-27 17:02       ` Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2023-09-27 22:35         ` Brian Inglis [this message]
2023-09-27 23:56           ` [EXTERNAL] " Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2023-09-28 17:48             ` Brian Inglis
2023-09-28 17:56               ` Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2023-09-28 18:53                 ` Jeffrey Altman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9bea176a-40d9-d7e0-9874-1fd625333940@Shaw.ca \
    --to=brian.inglis@shaw.ca \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).