Re: [netmod] Changes to IPv6 zone definition in draft-ietf-netmod-rfc6991-bis-15

Jürgen Schönwälder <jschoenwaelder@constructor.university> Thu, 18 April 2024 12:58 UTC

Return-Path: <jschoenwaelder@constructor.university>
X-Original-To: netmod@ietfa.amsl.com
Delivered-To: netmod@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id BF3C5C14F683 for <netmod@ietfa.amsl.com>; Thu, 18 Apr 2024 05:58:29 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.234
X-Spam-Level:
X-Spam-Status: No, score=-1.234 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_SOFTFAIL=0.665] autolearn=no 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 iqzTKLKnHa1P for <netmod@ietfa.amsl.com>; Thu, 18 Apr 2024 05:58:25 -0700 (PDT)
Received: from beadg.de (beadg.de [178.254.54.206]) by ietfa.amsl.com (Postfix) with ESMTP id 51433C14F615 for <netmod@ietf.org>; Thu, 18 Apr 2024 05:58:23 -0700 (PDT)
Received: from localhost (firewallix.jacobs-university.de [212.201.44.246]) by beadg.de (Postfix) with ESMTPSA id 4E0AC16A044; Thu, 18 Apr 2024 14:58:21 +0200 (CEST)
Date: Thu, 18 Apr 2024 14:58:20 +0200
From: Jürgen Schönwälder <jschoenwaelder@constructor.university>
To: Brian E Carpenter <brian.e.carpenter@gmail.com>
Cc: NETMOD Working Group <netmod@ietf.org>
Message-ID: <ZiEY7E7NfdzBGfze@alice.eecs.jacobs-university.de>
Reply-To: Jürgen Schönwälder <jschoenwaelder@constructor.university>
Mail-Followup-To: Brian E Carpenter <brian.e.carpenter@gmail.com>, NETMOD Working Group <netmod@ietf.org>
References: <BY5PR11MB41966FD2ECEFB84708C5A325B5869@BY5PR11MB4196.namprd11.prod.outlook.com> <16d6f918-ea40-3596-9292-d2656eec8ad4@gmail.com> <8d491135-c720-228c-efad-f1f3fa113545@gmail.com> <B655FE46-F8B9-4BAD-A4AF-7E6E2627ACE9@gmail.com> <1786272e-6982-42b3-a9f3-31cf5075089d@gmail.com> <797b0f5f-b1b1-45a9-82b7-75ed6ff65007@constructor.university> <8945f512-785d-479d-a442-20cc1b402d5a@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <8945f512-785d-479d-a442-20cc1b402d5a@gmail.com>
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/PradmLiIP6bjUU89zWXSWLTsdbw>
Subject: Re: [netmod] Changes to IPv6 zone definition in draft-ietf-netmod-rfc6991-bis-15
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: NETMOD WG list <netmod.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/netmod>, <mailto:netmod-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/netmod/>
List-Post: <mailto:netmod@ietf.org>
List-Help: <mailto:netmod-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/netmod>, <mailto:netmod-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 18 Apr 2024 12:58:29 -0000

On Mon, Apr 08, 2024 at 10:03:14AM +1200, Brian E Carpenter wrote:
> > 
> > > While I'm here, I looked at typedef ipv6-address {}. Two comments:
> > > 
> > > 1. "If the zone index is not present, the default zone of the device
> > > will be used."
> > > FYI, although RFC 4007 describes the default zone, it's optional. For
> > > example, there is no default zone on Linux; if you execute a socket call
> > > with a zero or null zone, it's a run-time error.
> > 
> > I am pretty optimistic that you can memset a sockaddr_in6 to zero and
> > then fill out the sin6_addr field and things will work.
> 
> I'm afraid not. If you call sendmsg() with a link-local destination and
> a zero sin6_scope_id, you get "[Errno 22] Invalid argument". If you call
> it with a non-existing positive value, you get "[Errno 101] Network is
> unreachable".
> 
> Tested on my Linux machine with the attached Python script. And I knew
> this anyway from testing with ping.

So for a global address, a sin6_scope_id set to 0 means the scope is
ignored but for a non-global address, a 0 is taken as something that
must resolve to an interface numbered 0 (which likely does not exist)?

So what do we do, simply remove the sentence that talks about a
default zone?

> > Perhaps the zero
> > is not what RFC 4007 calls the default zone, then we need to find
> > better wording. But then RFC 4007 also says:
> > 
> >      An implementation should also support the concept of a "default" zone
> >      for each scope.  And, when supported, the index value zero at each
> >      scope SHOULD be reserved to mean "use the default zone".
> 
> However, that "should" and "SHOULD" have not been implemented for Linux.

> > > 2. There seems to be a limited character set for the zone ID. RFC 4007
> > > doesn't restrict the character set; it just says "non-null strings".
> > > IMHO that's a bug, but if I want to name an interface
> > > *%!@#$^&()_-+=:;'"?\|}{}{/.><, it's allowed by the RFC. (The text
> > > doesn't even specify ASCII, and the remark about "conflict with the
> > > delimiter" is meaningless, if you think about parsing.)
> > 
> > > If you intend to limit the character set more than RFC 4007 does, that
> > > should be stated, and probably discussed on the 6man list.
> > 
> > Yes, the zone ID is underspecified, and we can't really fix that. What
> > we had did not allow forward slashes, although they are used by some
> > vendors. So we are trying to improve but whatever we do is debatable
> > since the zone ID is underspecified. (On Linux, I am pretty sure an
> > interface name does not even have to be ASCII or UTF-8. Whatever we
> > end up doing, we will likely assume UTF-8.)
> 
> OK, I understand that choice. Maybe you should say in the description
> that the zone ID is underspecified in the RFC?

I will make the zone match .+ and adapt text from the definition of
interface names (interfaces/name):

   If a system uses zone names that are not represented in UTF-8, then
   an implementation needs to use some mechanism to transform the
   local name into UTF-8. The definition of such a mechanism is
   outside the scope of this document.

> > This is why I suggested to write an ID that explains what happens if
> > people go creative with zone IDs so that people know that certain zone
> > IDs will not play nice with YANG modules, certain zone IDs will not play
> > nice with URLs and so on. People can than take an informed decision and
> > deal with the consequences.
> 
> Well, I think 6man really ought to clean up RFC 4007 in this respect.
> But that is a battle for another day.
> 
>     Brian

> import socket
> 
> def tryz(zone):
>     try:
>         print("Trying zone", zone)
>         sock = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM)
>         sock.connect(("fe80::2e3a:fdff:fea4:dde7", 12345, 0, zone))
>         result = sock.sendmsg([msg_bytes])
>         print("Result:", result, "bytes sent")
>         sock.close()
>     except Exception as e:
>         print(e)
> 
> msg_bytes = bytes(b"Test")
> 
> tryz(socket.if_nametoindex("wlp2s0"))
> tryz(99)
> tryz(0)

On Linux 6.1.0 (Debian 12.5), I get:

Trying zone 2
Result: 4 bytes sent
Trying zone 99
[Errno 101] Network is unreachable
Trying zone 0
[Errno 22] Invalid argument

On MacOS 14.4.1, I get:

Trying zone 4
Result: 4 bytes sent
Trying zone 99
[Errno 22] Invalid argument
Trying zone 0
[Errno 65] No route to host

Apparently, the behaviours of implementations vary...

/js

-- 
Jürgen Schönwälder              Constructor University Bremen gGmbH
Phone: +49 421 200 3587         Campus Ring 1 | 28759 Bremen | Germany