Skip to content

Commit

Permalink
DHCPv6 renew and transaction id update
Browse files Browse the repository at this point in the history
Clear transaction ID when response callback is coming

Renew process not start a new if there is pending request ongoing.

wi-sun dhcpv6 callback will remove address if address get fail.

Change-Id: Ida790be12e95a8ef389d3e6a615d608af74c1b4a
  • Loading branch information
Juha Heiskanen committed Sep 18, 2019
1 parent c5b6df3 commit 3cad7bd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions source/6LoWPAN/ws/ws_bootstrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1944,6 +1944,9 @@ static void ws_dhcp_client_global_adress_cb(int8_t interface, uint8_t dhcp_addr[
if (cur) {
rpl_control_register_address(cur, prefix);
}
} else {
//Delete dhcpv6 client
dhcp_client_global_address_delete(interface, dhcp_addr, prefix);
}
}

Expand Down
11 changes: 10 additions & 1 deletion source/DHCPv6_client/dhcpv6_client_service.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ int dhcp_solicit_resp_cb(uint16_t instance_id, void *ptr, uint8_t msg_name, uin
goto error_exit;
}

//Clear Active Transaction state
srv_data_ptr->transActionId = 0;

// Validate message
if (msg_name != DHCPV6_REPLY_TYPE) {
tr_error("invalid response");
Expand Down Expand Up @@ -332,7 +335,7 @@ int dhcp_client_server_address_update(int8_t interface, uint8_t *prefix, uint8_t
}

memcpy(srv_data_ptr->server_address, server_address, 16);
if (!srv_data_ptr->iaNonTemporalStructValid) {
if (srv_data_ptr->transActionId) {
dhcp_service_update_server_address(srv_data_ptr->transActionId, server_address);
}
return 0;
Expand Down Expand Up @@ -396,6 +399,12 @@ void dhcpv6_renew(protocol_interface_info_entry_t *interface, if_address_entry_t
return;
}

if (srv_data_ptr->transActionId) {
//Do not trig new Renew process
tr_warn("Do not trig new pending renew request");
return;
}

payload_len = libdhcpv6_address_request_message_len(srv_data_ptr->clientLinkIdType, srv_data_ptr->serverLinkType, 0, !dhcp_client.no_address_hint);
payload_ptr = ns_dyn_mem_temporary_alloc(payload_len);
if (payload_ptr == NULL) {
Expand Down

0 comments on commit 3cad7bd

Please sign in to comment.