fix two resource leaks in lpf-ib.patch
This commit is contained in:
parent
0f768b61dd
commit
344e2934be
@ -1,6 +1,6 @@
|
||||
diff -up dhcp-4.2.4/client/dhclient.c.lpf-ib dhcp-4.2.4/client/dhclient.c
|
||||
--- dhcp-4.2.4/client/dhclient.c.lpf-ib 2012-07-18 21:08:48.100835005 +0200
|
||||
+++ dhcp-4.2.4/client/dhclient.c 2012-07-18 21:08:48.111834856 +0200
|
||||
diff -up dhcp-4.2.4-P2/client/dhclient.c.lpf-ib dhcp-4.2.4-P2/client/dhclient.c
|
||||
--- dhcp-4.2.4-P2/client/dhclient.c.lpf-ib 2012-11-30 14:05:07.399394154 +0100
|
||||
+++ dhcp-4.2.4-P2/client/dhclient.c 2012-11-30 14:05:07.406394070 +0100
|
||||
@@ -113,6 +113,8 @@ static int check_domain_name_list(const
|
||||
static int check_option_values(struct universe *universe, unsigned int opt,
|
||||
const char *ptr, size_t len);
|
||||
@ -55,9 +55,9 @@ diff -up dhcp-4.2.4/client/dhclient.c.lpf-ib dhcp-4.2.4/client/dhclient.c
|
||||
/* Individual States:
|
||||
*
|
||||
* Each routine is called from the dhclient_state_machine() in one of
|
||||
diff -up dhcp-4.2.4/common/bpf.c.lpf-ib dhcp-4.2.4/common/bpf.c
|
||||
--- dhcp-4.2.4/common/bpf.c.lpf-ib 2012-07-18 21:08:48.101834991 +0200
|
||||
+++ dhcp-4.2.4/common/bpf.c 2012-07-18 21:08:48.111834856 +0200
|
||||
diff -up dhcp-4.2.4-P2/common/bpf.c.lpf-ib dhcp-4.2.4-P2/common/bpf.c
|
||||
--- dhcp-4.2.4-P2/common/bpf.c.lpf-ib 2012-11-30 14:05:07.394394214 +0100
|
||||
+++ dhcp-4.2.4-P2/common/bpf.c 2012-11-30 14:05:07.407394058 +0100
|
||||
@@ -198,11 +198,44 @@ struct bpf_insn dhcp_bpf_filter [] = {
|
||||
BPF_STMT(BPF_RET+BPF_K, 0),
|
||||
};
|
||||
@ -103,9 +103,9 @@ diff -up dhcp-4.2.4/common/bpf.c.lpf-ib dhcp-4.2.4/common/bpf.c
|
||||
#if defined (HAVE_TR_SUPPORT)
|
||||
struct bpf_insn dhcp_bpf_tr_filter [] = {
|
||||
/* accept all token ring packets due to variable length header */
|
||||
diff -up dhcp-4.2.4/common/lpf.c.lpf-ib dhcp-4.2.4/common/lpf.c
|
||||
--- dhcp-4.2.4/common/lpf.c.lpf-ib 2012-07-18 21:08:48.101834991 +0200
|
||||
+++ dhcp-4.2.4/common/lpf.c 2012-07-18 21:10:47.367210799 +0200
|
||||
diff -up dhcp-4.2.4-P2/common/lpf.c.lpf-ib dhcp-4.2.4-P2/common/lpf.c
|
||||
--- dhcp-4.2.4-P2/common/lpf.c.lpf-ib 2012-11-30 14:05:07.394394214 +0100
|
||||
+++ dhcp-4.2.4-P2/common/lpf.c 2012-11-30 14:19:27.211031532 +0100
|
||||
@@ -42,6 +42,7 @@
|
||||
#include "includes/netinet/udp.h"
|
||||
#include "includes/netinet/if_ether.h"
|
||||
@ -394,7 +394,7 @@ diff -up dhcp-4.2.4/common/lpf.c.lpf-ib dhcp-4.2.4/common/lpf.c
|
||||
|
||||
if (strlen(name) >= sizeof(tmp.ifr_name)) {
|
||||
log_fatal("Device name too long: \"%s\"", name);
|
||||
@@ -479,16 +630,44 @@ get_hw_addr(const char *name, struct har
|
||||
@@ -479,16 +630,52 @@ get_hw_addr(const char *name, struct har
|
||||
memset(&tmp, 0, sizeof(tmp));
|
||||
strcpy(tmp.ifr_name, name);
|
||||
if (ioctl(sock, SIOCGIFHWADDR, &tmp) < 0) {
|
||||
@ -402,9 +402,11 @@ diff -up dhcp-4.2.4/common/lpf.c.lpf-ib dhcp-4.2.4/common/lpf.c
|
||||
+ log_fatal("Error getting hardware address for \"%s\": %m",
|
||||
name);
|
||||
}
|
||||
+ close(sock);
|
||||
|
||||
sa = &tmp.ifr_hwaddr;
|
||||
- switch (sa->sa_family) {
|
||||
+ // needs to be freed outside this function
|
||||
+ sll = dmalloc (sizeof (struct sockaddr_ll), MDL);
|
||||
+ if (!sll)
|
||||
+ log_fatal("Unable to allocate memory for link layer address");
|
||||
@ -421,6 +423,7 @@ diff -up dhcp-4.2.4/common/lpf.c.lpf-ib dhcp-4.2.4/common/lpf.c
|
||||
+ struct ifaddrs *ifaddrs = NULL;
|
||||
+ struct ifaddrs *ifa = NULL;
|
||||
+ struct sockaddr_ll *sll = NULL;
|
||||
+ int sll_allocated = 0;
|
||||
+
|
||||
+ if (getifaddrs(&ifaddrs) == -1)
|
||||
+ log_fatal("Failed to get interfaces");
|
||||
@ -431,6 +434,11 @@ diff -up dhcp-4.2.4/common/lpf.c.lpf-ib dhcp-4.2.4/common/lpf.c
|
||||
+ * Fall back to ioctl(SIOCGIFHWADDR).
|
||||
+ */
|
||||
+ sll = ioctl_get_ll(name);
|
||||
+ if (sll != NULL)
|
||||
+ sll_allocated = 1;
|
||||
+ else
|
||||
+ // shouldn't happed
|
||||
+ log_fatal("Unexpected internal error");
|
||||
+ }
|
||||
+
|
||||
+ switch (sll->sll_hatype) {
|
||||
@ -442,7 +450,7 @@ diff -up dhcp-4.2.4/common/lpf.c.lpf-ib dhcp-4.2.4/common/lpf.c
|
||||
break;
|
||||
case ARPHRD_IEEE802:
|
||||
#ifdef ARPHRD_IEEE802_TR
|
||||
@@ -496,18 +675,35 @@ get_hw_addr(const char *name, struct har
|
||||
@@ -496,18 +683,35 @@ get_hw_addr(const char *name, struct har
|
||||
#endif /* ARPHRD_IEEE802_TR */
|
||||
hw->hlen = 7;
|
||||
hw->hbuf[0] = HTYPE_IEEE802;
|
||||
@ -482,7 +490,7 @@ diff -up dhcp-4.2.4/common/lpf.c.lpf-ib dhcp-4.2.4/common/lpf.c
|
||||
hw->hlen = 0;
|
||||
hw->hbuf[0] = HTYPE_RESERVED;
|
||||
/* 0xdeadbeef should never occur on the wire,
|
||||
@@ -520,10 +716,11 @@ get_hw_addr(const char *name, struct har
|
||||
@@ -520,10 +724,13 @@ get_hw_addr(const char *name, struct har
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
@ -494,12 +502,14 @@ diff -up dhcp-4.2.4/common/lpf.c.lpf-ib dhcp-4.2.4/common/lpf.c
|
||||
}
|
||||
|
||||
- close(sock);
|
||||
+ if (sll_allocated)
|
||||
+ dfree(sll, MDL);
|
||||
+ freeifaddrs(ifaddrs);
|
||||
}
|
||||
#endif
|
||||
diff -up dhcp-4.2.4/common/socket.c.lpf-ib dhcp-4.2.4/common/socket.c
|
||||
--- dhcp-4.2.4/common/socket.c.lpf-ib 2012-03-09 12:28:11.000000000 +0100
|
||||
+++ dhcp-4.2.4/common/socket.c 2012-07-18 21:08:48.112834843 +0200
|
||||
diff -up dhcp-4.2.4-P2/common/socket.c.lpf-ib dhcp-4.2.4-P2/common/socket.c
|
||||
--- dhcp-4.2.4-P2/common/socket.c.lpf-ib 2012-08-24 21:11:21.000000000 +0200
|
||||
+++ dhcp-4.2.4-P2/common/socket.c 2012-11-30 14:05:07.408394046 +0100
|
||||
@@ -325,7 +325,7 @@ void if_register_send (info)
|
||||
info->wfdesc = if_register_socket(info, AF_INET, 0);
|
||||
/* If this is a normal IPv4 address, get the hardware address. */
|
||||
@ -527,10 +537,10 @@ diff -up dhcp-4.2.4/common/socket.c.lpf-ib dhcp-4.2.4/common/socket.c
|
||||
|
||||
if (!quiet_interface_discovery) {
|
||||
if (info->shared_network != NULL) {
|
||||
diff -up dhcp-4.2.4/includes/dhcpd.h.lpf-ib dhcp-4.2.4/includes/dhcpd.h
|
||||
--- dhcp-4.2.4/includes/dhcpd.h.lpf-ib 2012-07-18 21:08:48.102834978 +0200
|
||||
+++ dhcp-4.2.4/includes/dhcpd.h 2012-07-18 21:08:48.114834815 +0200
|
||||
@@ -1243,6 +1243,7 @@ struct interface_info {
|
||||
diff -up dhcp-4.2.4-P2/includes/dhcpd.h.lpf-ib dhcp-4.2.4-P2/includes/dhcpd.h
|
||||
--- dhcp-4.2.4-P2/includes/dhcpd.h.lpf-ib 2012-11-30 14:05:07.400394142 +0100
|
||||
+++ dhcp-4.2.4-P2/includes/dhcpd.h 2012-11-30 14:05:07.409394034 +0100
|
||||
@@ -1249,6 +1249,7 @@ struct interface_info {
|
||||
struct shared_network *shared_network;
|
||||
/* Networks connected to this interface. */
|
||||
struct hardware hw_address; /* Its physical address. */
|
||||
@ -538,7 +548,7 @@ diff -up dhcp-4.2.4/includes/dhcpd.h.lpf-ib dhcp-4.2.4/includes/dhcpd.h
|
||||
struct in_addr *addresses; /* Addresses associated with this
|
||||
* interface.
|
||||
*/
|
||||
@@ -2360,7 +2361,7 @@ void print_dns_status (int, struct dhcp_
|
||||
@@ -2368,7 +2369,7 @@ void print_dns_status (int, struct dhcp_
|
||||
#endif
|
||||
const char *print_time(TIME);
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
Summary: Dynamic host configuration protocol software
|
||||
Name: dhcp
|
||||
Version: 4.2.4
|
||||
Release: 22.%{patchver}%{?dist}
|
||||
Release: 23.%{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.
|
||||
@ -562,6 +562,9 @@ fi
|
||||
|
||||
|
||||
%changelog
|
||||
* Fri Nov 30 2012 Jiri Popelka <jpopelka@redhat.com> - 12:4.2.4-23.P2
|
||||
- fix two resource leaks in lpf-ib.patch
|
||||
|
||||
* Mon Nov 26 2012 Jiri Popelka <jpopelka@redhat.com> - 12:4.2.4-22.P2
|
||||
- add After=time-sync.target to dhcpd[6].service (#878293)
|
||||
- remove groff from BuildRequires (no idea why it's been there)
|
||||
|
Loading…
Reference in New Issue
Block a user