diff --git a/source/6LoWPAN/Thread/thread_extension.c b/source/6LoWPAN/Thread/thread_extension.c index 258232e1b393..c83be2aa8f61 100644 --- a/source/6LoWPAN/Thread/thread_extension.c +++ b/source/6LoWPAN/Thread/thread_extension.c @@ -698,7 +698,6 @@ static void thread_extension_relay_socket_cb(void *cb_res) uint16_t payload_len; char *destination_uri_ptr = THREAD_URI_RELAY_RECEIVE; sckt_data = cb_res; - int ret MAYBE_UNUSED = -1; protocol_interface_info_entry_t *cur = protocol_stack_interface_info_get_by_id(sckt_data->interface_id); diff --git a/source/6LoWPAN/Thread/thread_router_bootstrap.c b/source/6LoWPAN/Thread/thread_router_bootstrap.c index aead13e6a452..4521b4fc1993 100644 --- a/source/6LoWPAN/Thread/thread_router_bootstrap.c +++ b/source/6LoWPAN/Thread/thread_router_bootstrap.c @@ -1216,7 +1216,7 @@ uint16_t thread_router_bootstrap_child_count_get(protocol_interface_info_entry_t } mle_neigh_table_list_t *mle_table = mle_class_active_list_get(cur->id); if (!mle_table) { - return -1; + return 0; } ns_list_foreach(mle_neigh_table_entry_t, cur_entry, mle_table) { if (thread_router_addr_from_addr(cur_entry->short_adr) == router_address) { @@ -1230,12 +1230,12 @@ static uint16_t thread_router_bootstrap_child_address_generate(protocol_interfac { mle_neigh_table_list_t *mle_table = mle_class_active_list_get(cur->id); if (!mle_table) { - return -1; + return 0xfffe; } if (thread_router_bootstrap_child_count_get(cur) >= cur->thread_info->maxChildCount) { tr_info("Maximum count %d reached", cur->thread_info->maxChildCount); - return 0xffff; + return 0xfffe; } bool address_allocated = false; @@ -1254,7 +1254,7 @@ static uint16_t thread_router_bootstrap_child_address_generate(protocol_interfac } if (address_allocated){ // all possible addresses already allocated - return 0xffff; + return 0xfffe; } return ((mac_helper_mac16_address_get(cur) & THREAD_ROUTER_MASK) | cur->thread_info->lastAllocatedChildAddress); } @@ -1262,16 +1262,16 @@ static uint16_t thread_router_bootstrap_child_address_generate(protocol_interfac static bool thread_child_id_request(protocol_interface_info_entry_t *cur, mle_neigh_table_entry_t *entry_temp) { //Remove All Short address links from router - if (entry_temp->short_adr != 0xffff) { + if (entry_temp->short_adr < 0xfffe) { protocol_6lowpan_release_short_link_address_from_neighcache(cur, entry_temp->short_adr); } - //allocate child address if current is router, 0xffff or not our child + //allocate child address if current is router, >0xfffe or not our child if (!thread_addr_is_child(mac_helper_mac16_address_get(cur), entry_temp->short_adr)) { entry_temp->short_adr = thread_router_bootstrap_child_address_generate(cur); } - if (entry_temp->short_adr == 0xffff) { + if (entry_temp->short_adr >= 0xfffe) { return false; } @@ -1900,9 +1900,9 @@ void thread_router_bootstrap_mle_receive_cb(int8_t interface_id, mle_message_t * uint32_t timeout = 0; uint64_t active_timestamp = 0; uint64_t pending_timestamp = 0; - mle_tlv_info_t addressRegisterTlv = {0}; - mle_tlv_info_t challengeTlv = {0}; - mle_tlv_info_t tlv_req = {0}; + mle_tlv_info_t addressRegisterTlv = {.tlvType = MLE_TYPE_SRC_ADDRESS}; + mle_tlv_info_t challengeTlv = {.tlvType = MLE_TYPE_SRC_ADDRESS}; + mle_tlv_info_t tlv_req = {.tlvType = MLE_TYPE_SRC_ADDRESS}; entry_temp = mle_class_get_entry_by_ll64(cur->id, linkMargin, mle_msg->packet_src_address, false, NULL); if (mle_tlv_read_8_bit_tlv(MLE_TYPE_STATUS, mle_msg->data_ptr, mle_msg->data_length, &status)) { diff --git a/source/6LoWPAN/Thread/thread_router_bootstrap.h b/source/6LoWPAN/Thread/thread_router_bootstrap.h index faf2f7db0d6b..3a834698c41b 100644 --- a/source/6LoWPAN/Thread/thread_router_bootstrap.h +++ b/source/6LoWPAN/Thread/thread_router_bootstrap.h @@ -64,7 +64,7 @@ void thread_router_bootstrap_active_router_attach(struct protocol_interface_info int thread_router_bootstrap_route_tlv_push(protocol_interface_info_entry_t *cur, uint8_t *route_tlv, uint8_t route_len, uint8_t linkMargin, mle_neigh_table_entry_t *entry); void thread_router_bootstrap_mle_receive_cb(int8_t interface_id, mle_message_t *mle_msg, struct mle_security_header *security_headers); void thread_router_bootstrap_timer(protocol_interface_info_entry_t *cur, uint32_t ticks); -uint32_t thread_router_bootstrap_random_upgrade_jitter(); +uint32_t thread_router_bootstrap_random_upgrade_jitter(void); void thread_router_bootstrap_advertiment_analyze(protocol_interface_info_entry_t *cur, uint8_t *src_address, mle_neigh_table_entry_t *entry_temp, uint16_t shortAddress); void thread_router_bootstrap_multicast_forwarder_enable(protocol_interface_info_entry_t *cur, buffer_t *buf); diff --git a/source/6LoWPAN/Thread/thread_routing.c b/source/6LoWPAN/Thread/thread_routing.c index 13bc600d386d..e71563b77bc4 100644 --- a/source/6LoWPAN/Thread/thread_routing.c +++ b/source/6LoWPAN/Thread/thread_routing.c @@ -183,7 +183,7 @@ static inline thread_link_quality_e thread_quality_combine(thread_link_quality_e /* Return the quality (worse of incoming and outgoing quality) for a neighbour router */ static inline thread_link_quality_e thread_neighbour_router_quality(const thread_router_link_t *neighbour) { - return thread_quality_combine(neighbour->incoming_quality, neighbour->outgoing_quality); + return thread_quality_combine((thread_link_quality_e) neighbour->incoming_quality, (thread_link_quality_e) neighbour->outgoing_quality); } @@ -690,8 +690,8 @@ int_fast8_t thread_routing_add_link(protocol_interface_info_entry_t *cur, if (our_quality_to_other_neighbour < QUALITY_10dB) { continue; } - thread_link_quality_e neighbours_incoming_quality_to_other_neighbour = (byte & ROUTE_DATA_IN_MASK) >> ROUTE_DATA_IN_SHIFT; - thread_link_quality_e neighbours_outgoing_quality_to_other_neighbour = (byte & ROUTE_DATA_OUT_MASK) >> ROUTE_DATA_OUT_SHIFT; + thread_link_quality_e neighbours_incoming_quality_to_other_neighbour = (thread_link_quality_e) ((byte & ROUTE_DATA_IN_MASK) >> ROUTE_DATA_IN_SHIFT); + thread_link_quality_e neighbours_outgoing_quality_to_other_neighbour = (thread_link_quality_e) ((byte & ROUTE_DATA_OUT_MASK) >> ROUTE_DATA_OUT_SHIFT); thread_link_quality_e neighbours_quality_to_other_neighbour = thread_quality_combine(neighbours_incoming_quality_to_other_neighbour, neighbours_outgoing_quality_to_other_neighbour); if (neighbours_quality_to_other_neighbour < our_quality_to_other_neighbour) { diff --git a/source/MAC/IEEE802_15_4/mac_mcps_sap.c b/source/MAC/IEEE802_15_4/mac_mcps_sap.c index eafdeb6b2533..64d0cab44ec0 100644 --- a/source/MAC/IEEE802_15_4/mac_mcps_sap.c +++ b/source/MAC/IEEE802_15_4/mac_mcps_sap.c @@ -227,8 +227,8 @@ static int8_t mac_virtual_mlme_nap_req_handler(protocol_interface_rf_mac_setup_s } mlme_scan_t mlme_scan_req; - mlme_scan_req.ScanType = *ptr++; - mlme_scan_req.ScanChannels.channel_page = *ptr++; + mlme_scan_req.ScanType = (mac_scan_type_t) *ptr++; + mlme_scan_req.ScanChannels.channel_page = (channel_page_e) *ptr++; memcpy(mlme_scan_req.ScanChannels.channel_mask, ptr, 32); ptr += 32; mlme_scan_req.ScanDuration = *ptr++; @@ -239,14 +239,13 @@ static int8_t mac_virtual_mlme_nap_req_handler(protocol_interface_rf_mac_setup_s memcpy(mlme_scan_req.Key.Keysource, ptr, 8); mac_mlme_scan_request(&mlme_scan_req, rf_mac_setup); return 0; - break; } case MLME_SET:{ if (mlme_req->ptr_length < 3) { return -1; } mlme_set_t mlme_set_req; - mlme_set_req.attr = *ptr++; + mlme_set_req.attr = (mlme_attr_t) *ptr++; mlme_set_req.attr_index = *ptr++; mlme_set_req.value_pointer = ptr; mlme_set_req.value_size = mlme_req->ptr_length - 2; diff --git a/source/MAC/IEEE802_15_4/mac_mlme.c b/source/MAC/IEEE802_15_4/mac_mlme.c index 56431691547a..a5544f097162 100644 --- a/source/MAC/IEEE802_15_4/mac_mlme.c +++ b/source/MAC/IEEE802_15_4/mac_mlme.c @@ -1255,7 +1255,7 @@ int8_t mac_mlme_virtual_confirmation_handle(int8_t driver_id, const uint8_t *dat if (!mac_setup) { return -1; } - mlme_primitive primitive = *data_ptr; + mlme_primitive primitive = (mlme_primitive) *data_ptr; if (primitive == MLME_SCAN) { mlme_scan_conf_t *resp = ns_dyn_mem_temporary_alloc(sizeof(mlme_scan_conf_t)); if (!resp) { diff --git a/source/MAC/virtual_rf/virtual_rf_client.c b/source/MAC/virtual_rf/virtual_rf_client.c index b81b2564dc37..e0bdeffd9f8d 100644 --- a/source/MAC/virtual_rf/virtual_rf_client.c +++ b/source/MAC/virtual_rf/virtual_rf_client.c @@ -138,7 +138,7 @@ static int8_t phy_rf_virtual_rx(const uint8_t *data_ptr, uint16_t data_len,int8_ return -1; } phy_msg.id = MACTUN_MLME_NAP_EXTENSION; - phy_msg.message.mlme_request.primitive = *data_ptr++; + phy_msg.message.mlme_request.primitive = (mlme_primitive) *data_ptr++; phy_msg.message.mlme_request.mlme_ptr = data_ptr; phy_msg.message.mlme_request.ptr_length = (data_len - 2); diff --git a/source/Service_Libs/mdns/ns_fnet_port.c b/source/Service_Libs/mdns/ns_fnet_port.c index e2cce7555c27..63e904b1911c 100644 --- a/source/Service_Libs/mdns/ns_fnet_port.c +++ b/source/Service_Libs/mdns/ns_fnet_port.c @@ -131,7 +131,7 @@ fnet_socket_t fnet_socket(fnet_address_family_t family, fnet_socket_type_t type, fnet_return_t fnet_socket_bind( fnet_socket_t s, const struct sockaddr *name, fnet_size_t namelen ) { (void)namelen; - ns_address_t ns_source_addr = {0}; + ns_address_t ns_source_addr; int8_t socket_id = (int8_t)(long)s; fnet_return_t fnet_ret_val = FNET_ERR; const struct sockaddr_in6 *namein6 = (const struct sockaddr_in6 *) name; diff --git a/source/libNET/src/multicast_api.c b/source/libNET/src/multicast_api.c index 2b21ad44d83e..4e24ff555e94 100644 --- a/source/libNET/src/multicast_api.c +++ b/source/libNET/src/multicast_api.c @@ -185,7 +185,7 @@ int_fast8_t multicast_mpl_set_default_parameters(int8_t interface_id, uint8_t control_message_k, uint8_t control_message_timer_expirations) { - protocol_interface_info_entry_t *interface = protocol_stack_interface_info_get(interface_id); + protocol_interface_info_entry_t *interface = protocol_stack_interface_info_get_by_id(interface_id); if (!interface) { return -1; }