Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/in_pcb.c
Show First 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | |||||
#include <sys/systm.h> | #include <sys/systm.h> | ||||
#include <sys/lock.h> | #include <sys/lock.h> | ||||
#include <sys/malloc.h> | #include <sys/malloc.h> | ||||
#include <sys/mbuf.h> | #include <sys/mbuf.h> | ||||
#include <sys/callout.h> | #include <sys/callout.h> | ||||
#include <sys/eventhandler.h> | #include <sys/eventhandler.h> | ||||
#include <sys/domain.h> | #include <sys/domain.h> | ||||
#include <sys/protosw.h> | #include <sys/protosw.h> | ||||
#include <sys/random.h> | |||||
#include <sys/rmlock.h> | #include <sys/rmlock.h> | ||||
#include <sys/smp.h> | #include <sys/smp.h> | ||||
#include <sys/socket.h> | #include <sys/socket.h> | ||||
#include <sys/socketvar.h> | #include <sys/socketvar.h> | ||||
#include <sys/sockio.h> | #include <sys/sockio.h> | ||||
#include <sys/priv.h> | #include <sys/priv.h> | ||||
#include <sys/proc.h> | #include <sys/proc.h> | ||||
#include <sys/refcount.h> | #include <sys/refcount.h> | ||||
▲ Show 20 Lines • Show All 564 Lines • ▼ Show 20 Lines | if (inp->inp_flags & INP_HIGHPORT) { | ||||
first = V_ipport_firstauto; /* sysctl */ | first = V_ipport_firstauto; /* sysctl */ | ||||
last = V_ipport_lastauto; | last = V_ipport_lastauto; | ||||
lastport = &pcbinfo->ipi_lastport; | lastport = &pcbinfo->ipi_lastport; | ||||
} | } | ||||
/* | /* | ||||
* For UDP(-Lite), use random port allocation as long as the user | * For UDP(-Lite), use random port allocation as long as the user | ||||
* allows it. For TCP (and as of yet unknown) connections, | * allows it. For TCP (and as of yet unknown) connections, | ||||
* use random port allocation only if the user allows it AND | * use random port allocation only if the user allows it AND | ||||
* ipport_tick() allows it. | * ipport_tick() allows it. Finally, if the random device is not yet | ||||
* available, don't try to draw a random number. | |||||
*/ | */ | ||||
if (V_ipport_randomized && | if (V_ipport_randomized && | ||||
(!V_ipport_stoprandom || pcbinfo == &V_udbinfo || | (!V_ipport_stoprandom || pcbinfo == &V_udbinfo || | ||||
pcbinfo == &V_ulitecbinfo)) | pcbinfo == &V_ulitecbinfo) && | ||||
is_random_seeded()) | |||||
dorandom = 1; | dorandom = 1; | ||||
else | else | ||||
dorandom = 0; | dorandom = 0; | ||||
/* | /* | ||||
* It makes no sense to do random port allocation if | * It makes no sense to do random port allocation if | ||||
* we have the only port available. | * we have the only port available. | ||||
*/ | */ | ||||
if (first == last) | if (first == last) | ||||
▲ Show 20 Lines • Show All 2,779 Lines • Show Last 20 Lines |