summaryrefslogtreecommitdiffstats
path: root/contrib/ntp/ntpd/ntp_timer.c
diff options
context:
space:
mode:
authorroberto <roberto@FreeBSD.org>2001-08-29 14:35:15 +0000
committerroberto <roberto@FreeBSD.org>2001-08-29 14:35:15 +0000
commit40b8e415eb0f835a9dd7a473ddf134ec67877fd7 (patch)
tree3cfb63f1a112ee17469b17fc1593a88d004ddda6 /contrib/ntp/ntpd/ntp_timer.c
parenta5a8dc6136fcee95f261a31609a25669038c3861 (diff)
downloadFreeBSD-src-40b8e415eb0f835a9dd7a473ddf134ec67877fd7.zip
FreeBSD-src-40b8e415eb0f835a9dd7a473ddf134ec67877fd7.tar.gz
Virgin import of ntpd 4.1.0
Diffstat (limited to 'contrib/ntp/ntpd/ntp_timer.c')
-rw-r--r--contrib/ntp/ntpd/ntp_timer.c45
1 files changed, 35 insertions, 10 deletions
diff --git a/contrib/ntp/ntpd/ntp_timer.c b/contrib/ntp/ntpd/ntp_timer.c
index 0e2dc88..71a84e2 100644
--- a/contrib/ntp/ntpd/ntp_timer.c
+++ b/contrib/ntp/ntpd/ntp_timer.c
@@ -5,20 +5,26 @@
# include <config.h>
#endif
+#include "ntp_machine.h"
+#include "ntpd.h"
+#include "ntp_stdlib.h"
+
#include <stdio.h>
-#include <sys/types.h>
-#include <sys/time.h>
#include <signal.h>
#include <sys/signal.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
-#include "ntp_machine.h"
-#include "ntpd.h"
-#include "ntp_stdlib.h"
#if defined(HAVE_IO_COMPLETION_PORT)
# include "ntp_iocompletionport.h"
# include "ntp_timer.h"
#endif
+#ifdef PUBKEY
+#include "ntp_crypto.h"
+#endif /* PUBKEY */
+
/*
* These routines provide support for the event timer. The timer is
* implemented by an interrupt routine which sets a flag once every
@@ -41,8 +47,11 @@ volatile int alarm_flag;
static u_long adjust_timer; /* second timer */
static u_long keys_timer; /* minute timer */
static u_long hourly_timer; /* hour timer */
+static u_long huffpuff_timer; /* huff-n'-puff timer */
+#ifdef AUTOKEY
static u_long revoke_timer; /* keys revoke timer */
-u_long sys_revoke = KEY_REVOKE; /* keys revoke timeout */
+u_long sys_revoke = 1 << KEY_REVOKE; /* keys revoke timeout */
+#endif /* AUTOKEY */
/*
* Statistics counter for the interested.
@@ -101,6 +110,7 @@ init_timer(void)
alarm_overflow = 0;
adjust_timer = 1;
hourly_timer = HOUR;
+ huffpuff_timer = 0;
current_time = 0;
timer_overflows = 0;
timer_xmtcalls = 0;
@@ -206,7 +216,7 @@ void
timer(void)
{
register struct peer *peer, *next_peer;
- int n;
+ u_int n;
current_time += (1<<EVENT_TIMEOUT);
@@ -250,12 +260,27 @@ timer(void)
}
/*
- * Garbage collect revoked keys
+ * Huff-n'-puff filter
+ */
+ if (huffpuff_timer <= current_time) {
+ huffpuff_timer += HUFFPUFF;
+ huffpuff();
+ }
+
+#ifdef AUTOKEY
+ /*
+ * Garbage collect old keys and generate new private value
*/
if (revoke_timer <= current_time) {
- revoke_timer += RANDPOLL(sys_revoke);
- key_expire_all();
+ revoke_timer += sys_revoke;
+ expire_all();
+#ifdef DEBUG
+ if (debug)
+ printf("key expire: at %lu next %lu\n",
+ current_time, revoke_timer);
+#endif
}
+#endif /* AUTOKEY */
/*
* Finally, call the hourly routine.
OpenPOWER on IntegriCloud