summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancesco Giudici <fgiudici@redhat.com>2019-07-12 11:54:21 +0200
committerFrancesco Giudici <fgiudici@redhat.com>2019-07-25 11:42:12 +0200
commit84dbc217a39690b8cab1271e8ecc64056efa3cfb (patch)
tree6cf2b7bf25c562ff8665f6da3dccd685f382a85c
parent2509b840a39a2c5f2f062cd7239786f8804f0905 (diff)
downloadNetworkManager-fg/nettools_dhcp_options.tar.gz
dhcp: nettools: check if addr is in the lease when boundfg/nettools_dhcp_options
otherwise quit early and share log info about it, like we do in the systemd internal client.
-rw-r--r--src/dhcp/nm-dhcp-nettools.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/dhcp/nm-dhcp-nettools.c b/src/dhcp/nm-dhcp-nettools.c
index d4b334cec8..3aa921807b 100644
--- a/src/dhcp/nm-dhcp-nettools.c
+++ b/src/dhcp/nm-dhcp-nettools.c
@@ -374,6 +374,12 @@ lease_parse_address (NDhcp4ClientLease *lease,
guint64 a_lifetime;
n_dhcp4_client_lease_get_yiaddr (lease, &a_address);
+ if (a_address.s_addr == INADDR_ANY) {
+ nm_utils_error_set_literal (error, NM_UTILS_ERROR_UNKNOWN, "could not get address from lease");
+ return FALSE;
+ }
+
+ /* n_dhcp4_client_lease_get_lifetime() never fails */
n_dhcp4_client_lease_get_lifetime (lease, &a_lifetime);
if (!lease_get_in_addr (lease, NM_DHCP_OPTION_DHCP4_SUBNET_MASK, &a_netmask)) {