use arc4random()

This commit is contained in:
ume 2003-10-01 21:10:02 +00:00
parent 6656ce1a54
commit 748bd5fe4d
2 changed files with 3 additions and 14 deletions

View File

@ -82,19 +82,11 @@ static MALLOC_DEFINE(M_FTABLE, "fragment", "fragment reassembly header");
void
frag6_init()
{
#ifndef RANDOM_IP_ID
struct timeval tv;
#endif
ip6_maxfragpackets = nmbclusters / 4;
#ifndef RANDOM_IP_ID
/*
* in many cases, random() here does NOT return random number
* as initialization during bootstrap time occur in fixed order.
*/
microtime(&tv);
ip6_id = random() ^ tv.tv_usec;
ip6_id = arc4random();
#endif
ip6q.ip6q_next = ip6q.ip6q_prev = &ip6q;
}

View File

@ -171,7 +171,6 @@ ip6_init()
{
struct ip6protosw *pr;
int i;
struct timeval tv;
#ifdef DIAGNOSTIC
if (sizeof(struct protosw) != sizeof(struct ip6protosw))
@ -203,10 +202,8 @@ ip6_init()
* in many cases, random() here does NOT return random number
* as initialization during bootstrap time occur in fixed order.
*/
microtime(&tv);
ip6_flow_seq = random() ^ tv.tv_usec;
microtime(&tv);
ip6_desync_factor = (random() ^ tv.tv_usec) % MAX_TEMP_DESYNC_FACTOR;
ip6_flow_seq = arc4random();
ip6_desync_factor = arc4random() % MAX_TEMP_DESYNC_FACTOR;
}
static void