Blame SOURCES/dhcp-dhclient-decline-backoff.patch

324fcf
diff -up dhcp-4.3.4/client/dhclient.c.backoff dhcp-4.3.4/client/dhclient.c
324fcf
--- dhcp-4.3.4/client/dhclient.c.backoff	2016-04-29 12:16:26.976245611 +0200
324fcf
+++ dhcp-4.3.4/client/dhclient.c	2016-04-29 12:16:26.979245609 +0200
324fcf
@@ -1423,6 +1423,8 @@ void state_init (cpp)
324fcf
 	void *cpp;
324fcf
 {
324fcf
 	struct client_state *client = cpp;
324fcf
+	enum dhcp_state init_state = client->state;
324fcf
+	struct timeval tv;
324fcf
 
324fcf
 	ASSERT_STATE(state, S_INIT);
324fcf
 
324fcf
@@ -1435,9 +1437,18 @@ void state_init (cpp)
324fcf
 	client -> first_sending = cur_time;
324fcf
 	client -> interval = client -> config -> initial_interval;
324fcf
 
324fcf
-	/* Add an immediate timeout to cause the first DHCPDISCOVER packet
324fcf
-	   to go out. */
324fcf
-	send_discover (client);
324fcf
+	if (init_state != S_DECLINED) {
324fcf
+		/* Add an immediate timeout to cause the first DHCPDISCOVER packet
324fcf
+		   to go out. */
324fcf
+		send_discover(client);
324fcf
+	} else {
324fcf
+		/* We've received an OFFER and it has been DECLINEd by dhclient-script.
324fcf
+		 * wait for a random time between 1 and backoff_cutoff seconds before
324fcf
+		 * trying again. */
324fcf
+		tv . tv_sec = cur_time + ((1 + (random() >> 2)) %  client->config->backoff_cutoff);
324fcf
+		tv . tv_usec = 0;
324fcf
+		add_timeout(&tv, send_discover, client, 0, 0);
324fcf
+	}
324fcf
 }
324fcf
 
324fcf
 /*
324fcf
@@ -1734,5 +1745,6 @@ void bind_lease (client)
324fcf
#endif
324fcf
 			exit(2);
324fcf
 		} else {
324fcf
+			client -> state = S_DECLINED;
324fcf
 			state_init(client);
324fcf
 			return;
324fcf
 		}
324fcf
@@ -4626,6 +4638,7 @@ void client_location_changed ()
324fcf
 			      case S_INIT:
324fcf
 			      case S_REBINDING:
324fcf
 			      case S_STOPPED:
324fcf
+			      case S_DECLINED:
324fcf
 				break;
324fcf
 			}
324fcf
 			client -> state = S_INIT;
324fcf
diff -up dhcp-4.3.4/includes/dhcpd.h.backoff dhcp-4.3.4/includes/dhcpd.h
324fcf
--- dhcp-4.3.4/includes/dhcpd.h.backoff	2016-04-29 12:16:26.980245609 +0200
324fcf
+++ dhcp-4.3.4/includes/dhcpd.h	2016-04-29 12:17:30.893203533 +0200
324fcf
@@ -1171,7 +1171,8 @@ enum dhcp_state {
324fcf
 	S_BOUND = 5,
324fcf
 	S_RENEWING = 6,
324fcf
 	S_REBINDING = 7,
324fcf
-	S_STOPPED = 8
324fcf
+	S_STOPPED = 8,
324fcf
+	S_DECLINED = 9
324fcf
 };
324fcf
 
324fcf
 /* Possible pending client operations. */