From 285ef64de870cb0fbe61966edfdfce81b4510997 Mon Sep 17 00:00:00 2001 From: henning <> Date: Thu, 29 Jul 2004 11:01:48 +0000 Subject: [PATCH] keep an ID per server we talk to --- src/usr.sbin/ntpd/ntpd.h | 3 ++- src/usr.sbin/ntpd/parse.y | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/usr.sbin/ntpd/ntpd.h b/src/usr.sbin/ntpd/ntpd.h index 3904669a..d093ca5d 100644 --- a/src/usr.sbin/ntpd/ntpd.h +++ b/src/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 @@ -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/src/usr.sbin/ntpd/parse.y b/src/usr.sbin/ntpd/parse.y index 400b8d1f..508df8d0 100644 --- a/src/usr.sbin/ntpd/parse.y +++ b/src/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 @@ -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);