SHA256
1
0
forked from pool/dhcp

- Applied fix by Jiri Slaby to not crash in interface discovery

when the interface address is NULL, which has been introduced
  by the infiniband support patch (bsc#909189,bsc#870535).
  [+ 0027-dhcp-4.2.x-handle-ifa_addr-NULL.909189.patch]
- Reverted previous commit

OBS-URL: https://build.opensuse.org/package/show/network:dhcp/dhcp?expand=0&rev=143
This commit is contained in:
Marius Tomaschewski 2014-12-10 13:24:44 +00:00 committed by Git OBS Bridge
parent 71bbe2c027
commit 68ca1863f7
4 changed files with 75 additions and 42 deletions

View File

@ -5,17 +5,17 @@ Subject: [PATCH 1/2] dhcp 4.2.6 lpf ip over ib support
---
client/dhclient.c | 31 +++++++
common/bpf.c | 33 +++++++
common/lpf.c | 239 ++++++++++++++++++++++++++++++++++++++++++++----------
common/socket.c | 8 -
includes/dhcpd.h | 3
5 files changed, 269 insertions(+), 45 deletions(-)
common/bpf.c | 33 ++++++++
common/lpf.c | 236 +++++++++++++++++++++++++++++++++++++++++++++---------
common/socket.c | 8 +-
includes/dhcpd.h | 3 +-
5 files changed, 266 insertions(+), 45 deletions(-)
Index: dhcp-4.2.6/client/dhclient.c
===================================================================
--- dhcp-4.2.6.orig/client/dhclient.c 2014-12-10 13:24:48.679081338 +0100
+++ dhcp-4.2.6/client/dhclient.c 2014-12-10 13:25:34.226013202 +0100
@@ -100,6 +100,29 @@ static int check_domain_name_list(const
diff --git a/client/dhclient.c b/client/dhclient.c
index 8af0a42..f7dfbef 100644
--- a/client/dhclient.c
+++ b/client/dhclient.c
@@ -100,6 +100,29 @@ static int check_domain_name_list(const char *ptr, size_t len, int dots);
static int check_option_values(struct universe *universe, unsigned int opt,
const char *ptr, size_t len);
@ -60,10 +60,10 @@ Index: dhcp-4.2.6/client/dhclient.c
/* Start a configuration state machine for each interface. */
#ifdef DHCPv6
if (local_family == AF_INET6) {
Index: dhcp-4.2.6/common/bpf.c
===================================================================
--- dhcp-4.2.6.orig/common/bpf.c 2014-12-10 13:24:48.664081690 +0100
+++ dhcp-4.2.6/common/bpf.c 2014-12-10 13:24:48.703080775 +0100
diff --git a/common/bpf.c b/common/bpf.c
index 076d9bc..124281b 100644
--- a/common/bpf.c
+++ b/common/bpf.c
@@ -198,11 +198,44 @@ struct bpf_insn dhcp_bpf_filter [] = {
BPF_STMT(BPF_RET+BPF_K, 0),
};
@ -109,10 +109,10 @@ Index: dhcp-4.2.6/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 */
Index: dhcp-4.2.6/common/lpf.c
===================================================================
--- dhcp-4.2.6.orig/common/lpf.c 2014-12-10 13:24:48.647082088 +0100
+++ dhcp-4.2.6/common/lpf.c 2014-12-10 13:27:33.789208756 +0100
diff --git a/common/lpf.c b/common/lpf.c
index 6639809..a428870 100644
--- a/common/lpf.c
+++ b/common/lpf.c
@@ -43,6 +43,7 @@
#include "includes/netinet/udp.h"
#include "includes/netinet/if_ether.h"
@ -299,7 +299,7 @@ Index: dhcp-4.2.6/common/lpf.c
ssize_t send_packet (interface, packet, raw, len, from, to, hto)
struct interface_info *interface;
struct packet *packet;
@@ -335,6 +420,11 @@ ssize_t send_packet (interface, packet,
@@ -335,6 +420,11 @@ ssize_t send_packet (interface, packet, raw, len, from, to, hto)
return send_fallback (interface, packet, raw,
len, from, to, hto);
@ -311,7 +311,7 @@ Index: dhcp-4.2.6/common/lpf.c
if (hto == NULL && interface->anycast_mac_addr.hlen)
hto = &interface->anycast_mac_addr;
@@ -356,6 +446,42 @@ ssize_t send_packet (interface, packet,
@@ -356,6 +446,42 @@ ssize_t send_packet (interface, packet, raw, len, from, to, hto)
#endif /* USE_LPF_SEND */
#ifdef USE_LPF_RECEIVE
@ -354,7 +354,7 @@ Index: dhcp-4.2.6/common/lpf.c
ssize_t receive_packet (interface, buf, len, from, hfrom)
struct interface_info *interface;
unsigned char *buf;
@@ -382,6 +508,10 @@ ssize_t receive_packet (interface, buf,
@@ -382,6 +508,10 @@ ssize_t receive_packet (interface, buf, len, from, hfrom)
};
struct cmsghdr *cmsg;
@ -365,7 +365,7 @@ Index: dhcp-4.2.6/common/lpf.c
length = recvmsg (interface -> rfdesc, &msg, 0);
if (length <= 0)
return length;
@@ -462,33 +592,44 @@ void maybe_setup_fallback ()
@@ -462,33 +592,41 @@ void maybe_setup_fallback ()
}
void
@ -386,14 +386,11 @@ Index: dhcp-4.2.6/common/lpf.c
- }
+ if (getifaddrs(&ifaddrs) == -1)
+ log_fatal("Failed to get interfaces");
+
+ for (ifa = ifaddrs; ifa != NULL; ifa = ifa->ifa_next) {
- sock = socket(AF_INET, SOCK_DGRAM, 0);
- if (sock < 0) {
- log_fatal("Can't create socket for \"%s\": %m", name);
+ if (!ifa->ifa_addr)
+ continue;
+ for (ifa = ifaddrs; ifa != NULL; ifa = ifa->ifa_next) {
+
+ if (ifa->ifa_addr->sa_family != AF_PACKET)
+ continue;
@ -428,7 +425,7 @@ Index: dhcp-4.2.6/common/lpf.c
break;
case ARPHRD_IEEE802:
#ifdef ARPHRD_IEEE802_TR
@@ -496,18 +637,36 @@ get_hw_addr(const char *name, struct har
@@ -496,18 +634,36 @@ get_hw_addr(const char *name, struct hardware *hw) {
#endif /* ARPHRD_IEEE802_TR */
hw->hlen = 7;
hw->hbuf[0] = HTYPE_IEEE802;
@ -469,10 +466,10 @@ Index: dhcp-4.2.6/common/lpf.c
+ freeifaddrs(ifaddrs);
}
#endif
Index: dhcp-4.2.6/common/socket.c
===================================================================
--- dhcp-4.2.6.orig/common/socket.c 2014-01-31 20:35:09.000000000 +0100
+++ dhcp-4.2.6/common/socket.c 2014-12-10 13:24:48.703080775 +0100
diff --git a/common/socket.c b/common/socket.c
index e111d82..04c86e3 100644
--- a/common/socket.c
+++ b/common/socket.c
@@ -322,7 +322,7 @@ void if_register_send (info)
info->wfdesc = if_register_socket(info, AF_INET, 0, NULL);
/* If this is a normal IPv4 address, get the hardware address. */
@ -491,7 +488,7 @@ Index: dhcp-4.2.6/common/socket.c
if (!quiet_interface_discovery)
log_info ("Listening on Socket/%s%s%s",
@@ -499,7 +499,7 @@ if_register6(struct interface_info *info
@@ -499,7 +499,7 @@ if_register6(struct interface_info *info, int do_multicast) {
if (req_multi)
if_register_multicast(info);
@ -500,7 +497,7 @@ Index: dhcp-4.2.6/common/socket.c
if (!quiet_interface_discovery) {
if (info->shared_network != NULL) {
@@ -555,7 +555,7 @@ if_register_linklocal6(struct interface_
@@ -555,7 +555,7 @@ if_register_linklocal6(struct interface_info *info) {
info->rfdesc = sock;
info->wfdesc = sock;
@ -509,10 +506,10 @@ Index: dhcp-4.2.6/common/socket.c
if (!quiet_interface_discovery) {
if (info->shared_network != NULL) {
Index: dhcp-4.2.6/includes/dhcpd.h
===================================================================
--- dhcp-4.2.6.orig/includes/dhcpd.h 2014-12-10 13:24:48.648082065 +0100
+++ dhcp-4.2.6/includes/dhcpd.h 2014-12-10 13:25:34.042017517 +0100
diff --git a/includes/dhcpd.h b/includes/dhcpd.h
index 68262e9..a52992b 100644
--- a/includes/dhcpd.h
+++ b/includes/dhcpd.h
@@ -1217,6 +1217,7 @@ struct interface_info {
struct shared_network *shared_network;
/* Networks connected to this interface. */
@ -521,7 +518,7 @@ Index: dhcp-4.2.6/includes/dhcpd.h
struct in_addr *addresses; /* Addresses associated with this
* interface.
*/
@@ -2346,7 +2347,7 @@ void print_dns_status (int, struct dhcp_
@@ -2346,7 +2347,7 @@ void print_dns_status (int, struct dhcp_ddns_cb *, isc_result_t);
#endif
const char *print_time(TIME);
@ -530,3 +527,6 @@ Index: dhcp-4.2.6/includes/dhcpd.h
/* socket.c */
#if defined (USE_SOCKET_SEND) || defined (USE_SOCKET_RECEIVE) \
--
1.7.12.4

View File

@ -0,0 +1,28 @@
From 17e0eabe7700d02b48ed8b0a923427caad3b7b4b Mon Sep 17 00:00:00 2001
From: Jiri Slaby <jslaby@suse.cz>
Date: Wed, 10 Dec 2014 13:48:03 +0100
Subject: [PATCH] dhcp-4.2.x-handle-ifa_addr-NULL.909189
References: bsc#909189,bnc#870535
Fix to not crash in interface discovery when the interface
address is NULL. Bug has been introduced by the infiniband
support patch (bsc#870535).
diff --git a/common/lpf.c b/common/lpf.c
index 9dc6053..892ccce 100644
--- a/common/lpf.c
+++ b/common/lpf.c
@@ -605,6 +605,9 @@ get_hw_addr(struct interface_info *info)
for (ifa = ifaddrs; ifa != NULL; ifa = ifa->ifa_next) {
+ if (!ifa->ifa_addr)
+ continue;
+
if (ifa->ifa_addr->sa_family != AF_PACKET)
continue;
--
2.2.0

View File

@ -1,8 +1,10 @@
-------------------------------------------------------------------
Wed Dec 10 13:29:38 CET 2014 - pth@suse.de
Wed Dec 10 12:52:03 UTC 2014 - mt@suse.de
- Modify 0017-dhcp-4.2.6-lpf-ip-over-ib-support.patch as detailed
in bnc#870535 instead of adding yet another patch.
- Applied fix by Jiri Slaby to not crash in interface discovery
when the interface address is NULL, which has been introduced
by the infiniband support patch (bsc#909189,bsc#870535).
[+ 0027-dhcp-4.2.x-handle-ifa_addr-NULL.909189.patch]
-------------------------------------------------------------------
Thu Nov 20 11:43:07 UTC 2014 - mt@suse.de

View File

@ -132,6 +132,8 @@ Patch24: 0024-dhcp-4.2.x-dhcpv6-decline-on-DAD-failure.872609.patch
Patch25: 0025-dhcp-4.2.x-dhcpv6-retransmission-until-MRD.872609.patch
# PATCH-FIX-SLE dhcp-4.2.x-disable-unused-ddns-port-in-server bnc#891655
Patch26: 0026-dhcp-4.2.x-disable-unused-ddns-port-in-server.891655.patch
# PATCH-FIX-SLE dhcp-4.2.x-handle-ifa_addr-NULL bsc#909189
Patch27: 0027-dhcp-4.2.x-handle-ifa_addr-NULL.909189.patch
##
PreReq: /bin/touch /sbin/chkconfig sysconfig
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@ -273,6 +275,7 @@ Authors:
%patch24 -p1
%patch25 -p1
%patch26 -p1
%patch27 -p1
##
find . -type f -name \*.cat\* -exec rm -f {} \;
dos2unix contrib/ms2isc/*