summaryrefslogtreecommitdiff
path: root/usr.sbin/ntpd
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2004-07-29 11:01:49 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2004-07-29 11:01:49 +0000
commitc718dc6b59fa7891b396ad0c349758d6713087ab (patch)
treea185e07692dd0dad1f8ebbac2e2740af983fdee6 /usr.sbin/ntpd
parentd6007927c8343dc07687c749ebc5e1ee46b0d18c (diff)
keep an ID per server we talk to
Diffstat (limited to 'usr.sbin/ntpd')
-rw-r--r--usr.sbin/ntpd/ntpd.h3
-rw-r--r--usr.sbin/ntpd/parse.y6
2 files changed, 7 insertions, 2 deletions
diff --git a/usr.sbin/ntpd/ntpd.h b/usr.sbin/ntpd/ntpd.h
index 3904669a8b4..d093ca5d187 100644
--- a/usr.sbin/ntpd/ntpd.h
+++ b/usr.sbin/ntpd/ntpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ntpd.h,v 1.30 2004/07/28 16:38:43 henning Exp $ */
+/* $OpenBSD: ntpd.h,v 1.31 2004/07/29 11:01:48 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -95,6 +95,7 @@ struct ntp_offset {
struct ntp_peer {
TAILQ_ENTRY(ntp_peer) entry;
+ u_int32_t id;
struct ntp_addr_wrap addr_head;
struct ntp_addr *addr;
struct ntp_query *query;
diff --git a/usr.sbin/ntpd/parse.y b/usr.sbin/ntpd/parse.y
index 400b8d1fc67..508df8d0fe6 100644
--- a/usr.sbin/ntpd/parse.y
+++ b/usr.sbin/ntpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.16 2004/07/28 16:56:21 henning Exp $ */
+/* $OpenBSD: parse.y,v 1.17 2004/07/29 11:01:48 henning Exp $ */
/*
* Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -41,6 +41,7 @@ static int lineno = 1;
static int errors = 0;
static int pdebug = 1;
char *infile;
+static u_int32_t maxid;
int yyerror(const char *, ...);
int yyparse(void);
@@ -171,6 +172,7 @@ conf_main : LISTEN ON address {
p = calloc(1, sizeof(struct ntp_peer));
if (p == NULL)
fatal("conf_main server calloc");
+ p->id = ++maxid;
h->next = NULL;
p->addr = h;
p->addr_head.a = h;
@@ -189,6 +191,7 @@ conf_main : LISTEN ON address {
if ((p = calloc(1, sizeof(struct ntp_peer))) == NULL)
fatal("conf_main server calloc");
+ p->id = ++maxid;
for (h = $2->a; h != NULL; h = next) {
next = h->next;
if (h->ss.ss_family != AF_INET &&
@@ -478,6 +481,7 @@ parse_config(char *filename, struct ntpd_conf *xconf)
conf = xconf;
lineno = 1;
errors = 0;
+ maxid = 0;
TAILQ_INIT(&conf->listen_addrs);
TAILQ_INIT(&conf->ntp_peers);