Skip to content

Commit ffa1569

Browse files
author
Arto Kinnunen
authored
Thread router network data update after link sync (ARMmbed#1530)
-Router is removing its own network data after link sync by sending a/sd to the leader. According to the spec own data should not be cleared after link sync. -Remove excess traces from thread_bbr. -Fix coverity CID 223399 (Unchecked return value from library) from thread_joiner_application.
1 parent 3b46d8d commit ffa1569

File tree

3 files changed

+10
-16
lines changed

3 files changed

+10
-16
lines changed

source/6LoWPAN/Thread/thread_bbr_api.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,6 @@ static void thread_bbr_udp_proxy_service_stop(int8_t interface_id)
768768
tr_error("Failed to find BA instance");
769769
return;
770770
}
771-
tr_debug("thread_border_router_udp_proxy_service_stop %d", interface_id);
772771

773772
socket_close(this->udp_proxy_socket);
774773
this->udp_proxy_socket = -1;
@@ -789,19 +788,18 @@ int thread_bbr_commissioner_proxy_service_update(int8_t interface_id)
789788
goto return_fail;
790789
}
791790

792-
if (cur->thread_info->registered_commissioner.commissioner_valid) {
793-
// relay is needed
791+
if (!cur->thread_info->registered_commissioner.commissioner_valid) {
792+
// commissioner not enabled
794793
if (this->udp_proxy_socket != -1) {
795-
// UDP service is already running
796-
return 0;
794+
thread_bbr_udp_proxy_service_stop(interface_id);
797795
}
798-
} else if (this->udp_proxy_socket != -1) {
799-
// UDP service is running and need to delete
800-
thread_bbr_udp_proxy_service_stop(interface_id);
801796
return 0;
802797
}
803-
tr_debug("thread_border_router_udp_proxy_service_start %d", interface_id);
804798

799+
if (this->udp_proxy_socket != -1) {
800+
// commissioner is valid and UDP service is already running
801+
return 0;
802+
}
805803

806804
// Set source parameters, if commissioner is available
807805
ret_val = thread_management_get_commissioner_address(this->interface_id, &ns_source_addr.address[0], 0);

source/6LoWPAN/Thread/thread_joiner_application.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1134,7 +1134,7 @@ void thread_joiner_pending_config_activate(int8_t interface_id)
11341134
this->active_configuration_ptr->timestamp = pending_active_timestamp;
11351135
// All information is copied from old configuration so if configuration is corrupt we dont change anything.
11361136
this->pending_configuration_ptr = NULL;
1137-
thread_nvm_store_pending_configuration_remove();
1137+
(void)thread_nvm_store_pending_configuration_remove();
11381138
configuration_set_copy_mandatory(this->active_configuration_ptr, this->old_active_configuration_ptr);
11391139
link_configuration_update(this->configuration_ptr,this->active_configuration_ptr->data, this->active_configuration_ptr->length);
11401140
link_configuration_trace(this->configuration_ptr);

source/6LoWPAN/Thread/thread_router_bootstrap.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -399,21 +399,17 @@ static void thread_router_synch_receive_cb(int8_t interface_id, mle_message_t *m
399399
if (thread_leader_service_thread_partitition_restart(interface_id, &routing)) {
400400
return;
401401
}
402-
tr_info("Router synch success as Leader of network");
402+
tr_info("Router synch OK as Leader");
403403
} else {
404-
// Remove possibly registered network data from leader
405-
thread_management_client_network_data_unregister(cur->id, address16);
406-
407404
// Decrement data version and request network data to be updated
408405
cur->thread_info->thread_leader_data->dataVersion--;
409406
cur->thread_info->thread_leader_data->stableDataVersion--;
410407
thread_network_data_request_send(cur, mle_msg->packet_src_address, true);
411-
tr_info("Router synch success as Router");
408+
tr_info("Router synch OK as Router");
412409
}
413410

414411
thread_router_bootstrap_route_tlv_push(cur, routing.dataPtr, routing.tlvLen , linkMargin, entry_temp);
415412
thread_bootstrap_attached_ready(cur);
416-
417413
}
418414

419415
break;

0 commit comments

Comments
 (0)