Removed upstream-merged IFNAMSIZ.patch

Polished patches according to results from static analysis of code.
This commit is contained in:
Jiri Popelka 2011-06-17 14:38:34 +02:00
parent fdefd274e5
commit 030991fd0d
4 changed files with 54 additions and 68 deletions

View File

@ -1,12 +0,0 @@
diff -up dhcp-4.2.0/server/dhcpd.c.ifnamsiz dhcp-4.2.0/server/dhcpd.c
--- dhcp-4.2.0/server/dhcpd.c.ifnamsiz 2010-07-21 14:31:39.000000000 +0200
+++ dhcp-4.2.0/server/dhcpd.c 2010-07-21 16:05:49.000000000 +0200
@@ -409,7 +409,7 @@ main(int argc, char **argv) {
log_fatal ("Insufficient memory to %s %s: %s",
"record interface", argv [i],
isc_result_totext (result));
- strcpy (tmp -> name, argv [i]);
+ strncpy (tmp -> name, argv [i], sizeof (tmp -> name));
if (interfaces) {
interface_reference (&tmp -> next,
interfaces, MDL);

View File

@ -1,6 +1,6 @@
diff -up dhcp-4.2.0/client/dhc6.c.sendDecline dhcp-4.2.0/client/dhc6.c
--- dhcp-4.2.0/client/dhc6.c.sendDecline 2009-11-20 02:48:58.000000000 +0100
+++ dhcp-4.2.0/client/dhc6.c 2010-07-21 16:18:51.000000000 +0200
diff -up dhcp-4.2.1-P1/client/dhc6.c.sendDecline dhcp-4.2.1-P1/client/dhc6.c
--- dhcp-4.2.1-P1/client/dhc6.c.sendDecline 2010-09-10 22:27:11.000000000 +0200
+++ dhcp-4.2.1-P1/client/dhc6.c 2011-06-17 14:19:48.992099868 +0200
@@ -95,6 +95,8 @@ void do_select6(void *input);
void do_refresh6(void *input);
static void do_release6(void *input);
@ -10,7 +10,7 @@ diff -up dhcp-4.2.0/client/dhc6.c.sendDecline dhcp-4.2.0/client/dhc6.c
static void start_informed(struct client_state *client);
void informed_handler(struct packet *packet, struct client_state *client);
void bound_handler(struct packet *packet, struct client_state *client);
@@ -2140,6 +2142,7 @@ start_release6(struct client_state *clie
@@ -2075,6 +2077,7 @@ start_release6(struct client_state *clie
cancel_timeout(do_select6, client);
cancel_timeout(do_refresh6, client);
cancel_timeout(do_release6, client);
@ -18,7 +18,7 @@ diff -up dhcp-4.2.0/client/dhc6.c.sendDecline dhcp-4.2.0/client/dhc6.c
client->state = S_STOPPED;
/*
@@ -2790,6 +2793,7 @@ dhc6_check_reply(struct client_state *cl
@@ -2708,6 +2711,7 @@ dhc6_check_reply(struct client_state *cl
break;
case S_STOPPED:
@ -26,7 +26,7 @@ diff -up dhcp-4.2.0/client/dhc6.c.sendDecline dhcp-4.2.0/client/dhc6.c
action = dhc6_stop_action;
break;
@@ -2891,6 +2895,7 @@ dhc6_check_reply(struct client_state *cl
@@ -2809,6 +2813,7 @@ dhc6_check_reply(struct client_state *cl
break;
case S_STOPPED:
@ -34,7 +34,7 @@ diff -up dhcp-4.2.0/client/dhc6.c.sendDecline dhcp-4.2.0/client/dhc6.c
/* Nothing critical to do at this stage. */
break;
@@ -3933,17 +3938,23 @@ reply_handler(struct packet *packet, str
@@ -3799,17 +3804,23 @@ reply_handler(struct packet *packet, str
cancel_timeout(do_select6, client);
cancel_timeout(do_refresh6, client);
cancel_timeout(do_release6, client);
@ -66,7 +66,7 @@ diff -up dhcp-4.2.0/client/dhc6.c.sendDecline dhcp-4.2.0/client/dhc6.c
return;
}
@@ -4470,7 +4481,11 @@ start_bound(struct client_state *client)
@@ -4336,7 +4347,11 @@ start_bound(struct client_state *client)
oldia, oldaddr);
dhc6_marshall_values("new_", client, lease, ia, addr);
@ -79,7 +79,7 @@ diff -up dhcp-4.2.0/client/dhc6.c.sendDecline dhcp-4.2.0/client/dhc6.c
}
/* XXX: maybe we should loop on the old values instead? */
@@ -4516,6 +4531,151 @@ start_bound(struct client_state *client)
@@ -4382,6 +4397,149 @@ start_bound(struct client_state *client)
dhc6_check_times(client);
}
@ -220,10 +220,8 @@ diff -up dhcp-4.2.0/client/dhc6.c.sendDecline dhcp-4.2.0/client/dhc6.c
+ return;
+
+decline_done:
+ if (client->active_lease != NULL) {
+ dhc6_lease_destroy(&client->active_lease, MDL);
+ client->active_lease = NULL;
+ }
+ start_init6(client);
+ return;
+}

View File

@ -1,6 +1,6 @@
diff -up dhcp-4.2.0/common/bpf.c.xen dhcp-4.2.0/common/bpf.c
--- dhcp-4.2.0/common/bpf.c.xen 2009-11-20 02:48:59.000000000 +0100
+++ dhcp-4.2.0/common/bpf.c 2010-07-21 13:51:24.000000000 +0200
diff -up dhcp-4.2.1-P1/common/bpf.c.xen dhcp-4.2.1-P1/common/bpf.c
--- dhcp-4.2.1-P1/common/bpf.c.xen 2009-11-20 02:48:59.000000000 +0100
+++ dhcp-4.2.1-P1/common/bpf.c 2011-06-17 13:33:18.398055078 +0200
@@ -485,7 +485,7 @@ ssize_t receive_packet (interface, buf,
offset = decode_udp_ip_header (interface,
interface -> rbuf,
@ -10,10 +10,10 @@ diff -up dhcp-4.2.0/common/bpf.c.xen dhcp-4.2.0/common/bpf.c
/* If the IP or UDP checksum was bad, skip the packet... */
if (offset < 0) {
diff -up dhcp-4.2.0/common/dlpi.c.xen dhcp-4.2.0/common/dlpi.c
--- dhcp-4.2.0/common/dlpi.c.xen 2009-11-20 02:49:00.000000000 +0100
+++ dhcp-4.2.0/common/dlpi.c 2010-07-21 13:51:24.000000000 +0200
@@ -694,7 +694,7 @@ ssize_t receive_packet (interface, buf,
diff -up dhcp-4.2.1-P1/common/dlpi.c.xen dhcp-4.2.1-P1/common/dlpi.c
--- dhcp-4.2.1-P1/common/dlpi.c.xen 2011-02-18 20:16:04.000000000 +0100
+++ dhcp-4.2.1-P1/common/dlpi.c 2011-06-17 13:33:18.398055078 +0200
@@ -695,7 +695,7 @@ ssize_t receive_packet (interface, buf,
length -= offset;
#endif
offset = decode_udp_ip_header (interface, dbuf, bufix,
@ -22,9 +22,9 @@ diff -up dhcp-4.2.0/common/dlpi.c.xen dhcp-4.2.0/common/dlpi.c
/*
* If the IP or UDP checksum was bad, skip the packet...
diff -up dhcp-4.2.0/common/lpf.c.xen dhcp-4.2.0/common/lpf.c
--- dhcp-4.2.0/common/lpf.c.xen 2009-07-23 20:52:19.000000000 +0200
+++ dhcp-4.2.0/common/lpf.c 2010-07-21 13:51:24.000000000 +0200
diff -up dhcp-4.2.1-P1/common/lpf.c.xen dhcp-4.2.1-P1/common/lpf.c
--- dhcp-4.2.1-P1/common/lpf.c.xen 2009-07-23 20:52:19.000000000 +0200
+++ dhcp-4.2.1-P1/common/lpf.c 2011-06-17 13:37:31.611730430 +0200
@@ -29,18 +29,33 @@
#include "dhcpd.h"
#if defined (USE_LPF_SEND) || defined (USE_LPF_RECEIVE)
@ -76,12 +76,13 @@ diff -up dhcp-4.2.0/common/lpf.c.xen dhcp-4.2.0/common/lpf.c
htons((short)ETH_P_ALL))) < 0) {
if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT ||
errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT ||
@@ -84,11 +103,16 @@ int if_register_lpf (info)
@@ -84,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");
+
@ -96,7 +97,7 @@ diff -up dhcp-4.2.0/common/lpf.c.xen dhcp-4.2.0/common/lpf.c
if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT ||
errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT ||
errno == EAFNOSUPPORT || errno == EINVAL) {
@@ -170,9 +194,18 @@ static void lpf_gen_filter_setup (struct
@@ -170,9 +195,18 @@ static void lpf_gen_filter_setup (struct
void if_register_receive (info)
struct interface_info *info;
{
@ -115,7 +116,7 @@ diff -up dhcp-4.2.0/common/lpf.c.xen dhcp-4.2.0/common/lpf.c
#if defined (HAVE_TR_SUPPORT)
if (info -> hw_address.hbuf [0] == HTYPE_IEEE802)
lpf_tr_filter_setup (info);
@@ -294,7 +327,6 @@ ssize_t send_packet (interface, packet,
@@ -294,7 +328,6 @@ ssize_t send_packet (interface, packet,
double hh [16];
double ih [1536 / sizeof (double)];
unsigned char *buf = (unsigned char *)ih;
@ -123,7 +124,7 @@ diff -up dhcp-4.2.0/common/lpf.c.xen dhcp-4.2.0/common/lpf.c
int result;
int fudge;
@@ -315,15 +347,7 @@ ssize_t send_packet (interface, packet,
@@ -315,15 +348,7 @@ ssize_t send_packet (interface, packet,
(unsigned char *)raw, len);
memcpy (buf + ibufp, raw, len);
@ -140,7 +141,7 @@ diff -up dhcp-4.2.0/common/lpf.c.xen dhcp-4.2.0/common/lpf.c
if (result < 0)
log_error ("send_packet: %m");
return result;
@@ -340,14 +364,35 @@ ssize_t receive_packet (interface, buf,
@@ -340,14 +365,35 @@ ssize_t receive_packet (interface, buf,
{
int length = 0;
int offset = 0;
@ -177,7 +178,7 @@ diff -up dhcp-4.2.0/common/lpf.c.xen dhcp-4.2.0/common/lpf.c
bufix = 0;
/* Decode the physical header... */
offset = decode_hw_header (interface, ibuf, bufix, hfrom);
@@ -364,7 +409,7 @@ ssize_t receive_packet (interface, buf,
@@ -364,7 +410,7 @@ ssize_t receive_packet (interface, buf,
/* Decode the IP and UDP headers... */
offset = decode_udp_ip_header (interface, ibuf, bufix, from,
@ -186,9 +187,9 @@ diff -up dhcp-4.2.0/common/lpf.c.xen dhcp-4.2.0/common/lpf.c
/* If the IP or UDP checksum was bad, skip the packet... */
if (offset < 0)
diff -up dhcp-4.2.0/common/nit.c.xen dhcp-4.2.0/common/nit.c
--- dhcp-4.2.0/common/nit.c.xen 2009-11-20 02:49:01.000000000 +0100
+++ dhcp-4.2.0/common/nit.c 2010-07-21 13:51:24.000000000 +0200
diff -up dhcp-4.2.1-P1/common/nit.c.xen dhcp-4.2.1-P1/common/nit.c
--- dhcp-4.2.1-P1/common/nit.c.xen 2009-11-20 02:49:01.000000000 +0100
+++ dhcp-4.2.1-P1/common/nit.c 2011-06-17 13:33:18.414054663 +0200
@@ -369,7 +369,7 @@ ssize_t receive_packet (interface, buf,
/* Decode the IP and UDP headers... */
@ -198,9 +199,9 @@ diff -up dhcp-4.2.0/common/nit.c.xen dhcp-4.2.0/common/nit.c
/* If the IP or UDP checksum was bad, skip the packet... */
if (offset < 0)
diff -up dhcp-4.2.0/common/packet.c.xen dhcp-4.2.0/common/packet.c
--- dhcp-4.2.0/common/packet.c.xen 2009-07-23 20:52:20.000000000 +0200
+++ dhcp-4.2.0/common/packet.c 2010-07-21 13:51:24.000000000 +0200
diff -up dhcp-4.2.1-P1/common/packet.c.xen dhcp-4.2.1-P1/common/packet.c
--- dhcp-4.2.1-P1/common/packet.c.xen 2009-07-23 20:52:20.000000000 +0200
+++ dhcp-4.2.1-P1/common/packet.c 2011-06-17 13:33:18.414054663 +0200
@@ -211,7 +211,7 @@ ssize_t
decode_udp_ip_header(struct interface_info *interface,
unsigned char *buf, unsigned bufix,
@ -219,9 +220,9 @@ diff -up dhcp-4.2.0/common/packet.c.xen dhcp-4.2.0/common/packet.c
udp_packets_bad_checksum++;
if (udp_packets_seen > 4 &&
(udp_packets_seen / udp_packets_bad_checksum) < 2) {
diff -up dhcp-4.2.0/common/upf.c.xen dhcp-4.2.0/common/upf.c
--- dhcp-4.2.0/common/upf.c.xen 2009-11-20 02:49:01.000000000 +0100
+++ dhcp-4.2.0/common/upf.c 2010-07-21 13:51:24.000000000 +0200
diff -up dhcp-4.2.1-P1/common/upf.c.xen dhcp-4.2.1-P1/common/upf.c
--- dhcp-4.2.1-P1/common/upf.c.xen 2009-11-20 02:49:01.000000000 +0100
+++ dhcp-4.2.1-P1/common/upf.c 2011-06-17 13:33:18.418054566 +0200
@@ -320,7 +320,7 @@ ssize_t receive_packet (interface, buf,
/* Decode the IP and UDP headers... */
@ -231,10 +232,10 @@ diff -up dhcp-4.2.0/common/upf.c.xen dhcp-4.2.0/common/upf.c
/* If the IP or UDP checksum was bad, skip the packet... */
if (offset < 0)
diff -up dhcp-4.2.0/includes/dhcpd.h.xen dhcp-4.2.0/includes/dhcpd.h
--- dhcp-4.2.0/includes/dhcpd.h.xen 2010-07-21 13:38:31.000000000 +0200
+++ dhcp-4.2.0/includes/dhcpd.h 2010-07-21 13:51:24.000000000 +0200
@@ -2773,7 +2773,7 @@ ssize_t decode_hw_header PROTO ((struct
diff -up dhcp-4.2.1-P1/includes/dhcpd.h.xen dhcp-4.2.1-P1/includes/dhcpd.h
--- dhcp-4.2.1-P1/includes/dhcpd.h.xen 2011-06-17 13:33:18.382055486 +0200
+++ dhcp-4.2.1-P1/includes/dhcpd.h 2011-06-17 13:33:18.420054516 +0200
@@ -2776,7 +2776,7 @@ ssize_t decode_hw_header PROTO ((struct
unsigned, struct hardware *));
ssize_t decode_udp_ip_header PROTO ((struct interface_info *, unsigned char *,
unsigned, struct sockaddr_in *,

View File

@ -16,7 +16,7 @@
Summary: Dynamic host configuration protocol software
Name: dhcp
Version: 4.2.1
Release: 11.%{patchver}%{?dist}
Release: 12.%{patchver}%{?dist}
# NEVER CHANGE THE EPOCH on this package. The previous maintainer (prior to
# dcantrell maintaining the package) made incorrect use of the epoch and
# that's why it is at 12 now. It should have never been used, but it was.
@ -45,20 +45,19 @@ Patch3: dhcp-4.2.0-dhclient-decline-backoff.patch
Patch4: dhcp-4.2.0-unicast-bootp.patch
Patch6: dhcp-4.2.0-dhclient-usage.patch
Patch7: dhcp-4.2.0-default-requested-options.patch
Patch8: dhcp-4.2.0-xen-checksum.patch
Patch8: dhcp-4.2.1-xen-checksum.patch
Patch10: dhcp-4.2.1-manpages.patch
Patch11: dhcp-4.2.0-paths.patch
Patch12: dhcp-4.2.0-CLOEXEC.patch
Patch13: dhcp-4.2.0-inherit-leases.patch
Patch14: dhcp-4.2.0-garbage-chars.patch
Patch15: dhcp-4.2.0-missing-ipv6-not-fatal.patch
Patch16: dhcp-4.2.0-IFNAMSIZ.patch
Patch17: dhcp-4.2.0-add_timeout_when_NULL.patch
Patch18: dhcp-4.2.1-64_bit_lease_parse.patch
Patch19: dhcp-4.2.1-capability.patch
Patch20: dhcp-4.2.0-logpid.patch
Patch21: dhcp-4.2.0-UseMulticast.patch
Patch22: dhcp-4.2.0-sendDecline.patch
Patch22: dhcp-4.2.1-sendDecline.patch
Patch23: dhcp-4.2.1-retransmission.patch
Patch24: dhcp-4.2.0-initialization-delay.patch
Patch25: dhcp-4.2.0-rfc3442-classless-static-routes.patch
@ -244,10 +243,6 @@ rm bind/bind.tar.gz
# (Submitted to dhcp-bugs@isc.org - [ISC-Bugs #19367])
%patch15 -p1 -b .noipv6
# Read only up to IFNAMSIZ characters for the interface name in dhcpd (#441524)
# (Submitted to dhcp-bugs@isc.org - [ISC-Bugs #19617])
%patch16 -p1 -b .ifnamsiz
# Handle cases in add_timeout() where the function is called with a NULL
# value for the 'when' parameter
# (Submitted to dhcp-bugs@isc.org - [ISC-Bugs #19867])
@ -393,17 +388,17 @@ CFLAGS="%{optflags} -fno-strict-aliasing -D_GNU_SOURCE" \
%{__mv} %{buildroot}%{_sbindir}/dhclient %{buildroot}/sbin/dhclient
%{__install} -p -m 0755 client/scripts/linux %{buildroot}/sbin/dhclient-script
# Install init scripts
# Install legacy SysV initscripts
%{__mkdir} -p %{buildroot}%{_initddir}
%{__install} -p -m 0755 %{SOURCE1} %{buildroot}%{_initddir}/dhcpd
%{__install} -p -m 0755 %{SOURCE2} %{buildroot}%{_initddir}/dhcpd6
%{__install} -p -m 0755 %{SOURCE3} %{buildroot}%{_initddir}/dhcrelay
# install systemd initscripts
mkdir -p %{buildroot}/lib/systemd/system/
install -m 644 %{SOURCE9} %{buildroot}/lib/systemd/system/dhcpd.service
install -m 644 %{SOURCE10} %{buildroot}/lib/systemd/system/dhcpd6.service
install -m 644 %{SOURCE11} %{buildroot}/lib/systemd/system/dhcrelay.service
# Install systemd unit files
mkdir -p %{buildroot}%{_unitdir}
install -m 644 %{SOURCE9} %{buildroot}%{_unitdir}
install -m 644 %{SOURCE10} %{buildroot}%{_unitdir}
install -m 644 %{SOURCE11} %{buildroot}%{_unitdir}
# Start empty lease databases
%{__mkdir} -p %{buildroot}%{_localstatedir}/lib/dhcpd/
@ -656,6 +651,10 @@ fi
%{_initddir}/dhcrelay
%changelog
* Fri Jun 17 2011 Jiri Popelka <jpopelka@redhat.com> - 12:4.2.1-12.P1
- Removed upstream-merged IFNAMSIZ.patch
- Polished patches according to results from static analysis of code.
* Thu Jun 16 2011 Jiri Popelka <jpopelka@redhat.com> - 12:4.2.1-11.P1
- Add triggerpostun scriptlet tied to dhcp-sysvinit
- Make it possible to build without downstream patches (Kamil Dudka)