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

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