Skip to content
This repository was archived by the owner on May 23, 2023. It is now read-only.

Commit 3a57101

Browse files
author
Arto Kinnunen
authored
Fix compiler warnings and update traces (ARMmbed#1523)
1 parent c288227 commit 3a57101

File tree

11 files changed

+52
-49
lines changed

11 files changed

+52
-49
lines changed

source/6LoWPAN/Bootstraps/Generic/protocol_6lowpan_bootstrap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2554,7 +2554,7 @@ void protocol_6lowpan_mac_scan_confirm(int8_t if_id, const mlme_scan_conf_t* con
25542554

25552555
void bootstrap_timer_handle(uint16_t ticks)
25562556
{
2557-
ticks;
2557+
(void)ticks;
25582558
ns_list_foreach(protocol_interface_info_entry_t, cur, &protocol_interface_info_list) {
25592559
if (cur->nwk_id == IF_6LoWPAN) {
25602560
if (cur->nwk_bootstrap_state == ER_ACTIVE_SCAN || cur->nwk_bootstrap_state == ER_WARM_ACTIVE_SCAN) {

source/6LoWPAN/Thread/thread_bbr_api.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,7 @@ static int thread_border_relay_to_leader_cb(int8_t service_id, uint8_t source_ad
512512
return -1;
513513
}
514514

515+
#ifdef HAVE_THREAD_BORDER_ROUTER
515516
static bool thread_bbr_i_host_prefix(struct protocol_interface_info_entry *cur, uint8_t prefix_ptr[8], uint8_t *br_count, bool *i_am_lowest)
516517
{
517518
bool i_host_this_prefix = false;
@@ -568,6 +569,7 @@ static void thread_bbr_network_data_remove(thread_bbr_t *this)
568569
memset(this->bbr_prefix,0,8);
569570
this->br_info_published = false;
570571
}
572+
571573
static void thread_bbr_network_data_send(thread_bbr_t *this, uint8_t prefix[8], uint8_t eui64[8])
572574
{
573575
thread_border_router_info_t br_info = { 0 };
@@ -594,8 +596,8 @@ static void thread_bbr_network_data_send(thread_bbr_t *this, uint8_t prefix[8],
594596
thread_border_router_prefix_add(this->interface_id, this->bbr_prefix, 64, &br_info);
595597
thread_border_router_publish(this->interface_id);
596598
this->br_info_published = true;
597-
598599
}
600+
599601
static void thread_bbr_routing_enable(thread_bbr_t *this)
600602
{
601603
if (this->routing_enabled) {
@@ -691,17 +693,18 @@ static void thread_bbr_status_check(thread_bbr_t *this, uint32_t seconds)
691693
} else {
692694
this->br_delete_timer = randLIB_get_random_in_range(5,10);
693695
}
694-
tr_info("br: too many BRs start remove jitter: %d", this->br_delete_timer);
696+
tr_info("br: too many BRs start remove jitter:%"PRIu32, this->br_delete_timer);
695697
return;
696698
}
697699
if (this->br_info_published && !bbr_prefix_ptr ) {
698700
// Need to disable ND proxy will give a 20 second delay for it We could also disable routing immediately
699701
this->br_delete_timer = 20;
700-
tr_info("br: can not be border router need to remove after: %d", this->br_delete_timer);
702+
tr_info("br: can not be border router need to remove after: %"PRIu32, this->br_delete_timer);
701703
return;
702704
}
703705
}
704706
}
707+
705708
static bool thread_bbr_activated(thread_bbr_t *this, uint32_t seconds)
706709
{
707710
protocol_interface_info_entry_t *cur;
@@ -740,7 +743,6 @@ static bool thread_bbr_activated(thread_bbr_t *this, uint32_t seconds)
740743
return false;
741744
}
742745

743-
#ifdef HAVE_THREAD_BORDER_ROUTER
744746
bool thread_bbr_routing_enabled(protocol_interface_info_entry_t *cur)
745747
{
746748
thread_bbr_t *this = thread_bbr_find_by_interface(cur->thread_info->interface_id);
@@ -756,7 +758,7 @@ void thread_bbr_network_data_update_notify(protocol_interface_info_entry_t *cur)
756758
(void) cur;
757759
thread_mdns_network_data_update_notify();
758760
}
759-
#endif
761+
#endif /* HAVE_THREAD_BORDER_ROUTER*/
760762

761763
static void thread_bbr_udp_proxy_service_stop(int8_t interface_id)
762764
{

source/6LoWPAN/Thread/thread_border_router_api.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,6 @@ static void thread_border_router_child_network_data_clean(uint8_t interface_id,
314314

315315
static void thread_border_router_lost_children_nwk_data_validate(protocol_interface_info_entry_t *cur, uint16_t router_short_addr)
316316
{
317-
318-
tr_debug("thread_border_router_lost_children_nwk_data_validate() %x", router_short_addr);
319317
if (!thread_is_router_addr(router_short_addr)) {
320318
// not validating children nwk data
321319
return;
@@ -432,6 +430,7 @@ static bool thread_border_router_local_srv_data_in_network_data_check(protocol_i
432430
return true;
433431
}
434432

433+
#ifdef HAVE_THREAD_BORDER_ROUTER
435434
static int thread_border_router_recursive_dns_server_option_store(int8_t interface_id, uint8_t *recursive_dns_server_option, uint16_t recursive_dns_server_option_len)
436435
{
437436
thread_border_router_t *this = thread_border_router_find_by_interface(interface_id);
@@ -451,7 +450,9 @@ static int thread_border_router_recursive_dns_server_option_store(int8_t interfa
451450
}
452451
return 0;
453452
}
453+
#endif
454454

455+
#ifdef HAVE_THREAD_BORDER_ROUTER
455456
static int thread_border_router_dns_search_list_option_store(int8_t interface_id, uint8_t *dns_search_list_option, uint16_t search_list_option_len)
456457
{
457458
thread_border_router_t *this = thread_border_router_find_by_interface(interface_id);
@@ -470,6 +471,7 @@ static int thread_border_router_dns_search_list_option_store(int8_t interface_id
470471
}
471472
return 0;
472473
}
474+
#endif
473475

474476
int8_t thread_border_router_init(int8_t interface_id)
475477
{

source/6LoWPAN/Thread/thread_network_data_storage.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2451,7 +2451,7 @@ uint8_t *thread_network_data_service_set_write(thread_network_data_cache_entry_t
24512451
tlvLength = thread_nd_service_based_on_list_entry_size(cur, true);
24522452
if (tlvLength) {
24532453
ptr = thread_nd_service_header_write(ptr, cur, tlvLength);
2454-
tr_debug("Service: sid:%d e:%d data:%s",cur->S_id, cur->S_enterprise_number, trace_array(cur->S_service_data, cur->S_service_data_length));
2454+
tr_debug("Service: sid:%d e:%"PRIu32" data:%s",cur->S_id, cur->S_enterprise_number, trace_array(cur->S_service_data, cur->S_service_data_length));
24552455
ptr = thread_nd_service_server_list_write(&cur->server_list, ptr, true);
24562456
}
24572457
}

source/6LoWPAN/Thread/thread_nvm_store.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ int thread_nvm_store_device_configuration_read(uint8_t *mac_ptr, uint8_t *mleid_
144144
ret = thread_nvm_store_read(device_conf_path, &d_c, sizeof(thread_nvm_device_conf_t), &version);
145145
if(THREAD_NVM_FILE_SUCCESS==ret) {
146146
if (THREAD_NVM_FILE_SUCCESS==ret && DEVICE_CONF_VERSION!=version) {
147-
tr_info("fast data version mismatch %d", version);
147+
tr_info("fast data version mismatch %"PRIu32, version);
148148
ret = THREAD_NVM_FILE_VERSION_WRONG;
149149
}
150150
else {
@@ -182,7 +182,7 @@ int thread_nvm_store_pending_configuration_read(void *data, uint16_t size)
182182

183183
int ret = thread_nvm_store_read(pc_data_path, data, size, &version);
184184
if (THREAD_NVM_FILE_SUCCESS==ret && PENDING_CONF_DATA_VERSION!=version) {
185-
tr_info("Pending configuration version mismatch %d", version);
185+
tr_info("Pending configuration version mismatch %"PRIu32, version);
186186
return THREAD_NVM_FILE_VERSION_WRONG;
187187
}
188188
return ret;
@@ -216,7 +216,7 @@ int thread_nvm_store_active_configuration_read(void *data, uint16_t data_size)
216216

217217
int ret = thread_nvm_store_read(ac_data_path, data, data_size, &version);
218218
if (THREAD_NVM_FILE_SUCCESS==ret && ACTIVE_CONF_DATA_VERSION!=version) {
219-
tr_info("active configuration version mismatch %d", version);
219+
tr_info("active configuration version mismatch %"PRIu32, version);
220220
return THREAD_NVM_FILE_VERSION_WRONG;
221221
}
222222
return ret;
@@ -324,7 +324,7 @@ int thread_nvm_store_fast_data_read(thread_nvm_fast_data_t* fast_data)
324324
uint32_t version;
325325
ret = thread_nvm_store_read(fast_data_path, fast_data, sizeof(thread_nvm_fast_data_t), &version);
326326
if (THREAD_NVM_FILE_SUCCESS==ret && FAST_DATA_VERSION!=version) {
327-
tr_info("fast data version mismatch %d", version);
327+
tr_info("fast data version mismatch %"PRIu32, version);
328328
return THREAD_NVM_FILE_VERSION_WRONG;
329329
}
330330
}
@@ -347,12 +347,13 @@ static int thread_nvm_store_write(const char *file_name, void *data, uint32_t da
347347
{
348348
FILE *fp = fopen(file_name, "w");
349349
if(fp == NULL) {
350+
tr_error("NVM open error: %s", file_name);
350351
return THREAD_NVM_FILE_CANNOT_OPEN;
351352
}
352353

353354
size_t n_bytes = fwrite(&version, 1, sizeof(uint32_t), fp);
354355
if (n_bytes!=sizeof(uint32_t)) {
355-
tr_warning("NVM version write failed");
356+
tr_warning("NVM version write error");
356357
fclose(fp);
357358
return THREAD_NVM_FILE_WRITE_ERROR;
358359
}
@@ -373,13 +374,13 @@ static int thread_nvm_store_read(const char *file_name, void *data, uint32_t dat
373374
{
374375
FILE *fp = fopen(file_name, "r");
375376
if(fp == NULL) {
376-
tr_warning("File not found %s", file_name);
377+
tr_warning("File not found: %s", file_name);
377378
return THREAD_NVM_FILE_CANNOT_OPEN;
378379
}
379380

380381
size_t n_bytes = fread(version, 1, sizeof(uint32_t), fp);
381382
if (n_bytes!=sizeof(uint32_t)) {
382-
tr_warning("NVM version read failed %s", file_name);
383+
tr_warning("NVM version read error %s", file_name);
383384
fclose(fp);
384385
return THREAD_NVM_FILE_READ_ERROR;
385386
}
@@ -418,14 +419,14 @@ int thread_nvm_store_link_info_read(void)
418419
if (status != THREAD_NVM_FILE_SUCCESS) {
419420
if (!memcmp(cached_link_info.nvm_link_info.mac, ADDR_UNSPECIFIED, 8) &&
420421
cached_link_info.nvm_link_info.short_addr == LINK_INFO_SHORT_ADDR_NOT_SET) {
421-
tr_info("link info not cached and read failed");
422+
tr_info("link info not cached and read error %d", status);
422423
cached_link_info.loaded = false;
423424
return THREAD_NVM_FILE_READ_ERROR;
424425
}
425426
return status;
426427
}
427428
else if (ACTIVE_CONF_DATA_VERSION != version) {
428-
tr_info("link info version mismatch %d", version);
429+
tr_info("link info version mismatch %"PRIu32, version);
429430
return THREAD_NVM_FILE_VERSION_WRONG;
430431
}
431432
memcpy(cached_link_info.nvm_link_info.mac, nvm_link_info_tmp.mac, 8);

source/Common_Protocols/ipv6.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,9 +1075,6 @@ static buffer_t *ipv6_consider_forwarding_multicast_packet(buffer_t *buf, protoc
10751075
cur->if_special_multicast_forwarding(cur, buf);
10761076
}
10771077

1078-
uint_fast8_t group_scope = addr_ipv6_multicast_scope(buf->dst_sa.address);
1079-
uint_fast8_t src_scope = addr_ipv6_scope(buf->src_sa.address, cur);
1080-
10811078
#ifdef HAVE_MPL
10821079
/* MPL does its own thing - we do not perform any "native" forwarding */
10831080
if (buf->options.ip_extflags & IPEXT_HBH_MPL) {
@@ -1086,6 +1083,9 @@ static buffer_t *ipv6_consider_forwarding_multicast_packet(buffer_t *buf, protoc
10861083
#endif
10871084

10881085
#ifdef MULTICAST_FORWARDING
1086+
uint_fast8_t group_scope = addr_ipv6_multicast_scope(buf->dst_sa.address);
1087+
uint_fast8_t src_scope = addr_ipv6_scope(buf->src_sa.address, cur);
1088+
10891089
/* Look at reverse path - check our route to the source address */
10901090
ipv6_route_t *route = ipv6_route_choose_next_hop(buf->src_sa.address, cur->id, NULL);
10911091

source/MPL/mpl.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,9 +1128,6 @@ static buffer_t *mpl_exthdr_provider(buffer_t *buf, ipv6_exthdr_stage_t stage, i
11281128
buf->options.ip_extflags &=~ IPEXT_HBH_MPL_UNFILLED;
11291129
buf->mpl_option_data_offset = IPV6_HDRLEN + 4;
11301130
mpl_forwarder_process_message(buf, domain, true);
1131-
} else {
1132-
uint8_t *iphdr = buffer_data_pointer(buf);
1133-
uint8_t *ext = iphdr + IPV6_HDRLEN;
11341131
}
11351132
*result = 0;
11361133
return buf;

source/RPL/rpl_data.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151

5252
#define RPL_DATA_SR_INIT_SIZE (16*4)
5353

54+
#ifdef HAVE_RPL_ROOT
5455
typedef struct rpl_data_sr {
5556
rpl_dao_target_t *target; /* Target - note may be a prefix */
5657
uint16_t iaddr_size;
@@ -60,6 +61,7 @@ typedef struct rpl_data_sr {
6061
} rpl_data_sr_t;
6162

6263
static rpl_data_sr_t *rpl_data_sr;
64+
#endif
6365

6466
static const uint8_t *rpl_data_get_dodagid(const buffer_t *buf);
6567

source/RPL/rpl_downward.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -170,19 +170,6 @@ void rpl_downward_convert_dodag_preferences_to_dao_path_control(rpl_dodag_t *dod
170170
}
171171
}
172172

173-
static uint_fast8_t rpl_downward_path_control_to_preference(uint8_t pc)
174-
{
175-
if (pc >= 0x40) {
176-
return 1;
177-
} else if (pc >= 0x10) {
178-
return 2;
179-
} else if (pc >= 0x04) {
180-
return 3;
181-
} else {
182-
return 4;
183-
}
184-
}
185-
186173
static void rpl_downward_target_refresh(rpl_dao_target_t *target)
187174
{
188175
target->need_seq_inc = true;
@@ -826,6 +813,19 @@ void rpl_instance_send_dao_no_path(rpl_instance_t *instance, rpl_dao_target_t *t
826813
#endif
827814

828815
#ifdef HAVE_RPL_ROOT
816+
static uint_fast8_t rpl_downward_path_control_to_preference(uint8_t pc)
817+
{
818+
if (pc >= 0x40) {
819+
return 1;
820+
} else if (pc >= 0x10) {
821+
return 2;
822+
} else if (pc >= 0x04) {
823+
return 3;
824+
} else {
825+
return 4;
826+
}
827+
}
828+
829829
static rpl_dao_root_transit_t *rpl_downward_add_root_transit(rpl_dao_target_t *target, const uint8_t parent[16], uint8_t path_control)
830830
{
831831
//rpl_dao_root_transit_t *old_first = ns_list_get_first(&target->info.root.transits);

source/Security/PANA/eap_protocol.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,10 +272,10 @@ buffer_t *eap_down(buffer_t *buf, sec_suite_t *suite)
272272

273273
buffer_t *eap_up(buffer_t *buf, sec_suite_t *suite)
274274
{
275+
eap_header_t header;
275276
uint8_t *ptr = buffer_data_pointer(buf);
276277
uint16_t payload_length = buffer_data_length(buf);
277-
eap_header_t header;
278-
uint8_t response_counter;
278+
uint8_t response_counter = suite->retry_counter;
279279
if (!eap_header_parse(ptr, payload_length, &header)) {
280280
return buffer_free(buf);
281281
}
@@ -288,7 +288,6 @@ buffer_t *eap_up(buffer_t *buf, sec_suite_t *suite)
288288
}
289289
//tr_debug("EAP RES");
290290
suite->pana_session.eap_id_seq++;
291-
response_counter = suite->retry_counter;
292291
suite->retry_counter = 0;
293292
} else if (header.eap_code == EAP_REQ) {
294293

source/libNET/src/net_load_balance.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -263,22 +263,25 @@ void net_load_balance_internal_state_activate(protocol_interface_info_entry_t *i
263263

264264
}
265265

266-
266+
#ifdef HAVE_RPL
267+
#ifdef HAVE_6LOWPAN_BORDER_ROUTER
267268
static int8_t net_load_balance_api_get_node_count_cb(void *lb_user, uint16_t *node_count)
268269
{
269-
#ifdef HAVE_RPL
270270
protocol_interface_info_entry_t *interface_ptr = lb_user;
271271
if (rpl_control_get_instance_dao_target_count(interface_ptr->rpl_domain, 1, NULL, node_count) ) {
272272
return 0;
273273
}
274-
#endif
274+
275275
return -1;
276276
}
277+
#endif
278+
#endif
277279

280+
#ifdef HAVE_RPL
281+
#ifdef HAVE_6LOWPAN_BORDER_ROUTER
278282
static int8_t net_load_balance_api_get_set_load_level_cb(void *lb_user, uint8_t load_level)
279283
{
280284
//Call DODAG preference
281-
#ifdef HAVE_RPL
282285
protocol_interface_info_entry_t *interface_ptr = lb_user;
283286
if (!interface_ptr->rpl_domain || interface_ptr->rpl_domain != protocol_6lowpan_rpl_domain || !protocol_6lowpan_rpl_root_dodag) {
284287
return -1;
@@ -290,12 +293,9 @@ static int8_t net_load_balance_api_get_set_load_level_cb(void *lb_user, uint8_t
290293

291294
rpl_control_set_dodag_pref(protocol_6lowpan_rpl_root_dodag, RPL_DODAG_PREF_MASK - load_level);
292295
return 0;
293-
294-
#else
295-
return -1;
296-
#endif
297296
}
298-
297+
#endif
298+
#endif
299299

300300
int8_t net_load_balance_load_level_update_enable(int8_t interface_id, uint16_t expected_device_count)
301301
{

0 commit comments

Comments
 (0)