o Document net.inet.ip.portrange.random* sysctls.
o Correct a comment about random port allocation threshold implementation. Reviewed by: silby, ru MFC after: 3 days
This commit is contained in:
parent
39d1acc38a
commit
6ee79c59d2
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=144016
@ -32,7 +32,7 @@
|
|||||||
.\" @(#)ip.4 8.2 (Berkeley) 11/30/93
|
.\" @(#)ip.4 8.2 (Berkeley) 11/30/93
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd June 14, 2004
|
.Dd March 23, 2005
|
||||||
.Dt IP 4
|
.Dt IP 4
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -331,6 +331,21 @@ In scenarios such as benchmarking, this behavior may be undesirable.
|
|||||||
In these cases,
|
In these cases,
|
||||||
.Va net.inet.ip.portrange.randomized
|
.Va net.inet.ip.portrange.randomized
|
||||||
can be used to toggle randomization off.
|
can be used to toggle randomization off.
|
||||||
|
If more than
|
||||||
|
.Va net.inet.ip.portrange.randomcps
|
||||||
|
ports have been allocated in the last second, then return to sequential
|
||||||
|
port allocation.
|
||||||
|
Return to random allocation only once the current port allocation rate
|
||||||
|
drops below
|
||||||
|
.Va net.inet.ip.portrange.randomcps
|
||||||
|
for at least
|
||||||
|
.Va net.inet.ip.portrange.randomtime
|
||||||
|
seconds.
|
||||||
|
The default values for
|
||||||
|
.Va net.inet.ip.portrange.randomcps
|
||||||
|
and
|
||||||
|
.Va net.inet.ip.portrange.randomtime
|
||||||
|
are 10 port allocations per second and 45 seconds correspondingly.
|
||||||
.Ss "Multicast Options"
|
.Ss "Multicast Options"
|
||||||
.Pp
|
.Pp
|
||||||
.Tn IP
|
.Tn IP
|
||||||
|
@ -148,12 +148,14 @@ SYSCTL_INT(_net_inet_ip_portrange, OID_AUTO, reservedhigh,
|
|||||||
CTLFLAG_RW|CTLFLAG_SECURE, &ipport_reservedhigh, 0, "");
|
CTLFLAG_RW|CTLFLAG_SECURE, &ipport_reservedhigh, 0, "");
|
||||||
SYSCTL_INT(_net_inet_ip_portrange, OID_AUTO, reservedlow,
|
SYSCTL_INT(_net_inet_ip_portrange, OID_AUTO, reservedlow,
|
||||||
CTLFLAG_RW|CTLFLAG_SECURE, &ipport_reservedlow, 0, "");
|
CTLFLAG_RW|CTLFLAG_SECURE, &ipport_reservedlow, 0, "");
|
||||||
SYSCTL_INT(_net_inet_ip_portrange, OID_AUTO, randomized,
|
SYSCTL_INT(_net_inet_ip_portrange, OID_AUTO, randomized, CTLFLAG_RW,
|
||||||
CTLFLAG_RW, &ipport_randomized, 0, "");
|
&ipport_randomized, 0, "Enable random port allocation");
|
||||||
SYSCTL_INT(_net_inet_ip_portrange, OID_AUTO, randomcps,
|
SYSCTL_INT(_net_inet_ip_portrange, OID_AUTO, randomcps, CTLFLAG_RW,
|
||||||
CTLFLAG_RW, &ipport_randomcps, 0, "");
|
&ipport_randomcps, 0, "Maximum number of random port "
|
||||||
SYSCTL_INT(_net_inet_ip_portrange, OID_AUTO, randomtime,
|
"allocations before switching to a sequental one");
|
||||||
CTLFLAG_RW, &ipport_randomtime, 0, "");
|
SYSCTL_INT(_net_inet_ip_portrange, OID_AUTO, randomtime, CTLFLAG_RW,
|
||||||
|
&ipport_randomtime, 0, "Minimum time to keep sequental port "
|
||||||
|
"allocation before switching to a random one");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* in_pcb.c: manage the Protocol Control Blocks.
|
* in_pcb.c: manage the Protocol Control Blocks.
|
||||||
@ -1211,7 +1213,8 @@ in_pcbsosetlabel(so)
|
|||||||
* allocation should be continued. If more than ipport_randomcps
|
* allocation should be continued. If more than ipport_randomcps
|
||||||
* ports have been allocated in the last second, then we return to
|
* ports have been allocated in the last second, then we return to
|
||||||
* sequential port allocation. We return to random allocation only
|
* sequential port allocation. We return to random allocation only
|
||||||
* once we drop below ipport_randomcps for at least 5 seconds.
|
* once we drop below ipport_randomcps for at least ipport_randomtime
|
||||||
|
* seconds.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user