summaryrefslogtreecommitdiff
path: root/source/n/dnsmasq/dnsmasq-2.80-SIOCGSTAMP.patch
blob: 3a32bb82ec609b811b2e1fb7962805c0a8c5fa80 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
From 31e14f6e52677c675ee4683f9daab5bf21c07dd6 Mon Sep 17 00:00:00 2001
From: Petr Mensik <pemensik@redhat.com>
Date: Wed, 31 Jul 2019 20:35:35 +0200
Subject: [PATCH] Recent kernel no longer supports SIOCGSTAMP

Build without it defined by kernel headers. Do not try SO_TIMESTAMP
until fixed properly.
---
 src/dhcp.c | 32 ++++++++++++++++++--------------
 1 file changed, 18 insertions(+), 14 deletions(-)

diff --git a/src/dhcp.c b/src/dhcp.c
index f8d323b..9afdccf 100644
--- a/src/dhcp.c
+++ b/src/dhcp.c
@@ -178,23 +178,27 @@ void dhcp_packet(time_t now, int pxe_fd)
       (sz < (ssize_t)(sizeof(*mess) - sizeof(mess->options)))) 
     return;
     
-  #if defined (HAVE_LINUX_NETWORK)
-  if (ioctl(fd, SIOCGSTAMP, &tv) == 0)
+#if defined (HAVE_LINUX_NETWORK)
+#ifdef SIOCGSTAMP
+  if (tv.tv_sec == 0 && ioctl(fd, SIOCGSTAMP, &tv) == 0)
     recvtime = tv.tv_sec;
+#endif
 
   if (msg.msg_controllen >= sizeof(struct cmsghdr))
-    for (cmptr = CMSG_FIRSTHDR(&msg); cmptr; cmptr = CMSG_NXTHDR(&msg, cmptr))
-      if (cmptr->cmsg_level == IPPROTO_IP && cmptr->cmsg_type == IP_PKTINFO)
-	{
-	  union {
-	    unsigned char *c;
-	    struct in_pktinfo *p;
-	  } p;
-	  p.c = CMSG_DATA(cmptr);
-	  iface_index = p.p->ipi_ifindex;
-	  if (p.p->ipi_addr.s_addr != INADDR_BROADCAST)
-	    unicast_dest = 1;
-	}
+    {
+      for (cmptr = CMSG_FIRSTHDR(&msg); cmptr; cmptr = CMSG_NXTHDR(&msg, cmptr))
+        if (cmptr->cmsg_level == IPPROTO_IP && cmptr->cmsg_type == IP_PKTINFO)
+	  {
+	    union {
+	      unsigned char *c;
+	      struct in_pktinfo *p;
+	    } p;
+	    p.c = CMSG_DATA(cmptr);
+	    iface_index = p.p->ipi_ifindex;
+	    if (p.p->ipi_addr.s_addr != INADDR_BROADCAST)
+	      unicast_dest = 1;
+	  }
+    }
 
 #elif defined(HAVE_BSD_NETWORK) 
   if (msg.msg_controllen >= sizeof(struct cmsghdr))
-- 
2.20.1