d3e04d
diff -up dhcp-4.1.1/client/dhclient.c.inherit dhcp-4.1.1/client/dhclient.c
d3e04d
--- dhcp-4.1.1/client/dhclient.c.inherit	2010-01-20 17:22:34.000000000 +0100
d3e04d
+++ dhcp-4.1.1/client/dhclient.c	2010-01-20 17:22:34.000000000 +0100
d3e04d
@@ -2301,6 +2301,7 @@ void send_request (cpp)
929b2c
 {
929b2c
 	struct client_state *client = cpp;
929b2c
 
929b2c
+	int i;
929b2c
 	int result;
929b2c
 	int interval;
929b2c
 	struct sockaddr_in destination;
d3e04d
@@ -2360,6 +2361,22 @@ void send_request (cpp)
4f14cb
 		/* Now do a preinit on the interface so that we can
4f14cb
 		   discover a new address. */
4f14cb
 		script_init (client, "PREINIT", (struct string_list *)0);
929b2c
+
4f14cb
+		/* Has an active lease */
929b2c
+		if (client -> interface -> addresses != NULL) {
929b2c
+			for (i = 0; i < client -> interface -> address_count; i++) {
929b2c
+				if (client -> active &&
929b2c
+				    client -> active -> is_bootp &&
929b2c
+				    client -> active -> expiry > cur_time &&
929b2c
+				    client -> interface -> addresses[i].s_addr != 0 &&
929b2c
+				    client -> active -> address.len == 4 &&
929b2c
+				    memcpy (client -> active -> address.iabuf, &(client -> interface -> addresses[i]), 4) == 0) {
929b2c
+					client_envadd (client, "", "keep_old_ip", "%s", "yes");
929b2c
+					break;
929b2c
+				}
929b2c
+			}
929b2c
+		}
929b2c
+
4f14cb
 		if (client -> alias)
4f14cb
 			script_write_params (client, "alias_",
4f14cb
 					     client -> alias);