Re: Question about RFC6724

JINMEI Tatuya / 神明達哉 <jinmei@wide.ad.jp> Mon, 02 May 2022 23:42 UTC

Return-Path: <jinmei@wide.ad.jp>
X-Original-To: ipv6@ietfa.amsl.com
Delivered-To: ipv6@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 2D176C14F745 for <ipv6@ietfa.amsl.com>; Mon, 2 May 2022 16:42:54 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.9
X-Spam-Level:
X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5jN_EAZFXMVj for <ipv6@ietfa.amsl.com>; Mon, 2 May 2022 16:42:52 -0700 (PDT)
Received: from mail.wide.ad.jp (mail.wide.ad.jp [IPv6:2001:200:0:1::7]) by ietfa.amsl.com (Postfix) with ESMTP id 6887AC14EB1F for <ipv6@ietf.org>; Mon, 2 May 2022 16:42:51 -0700 (PDT)
Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) (authenticated (0 bits)) by mail.wide.ad.jp (8.14.1+3.5Wbeta/8.14.1/smtpfeed 1.21) with ESMTP id 242NgjO7028206 (using TLSv1/SSLv3 with cipher AES128-GCM-SHA256 (128 bits) verified OK) for <ipv6@ietf.org>; Tue, 3 May 2022 08:42:46 +0900 (JST)
Received: by mail-pf1-f182.google.com with SMTP id v11so4000601pff.6 for <ipv6@ietf.org>; Mon, 02 May 2022 16:42:46 -0700 (PDT)
X-Gm-Message-State: AOAM533c6Nmc7T0Y7V6z20cVebDmc3nTlKF5YJtNagJ4TJq1o8TB5v7m Ubx6smG5PxrHK86f1PS2m0m+oh3ZTI06lYQvxso=
X-Google-Smtp-Source: ABdhPJysrmZNVvPQ/NHBRbIQywHr8q7KGs27Z/2JyqLTM6n4nqIhl2oOdbX0fjcdBAlJ2B8hMawUqIYrKDB4iB4XqQc=
X-Received: by 2002:a62:d415:0:b0:50d:baaf:4156 with SMTP id a21-20020a62d415000000b0050dbaaf4156mr13564881pfh.28.1651534965320; Mon, 02 May 2022 16:42:45 -0700 (PDT)
MIME-Version: 1.0
References: <985e9c94-b6f7-b45d-208d-e9b26664540b@gmail.com>
In-Reply-To: <985e9c94-b6f7-b45d-208d-e9b26664540b@gmail.com>
From: JINMEI Tatuya / 神明達哉 <jinmei@wide.ad.jp>
Date: Mon, 02 May 2022 16:42:33 -0700
X-Gmail-Original-Message-ID: <CAJE_bqfpURs++e9FaECp7zJFD3tTz4FGizYUo58U_7Ge1sWa0Q@mail.gmail.com>
Message-ID: <CAJE_bqfpURs++e9FaECp7zJFD3tTz4FGizYUo58U_7Ge1sWa0Q@mail.gmail.com>
Subject: Re: Question about RFC6724
To: Brian E Carpenter <brian.e.carpenter@gmail.com>
Cc: 6man <ipv6@ietf.org>
Content-Type: text/plain; charset="UTF-8"
Archived-At: <https://mailarchive.ietf.org/arch/msg/ipv6/E22fMf5cJBmYjGYDQabpyMdPhf4>
X-BeenThere: ipv6@ietf.org
X-Mailman-Version: 2.1.34
Precedence: list
List-Id: "IPv6 Maintenance Working Group \(6man\)" <ipv6.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/ipv6>, <mailto:ipv6-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/ipv6/>
List-Post: <mailto:ipv6@ietf.org>
List-Help: <mailto:ipv6-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/ipv6>, <mailto:ipv6-request@ietf.org?subject=subscribe>
X-List-Received-Date: Mon, 02 May 2022 23:42:54 -0000

On Sun, May 1, 2022 at 9:33 PM Brian E Carpenter
<brian.e.carpenter@gmail.com> wrote:

> > 2.2.  Common Prefix Length
> >
> >    We define the common prefix length CommonPrefixLen(S, D) of a source
> >    address S and a destination address D as the length of the longest
> >    prefix (looking at the most significant, or leftmost, bits) that the
> >    two addresses have in common, up to the length of S's prefix (i.e.,
> >    the portion of the address not including the interface ID).  For
> >    example, CommonPrefixLen(fe80::1, fe80::2) is 64.
>
> The "interface ID" is simply a non-concept for IPv4-mapped IPv6 addresses. So what do implementations do?

I've just checked an implementation I'm relatively familiar with, and
found that it seems to completely ignore the "up to the length of S's
prefix" part:
https://github.com/freebsd/freebsd-src/blob/271f6d52a606e86c11b366082f11fe69350f24da/lib/libc/net/getaddrinfo.c#L924
that is, it compares the entire 128-bit IPv6 addresses and 32-bit IPv4
addresses.

But I don't think the specification simply "doesn't work for
::ffff:0:0/96" (or IPv4 addresses).
Since 'S' is a local address, the implementation should also be able
to get the corresponding netmask
(which should be contiguous in practice, and can be converted to a
"prefix length").
An implementation could apply that prefix and compare the
corresponding IPv4 addresses
up to that length of bits.
Extending it to the form of IPv4-mapped IPv6 addresses would be straightforward,
although the RFC text could have been clearer for that case.

--
jinmei