diff options
-rw-r--r-- | src/dhcp/nm-dhcp-nettools.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/dhcp/nm-dhcp-nettools.c b/src/dhcp/nm-dhcp-nettools.c index 89ab0ad30c..ee66b68451 100644 --- a/src/dhcp/nm-dhcp-nettools.c +++ b/src/dhcp/nm-dhcp-nettools.c @@ -371,7 +371,7 @@ lease_parse_address (NDhcp4ClientLease *lease, */ if (nettools_lifetime == G_MAXUINT64) { a_lifetime = NM_PLATFORM_LIFETIME_PERMANENT; - a_expiry = NM_PLATFORM_LIFETIME_PERMANENT; + a_expiry = -1; } else { gint64 ts_time = time (NULL); @@ -382,10 +382,7 @@ lease_parse_address (NDhcp4ClientLease *lease, else if (a_lifetime > NM_PLATFORM_LIFETIME_PERMANENT) a_lifetime = NM_PLATFORM_LIFETIME_PERMANENT - 1; - if (ts_time > NM_PLATFORM_LIFETIME_PERMANENT - a_lifetime) - a_expiry = NM_PLATFORM_LIFETIME_PERMANENT - 1; - else - a_expiry = ts_time + a_lifetime; + a_expiry = ts_time + a_lifetime; } if (!lease_get_in_addr (lease, NM_DHCP_OPTION_DHCP4_SUBNET_MASK, &a_netmask)) { @@ -410,10 +407,12 @@ lease_parse_address (NDhcp4ClientLease *lease, NM_DHCP_OPTION_DHCP4_IP_ADDRESS_LEASE_TIME, (guint64) a_lifetime); - nm_dhcp_option_add_option_u64 (options, - _nm_dhcp_option_dhcp4_options, - NM_DHCP_OPTION_DHCP4_NM_EXPIRY, - (guint64) a_expiry); + if (a_expiry != -1) { + nm_dhcp_option_add_option_u64 (options, + _nm_dhcp_option_dhcp4_options, + NM_DHCP_OPTION_DHCP4_NM_EXPIRY, + (guint64) a_expiry); + } nm_ip4_config_add_address (ip4_config, &((const NMPlatformIP4Address) { |