Use stronger random number generation for TCP_ISSINCR and tcp_iss.

Reviewed by:	peter, jlemon
This commit is contained in:
kris 2000-09-29 01:37:19 +00:00
parent 13282b8968
commit 6105160a23
3 changed files with 3 additions and 3 deletions

View File

@ -91,7 +91,7 @@ extern tcp_cc tcp_ccgen; /* global connection count */
* number in the range [0-0x3ffff] that is hard to predict.
*/
#ifndef tcp_random18
#define tcp_random18() ((random() >> 14) & 0x3ffff)
#define tcp_random18() (arc4random() & 0x3ffff)
#endif
#define TCP_ISSINCR (122*1024 + tcp_random18())

View File

@ -178,7 +178,7 @@ tcp_init()
{
int hashsize;
tcp_iss = random(); /* wrong, but better than a constant */
tcp_iss = arc4random(); /* wrong, but better than a constant */
tcp_ccgen = 1;
tcp_cleartaocache();

View File

@ -178,7 +178,7 @@ tcp_init()
{
int hashsize;
tcp_iss = random(); /* wrong, but better than a constant */
tcp_iss = arc4random(); /* wrong, but better than a constant */
tcp_ccgen = 1;
tcp_cleartaocache();