]> git.pld-linux.org Git - packages/dhcp.git/blob - dhcp-dhclient-decline-backoff.patch
- patch no-ipv6 - don't require ipv6 support in kernel
[packages/dhcp.git] / dhcp-dhclient-decline-backoff.patch
1 --- dhcp-3.0.5/client/dhclient.c.decline        2007-03-30 15:29:58.000000000 -0400
2 +++ dhcp-3.0.5/client/dhclient.c        2007-03-30 15:50:25.000000000 -0400
3 @@ -934,6 +934,7 @@
4         void *cpp;
5  {
6         struct client_state *client = cpp;
7 +       enum dhcp_state init_state = client->state;
8  
9         ASSERT_STATE(state, S_INIT);
10  
11 @@ -946,9 +947,16 @@
12         client -> first_sending = cur_time;
13         client -> interval = client -> config -> initial_interval;
14  
15 -       /* Add an immediate timeout to cause the first DHCPDISCOVER packet
16 -          to go out. */
17 -       send_discover (client);
18 +       if (init_state != S_DECLINED) {
19 +               /* Add an immediate timeout to cause the first DHCPDISCOVER packet
20 +                  to go out. */
21 +               send_discover(client);
22 +       } else {
23 +               /* We've received an OFFER and it has been DECLINEd by dhclient-script.
24 +                * wait for a random time between 1 and backoff_cutoff seconds before
25 +                * trying again. */
26 +               add_timeout(cur_time + ((1 + (random() >> 2)) %  client->config->backoff_cutoff), send_discover, client, 0, 0);
27 +       }
28  }
29  
30  /* state_selecting is called when one or more DHCPOFFER packets have been
31 @@ -1215,6 +1223,7 @@
32                 send_decline (client);
33                 destroy_client_lease (client -> new);
34                 client -> new = (struct client_lease *)0;
35 +               client -> state = S_DECLINED;
36                 state_init (client);
37                 return;
38         }
39 @@ -3183,6 +3192,7 @@
40                               case S_INIT:
41                               case S_REBINDING:
42                               case S_STOPPED:
43 +                             case S_DECLINED:
44                                 break;
45                         }
46                         client -> state = S_INIT;
47 --- dhcp-3.0.5/includes/dhcpd.h.decline 2007-03-30 15:30:14.000000000 -0400
48 +++ dhcp-3.0.5/includes/dhcpd.h 2007-03-30 15:50:53.000000000 -0400
49 @@ -704,7 +704,8 @@
50         S_BOUND = 5,
51         S_RENEWING = 6,
52         S_REBINDING = 7,
53 -       S_STOPPED = 8
54 +       S_STOPPED = 8,
55 +       S_DECLINED = 9
56  };
57  
58  /* Authentication and BOOTP policy possibilities (not all values work
This page took 0.033872 seconds and 3 git commands to generate.