Skip to content

Commit b016d52

Browse files
author
Juha Heiskanen
committed
Fixed DHCPv6 client delete when address was removed to new network discovery.
Change-Id: I460b60adc985c6bb05bd05ac0c35a9550c6526ad
1 parent 69fb24b commit b016d52

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

source/6LoWPAN/ws/ws_bootstrap.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,12 @@ static void ws_bootstrap_address_notification_cb(struct protocol_interface_info_
159159
} else if (reason == ADDR_CALLBACK_DELETED) {
160160
// What to do?
161161
// Go through address list and check if there is global address still available
162+
if (addr->source == ADDR_SOURCE_DHCP) {
163+
//Deprecate dhcpv address
164+
uint8_t address[16];
165+
memcpy(address, addr->address, 16);
166+
dhcp_client_global_address_delete(interface->id, NULL, address);
167+
}
162168
//Discover prefix policy
163169
addr_policy_remove_by_label(WS_NON_PREFFRED_LABEL);
164170

source/DHCPv6_client/dhcpv6_client_service.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ void dhcp_client_delete(int8_t interface)
9696
{
9797
protocol_interface_info_entry_t *cur = NULL;
9898
dhcpv6_client_server_data_t *srv_data_ptr;
99-
99+
uint8_t temporary_address[16];
100100
dhcp_service_delete(dhcp_client.service_instance);
101101

102102

@@ -110,9 +110,11 @@ void dhcp_client_delete(int8_t interface)
110110
srv_data_ptr = libdhcpv6_nonTemporal_entry_get_by_instance(dhcp_client.libDhcp_instance);
111111
if (srv_data_ptr != NULL) {
112112
tr_debug("Free DHCPv6 Client\n");
113+
memcpy(temporary_address, srv_data_ptr->iaNontemporalAddress.addressPrefix, 16);
113114
dhcp_service_req_remove(srv_data_ptr->transActionId);// remove all pending retransmissions
114-
addr_delete(cur, srv_data_ptr->iaNontemporalAddress.addressPrefix);
115115
libdhcvp6_nontemporalAddress_server_data_free(srv_data_ptr);
116+
addr_delete(cur, temporary_address);
117+
116118
}
117119
} while (srv_data_ptr != NULL);
118120
dhcp_client.service_instance = 0;

0 commit comments

Comments
 (0)