summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/lcp.c
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1997-05-11 00:16:00 +0000
committerache <ache@FreeBSD.org>1997-05-11 00:16:00 +0000
commit2f32718791f7636eae5393e5b7397c1fcde0d9d5 (patch)
treee8e72136e015402810965b6eadf3f289d53a2208 /usr.sbin/ppp/lcp.c
parent36ab59d4ff2802cdf5b5bbeb90d5eeb1d7c561b2 (diff)
downloadFreeBSD-src-2f32718791f7636eae5393e5b7397c1fcde0d9d5.zip
FreeBSD-src-2f32718791f7636eae5393e5b7397c1fcde0d9d5.tar.gz
Use random() for GenerateMagic()
Diffstat (limited to 'usr.sbin/ppp/lcp.c')
-rw-r--r--usr.sbin/ppp/lcp.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/usr.sbin/ppp/lcp.c b/usr.sbin/ppp/lcp.c
index 4bc0ebf..4eede6a 100644
--- a/usr.sbin/ppp/lcp.c
+++ b/usr.sbin/ppp/lcp.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: lcp.c,v 1.14 1997/05/05 23:45:15 brian Exp $
+ * $Id: lcp.c,v 1.15 1997/05/10 01:22:13 brian Exp $
*
* TODO:
* o Validate magic number received from peer.
@@ -47,6 +47,7 @@ extern void StopIdleTimer();
extern void OsLinkdown();
extern void Cleanup();
extern struct pppTimer IpcpReportTimer;
+extern int randinit;
struct lcpstate LcpInfo;
@@ -179,14 +180,13 @@ ReportLcpStatus()
u_long
GenerateMagic()
{
- time_t tl;
- struct timeval tval;
-
- time(&tl);
- gettimeofday(&tval, NULL);
- tl += (tval.tv_sec ^ tval.tv_usec) + getppid();
- tl *= getpid();
- return(tl);
+ if (!randinit) {
+ randinit = 1;
+ if (srandomdev() < 0)
+ srandom((unsigned long)(time(NULL) ^ getpid()));
+ }
+
+ return (random());
}
void
OpenPOWER on IntegriCloud