File dhcp-4.1.1-P1-relay-no-ip-on-interface.diff of Package dhcp.import5532

From 4509d956715297469469ab0e207c2641f521470d Mon Sep 17 00:00:00 2001
From: Marius Tomaschewski <mt@suse.de>
Date: Fri, 29 Oct 2010 18:49:06 +0200
Subject: [PATCH] dhcp-4.1.1-P1-relay-no-ip-on-interface

Fix for a dhcrelay segfault while receiving packets on interfaces
without any IPv4 address assigned (bnc#631305, [ISC-Bugs #22409]).

Signed-off-by: Marius Tomaschewski <mt@suse.de>
---
 relay/dhcrelay.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/relay/dhcrelay.c b/relay/dhcrelay.c
index 11676ae..c375c83 100644
--- a/relay/dhcrelay.c
+++ b/relay/dhcrelay.c
@@ -565,6 +565,10 @@ do_relay4(struct interface_info *ip, struct dhcp_packet *packet,
 		log_info("Discarding packet with invalid hlen.");
 		return;
 	}
+	if (ip->address_count < 1 || ip->addresses == NULL) {
+		log_info("Discarding packet from interface without IP address");
+		return;
+	}
 
 	/* Find the interface that corresponds to the giaddr
 	   in the packet. */
-- 
1.7.1
openSUSE Build Service is sponsored by