@@ -181,7 +181,6 @@ static duplicate_dua_tr_t *thread_border_router_dup_tr_create(int8_t interface_i
181
181
182
182
static void thread_border_router_dup_tr_delete (duplicate_dua_tr_t * this )
183
183
{
184
-
185
184
if (!this ) {
186
185
return ;
187
186
}
@@ -209,7 +208,7 @@ static duplicate_dua_tr_t *thread_border_router_dup_tr_find(int8_t interface_id,
209
208
* DUA Registration Sequence Number TLV
210
209
* Network Name TLV
211
210
*/
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 )
213
212
{
214
213
uint8_t * payload_ptr , * ptr ;
215
214
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
219
218
payload_ptr = ptr = ns_dyn_mem_alloc (64 );
220
219
if (!payload_ptr ) {
221
220
tr_error ("BB_ANS.ntf alloc failed!" );
222
- return ;
221
+ return -1 ;
223
222
}
224
223
225
224
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
239
238
240
239
ns_dyn_mem_free (payload_ptr );
241
240
242
- return ;
241
+ return 0 ;
243
242
}
244
243
245
244
static 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
331
330
332
331
if (0 == request_tlv_len ) {
333
332
//error handling
334
- return 0 ;
333
+ return -1 ;
335
334
}
336
335
337
336
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
463
462
}
464
463
cur = protocol_stack_interface_info_get_by_id (this -> interface_id );
465
464
if (!cur ) {
466
- return 0 ;
465
+ return -1 ;
467
466
}
468
467
len = 3 + 10 ; // state,timestamp
469
468
len += thread_joiner_application_active_config_length (this -> interface_id ,NULL ,0 ,NULL ,0 );
470
469
// TODO implement processing
471
470
payload_ptr = ns_dyn_mem_temporary_alloc (len );
472
471
if (!payload_ptr ) {
473
472
tr_error ("out of resources" );
474
- return 0 ;
473
+ return -1 ;
475
474
}
476
475
ptr = payload_ptr ;
477
476
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],
510
509
}
511
510
if (addr_interface_address_compare (backbone_if , source_address ) == 0 ) {
512
511
// Received from own address no need to process
513
- return 0 ;
512
+ return -1 ;
514
513
}
515
514
516
515
addr_len = thread_meshcop_tlv_find (request_ptr -> payload_ptr , request_ptr -> payload_len , TMFCOP_TLV_TARGET_EID , & addr_data_ptr );
517
516
if (addr_len < 16 ) {
518
517
tr_warn ("Invalid BB_QRY.ntf message" );
519
- return 0 ;
518
+ return -1 ;
520
519
}
521
520
ipv6_route_t * route = ipv6_route_choose_next_hop (addr_data_ptr , this -> interface_id , NULL );
522
521
if (!route || route -> prefix_len < 128 || !route -> on_link || route -> info .source != ROUTE_THREAD_PROXIED_DUA_HOST || !route -> info .info ) {
523
522
//address not in mesh
524
- return 0 ;
523
+ return -1 ;
525
524
}
526
525
if (thread_meshcop_tlv_data_get_uint16 (request_ptr -> payload_ptr , request_ptr -> payload_len , TMFCOP_TLV_RLOC16 , & rloc ) > 1 ) {
527
526
rloc_ptr = & rloc ;
@@ -531,9 +530,7 @@ static int thread_pbbr_bb_qry_cb(int8_t service_id, uint8_t source_address[16],
531
530
uint8_t * ml_eid_ptr = ((thread_pbbr_dua_info_t * )route -> info .info )-> mleid_ptr ;
532
531
533
532
// 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 );
537
534
}
538
535
539
536
static 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_
593
590
if (!route || route -> prefix_len != 128 || !route -> on_link || route -> info .source != ROUTE_THREAD_PROXIED_DUA_HOST ) {
594
591
// Not found
595
592
tr_debug ("route not found" );
596
- return 0 ;
593
+ return -1 ;
597
594
}
598
595
599
596
// 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],
641
638
}
642
639
if (addr_interface_address_compare (backbone_if , source_address ) == 0 ) {
643
640
// Received from own address no need to process
644
- return 0 ;
641
+ return -1 ;
645
642
}
646
643
addr_len = thread_meshcop_tlv_find (request_ptr -> payload_ptr , request_ptr -> payload_len , TMFCOP_TLV_TARGET_EID , & addr_data_ptr );
647
644
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