Remove SO_TIMESTAMP support, DHCP was broken (#1739081)
Quick made support of SO_TIMESTAMP is broken and it broke whole DHCP. Until that is fixed and properly tested, remove its support. Just skip call to unsupported ioctl. Signed-off-by: Petr Menšík <pemensik@redhat.com>
This commit is contained in:
parent
8503847793
commit
bde34f977c
60
dnsmasq-2.80-SIOCGSTAMP.patch
Normal file
60
dnsmasq-2.80-SIOCGSTAMP.patch
Normal file
@ -0,0 +1,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
|
||||
|
@ -1,100 +0,0 @@
|
||||
From 21c540903974d39dbe0e0eefe26143e93f52d58e Mon Sep 17 00:00:00 2001
|
||||
From: Petr Mensik <pemensik@redhat.com>
|
||||
Date: Wed, 31 Jul 2019 20:35:35 +0200
|
||||
Subject: [PATCH] Add support for SO_TIMESTAMP
|
||||
|
||||
Recent kernel no longer supports SIOCGSTAMP. Make it compile without its
|
||||
support. Use SO_TIMESTAMP message, since already obtained for interface
|
||||
index.
|
||||
---
|
||||
src/dhcp.c | 54 ++++++++++++++++++++++++++++++++++++------------------
|
||||
1 file changed, 36 insertions(+), 18 deletions(-)
|
||||
|
||||
diff --git a/src/dhcp.c b/src/dhcp.c
|
||||
index f8d323b..fd8ffc3 100644
|
||||
--- a/src/dhcp.c
|
||||
+++ b/src/dhcp.c
|
||||
@@ -61,6 +61,9 @@ static int make_fd(int port)
|
||||
#endif
|
||||
#if defined(HAVE_LINUX_NETWORK)
|
||||
setsockopt(fd, IPPROTO_IP, IP_PKTINFO, &oneopt, sizeof(oneopt)) == -1 ||
|
||||
+# ifdef SO_TIMESTAMP
|
||||
+ setsockopt(fd, SOL_SOCKET, SO_TIMESTAMP, &oneopt, sizeof(oneopt)) == -1 ||
|
||||
+# endif
|
||||
#else
|
||||
setsockopt(fd, IPPROTO_IP, IP_RECVIF, &oneopt, sizeof(oneopt)) == -1 ||
|
||||
#endif
|
||||
@@ -152,13 +155,13 @@ void dhcp_packet(time_t now, int pxe_fd)
|
||||
time_t recvtime = now;
|
||||
#ifdef HAVE_LINUX_NETWORK
|
||||
struct arpreq arp_req;
|
||||
- struct timeval tv;
|
||||
+ struct timeval tv = {0, };
|
||||
#endif
|
||||
|
||||
union {
|
||||
struct cmsghdr align; /* this ensures alignment */
|
||||
#if defined(HAVE_LINUX_NETWORK)
|
||||
- char control[CMSG_SPACE(sizeof(struct in_pktinfo))];
|
||||
+ char control[CMSG_SPACE(sizeof(struct in_pktinfo)+sizeof(struct timeval))];
|
||||
#elif defined(HAVE_SOLARIS_NETWORK)
|
||||
char control[CMSG_SPACE(sizeof(unsigned int))];
|
||||
#elif defined(HAVE_BSD_NETWORK)
|
||||
@@ -178,23 +181,38 @@ 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)
|
||||
- recvtime = tv.tv_sec;
|
||||
-
|
||||
+#if defined (HAVE_LINUX_NETWORK)
|
||||
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;
|
||||
+ }
|
||||
+#ifdef SO_TIMESTAMP
|
||||
+ else if (cmptr->cmsg_level == SOL_SOCKET && cmptr->cmsg_type == SO_TIMESTAMP)
|
||||
+ {
|
||||
+ union {
|
||||
+ unsigned char *c;
|
||||
+ struct timeval *tv;
|
||||
+ } p;
|
||||
+ p.c = CMSG_DATA(cmptr);
|
||||
+ recvtime = tv.tv_sec = p.tv->tv_sec;
|
||||
+ }
|
||||
+#endif
|
||||
+ }
|
||||
+
|
||||
+#ifdef SIOCGSTAMP
|
||||
+ if (tv.tv_sec == 0 && ioctl(fd, SIOCGSTAMP, &tv) == 0)
|
||||
+ recvtime = tv.tv_sec;
|
||||
+#endif
|
||||
|
||||
#elif defined(HAVE_BSD_NETWORK)
|
||||
if (msg.msg_controllen >= sizeof(struct cmsghdr))
|
||||
--
|
||||
2.20.1
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
Name: dnsmasq
|
||||
Version: 2.80
|
||||
Release: 8%{?extraversion:.%{extraversion}}%{?dist}
|
||||
Release: 9%{?extraversion:.%{extraversion}}%{?dist}
|
||||
Summary: A lightweight DHCP/caching DNS server
|
||||
|
||||
License: GPLv2 or GPLv3
|
||||
@ -32,7 +32,7 @@ Patch6: dnsmasq-2.80-rh1674067.patch
|
||||
Patch7: dnsmasq-2.80-rh1728701.patch
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=1735096
|
||||
Patch8: dnsmasq-2.80-nettle.patch
|
||||
Patch9: dnsmasq-2.80-dhcp-timestamp.patch
|
||||
Patch9: dnsmasq-2.80-SIOCGSTAMP.patch
|
||||
|
||||
# This is workaround to nettle bug #1549190
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=1549190
|
||||
@ -165,6 +165,9 @@ install -Dpm 644 %{SOURCE2} %{buildroot}%{_sysusersdir}/%{name}.conf
|
||||
%{_mandir}/man1/dhcp_*
|
||||
|
||||
%changelog
|
||||
* Fri Aug 09 2019 Petr Menšík <pemensik@redhat.com> - 2.80-9
|
||||
- Remove SO_TIMESTAMP support, DHCP was broken (#1739081)
|
||||
|
||||
* Wed Jul 31 2019 Petr Menšík <pemensik@redhat.com> - 2.80-8
|
||||
- Compile with nettle 3.5
|
||||
- Support missing SIOCGSTAMP ioctl
|
||||
|
Loading…
Reference in New Issue
Block a user