7b69e5
diff -up dhcp-4.3.1b1/client/dhclient.c.JwFUZj dhcp-4.3.1b1/client/dhclient.c
7b69e5
--- dhcp-4.3.1b1/client/dhclient.c.JwFUZj	2014-07-10 17:38:50.511265091 +0200
7b69e5
+++ dhcp-4.3.1b1/client/dhclient.c	2014-07-10 17:39:16.164901267 +0200
7b69e5
@@ -1281,6 +1281,8 @@ void state_init (cpp)
db449e
 	void *cpp;
db449e
 {
db449e
 	struct client_state *client = cpp;
db449e
+	enum dhcp_state init_state = client->state;
465f75
+	struct timeval tv;
db449e
 
db449e
 	ASSERT_STATE(state, S_INIT);
db449e
 
7b69e5
@@ -1293,9 +1295,18 @@ void state_init (cpp)
db449e
 	client -> first_sending = cur_time;
db449e
 	client -> interval = client -> config -> initial_interval;
db449e
 
db449e
-	/* Add an immediate timeout to cause the first DHCPDISCOVER packet
db449e
-	   to go out. */
db449e
-	send_discover (client);
db449e
+	if (init_state != S_DECLINED) {
db449e
+		/* Add an immediate timeout to cause the first DHCPDISCOVER packet
db449e
+		   to go out. */
db449e
+		send_discover(client);
db449e
+	} else {
db449e
+		/* We've received an OFFER and it has been DECLINEd by dhclient-script.
db449e
+		 * wait for a random time between 1 and backoff_cutoff seconds before
db449e
+		 * trying again. */
465f75
+		tv . tv_sec = cur_time + ((1 + (random() >> 2)) %  client->config->backoff_cutoff);
465f75
+		tv . tv_usec = 0;
465f75
+		add_timeout(&tv, send_discover, client, 0, 0);
db449e
+	}
db449e
 }
db449e
 
4bf24c
 /*
7b69e5
@@ -1592,6 +1603,7 @@ void bind_lease (client)
7b69e5
 					 "try (declined).  Exiting.");
7b69e5
 			exit(2);
7b69e5
 		} else {
7b69e5
+			client -> state = S_DECLINED;
7b69e5
 			state_init(client);
7b69e5
 			return;
7b69e5
 		}
7b69e5
@@ -4059,6 +4071,7 @@ void client_location_changed ()
db449e
 			      case S_INIT:
db449e
 			      case S_REBINDING:
db449e
 			      case S_STOPPED:
db449e
+			      case S_DECLINED:
db449e
 				break;
db449e
 			}
db449e
 			client -> state = S_INIT;
7b69e5
diff -up dhcp-4.3.1b1/includes/dhcpd.h.JwFUZj dhcp-4.3.1b1/includes/dhcpd.h
7b69e5
--- dhcp-4.3.1b1/includes/dhcpd.h.JwFUZj	2014-07-10 17:38:26.941599360 +0200
7b69e5
+++ dhcp-4.3.1b1/includes/dhcpd.h	2014-07-10 17:38:50.526264878 +0200
7b69e5
@@ -1087,7 +1087,8 @@ enum dhcp_state {
db449e
 	S_BOUND = 5,
db449e
 	S_RENEWING = 6,
db449e
 	S_REBINDING = 7,
db449e
-	S_STOPPED = 8
db449e
+	S_STOPPED = 8,
db449e
+	S_DECLINED = 9
db449e
 };
db449e
 
db449e
 /* Authentication and BOOTP policy possibilities (not all values work