File 0029-Expose-next-server-DHCPv4-option-to-dhclient-script.patch of Package dhcp.1901
From cbbe6f408e648b5c0aaff0e4284dda0c6dddc91d Mon Sep 17 00:00:00 2001
From: Tomas Hozza <thozza@redhat.com>
Date: Fri, 29 May 2015 13:56:58 +0200
Subject: [PATCH 29/31] Expose next-server DHCPv4 option to dhclient script
Currently dhclient does not exposes next-server option
to the dhclient script. this patch fixes this.
Signed-off-by: Tomas Hozza <thozza@redhat.com>
References: bsc#928390
Signed-off-by: Marius Tomaschewski <mt@suse.de>
diff --git a/client/dhclient.c b/client/dhclient.c
index 2fe95dc..8d0bf5a 100644
--- a/client/dhclient.c
+++ b/client/dhclient.c
@@ -1125,7 +1125,7 @@ void state_selecting (cpp)
client -> state = S_REQUESTING;
/* Bind to the address we received. */
- bind_lease (client);
+ bind_lease (client, NULL);
return;
}
@@ -1315,11 +1315,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;
@@ -1341,6 +1342,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 --git a/includes/dhcpd.h b/includes/dhcpd.h
index 0eda51d..55e9dbd 100644
--- a/includes/dhcpd.h
+++ b/includes/dhcpd.h
@@ -2692,7 +2692,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 *,
--
2.1.4