@@ -135,6 +135,13 @@ int dhcp_solicit_resp_cb(uint16_t instance_id, void *ptr, uint8_t msg_name, uin
135
135
tr_error ("Sol Not include all Options" );
136
136
goto error_exit ;
137
137
}
138
+
139
+ if (libdhcpv6_nonTemporal_entry_get_by_iaid (dhcp_ia_non_temporal_params .iaId ) != srv_data_ptr ) {
140
+ /* Validate server data availability */
141
+ tr_error ("Valid instance not found" );
142
+ goto error_exit ;
143
+ }
144
+
138
145
if (srv_data_ptr -> IAID != dhcp_ia_non_temporal_params .iaId ) {
139
146
tr_error ("Wrong IAID" );
140
147
goto error_exit ;
@@ -181,7 +188,9 @@ int thread_dhcp_client_get_global_address(int8_t interface, uint8_t dhcp_addr[st
181
188
tr_error ("Invalid parameters" );
182
189
return -1 ;
183
190
}
191
+
184
192
srv_data_ptr = libdhcvp6_nontemporalAddress_server_data_allocate (interface , dhcp_client .libDhcp_instance , mac64 , DHCPV6_DUID_HARDWARE_EUI64_TYPE , prefix , dhcp_addr );
193
+
185
194
payload_len = libdhcpv6_solication_message_length (DHCPV6_DUID_HARDWARE_EUI64_TYPE , true, 0 );
186
195
payload_ptr = ns_dyn_mem_temporary_alloc (payload_len );
187
196
@@ -207,6 +216,7 @@ int thread_dhcp_client_get_global_address(int8_t interface, uint8_t dhcp_addr[st
207
216
srv_data_ptr -> transActionId = dhcp_service_send_req (dhcp_client .service_instance , 0 , srv_data_ptr , dhcp_addr , payload_ptr , payload_len , dhcp_solicit_resp_cb );
208
217
return srv_data_ptr -> transActionId ? 0 : -1 ;
209
218
}
219
+
210
220
void thread_dhcp_client_global_address_renew (int8_t interface )
211
221
{
212
222
// only prepared for changes in thread specifications
@@ -219,15 +229,23 @@ void thread_dhcp_client_global_address_delete(int8_t interface, uint8_t dhcp_add
219
229
protocol_interface_info_entry_t * cur ;
220
230
dhcpv6_client_server_data_t * srv_data_ptr ;
221
231
(void ) dhcp_addr ;
232
+
222
233
srv_data_ptr = libdhcpv6_nonTemporal_entry_get_by_prefix (interface , prefix );
223
234
cur = protocol_stack_interface_info_get_by_id (interface );
224
- if (cur == NULL || srv_data_ptr == NULL ) {
225
- tr_error ("Not valid prefix" );
226
- return ;
227
- }
228
- dhcp_service_req_remove (srv_data_ptr -> transActionId );// remove all pending retransmissions
229
- addr_delete (cur , srv_data_ptr -> iaNontemporalAddress .addressPrefix );
230
- libdhcvp6_nontemporalAddress_server_data_free (srv_data_ptr );
235
+
236
+ do {
237
+ if (cur == NULL || srv_data_ptr == NULL ) {
238
+ return ;
239
+ }
240
+ dhcp_service_req_remove (srv_data_ptr -> transActionId );// remove all pending retransmissions
241
+ tr_debug ("Deleting address: %s" , trace_ipv6 (srv_data_ptr -> iaNontemporalAddress .addressPrefix ));
242
+
243
+ addr_delete (cur , srv_data_ptr -> iaNontemporalAddress .addressPrefix );
244
+
245
+ libdhcvp6_nontemporalAddress_server_data_free (srv_data_ptr );
246
+ srv_data_ptr = libdhcpv6_nonTemporal_entry_get_by_prefix (interface , prefix );
247
+ } while (srv_data_ptr );
248
+
231
249
return ;
232
250
}
233
251
@@ -306,7 +324,7 @@ void thread_dhcpv6_client_set_address(int8_t interface_id, dhcpv6_client_server_
306
324
307
325
if (address_entry == NULL ) {
308
326
tr_error ("Address add failed" );
309
- return ;
327
+ return ;
310
328
}
311
329
if (renewTimer ) {
312
330
// translate seconds to 100ms ticks
@@ -316,7 +334,6 @@ void thread_dhcpv6_client_set_address(int8_t interface_id, dhcpv6_client_server_
316
334
renewTimer = 0xfffffffe ;
317
335
}
318
336
}
319
- tr_debug ("Added new address" );
320
337
address_entry -> state_timer = renewTimer ;
321
338
address_entry -> cb = thread_dhcpv6_renew ;
322
339
}
0 commit comments