From 24e8b498bdd5119bad221fcf921f30f390858c75 Mon Sep 17 00:00:00 2001 From: kardel Date: Sat, 27 Jan 2007 09:02:38 +0000 Subject: [PATCH] track NTP bug 768: opening of bcast if, misleading error message --- dist/ntp/ntpd/ntp_io.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/dist/ntp/ntpd/ntp_io.c b/dist/ntp/ntpd/ntp_io.c index 556b9bd78457..878de456e28d 100644 --- a/dist/ntp/ntpd/ntp_io.c +++ b/dist/ntp/ntpd/ntp_io.c @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_io.c,v 1.22 2007/01/21 07:59:31 kardel Exp $ */ +/* $NetBSD: ntp_io.c,v 1.23 2007/01/27 09:02:38 kardel Exp $ */ /* * ntp_io.c - input/output routines for ntpd. The socket-opening code @@ -1864,15 +1864,18 @@ io_setbclient(void) continue; /* Do we already have the broadcast address open? */ - if (interf->flags & INT_BCASTOPEN) + if (interf->flags & INT_BCASTOPEN) { + /* account for already open interfaces to aviod misleading warning below */ + nif++; continue; + } /* * Try to open the broadcast address */ interf->family = AF_INET; interf->bfd = open_socket(&interf->bcast, - INT_BROADCAST, 1, interf); + INT_BROADCAST, 0, interf); /* * If we succeeded then we use it otherwise @@ -1901,8 +1904,8 @@ io_setbclient(void) if (nif > 0) printf("io_setbclient: Opened broadcast clients\n"); #endif - if (nif == 0) - netsyslog(LOG_ERR, "Unable to listen for broadcasts, no broadcast interfaces available"); + if (nif == 0) + netsyslog(LOG_ERR, "Unable to listen for broadcasts, no broadcast interfaces available"); #else netsyslog(LOG_ERR, "io_setbclient: Broadcast Client disabled by build"); #endif @@ -2326,7 +2329,7 @@ open_socket( #ifdef OS_NEEDS_REUSEADDR_FOR_IFADDRBIND /* - * some OSes don't allow bindinf to more specific + * some OSes don't allow binding to more specific * addresses if a wildcard address already bound * to the port and SO_REUSEADDR is not set */