delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2023/09/27/18:36:08

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B8CE238618C4
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1695854165;
bh=2m9trrIAD7Su7ZIHnfzsRAl45gi1NKzhuoo/GSrm+bM=;
h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:
From;
b=udnvNtHW4bHPjEhgPrIpMw8KF9JcRt3lD7tn4DiKUjxdWXkWBC8x4bMMMibuO9A9J
SjRt2txvS6aole38sLLVj2TnYEEo48YxLiDRFJn+UdWyBg9SHg2kEPuDCQTq/gZQig
gXVDZz48uCL1B1A4BxdMiXcuKUiwTdgykkpD1gNw=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0FE323857C71
X-Authority-Analysis: v=2.4 cv=JbqvEGGV c=1 sm=1 tr=0 ts=6514ae30
a=DxHlV3/gbUaP7LOF0QAmaA==:117 a=DxHlV3/gbUaP7LOF0QAmaA==:17 a=QLJBA3oMAAAA:8
a=IkcTkHD0fZMA:10 a=Gp-lxj9tAAAA:8 a=o-TP5xvWObpwlsgUgKYA:9 a=QEXdDO2ut3YA:10
a=rcIUkKV_xqxCC_XXXGoP:22 a=smTvJldoz-HJJhlRgX4u:22
Message-ID: <9bea176a-40d9-d7e0-9874-1fd625333940@Shaw.ca>
Date: Wed, 27 Sep 2023 16:35:27 -0600
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.15.1
Subject: Re: Cygwin/Win32 utility function to convert "raw" IPv6 address
string into *.ipv6-literal.net string ?
To: cygwin AT cygwin DOT com
References: <a0f1e420-ae48-49a3-9300-c56f1948ad9b DOT 8d485f54-9f47-42b0-bdcb-9635fbf663c3 DOT 1953b09c-03d1-4289-80f4-778eacaeb398 AT emailsignatures365 DOT codetwo DOT com>
<a0f1e420-ae48-49a3-9300-c56f1948ad9b DOT 93e247b8-206a-49dd-b71c-9240681180cb DOT af28cea3-9945-4ab0-bb94-5ee9947bdc30 AT emailsignatures365 DOT codetwo DOT com>
<a0f1e420-ae48-49a3-9300-c56f1948ad9b DOT e52b7f5f-5a09-4346-99f8-a6591191169c DOT 56a70ab3-2a48-435e-a1d6-57e7829aa764 AT emailsignatures365 DOT codetwo DOT com>
<AM5PR0502MB3075062AEA53351A74C19EA092C2A AT AM5PR0502MB3075 DOT eurprd05 DOT prod DOT outlook DOT com>
<DM8PR09MB70953E1499A9EE95DEA12121A5C2A AT DM8PR09MB7095 DOT namprd09 DOT prod DOT outlook DOT com>
Organization: Inglis
In-Reply-To: <DM8PR09MB70953E1499A9EE95DEA12121A5C2A@DM8PR09MB7095.namprd09.prod.outlook.com>
X-CMAE-Envelope: MS4xfCLM9wPv5bHF2NZF6KVdDkX6nSeL92mTw6t5GUHvpLy9KbaWMR12Vw1ZhRCWWMCTJ1JxX6VYbsnaTwnHVSctdlDagIf5RmqS2aS5TQ1NneHqxWHjD1F9
Q65rjxjuz/57KcdLjJts7rhc7gxbx3/KOcZ2SsrPXsjHgASizGEGUUsVY031osxwp/LQ+UHBZhpAVA==
X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_SIGNED,
DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_LOW,
SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
server2.sourceware.org
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Brian Inglis via Cygwin <cygwin AT cygwin DOT com>
Reply-To: cygwin AT cygwin DOT com
Cc: Brian Inglis <Brian DOT Inglis AT Shaw DOT ca>
Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 38RMa8wL017168

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019