dhcp/dhcp-4.2.3-dhclient-decline-onetry.patch
Jiri Popelka f3cba52167 dhclient: Don't retry on DECLINE when -1 option used
Don't build with -D_GNU_SOURCE, configure.ac uses AC_USE_SYSTEM_EXTENSIONS
2011-11-24 17:26:59 +01:00

28 lines
903 B
Diff

diff -up dhcp-4.2.3/client/dhclient.c.decline-onetry dhcp-4.2.3/client/dhclient.c
--- dhcp-4.2.3/client/dhclient.c.decline-onetry 2011-11-24 14:21:50.000000000 +0100
+++ dhcp-4.2.3/client/dhclient.c 2011-11-24 14:23:44.472893215 +0100
@@ -1704,11 +1704,18 @@ void bind_lease (client)
if (script_go (client)) {
make_decline (client, client -> new);
send_decline (client);
- destroy_client_lease (client -> new);
- client -> new = (struct client_lease *)0;
- client -> state = S_DECLINED;
- state_init (client);
- return;
+ if (onetry) {
+ if (!quiet)
+ log_info ("Unable to obtain a lease on first try.%s",
+ " Exiting.");
+ exit (2);
+ } else {
+ destroy_client_lease (client -> new);
+ client -> new = (struct client_lease *)0;
+ client -> state = S_DECLINED;
+ state_init (client);
+ return;
+ }
}
/* Write out the new lease if it has been long enough. */