From: Peter Miller <millerp@canb.auug.org.au>
Subject: Show offered/requested client IP in log, for better debugging.
Bug-Ubuntu: https://launchpad.net/bugs/35265
Bug-Debian: http://bugs.debian.org/486611

Index: isc-dhcp/client/dhclient.c
===================================================================
--- isc-dhcp.orig/client/dhclient.c	2012-06-22 15:04:05.774627714 -0400
+++ isc-dhcp/client/dhclient.c	2012-06-22 15:04:12.774627908 -0400
@@ -1023,6 +1023,7 @@
 	struct interface_info *ip = packet -> interface;
 	struct client_state *client;
 	struct client_lease *lease;
+	char *leasestr;
 	struct option_cache *oc;
 	struct data_string ds;
 
@@ -1053,13 +1054,16 @@
 		return;
 	}
 
-	log_info ("DHCPACK from %s", piaddr (packet -> client_addr));
-
 	lease = packet_to_lease (packet, client);
 	if (!lease) {
+		log_info ("DHCPACK from %s", piaddr (packet -> client_addr));
 		log_info ("packet_to_lease failed.");
 		return;
 	}
+	leasestr = strdup (piaddr (lease -> address));
+	log_info ("DHCPACK of %s from %s", leasestr,
+		  piaddr (packet -> client_addr));
+	free (leasestr);
 
 	client -> new = lease;
 
@@ -1484,6 +1488,7 @@
 	struct interface_info *ip = packet -> interface;
 	struct client_state *client;
 	struct client_lease *lease, *lp;
+	char *leasestr;
 	struct option **req;
 	int i;
 	int stop_selecting;
@@ -1562,6 +1567,10 @@
 		log_info ("%s: packet_to_lease failed.", obuf);
 		return;
 	}
+	leasestr = strdup (piaddr (lease -> address));
+	sprintf (obuf, "%s of %s from %s", name, leasestr,
+		 piaddr (packet -> client_addr));
+	free (leasestr);
 
 	/* If this lease was acquired through a BOOTREPLY, record that
 	   fact. */
@@ -2172,7 +2181,10 @@
 			client -> packet.secs = htons (65535);
 	}
 
-	log_info ("DHCPREQUEST on %s to %s port %d",
+	log_info ("DHCPREQUEST of %s on %s to %s port %d", 
+              piaddr ((client -> state == S_BOUND || client -> state ==
+		       S_RENEWING || client -> state == S_REBINDING) ?
+		       client -> active -> address : client -> requested_address),
 	      client -> name ? client -> name : client -> interface -> name,
 	      inet_ntoa (destination.sin_addr),
 	      ntohs (destination.sin_port));
