diff options
author | maxim <maxim@FreeBSD.org> | 2005-04-08 08:42:10 +0000 |
---|---|---|
committer | maxim <maxim@FreeBSD.org> | 2005-04-08 08:42:10 +0000 |
commit | a31bda3d3c8e5d8fd3385d8cc93a88b6f0192e73 (patch) | |
tree | 80e9e99bf99d85175be0dfd9383346712dcc7399 /sys/netinet/in_pcb.c | |
parent | d0b8d0131624ed0492a880a425a4f2c62bbbef06 (diff) | |
download | FreeBSD-src-a31bda3d3c8e5d8fd3385d8cc93a88b6f0192e73.zip FreeBSD-src-a31bda3d3c8e5d8fd3385d8cc93a88b6f0192e73.tar.gz |
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
Diffstat (limited to 'sys/netinet/in_pcb.c')
-rw-r--r-- | sys/netinet/in_pcb.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 3ff8615..a91ca6d 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -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++; |