From: Harlan Stenn Date: Sat, 26 Jan 2008 08:30:14 +0000 (-0500) Subject: refresh epoch, throttle, and leap cleanup from Dave Mills X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=982d5e463d00aba17ee1cd8086fb0fdf43b833a3;p=thirdparty%2Fntp.git refresh epoch, throttle, and leap cleanup from Dave Mills bk: 479aef96KYoJHeaiaXH1WW64TmvFCQ --- diff --git a/ChangeLog b/ChangeLog index 30ec7a808f..d00d31df1c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,4 @@ +* refresh epoch, throttle, and leap cleanup from Dave Mills. * Documentation cleanup from Dave Mills. * [Bug 918] Only use a native md5.h if MD5Init() is available. * [Bug 979] Provide ntptimeval if it is not otherwise present. diff --git a/include/ntp.h b/include/ntp.h index 43355be308..62413c7612 100644 --- a/include/ntp.h +++ b/include/ntp.h @@ -310,6 +310,7 @@ struct peer { struct value cookval; /* cookie values */ struct value recval; /* receive autokey values */ struct exten *cmmd; /* extension pointer */ + u_long refresh; /* next refresh epoch */ /* * Variables used by authenticated server @@ -327,12 +328,11 @@ struct peer { */ u_char status; /* peer status */ u_char reach; /* reachability register */ - u_int flash; /* protocol error test tally bits */ + int flash; /* protocol error test tally bits */ u_long epoch; /* reference epoch */ - u_int burst; /* packets remaining in burst */ - u_int retry; /* retry counter */ - u_int throttle; /* rate control */ - u_int filter_nextpt; /* index into filter shift register */ + int burst; /* packets remaining in burst */ + int retry; /* retry counter */ + int filter_nextpt; /* index into filter shift register */ double filter_delay[NTP_SHIFT]; /* delay shift register */ double filter_offset[NTP_SHIFT]; /* offset shift register */ double filter_disp[NTP_SHIFT]; /* dispersion shift register */ @@ -363,7 +363,8 @@ struct peer { */ u_long update; /* receive epoch */ #define end_clear_to_zero update - u_int unreach; /* watchdog counter */ + int unreach; /* watchdog counter */ + int throttle; /* rate control */ u_long outdate; /* send time last packet */ u_long nextdate; /* send time next packet */ u_long nextaction; /* peer local activity timeout (refclocks) */ @@ -720,12 +721,6 @@ struct pkt { #define NTP_HASH_MASK (NTP_HASH_SIZE-1) #define NTP_HASH_ADDR(src) sock_hash(src) -/* - * How we randomize polls. The poll interval is a power of two. We chose - * a random interval which is this plus random 3 seconds. - */ -#define RANDPOLL(x) ((1 << (x)) + (ntp_random() & 0x3)) - /* * min, min3 and max. Makes it easier to transliterate the spec without * thinking about it. @@ -886,8 +881,8 @@ struct restrictlist6 { /* * Match flags */ -#define RESM_INTERFACE 0x1 /* this is an interface */ -#define RESM_NTPONLY 0x2 /* match ntp port only */ +#define RESM_INTERFACE 0x1000 /* this is an interface */ +#define RESM_NTPONLY 0x2000 /* match ntp port only */ /* * Restriction configuration ops diff --git a/include/ntp_crypto.h b/include/ntp_crypto.h index 7de89a3072..e654ce4a36 100644 --- a/include/ntp_crypto.h +++ b/include/ntp_crypto.h @@ -103,6 +103,7 @@ #define NTP_AUTOMAX 3600 /* default max session key lifetime */ #define KEY_REVOKE 86400 /* default key revoke timeout */ #define NTP_MAXEXTEN 1024 /* maximum extension field size */ +#define NTP_REFRESH (7 * 86400) /* refresh interval */ /* * The autokey structure holds the values used to authenticate key IDs. diff --git a/include/ntpd.h b/include/ntpd.h index 349e1da609..a68dfe36de 100644 --- a/include/ntpd.h +++ b/include/ntpd.h @@ -104,18 +104,6 @@ extern void block_io_and_alarm (void); #define BLOCK_IO_AND_ALARM() #endif -/* ntp_leap.c */ -extern void init_leap (void); -extern void leap_process (void); -extern int leap_setleap (int, int); -/* - * there seems to be a bug in the IRIX 4 compiler which prevents - * u_char from beeing used in prototyped functions. - * This is also true AIX compiler. - * So give up and define it to be int. WLJ - */ -extern int leap_actual (int); - /* ntp_loopfilter.c */ extern void init_loopfilter (void); extern int local_clock (struct peer *, u_long, double); @@ -187,9 +175,12 @@ extern void peer_clear (struct peer *, char *); extern void process_packet (struct peer *, struct pkt *, u_int); extern void clock_select (void); extern void kod_proto (void); -extern int leap_tai; -extern u_long leap_expire; -extern u_long leap_sec; + +extern int leap_tai; /* TAI at next leap */ +extern u_long leap_sec; /* next scheduled leap from file */ +extern u_long leap_peers; /* next scheduled leap from peers */ +extern u_long leapsec; /* seconds to next leap */ +extern u_long leap_expire; /* leap information expiration */ extern int sys_orphan; extern double sys_mindisp; extern double sys_maxdist; @@ -445,7 +436,7 @@ extern keyid_t info_auth_keyid; /* keyid used to authenticate requests */ extern struct restrictlist *restrictlist; /* the ipv4 restriction list */ extern struct restrictlist6 *restrictlist6; /* the ipv6 restriction list */ extern int res_min_interval; -extern int res_avg_interval; +extern int ntp_minpoll; extern int mon_age; /* monitor preempt age */ /* ntp_timer.c */