Subject: Re: bin/19069: traceroute(8) and traceroute6(8) can send packet to udp port 0, which is illegal
To: None <itojun@iijlab.net>
From: Robert Elz <kre@munnari.OZ.AU>
List: netbsd-bugs
Date: 11/18/2002 15:02:08
    Date:        Sun, 17 Nov 2002 23:33:39 +0900
    From:        itojun@iijlab.net
    Message-ID:  <20021117143339.417904B22@coconut.itojun.org>

  | 	port 0 is "reserved" on assigned numbers RFC.  it has a special
  | 	meaning when it appears on source - means "no source port is specified".

Reserved just means it hasn't been assigned as a reserved port number, and
most likely never will be, not that it isn't legal.   As a source, I agree.

  | 	there's no declaration for the use in destionation port, which led
  | 	me to believe it is not legal to use port 0 as destination port.

No, I think it is legal, but not very useful (traceroute is perhaps one of the
only applications where using it makes sense, as it isn't expecting a reply...)

  | 	in fact, BSD implementation relies upon the fact port 0 is not used
  | 	on wire, as bind(2) to port 0 will mean "the port is now not bound".

Implementations have been known to use unlikely, but valid, values for all
kinds of weird reasons.

  | 	am i reading too much between lines?

Probably, but I don't think it matters for the purpose, fixing traceroute
to avoid dest port 0 is almost certainly a wise thing to do, regardless of
whether or not it was technically required.

kre