From: Andreas Schwab <schwab@suse.de>
To: Florian Weimer <fweimer@redhat.com>
Cc: Andreas Schwab via Libc-alpha <libc-alpha@sourceware.org>
Subject: Re: [PATCH] Update getaddrinfo to RFC 6724 (bug 29496)
Date: Mon, 04 Sep 2023 18:16:35 +0200 [thread overview]
Message-ID: <mvm5y4p3od8.fsf@suse.de> (raw)
In-Reply-To: <87v8cqsznx.fsf@oldenburg3.str.redhat.com> (Florian Weimer's message of "Mon, 04 Sep 2023 17:53:22 +0200")
On Sep 04 2023, Florian Weimer wrote:
>> @@ -1653,7 +1667,7 @@ rfc3484_sort (const void *p1, const void *p2, void *arg)
>> in_addr_t netmask2 = 0xffffffffu << (32 - a2->prefixlen);
>>
>> if ((in2_src_addr & netmask2) == (in2_dst_addr & netmask2))
>> - bit2 = fls (in2_dst_addr ^ in2_src_addr);
>> + bit2 = a2->prefixlen;
>> }
>
> This is an undocumented change that I can't find in RFC 6724.
See Appendix B, changes to the rules, "Changed the definition of
CommonPrefixLen()".
>
>> else if (a1->dest_addr->ai_family == PF_INET6)
>> {
>> @@ -1672,18 +1686,33 @@ rfc3484_sort (const void *p1, const void *p2, void *arg)
>>
>> int i;
>> for (i = 0; i < 4; ++i)
>> {
>> + uint32_t mask1, mask2;
>> + if (i * 32 >= a1->prefixlen)
>> + mask1 = 0;
>> + else if ((i + 1) * 32 > a1->prefixlen)
>> + mask1 = 0xffffffffu << (32 - (a1->prefixlen & 31));
>> + else
>> + mask1 = 0xffffffffu;
>> + if (i * 32 >= a2->prefixlen)
>> + mask2 = 0;
>> + else if ((i + 1) * 32 > a2->prefixlen)
>> + mask2 = 0xffffffffu << (32 - (a2->prefixlen & 31));
>> + else
>> + mask2 = 0xffffffffu;
>> + if (((in1_dst->sin6_addr.s6_addr32[i]
>> + ^ in1_src->sin6_addr.s6_addr32[i]) & htonl (mask1)) != 0
>> + || ((in2_dst->sin6_addr.s6_addr32[i]
>> + ^ in2_src->sin6_addr.s6_addr32[i]) & htonl (mask2)) != 0)
>> + {
>> + bit1 = fls (ntohl (in1_dst->sin6_addr.s6_addr32[i]
>> + ^ in1_src->sin6_addr.s6_addr32[i])
>> + & mask1);
>> + bit2 = fls (ntohl (in2_dst->sin6_addr.s6_addr32[i]
>> + ^ in2_src->sin6_addr.s6_addr32[i])
>> + & mask2);
>> + break;
>> + }
>
> Why use the common prefix length for IPv6 addresses? RFC 6724 pretends
> that IPv6 assignment is strictly hierarchical, but in reality, it's
> not. Shouldn't we do the same thing as for IPv4 addresses?
That's the same consequence as above due to the changes in
CommonPrefixLen.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
next prev parent reply other threads:[~2023-09-04 16:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-06 9:28 Andreas Schwab
2023-09-04 15:53 ` Florian Weimer
2023-09-04 16:16 ` Andreas Schwab [this message]
2023-09-05 12:19 ` Florian Weimer
2023-09-05 12:31 ` Andreas Schwab
2023-09-05 12:44 ` Florian Weimer
2023-10-24 11:27 Andreas Schwab
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=mvm5y4p3od8.fsf@suse.de \
--to=schwab@suse.de \
--cc=fweimer@redhat.com \
--cc=libc-alpha@sourceware.org \
/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).