philipp / rpms / dhcp

Forked from rpms/dhcp 4 years ago
Clone

Blame SOURCES/dhcp-4.2.3-dhclient-decline-onetry.patch

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