From 03b1f4741ce15819cb52ca69029dd2005cf8a173 Mon Sep 17 00:00:00 2001 From: Mike Karels Date: Tue, 27 May 1986 22:58:21 -0800 Subject: [PATCH] toss MAXSEQ SCCS-vsn: usr.sbin/timed/timed/acksend.c 2.4 SCCS-vsn: usr.sbin/timed/timed/master.c 2.9 SCCS-vsn: usr.sbin/timed/timed/slave.c 2.13 SCCS-vsn: usr.sbin/timed/timed/timed.c 2.8 --- usr/src/usr.sbin/timed/timed/acksend.c | 7 +++---- usr/src/usr.sbin/timed/timed/master.c | 6 ++---- usr/src/usr.sbin/timed/timed/slave.c | 6 ++---- usr/src/usr.sbin/timed/timed/timed.c | 11 +++++------ 4 files changed, 12 insertions(+), 18 deletions(-) diff --git a/usr/src/usr.sbin/timed/timed/acksend.c b/usr/src/usr.sbin/timed/timed/acksend.c index 49ae4564bf..aa39f9a41b 100644 --- a/usr/src/usr.sbin/timed/timed/acksend.c +++ b/usr/src/usr.sbin/timed/timed/acksend.c @@ -1,11 +1,11 @@ /* - * Copyright (c) 1983 Regents of the University of California. + * Copyright (c) 1985 Regents of the University of California. * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. */ #ifndef lint -static char sccsid[] = "@(#)acksend.c 2.3 (Berkeley) %G%"; +static char sccsid[] = "@(#)acksend.c 2.4 (Berkeley) %G%"; #endif not lint #include "globals.h" @@ -77,7 +77,6 @@ struct netinfo *net; } } } while (flag != RECEIVED); - if (++sequence > MAXSEQ) - sequence = 1; + sequence++; return(answer); } diff --git a/usr/src/usr.sbin/timed/timed/master.c b/usr/src/usr.sbin/timed/timed/master.c index 750254456d..5ed8085a7c 100644 --- a/usr/src/usr.sbin/timed/timed/master.c +++ b/usr/src/usr.sbin/timed/timed/master.c @@ -5,7 +5,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)master.c 2.8 (Berkeley) %G%"; +static char sccsid[] = "@(#)master.c 2.9 (Berkeley) %G%"; #endif not lint #include "globals.h" @@ -78,7 +78,7 @@ loop: for (ntp = nettab; ntp != NULL; ntp = ntp->next) { to.tsp_type = TSP_LOOP; to.tsp_vers = TSPVERSION; - to.tsp_seq = sequence; + to.tsp_seq = sequence++; to.tsp_hopcnt = 10; (void)strcpy(to.tsp_name, hostname); bytenetorder(&to); @@ -86,8 +86,6 @@ loop: &ntp->dest_addr, sizeof(struct sockaddr_in)) < 0) { syslog(LOG_ERR, "sendto: %m"); exit(1); - if (++sequence > MAXSEQ) - sequence = 1; } } } diff --git a/usr/src/usr.sbin/timed/timed/slave.c b/usr/src/usr.sbin/timed/timed/slave.c index 6353572c30..6edd157325 100644 --- a/usr/src/usr.sbin/timed/timed/slave.c +++ b/usr/src/usr.sbin/timed/timed/slave.c @@ -5,7 +5,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)slave.c 2.12 (Berkeley) %G%"; +static char sccsid[] = "@(#)slave.c 2.13 (Berkeley) %G%"; #endif not lint #include "globals.h" @@ -130,7 +130,7 @@ loop: if (ntp->status == MASTER) { to.tsp_type = TSP_LOOP; to.tsp_vers = TSPVERSION; - to.tsp_seq = sequence; + to.tsp_seq = sequence++; to.tsp_hopcnt = 10; (void)strcpy(to.tsp_name, hostname); bytenetorder(&to); @@ -138,8 +138,6 @@ loop: &ntp->dest_addr, sizeof(struct sockaddr_in)) < 0) { syslog(LOG_ERR, "sendto: %m"); exit(1); - if (++sequence > MAXSEQ) - sequence = 1; } } } diff --git a/usr/src/usr.sbin/timed/timed/timed.c b/usr/src/usr.sbin/timed/timed/timed.c index 1b19dfaffb..517823a55d 100644 --- a/usr/src/usr.sbin/timed/timed/timed.c +++ b/usr/src/usr.sbin/timed/timed/timed.c @@ -11,7 +11,7 @@ char copyright[] = #endif not lint #ifndef lint -static char sccsid[] = "@(#)timed.c 2.7 (Berkeley) %G%"; +static char sccsid[] = "@(#)timed.c 2.8 (Berkeley) %G%"; #endif not lint #include "globals.h" @@ -188,7 +188,7 @@ char **argv; seed = time.tv_sec + time.tv_usec; srandom(seed); - sequence = casual((long)1, (long)MAXSEQ); /* initial seq number */ + sequence = random(); /* initial seq number */ /* rounds kernel variable time to multiple of 5 ms. */ time.tv_sec = 0; @@ -587,19 +587,18 @@ long sup; char * date() { - char *ret; char *ctime(); struct timeval tv; (void)gettimeofday(&tv, (struct timezone *)0); - ret = ctime(&tv.tv_sec); - return(ret); + return (ctime(&tv.tv_sec)); } addnetname(name) char *name; { - struct nets **netlist = &nets; + register struct nets **netlist = &nets; + while (*netlist) netlist = &((*netlist)->next); *netlist = (struct nets *)malloc(sizeof **netlist); -- 2.20.1