File 0017-server-no-success-report-before-send.919959.patch of Package dhcp.24175

From ce15607bca2509bc2abd440000d25498ad589e27 Mon Sep 17 00:00:00 2001
From: Marius Tomaschewski <mt@suse.de>
Date: Mon, 14 Sep 2015 15:31:37 +0200
Subject: [PATCH] server: no success report before send (bsc#919959)
References: bsc#919959

---
 server/dhcp.c | 53 ++++++++++++++++++++++++++++++-----------------------
 1 file changed, 30 insertions(+), 23 deletions(-)

diff --git a/server/dhcp.c b/server/dhcp.c
index 0f53ac2..3a610e8 100644
--- a/server/dhcp.c
+++ b/server/dhcp.c
@@ -3643,22 +3643,6 @@ void dhcp_reply (lease)
 	} else
 		s = (char *)0;
 
-	/* Say what we're doing... */
-	log_info ("%s on %s to %s %s%s%svia %s",
-		  (state -> offer
-		   ? (state -> offer == DHCPACK ? "DHCPACK" : "DHCPOFFER")
-		   : "BOOTREPLY"),
-		  piaddr (lease -> ip_addr),
-		  (lease -> hardware_addr.hlen
-		   ? print_hw_addr (lease -> hardware_addr.hbuf [0],
-				    lease -> hardware_addr.hlen - 1,
-				    &lease -> hardware_addr.hbuf [1])
-		   : print_hex_1(lease->uid_len, lease->uid, 60)),
-		  s ? "(" : "", s ? s : "", s ? ") " : "",
-		  (state -> giaddr.s_addr
-		   ? inet_ntoa (state -> giaddr)
-		   : state -> ip -> name));
-
 	/* Set up the hardware address... */
 	hto.hlen = lease -> hardware_addr.hlen;
 	memcpy (hto.hbuf, lease -> hardware_addr.hbuf, hto.hlen);
@@ -3695,12 +3679,13 @@ void dhcp_reply (lease)
 					   "packet over %s interface.", MDL,
 					   packet_length,
 					   fallback_interface->name);
-			}
 
+				free_lease_state (state, MDL);
+				lease -> state = (struct lease_state *)0;
+				return;
+			}
 
-			free_lease_state (state, MDL);
-			lease -> state = (struct lease_state *)0;
-			return;
+			goto report;
 		}
 
 	/* If the client is RENEWING, unicast to the client using the
@@ -3733,11 +3718,13 @@ void dhcp_reply (lease)
 					  " packet over %s interface.", MDL,
 					   packet_length,
 					   fallback_interface->name);
+
+				free_lease_state (state, MDL);
+				lease -> state = (struct lease_state *)0;
+				return;
 			}
 
-			free_lease_state (state, MDL);
-			lease -> state = (struct lease_state *)0;
-			return;
+			goto report;
 		}
 
 	/* If it comes from a client that already knows its address
@@ -3765,8 +3752,28 @@ void dhcp_reply (lease)
 	    log_error ("%s:%d: Failed to send %d byte long "
 		       "packet over %s interface.", MDL,
 		       packet_length, state->ip->name);
+
+	    free_lease_state (state, MDL);
+	    lease -> state = (struct lease_state *)0;
+	    return;
 	}
 
+report:
+	/* Say what we're doing... */
+	log_info ("%s on %s to %s %s%s%svia %s",
+		  (state -> offer
+		   ? (state -> offer == DHCPACK ? "DHCPACK" : "DHCPOFFER")
+		   : "BOOTREPLY"),
+		  piaddr (lease -> ip_addr),
+		  (lease -> hardware_addr.hlen
+		   ? print_hw_addr (lease -> hardware_addr.hbuf [0],
+				    lease -> hardware_addr.hlen - 1,
+				    &lease -> hardware_addr.hbuf [1])
+		   : print_hex_1(lease->uid_len, lease->uid, 60)),
+		  s ? "(" : "", s ? s : "", s ? ") " : "",
+		  (state -> giaddr.s_addr
+		   ? inet_ntoa (state -> giaddr)
+		   : state -> ip -> name));
 
 	/* Free all of the entries in the option_state structure
 	   now that we're done with them. */
-- 
2.1.4

openSUSE Build Service is sponsored by