Browse Source

in the pool case ("servers somepool.somewhere"), we add new peers while

looping over the addresses returned by the dns lookup, as each address
is one new peer.
however, if the lookup fails with a temporary error, we will try to lookup
later again. for that, we obviously need to insert one peer with the
hostname in addr_head... change one for() loop into a do { } while() one
OPENBSD_3_6
henning 20 years ago
parent
commit
49770cb818
1 changed files with 21 additions and 13 deletions
  1. +21
    -13
      src/usr.sbin/ntpd/parse.y

+ 21
- 13
src/usr.sbin/ntpd/parse.y View File

@ -1,4 +1,4 @@
/* $OpenBSD: parse.y,v 1.18 2004/08/10 12:41:15 henning Exp $ */
/* $OpenBSD: parse.y,v 1.19 2004/08/10 12:45:27 henning Exp $ */
/* /*
* Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org> * Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -158,18 +158,23 @@ conf_main : LISTEN ON address {
struct ntp_peer *p; struct ntp_peer *p;
struct ntp_addr *h, *next; struct ntp_addr *h, *next;
for (h = $2->a; h != NULL; h = next) {
next = h->next;
if (h->ss.ss_family != AF_INET &&
h->ss.ss_family != AF_INET6) {
yyerror("IPv4 or IPv6 address "
"or hostname expected");
free($2->name);
free($2);
YYERROR;
}
h = $2->a;
do {
if (h != NULL) {
next = h->next;
if (h->ss.ss_family != AF_INET &&
h->ss.ss_family != AF_INET6) {
yyerror("IPv4 or IPv6 address "
"or hostname expected");
free($2->name);
free($2);
YYERROR;
}
h->next = NULL;
} else
next = NULL;
p = new_peer(); p = new_peer();
h->next = NULL;
p->addr = h; p->addr = h;
p->addr_head.a = h; p->addr_head.a = h;
p->addr_head.pool = 1; p->addr_head.pool = 1;
@ -177,7 +182,10 @@ conf_main : LISTEN ON address {
if (p->addr_head.name == NULL) if (p->addr_head.name == NULL)
fatal(NULL); fatal(NULL);
TAILQ_INSERT_TAIL(&conf->ntp_peers, p, entry); TAILQ_INSERT_TAIL(&conf->ntp_peers, p, entry);
}
h = next;
} while (h != NULL);
free($2->name); free($2->name);
free($2); free($2);
} }


Loading…
Cancel
Save