4f14cb7
diff -up dhcp-4.0.0//client/dhclient.c.backoff dhcp-4.0.0//client/dhclient.c
4f14cb7
--- dhcp-4.0.0//client/dhclient.c.backoff	2008-08-01 10:09:17.000000000 -1000
4f14cb7
+++ dhcp-4.0.0//client/dhclient.c	2008-08-01 10:10:10.000000000 -1000
4f14cb7
@@ -1003,6 +1003,7 @@ void state_init (cpp)
8273327
 	void *cpp;
8273327
 {
8273327
 	struct client_state *client = cpp;
8273327
+	enum dhcp_state init_state = client->state;
8273327
 
8273327
 	ASSERT_STATE(state, S_INIT);
8273327
 
4f14cb7
@@ -1015,9 +1016,16 @@ void state_init (cpp)
8273327
 	client -> first_sending = cur_time;
8273327
 	client -> interval = client -> config -> initial_interval;
8273327
 
8273327
-	/* Add an immediate timeout to cause the first DHCPDISCOVER packet
8273327
-	   to go out. */
8273327
-	send_discover (client);
8273327
+	if (init_state != S_DECLINED) {
8273327
+		/* Add an immediate timeout to cause the first DHCPDISCOVER packet
8273327
+		   to go out. */
8273327
+		send_discover(client);
8273327
+	} else {
8273327
+		/* We've received an OFFER and it has been DECLINEd by dhclient-script.
8273327
+		 * wait for a random time between 1 and backoff_cutoff seconds before
8273327
+		 * trying again. */
8273327
+		add_timeout(cur_time + ((1 + (random() >> 2)) %  client->config->backoff_cutoff), send_discover, client, 0, 0);
8273327
+	}
8273327
 }
8273327
 
8273327
 /* state_selecting is called when one or more DHCPOFFER packets have been
4f14cb7
@@ -1284,6 +1292,7 @@ void bind_lease (client)
8273327
 		send_decline (client);
8273327
 		destroy_client_lease (client -> new);
8273327
 		client -> new = (struct client_lease *)0;
8273327
+		client -> state = S_DECLINED;
8273327
 		state_init (client);
8273327
 		return;
8273327
 	}
4f14cb7
@@ -3439,6 +3448,7 @@ void client_location_changed ()
8273327
 			      case S_INIT:
8273327
 			      case S_REBINDING:
8273327
 			      case S_STOPPED:
8273327
+			      case S_DECLINED:
8273327
 				break;
8273327
 			}
8273327
 			client -> state = S_INIT;
4f14cb7
diff -up dhcp-4.0.0//includes/dhcpd.h.backoff dhcp-4.0.0//includes/dhcpd.h
4f14cb7
--- dhcp-4.0.0//includes/dhcpd.h.backoff	2008-08-01 10:09:01.000000000 -1000
4f14cb7
+++ dhcp-4.0.0//includes/dhcpd.h	2008-08-01 10:10:10.000000000 -1000
4f14cb7
@@ -992,7 +992,8 @@ enum dhcp_state {
8273327
 	S_BOUND = 5,
8273327
 	S_RENEWING = 6,
8273327
 	S_REBINDING = 7,
8273327
-	S_STOPPED = 8
8273327
+	S_STOPPED = 8,
8273327
+	S_DECLINED = 9
8273327
 };
8273327
 
8273327
 /* Authentication and BOOTP policy possibilities (not all values work