philipp / rpms / dhcp

Forked from rpms/dhcp 4 years ago
Clone
Blob Blame History Raw
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. */