From: Frank Kardel Date: Sat, 27 Jan 2007 08:54:51 +0000 (+0000) Subject: ntp_io.c: X-Git-Tag: NTP_4_2_4_RC2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=363cc128e7f260489d9e5465336a9db6eb27e171;p=thirdparty%2Fntp.git ntp_io.c: fix misleading error message when calling io_setbclient() and broadcast sockets are already open and not new sockets need to be opened. Bug 768: fix binding for broadcast client mode (Ulrich Weber) bk: 45bb135bAWHK8Y66rrZJOb49h7umoQ --- diff --git a/ntpd/ntp_io.c b/ntpd/ntp_io.c index 1fb85280c..320b6e6df 100644 --- a/ntpd/ntp_io.c +++ b/ntpd/ntp_io.c @@ -1862,15 +1862,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 @@ -1899,8 +1902,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 @@ -2324,7 +2327,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 */