From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id 8560C3857C46; Tue, 18 Jan 2022 10:32:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8560C3857C46 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Corinna Vinschen To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: resolver: Added processing of AAAA records X-Act-Checkin: newlib-cygwin X-Git-Author: Anton Lavrentiev via Cygwin-patches X-Git-Refname: refs/heads/master X-Git-Oldrev: 90947659b0b0de783874abf4143099cc71a54308 X-Git-Newrev: e195f51af76687d2aebfdd0b24517bd923024b7a Message-Id: <20220118103230.8560C3857C46@sourceware.org> Date: Tue, 18 Jan 2022 10:32:30 +0000 (GMT) X-BeenThere: cygwin-cvs@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component git logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Jan 2022 10:32:30 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3De195f51af76= 687d2aebfdd0b24517bd923024b7a commit e195f51af76687d2aebfdd0b24517bd923024b7a Author: Anton Lavrentiev via Cygwin-patches Date: Mon Jan 17 13:03:14 2022 -0500 Cygwin: resolver: Added processing of AAAA records =20 AAAA records returned from Windows resolver were flagged as "No structure" in debug output because of being processed (although correctly) in the default catch-all case. This patch makes the AAAA records properly recognized. Diff: --- winsup/cygwin/libc/minires-os-if.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/winsup/cygwin/libc/minires-os-if.c b/winsup/cygwin/libc/minire= s-os-if.c index 6b4c5e33e..bb6786f6c 100644 --- a/winsup/cygwin/libc/minires-os-if.c +++ b/winsup/cygwin/libc/minires-os-if.c @@ -69,15 +69,14 @@ static unsigned char * write_record(unsigned char * ptr= , PDNS_RECORD rr, =20 switch(rr->wType) { case DNS_TYPE_A: + case DNS_TYPE_AAAA: { - u_int8_t * aptr =3D (u_int8_t *) & rr->Data.A.IpAddress; - if (ptr + 4 <=3D EndPtr) { - ptr[0] =3D aptr[0]; - ptr[1] =3D aptr[1]; - ptr[2] =3D aptr[2]; - ptr[3] =3D aptr[3]; - } - ptr +=3D 4; + u_int8_t * aptr =3D rr->wType =3D=3D DNS_TYPE_A + ? (u_int8_t *) & rr->Data.A.IpAddress : (u_int8_t *) & rr->Data.AAAA= .Ip6Address; + int sz =3D rr->wType =3D=3D DNS_TYPE_A ? NS_INADDRSZ/*4*/ : NS_IN6ADDR= SZ/*16*/; + if (ptr + sz <=3D EndPtr) + memcpy(ptr, aptr, sz); + ptr +=3D sz; break; } case DNS_TYPE_NS: