summary refs log tree commit diff
path: root/src/dhcp
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2019-11-25 18:53:53 +0100
committerMichael Biebl <biebl@debian.org>2019-11-25 18:53:53 +0100
commite22609983008e1a669196ad64ba3a59ae8c76e0d (patch)
treec5b97693244d5004cbe735d507a25159512a753d /src/dhcp
parent9c642eac191ef0dce49855d8da0a9e9af18d5113 (diff)
New upstream version 1.20.8 upstream/1.20.8
Diffstat (limited to 'src/dhcp')
-rw-r--r--src/dhcp/nm-dhcp-nettools.c11
-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
4 files changed, 22 insertions, 0 deletions
diff --git a/src/dhcp/nm-dhcp-nettools.c b/src/dhcp/nm-dhcp-nettools.c
index 6140a916..a71a7a13 100644
--- a/src/dhcp/nm-dhcp-nettools.c
+++ b/src/dhcp/nm-dhcp-nettools.c
@@ -371,6 +371,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;
@@ -440,6 +441,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,
diff --git a/src/dhcp/nm-dhcp-options.c b/src/dhcp/nm-dhcp-options.c
index 21963070..22e7d90e 100644
--- a/src/dhcp/nm-dhcp-options.c
+++ b/src/dhcp/nm-dhcp-options.c
@@ -180,6 +180,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 0dc7a276..f56edb19 100644
--- a/src/dhcp/nm-dhcp-options.h
+++ b/src/dhcp/nm-dhcp-options.h
@@ -164,6 +164,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 073a6da0..96409345 100644
--- a/src/dhcp/nm-dhcp-systemd.c
+++ b/src/dhcp/nm-dhcp-systemd.c
@@ -119,6 +119,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;
@@ -178,6 +179,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,