o Disable random port allocation when ip.portrange.first ==

ip.portrange.last and there is the only port for that because:
a) it is not wise; b) it leads to a panic in the random ip port
allocation code.  In general we need to disable ip port allocation
randomization if the last - first delta is ridiculous small.

PR:		kern/79342
Spotted by:	Anjali Kulkarni
Glanced at by:	silby
MFC after:	2 weeks
This commit is contained in:
maxim 2005-04-08 08:42:10 +00:00
parent d0b8d01316
commit a31bda3d3c

View File

@ -418,6 +418,12 @@ in_pcbbind_setup(inp, nam, laddrp, lportp, cred)
dorandom = 1;
else
dorandom = 0;
/*
* It makes no sense to do random port allocation if
* we have the only port available.
*/
if (first == last)
dorandom = 0;
/* Make sure to not include UDP packets in the count. */
if (pcbinfo != &udbinfo)
ipport_tcpallocs++;