@@ -181,7 +181,6 @@ static duplicate_dua_tr_t *thread_border_router_dup_tr_create(int8_t interface_i
181181
182182static void thread_border_router_dup_tr_delete (duplicate_dua_tr_t * this )
183183{
184-
185184 if (!this ) {
186185 return ;
187186 }
@@ -209,7 +208,7 @@ static duplicate_dua_tr_t *thread_border_router_dup_tr_find(int8_t interface_id,
209208 * DUA Registration Sequence Number TLV
210209 * Network Name TLV
211210 */
212- static void thread_border_router_bb_ans_send (thread_pbbr_t * this , uint8_t * destination_addr_ptr , uint8_t * target_eid_ptr , uint8_t * ml_eid_ptr , uint32_t last_transaction_time , uint8_t * network_name_ptr , uint16_t * rloc_ptr )
211+ static int thread_border_router_bb_ans_send (thread_pbbr_t * this , uint8_t * destination_addr_ptr , uint8_t * target_eid_ptr , uint8_t * ml_eid_ptr , uint32_t last_transaction_time , uint8_t * network_name_ptr , uint16_t * rloc_ptr )
213212{
214213 uint8_t * payload_ptr , * ptr ;
215214 sn_coap_msg_type_e coap_msg_type = COAP_MSG_TYPE_CONFIRMABLE ;
@@ -219,7 +218,7 @@ static void thread_border_router_bb_ans_send(thread_pbbr_t *this, uint8_t *desti
219218 payload_ptr = ptr = ns_dyn_mem_alloc (64 );
220219 if (!payload_ptr ) {
221220 tr_error ("BB_ANS.ntf alloc failed!" );
222- return ;
221+ return -1 ;
223222 }
224223
225224 ptr = thread_meshcop_tlv_data_write (ptr , TMFCOP_TLV_TARGET_EID , 16 , target_eid_ptr );
@@ -239,7 +238,7 @@ static void thread_border_router_bb_ans_send(thread_pbbr_t *this, uint8_t *desti
239238
240239 ns_dyn_mem_free (payload_ptr );
241240
242- return ;
241+ return 0 ;
243242}
244243
245244static void thread_border_router_bb_qry_send (thread_pbbr_t * this , const uint8_t * target_eid_ptr , uint16_t * rloc_ptr )
@@ -331,7 +330,7 @@ static int thread_pbbr_data_req_recv_cb(int8_t service_id, uint8_t source_addres
331330
332331 if (0 == request_tlv_len ) {
333332 //error handling
334- return 0 ;
333+ return -1 ;
335334 }
336335
337336 if (thread_meshcop_tlv_list_type_available (request_tlv_ptr , request_tlv_len , MESHCOP_TLV_REGISTRAR_IPV6_ADDRESS )) {
@@ -463,15 +462,15 @@ static int thread_pbbr_nmkp_req_recv_cb(int8_t service_id, uint8_t source_addres
463462 }
464463 cur = protocol_stack_interface_info_get_by_id (this -> interface_id );
465464 if (!cur ) {
466- return 0 ;
465+ return -1 ;
467466 }
468467 len = 3 + 10 ; // state,timestamp
469468 len += thread_joiner_application_active_config_length (this -> interface_id ,NULL ,0 ,NULL ,0 );
470469 // TODO implement processing
471470 payload_ptr = ns_dyn_mem_temporary_alloc (len );
472471 if (!payload_ptr ) {
473472 tr_error ("out of resources" );
474- return 0 ;
473+ return -1 ;
475474 }
476475 ptr = payload_ptr ;
477476 ptr = thread_meshcop_tlv_data_write_uint8 (ptr , MESHCOP_TLV_STATE , 1 );
@@ -510,18 +509,18 @@ static int thread_pbbr_bb_qry_cb(int8_t service_id, uint8_t source_address[16],
510509 }
511510 if (addr_interface_address_compare (backbone_if , source_address ) == 0 ) {
512511 // Received from own address no need to process
513- return 0 ;
512+ return -1 ;
514513 }
515514
516515 addr_len = thread_meshcop_tlv_find (request_ptr -> payload_ptr , request_ptr -> payload_len , TMFCOP_TLV_TARGET_EID , & addr_data_ptr );
517516 if (addr_len < 16 ) {
518517 tr_warn ("Invalid BB_QRY.ntf message" );
519- return 0 ;
518+ return -1 ;
520519 }
521520 ipv6_route_t * route = ipv6_route_choose_next_hop (addr_data_ptr , this -> interface_id , NULL );
522521 if (!route || route -> prefix_len < 128 || !route -> on_link || route -> info .source != ROUTE_THREAD_PROXIED_DUA_HOST || !route -> info .info ) {
523522 //address not in mesh
524- return 0 ;
523+ return -1 ;
525524 }
526525 if (thread_meshcop_tlv_data_get_uint16 (request_ptr -> payload_ptr , request_ptr -> payload_len , TMFCOP_TLV_RLOC16 , & rloc ) > 1 ) {
527526 rloc_ptr = & rloc ;
@@ -531,9 +530,7 @@ static int thread_pbbr_bb_qry_cb(int8_t service_id, uint8_t source_address[16],
531530 uint8_t * ml_eid_ptr = ((thread_pbbr_dua_info_t * )route -> info .info )-> mleid_ptr ;
532531
533532 // This address is valid in our MESH
534- thread_border_router_bb_ans_send (this , source_address , addr_data_ptr , ml_eid_ptr , last_transaction_time , link_configuration_ptr -> name , rloc_ptr );
535-
536- return 0 ;
533+ return thread_border_router_bb_ans_send (this , source_address , addr_data_ptr , ml_eid_ptr , last_transaction_time , link_configuration_ptr -> name , rloc_ptr );
537534}
538535
539536static void thread_pbbr_pro_bb_ntf_process (protocol_interface_info_entry_t * cur , uint8_t * network_name_ptr , uint8_t network_name_len , uint8_t * ml_eid_ptr , uint8_t * addr_data_ptr , uint32_t last_transaction_time )
@@ -593,7 +590,7 @@ static int thread_pbbr_dua_duplicate_address_detection(int8_t service_id, uint8_
593590 if (!route || route -> prefix_len != 128 || !route -> on_link || route -> info .source != ROUTE_THREAD_PROXIED_DUA_HOST ) {
594591 // Not found
595592 tr_debug ("route not found" );
596- return 0 ;
593+ return -1 ;
597594 }
598595
599596 // We have pending request and received answer
@@ -641,7 +638,7 @@ static int thread_pbbr_bb_ans_cb(int8_t service_id, uint8_t source_address[16],
641638 }
642639 if (addr_interface_address_compare (backbone_if , source_address ) == 0 ) {
643640 // Received from own address no need to process
644- return 0 ;
641+ return -1 ;
645642 }
646643 addr_len = thread_meshcop_tlv_find (request_ptr -> payload_ptr , request_ptr -> payload_len , TMFCOP_TLV_TARGET_EID , & addr_data_ptr );
647644 ml_eid_len = thread_meshcop_tlv_find (request_ptr -> payload_ptr , request_ptr -> payload_len , TMFCOP_TLV_ML_EID , & ml_eid_ptr );
0 commit comments