diff options
author | Francesco Giudici <fgiudici@redhat.com> | 2019-07-12 11:54:21 +0200 |
---|---|---|
committer | Francesco Giudici <fgiudici@redhat.com> | 2019-07-25 11:42:12 +0200 |
commit | 84dbc217a39690b8cab1271e8ecc64056efa3cfb (patch) | |
tree | 6cf2b7bf25c562ff8665f6da3dccd685f382a85c | |
parent | 2509b840a39a2c5f2f062cd7239786f8804f0905 (diff) | |
download | NetworkManager-84dbc217a39690b8cab1271e8ecc64056efa3cfb.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.c | 6 |
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)) { |