|
|
fad460 |
From f113ad7822fcd691e72f61cab7412595951222db Mon Sep 17 00:00:00 2001
|
|
|
fad460 |
From: Tomas Hozza <thozza@redhat.com>
|
|
|
fad460 |
Date: Wed, 3 Apr 2013 10:20:18 +0200
|
|
|
fad460 |
Subject: [PATCH] Expose next-server DHCPv4 option to dhclient script
|
|
|
fad460 |
|
|
|
fad460 |
Currently dhclient does not exposes next-server option
|
|
|
fad460 |
to the dhclient script. this patch fixes this.
|
|
|
fad460 |
|
|
|
fad460 |
Signed-off-by: Tomas Hozza <thozza@redhat.com>
|
|
|
fad460 |
---
|
|
|
fad460 |
client/dhclient.c | 14 +++++++++++---
|
|
|
fad460 |
includes/dhcpd.h | 2 +-
|
|
|
fad460 |
2 files changed, 12 insertions(+), 4 deletions(-)
|
|
|
fad460 |
|
|
|
fad460 |
diff --git a/client/dhclient.c b/client/dhclient.c
|
|
|
fad460 |
index 551ccbf..e8df320 100644
|
|
|
fad460 |
--- a/client/dhclient.c
|
|
|
fad460 |
+++ b/client/dhclient.c
|
|
|
fad460 |
@@ -993,7 +993,7 @@ void state_selecting (cpp)
|
|
|
fad460 |
client -> state = S_REQUESTING;
|
|
|
fad460 |
|
|
|
fad460 |
/* Bind to the address we received. */
|
|
|
fad460 |
- bind_lease (client);
|
|
|
fad460 |
+ bind_lease (client, NULL);
|
|
|
fad460 |
return;
|
|
|
fad460 |
}
|
|
|
fad460 |
|
|
|
fad460 |
@@ -1183,11 +1183,12 @@ void dhcpack (packet)
|
|
|
fad460 |
if (client -> new -> rebind < cur_time)
|
|
|
fad460 |
client -> new -> rebind = TIME_MAX;
|
|
|
fad460 |
|
|
|
fad460 |
- bind_lease (client);
|
|
|
fad460 |
+ bind_lease (client, &packet -> raw -> siaddr);
|
|
|
fad460 |
}
|
|
|
fad460 |
|
|
|
fad460 |
-void bind_lease (client)
|
|
|
fad460 |
+void bind_lease (client, siaddr)
|
|
|
fad460 |
struct client_state *client;
|
|
|
fad460 |
+ struct in_addr *siaddr;
|
|
|
fad460 |
{
|
|
|
fad460 |
struct timeval tv;
|
|
|
fad460 |
|
|
|
fad460 |
@@ -1209,6 +1210,13 @@ void bind_lease (client)
|
|
|
fad460 |
if (client -> alias)
|
|
|
fad460 |
script_write_params (client, "alias_", client -> alias);
|
|
|
fad460 |
|
|
|
fad460 |
+ if (siaddr) {
|
|
|
fad460 |
+ char buf[INET_ADDRSTRLEN];
|
|
|
fad460 |
+
|
|
|
fad460 |
+ if (inet_ntop (AF_INET, (void *) siaddr, buf, sizeof (buf)))
|
|
|
fad460 |
+ client_envadd (client, "new_", "next_server", "%s", buf);
|
|
|
fad460 |
+ }
|
|
|
fad460 |
+
|
|
|
fad460 |
/* If the BOUND/RENEW code detects another machine using the
|
|
|
fad460 |
offered address, it exits nonzero. We need to send a
|
|
|
fad460 |
DHCPDECLINE and toss the lease. */
|
|
|
fad460 |
diff --git a/includes/dhcpd.h b/includes/dhcpd.h
|
|
|
fad460 |
index 12ed2ba..4e93e68 100644
|
|
|
fad460 |
--- a/includes/dhcpd.h
|
|
|
fad460 |
+++ b/includes/dhcpd.h
|
|
|
fad460 |
@@ -2712,7 +2712,7 @@ void state_bound (void *);
|
|
|
fad460 |
void state_stop (void *);
|
|
|
fad460 |
void state_panic (void *);
|
|
|
fad460 |
|
|
|
fad460 |
-void bind_lease (struct client_state *);
|
|
|
fad460 |
+void bind_lease (struct client_state *, struct in_addr *);
|
|
|
fad460 |
|
|
|
fad460 |
void make_client_options (struct client_state *,
|
|
|
fad460 |
struct client_lease *, u_int8_t *,
|
|
|
fad460 |
--
|
|
|
fad460 |
1.8.1.4
|
|
|
fad460 |
|