summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2019-11-07 13:26:38 +0100
committerLubomir Rintel <lkundrak@v3.sk>2019-11-18 13:34:09 +0100
commitc1104a5cc2ff2fce9831e7ccc9286e91bd48120d (patch)
treefad3ff7dbae1883252c0285f5d9bedf641a8220f
parentedda3d36064dba517c9b312210d56c28f880db4a (diff)
downloadNetworkManager-lr/nettools-siaddr.tar.gz
dhcp/nettools: add siaddr to lease optionslr/nettools-siaddr
This is so that we end up with a next-server option analogous to what dhclient helper sends us. Dracut uses this for networked boots.
-rw-r--r--src/dhcp/nm-dhcp-nettools.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/dhcp/nm-dhcp-nettools.c b/src/dhcp/nm-dhcp-nettools.c
index 49743eb148..e2719f8557 100644
--- a/src/dhcp/nm-dhcp-nettools.c
+++ b/src/dhcp/nm-dhcp-nettools.c
@@ -352,6 +352,7 @@ lease_parse_address (NDhcp4ClientLease *lease,
const gint64 ts_clock_boottime = nm_utils_monotonic_timestamp_as_boottime (ts, 1);
struct in_addr a_address;
struct in_addr a_netmask;
+ struct in_addr a_next_server;
guint32 a_plen;
guint64 nettools_lifetime;
gint64 a_lifetime;
@@ -415,6 +416,16 @@ lease_parse_address (NDhcp4ClientLease *lease,
NM_DHCP_OPTION_DHCP4_NM_EXPIRY,
(guint64) a_expiry);
+
+ n_dhcp4_client_lease_get_siaddr (lease, &a_next_server);
+ if (a_next_server.s_addr != INADDR_ANY) {
+ nm_utils_inet4_ntop (a_next_server.s_addr, addr_str);
+ nm_dhcp_option_add_option (options,
+ _nm_dhcp_option_dhcp4_options,
+ NM_DHCP_OPTION_DHCP4_NM_NEXT_SERVER,
+ addr_str);
+ }
+
nm_ip4_config_add_address (ip4_config,
&((const NMPlatformIP4Address) {
.address = a_address.s_addr,