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