]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
ntp_io.c:
authorFrank Kardel <kardel@ntp.org>
Sat, 27 Jan 2007 08:54:51 +0000 (08:54 +0000)
committerFrank Kardel <kardel@ntp.org>
Sat, 27 Jan 2007 08:54:51 +0000 (08:54 +0000)
  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

ntpd/ntp_io.c

index 1fb85280c9229947b91980ca0328af61eb313745..320b6e6dfea55cc284c1fabc983f7aa8f145c449 100644 (file)
@@ -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
         */