mirror of
https://github.com/openbsd/src.git
synced 2025-01-10 06:47:55 -08:00
If a bind() spuriously fails (as appears to happen once in a blue moon due
to some stupid ipv6 bug in particular), remove that 'listen' from the list and continue operation. issue spotted by naddy ok henning
This commit is contained in:
parent
8de9cb902f
commit
2f3d2c487d
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: server.c,v 1.32 2008/06/10 03:46:09 naddy Exp $ */
|
||||
/* $OpenBSD: server.c,v 1.33 2008/11/10 16:59:33 deraadt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
|
||||
@ -75,9 +75,7 @@ setup_listeners(struct servent *se, struct ntpd_conf *lconf, u_int *cnt)
|
||||
freeifaddrs(ifa);
|
||||
}
|
||||
|
||||
TAILQ_FOREACH(la, &lconf->listen_addrs, entry) {
|
||||
new_cnt++;
|
||||
|
||||
for (la = TAILQ_FIRST(&lconf->listen_addrs); la; ) {
|
||||
switch (la->sa.ss_family) {
|
||||
case AF_INET:
|
||||
if (((struct sockaddr_in *)&la->sa)->sin_port == 0)
|
||||
@ -104,8 +102,21 @@ setup_listeners(struct servent *se, struct ntpd_conf *lconf, u_int *cnt)
|
||||
log_warn("setsockopt IPTOS_LOWDELAY");
|
||||
|
||||
if (bind(la->fd, (struct sockaddr *)&la->sa,
|
||||
SA_LEN((struct sockaddr *)&la->sa)) == -1)
|
||||
fatal("bind");
|
||||
SA_LEN((struct sockaddr *)&la->sa)) == -1) {
|
||||
struct listen_addr *nla;
|
||||
|
||||
log_warn("bind on %s failed, skipping",
|
||||
log_sockaddr((struct sockaddr *)&la->sa));
|
||||
close(la->fd);
|
||||
la->fd = -1;
|
||||
nla = TAILQ_NEXT(la, entry);
|
||||
TAILQ_REMOVE(&lconf->listen_addrs, la, entry);
|
||||
free(la);
|
||||
la = nla;
|
||||
continue;
|
||||
}
|
||||
new_cnt++;
|
||||
la = TAILQ_NEXT(la, entry);
|
||||
}
|
||||
|
||||
*cnt = new_cnt;
|
||||
|
Loading…
Reference in New Issue
Block a user