SHA256
1
0
forked from pool/dhcp
dhcp/0015-Expose-next-server-DHCPv4-option-to-dhclient-script.patch

70 lines
1.9 KiB
Diff
Raw Normal View History

For complete changelog, please read the RELNOTES file shipped along with this package or online at: - Replaced hostname patch with a dhcpv6 and fqdn aware variant: [- 0006-dhcp-4.2.5-dhclient-send-hostname-rml.patch, + 0006-dhcp-4.3.2-dhclient-send-hostname-or-fqdn.patch] - Adjusted patch numbers in the spec file: [- 0008-dhcp-4.1.1-P1-lpf-bind-msg-fix.patch, - 0010-dhcp-4.2.2-dhclient-option-checks.patch, - 0011-dhcp-4.2.6-close-on-exec.patch, - 0012-dhcp-4.2.2-quiet-dhclient.patch, - 0014-Fixed-linux-interface-discovery-using-getifaddrs.patch, - 0020-dhcp-4.2.x-chown-server-leases.bnc868253.patch, - 0024-dhcp-4.2.x-dhcpv6-decline-on-DAD-failure.872609.patch, + 0008-dhcp-4.2.2-dhclient-option-checks.patch, + 0009-dhcp-4.2.6-close-on-exec.patch, + 0010-dhcp-4.2.2-quiet-dhclient.patch, + 0011-Fixed-linux-interface-discovery-using-getifaddrs.patch, + 0012-dhcp-4.2.x-chown-server-leases.bnc868253.patch, + 0013-dhcp-4.2.x-dhcpv6-decline-on-DAD-failure.872609.patch] - Fixed to not pass DHCPv6 address lifetimes a positive (unsigned 32bit) integers to scripts and properly format timestamps as long to not break them on 64bit architectures (bsc#926159). [+ 0014-dhclient6-unsigned-lifetimes-for-script-bsc-926159.patch] - dhclient: expose next-server DHCPv4 option to script (bsc#928390) [+ 0015-Expose-next-server-DHCPv4-option-to-dhclient-script.patch] - Replaced infiniband support patch with fixed variant (bsc#910984): [- 0017-dhcp-4.2.6-lpf-ip-over-ib-support.patch, - 0018-dhcp-4.2.6-improved-xid.patch, + 0016-infiniband-support.patch] - Moved dhcp-devel package include files and static libraries OBS-URL: https://build.opensuse.org/package/show/network:dhcp/dhcp?expand=0&rev=154
2015-09-14 17:35:16 +02:00
From 5fd4d0595760acd3e4c2524c9747dc5c0042e173 Mon Sep 17 00:00:00 2001
From: Tomas Hozza <thozza@redhat.com>
Date: Fri, 29 May 2015 13:56:58 +0200
Subject: 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
diff --git a/client/dhclient.c b/client/dhclient.c
index 4d7394d..0c77ae2 100644
--- a/client/dhclient.c
+++ b/client/dhclient.c
@@ -1104,7 +1104,7 @@ void state_selecting (cpp)
client -> state = S_REQUESTING;
/* Bind to the address we received. */
- bind_lease (client);
+ bind_lease (client, NULL);
return;
}
@@ -1294,11 +1294,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;
@@ -1318,6 +1319,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 86d0afe..f0f4b20 100644
--- a/includes/dhcpd.h
+++ b/includes/dhcpd.h
@@ -2891,7 +2891,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