2010-01-20 17:07:47 +00:00
|
|
|
diff -up dhcp-4.1.1/client/dhclient.c.backoff dhcp-4.1.1/client/dhclient.c
|
|
|
|
--- dhcp-4.1.1/client/dhclient.c.backoff 2010-01-20 17:14:37.000000000 +0100
|
|
|
|
+++ dhcp-4.1.1/client/dhclient.c 2010-01-20 17:14:37.000000000 +0100
|
|
|
|
@@ -1187,6 +1187,7 @@ void state_init (cpp)
|
2008-01-11 00:19:03 +00:00
|
|
|
void *cpp;
|
|
|
|
{
|
|
|
|
struct client_state *client = cpp;
|
|
|
|
+ enum dhcp_state init_state = client->state;
|
|
|
|
|
|
|
|
ASSERT_STATE(state, S_INIT);
|
|
|
|
|
2010-01-20 17:07:47 +00:00
|
|
|
@@ -1199,9 +1200,16 @@ void state_init (cpp)
|
2008-01-11 00:19:03 +00:00
|
|
|
client -> first_sending = cur_time;
|
|
|
|
client -> interval = client -> config -> initial_interval;
|
|
|
|
|
|
|
|
- /* Add an immediate timeout to cause the first DHCPDISCOVER packet
|
|
|
|
- to go out. */
|
|
|
|
- send_discover (client);
|
|
|
|
+ if (init_state != S_DECLINED) {
|
|
|
|
+ /* Add an immediate timeout to cause the first DHCPDISCOVER packet
|
|
|
|
+ to go out. */
|
|
|
|
+ send_discover(client);
|
|
|
|
+ } else {
|
|
|
|
+ /* We've received an OFFER and it has been DECLINEd by dhclient-script.
|
|
|
|
+ * wait for a random time between 1 and backoff_cutoff seconds before
|
|
|
|
+ * trying again. */
|
|
|
|
+ add_timeout(cur_time + ((1 + (random() >> 2)) % client->config->backoff_cutoff), send_discover, client, 0, 0);
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
|
2009-01-06 23:50:29 +00:00
|
|
|
/*
|
2010-01-20 17:07:47 +00:00
|
|
|
@@ -1480,6 +1488,7 @@ void bind_lease (client)
|
2008-01-11 00:19:03 +00:00
|
|
|
send_decline (client);
|
|
|
|
destroy_client_lease (client -> new);
|
|
|
|
client -> new = (struct client_lease *)0;
|
|
|
|
+ client -> state = S_DECLINED;
|
|
|
|
state_init (client);
|
|
|
|
return;
|
|
|
|
}
|
2010-01-20 17:07:47 +00:00
|
|
|
@@ -3689,6 +3698,7 @@ void client_location_changed ()
|
2008-01-11 00:19:03 +00:00
|
|
|
case S_INIT:
|
|
|
|
case S_REBINDING:
|
|
|
|
case S_STOPPED:
|
|
|
|
+ case S_DECLINED:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
client -> state = S_INIT;
|
2010-01-20 17:07:47 +00:00
|
|
|
diff -up dhcp-4.1.1/includes/dhcpd.h.backoff dhcp-4.1.1/includes/dhcpd.h
|
|
|
|
--- dhcp-4.1.1/includes/dhcpd.h.backoff 2010-01-20 17:14:37.000000000 +0100
|
|
|
|
+++ dhcp-4.1.1/includes/dhcpd.h 2010-01-20 17:14:37.000000000 +0100
|
|
|
|
@@ -1017,7 +1017,8 @@ enum dhcp_state {
|
2008-01-11 00:19:03 +00:00
|
|
|
S_BOUND = 5,
|
|
|
|
S_RENEWING = 6,
|
|
|
|
S_REBINDING = 7,
|
|
|
|
- S_STOPPED = 8
|
|
|
|
+ S_STOPPED = 8,
|
|
|
|
+ S_DECLINED = 9
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Authentication and BOOTP policy possibilities (not all values work
|