From 85d27409b9a744f2845806ea68e3345b3a2b1d60 Mon Sep 17 00:00:00 2001 From: Alexey Ivanov Date: Wed, 18 Mar 2015 08:53:19 +0000 Subject: [PATCH] Upgrade to version 4.3.2 and prepare to ship spec files from source tree for inclusion to OpenLDAP installations --- .abf.yml | 6 +- dhcp-4.2.2-fix-format-errors.patch | 85 ---------- dhcp-4.2.2-xen-checksum.patch | 254 ----------------------------- dhcp.spec | 31 +++- 4 files changed, 28 insertions(+), 348 deletions(-) delete mode 100644 dhcp-4.2.2-fix-format-errors.patch delete mode 100644 dhcp-4.2.2-xen-checksum.patch diff --git a/.abf.yml b/.abf.yml index 6be5bd3..fa6f3f9 100644 --- a/.abf.yml +++ b/.abf.yml @@ -1,9 +1,11 @@ removed_sources: - dhcp-4.2.5.tar.gz: d029505509aee83ea28972d5d1c95dc4b5db99f1 dhcp-4.2.5-P1.tar.gz: 120b6e476b2ac0d35e1dc8dee53752c42449b925 dhcp-4.2.5-P1.tar.gz.sha512.asc: d43248ba82d8a2f393f2f6c283ea06fb2df38d18 + dhcp-4.2.5.tar.gz: d029505509aee83ea28972d5d1c95dc4b5db99f1 dhcp-4.2.5.tar.gz.sha512.asc: ac49b30ef17acb36cc5603faa5d780e423aa0e06 -sources: dhcp-4.3.0.tar.gz: deed72a4636461042b74de68c2825dc52623e1d1 dhcp-4.3.0.tar.gz.sha512.asc: e05375f86430f0d92a371fe8f619aa73e65de19a +sources: + dhcp-4.3.2.tar.gz: c7fcc4fa2bd135700b410f47eca238dd67419654 + dhcp-4.3.2.tar.gz.sha512.asc: dd76a14f1424e216dfaf186b75566a867de311d4 dhcp-dynamic-dns-examples.tar.bz2: d33980aad3e0380fc89f8346ab37786d39157696 diff --git a/dhcp-4.2.2-fix-format-errors.patch b/dhcp-4.2.2-fix-format-errors.patch deleted file mode 100644 index ee518c7..0000000 --- a/dhcp-4.2.2-fix-format-errors.patch +++ /dev/null @@ -1,85 +0,0 @@ -diff -Naur -x '*.orig' dhcp-4.2.2/client/dhclient.c dhcp-4.2.2-fix-format-errors/client/dhclient.c ---- dhcp-4.2.2/client/dhclient.c 2011-07-01 13:58:53.000000000 +0200 -+++ dhcp-4.2.2-fix-format-errors/client/dhclient.c 2011-08-29 19:08:55.560183457 +0200 -@@ -420,9 +420,9 @@ - - if (!quiet) { - log_info("%s %s", message, PACKAGE_VERSION); -- log_info(copyright); -- log_info(arr); -- log_info(url); -+ log_info("%s", copyright); -+ log_info("%s", arr); -+ log_info("%s", url); - log_info("%s", ""); - } else { - log_perror = 0; -@@ -701,9 +701,9 @@ - static void usage() - { - log_info("%s %s", message, PACKAGE_VERSION); -- log_info(copyright); -- log_info(arr); -- log_info(url); -+ log_info("%s", copyright); -+ log_info("%s", arr); -+ log_info("%s", url); - - - log_fatal("Usage: dhclient " -diff -Naur -x '*.orig' dhcp-4.2.2/relay/dhcrelay.c dhcp-4.2.2-fix-format-errors/relay/dhcrelay.c ---- dhcp-4.2.2/relay/dhcrelay.c 2011-05-10 15:07:37.000000000 +0200 -+++ dhcp-4.2.2-fix-format-errors/relay/dhcrelay.c 2011-08-29 19:08:55.561183444 +0200 -@@ -428,9 +428,9 @@ - - if (!quiet) { - log_info("%s %s", message, PACKAGE_VERSION); -- log_info(copyright); -- log_info(arr); -- log_info(url); -+ log_info("%s", copyright); -+ log_info("%s", arr); -+ log_info("%s", url); - } else - log_perror = 0; - -diff -Naur -x '*.orig' dhcp-4.2.2/server/dhcpd.c dhcp-4.2.2-fix-format-errors/server/dhcpd.c ---- dhcp-4.2.2/server/dhcpd.c 2011-04-21 16:08:15.000000000 +0200 -+++ dhcp-4.2.2-fix-format-errors/server/dhcpd.c 2011-08-29 19:08:55.563183419 +0200 -@@ -474,9 +474,9 @@ - - if (!quiet) { - log_info("%s %s", message, PACKAGE_VERSION); -- log_info (copyright); -- log_info (arr); -- log_info (url); -+ log_info ("%s", copyright); -+ log_info ("%s", arr); -+ log_info ("%s", url); - } else { - quiet = 0; - log_perror = 0; -@@ -1096,9 +1096,9 @@ - log_perror = 0; - log_info("%s %s", - message, PACKAGE_VERSION); -- log_info(copyright); -- log_info(arr); -- log_info(url); -+ log_info("%s", copyright); -+ log_info("%s", arr); -+ log_info("%s", url); - log_perror = tmp; - } - } else -@@ -1205,8 +1205,8 @@ - static void - usage(void) { - log_info("%s %s", message, PACKAGE_VERSION); -- log_info(copyright); -- log_info(arr); -+ log_info("%s", copyright); -+ log_info("%s", arr); - - log_fatal("Usage: dhcpd [-p ] [-f] [-d] [-q] [-t|-T]\n" - #ifdef DHCPv6 diff --git a/dhcp-4.2.2-xen-checksum.patch b/dhcp-4.2.2-xen-checksum.patch deleted file mode 100644 index 2b56a9d..0000000 --- a/dhcp-4.2.2-xen-checksum.patch +++ /dev/null @@ -1,254 +0,0 @@ -diff -up dhcp-4.2.2b1/common/bpf.c.xen dhcp-4.2.2b1/common/bpf.c ---- dhcp-4.2.2b1/common/bpf.c.xen 2009-11-20 02:48:59.000000000 +0100 -+++ dhcp-4.2.2b1/common/bpf.c 2011-07-01 14:00:16.936959001 +0200 -@@ -481,7 +481,7 @@ - /* Decode the IP and UDP headers... */ - offset = decode_udp_ip_header(interface, interface->rbuf, - interface->rbuf_offset, -- from, hdr.bh_caplen, &paylen); -+ from, hdr.bh_caplen, &paylen, 0); - - /* If the IP or UDP checksum was bad, skip the packet... */ - if (offset < 0) { -diff -up dhcp-4.2.2b1/common/dlpi.c.xen dhcp-4.2.2b1/common/dlpi.c ---- dhcp-4.2.2b1/common/dlpi.c.xen 2011-05-11 16:20:59.000000000 +0200 -+++ dhcp-4.2.2b1/common/dlpi.c 2011-07-01 14:00:16.937958997 +0200 -@@ -693,7 +693,7 @@ ssize_t receive_packet (interface, buf, - length -= offset; - #endif - offset = decode_udp_ip_header (interface, dbuf, bufix, -- from, length, &paylen); -+ from, length, &paylen, 0); - - /* - * If the IP or UDP checksum was bad, skip the packet... -diff -up dhcp-4.2.2b1/common/lpf.c.xen dhcp-4.2.2b1/common/lpf.c ---- dhcp-4.2.2b1/common/lpf.c.xen 2011-05-10 16:38:58.000000000 +0200 -+++ dhcp-4.2.2b1/common/lpf.c 2011-07-01 14:11:24.725748028 +0200 -@@ -29,24 +29,38 @@ - - #include "dhcpd.h" - #if defined (USE_LPF_SEND) || defined (USE_LPF_RECEIVE) -+#include - #include - #include - - #include - #include - #include -+#include - #include --#include - #include "includes/netinet/ip.h" - #include "includes/netinet/udp.h" - #include "includes/netinet/if_ether.h" - #endif - - #if defined (USE_LPF_RECEIVE) || defined (USE_LPF_HWADDR) - #include - #include - #endif - -+#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 -+ - #if defined (USE_LPF_SEND) || defined (USE_LPF_RECEIVE) - /* Reinitializes the specified interface after an address change. This - is not required for packet-filter APIs. */ -@@ -67,10 +81,14 @@ int if_register_lpf (info) - 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 || -@@ -85,11 +103,17 @@ int if_register_lpf (info) - 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); -+ ifr.ifr_name[IFNAMSIZ-1] = '\0'; -+ 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 @@ static void lpf_gen_filter_setup (struct - 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); -@@ -295,7 +328,6 @@ ssize_t send_packet (interface, packet, - double hh [16]; - double ih [1536 / sizeof (double)]; - unsigned char *buf = (unsigned char *)ih; -- struct sockaddr_pkt sa; - int result; - int fudge; - -@@ -316,17 +348,7 @@ ssize_t send_packet (interface, packet, - (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.spkt_family = AF_PACKET; -- strncpy ((char *)sa.spkt_device, -- (const char *)interface -> ifp, sizeof sa.spkt_device); -- sa.spkt_protocol = htons(ETH_P_IP); -- -- result = sendto (interface -> wfdesc, -- buf + fudge, ibufp + len - fudge, 0, -- (const struct sockaddr *)&sa, sizeof sa); -+ result = write (interface -> wfdesc, buf + fudge, ibufp + len - fudge); - if (result < 0) - log_error ("send_packet: %m"); - return result; -@@ -343,14 +365,35 @@ ssize_t receive_packet (interface, buf, - { - int length = 0; - int offset = 0; -+ int nocsum = 0; - unsigned char ibuf [1536]; - unsigned bufix = 0; - unsigned paylen; -+ 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); -@@ -367,7 +410,7 @@ ssize_t receive_packet (interface, buf, - - /* Decode the IP and UDP headers... */ - offset = decode_udp_ip_header (interface, ibuf, bufix, from, -- (unsigned)length, &paylen); -+ (unsigned)length, &paylen, nocsum); - - /* If the IP or UDP checksum was bad, skip the packet... */ - if (offset < 0) -diff -up dhcp-4.2.2b1/common/nit.c.xen dhcp-4.2.2b1/common/nit.c ---- dhcp-4.2.2b1/common/nit.c.xen 2009-11-20 02:49:01.000000000 +0100 -+++ dhcp-4.2.2b1/common/nit.c 2011-07-01 14:00:16.939958989 +0200 -@@ -369,7 +369,7 @@ ssize_t receive_packet (interface, buf, - - /* Decode the IP and UDP headers... */ - offset = decode_udp_ip_header (interface, ibuf, bufix, -- from, length, &paylen); -+ from, length, &paylen, 0); - - /* If the IP or UDP checksum was bad, skip the packet... */ - if (offset < 0) -diff -up dhcp-4.2.2b1/common/packet.c.xen dhcp-4.2.2b1/common/packet.c ---- dhcp-4.2.2b1/common/packet.c.xen 2009-07-23 20:52:20.000000000 +0200 -+++ dhcp-4.2.2b1/common/packet.c 2011-07-01 14:00:16.939958989 +0200 -@@ -211,7 +211,7 @@ ssize_t - decode_udp_ip_header(struct interface_info *interface, - unsigned char *buf, unsigned bufix, - struct sockaddr_in *from, unsigned buflen, -- unsigned *rbuflen) -+ unsigned *rbuflen, int nocsum) - { - unsigned char *data; - struct ip ip; -@@ -322,7 +322,7 @@ decode_udp_ip_header(struct interface_in - 8, IPPROTO_UDP + 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) { -diff -up dhcp-4.2.2b1/common/upf.c.xen dhcp-4.2.2b1/common/upf.c ---- dhcp-4.2.2b1/common/upf.c.xen 2009-11-20 02:49:01.000000000 +0100 -+++ dhcp-4.2.2b1/common/upf.c 2011-07-01 14:00:16.940958986 +0200 -@@ -320,7 +320,7 @@ ssize_t receive_packet (interface, buf, - - /* Decode the IP and UDP headers... */ - offset = decode_udp_ip_header (interface, ibuf, bufix, -- from, length, &paylen); -+ from, length, &paylen, 0); - - /* If the IP or UDP checksum was bad, skip the packet... */ - if (offset < 0) -diff -up dhcp-4.2.2b1/includes/dhcpd.h.xen dhcp-4.2.2b1/includes/dhcpd.h ---- dhcp-4.2.2b1/includes/dhcpd.h.xen 2011-07-01 14:00:16.000000000 +0200 -+++ dhcp-4.2.2b1/includes/dhcpd.h 2011-07-01 14:12:18.069642470 +0200 -@@ -2796,7 +2796,7 @@ ssize_t decode_hw_header (struct interfa - unsigned, struct hardware *); - ssize_t decode_udp_ip_header (struct interface_info *, unsigned char *, - unsigned, struct sockaddr_in *, -- unsigned, unsigned *); -+ unsigned, unsigned *, int); - - /* ethernet.c */ - void assemble_ethernet_header (struct interface_info *, unsigned char *, diff --git a/dhcp.spec b/dhcp.spec index 92dd843..93f6d3f 100644 --- a/dhcp.spec +++ b/dhcp.spec @@ -1,10 +1,14 @@ -%define major_version 4.3.0 -%define patch_version %{nil} +%define major_version 4.3.2 +%define patch_version %{nil} + +# Detect OpenLDAP schema dir +%{!?ol_major: %global ol_major %nil} +%define schema_dir %{_datadir}/openldap%{ol_major}/schema Name: dhcp Epoch: 3 Version: %{major_version}%{patch_version} -Release: 5 +Release: 1 Summary: The ISC DHCP (Dynamic Host Configuration Protocol) server/relay agent/client License: Distributable Group: System/Servers @@ -26,13 +30,13 @@ Source18: dhclient.tmpfiles Source19: dhcrelay.tmpfiles # mageia patches Patch100: dhcp-4.2.2-ifup.patch -Patch101: dhcp-4.2.2-fix-format-errors.patch +#Patch101: dhcp-4.2.2-fix-format-errors.patch # I see it applied in the source already # prevents needless deassociation, working around mdv bug #43441 Patch102: dhcp-4.1.1-prevent_wireless_deassociation.patch Patch103: dhcp-4.2.5-P1-man.patch # fedora patches Patch7: dhcp-4.2.0-default-requested-options.patch -Patch8: dhcp-4.2.2-xen-checksum.patch +#Patch8: dhcp-4.2.2-xen-checksum.patch # fixed in upstream since 4.3.2 Patch15: dhcp-4.2.2-missing-ipv6-not-fatal.patch Patch17: dhcp-4.2.0-add_timeout_when_NULL.patch Patch18: dhcp-4.3.0-64_bit_lease_parse.patch @@ -143,10 +147,15 @@ Requires: dhcp-common = %{EVRD} DHCP devel contains all of the libraries and headers for developing with the Internet Software Consortium (ISC) dhcpctl API. +%package -n openldap-schemas-%{name} +summary: OpenLDAP schema files from %{name}-%{EVRD} source tree +Group: Databases +BuildArch: noarch + %prep %setup -q -n %{name}-%{major_version}%{patch_version} %patch100 -p1 -b .ifup -%patch101 -p1 -b .format_not_a_string_literal_and_no_format_arguments +#patch101 -p1 -b .format_not_a_string_literal_and_no_format_arguments %patch102 -p1 -b .prevent_wireless_deassociation %patch103 -p1 -b .man @@ -154,7 +163,7 @@ Internet Software Consortium (ISC) dhcpctl API. # to the list of default requested DHCP options %patch7 -p1 -b .requested # Handle Xen partial UDP checksums -%patch8 -p1 -b .xen +#patch8 -p1 -b .xen # If the ipv6 kernel module is missing, do not segfault # (Submitted to dhcp-bugs@isc.org - [ISC-Bugs #19367]) %patch15 -p1 -b .noipv6 @@ -251,6 +260,7 @@ find . -type f -exec chmod 0644 {} \; rm -rf doc/ja_JP.eucJP # remove empty files + find -size 0 |grep ldap | xargs rm -rf # remove unwanted file @@ -258,6 +268,10 @@ rm -f %{buildroot}%{_sysconfdir}/dhclient.conf.example rm -f %{buildroot}%{_sysconfdir}/dhcpd.conf.example rm -f %{buildroot}%{_libdir}/*.a +# Prepare schema files to be included into OpenLDAP configuration +mkdir -p %{buildroot}%{schema_dir} +install -m 0644 contrib/ldap/dhcp.schema %{buildroot}%{schema_dir} + %pre server %_pre_useradd dhcpd /dev/null /bin/false @@ -340,4 +354,7 @@ rm -rf %{_var}/lib/dhclient/dhclient.leases %{_mandir}/man3/* %exclude %{_mandir}/man3/omapi.3* +%files -n openldap-schemas-%{name} +%config(noreplace) %{schema_dir}/*.schema +#config(noreplace) #{schema_dir}/*.ldif