Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/tcp_subr.c
Show First 20 Lines • Show All 1,090 Lines • ▼ Show 20 Lines | #endif | ||||
tcp_tcbhashsize = hashsize; | tcp_tcbhashsize = hashsize; | ||||
/* Setup the tcp function block list */ | /* Setup the tcp function block list */ | ||||
init_tcp_functions(); | init_tcp_functions(); | ||||
register_tcp_functions(&tcp_def_funcblk, M_WAITOK); | register_tcp_functions(&tcp_def_funcblk, M_WAITOK); | ||||
#ifdef TCP_BLACKBOX | #ifdef TCP_BLACKBOX | ||||
/* Initialize the TCP logging data. */ | /* Initialize the TCP logging data. */ | ||||
tcp_log_init(); | tcp_log_init(); | ||||
#endif | #endif | ||||
read_random(&V_ts_offset_secret, sizeof(V_ts_offset_secret)); | arc4rand(&V_ts_offset_secret, sizeof(V_ts_offset_secret), 0); | ||||
if (tcp_soreceive_stream) { | if (tcp_soreceive_stream) { | ||||
#ifdef INET | #ifdef INET | ||||
tcp_usrreqs.pru_soreceive = soreceive_stream; | tcp_usrreqs.pru_soreceive = soreceive_stream; | ||||
#endif | #endif | ||||
#ifdef INET6 | #ifdef INET6 | ||||
tcp6_usrreqs.pru_soreceive = soreceive_stream; | tcp6_usrreqs.pru_soreceive = soreceive_stream; | ||||
#endif /* INET6 */ | #endif /* INET6 */ | ||||
▲ Show 20 Lines • Show All 1,603 Lines • ▼ Show 20 Lines | tcp_new_isn(struct in_conninfo *inc) | ||||
tcp_seq new_isn; | tcp_seq new_isn; | ||||
u_int32_t projected_offset; | u_int32_t projected_offset; | ||||
ISN_LOCK(); | ISN_LOCK(); | ||||
/* Seed if this is the first use, reseed if requested. */ | /* Seed if this is the first use, reseed if requested. */ | ||||
if ((V_isn_last_reseed == 0) || ((V_tcp_isn_reseed_interval > 0) && | if ((V_isn_last_reseed == 0) || ((V_tcp_isn_reseed_interval > 0) && | ||||
(((u_int)V_isn_last_reseed + (u_int)V_tcp_isn_reseed_interval*hz) | (((u_int)V_isn_last_reseed + (u_int)V_tcp_isn_reseed_interval*hz) | ||||
< (u_int)ticks))) { | < (u_int)ticks))) { | ||||
read_random(&V_isn_secret, sizeof(V_isn_secret)); | arc4rand(&V_isn_secret, sizeof(V_isn_secret), 0); | ||||
V_isn_last_reseed = ticks; | V_isn_last_reseed = ticks; | ||||
} | } | ||||
/* Compute the md5 hash and return the ISN. */ | /* Compute the md5 hash and return the ISN. */ | ||||
new_isn = (tcp_seq)tcp_keyed_hash(inc, V_isn_secret, | new_isn = (tcp_seq)tcp_keyed_hash(inc, V_isn_secret, | ||||
sizeof(V_isn_secret)); | sizeof(V_isn_secret)); | ||||
V_isn_offset += ISN_STATIC_INCREMENT + | V_isn_offset += ISN_STATIC_INCREMENT + | ||||
(arc4random() & ISN_RANDOM_INCREMENT); | (arc4random() & ISN_RANDOM_INCREMENT); | ||||
▲ Show 20 Lines • Show All 530 Lines • Show Last 20 Lines |