Blob Blame History Raw
diff -up dhcp-4.3.0a1/client/dhclient.c.next-server dhcp-4.3.0a1/client/dhclient.c
--- dhcp-4.3.0a1/client/dhclient.c.next-server	2013-12-20 13:57:06.458349572 +0100
+++ dhcp-4.3.0a1/client/dhclient.c	2013-12-20 13:57:06.500348986 +0100
@@ -1486,7 +1486,7 @@ void state_selecting (cpp)
 		client -> state = S_REQUESTING;
 
 		/* Bind to the address we received. */
-		bind_lease (client);
+		bind_lease (client, NULL);
 		return;
 	}
 
@@ -1676,11 +1676,12 @@ void dhcpack (packet)
 	if (client -> new -> rebind < cur_time)
 		client -> new -> rebind = TIME_MAX;
 
-	bind_lease (client);
+	bind_lease (client, &packet -> raw -> siaddr);
 }
 
-void bind_lease (client)
+void bind_lease (client, siaddr)
 	struct client_state *client;
+	struct in_addr *siaddr;
 {
 	struct timeval tv;
 
@@ -1702,6 +1703,13 @@ void bind_lease (client)
 	if (client -> alias)
 		script_write_params (client, "alias_", client -> alias);
 
+	if (siaddr) {
+		char buf[INET_ADDRSTRLEN];
+
+		if (inet_ntop (AF_INET, (void *) siaddr, buf, sizeof (buf)))
+			client_envadd (client, "new_", "next_server", "%s", buf);
+	}
+
 	/* If the BOUND/RENEW code detects another machine using the
 	   offered address, it exits nonzero.  We need to send a
 	   DHCPDECLINE and toss the lease. */
diff -up dhcp-4.3.0a1/includes/dhcpd.h.next-server dhcp-4.3.0a1/includes/dhcpd.h
--- dhcp-4.3.0a1/includes/dhcpd.h.next-server	2013-12-20 13:57:06.434349907 +0100
+++ dhcp-4.3.0a1/includes/dhcpd.h	2013-12-20 13:57:06.502348958 +0100
@@ -2771,7 +2771,7 @@ void state_bound (void *);
 void state_stop (void *);
 void state_panic (void *);
 
-void bind_lease (struct client_state *);
+void bind_lease (struct client_state *, struct in_addr *);
 
 void make_client_options (struct client_state *,
 			  struct client_lease *, u_int8_t *,