]> git.ipfire.org Git - people/ms/ipfire-3.x.git/blobdiff - ntp/patches/ntp-4.2.6p3-bcast.patch
ntp: Update to 4.2.8
[people/ms/ipfire-3.x.git] / ntp / patches / ntp-4.2.6p3-bcast.patch
diff --git a/ntp/patches/ntp-4.2.6p3-bcast.patch b/ntp/patches/ntp-4.2.6p3-bcast.patch
deleted file mode 100644 (file)
index 57581f3..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-diff -up ntp-4.2.6p3/ntpd/ntp_io.c.bcast ntp-4.2.6p3/ntpd/ntp_io.c
---- ntp-4.2.6p3/ntpd/ntp_io.c.bcast    2010-12-25 10:40:36.000000000 +0100
-+++ ntp-4.2.6p3/ntpd/ntp_io.c  2011-01-05 17:46:13.820049150 +0100
-@@ -151,6 +151,8 @@ int ninterfaces;                   /* Total number of in
- int disable_dynamic_updates;          /* scan interfaces once only */
-+static int pktinfo_status = 0;                /* is IP_PKTINFO on wildipv4 iface enabled? */
-+
- #ifdef REFCLOCK
- /*
-  * Refclock stuff.    We keep a chain of structures with data concerning
-@@ -2254,6 +2256,17 @@ set_reuseaddr(
- #endif /* ! SO_EXCLUSIVEADDRUSE */
- }
-+static void
-+set_pktinfo(int flag)
-+{
-+      if (wildipv4 == NULL)
-+              return;
-+      if (setsockopt(wildipv4->fd, SOL_IP, IP_PKTINFO, &flag, sizeof (flag))) {
-+              msyslog(LOG_ERR, "set_pktinfo: setsockopt(IP_PKTINFO, %s) failed: %m", flag ? "on" : "off");
-+      } else
-+              pktinfo_status = flag;
-+}
-+
- /*
-  * This is just a wrapper around an internal function so we can
-  * make other changes as necessary later on
-@@ -2659,6 +2672,7 @@ io_setbclient(void)
-               }
-       }
-       set_reuseaddr(0);
-+      set_pktinfo(1);
-       if (nif > 0)
-               DPRINTF(1, ("io_setbclient: Opened broadcast clients\n"));
-       else if (!nif)
-@@ -2685,6 +2699,7 @@ io_unsetbclient(void)
-                       continue;
-               socket_broadcast_disable(ep, &ep->sin);
-       }
-+      set_pktinfo(0);
- }
- /*
-@@ -3392,7 +3407,8 @@ read_network_packet(
- #ifdef HAVE_TIMESTAMP
-       struct msghdr msghdr;
-       struct iovec iovec;
--      char control[TIMESTAMP_CTLMSGBUF_SIZE];
-+      char control[sizeof (struct cmsghdr) * 2 + sizeof (struct timeval) +
-+              sizeof (struct in_pktinfo) + 32];
- #endif
-       /*
-@@ -3403,7 +3419,7 @@ read_network_packet(
-        */
-       rb = get_free_recv_buffer();
--      if (NULL == rb || itf->ignore_packets) {
-+      if (NULL == rb || (itf->ignore_packets && !(pktinfo_status && itf == wildipv4))) {
-               char buf[RX_BUFF_SIZE];
-               sockaddr_u from;
-@@ -3463,6 +3479,27 @@ read_network_packet(
-               return (buflen);
-       }
-+      if (pktinfo_status && itf->ignore_packets && itf == wildipv4) {
-+              /* check for broadcast on 255.255.255.255, exception allowed on wildipv4 */
-+              struct cmsghdr *cmsg;
-+              struct in_pktinfo *pktinfo = NULL;
-+
-+              if ((cmsg = CMSG_FIRSTHDR(&msghdr)))
-+                      do {
-+                              if (cmsg->cmsg_level == SOL_IP && cmsg->cmsg_type == IP_PKTINFO)
-+                                      pktinfo = (struct in_pktinfo *) CMSG_DATA(cmsg);
-+                      } while ((cmsg = CMSG_NXTHDR(&msghdr, cmsg)));
-+              if (pktinfo && pktinfo->ipi_addr.s_addr == INADDR_BROADCAST) {
-+                      DPRINTF(4, ("INADDR_BROADCAST\n"));
-+              } else {
-+                      DPRINTF(4, ("%s on (%lu) fd=%d from %s\n", "ignore",
-+                              free_recvbuffs(), fd, stoa(&rb->recv_srcadr)));
-+                      packets_ignored++;
-+                      freerecvbuf(rb);
-+                      return (buflen);
-+              }
-+      }
-+
-       DPRINTF(3, ("read_network_packet: fd=%d length %d from %s\n",
-                   fd, buflen, stoa(&rb->recv_srcadr)));