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-07 13:55:57 +0100
commitafcf1ec6a3f876a8f918e0cfa9807770b0638f7e (patch)
tree4922062e671ddaf68b18eb24ea9a2b1498cadf70
parent4a870c57f52d7f0447c5a11145dca3d46ca57a5c (diff)
downloadNetworkManager-lr/siaddr.tar.gz
systemd: add siaddr to lease optionslr/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-options.c1
-rw-r--r--src/dhcp/nm-dhcp-options.h1
-rw-r--r--src/dhcp/nm-dhcp-systemd.c9
3 files changed, 11 insertions, 0 deletions
diff --git a/src/dhcp/nm-dhcp-options.c b/src/dhcp/nm-dhcp-options.c
index 66a361ab28..4c003f315c 100644
--- a/src/dhcp/nm-dhcp-options.c
+++ b/src/dhcp/nm-dhcp-options.c
@@ -166,6 +166,7 @@ const NMDhcpOption _nm_dhcp_option_dhcp4_options[] = {
/* Internal values */
REQ (NM_DHCP_OPTION_DHCP4_NM_IP_ADDRESS, "ip_address", FALSE ),
REQ (NM_DHCP_OPTION_DHCP4_NM_EXPIRY, "expiry", FALSE ),
+ REQ (NM_DHCP_OPTION_DHCP4_NM_NEXT_SERVER, "next_server", FALSE ),
{ 0 }
};
diff --git a/src/dhcp/nm-dhcp-options.h b/src/dhcp/nm-dhcp-options.h
index 572f71e678..bf9ccd5719 100644
--- a/src/dhcp/nm-dhcp-options.h
+++ b/src/dhcp/nm-dhcp-options.h
@@ -150,6 +150,7 @@ typedef enum {
/* Internal values */
NM_DHCP_OPTION_DHCP4_NM_IP_ADDRESS = 1024,
NM_DHCP_OPTION_DHCP4_NM_EXPIRY = 1025,
+ NM_DHCP_OPTION_DHCP4_NM_NEXT_SERVER = 1026,
} NMDhcpOptionDhcp4Options;
typedef enum {
diff --git a/src/dhcp/nm-dhcp-systemd.c b/src/dhcp/nm-dhcp-systemd.c
index 7f0cd3325e..f2c3acc249 100644
--- a/src/dhcp/nm-dhcp-systemd.c
+++ b/src/dhcp/nm-dhcp-systemd.c
@@ -97,6 +97,7 @@ lease_to_ip4_config (NMDedupMultiIndex *multi_idx,
gint64 ts_time = time (NULL);
struct in_addr a_address;
struct in_addr a_netmask;
+ struct in_addr a_next_server;
struct in_addr server_id;
struct in_addr broadcast;
const struct in_addr *a_router;
@@ -148,6 +149,14 @@ lease_to_ip4_config (NMDedupMultiIndex *multi_idx,
NM_DHCP_OPTION_DHCP4_NM_EXPIRY,
(guint64) (ts_time + a_lifetime));
+ if (sd_dhcp_lease_get_next_server (lease, &a_next_server) == 0) {
+ 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,