rpms/dhcp/devel dhcp-3.0.5-xen-checksum.patch, 1.4, 1.5 dhcp.spec, 1.153, 1.154
fedora-cvs-commits at redhat.com
fedora-cvs-commits at redhat.com
Wed Apr 11 14:29:21 UTC 2007
Author: dcantrel
Update of /cvs/dist/rpms/dhcp/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv25328
Modified Files:
dhcp.spec
Added Files:
dhcp-3.0.5-xen-checksum.patch
Log Message:
* Wed Apr 11 2007 David Cantrell <dcantrell at redhat.com> - 12:3.0.5-30
- Enable Xen patch again, kernel bits present (#231444)
dhcp-3.0.5-xen-checksum.patch:
common/bpf.c | 3 +-
common/dlpi.c | 2 -
common/lpf.c | 79 +++++++++++++++++++++++++++++++++++++++++++------------
common/nit.c | 2 -
common/packet.c | 5 ++-
common/upf.c | 2 -
includes/dhcpd.h | 2 -
7 files changed, 71 insertions(+), 24 deletions(-)
Index: dhcp-3.0.5-xen-checksum.patch
===================================================================
RCS file: dhcp-3.0.5-xen-checksum.patch
diff -N dhcp-3.0.5-xen-checksum.patch
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ dhcp-3.0.5-xen-checksum.patch 11 Apr 2007 14:29:18 -0000 1.5
@@ -0,0 +1,242 @@
+--- dhcp-3.0.5/common/bpf.c.xen 2004-11-24 12:39:15.000000000 -0500
++++ dhcp-3.0.5/common/bpf.c 2007-03-30 16:34:45.000000000 -0400
+@@ -478,7 +478,8 @@
+ interface -> rbuf,
+ interface -> rbuf_offset,
+ from,
+- hdr.bh_caplen);
++ hdr.bh_caplen,
++ 0);
+
+ /* If the IP or UDP checksum was bad, skip the packet... */
+ if (offset < 0) {
+--- dhcp-3.0.5/common/dlpi.c.xen 2004-11-24 12:39:15.000000000 -0500
++++ dhcp-3.0.5/common/dlpi.c 2007-03-30 16:34:45.000000000 -0400
+@@ -679,7 +679,7 @@
+ length -= offset;
+ #endif
+ offset = decode_udp_ip_header (interface, dbuf, bufix,
+- from, length);
++ from, length, 0);
+
+ /* If the IP or UDP checksum was bad, skip the packet... */
+ if (offset < 0) {
+--- dhcp-3.0.5/common/lpf.c.xen 2007-03-30 16:34:26.000000000 -0400
++++ dhcp-3.0.5/common/lpf.c 2007-03-30 16:34:45.000000000 -0400
+@@ -34,16 +34,31 @@
+ #include "dhcpd.h"
+ #if defined (USE_LPF_SEND) || defined (USE_LPF_RECEIVE)
+ #include <sys/ioctl.h>
++#include <sys/socket.h>
+ #include <sys/uio.h>
+
+ #include <asm/types.h>
+ #include <linux/filter.h>
+ #include <linux/if_ether.h>
++#include <linux/if_packet.h>
+ #include <netinet/in_systm.h>
+ #include "includes/netinet/ip.h"
+ #include "includes/netinet/udp.h"
+ #include "includes/netinet/if_ether.h"
+
++#ifndef PACKET_AUXDATA
++#define PACKET_AUXDATA 8
++
++struct tpacket_auxdata
++{
++ __u32 tp_status;
++ __u32 tp_len;
++ __u32 tp_snaplen;
++ __u16 tp_mac;
++ __u16 tp_net;
++};
++#endif
++
+ /* Reinitializes the specified interface after an address change. This
+ is not required for packet-filter APIs. */
+
+@@ -69,10 +84,14 @@
+ struct interface_info *info;
+ {
+ int sock;
+- struct sockaddr sa;
++ union {
++ struct sockaddr_ll ll;
++ struct sockaddr common;
++ } sa;
++ struct ifreq ifr;
+
+ /* Make an LPF socket. */
+- if ((sock = socket(PF_PACKET, SOCK_PACKET,
++ if ((sock = socket(PF_PACKET, SOCK_RAW,
+ htons((short)ETH_P_ALL))) < 0) {
+ if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT ||
+ errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT ||
+@@ -87,11 +106,16 @@
+ log_fatal ("Open a socket for LPF: %m");
+ }
+
++ memset (&ifr, 0, sizeof ifr);
++ strncpy (ifr.ifr_name, (const char *)info -> ifp, sizeof ifr.ifr_name);
++ if (ioctl (sock, SIOCGIFINDEX, &ifr))
++ log_fatal ("Failed to get interface index: %m");
++
+ /* Bind to the interface name */
+ memset (&sa, 0, sizeof sa);
+- sa.sa_family = AF_PACKET;
+- strncpy (sa.sa_data, (const char *)info -> ifp, sizeof sa.sa_data);
+- if (bind (sock, &sa, sizeof sa)) {
++ sa.ll.sll_family = AF_PACKET;
++ sa.ll.sll_ifindex = ifr.ifr_ifindex;
++ if (bind (sock, &sa.common, sizeof sa)) {
+ if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT ||
+ errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT ||
+ errno == EAFNOSUPPORT || errno == EINVAL) {
+@@ -171,9 +195,18 @@
+ void if_register_receive (info)
+ struct interface_info *info;
+ {
++ int val;
++
+ /* Open a LPF device and hang it on this interface... */
+ info -> rfdesc = if_register_lpf (info);
+
++ val = 1;
++ if (setsockopt (info -> rfdesc, SOL_PACKET, PACKET_AUXDATA, &val,
++ sizeof val) < 0) {
++ if (errno != ENOPROTOOPT)
++ log_fatal ("Failed to set auxiliary packet data: %m");
++ }
++
+ #if defined (HAVE_TR_SUPPORT)
+ if (info -> hw_address.hbuf [0] == HTYPE_IEEE802)
+ lpf_tr_filter_setup (info);
+@@ -291,7 +324,6 @@
+ double hh [16];
+ double ih [1536 / sizeof (double)];
+ unsigned char *buf = (unsigned char *)ih;
+- struct sockaddr sa;
+ int result;
+ int fudge;
+
+@@ -309,15 +341,7 @@
+ (unsigned char *)raw, len);
+ memcpy (buf + ibufp, raw, len);
+
+- /* For some reason, SOCK_PACKET sockets can't be connected,
+- so we have to do a sentdo every time. */
+- memset (&sa, 0, sizeof sa);
+- sa.sa_family = AF_PACKET;
+- strncpy (sa.sa_data,
+- (const char *)interface -> ifp, sizeof sa.sa_data);
+-
+- result = sendto (interface -> wfdesc,
+- buf + fudge, ibufp + len - fudge, 0, &sa, sizeof sa);
++ result = write (interface -> wfdesc, buf + fudge, ibufp + len - fudge);
+ if (result < 0)
+ log_error ("send_packet: %m");
+ return result;
+@@ -334,13 +358,34 @@
+ {
+ int length = 0;
+ int offset = 0;
++ int nocsum = 0;
+ unsigned char ibuf [1536];
+ unsigned bufix = 0;
++ unsigned char cmsgbuf[CMSG_LEN(sizeof(struct tpacket_auxdata))];
++ struct iovec iov = {
++ .iov_base = ibuf,
++ .iov_len = sizeof ibuf,
++ };
++ struct msghdr msg = {
++ .msg_iov = &iov,
++ .msg_iovlen = 1,
++ .msg_control = cmsgbuf,
++ .msg_controllen = sizeof(cmsgbuf),
++ };
++ struct cmsghdr *cmsg;
+
+- length = read (interface -> rfdesc, ibuf, sizeof ibuf);
++ length = recvmsg (interface -> rfdesc, &msg, 0);
+ if (length <= 0)
+ return length;
+
++ for (cmsg = CMSG_FIRSTHDR(&msg); cmsg; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
++ if (cmsg->cmsg_level == SOL_PACKET &&
++ cmsg->cmsg_type == PACKET_AUXDATA) {
++ struct tpacket_auxdata *aux = (void *)CMSG_DATA(cmsg);
++ nocsum = aux->tp_status & TP_STATUS_CSUMNOTREADY;
++ }
++ }
++
+ bufix = 0;
+ /* Decode the physical header... */
+ offset = decode_hw_header (interface, ibuf, bufix, hfrom);
+@@ -357,7 +402,7 @@
+
+ /* Decode the IP and UDP headers... */
+ offset = decode_udp_ip_header (interface, ibuf, bufix, from,
+- (unsigned)length);
++ (unsigned)length, nocsum);
+
+ /* If the IP or UDP checksum was bad, skip the packet... */
+ if (offset < 0)
+--- dhcp-3.0.5/common/nit.c.xen 2004-11-24 12:39:15.000000000 -0500
++++ dhcp-3.0.5/common/nit.c 2007-03-30 16:34:45.000000000 -0400
+@@ -370,7 +370,7 @@
+
+ /* Decode the IP and UDP headers... */
+ offset = decode_udp_ip_header (interface, ibuf, bufix,
+- from, length);
++ from, length, 0);
+
+ /* If the IP or UDP checksum was bad, skip the packet... */
+ if (offset < 0)
+--- dhcp-3.0.5/common/packet.c.xen 2007-03-30 16:34:26.000000000 -0400
++++ dhcp-3.0.5/common/packet.c 2007-03-30 16:34:45.000000000 -0400
+@@ -211,12 +211,13 @@
+
+ /* UDP header and IP header decoded together for convenience. */
+
+-ssize_t decode_udp_ip_header (interface, buf, bufix, from, buflen)
++ssize_t decode_udp_ip_header (interface, buf, bufix, from, buflen, nocsum)
+ struct interface_info *interface;
+ unsigned char *buf;
+ unsigned bufix;
+ struct sockaddr_in *from;
+ unsigned buflen;
++ int nocsum;
+ {
+ unsigned char *data;
+ struct ip ip;
+@@ -319,7 +320,7 @@
+ (u_int32_t)ulen))));
+
+ udp_packets_seen++;
+- if (usum && usum != sum) {
++ if (!nocsum && usum && usum != sum) {
+ udp_packets_bad_checksum++;
+ if (udp_packets_seen > 4 &&
+ (udp_packets_seen / udp_packets_bad_checksum) < 2) {
+--- dhcp-3.0.5/common/upf.c.xen 2004-11-24 12:39:16.000000000 -0500
++++ dhcp-3.0.5/common/upf.c 2007-03-30 16:34:45.000000000 -0400
+@@ -321,7 +321,7 @@
+
+ /* Decode the IP and UDP headers... */
+ offset = decode_udp_ip_header (interface, ibuf, bufix,
+- from, length);
++ from, length, 0);
+
+ /* If the IP or UDP checksum was bad, skip the packet... */
+ if (offset < 0)
+--- dhcp-3.0.5/includes/dhcpd.h.xen 2007-03-30 16:34:26.000000000 -0400
++++ dhcp-3.0.5/includes/dhcpd.h 2007-03-30 16:34:45.000000000 -0400
+@@ -1988,7 +1988,7 @@
+ unsigned, struct hardware *));
+ ssize_t decode_udp_ip_header PROTO ((struct interface_info *, unsigned char *,
+ unsigned, struct sockaddr_in *,
+- unsigned));
++ unsigned, int));
+
+ /* ethernet.c */
+ void assemble_ethernet_header PROTO ((struct interface_info *, unsigned char *,
Index: dhcp.spec
===================================================================
RCS file: /cvs/dist/rpms/dhcp/devel/dhcp.spec,v
retrieving revision 1.153
retrieving revision 1.154
diff -u -r1.153 -r1.154
--- dhcp.spec 9 Apr 2007 21:44:55 -0000 1.153
+++ dhcp.spec 11 Apr 2007 14:29:18 -0000 1.154
@@ -10,7 +10,7 @@
Summary: DHCP (Dynamic Host Configuration Protocol) server and relay agent
Name: dhcp
Version: 3.0.5
-Release: 29%{?dist}
+Release: 30%{?dist}
Epoch: 12
License: ISC
Group: System Environment/Daemons
@@ -51,6 +51,7 @@
Patch18: %{name}-3.0.5-prototypes.patch
Patch19: %{name}-3.0.5-manpages.patch
Patch20: %{name}-3.0.5-libdhcp4client.patch
+Patch21: %{name}-3.0.5-xen-checksum.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: groff openldap-devel
@@ -210,6 +211,9 @@
# Add the libdhcp4client target (library version of dhclient)
%patch20 -p1 -b .libdhcp4client
+# Handle Xen partial UDP checksums
+%patch21 -p1 -b .xen
+
# Copy in documentation and example scripts for LDAP patch to dhcpd
%{__install} -p -m 0644 %SOURCE6 .
%{__install} -p -m 0644 %SOURCE7 doc
@@ -398,6 +402,9 @@
%{_libdir}/libdhcp4client.so
%changelog
+* Wed Apr 11 2007 David Cantrell <dcantrell at redhat.com> - 12:3.0.5-30
+- Enable Xen patch again, kernel bits present (#231444)
+
* Tue Apr 10 2007 David Cantrell <dcantrell at redhat.com> - 12:3.0.5-29
- Spec file cleanups (#225691)
More information about the fedora-cvs-commits
mailing list