Re: [dhcwg] recommendation on DHCP6 source port numbers

Tomoyuki Sahara <tsahara@iij.ad.jp> Fri, 01 March 2024 04:26 UTC

Return-Path: <tsahara@iij.ad.jp>
X-Original-To: dhcwg@ietfa.amsl.com
Delivered-To: dhcwg@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id ACBFFC14F6B1 for <dhcwg@ietfa.amsl.com>; Thu, 29 Feb 2024 20:26:29 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -7.107
X-Spam-Level:
X-Spam-Status: No, score=-7.107 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, URIBL_DBL_BLOCKED_OPENDNS=0.001, URIBL_ZEN_BLOCKED_OPENDNS=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=iij.ad.jp
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 oixccR3fza0u for <dhcwg@ietfa.amsl.com>; Thu, 29 Feb 2024 20:26:25 -0800 (PST)
Received: from omgo.iij.ad.jp (mo1121.iij.ad.jp [202.232.173.189]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 96EE9C14F6AD for <dhcwg@ietf.org>; Thu, 29 Feb 2024 20:26:25 -0800 (PST)
DKIM-Signature: v=1;a=rsa-sha256;c=relaxed/simple;d=iij.ad.jp;h=Date: Message-Id:To:Cc:Subject:From:In-Reply-To:References:Mime-Version: Content-Type:Content-Transfer-Encoding;i=tsahara@iij.ad.jp;s=omgo2;t= 1709267167; x=1710476767; bh=DieTDcXYgnK8vvALp45EXHP6Nj4wb8fRiV7O+U6B0iM=; b=tQd 89qqQ+ulkGtID3do8PDbPDYHbfNKaLr0I26sL+385JkvrN68/s6kfktwl5owriWzIUvuTZN9NtzCg XGenS74aagQWt6GVquH/m7yEf6RFDxAv33R/BgnAL+xxhKMRpoMfQSVO4yCajIVHVMWyFBTp3WqP8 HmKhdu4ZiKKY6vLnjYctAtgYUX+4RC8nVCOlrs5loqPqLPpzpJmV4asBp6g2SjdoL2sPA2txyXHbD RNtGzhWb4Od+nRmNnD5/jm9BQqxAUtE1hZMqeZuMCB1+ZtCAJENjywXf6ORgHluD/wF3xDd2krUl8 Ap4+s+EkIb7tVmLhuwa90pwJH6a7sCQ==;
Received: by omgo.iij.ad.jp (of-mo1121) id 4214Q7eH3412388; Fri, 1 Mar 2024 13:26:07 +0900
X-ENVID: IIJ
X-Iguazu-Qid: C8OKDsljnhIwWcU9Sa
X-Iguazu-QSIG: v=2; s=0; t=1709267167; q=C8Oj52lBmYBxprmAk4; m=XmBCoR4mUftLAv2jVvwgWuC4vwlrSKbpIZ9jvltXktk=
Date: Fri, 01 Mar 2024 13:26:00 +0900
Message-Id: <20240301.132600.531322798554788835.tsahara@iij.ad.jp>
To: bevolz@gmail.com
Cc: lorenzo@google.com, otroan@employees.org, dhcwg@ietf.org
From: Tomoyuki Sahara <tsahara@iij.ad.jp>
In-Reply-To: <4A3D8AF6-A89A-4AB2-BACA-71F76378AD3E@gmail.com>
References: <CAKD1Yr3Hwgu+dTxHB-1PQR2Qxz4bxLWP_0-q-MC4MEiM7j-FLw@mail.gmail.com> <4A3D8AF6-A89A-4AB2-BACA-71F76378AD3E@gmail.com>
X-Mailer: Mew version 6.9 on Emacs 28.2
Mime-Version: 1.0
Content-Type: Text/Plain; charset="utf-8"
Content-Transfer-Encoding: base64
Archived-At: <https://mailarchive.ietf.org/arch/msg/dhcwg/dO5DMZtGWF0q8i4plI5i-JCWiiU>
Subject: Re: [dhcwg] recommendation on DHCP6 source port numbers
X-BeenThere: dhcwg@ietf.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: Dynamic Host Configuration <dhcwg.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/dhcwg>, <mailto:dhcwg-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/dhcwg/>
List-Post: <mailto:dhcwg@ietf.org>
List-Help: <mailto:dhcwg-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/dhcwg>, <mailto:dhcwg-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 01 Mar 2024 04:26:29 -0000

>That would not solve anything for (b) clients.

Yes.  The recomendation is not for the existing clients but
for new client implementations.

Consider 3 new DHCP6 client implementations:

  (C1) sends messages from 546 and receives messages on 546.
  (C2) sends messages from 12345 (a random port) and receives messages
      on 546.
  (C3) sends messages from 12345 and receives messages on 12345.

and 2 existing DHCP6 servers on the market:

  (a) sends response messages to 546.
  (b) sends response messages to the source port of the request message.

(C1) interoperates with both (a) and (b).
(C2) interoperates with (a) but does not interoperate with (b).
(C3) does not interoperate with (a) but interoperates with (b).

(C1) and (C2) follow the specification to listen on 546.  But (C2) does
not interoperate with (b).  So, I have recommended (C1) - sending
messages from the standard source port.


Thanks,
Tomoyuki

>Yes, that is correct - (a).
>
>If a client does (b), it would never get any messages from server.
>
> To interoperaate with both (a) and (b), we should
> send request messages from the standard source port number 546/547.
>
>That would not solve anything for (b) clients. The source port doesn’t
>matter to them if they are waiting for traffic on another port.
>
>- Bernie
>
> On Feb 29, 2024, at 2:23 AM, Lorenzo Colitti <lorenzo@google.com> wrote:
>
> Isn't b) a violation of the RFC? If a client sends a message from port
> 12345 to 547, then shouldn't the server send the message to destination
> port 546, since the RFC says "clients listen for DHCP messages on UDP
> port 546"?
>
> On Thu, Feb 29, 2024 at 4:19 PM Tomoyuki Sahara <tsahara@iij.ad.jp>
> wrote:
>
> The clarification text should be helpful for new DHCP6 implementers
> and network operators who write firewall rules.
>
> But when client/server received a request message from a random
> port,
> which port should they send a response message to?  There are two
> types
> of implementations on the market (and on my desk):
>
>   (a) returns to 546/547.
>   (b) returns to the source port of the request message.
>
> (a) follows the text in RFC8415 strictly.  (b) follows normal UDP
> communication rules.  To interoperaate with both (a) and (b), we
> should
> send request messages from the standard source port number 546/547.
> That is not obvious and I think it is worth mentioning that in the
> spec.
>
> Thanks,
> Tomoyuki
>
> >Yes, I got it wrong. Been a while since that part of the code was
> done.
> >
> >I agree with Lorenzo:
> >
> > I do think the current text is ambiguous. In practice it allows
> > arbitrary source ports, but because this is unusual, implementers
> might
> > assume that the other side is using the same port to send and
> receive.
> > Such an implementation might not interoperate. So if we think the
> > behaviour is OK, then we should clarify the text to say that the
> source
> > port is not specified and clients and servers need to be prepared
> to
> > receive messages from arbitrary source ports.
> >
> >We do allow arbitrary source ports and as there are lots if
> implementations
> >in existence with that behavior, we should just clarify it: "The
> source
> >port is not specified and clients, servers, and relay agents need
> to be
> >prepared to receive messages from arbitrary source ports."
> >
> >- Bernie
> >
> > On Feb 28, 2024, at 3:28 AM, Lorenzo Colitti <lorenzo@google.com>
> wrote:
> >
> > FWIW the Android client binds to port 546 and does not connect()
> the
> > socket but uses sendto(). So it will send packets from port 546
> and it
> > will receive any packet to port 546 regardless of the source port
> used
> > by the server. So I guess that happens to be correct.
> >
> > Having the client send from 12345 -> 547 and the server send from
> 33333
> > -> 546 is sort of unusual - usually each party in a connection
> will use
> > the same source port for sending and receiving - but DHCPv6 is not
> a
> > connected protocol (e.g., some of the messages are multicast and
> some
> > are unicast), so...
> >
> > I do think the current text is ambiguous. In practice it allows
> > arbitrary source ports, but because this is unusual, implementers
> might
> > assume that the other side is using the same port to send and
> receive.
> > Such an implementation might not interoperate. So if we think the
> > behaviour is OK, then we should clarify the text to say that the
> source
> > port is not specified and clients and servers need to be prepared
> to
> > receive messages from arbitrary source ports.
> >
> > On Wed, Feb 28, 2024 at 4:47 PM Ole Troan
> > <otroan=40employees.org@dmarc.ietf.org> wrote:
> >
> > Bernie,
> >
> > > No. Normal UDP communication rules apply. A client sends traffic
> > to a well-known destination port and it is free to select whatever
> > port number it likes as the source port. The server’s response is
> > sent from that well known port (as source port) and sent to the
> > client’s selected port (as destination port). This is normal
> > communication and dhcpv6 follows it. That is why nothing is said
> or
> > needs to be said about the client source port.
> >
> > I’m with Tomoyuki here.
> >
> > "
> > 7.2. UDP Ports
> >
> > Clients listen for DHCP messages on UDP port 546. Servers and
> relay
> > agents listen for DHCP messages on UDP port 547.
> >
> > “
> >
> > Just checked my little scapy based DHCPv6 server and I do:
> >
> >        reply = (Ether(src=self.interface_info.mac, dst=request
> > [Ether].src) /
> >                     IPv6(src=self.interface_info.ip6ll,
> dst=request
> > [IPv6].src) /
> >                     UDP(sport=547, dport=546) /
> >                     DHCP6_Reply(trid=trid) /
> >                     DHCP6OptServerId(duid=self.duid) /
> >                     DHCP6OptClientId(duid=clientduid) /
> >                     DHCP6OptIA_NA(iaid=request
> [DHCP6OptIA_NA].iaid,
> > T1=t1, T2=t2,
> >                                   ianaopts = DHCP6OptIAAddress
> > (addr=ipv6,
> >
> > preflft=self.preflft,
> >
> > validlft=self.validlft)
> >                     )
> >
> > I couldn’t find any text supporting your position Bernie.
> Although
> > I would be fine if that was also the outcome.
> > As another implementor I cannot figure out what the correct
> > behaviour is from the RFC.
> >
> > Cheers,
> > Ole
> >
> > > - Bernie Volz
> > >
> > >> On Feb 26, 2024, at 1:00 AM, Tomoyuki Sahara
> > <tsahara=40iij.ad.jp@dmarc.ietf.org> wrote:
> > >>
> > >> Hi, DHC wg members:
> > >>
> > >> Can we make recommendations on source port numbers of DHCP6
> > messages
> > >> in rfc8415bis?
> > >>
> > >> DHCP6 specification says that DHCP6 clients and servers listen
> on
> > UDP
> > >> port 546 and 547 respectively, in RFC8415 section 7.2.  It
> > implies
> > >> that DHCP6 clients MUST send messages to UDP port 547 (server
> > port) and
> > >> servers MUST send messages to UDP port 546 (client port) to
> work
> > with
> > >> their counterpart correctly (though restrictions can be relaxed
> > with
> > >> RFC8357 for relays).
> > >>
> > >> But it says nothing about source port numbers.  Without any
> > >> restrictions, some implementations use ephemeral source port
> > >> (e.g. 12345) to send their messages.  DHCP6 conversations look
> > like:
> > >>
> > >> 1. client send Solicit    fe80::2#49876    -> ff02::1:2#547
> > >> 2. server send Advertise  fe80::1#547      -> fe80::2#546 (!)
> > >> 3. client send Request    fe80::2#49877(?) -> ff02::1:2#547
> > >> 4. server send Confirm    fe80::1#547      -> fe80::2#546
> > >>
> > >> This behavior is not prohibited by the specification but makes
> > >> confusions for DHCP6 implementer and network/firewall operators
> > (*1).
> > >> Most Internet protocols nowadays assume that servers send
> > response
> > >> messages from the port number they received on.
> > >> (*1 e.g. https://bugzilla.redhat.com/show_bug.cgi?id=952126 )
> > >>
> > >> In my humble opinion, it is too late to require that DHCP6
> client
> > and
> > >> server MUST send messages from the fixed port number (546/547)
> > because
> > >> there are too many DHCP6 implementations in the wild.  But
> making
> > a
> > >> recommendation is helpful for new implementations/deployments
> of
> > DHCP6.
> > >>
> > >> An idea to make such recommendation is adding a text in
> > rfc8415bis:
> > >>
> > >> OLD:
> > >>   7.2. UDP Ports
> > >>     Clients listen for DHCP messages on UDP port 546.  Servers
> > and
> > >>     relay agents listen for DHCP messages on UDP port 547.
> > >>
> > >> NEW:
> > >>   7.2. UDP Ports
> > >>     Clients listen for DHCP messages on UDP port 546.  Servers
> > and
> > >>     relay agents listen for DHCP messages on UDP port 547.
> > >>
> > >>     Clients are RECOMMENDED to send DHCP messages from UDP port
> > 546.
> > >>     Servers and relay agents are RECOMMENDED to send DHCP
> > messages
> > >>     from UDP port 547 (unless relay agent includes Relay Source
> > Port
> > >>     Option for DHCP6 [RFC8357]).
> > >>
> > >> I know WGLC has been concluded but I believe the
> recommendations
> > above
> > >> encourage new implementations to use the standard DHCP6 port
> > numbers
> > >> on UDP source port.
> > >>
> > >>
> > >> Best regards,
> > >> Tomoyuki Sahara
> > >>
> > >>
> > >> _______________________________________________
> > >> dhcwg mailing list
> > >> dhcwg@ietf.org
> > >> https://www.ietf.org/mailman/listinfo/dhcwg
> > >
> > > _______________________________________________
> > > dhcwg mailing list
> > > dhcwg@ietf.org
> > > https://www.ietf.org/mailman/listinfo/dhcwg
> >
> > _______________________________________________
> > dhcwg mailing list
> > dhcwg@ietf.org
> > https://www.ietf.org/mailman/listinfo/dhcwg