From: Dave Hart Date: Mon, 27 Feb 2023 08:04:43 +0000 (-0500) Subject: [Bug 3781] log "Unable to listen for broadcasts" for IPv4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f35b859687ac52092be4ed8ce9a7fe58f0ef4750;p=thirdparty%2Fntp.git [Bug 3781] log "Unable to listen for broadcasts" for IPv4 bk: 63fc641b7Eqc24lB2OE_VnaHS6wp5g --- diff --git a/ChangeLog b/ChangeLog index 5d076c62c..95138c66d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,5 @@ --- +* [Bug 3781] log "Unable to listen for broadcasts" for IPv4 * [Bug 3595] pollskewlist documentation uses | when it shouldn't. - ntp.conf manual page and miscopt.html corrections. * [Bug 3797] Windows getaddrinfo w/AI_ADDRCONFIG fails for localhost when diff --git a/ntpd/ntp_io.c b/ntpd/ntp_io.c index 077a5a89f..65fb0ad46 100644 --- a/ntpd/ntp_io.c +++ b/ntpd/ntp_io.c @@ -2604,19 +2604,17 @@ io_setbclient(void) { #ifdef OPEN_BCAST_SOCKET endpt * ep; - unsigned int nif, ni4, ni6; + unsigned int nif, ni4; - nif = ni4 = ni6 = 0; + nif = ni4 = 0; set_reuseaddr(1); for (ep = ep_list; ep != NULL; ep = ep->elink) { - /* count IPv6 vs IPv4 interfaces. Needed later to decide + /* count IPv4 interfaces. Needed later to decide * if we should log an error or not. */ - switch (ep->family) { - case AF_INET : ++ni4; break; - case AF_INET6: ++ni6; break; - default : break; + if (AF_INET == ep->family) { + ++ni4; } if (ep->flags & (INT_WILDCARD | INT_LOOPBACK)) @@ -2696,7 +2694,7 @@ io_setbclient(void) * and no IPv4 interfaces at all. We suppress the error * log in that case... everything else should work! */ - if (ni4 && !ni6) { + if (ni4) { msyslog(LOG_ERR, "Unable to listen for broadcasts, no broadcast interfaces available"); }