diff options
author | Dave Barach <dave@barachs.net> | 2019-11-08 20:20:17 -0500 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2019-11-09 17:28:14 +0000 |
commit | 20b962d3e494513ab28854936cc8bbc32891686b (patch) | |
tree | 46e5b006f7e5768dc0033a257a44529b00725a57 /src/plugins/dhcp/dhcp6_ia_na_client_cp.c | |
parent | 3c80c106a88f18523b7edaeaa8acf5728fd72ec3 (diff) |
dhcp: fix dhcpv6 client and dhcpv6 prefix delegation
Keep trying even if the interface in question is not "admin-up,
link-up." In real life, it's normal for link autonegotiation to take a
good fraction of a second. The driver layer takes care of packets sent
to an interface which can't transmit at the moment.
Renew address leases at the preferred renewal time, not at the
expiration time.
Type: fix
Signed-off-by: Dave Barach <dave@barachs.net>
Change-Id: I68ec1c52cc1f4a8aa256185820748b845e92f7c1
Diffstat (limited to 'src/plugins/dhcp/dhcp6_ia_na_client_cp.c')
-rw-r--r-- | src/plugins/dhcp/dhcp6_ia_na_client_cp.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/plugins/dhcp/dhcp6_ia_na_client_cp.c b/src/plugins/dhcp/dhcp6_ia_na_client_cp.c index 2d4135d7ebd..b87ad2139ed 100644 --- a/src/plugins/dhcp/dhcp6_ia_na_client_cp.c +++ b/src/plugins/dhcp/dhcp6_ia_na_client_cp.c @@ -302,7 +302,11 @@ dhcp6_reply_event_handler (vl_api_dhcp6_reply_event_t * mp) { address_info->preferred_lt = preferred_time; address_info->valid_lt = valid_time; - address_info->due_time = current_time + valid_time; + address_info->due_time = current_time; + /* Renew the lease at the preferred time, if non-zero */ + address_info->due_time += (preferred_time > 0) ? + preferred_time : valid_time; + if (address_info->due_time > rm->max_valid_due_time) rm->max_valid_due_time = address_info->due_time; continue; @@ -316,7 +320,11 @@ dhcp6_reply_event_handler (vl_api_dhcp6_reply_event_t * mp) address_info->address = *address; address_info->preferred_lt = preferred_time; address_info->valid_lt = valid_time; - address_info->due_time = current_time + valid_time; + address_info->due_time = current_time; + /* Renew the lease at the preferred time, if non-zero */ + address_info->due_time += (preferred_time > 0) ? + preferred_time : valid_time; + if (address_info->due_time > rm->max_valid_due_time) rm->max_valid_due_time = address_info->due_time; rm->client_state_by_sw_if_index[sw_if_index].address_count++; |