Subject: Re: first TCP port used
To: Michael C. Richardson <>
From: Perry E. Metzger <>
List: tech-net
Date: 10/05/1997 23:56:05
"Michael C. Richardson" writes:
>   In in_pcb.c, in_pcbinit, we set inpt_lastport to
>   I have been testing kernels over the weekend, and sometimes my
> compile/reboo test box cycle is so fast that I wind up reusing a
> previous TCP port. When one kernel fails, I reboot that machine with a
> known good kernel, and use SSH to copy a new kernel over.
>   I'm wondering if there is any value in starting inpt_lastport from a
> more "random" value. Maybe:
> 	(boottime.tv_sec & 0xfff) + IPPORT_RESERVED

It's probably too late to deal with this for 1.3, but please submit a
PR. I would suggest that we use the (probably in post 1.3) kernel RNG
mechanism to pick the initial value.

We should also likely be paying attention to the IANA set of what
should and shouldn't be dynamic port ranges more...