|
@ -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> |
|
|
* 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); |
|
|
freeifaddrs(ifa); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
TAILQ_FOREACH(la, &lconf->listen_addrs, entry) { |
|
|
|
|
|
new_cnt++; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (la = TAILQ_FIRST(&lconf->listen_addrs); la; ) { |
|
|
switch (la->sa.ss_family) { |
|
|
switch (la->sa.ss_family) { |
|
|
case AF_INET: |
|
|
case AF_INET: |
|
|
if (((struct sockaddr_in *)&la->sa)->sin_port == 0) |
|
|
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"); |
|
|
log_warn("setsockopt IPTOS_LOWDELAY"); |
|
|
|
|
|
|
|
|
if (bind(la->fd, (struct sockaddr *)&la->sa, |
|
|
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; |
|
|
*cnt = new_cnt; |
|
|