From 4e7dfcabb57ea1f6e787ab62c9281badc1d2990e Mon Sep 17 00:00:00 2001 From: Arto Kinnunen Date: Tue, 22 Jun 2021 12:42:13 +0300 Subject: [PATCH] Squashed 'features/nanostack/sal-stack-nanostack/' changes from 0903b819c5..4a3c5c525b 4a3c5c525b Merge remote-tracking branch 'origin/release_internal' into release_external 2b8d2e1356 Do not reset radio when MAC data request timeouts (#2647) 95c506a276 Frame counters for nw keys are now stored to NVM only after send key is set (#2641) 3b3010a79b Adjusted stagger random to [min,min+max] and for small nw set the stagger value to 10 seconds 02bc33a242 Adjusted security protocol (EAP-TLS,4WH,2WH) retry timers eb26726020 High Priority timestamp compare overflow support fix. 928723a33e FHSS WS: Initialize broadcast channel count when enabling FHSS (#2642) 6040d703c8 Updated change log 667b191223 Changed initial EAPOL-key retries from trickle to exponential backup d925145d33 Add RTT calculation for DHCP Time calculation 0b82953567 Traceroute bug fix. 04de6e26d8 Merge pull request #2638 from PelionIoT/mbed_os_fix_ufsi_calculation 20123477c6 Fixed FHSS UFSI calculation unit tests 436f16e84f Handle timer rollover in calculate_ufsi 411cf5c7a4 coding style d6f44218d6 Correct ufsi timing calculation 560619d85d Add network time vendor data element to DHCPv6 reply message 6d290dc3c1 System time read/write callbacks (#2637) 7905df666d Restart or remove transmission when MAC data request timeouts (#2636) c97695cfc6 Bug fix: EAPOL parent compare fix e283e6285c Fixed channel mask usage with OFDM configurations (#2633) 24168f891b Do not send too old packets (#2632) dbd83be16d Fix copyrights (#2631) 7f0cffdbf7 Merge pull request #2630 from PelionIoT/use_pelion_copyright 511bd5a3ad Corrected coding style 57ec0281a8 Corrected comparison 7d853de862 When EAPOL waiting queue is full oldest entry is removed acf580fbd0 Update copyright in changed MDNS files 933c0bbf0a Update copyright 3aeb2af77c Statistics for data request latencies (#2629) 3f7eae64ef EAPOL FHSS temp entry discover 5200b666e7 DHCP time elapsed time write fix. 0536874f64 Removed empty EAPOL-key message send after 4WH completion to nodes on relay 8a2a683aef Fixed DHCP wrong time elapsed value write. 283f2ee685 DHCPv6 update: 99be7783ec EAPOL temp neighbour update 4f9e3d12ab Adaptation layer to remove oldest packet first 20f1f6492f Added ignoring of retry messages from RADIUS server when waiting EAP-TLS 8a8b407c47 Add RSL check for ETX Calculation for RPL parent selection c05e1da757 Fix DHCP server Uninitialized memory read 77229eefa6 Fix CPP error from domain prefix check 7e47889111 support filtering of EAPOL parents based device-min-sens configuration 618a19192c Wi-SUN Expedite forward state update 4371462d66 Fix NULL read from RPL header addition 7802c7ee97 Update CHANGELOG.md b2c810402c CHANGELOG for Nanostack v13.0.0 (#2615) git-subtree-dir: features/nanostack/sal-stack-nanostack git-subtree-split: 4a3c5c525b2a62c19ecfb0ac64d09bd2a7f56ceb --- LICENSE-Apache-2.0 | 2 +- LICENSE-BSD-3-Clause | 2 +- nanostack/cca_api.h | 2 +- nanostack/ccmLIB.h | 2 +- nanostack/dhcp_service_api.h | 15 +- nanostack/ethernet_mac_api.h | 2 +- nanostack/fhss_api.h | 2 +- nanostack/fhss_config.h | 2 +- nanostack/fhss_test_api.h | 2 +- nanostack/fhss_ws_extension.h | 2 +- nanostack/mac_api.h | 3 +- nanostack/mac_common_defines.h | 2 +- nanostack/mac_filter_api.h | 2 +- nanostack/mac_mcps.h | 2 +- nanostack/mlme.h | 2 +- nanostack/multicast_api.h | 2 +- nanostack/net_6lowpan_parameter_api.h | 2 +- nanostack/net_address_extension.h | 2 +- nanostack/net_fhss.h | 2 +- nanostack/net_interface.h | 2 +- nanostack/net_ipv6_api.h | 2 +- nanostack/net_load_balance_api.h | 2 +- nanostack/net_mle_api.h | 2 +- nanostack/net_nvm_api.h | 2 +- nanostack/net_nwk_scan.h | 2 +- nanostack/net_pana_parameters_api.h | 2 +- nanostack/net_polling_api.h | 2 +- nanostack/net_rpl.h | 2 +- nanostack/net_sleep.h | 2 +- nanostack/net_test_api.h | 2 +- nanostack/net_thread_test.h | 2 +- nanostack/net_ws_test.h | 2 +- nanostack/ns_address.h | 2 +- nanostack/ns_conf.h | 2 +- nanostack/ns_file_system.h | 2 +- nanostack/ns_mdns_api.h | 2 +- nanostack/ns_sha256.h | 2 +- nanostack/ns_time_api.h | 32 ++- nanostack/ns_virtual_rf_api.h | 2 +- nanostack/nwk_stats_api.h | 3 +- nanostack/platform/arm_hal_aes.h | 2 +- nanostack/platform/arm_hal_phy.h | 2 +- nanostack/platform/os_whiteboard.h | 2 +- nanostack/platform/topo_trace.h | 2 +- nanostack/serial_mac_api.h | 2 +- nanostack/shalib.h | 2 +- nanostack/socket_api.h | 2 +- nanostack/sw_mac.h | 2 +- nanostack/thread_bbr_api.h | 2 +- nanostack/thread_border_router_api.h | 2 +- nanostack/thread_commissioning_api.h | 2 +- nanostack/thread_dhcpv6_server.h | 2 +- nanostack/thread_diagcop_lib.h | 2 +- nanostack/thread_lowpower_api.h | 2 +- nanostack/thread_management_api.h | 2 +- nanostack/thread_management_if.h | 2 +- nanostack/thread_meshcop_lib.h | 2 +- nanostack/thread_net_config_api.h | 2 +- nanostack/whiteboard_api.h | 2 +- nanostack/ws_bbr_api.h | 2 +- nanostack/ws_management_api.h | 12 +- .../6LoWPAN/Bootstraps/Generic/network_lib.c | 2 +- .../Bootstraps/Generic/protocol_6lowpan.c | 11 +- .../Generic/protocol_6lowpan_bootstrap.c | 2 +- .../Generic/protocol_6lowpan_interface.c | 2 +- source/6LoWPAN/Bootstraps/network_lib.h | 2 +- source/6LoWPAN/Bootstraps/protocol_6lowpan.h | 2 +- .../Bootstraps/protocol_6lowpan_bootstrap.h | 2 +- .../Bootstraps/protocol_6lowpan_interface.h | 2 +- .../6LoWPAN/Fragmentation/cipv6_fragmenter.c | 2 +- .../6LoWPAN/Fragmentation/cipv6_fragmenter.h | 2 +- source/6LoWPAN/IPHC_Decode/6lowpan_iphc.c | 2 +- source/6LoWPAN/IPHC_Decode/cipv6.h | 2 +- source/6LoWPAN/IPHC_Decode/iphc_compress.c | 2 +- source/6LoWPAN/IPHC_Decode/iphc_compress.h | 2 +- source/6LoWPAN/IPHC_Decode/iphc_decompress.c | 2 +- source/6LoWPAN/IPHC_Decode/iphc_decompress.h | 2 +- source/6LoWPAN/IPHC_Decode/lowpan_context.c | 2 +- source/6LoWPAN/IPHC_Decode/lowpan_context.h | 2 +- source/6LoWPAN/MAC/beacon_handler.c | 2 +- source/6LoWPAN/MAC/beacon_handler.h | 2 +- source/6LoWPAN/MAC/mac_data_poll.c | 2 +- source/6LoWPAN/MAC/mac_data_poll.h | 2 +- source/6LoWPAN/MAC/mac_helper.c | 2 +- source/6LoWPAN/MAC/mac_helper.h | 2 +- source/6LoWPAN/MAC/mac_ie_lib.c | 2 +- source/6LoWPAN/MAC/mac_ie_lib.h | 2 +- source/6LoWPAN/MAC/mac_pairwise_key.c | 2 +- source/6LoWPAN/MAC/mac_pairwise_key.h | 2 +- source/6LoWPAN/MAC/mac_response_handler.c | 2 +- source/6LoWPAN/MAC/mac_response_handler.h | 2 +- source/6LoWPAN/MAC/mpx_api.h | 2 +- source/6LoWPAN/Mesh/mesh.c | 2 +- source/6LoWPAN/Mesh/mesh.h | 2 +- source/6LoWPAN/ND/nd_defines.h | 2 +- source/6LoWPAN/ND/nd_router_object.c | 2 +- source/6LoWPAN/ND/nd_router_object.h | 2 +- source/6LoWPAN/NVM/nwk_nvm.c | 2 +- source/6LoWPAN/NVM/nwk_nvm.h | 2 +- source/6LoWPAN/Thread/thread_bbr_api.c | 2 +- .../6LoWPAN/Thread/thread_bbr_api_internal.h | 2 +- source/6LoWPAN/Thread/thread_bbr_commercial.c | 4 +- source/6LoWPAN/Thread/thread_bbr_commercial.h | 2 +- source/6LoWPAN/Thread/thread_beacon.c | 2 +- source/6LoWPAN/Thread/thread_beacon.h | 2 +- source/6LoWPAN/Thread/thread_bootstrap.c | 2 +- source/6LoWPAN/Thread/thread_bootstrap.h | 2 +- .../6LoWPAN/Thread/thread_border_router_api.c | 2 +- .../thread_border_router_api_internal.h | 2 +- source/6LoWPAN/Thread/thread_ccm.c | 2 +- source/6LoWPAN/Thread/thread_ccm.h | 2 +- .../6LoWPAN/Thread/thread_commissioning_api.c | 2 +- .../6LoWPAN/Thread/thread_commissioning_if.c | 2 +- .../6LoWPAN/Thread/thread_commissioning_if.h | 2 +- source/6LoWPAN/Thread/thread_common.c | 2 +- source/6LoWPAN/Thread/thread_common.h | 2 +- source/6LoWPAN/Thread/thread_config.h | 2 +- source/6LoWPAN/Thread/thread_constants.h | 2 +- source/6LoWPAN/Thread/thread_dhcpv6_server.c | 2 +- source/6LoWPAN/Thread/thread_dhcpv6_server.h | 2 +- source/6LoWPAN/Thread/thread_diagnostic.c | 2 +- source/6LoWPAN/Thread/thread_diagnostic.h | 2 +- source/6LoWPAN/Thread/thread_discovery.c | 2 +- source/6LoWPAN/Thread/thread_discovery.h | 2 +- source/6LoWPAN/Thread/thread_host_bootstrap.c | 2 +- source/6LoWPAN/Thread/thread_host_bootstrap.h | 2 +- .../Thread/thread_joiner_application.c | 2 +- .../Thread/thread_joiner_application.h | 2 +- source/6LoWPAN/Thread/thread_leader_service.c | 2 +- source/6LoWPAN/Thread/thread_leader_service.h | 2 +- source/6LoWPAN/Thread/thread_lowpower_api.c | 2 +- .../Thread/thread_lowpower_private_api.c | 2 +- .../Thread/thread_lowpower_private_api.h | 2 +- source/6LoWPAN/Thread/thread_management_api.c | 2 +- .../6LoWPAN/Thread/thread_management_client.c | 2 +- .../6LoWPAN/Thread/thread_management_client.h | 2 +- source/6LoWPAN/Thread/thread_management_if.c | 2 +- .../Thread/thread_management_internal.h | 2 +- .../6LoWPAN/Thread/thread_management_server.c | 2 +- .../6LoWPAN/Thread/thread_management_server.h | 2 +- source/6LoWPAN/Thread/thread_mdns.c | 2 +- source/6LoWPAN/Thread/thread_mdns.h | 2 +- source/6LoWPAN/Thread/thread_meshcop_lib.c | 2 +- .../Thread/thread_mle_message_handler.c | 2 +- .../Thread/thread_mle_message_handler.h | 2 +- source/6LoWPAN/Thread/thread_nd.c | 2 +- source/6LoWPAN/Thread/thread_nd.h | 2 +- source/6LoWPAN/Thread/thread_neighbor_class.c | 2 +- source/6LoWPAN/Thread/thread_neighbor_class.h | 2 +- source/6LoWPAN/Thread/thread_net_config_api.c | 2 +- .../6LoWPAN/Thread/thread_network_data_lib.c | 2 +- .../6LoWPAN/Thread/thread_network_data_lib.h | 2 +- .../Thread/thread_network_data_storage.c | 2 +- .../Thread/thread_network_data_storage.h | 2 +- source/6LoWPAN/Thread/thread_network_synch.c | 2 +- source/6LoWPAN/Thread/thread_network_synch.h | 2 +- source/6LoWPAN/Thread/thread_nvm_store.c | 2 +- source/6LoWPAN/Thread/thread_nvm_store.h | 2 +- .../6LoWPAN/Thread/thread_resolution_client.c | 2 +- .../6LoWPAN/Thread/thread_resolution_client.h | 2 +- .../6LoWPAN/Thread/thread_resolution_server.c | 2 +- .../6LoWPAN/Thread/thread_resolution_server.h | 2 +- .../6LoWPAN/Thread/thread_router_bootstrap.c | 2 +- .../6LoWPAN/Thread/thread_router_bootstrap.h | 2 +- source/6LoWPAN/Thread/thread_routing.c | 2 +- source/6LoWPAN/Thread/thread_routing.h | 2 +- source/6LoWPAN/Thread/thread_test_api.c | 2 +- source/6LoWPAN/Thread/thread_tmfcop_lib.h | 2 +- source/6LoWPAN/adaptation_interface.c | 190 ++++++++----- source/6LoWPAN/lowpan_adaptation_interface.h | 4 +- source/6LoWPAN/ws/ws_bbr_api.c | 50 +++- source/6LoWPAN/ws/ws_bbr_api_internal.h | 2 +- source/6LoWPAN/ws/ws_bootstrap.c | 186 +++++++------ source/6LoWPAN/ws/ws_bootstrap.h | 6 +- source/6LoWPAN/ws/ws_cfg_settings.c | 56 ++-- source/6LoWPAN/ws/ws_cfg_settings.h | 10 +- source/6LoWPAN/ws/ws_common.c | 29 +- source/6LoWPAN/ws/ws_common.h | 10 +- source/6LoWPAN/ws/ws_common_defines.h | 2 +- source/6LoWPAN/ws/ws_config.h | 76 ++++-- source/6LoWPAN/ws/ws_eapol_auth_relay.c | 9 +- source/6LoWPAN/ws/ws_eapol_auth_relay.h | 2 +- source/6LoWPAN/ws/ws_eapol_pdu.c | 2 +- source/6LoWPAN/ws/ws_eapol_pdu.h | 2 +- source/6LoWPAN/ws/ws_eapol_relay.c | 2 +- source/6LoWPAN/ws/ws_eapol_relay.h | 2 +- source/6LoWPAN/ws/ws_eapol_relay_lib.c | 2 +- source/6LoWPAN/ws/ws_eapol_relay_lib.h | 2 +- source/6LoWPAN/ws/ws_empty_functions.c | 7 +- source/6LoWPAN/ws/ws_ie_lib.c | 2 +- source/6LoWPAN/ws/ws_ie_lib.h | 2 +- source/6LoWPAN/ws/ws_llc.h | 6 +- source/6LoWPAN/ws/ws_llc_data_service.c | 202 +++++++++----- source/6LoWPAN/ws/ws_management_api.c | 2 +- source/6LoWPAN/ws/ws_mpx_header.c | 2 +- source/6LoWPAN/ws/ws_mpx_header.h | 2 +- source/6LoWPAN/ws/ws_neighbor_class.c | 2 +- source/6LoWPAN/ws/ws_neighbor_class.h | 2 +- source/6LoWPAN/ws/ws_pae_auth.c | 27 +- source/6LoWPAN/ws/ws_pae_auth.h | 2 +- source/6LoWPAN/ws/ws_pae_controller.c | 56 ++-- source/6LoWPAN/ws/ws_pae_controller.h | 2 +- source/6LoWPAN/ws/ws_pae_key_storage.c | 2 +- source/6LoWPAN/ws/ws_pae_key_storage.h | 2 +- source/6LoWPAN/ws/ws_pae_lib.c | 2 +- source/6LoWPAN/ws/ws_pae_lib.h | 2 +- source/6LoWPAN/ws/ws_pae_nvm_data.c | 2 +- source/6LoWPAN/ws/ws_pae_nvm_data.h | 2 +- source/6LoWPAN/ws/ws_pae_nvm_store.c | 2 +- source/6LoWPAN/ws/ws_pae_nvm_store.h | 2 +- source/6LoWPAN/ws/ws_pae_supp.c | 250 +++++++++--------- source/6LoWPAN/ws/ws_pae_supp.h | 2 +- source/6LoWPAN/ws/ws_pae_time.c | 22 +- source/6LoWPAN/ws/ws_pae_time.h | 2 +- source/6LoWPAN/ws/ws_pae_timers.c | 2 +- source/6LoWPAN/ws/ws_pae_timers.h | 2 +- source/6LoWPAN/ws/ws_stats.c | 2 +- source/6LoWPAN/ws/ws_stats.h | 2 +- source/6LoWPAN/ws/ws_test_api.c | 2 +- source/BorderRouter/border_router.c | 2 +- source/BorderRouter/border_router.h | 2 +- source/Common_Protocols/icmpv6.c | 2 +- source/Common_Protocols/icmpv6.h | 2 +- source/Common_Protocols/icmpv6_prefix.c | 2 +- source/Common_Protocols/icmpv6_prefix.h | 2 +- source/Common_Protocols/icmpv6_radv.c | 2 +- source/Common_Protocols/icmpv6_radv.h | 2 +- source/Common_Protocols/ip.h | 2 +- source/Common_Protocols/ipv6.c | 2 +- source/Common_Protocols/ipv6.h | 2 +- source/Common_Protocols/ipv6_constants.h | 2 +- source/Common_Protocols/ipv6_flow.c | 2 +- source/Common_Protocols/ipv6_flow.h | 2 +- source/Common_Protocols/ipv6_fragmentation.c | 2 +- source/Common_Protocols/ipv6_fragmentation.h | 2 +- source/Common_Protocols/ipv6_resolution.c | 2 +- source/Common_Protocols/ipv6_resolution.h | 2 +- source/Common_Protocols/mld.c | 2 +- source/Common_Protocols/mld.h | 2 +- source/Common_Protocols/tcp.c | 2 +- source/Common_Protocols/tcp.h | 2 +- source/Common_Protocols/udp.c | 2 +- source/Common_Protocols/udp.h | 2 +- source/Core/buffer_dyn.c | 2 +- source/Core/include/ns_address_internal.h | 2 +- source/Core/include/ns_buffer.h | 3 +- source/Core/include/ns_error_types.h | 2 +- source/Core/include/ns_monitor.h | 2 +- source/Core/include/ns_socket.h | 2 +- source/Core/include/sockbuf.h | 2 +- source/Core/ns_address_internal.c | 2 +- source/Core/ns_monitor.c | 2 +- source/Core/ns_socket.c | 2 +- source/Core/sockbuf.c | 2 +- source/DHCPv6_Server/DHCPv6_Server_service.c | 43 +-- source/DHCPv6_Server/DHCPv6_server_service.h | 6 +- source/DHCPv6_client/dhcpv6_client_api.h | 6 +- source/DHCPv6_client/dhcpv6_client_service.c | 25 +- source/MAC/IEEE802_15_4/mac_cca_threshold.c | 2 +- source/MAC/IEEE802_15_4/mac_cca_threshold.h | 2 +- source/MAC/IEEE802_15_4/mac_data_buffer.h | 3 +- source/MAC/IEEE802_15_4/mac_defines.h | 2 +- source/MAC/IEEE802_15_4/mac_fhss_callbacks.c | 2 +- source/MAC/IEEE802_15_4/mac_fhss_callbacks.h | 2 +- source/MAC/IEEE802_15_4/mac_filter.c | 2 +- source/MAC/IEEE802_15_4/mac_filter.h | 2 +- .../mac_header_helper_functions.c | 2 +- .../mac_header_helper_functions.h | 2 +- source/MAC/IEEE802_15_4/mac_indirect_data.c | 2 +- source/MAC/IEEE802_15_4/mac_indirect_data.h | 2 +- source/MAC/IEEE802_15_4/mac_mcps_sap.c | 69 +++-- source/MAC/IEEE802_15_4/mac_mcps_sap.h | 4 +- source/MAC/IEEE802_15_4/mac_mlme.c | 4 +- source/MAC/IEEE802_15_4/mac_mlme.h | 2 +- source/MAC/IEEE802_15_4/mac_pd_sap.c | 2 +- source/MAC/IEEE802_15_4/mac_pd_sap.h | 2 +- source/MAC/IEEE802_15_4/mac_security_mib.c | 2 +- source/MAC/IEEE802_15_4/mac_security_mib.h | 2 +- source/MAC/IEEE802_15_4/mac_timer.c | 2 +- source/MAC/IEEE802_15_4/mac_timer.h | 2 +- source/MAC/IEEE802_15_4/sw_mac.c | 7 +- source/MAC/IEEE802_15_4/sw_mac_internal.h | 3 +- source/MAC/ethernet/ethernet_mac_api.c | 2 +- source/MAC/rf_driver_storage.c | 2 +- source/MAC/rf_driver_storage.h | 2 +- source/MAC/serial/serial_mac_api.c | 2 +- source/MAC/virtual_rf/virtual_rf_client.c | 2 +- source/MAC/virtual_rf/virtual_rf_defines.h | 2 +- source/MAC/virtual_rf/virtual_rf_driver.c | 2 +- source/MLE/mle.c | 2 +- source/MLE/mle.h | 2 +- source/MLE/mle_tlv.c | 2 +- source/MLE/mle_tlv.h | 2 +- source/MPL/mpl.c | 2 +- source/MPL/mpl.h | 2 +- source/NWK_INTERFACE/Include/protocol.h | 2 +- .../NWK_INTERFACE/Include/protocol_abstract.h | 2 +- source/NWK_INTERFACE/Include/protocol_stats.h | 5 +- source/NWK_INTERFACE/Include/protocol_timer.h | 2 +- source/NWK_INTERFACE/protocol_core.c | 2 +- source/NWK_INTERFACE/protocol_core_sleep.c | 2 +- source/NWK_INTERFACE/protocol_stats.c | 7 +- source/NWK_INTERFACE/protocol_timer.c | 2 +- source/RPL/rpl_control.c | 2 +- source/RPL/rpl_control.h | 2 +- source/RPL/rpl_data.c | 10 +- source/RPL/rpl_data.h | 2 +- source/RPL/rpl_downward.c | 2 +- source/RPL/rpl_downward.h | 2 +- source/RPL/rpl_mrhof.c | 2 +- source/RPL/rpl_mrhof.h | 2 +- source/RPL/rpl_objective.c | 2 +- source/RPL/rpl_objective.h | 2 +- source/RPL/rpl_of0.c | 2 +- source/RPL/rpl_of0.h | 2 +- source/RPL/rpl_policy.c | 2 +- source/RPL/rpl_policy.h | 2 +- source/RPL/rpl_protocol.h | 2 +- source/RPL/rpl_structures.h | 2 +- source/RPL/rpl_upward.c | 5 +- source/RPL/rpl_upward.h | 2 +- source/Security/Common/sec_lib.h | 2 +- source/Security/Common/sec_lib_definitions.h | 2 +- source/Security/Common/security_lib.c | 2 +- source/Security/PANA/eap_protocol.c | 2 +- source/Security/PANA/eap_protocol.h | 2 +- source/Security/PANA/pana.c | 2 +- source/Security/PANA/pana.h | 2 +- source/Security/PANA/pana_avp.c | 2 +- source/Security/PANA/pana_avp.h | 2 +- source/Security/PANA/pana_client.c | 2 +- source/Security/PANA/pana_eap_header.c | 2 +- source/Security/PANA/pana_eap_header.h | 2 +- source/Security/PANA/pana_header.c | 2 +- source/Security/PANA/pana_header.h | 2 +- source/Security/PANA/pana_internal_api.h | 2 +- source/Security/PANA/pana_nvm.h | 2 +- source/Security/PANA/pana_relay_table.c | 2 +- source/Security/PANA/pana_relay_table.h | 2 +- source/Security/PANA/pana_server.c | 2 +- source/Security/TLS/tls_ccm_crypt.c | 2 +- source/Security/TLS/tls_ccm_crypt.h | 2 +- source/Security/TLS/tls_lib.c | 2 +- source/Security/TLS/tls_lib.h | 2 +- source/Security/eapol/eapol_helper.c | 2 +- source/Security/eapol/eapol_helper.h | 2 +- source/Security/eapol/kde_helper.c | 2 +- source/Security/eapol/kde_helper.h | 2 +- source/Security/kmp/kmp_addr.c | 2 +- source/Security/kmp/kmp_addr.h | 2 +- source/Security/kmp/kmp_api.c | 2 +- source/Security/kmp/kmp_api.h | 3 +- source/Security/kmp/kmp_eapol_pdu_if.c | 2 +- source/Security/kmp/kmp_eapol_pdu_if.h | 2 +- source/Security/kmp/kmp_socket_if.c | 2 +- source/Security/kmp/kmp_socket_if.h | 2 +- .../eap_tls_sec_prot/auth_eap_tls_sec_prot.c | 2 +- .../eap_tls_sec_prot/auth_eap_tls_sec_prot.h | 2 +- .../eap_tls_sec_prot/eap_tls_sec_prot_lib.c | 2 +- .../eap_tls_sec_prot/eap_tls_sec_prot_lib.h | 2 +- .../radius_eap_tls_sec_prot.c | 2 +- .../radius_eap_tls_sec_prot.h | 2 +- .../eap_tls_sec_prot/supp_eap_tls_sec_prot.c | 2 +- .../eap_tls_sec_prot/supp_eap_tls_sec_prot.h | 2 +- .../fwh_sec_prot/auth_fwh_sec_prot.c | 2 +- .../fwh_sec_prot/auth_fwh_sec_prot.h | 2 +- .../fwh_sec_prot/supp_fwh_sec_prot.c | 2 +- .../fwh_sec_prot/supp_fwh_sec_prot.h | 2 +- .../gkh_sec_prot/auth_gkh_sec_prot.c | 2 +- .../gkh_sec_prot/auth_gkh_sec_prot.h | 2 +- .../gkh_sec_prot/supp_gkh_sec_prot.c | 2 +- .../gkh_sec_prot/supp_gkh_sec_prot.h | 2 +- .../protocols/key_sec_prot/key_sec_prot.c | 2 +- .../protocols/key_sec_prot/key_sec_prot.h | 2 +- .../protocols/msg_sec_prot/msg_sec_prot.c | 148 +++++++++++ .../protocols/msg_sec_prot/msg_sec_prot.h | 37 +++ .../protocols/radius_sec_prot/avp_helper.c | 2 +- .../protocols/radius_sec_prot/avp_helper.h | 2 +- .../radius_sec_prot/radius_client_sec_prot.c | 22 +- .../radius_sec_prot/radius_client_sec_prot.h | 2 +- source/Security/protocols/sec_prot.h | 2 +- source/Security/protocols/sec_prot_certs.c | 2 +- source/Security/protocols/sec_prot_certs.h | 2 +- source/Security/protocols/sec_prot_cfg.h | 7 +- source/Security/protocols/sec_prot_keys.c | 2 +- source/Security/protocols/sec_prot_keys.h | 3 +- source/Security/protocols/sec_prot_lib.c | 4 +- source/Security/protocols/sec_prot_lib.h | 2 +- .../protocols/tls_sec_prot/tls_sec_prot.c | 2 +- .../protocols/tls_sec_prot/tls_sec_prot.h | 2 +- .../protocols/tls_sec_prot/tls_sec_prot_lib.c | 2 +- .../protocols/tls_sec_prot/tls_sec_prot_lib.h | 2 +- source/Service_Libs/CCM_lib/ccm_security.c | 2 +- .../Service_Libs/CCM_lib/mbedOS/aes_mbedtls.c | 2 +- .../CCM_lib/mbedOS/aes_mbedtls_adapter.c | 2 +- .../Neighbor_cache/neighbor_cache.c | 2 +- .../neighbor_table_definition.h | 2 +- source/Service_Libs/SHA256_Lib/ns_sha256.c | 2 +- source/Service_Libs/SHA256_Lib/shalib.c | 2 +- source/Service_Libs/Trickle/trickle.c | 2 +- source/Service_Libs/Trickle/trickle.h | 2 +- source/Service_Libs/blacklist/blacklist.c | 2 +- source/Service_Libs/blacklist/blacklist.h | 2 +- source/Service_Libs/etx/etx.c | 7 +- source/Service_Libs/etx/etx.h | 2 +- source/Service_Libs/fhss/channel_functions.c | 2 +- source/Service_Libs/fhss/channel_functions.h | 2 +- source/Service_Libs/fhss/channel_list.c | 2 +- source/Service_Libs/fhss/channel_list.h | 2 +- source/Service_Libs/fhss/fhss.c | 2 +- source/Service_Libs/fhss/fhss.h | 2 +- source/Service_Libs/fhss/fhss_channel.c | 2 +- source/Service_Libs/fhss/fhss_channel.h | 2 +- source/Service_Libs/fhss/fhss_common.c | 2 +- source/Service_Libs/fhss/fhss_common.h | 2 +- .../fhss/fhss_configuration_interface.c | 2 +- source/Service_Libs/fhss/fhss_statistics.c | 2 +- source/Service_Libs/fhss/fhss_statistics.h | 2 +- source/Service_Libs/fhss/fhss_test_api.c | 2 +- source/Service_Libs/fhss/fhss_ws.c | 47 +++- source/Service_Libs/fhss/fhss_ws.h | 2 +- .../fhss/fhss_ws_empty_functions.c | 2 +- source/Service_Libs/fnv_hash/fnv_hash.c | 2 +- source/Service_Libs/fnv_hash/fnv_hash.h | 2 +- source/Service_Libs/hmac/hmac_md.c | 2 +- source/Service_Libs/hmac/hmac_md.h | 2 +- source/Service_Libs/ieee_802_11/ieee_802_11.c | 2 +- source/Service_Libs/ieee_802_11/ieee_802_11.h | 2 +- .../Service_Libs/load_balance/load_balance.c | 2 +- .../load_balance/load_balance_api.h | 2 +- .../mac_neighbor_table/mac_neighbor_table.c | 2 +- .../mac_neighbor_table/mac_neighbor_table.h | 2 +- .../mdns/fnet/fnet_stack/fnet_config.h | 2 +- .../fnet/fnet_stack/port/compiler/fnet_comp.h | 2 +- .../port/compiler/fnet_comp_config.h | 2 +- .../fnet/fnet_stack/services/fnet_services.h | 2 +- .../services/fnet_services_config.h | 2 +- .../fnet/fnet_stack/services/mdns/fnet_mdns.c | 184 ++++++------- .../fnet/fnet_stack/services/mdns/fnet_mdns.h | 10 +- .../fnet/fnet_stack/services/poll/fnet_poll.c | 2 +- .../fnet_stack/services/serial/fnet_serial.h | 2 +- .../mdns/fnet/fnet_stack/stack/fnet_debug.h | 2 +- .../mdns/fnet/fnet_stack/stack/fnet_stdlib.c | 2 +- source/Service_Libs/mdns/fnet_user_config.h | 2 +- source/Service_Libs/mdns/ns_fnet_events.c | 2 +- source/Service_Libs/mdns/ns_fnet_events.h | 2 +- source/Service_Libs/mdns/ns_fnet_port.c | 2 +- source/Service_Libs/mdns/ns_fnet_types.h | 2 +- source/Service_Libs/mdns/ns_mdns_api.c | 2 +- source/Service_Libs/mle_service/mle_service.c | 2 +- .../mle_service/mle_service_api.h | 2 +- .../mle_service/mle_service_buffer.c | 2 +- .../mle_service/mle_service_buffer.h | 2 +- .../mle_service_frame_counter_table.c | 2 +- .../mle_service_frame_counter_table.h | 2 +- .../mle_service/mle_service_interface.c | 2 +- .../mle_service/mle_service_interface.h | 2 +- .../mle_service/mle_service_security.c | 2 +- .../mle_service/mle_service_security.h | 2 +- source/Service_Libs/nd_proxy/nd_proxy.c | 2 +- source/Service_Libs/nd_proxy/nd_proxy.h | 2 +- source/Service_Libs/nist_aes_kw/nist_aes_kw.c | 2 +- source/Service_Libs/nist_aes_kw/nist_aes_kw.h | 2 +- .../pan_blacklist/pan_blacklist.c | 2 +- .../pan_blacklist/pan_blacklist_api.h | 2 +- .../random_early_detection.c | 2 +- .../random_early_detection.h | 2 +- .../random_early_detection_api.h | 2 +- source/Service_Libs/utils/isqrt.c | 2 +- source/Service_Libs/utils/isqrt.h | 2 +- source/Service_Libs/utils/ns_conf.c | 2 +- source/Service_Libs/utils/ns_crc.c | 2 +- source/Service_Libs/utils/ns_crc.h | 2 +- source/Service_Libs/utils/ns_file.h | 2 +- source/Service_Libs/utils/ns_file_system.c | 2 +- source/Service_Libs/utils/ns_time.c | 55 ++++ source/Service_Libs/utils/ns_time.h | 56 ++++ source/Service_Libs/whiteboard/whiteboard.c | 2 +- source/Service_Libs/whiteboard/whiteboard.h | 2 +- source/configs/base/cfg_ethernet.h | 2 +- source/configs/base/cfg_local_socket.h | 2 +- .../configs/base/cfg_lowpan_border_router.h | 2 +- source/configs/base/cfg_lowpan_host.h | 2 +- source/configs/base/cfg_lowpan_router.h | 2 +- source/configs/base/cfg_rf_tunnel.h | 2 +- .../configs/base/cfg_thread_border_router.h | 2 +- source/configs/base/cfg_thread_end_device.h | 2 +- .../configs/base/cfg_thread_full_end_device.h | 2 +- source/configs/base/cfg_thread_router.h | 2 +- source/configs/base/cfg_ws_border_router.h | 2 +- source/configs/base/cfg_ws_router.h | 2 +- source/configs/cfg_ethernet_host.h | 2 +- source/configs/cfg_generic.h | 2 +- source/configs/cfg_lowpan_border_router.h | 2 +- .../cfg_lowpan_border_router_rf_tunnel.h | 2 +- .../cfg_lowpan_border_router_rf_tunnel_ecc.h | 2 +- ...wpan_border_router_rf_tunnel_ecc_release.h | 2 +- source/configs/cfg_lowpan_host.h | 2 +- source/configs/cfg_lowpan_router.h | 2 +- source/configs/cfg_lowpan_router_ecc.h | 2 +- .../configs/cfg_lowpan_router_ecc_release.h | 2 +- source/configs/cfg_nanostack_full.h | 2 +- source/configs/cfg_nanostack_full_debug.h | 2 +- source/configs/cfg_rf_interface.h | 2 +- source/configs/cfg_thread_border_router.h | 2 +- source/configs/cfg_thread_end_device.h | 2 +- source/configs/cfg_thread_full_end_device.h | 2 +- source/configs/cfg_thread_router.h | 2 +- source/configs/cfg_thread_thci.h | 2 +- source/configs/cfg_ws_border_router.h | 2 +- source/configs/cfg_ws_router.h | 2 +- source/ipv6_stack/ipv6_routing_table.c | 2 +- source/ipv6_stack/ipv6_routing_table.h | 2 +- source/ipv6_stack/protocol_ipv6.c | 2 +- source/ipv6_stack/protocol_ipv6.h | 2 +- source/libDHCPv6/dhcp_service_api.c | 59 ++++- source/libDHCPv6/libDHCPv6.c | 2 +- source/libDHCPv6/libDHCPv6.h | 2 +- source/libDHCPv6/libDHCPv6_server.c | 27 +- source/libDHCPv6/libDHCPv6_server.h | 7 +- source/libDHCPv6/libDHCPv6_vendordata.c | 60 ++++- source/libDHCPv6/libDHCPv6_vendordata.h | 40 ++- source/libNET/src/multicast_api.c | 2 +- source/libNET/src/net_6lowpan_parameter_api.c | 2 +- source/libNET/src/net_dns.c | 2 +- source/libNET/src/net_dns_internal.h | 2 +- source/libNET/src/net_ipv6.c | 2 +- source/libNET/src/net_load_balance.c | 2 +- source/libNET/src/net_load_balance_internal.h | 2 +- source/libNET/src/net_mle.c | 2 +- source/libNET/src/net_rpl.c | 2 +- .../libNET/src/net_short_address_extension.c | 2 +- source/libNET/src/net_test.c | 2 +- source/libNET/src/ns_net.c | 2 +- source/libNET/src/socket_api.c | 2 +- source/nsconfig.h | 2 +- sources.mk | 2 + 537 files changed, 2021 insertions(+), 1189 deletions(-) create mode 100644 source/Security/protocols/msg_sec_prot/msg_sec_prot.c create mode 100644 source/Security/protocols/msg_sec_prot/msg_sec_prot.h create mode 100644 source/Service_Libs/utils/ns_time.c create mode 100644 source/Service_Libs/utils/ns_time.h diff --git a/LICENSE-Apache-2.0 b/LICENSE-Apache-2.0 index ae3cb70b6b..a7155e2dc7 100644 --- a/LICENSE-Apache-2.0 +++ b/LICENSE-Apache-2.0 @@ -1,4 +1,4 @@ -Copyright 2017 Arm Limited and its affiliates +Copyright 2017, Pelion and affiliates. SPDX-License-Identifier: Apache-2.0 Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/LICENSE-BSD-3-Clause b/LICENSE-BSD-3-Clause index a6fe7d9a0a..5c59c7c596 100644 --- a/LICENSE-BSD-3-Clause +++ b/LICENSE-BSD-3-Clause @@ -1,4 +1,4 @@ -Copyright 2017 Arm Limited and affiliates. +Copyright 2017, Pelion and affiliates. SPDX-License-Identifier: BSD-3-Clause Redistribution and use in source and binary forms, with or without diff --git a/nanostack/cca_api.h b/nanostack/cca_api.h index 6f276b62ed..3abe66093a 100644 --- a/nanostack/cca_api.h +++ b/nanostack/cca_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/nanostack/ccmLIB.h b/nanostack/ccmLIB.h index d168a6ed00..3ef95fe7d9 100644 --- a/nanostack/ccmLIB.h +++ b/nanostack/ccmLIB.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/nanostack/dhcp_service_api.h b/nanostack/dhcp_service_api.h index 88a5150458..0a576c1d6c 100644 --- a/nanostack/dhcp_service_api.h +++ b/nanostack/dhcp_service_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2018, Arm Limited and affiliates. + * Copyright (c) 2013-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -197,11 +197,12 @@ int dhcp_service_send_resp(uint32_t msg_tr_id, uint8_t options, uint8_t *msg_ptr * \param msg_ptr An allocated message pointer. This pointer is the responsibility of the service after this call. * \param msg_len The length of the message. * \param receive_resp_cb Callback pointer + * \param delay_tx Transmit may be delayed and this parameter define that * * \return Transaction ID of the DHCP transaction * \return 0, if error occurred. */ -uint32_t dhcp_service_send_req(uint16_t instance_id, uint8_t options, void *ptr, const uint8_t addr[static 16], uint8_t *msg_ptr, uint16_t msg_len, dhcp_service_receive_resp_cb *receive_resp_cb); +uint32_t dhcp_service_send_req(uint16_t instance_id, uint8_t options, void *ptr, const uint8_t addr[static 16], uint8_t *msg_ptr, uint16_t msg_len, dhcp_service_receive_resp_cb *receive_resp_cb, uint16_t delay_tx); /** * \brief Setting retransmission parameters. @@ -225,6 +226,16 @@ void dhcp_service_set_retry_timers(uint32_t msg_tr_id, uint16_t timeout_init, ui */ void dhcp_service_update_server_address(uint32_t msg_tr_id, uint8_t *server_address); +/** + * \brief Get Round Trip time of the request + * + * get the elapsed time of the request from last message sent to server. + * + * \param msg_tr_id The message transaction ID. + * + */ +uint32_t dhcp_service_rtt_get(uint32_t msg_tr_id); + /** * \brief Stops transactions for a message (retransmissions). * diff --git a/nanostack/ethernet_mac_api.h b/nanostack/ethernet_mac_api.h index 8460da680d..22d40ca67c 100644 --- a/nanostack/ethernet_mac_api.h +++ b/nanostack/ethernet_mac_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/nanostack/fhss_api.h b/nanostack/fhss_api.h index e6aa23270e..6060fd67df 100644 --- a/nanostack/fhss_api.h +++ b/nanostack/fhss_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2019, 2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/nanostack/fhss_config.h b/nanostack/fhss_config.h index 545cb98cda..fddd216b64 100644 --- a/nanostack/fhss_config.h +++ b/nanostack/fhss_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/nanostack/fhss_test_api.h b/nanostack/fhss_test_api.h index e6a93cc2c0..1094b8c344 100644 --- a/nanostack/fhss_test_api.h +++ b/nanostack/fhss_test_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Arm Limited and affiliates. + * Copyright (c) 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/nanostack/fhss_ws_extension.h b/nanostack/fhss_ws_extension.h index d98b5ace97..7516b10f74 100644 --- a/nanostack/fhss_ws_extension.h +++ b/nanostack/fhss_ws_extension.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Arm Limited and affiliates. + * Copyright (c) 2018, 2020-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/nanostack/mac_api.h b/nanostack/mac_api.h index bc5b13fcef..8cc4da258e 100644 --- a/nanostack/mac_api.h +++ b/nanostack/mac_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2018, 2020-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -325,6 +325,7 @@ typedef struct mac_statistics_s { uint32_t mac_retry_count; /**< MAC TX retry count. */ uint32_t mac_cca_attempts_count; /**< MAC CCA attempts count. */ uint32_t mac_failed_cca_count; /**< MAC failed CCA count. */ + uint32_t mac_tx_latency_max; /**< MAC data request max latency. */ } mac_statistics_t; #ifdef __cplusplus diff --git a/nanostack/mac_common_defines.h b/nanostack/mac_common_defines.h index e64015c1bd..082b5b4c34 100644 --- a/nanostack/mac_common_defines.h +++ b/nanostack/mac_common_defines.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2018, 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/nanostack/mac_filter_api.h b/nanostack/mac_filter_api.h index 0b7fe0349a..a667901f1a 100644 --- a/nanostack/mac_filter_api.h +++ b/nanostack/mac_filter_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/nanostack/mac_mcps.h b/nanostack/mac_mcps.h index 8e99c2f431..9f56881945 100644 --- a/nanostack/mac_mcps.h +++ b/nanostack/mac_mcps.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2018, 2020-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/nanostack/mlme.h b/nanostack/mlme.h index 992046dfde..2bd14e2bc8 100644 --- a/nanostack/mlme.h +++ b/nanostack/mlme.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2018, Arm Limited and affiliates. + * Copyright (c) 2013-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/nanostack/multicast_api.h b/nanostack/multicast_api.h index a24f958fd8..1fa999bbbb 100644 --- a/nanostack/multicast_api.h +++ b/nanostack/multicast_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2018, Arm Limited and affiliates. + * Copyright (c) 2012-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/nanostack/net_6lowpan_parameter_api.h b/nanostack/net_6lowpan_parameter_api.h index 0783ac9aae..9e21bde1a5 100644 --- a/nanostack/net_6lowpan_parameter_api.h +++ b/nanostack/net_6lowpan_parameter_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2015, 2017, Arm Limited and affiliates. + * Copyright (c) 2014-2015, 2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/nanostack/net_address_extension.h b/nanostack/net_address_extension.h index 8f1ece0b70..5bbac60da7 100644 --- a/nanostack/net_address_extension.h +++ b/nanostack/net_address_extension.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2018, Arm Limited and affiliates. + * Copyright (c) 2013-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/nanostack/net_fhss.h b/nanostack/net_fhss.h index 6d6003c986..6f64496673 100644 --- a/nanostack/net_fhss.h +++ b/nanostack/net_fhss.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/nanostack/net_interface.h b/nanostack/net_interface.h index 89c942ccb1..eb87675af5 100644 --- a/nanostack/net_interface.h +++ b/nanostack/net_interface.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019, Arm Limited and affiliates. + * Copyright (c) 2014-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/nanostack/net_ipv6_api.h b/nanostack/net_ipv6_api.h index 7132d9057f..9f23448ee5 100644 --- a/nanostack/net_ipv6_api.h +++ b/nanostack/net_ipv6_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017, Arm Limited and affiliates. + * Copyright (c) 2016-2017, 2019-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/nanostack/net_load_balance_api.h b/nanostack/net_load_balance_api.h index d198bd8315..c72b1e89dd 100644 --- a/nanostack/net_load_balance_api.h +++ b/nanostack/net_load_balance_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/nanostack/net_mle_api.h b/nanostack/net_mle_api.h index 2dde4426e9..66eb9586f0 100644 --- a/nanostack/net_mle_api.h +++ b/nanostack/net_mle_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017, Arm Limited and affiliates. + * Copyright (c) 2016-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/nanostack/net_nvm_api.h b/nanostack/net_nvm_api.h index e790f63a87..98c108e37d 100644 --- a/nanostack/net_nvm_api.h +++ b/nanostack/net_nvm_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2018, Arm Limited and affiliates. + * Copyright (c) 2013-2019, 2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/nanostack/net_nwk_scan.h b/nanostack/net_nwk_scan.h index f5b09126ff..f12a397998 100644 --- a/nanostack/net_nwk_scan.h +++ b/nanostack/net_nwk_scan.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2017, Arm Limited and affiliates. + * Copyright (c) 2013-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/nanostack/net_pana_parameters_api.h b/nanostack/net_pana_parameters_api.h index c3f63ff7eb..924bf417e5 100644 --- a/nanostack/net_pana_parameters_api.h +++ b/nanostack/net_pana_parameters_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/nanostack/net_polling_api.h b/nanostack/net_polling_api.h index de22f7db7d..ea98ee7d3f 100644 --- a/nanostack/net_polling_api.h +++ b/nanostack/net_polling_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2017, Arm Limited and affiliates. + * Copyright (c) 2013-2017, 2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/nanostack/net_rpl.h b/nanostack/net_rpl.h index c65308130e..d78bc80001 100644 --- a/nanostack/net_rpl.h +++ b/nanostack/net_rpl.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2017, Arm Limited and affiliates. + * Copyright (c) 2013-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/nanostack/net_sleep.h b/nanostack/net_sleep.h index 3eb8ba3d44..da7b85d50b 100644 --- a/nanostack/net_sleep.h +++ b/nanostack/net_sleep.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/nanostack/net_test_api.h b/nanostack/net_test_api.h index 35322069b5..3ebe3eec4e 100644 --- a/nanostack/net_test_api.h +++ b/nanostack/net_test_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/nanostack/net_thread_test.h b/nanostack/net_thread_test.h index f88e19a56c..0ab970a77c 100644 --- a/nanostack/net_thread_test.h +++ b/nanostack/net_thread_test.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019, Arm Limited and affiliates. + * Copyright (c) 2014-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/nanostack/net_ws_test.h b/nanostack/net_ws_test.h index 6bd20c658a..234c12e0b1 100644 --- a/nanostack/net_ws_test.h +++ b/nanostack/net_ws_test.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019, Arm Limited and affiliates. + * Copyright (c) 2014-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/nanostack/ns_address.h b/nanostack/ns_address.h index 0a820fb551..50e7e96ba5 100644 --- a/nanostack/ns_address.h +++ b/nanostack/ns_address.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2017, Arm Limited and affiliates. + * Copyright (c) 2010-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/nanostack/ns_conf.h b/nanostack/ns_conf.h index c8e6d50602..56b0787517 100644 --- a/nanostack/ns_conf.h +++ b/nanostack/ns_conf.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Arm Limited and affiliates. + * Copyright (c) 2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/nanostack/ns_file_system.h b/nanostack/ns_file_system.h index 031e3a1657..45a92f1efd 100644 --- a/nanostack/ns_file_system.h +++ b/nanostack/ns_file_system.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Arm Limited and affiliates. + * Copyright (c) 2017, 2019-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/nanostack/ns_mdns_api.h b/nanostack/ns_mdns_api.h index 7a92fb2c36..bba6d2608a 100644 --- a/nanostack/ns_mdns_api.h +++ b/nanostack/ns_mdns_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018, Arm Limited and affiliates. + * Copyright (c) 2017-2019, 2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/nanostack/ns_sha256.h b/nanostack/ns_sha256.h index d088188608..fccded2cfa 100644 --- a/nanostack/ns_sha256.h +++ b/nanostack/ns_sha256.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, Arm Limited and affiliates. + * Copyright (c) 2006-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/nanostack/ns_time_api.h b/nanostack/ns_time_api.h index a306bad718..4b1907cfc9 100644 --- a/nanostack/ns_time_api.h +++ b/nanostack/ns_time_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Arm Limited and affiliates. + * Copyright (c) 2020-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -29,7 +29,7 @@ #include "ns_types.h" /** - * System time callback. + * System time read callback. * * Callback shall return the system time in seconds after 1970. * @@ -39,13 +39,33 @@ typedef uint64_t ns_time_api_system_time_callback(void); /** - * System time callback set. + * System time write callback. * - * Sets callback for the system time. + * Callback will write the time in seconds after 1970. * - * \param callback system time callback + * \param seconds system time in seconds * */ -void ns_time_api_system_time_callback_set(ns_time_api_system_time_callback callback); +typedef void ns_time_api_system_time_write_callback(uint64_t write_time); + +/** + * System time read callback set. + * + * Sets callback for the system time read. + * + * \param callback_rd system time read callback + * + */ +void ns_time_api_system_time_callback_set(ns_time_api_system_time_callback callback_rd); + +/** + * Set system time write callback. + * + * Sets system time write callback. + * + * \param callback_wr system time write callback. + * + */ +void ns_time_api_system_time_write_callback_set(ns_time_api_system_time_write_callback callback_wr); #endif /* NS_TIME_API_H_ */ diff --git a/nanostack/ns_virtual_rf_api.h b/nanostack/ns_virtual_rf_api.h index 6d64d2b3b3..877709509a 100644 --- a/nanostack/ns_virtual_rf_api.h +++ b/nanostack/ns_virtual_rf_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017, Arm Limited and affiliates. + * Copyright (c) 2016-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/nanostack/nwk_stats_api.h b/nanostack/nwk_stats_api.h index a59d062e43..a53104a0b9 100644 --- a/nanostack/nwk_stats_api.h +++ b/nanostack/nwk_stats_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2017, Arm Limited and affiliates. + * Copyright (c) 2013-2017, 2019-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -74,6 +74,7 @@ typedef struct nwk_stats_t { uint16_t adapt_layer_tx_queue_size; /**< Adaptation layer direct TX queue size. */ uint16_t adapt_layer_tx_queue_peak; /**< Adaptation layer direct TX queue size peak. */ uint32_t adapt_layer_tx_congestion_drop; /**< Adaptation layer direct TX randon early detection drop packet. */ + uint16_t adapt_layer_tx_latency_max; /**< Adaptation layer latency between TX request and TX ready in seconds (MAX). */ } nwk_stats_t; /** diff --git a/nanostack/platform/arm_hal_aes.h b/nanostack/platform/arm_hal_aes.h index e64c12050e..60e7be7d26 100644 --- a/nanostack/platform/arm_hal_aes.h +++ b/nanostack/platform/arm_hal_aes.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2018, 2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/nanostack/platform/arm_hal_phy.h b/nanostack/platform/arm_hal_phy.h index 62c46f8552..b4a1913742 100644 --- a/nanostack/platform/arm_hal_phy.h +++ b/nanostack/platform/arm_hal_phy.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/nanostack/platform/os_whiteboard.h b/nanostack/platform/os_whiteboard.h index 8709bc351a..8348f754f4 100644 --- a/nanostack/platform/os_whiteboard.h +++ b/nanostack/platform/os_whiteboard.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/nanostack/platform/topo_trace.h b/nanostack/platform/topo_trace.h index b8615ffc11..80c837ff73 100644 --- a/nanostack/platform/topo_trace.h +++ b/nanostack/platform/topo_trace.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/nanostack/serial_mac_api.h b/nanostack/serial_mac_api.h index 2b202e39bd..dd5dc14f08 100644 --- a/nanostack/serial_mac_api.h +++ b/nanostack/serial_mac_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/nanostack/shalib.h b/nanostack/shalib.h index 5aaa7f9d1a..3883830c7f 100644 --- a/nanostack/shalib.h +++ b/nanostack/shalib.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/nanostack/socket_api.h b/nanostack/socket_api.h index 0b5db6c825..7cf8b57748 100644 --- a/nanostack/socket_api.h +++ b/nanostack/socket_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2018, Arm Limited and affiliates. + * Copyright (c) 2010-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/nanostack/sw_mac.h b/nanostack/sw_mac.h index 894b8b75c4..d150718110 100644 --- a/nanostack/sw_mac.h +++ b/nanostack/sw_mac.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/nanostack/thread_bbr_api.h b/nanostack/thread_bbr_api.h index 55a8e9f97d..2bfc2b1267 100644 --- a/nanostack/thread_bbr_api.h +++ b/nanostack/thread_bbr_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018, Arm Limited and affiliates. + * Copyright (c) 2017-2018, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/nanostack/thread_border_router_api.h b/nanostack/thread_border_router_api.h index c5083a598c..cbdaafc9a5 100644 --- a/nanostack/thread_border_router_api.h +++ b/nanostack/thread_border_router_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2018, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/nanostack/thread_commissioning_api.h b/nanostack/thread_commissioning_api.h index fbba8b355e..7235d415bb 100644 --- a/nanostack/thread_commissioning_api.h +++ b/nanostack/thread_commissioning_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/nanostack/thread_dhcpv6_server.h b/nanostack/thread_dhcpv6_server.h index e0b1fab14c..70df15d310 100644 --- a/nanostack/thread_dhcpv6_server.h +++ b/nanostack/thread_dhcpv6_server.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/nanostack/thread_diagcop_lib.h b/nanostack/thread_diagcop_lib.h index abad9775ce..f1d92d9820 100644 --- a/nanostack/thread_diagcop_lib.h +++ b/nanostack/thread_diagcop_lib.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/nanostack/thread_lowpower_api.h b/nanostack/thread_lowpower_api.h index bf078280dc..74033cbef2 100644 --- a/nanostack/thread_lowpower_api.h +++ b/nanostack/thread_lowpower_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Arm Limited and affiliates. + * Copyright (c) 2017, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/nanostack/thread_management_api.h b/nanostack/thread_management_api.h index 42def140d6..cbc6693443 100644 --- a/nanostack/thread_management_api.h +++ b/nanostack/thread_management_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/nanostack/thread_management_if.h b/nanostack/thread_management_if.h index 9256e6149f..0332d7faaf 100644 --- a/nanostack/thread_management_if.h +++ b/nanostack/thread_management_if.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/nanostack/thread_meshcop_lib.h b/nanostack/thread_meshcop_lib.h index 583721d4d6..67dab7150b 100644 --- a/nanostack/thread_meshcop_lib.h +++ b/nanostack/thread_meshcop_lib.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/nanostack/thread_net_config_api.h b/nanostack/thread_net_config_api.h index c92f0c0b2c..7830ef6d8c 100644 --- a/nanostack/thread_net_config_api.h +++ b/nanostack/thread_net_config_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017, Arm Limited and affiliates. + * Copyright (c) 2016-2017, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/nanostack/whiteboard_api.h b/nanostack/whiteboard_api.h index 62cc5c7d2e..61164a7252 100644 --- a/nanostack/whiteboard_api.h +++ b/nanostack/whiteboard_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2017, Arm Limited and affiliates. + * Copyright (c) 2011-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/nanostack/ws_bbr_api.h b/nanostack/ws_bbr_api.h index 6347e2c95c..a1c15aa061 100644 --- a/nanostack/ws_bbr_api.h +++ b/nanostack/ws_bbr_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019, Arm Limited and affiliates. + * Copyright (c) 2017-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/nanostack/ws_management_api.h b/nanostack/ws_management_api.h index 7094d09077..ddab5d40e5 100644 --- a/nanostack/ws_management_api.h +++ b/nanostack/ws_management_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -857,9 +857,13 @@ int ws_neighbor_info_get( * * Setting a value that is not suitable for Radio might prevent the device joining to the network. * - * NOTE: Currently lower EAPOL parents are accepted if there is no parents higher than - * DEVICE_MIN_SENS + CAND_PARENT_THRESHOLD + CAND_PARENT_HYSTERESIS - * NOTE: Currently not using this value to limit parents as it is only RECOMENDED in specification. + * This configuration limits the EAPOL parents accepted for Authentication and device must hear signal + * level higher than device_min_sens + CAND_PARENT_THRESHOLD + CAND_PARENT_HYSTERESIS + * to start authentication. + * + * ETX Calculation gives a maximum ETX if two way EWMA RSL is less than + * device_min_sens + CAND_PARENT_THRESHOLD + CAND_PARENT_HYSTERESIS to + * prevent selecting parents with poor signal quality * * \param interface_id Network interface ID. * \param device_min_sens value used in the parent selections. diff --git a/source/6LoWPAN/Bootstraps/Generic/network_lib.c b/source/6LoWPAN/Bootstraps/Generic/network_lib.c index 208b091b8a..86d2d353b3 100644 --- a/source/6LoWPAN/Bootstraps/Generic/network_lib.c +++ b/source/6LoWPAN/Bootstraps/Generic/network_lib.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2019, Arm Limited and affiliates. + * Copyright (c) 2013-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/Bootstraps/Generic/protocol_6lowpan.c b/source/6LoWPAN/Bootstraps/Generic/protocol_6lowpan.c index 6c6a0ca445..3069e00a56 100644 --- a/source/6LoWPAN/Bootstraps/Generic/protocol_6lowpan.c +++ b/source/6LoWPAN/Bootstraps/Generic/protocol_6lowpan.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2019, Arm Limited and affiliates. + * Copyright (c) 2013-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -870,7 +870,12 @@ bool protocol_6lowpan_stagger_estimate_get(int8_t interface_id, uint32_t data_am datarate = STAGGER_DATARATE_FOR_APPL(datarate); } - stagger_value = 1 + ((data_amount * 1024 * 8 * network_size) / datarate); + // For small networks sets 10 seconds stagger + if (network_size <= 100 && ws_info(cur_interface)) { + stagger_value = 10; + } else { + stagger_value = 1 + ((data_amount * 1024 * 8 * network_size) / datarate); + } /** * Example: * Maximum stagger value to send 1kB to 100 device network using data rate of 50kbs: @@ -882,7 +887,7 @@ bool protocol_6lowpan_stagger_estimate_get(int8_t interface_id, uint32_t data_am if (stagger_value > 0xFFFF) { *stagger_max = 0xFFFF; } else { - *stagger_max = (uint16_t)stagger_value; + *stagger_max = (uint16_t)stagger_value + *stagger_min; } // Randomize stagger value diff --git a/source/6LoWPAN/Bootstraps/Generic/protocol_6lowpan_bootstrap.c b/source/6LoWPAN/Bootstraps/Generic/protocol_6lowpan_bootstrap.c index 11a2a8d989..fa7ecae8b1 100644 --- a/source/6LoWPAN/Bootstraps/Generic/protocol_6lowpan_bootstrap.c +++ b/source/6LoWPAN/Bootstraps/Generic/protocol_6lowpan_bootstrap.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2019, Arm Limited and affiliates. + * Copyright (c) 2015-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/Bootstraps/Generic/protocol_6lowpan_interface.c b/source/6LoWPAN/Bootstraps/Generic/protocol_6lowpan_interface.c index 92ea3ce738..0ac784303a 100644 --- a/source/6LoWPAN/Bootstraps/Generic/protocol_6lowpan_interface.c +++ b/source/6LoWPAN/Bootstraps/Generic/protocol_6lowpan_interface.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/Bootstraps/network_lib.h b/source/6LoWPAN/Bootstraps/network_lib.h index 2b856fd5a5..9bcbc515bc 100644 --- a/source/6LoWPAN/Bootstraps/network_lib.h +++ b/source/6LoWPAN/Bootstraps/network_lib.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2017, Arm Limited and affiliates. + * Copyright (c) 2013-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/Bootstraps/protocol_6lowpan.h b/source/6LoWPAN/Bootstraps/protocol_6lowpan.h index 95515c1fd4..ced19fdcb1 100644 --- a/source/6LoWPAN/Bootstraps/protocol_6lowpan.h +++ b/source/6LoWPAN/Bootstraps/protocol_6lowpan.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2018, 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/Bootstraps/protocol_6lowpan_bootstrap.h b/source/6LoWPAN/Bootstraps/protocol_6lowpan_bootstrap.h index 14bb828496..0768034d03 100644 --- a/source/6LoWPAN/Bootstraps/protocol_6lowpan_bootstrap.h +++ b/source/6LoWPAN/Bootstraps/protocol_6lowpan_bootstrap.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/Bootstraps/protocol_6lowpan_interface.h b/source/6LoWPAN/Bootstraps/protocol_6lowpan_interface.h index 017805735c..175c6a696f 100644 --- a/source/6LoWPAN/Bootstraps/protocol_6lowpan_interface.h +++ b/source/6LoWPAN/Bootstraps/protocol_6lowpan_interface.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017, Arm Limited and affiliates. + * Copyright (c) 2015, 2017, 2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/Fragmentation/cipv6_fragmenter.c b/source/6LoWPAN/Fragmentation/cipv6_fragmenter.c index df2b4404e3..ca4710241f 100644 --- a/source/6LoWPAN/Fragmentation/cipv6_fragmenter.c +++ b/source/6LoWPAN/Fragmentation/cipv6_fragmenter.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2019, Arm Limited and affiliates. + * Copyright (c) 2013-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/Fragmentation/cipv6_fragmenter.h b/source/6LoWPAN/Fragmentation/cipv6_fragmenter.h index 28c3384a1d..42baadeeda 100644 --- a/source/6LoWPAN/Fragmentation/cipv6_fragmenter.h +++ b/source/6LoWPAN/Fragmentation/cipv6_fragmenter.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2017, Arm Limited and affiliates. + * Copyright (c) 2013-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/IPHC_Decode/6lowpan_iphc.c b/source/6LoWPAN/IPHC_Decode/6lowpan_iphc.c index b02b372fc1..45c91e5ba7 100644 --- a/source/6LoWPAN/IPHC_Decode/6lowpan_iphc.c +++ b/source/6LoWPAN/IPHC_Decode/6lowpan_iphc.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2018, Arm Limited and affiliates. + * Copyright (c) 2013-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/IPHC_Decode/cipv6.h b/source/6LoWPAN/IPHC_Decode/cipv6.h index 28f55fd112..764d042fb3 100644 --- a/source/6LoWPAN/IPHC_Decode/cipv6.h +++ b/source/6LoWPAN/IPHC_Decode/cipv6.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2017, Arm Limited and affiliates. + * Copyright (c) 2013-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/IPHC_Decode/iphc_compress.c b/source/6LoWPAN/IPHC_Decode/iphc_compress.c index 735955aca9..326cfd49ed 100644 --- a/source/6LoWPAN/IPHC_Decode/iphc_compress.c +++ b/source/6LoWPAN/IPHC_Decode/iphc_compress.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/IPHC_Decode/iphc_compress.h b/source/6LoWPAN/IPHC_Decode/iphc_compress.h index b64074fb0d..6061063225 100644 --- a/source/6LoWPAN/IPHC_Decode/iphc_compress.h +++ b/source/6LoWPAN/IPHC_Decode/iphc_compress.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/IPHC_Decode/iphc_decompress.c b/source/6LoWPAN/IPHC_Decode/iphc_decompress.c index eeeb48c2e1..988be70257 100644 --- a/source/6LoWPAN/IPHC_Decode/iphc_decompress.c +++ b/source/6LoWPAN/IPHC_Decode/iphc_decompress.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/IPHC_Decode/iphc_decompress.h b/source/6LoWPAN/IPHC_Decode/iphc_decompress.h index e2cd8d55dc..7949fae709 100644 --- a/source/6LoWPAN/IPHC_Decode/iphc_decompress.h +++ b/source/6LoWPAN/IPHC_Decode/iphc_decompress.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/IPHC_Decode/lowpan_context.c b/source/6LoWPAN/IPHC_Decode/lowpan_context.c index 1d9a68904a..6a2d4e644f 100644 --- a/source/6LoWPAN/IPHC_Decode/lowpan_context.c +++ b/source/6LoWPAN/IPHC_Decode/lowpan_context.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2017, 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/IPHC_Decode/lowpan_context.h b/source/6LoWPAN/IPHC_Decode/lowpan_context.h index 0b8daf32cc..e9eb21be77 100644 --- a/source/6LoWPAN/IPHC_Decode/lowpan_context.h +++ b/source/6LoWPAN/IPHC_Decode/lowpan_context.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2017, 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/MAC/beacon_handler.c b/source/6LoWPAN/MAC/beacon_handler.c index 34c7b3c98b..d3d9a37f35 100644 --- a/source/6LoWPAN/MAC/beacon_handler.c +++ b/source/6LoWPAN/MAC/beacon_handler.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/MAC/beacon_handler.h b/source/6LoWPAN/MAC/beacon_handler.h index c08680f60f..11f7164b00 100644 --- a/source/6LoWPAN/MAC/beacon_handler.h +++ b/source/6LoWPAN/MAC/beacon_handler.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/MAC/mac_data_poll.c b/source/6LoWPAN/MAC/mac_data_poll.c index 04491a4832..c7af05a97e 100644 --- a/source/6LoWPAN/MAC/mac_data_poll.c +++ b/source/6LoWPAN/MAC/mac_data_poll.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/MAC/mac_data_poll.h b/source/6LoWPAN/MAC/mac_data_poll.h index 877e370862..8d31424ae2 100644 --- a/source/6LoWPAN/MAC/mac_data_poll.h +++ b/source/6LoWPAN/MAC/mac_data_poll.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/MAC/mac_helper.c b/source/6LoWPAN/MAC/mac_helper.c index 73d6690f97..515c16ce18 100644 --- a/source/6LoWPAN/MAC/mac_helper.c +++ b/source/6LoWPAN/MAC/mac_helper.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/MAC/mac_helper.h b/source/6LoWPAN/MAC/mac_helper.h index f85916bcf7..ee04da6e96 100644 --- a/source/6LoWPAN/MAC/mac_helper.h +++ b/source/6LoWPAN/MAC/mac_helper.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/MAC/mac_ie_lib.c b/source/6LoWPAN/MAC/mac_ie_lib.c index a4fab39a44..e6329bfbca 100644 --- a/source/6LoWPAN/MAC/mac_ie_lib.c +++ b/source/6LoWPAN/MAC/mac_ie_lib.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Arm Limited and affiliates. + * Copyright (c) 2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/MAC/mac_ie_lib.h b/source/6LoWPAN/MAC/mac_ie_lib.h index cd00984dce..6cd0f5f82e 100644 --- a/source/6LoWPAN/MAC/mac_ie_lib.h +++ b/source/6LoWPAN/MAC/mac_ie_lib.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Arm Limited and affiliates. + * Copyright (c) 2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/MAC/mac_pairwise_key.c b/source/6LoWPAN/MAC/mac_pairwise_key.c index a9e61f77d4..34eaae5482 100644 --- a/source/6LoWPAN/MAC/mac_pairwise_key.c +++ b/source/6LoWPAN/MAC/mac_pairwise_key.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/MAC/mac_pairwise_key.h b/source/6LoWPAN/MAC/mac_pairwise_key.h index a28cac60a7..dc7a7ba4de 100644 --- a/source/6LoWPAN/MAC/mac_pairwise_key.h +++ b/source/6LoWPAN/MAC/mac_pairwise_key.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/MAC/mac_response_handler.c b/source/6LoWPAN/MAC/mac_response_handler.c index 68054aa1ce..7b36644952 100644 --- a/source/6LoWPAN/MAC/mac_response_handler.c +++ b/source/6LoWPAN/MAC/mac_response_handler.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/MAC/mac_response_handler.h b/source/6LoWPAN/MAC/mac_response_handler.h index dc58042ee7..7aa5a91c58 100644 --- a/source/6LoWPAN/MAC/mac_response_handler.h +++ b/source/6LoWPAN/MAC/mac_response_handler.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/MAC/mpx_api.h b/source/6LoWPAN/MAC/mpx_api.h index b210e4a395..0a3042ce2b 100644 --- a/source/6LoWPAN/MAC/mpx_api.h +++ b/source/6LoWPAN/MAC/mpx_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Arm Limited and affiliates. + * Copyright (c) 2018, 2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/Mesh/mesh.c b/source/6LoWPAN/Mesh/mesh.c index 4cdbbb138c..5ee8d2cf45 100644 --- a/source/6LoWPAN/Mesh/mesh.c +++ b/source/6LoWPAN/Mesh/mesh.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, 2019, Arm Limited and affiliates. + * Copyright (c) 2014-2017, 2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/Mesh/mesh.h b/source/6LoWPAN/Mesh/mesh.h index 469d19f7aa..32ef979f08 100644 --- a/source/6LoWPAN/Mesh/mesh.h +++ b/source/6LoWPAN/Mesh/mesh.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/ND/nd_defines.h b/source/6LoWPAN/ND/nd_defines.h index 6cc37bd17c..36f381e0a3 100644 --- a/source/6LoWPAN/ND/nd_defines.h +++ b/source/6LoWPAN/ND/nd_defines.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, 2019, Arm Limited and affiliates. + * Copyright (c) 2014-2017, 2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/ND/nd_router_object.c b/source/6LoWPAN/ND/nd_router_object.c index 25441af0a3..40aa092de5 100644 --- a/source/6LoWPAN/ND/nd_router_object.c +++ b/source/6LoWPAN/ND/nd_router_object.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2019, Arm Limited and affiliates. + * Copyright (c) 2013-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/ND/nd_router_object.h b/source/6LoWPAN/ND/nd_router_object.h index 78d494fbf4..a369ed84c3 100644 --- a/source/6LoWPAN/ND/nd_router_object.h +++ b/source/6LoWPAN/ND/nd_router_object.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2017, Arm Limited and affiliates. + * Copyright (c) 2013-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/NVM/nwk_nvm.c b/source/6LoWPAN/NVM/nwk_nvm.c index 1da43f28cf..4a57e129a9 100644 --- a/source/6LoWPAN/NVM/nwk_nvm.c +++ b/source/6LoWPAN/NVM/nwk_nvm.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019, Arm Limited and affiliates. + * Copyright (c) 2017-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/NVM/nwk_nvm.h b/source/6LoWPAN/NVM/nwk_nvm.h index 5b4c82dc41..6950f4d2a1 100644 --- a/source/6LoWPAN/NVM/nwk_nvm.h +++ b/source/6LoWPAN/NVM/nwk_nvm.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Arm Limited and affiliates. + * Copyright (c) 2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/Thread/thread_bbr_api.c b/source/6LoWPAN/Thread/thread_bbr_api.c index bab9f73d6f..bae8e8a3c7 100644 --- a/source/6LoWPAN/Thread/thread_bbr_api.c +++ b/source/6LoWPAN/Thread/thread_bbr_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018, Arm Limited and affiliates. + * Copyright (c) 2017-2020, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_bbr_api_internal.h b/source/6LoWPAN/Thread/thread_bbr_api_internal.h index e9074ebd67..ca71446a21 100644 --- a/source/6LoWPAN/Thread/thread_bbr_api_internal.h +++ b/source/6LoWPAN/Thread/thread_bbr_api_internal.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_bbr_commercial.c b/source/6LoWPAN/Thread/thread_bbr_commercial.c index 17eb7096c9..3abd7735e2 100644 --- a/source/6LoWPAN/Thread/thread_bbr_commercial.c +++ b/source/6LoWPAN/Thread/thread_bbr_commercial.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019, Arm Limited and affiliates. + * Copyright (c) 2017-2019, 2021, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without @@ -1351,7 +1351,7 @@ void thread_bbr_commercial_route_update(protocol_interface_info_entry_t *cur) // remove with info and add valid domain prefix again to back bone interface ipv6_route_table_remove_info(this->backbone_interface_id, ROUTE_THREAD_BBR, NULL); - if (!addr_is_ipv6_unspecified(this->domain_prefix)) { + if (memcmp(this->domain_prefix, ADDR_UNSPECIFIED, 8) != 0) { // add dua route to backbone, delete dua from on-mesh route ipv6_route_add_with_info(this->domain_prefix, 64, this->backbone_interface_id, NULL, ROUTE_THREAD_BBR, NULL, 0, 0xffffffff, 0); tr_info("Hosting pBBR for DUA prefix"); diff --git a/source/6LoWPAN/Thread/thread_bbr_commercial.h b/source/6LoWPAN/Thread/thread_bbr_commercial.h index ebe3aa7705..eedf71cbce 100644 --- a/source/6LoWPAN/Thread/thread_bbr_commercial.h +++ b/source/6LoWPAN/Thread/thread_bbr_commercial.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019, Arm Limited and affiliates. + * Copyright (c) 2017-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_beacon.c b/source/6LoWPAN/Thread/thread_beacon.c index 115cf02134..e9e8bf91d2 100644 --- a/source/6LoWPAN/Thread/thread_beacon.c +++ b/source/6LoWPAN/Thread/thread_beacon.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2019, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_beacon.h b/source/6LoWPAN/Thread/thread_beacon.h index bd50f1a15a..69a924ad08 100644 --- a/source/6LoWPAN/Thread/thread_beacon.h +++ b/source/6LoWPAN/Thread/thread_beacon.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2019, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_bootstrap.c b/source/6LoWPAN/Thread/thread_bootstrap.c index 1d0537d343..af16058f13 100644 --- a/source/6LoWPAN/Thread/thread_bootstrap.c +++ b/source/6LoWPAN/Thread/thread_bootstrap.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2020, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_bootstrap.h b/source/6LoWPAN/Thread/thread_bootstrap.h index c1e155a504..13383e8a18 100644 --- a/source/6LoWPAN/Thread/thread_bootstrap.h +++ b/source/6LoWPAN/Thread/thread_bootstrap.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_border_router_api.c b/source/6LoWPAN/Thread/thread_border_router_api.c index fc7a009bf9..d035b16d08 100644 --- a/source/6LoWPAN/Thread/thread_border_router_api.c +++ b/source/6LoWPAN/Thread/thread_border_router_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_border_router_api_internal.h b/source/6LoWPAN/Thread/thread_border_router_api_internal.h index 53db69b22b..88d9494aca 100644 --- a/source/6LoWPAN/Thread/thread_border_router_api_internal.h +++ b/source/6LoWPAN/Thread/thread_border_router_api_internal.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_ccm.c b/source/6LoWPAN/Thread/thread_ccm.c index e4da36ce64..0795599e8b 100644 --- a/source/6LoWPAN/Thread/thread_ccm.c +++ b/source/6LoWPAN/Thread/thread_ccm.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019, Arm Limited and affiliates. + * Copyright (c) 2017-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_ccm.h b/source/6LoWPAN/Thread/thread_ccm.h index ca84cb6dfe..72958da2f6 100644 --- a/source/6LoWPAN/Thread/thread_ccm.h +++ b/source/6LoWPAN/Thread/thread_ccm.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019, Arm Limited and affiliates. + * Copyright (c) 2017-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_commissioning_api.c b/source/6LoWPAN/Thread/thread_commissioning_api.c index 2b498bb151..f9939a1cc2 100644 --- a/source/6LoWPAN/Thread/thread_commissioning_api.c +++ b/source/6LoWPAN/Thread/thread_commissioning_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2019, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_commissioning_if.c b/source/6LoWPAN/Thread/thread_commissioning_if.c index af327f6cb3..29274f10b3 100644 --- a/source/6LoWPAN/Thread/thread_commissioning_if.c +++ b/source/6LoWPAN/Thread/thread_commissioning_if.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019, Arm Limited and affiliates. + * Copyright (c) 2014-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_commissioning_if.h b/source/6LoWPAN/Thread/thread_commissioning_if.h index 448c0ce3c4..3aba2c31e4 100644 --- a/source/6LoWPAN/Thread/thread_commissioning_if.h +++ b/source/6LoWPAN/Thread/thread_commissioning_if.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2017, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_common.c b/source/6LoWPAN/Thread/thread_common.c index 8e843f5673..a5146cc29b 100644 --- a/source/6LoWPAN/Thread/thread_common.c +++ b/source/6LoWPAN/Thread/thread_common.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2015, 2017-2019, Arm Limited and affiliates. + * Copyright (c) 2014-2015, 2017-2020, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_common.h b/source/6LoWPAN/Thread/thread_common.h index 9e3d6a971f..2850c9481f 100644 --- a/source/6LoWPAN/Thread/thread_common.h +++ b/source/6LoWPAN/Thread/thread_common.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019, Arm Limited and affiliates. + * Copyright (c) 2014-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_config.h b/source/6LoWPAN/Thread/thread_config.h index 4b8d41db18..574b5d69e1 100644 --- a/source/6LoWPAN/Thread/thread_config.h +++ b/source/6LoWPAN/Thread/thread_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_constants.h b/source/6LoWPAN/Thread/thread_constants.h index 2ad12b4271..12cd1ee8d9 100644 --- a/source/6LoWPAN/Thread/thread_constants.h +++ b/source/6LoWPAN/Thread/thread_constants.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_dhcpv6_server.c b/source/6LoWPAN/Thread/thread_dhcpv6_server.c index c01e385bb0..951ed6b100 100644 --- a/source/6LoWPAN/Thread/thread_dhcpv6_server.c +++ b/source/6LoWPAN/Thread/thread_dhcpv6_server.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2015, 2018-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_dhcpv6_server.h b/source/6LoWPAN/Thread/thread_dhcpv6_server.h index b8e56a63f0..ed17352db5 100644 --- a/source/6LoWPAN/Thread/thread_dhcpv6_server.h +++ b/source/6LoWPAN/Thread/thread_dhcpv6_server.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Arm Limited and affiliates. + * Copyright (c) 2018, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_diagnostic.c b/source/6LoWPAN/Thread/thread_diagnostic.c index 4dafbd34bd..23f627dea5 100644 --- a/source/6LoWPAN/Thread/thread_diagnostic.c +++ b/source/6LoWPAN/Thread/thread_diagnostic.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2018, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_diagnostic.h b/source/6LoWPAN/Thread/thread_diagnostic.h index 5e787e4401..fe217ed7d7 100644 --- a/source/6LoWPAN/Thread/thread_diagnostic.h +++ b/source/6LoWPAN/Thread/thread_diagnostic.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017, Arm Limited and affiliates. + * Copyright (c) 2016-2017, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_discovery.c b/source/6LoWPAN/Thread/thread_discovery.c index 278e69a541..61dfe6e2c2 100644 --- a/source/6LoWPAN/Thread/thread_discovery.c +++ b/source/6LoWPAN/Thread/thread_discovery.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_discovery.h b/source/6LoWPAN/Thread/thread_discovery.h index 1e44c1b2be..336173d273 100644 --- a/source/6LoWPAN/Thread/thread_discovery.h +++ b/source/6LoWPAN/Thread/thread_discovery.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_host_bootstrap.c b/source/6LoWPAN/Thread/thread_host_bootstrap.c index 35a95c6227..64f48b7b3d 100644 --- a/source/6LoWPAN/Thread/thread_host_bootstrap.c +++ b/source/6LoWPAN/Thread/thread_host_bootstrap.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2019, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_host_bootstrap.h b/source/6LoWPAN/Thread/thread_host_bootstrap.h index b541154527..b76bcc2e5c 100644 --- a/source/6LoWPAN/Thread/thread_host_bootstrap.h +++ b/source/6LoWPAN/Thread/thread_host_bootstrap.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2018, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_joiner_application.c b/source/6LoWPAN/Thread/thread_joiner_application.c index e880b7e0a8..481dc23775 100644 --- a/source/6LoWPAN/Thread/thread_joiner_application.c +++ b/source/6LoWPAN/Thread/thread_joiner_application.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_joiner_application.h b/source/6LoWPAN/Thread/thread_joiner_application.h index 9f5dc88a4c..90646ae813 100644 --- a/source/6LoWPAN/Thread/thread_joiner_application.h +++ b/source/6LoWPAN/Thread/thread_joiner_application.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_leader_service.c b/source/6LoWPAN/Thread/thread_leader_service.c index 73a6000893..404b701c8e 100644 --- a/source/6LoWPAN/Thread/thread_leader_service.c +++ b/source/6LoWPAN/Thread/thread_leader_service.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_leader_service.h b/source/6LoWPAN/Thread/thread_leader_service.h index a28bb9202f..b1a0cc212e 100644 --- a/source/6LoWPAN/Thread/thread_leader_service.h +++ b/source/6LoWPAN/Thread/thread_leader_service.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2018, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_lowpower_api.c b/source/6LoWPAN/Thread/thread_lowpower_api.c index bfae858d6b..c953d323ca 100644 --- a/source/6LoWPAN/Thread/thread_lowpower_api.c +++ b/source/6LoWPAN/Thread/thread_lowpower_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018, Arm Limited and affiliates. + * Copyright (c) 2017-2018, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_lowpower_private_api.c b/source/6LoWPAN/Thread/thread_lowpower_private_api.c index 06ba84d684..0d78c4f361 100644 --- a/source/6LoWPAN/Thread/thread_lowpower_private_api.c +++ b/source/6LoWPAN/Thread/thread_lowpower_private_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019, Arm Limited and affiliates. + * Copyright (c) 2017-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_lowpower_private_api.h b/source/6LoWPAN/Thread/thread_lowpower_private_api.h index faed87cbba..9a1c3d614e 100644 --- a/source/6LoWPAN/Thread/thread_lowpower_private_api.h +++ b/source/6LoWPAN/Thread/thread_lowpower_private_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017, Arm Limited and affiliates. + * Copyright (c) 2016-2017, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_management_api.c b/source/6LoWPAN/Thread/thread_management_api.c index 60e02e3aee..9b41ad0e9b 100644 --- a/source/6LoWPAN/Thread/thread_management_api.c +++ b/source/6LoWPAN/Thread/thread_management_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2019, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_management_client.c b/source/6LoWPAN/Thread/thread_management_client.c index 50950f5b2b..fb8ea1138c 100644 --- a/source/6LoWPAN/Thread/thread_management_client.c +++ b/source/6LoWPAN/Thread/thread_management_client.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_management_client.h b/source/6LoWPAN/Thread/thread_management_client.h index 7822b5757c..86d61de2c8 100644 --- a/source/6LoWPAN/Thread/thread_management_client.h +++ b/source/6LoWPAN/Thread/thread_management_client.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_management_if.c b/source/6LoWPAN/Thread/thread_management_if.c index 2a35d85dfe..76fd5739a6 100644 --- a/source/6LoWPAN/Thread/thread_management_if.c +++ b/source/6LoWPAN/Thread/thread_management_if.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019, Arm Limited and affiliates. + * Copyright (c) 2014-2019, 2021, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_management_internal.h b/source/6LoWPAN/Thread/thread_management_internal.h index 3e3dac832f..e4e3891d8a 100644 --- a/source/6LoWPAN/Thread/thread_management_internal.h +++ b/source/6LoWPAN/Thread/thread_management_internal.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2018, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_management_server.c b/source/6LoWPAN/Thread/thread_management_server.c index 5d602813ad..cbab57d3ab 100644 --- a/source/6LoWPAN/Thread/thread_management_server.c +++ b/source/6LoWPAN/Thread/thread_management_server.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019, Arm Limited and affiliates. + * Copyright (c) 2014-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_management_server.h b/source/6LoWPAN/Thread/thread_management_server.h index 8f3552791a..c2d41dfc97 100644 --- a/source/6LoWPAN/Thread/thread_management_server.h +++ b/source/6LoWPAN/Thread/thread_management_server.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019, Arm Limited and affiliates. + * Copyright (c) 2014-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_mdns.c b/source/6LoWPAN/Thread/thread_mdns.c index 168bff5e81..4607f3f722 100644 --- a/source/6LoWPAN/Thread/thread_mdns.c +++ b/source/6LoWPAN/Thread/thread_mdns.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019, Arm Limited and affiliates. + * Copyright (c) 2017-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_mdns.h b/source/6LoWPAN/Thread/thread_mdns.h index 0f9a1547f9..a9a603db10 100644 --- a/source/6LoWPAN/Thread/thread_mdns.h +++ b/source/6LoWPAN/Thread/thread_mdns.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Arm Limited and affiliates. + * Copyright (c) 2017, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_meshcop_lib.c b/source/6LoWPAN/Thread/thread_meshcop_lib.c index 09a70ce682..acd798c2c3 100644 --- a/source/6LoWPAN/Thread/thread_meshcop_lib.c +++ b/source/6LoWPAN/Thread/thread_meshcop_lib.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2019, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_mle_message_handler.c b/source/6LoWPAN/Thread/thread_mle_message_handler.c index 9a465fbc27..716aa2ef02 100644 --- a/source/6LoWPAN/Thread/thread_mle_message_handler.c +++ b/source/6LoWPAN/Thread/thread_mle_message_handler.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2020, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_mle_message_handler.h b/source/6LoWPAN/Thread/thread_mle_message_handler.h index 6eb6dd7dbc..5ea3e327bc 100644 --- a/source/6LoWPAN/Thread/thread_mle_message_handler.h +++ b/source/6LoWPAN/Thread/thread_mle_message_handler.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017, Arm Limited and affiliates. + * Copyright (c) 2016-2017, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_nd.c b/source/6LoWPAN/Thread/thread_nd.c index ceff56d07f..89429438a5 100644 --- a/source/6LoWPAN/Thread/thread_nd.c +++ b/source/6LoWPAN/Thread/thread_nd.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019, Arm Limited and affiliates. + * Copyright (c) 2014-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_nd.h b/source/6LoWPAN/Thread/thread_nd.h index 60277db436..bcc47c599d 100644 --- a/source/6LoWPAN/Thread/thread_nd.h +++ b/source/6LoWPAN/Thread/thread_nd.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2018, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_neighbor_class.c b/source/6LoWPAN/Thread/thread_neighbor_class.c index bf0eead1b6..95f2a43cc6 100644 --- a/source/6LoWPAN/Thread/thread_neighbor_class.c +++ b/source/6LoWPAN/Thread/thread_neighbor_class.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Arm Limited and affiliates. + * Copyright (c) 2018, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_neighbor_class.h b/source/6LoWPAN/Thread/thread_neighbor_class.h index 5244441741..4d82195cf2 100644 --- a/source/6LoWPAN/Thread/thread_neighbor_class.h +++ b/source/6LoWPAN/Thread/thread_neighbor_class.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Arm Limited and affiliates. + * Copyright (c) 2018, 2020, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_net_config_api.c b/source/6LoWPAN/Thread/thread_net_config_api.c index 62831be013..84ad064604 100644 --- a/source/6LoWPAN/Thread/thread_net_config_api.c +++ b/source/6LoWPAN/Thread/thread_net_config_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017, Arm Limited and affiliates. + * Copyright (c) 2016-2017, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_network_data_lib.c b/source/6LoWPAN/Thread/thread_network_data_lib.c index c7167e5937..8f1d9865ea 100644 --- a/source/6LoWPAN/Thread/thread_network_data_lib.c +++ b/source/6LoWPAN/Thread/thread_network_data_lib.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_network_data_lib.h b/source/6LoWPAN/Thread/thread_network_data_lib.h index 5c37901111..144af502d9 100644 --- a/source/6LoWPAN/Thread/thread_network_data_lib.h +++ b/source/6LoWPAN/Thread/thread_network_data_lib.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2018, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_network_data_storage.c b/source/6LoWPAN/Thread/thread_network_data_storage.c index 38576ac17e..2b43176ce7 100755 --- a/source/6LoWPAN/Thread/thread_network_data_storage.c +++ b/source/6LoWPAN/Thread/thread_network_data_storage.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_network_data_storage.h b/source/6LoWPAN/Thread/thread_network_data_storage.h index 54bef09e9b..8269821f3b 100644 --- a/source/6LoWPAN/Thread/thread_network_data_storage.h +++ b/source/6LoWPAN/Thread/thread_network_data_storage.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2018, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_network_synch.c b/source/6LoWPAN/Thread/thread_network_synch.c index 1ffbdc8da9..19c858e648 100644 --- a/source/6LoWPAN/Thread/thread_network_synch.c +++ b/source/6LoWPAN/Thread/thread_network_synch.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2018, 2020, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_network_synch.h b/source/6LoWPAN/Thread/thread_network_synch.h index eb85ae0a03..36adc78b69 100644 --- a/source/6LoWPAN/Thread/thread_network_synch.h +++ b/source/6LoWPAN/Thread/thread_network_synch.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2018, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_nvm_store.c b/source/6LoWPAN/Thread/thread_nvm_store.c index 876639933c..bc97297094 100644 --- a/source/6LoWPAN/Thread/thread_nvm_store.c +++ b/source/6LoWPAN/Thread/thread_nvm_store.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019, Arm Limited and affiliates. + * Copyright (c) 2017-2020, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_nvm_store.h b/source/6LoWPAN/Thread/thread_nvm_store.h index bba95038a5..5c03f9f716 100644 --- a/source/6LoWPAN/Thread/thread_nvm_store.h +++ b/source/6LoWPAN/Thread/thread_nvm_store.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018, Arm Limited and affiliates. + * Copyright (c) 2017-2018, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_resolution_client.c b/source/6LoWPAN/Thread/thread_resolution_client.c index 79740a0296..7ff3549871 100644 --- a/source/6LoWPAN/Thread/thread_resolution_client.c +++ b/source/6LoWPAN/Thread/thread_resolution_client.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019, Arm Limited and affiliates. + * Copyright (c) 2014-2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_resolution_client.h b/source/6LoWPAN/Thread/thread_resolution_client.h index aec6f3911a..4f42a527a5 100644 --- a/source/6LoWPAN/Thread/thread_resolution_client.h +++ b/source/6LoWPAN/Thread/thread_resolution_client.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2017, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_resolution_server.c b/source/6LoWPAN/Thread/thread_resolution_server.c index bbf2821eff..e21c71d9d4 100644 --- a/source/6LoWPAN/Thread/thread_resolution_server.c +++ b/source/6LoWPAN/Thread/thread_resolution_server.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2018, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_resolution_server.h b/source/6LoWPAN/Thread/thread_resolution_server.h index 77fa611045..ea003a0bab 100644 --- a/source/6LoWPAN/Thread/thread_resolution_server.h +++ b/source/6LoWPAN/Thread/thread_resolution_server.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2018, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_router_bootstrap.c b/source/6LoWPAN/Thread/thread_router_bootstrap.c index df32d174f6..29066cf88f 100644 --- a/source/6LoWPAN/Thread/thread_router_bootstrap.c +++ b/source/6LoWPAN/Thread/thread_router_bootstrap.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2019, Arm Limited and affiliates. + * Copyright (c) 2015-2020, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_router_bootstrap.h b/source/6LoWPAN/Thread/thread_router_bootstrap.h index 6874a01b0b..b32982aa93 100644 --- a/source/6LoWPAN/Thread/thread_router_bootstrap.h +++ b/source/6LoWPAN/Thread/thread_router_bootstrap.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2018, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_routing.c b/source/6LoWPAN/Thread/thread_routing.c index 18a6f04f6a..1bb410f6f0 100644 --- a/source/6LoWPAN/Thread/thread_routing.c +++ b/source/6LoWPAN/Thread/thread_routing.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2018, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_routing.h b/source/6LoWPAN/Thread/thread_routing.h index 720cecbe3e..ef53fcc1e8 100644 --- a/source/6LoWPAN/Thread/thread_routing.h +++ b/source/6LoWPAN/Thread/thread_routing.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2018, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_test_api.c b/source/6LoWPAN/Thread/thread_test_api.c index 79a3972425..ac9faec896 100644 --- a/source/6LoWPAN/Thread/thread_test_api.c +++ b/source/6LoWPAN/Thread/thread_test_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019, Arm Limited and affiliates. + * Copyright (c) 2014-2021, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/Thread/thread_tmfcop_lib.h b/source/6LoWPAN/Thread/thread_tmfcop_lib.h index d6ab869f50..7827a019f9 100644 --- a/source/6LoWPAN/Thread/thread_tmfcop_lib.h +++ b/source/6LoWPAN/Thread/thread_tmfcop_lib.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2017, 2019, Pelion and affiliates. * SPDX-License-Identifier: BSD-3-Clause * * Redistribution and use in source and binary forms, with or without diff --git a/source/6LoWPAN/adaptation_interface.c b/source/6LoWPAN/adaptation_interface.c index 0374731751..4423636e03 100644 --- a/source/6LoWPAN/adaptation_interface.c +++ b/source/6LoWPAN/adaptation_interface.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -120,6 +120,10 @@ typedef struct { #define LOWPAN_MEM_LIMIT_REMOVE_MAX 10000 // Remove when at memory limit #define LOWPAN_MEM_LIMIT_REMOVE_EF_MODE 20000 // Remove when out of memory and we are in EF mode +#define LOWPAN_TX_BUFFER_AGE_LIMIT_LOW_PRIORITY 30 // Remove low priority packets older than limit (seconds) +#define LOWPAN_TX_BUFFER_AGE_LIMIT_HIGH_PRIORITY 60 // Remove high priority packets older than limit (seconds) +#define LOWPAN_TX_BUFFER_AGE_LIMIT_EF_PRIORITY 120 // Remove expedited forwarding packets older than limit (seconds) + static NS_LIST_DEFINE(fragmenter_interface_list, fragmenter_interface_t, link); @@ -128,8 +132,8 @@ static NS_LIST_DEFINE(fragmenter_interface_list, fragmenter_interface_t, link); static fragmenter_interface_t *lowpan_adaptation_interface_discover(int8_t interfaceId); /* Interface direct message pending queue functions */ -static void lowpan_adaptation_tx_queue_write(fragmenter_interface_t *interface_ptr, buffer_t *buf); -static buffer_t *lowpan_adaptation_tx_queue_read(fragmenter_interface_t *interface_ptr); +static void lowpan_adaptation_tx_queue_write(protocol_interface_info_entry_t *cur, fragmenter_interface_t *interface_ptr, buffer_t *buf); +static buffer_t *lowpan_adaptation_tx_queue_read(protocol_interface_info_entry_t *cur, fragmenter_interface_t *interface_ptr); /* Data direction and message length validation */ static bool lowpan_adaptation_indirect_data_request(mac_neighbor_table_entry_t *mle_entry); @@ -223,8 +227,11 @@ static struct protocol_interface_info_entry *lowpan_adaptation_network_interface } -static void lowpan_adaptation_tx_queue_level_update(fragmenter_interface_t *interface_ptr) +static void lowpan_adaptation_tx_queue_level_update(protocol_interface_info_entry_t *cur, fragmenter_interface_t *interface_ptr) { + random_early_detetction_aq_calc(cur->random_early_detection, interface_ptr->directTxQueue_size); + protocol_stats_update(STATS_AL_TX_QUEUE_SIZE, interface_ptr->directTxQueue_size); + if (interface_ptr->directTxQueue_size == interface_ptr->directTxQueue_level + ADAPTION_DIRECT_TX_QUEUE_SIZE_THRESHOLD_TRACE || interface_ptr->directTxQueue_size == interface_ptr->directTxQueue_level - ADAPTION_DIRECT_TX_QUEUE_SIZE_THRESHOLD_TRACE) { interface_ptr->directTxQueue_level = interface_ptr->directTxQueue_size; @@ -233,14 +240,14 @@ static void lowpan_adaptation_tx_queue_level_update(fragmenter_interface_t *inte } -static void lowpan_adaptation_tx_queue_write(fragmenter_interface_t *interface_ptr, buffer_t *buf) +static void lowpan_adaptation_tx_queue_write(protocol_interface_info_entry_t *cur, fragmenter_interface_t *interface_ptr, buffer_t *buf) { buffer_t *lower_priority_buf = NULL; - ns_list_foreach(buffer_t, cur, &interface_ptr->directTxQueue) { + ns_list_foreach(buffer_t, entry, &interface_ptr->directTxQueue) { - if (cur->priority < buf->priority) { - lower_priority_buf = cur; + if (entry->priority < buf->priority) { + lower_priority_buf = entry; break; } } @@ -251,18 +258,17 @@ static void lowpan_adaptation_tx_queue_write(fragmenter_interface_t *interface_p ns_list_add_to_end(&interface_ptr->directTxQueue, buf); } interface_ptr->directTxQueue_size++; - lowpan_adaptation_tx_queue_level_update(interface_ptr); - protocol_stats_update(STATS_AL_TX_QUEUE_SIZE, interface_ptr->directTxQueue_size); + lowpan_adaptation_tx_queue_level_update(cur, interface_ptr); } -static void lowpan_adaptation_tx_queue_write_to_front(fragmenter_interface_t *interface_ptr, buffer_t *buf) +static void lowpan_adaptation_tx_queue_write_to_front(protocol_interface_info_entry_t *cur, fragmenter_interface_t *interface_ptr, buffer_t *buf) { buffer_t *lower_priority_buf = NULL; - ns_list_foreach(buffer_t, cur, &interface_ptr->directTxQueue) { + ns_list_foreach(buffer_t, entry, &interface_ptr->directTxQueue) { - if (cur->priority <= buf->priority) { - lower_priority_buf = cur; + if (entry->priority <= buf->priority) { + lower_priority_buf = entry; break; } } @@ -273,11 +279,10 @@ static void lowpan_adaptation_tx_queue_write_to_front(fragmenter_interface_t *in ns_list_add_to_end(&interface_ptr->directTxQueue, buf); } interface_ptr->directTxQueue_size++; - lowpan_adaptation_tx_queue_level_update(interface_ptr); - protocol_stats_update(STATS_AL_TX_QUEUE_SIZE, interface_ptr->directTxQueue_size); + lowpan_adaptation_tx_queue_level_update(cur, interface_ptr); } -static buffer_t *lowpan_adaptation_tx_queue_read(fragmenter_interface_t *interface_ptr) +static buffer_t *lowpan_adaptation_tx_queue_read(protocol_interface_info_entry_t *cur, fragmenter_interface_t *interface_ptr) { // Currently this function is called only when data confirm is received for previously sent packet. if (!interface_ptr->directTxQueue_size) { @@ -293,8 +298,7 @@ static buffer_t *lowpan_adaptation_tx_queue_read(fragmenter_interface_t *interfa if (lowpan_buffer_tx_allowed(interface_ptr, buf)) { ns_list_remove(&interface_ptr->directTxQueue, buf); interface_ptr->directTxQueue_size--; - lowpan_adaptation_tx_queue_level_update(interface_ptr); - protocol_stats_update(STATS_AL_TX_QUEUE_SIZE, interface_ptr->directTxQueue_size); + lowpan_adaptation_tx_queue_level_update(cur, interface_ptr); return buf; } } @@ -561,12 +565,24 @@ void lowpan_adaptation_free_heap(bool full_gc) lowpan_adaptation_free_low_priority_packets(interface_ptr->interface_id, priority, amount); } } +buffer_t *lowpan_adaptation_get_oldest_packet(fragmenter_interface_t *interface_ptr, buffer_priority_t priority) +{ + ns_list_foreach(buffer_t, entry, &interface_ptr->directTxQueue) { + if (entry->priority == priority) { + // Only Higher priority packets left no need to go through list anymore + return entry; + } + } + return NULL; + +} int8_t lowpan_adaptation_free_low_priority_packets(int8_t interface_id, buffer_priority_t max_priority, uint32_t requested_amount) { fragmenter_interface_t *interface_ptr = lowpan_adaptation_interface_discover(interface_id); + protocol_interface_info_entry_t *cur = protocol_stack_interface_info_get_by_id(interface_id); - if (!interface_ptr) { + if (!interface_ptr || !cur) { return -1; } uint32_t adaptation_memory = 0; @@ -592,21 +608,36 @@ int8_t lowpan_adaptation_free_low_priority_packets(int8_t interface_id, buffer_p requested_amount = adaptation_memory - LOWPAN_MEM_LIMIT_MIN_MEMORY; } - //Only remove last entries from TX queue with low priority - ns_list_foreach_reverse_safe(buffer_t, entry, &interface_ptr->directTxQueue) { - if (entry->priority <= max_priority) { - memory_freed += sizeof(buffer_t) + entry->size; - packets_freed++; - ns_list_remove(&interface_ptr->directTxQueue, entry); - interface_ptr->directTxQueue_size--; - lowpan_adaptation_tx_queue_level_update(interface_ptr); - socket_tx_buffer_event_and_free(entry, SOCKET_TX_FAIL); - } - if (memory_freed > requested_amount) { - // Enough memory freed + /* Order of packets is + * priority 4 oldest to newest + * priority 3 oldest to newest + * priority 2 oldest to newest + * priority 1 oldest to newest + * priority 0 oldest to newest + * So we search oldest for lowest priority and delete that until that priority is empty + * and then start deleting one higher priority packets from oldest first + */ + + buffer_priority_t priority = QOS_NORMAL; + do { + buffer_t *entry = lowpan_adaptation_get_oldest_packet(interface_ptr, priority); + if (!entry) { + if (priority < max_priority) { + priority++; + continue; + } + // No more packets available break; } - } + // This packet can be deleted + memory_freed += sizeof(buffer_t) + entry->size; + packets_freed++; + ns_list_remove(&interface_ptr->directTxQueue, entry); + interface_ptr->directTxQueue_size--; + lowpan_adaptation_tx_queue_level_update(cur, interface_ptr); + socket_tx_buffer_event_and_free(entry, SOCKET_TX_FAIL); + } while (memory_freed < requested_amount); + tr_info("Adaptation Free low priority packets memory: %" PRIi32 " queue: %d deallocated %" PRIi32 " bytes, %d packets, %" PRIi32 " requested", adaptation_memory, adaptation_packets, memory_freed, packets_freed, requested_amount); return 0; } @@ -1155,17 +1186,9 @@ static bool lowpan_buffer_tx_allowed(fragmenter_interface_t *interface_ptr, buff return true; } -static uint32_t lowpan_adaptation_time_stamp_diff(uint32_t compare_stamp) -{ - if (protocol_core_monotonic_time < compare_stamp) { - return compare_stamp - protocol_core_monotonic_time; - } - return protocol_core_monotonic_time - compare_stamp; -} - static bool lowpan_adaptation_high_priority_state_exit(fragmenter_interface_t *interface_ptr) { - if (!interface_ptr->last_rx_high_priority || lowpan_adaptation_time_stamp_diff(interface_ptr->last_rx_high_priority) < LOWPAN_HIGH_PRIORITY_STATE_LENGTH) { + if (!interface_ptr->last_rx_high_priority || ((protocol_core_monotonic_time - interface_ptr->last_rx_high_priority) < LOWPAN_HIGH_PRIORITY_STATE_LENGTH)) { return false; } @@ -1210,8 +1233,7 @@ static void lowpan_adaptation_high_priority_state_enable(protocol_interface_info interface_ptr->activeTxList_size--; ns_dyn_mem_free(entry); //Add message to tx queue front based on priority. Now same priority at buf is prioritised at order - lowpan_adaptation_tx_queue_write_to_front(interface_ptr, buf); - random_early_detetction_aq_calc(cur->random_early_detection, interface_ptr->directTxQueue_size); + lowpan_adaptation_tx_queue_write_to_front(cur, interface_ptr, buf); } } } @@ -1242,6 +1264,15 @@ void lowpan_adaptation_expedite_forward_enable(protocol_interface_info_entry_t * lowpan_adaptation_high_priority_state_enable(cur, interface_ptr); } +bool lowpan_adaptation_expedite_forward_state_get(protocol_interface_info_entry_t *cur) +{ + fragmenter_interface_t *interface_ptr = lowpan_adaptation_interface_discover(cur->id); + if (!interface_ptr || !interface_ptr->last_rx_high_priority) { + return false; + } + return true; +} + void lowpan_adaptation_interface_slow_timer(protocol_interface_info_entry_t *cur) { fragmenter_interface_t *interface_ptr = lowpan_adaptation_interface_discover(cur->id); @@ -1251,16 +1282,31 @@ void lowpan_adaptation_interface_slow_timer(protocol_interface_info_entry_t *cur if (lowpan_adaptation_high_priority_state_exit(interface_ptr)) { //Activate Packets from TX queue - buffer_t *buf_from_queue = lowpan_adaptation_tx_queue_read(interface_ptr); + buffer_t *buf_from_queue = lowpan_adaptation_tx_queue_read(cur, interface_ptr); while (buf_from_queue) { lowpan_adaptation_interface_tx(cur, buf_from_queue); - buf_from_queue = lowpan_adaptation_tx_queue_read(interface_ptr); + buf_from_queue = lowpan_adaptation_tx_queue_read(cur, interface_ptr); } - //Update Average QUEUE - random_early_detetction_aq_calc(cur->random_early_detection, interface_ptr->directTxQueue_size); } } +static bool lowpan_adaptation_interface_check_buffer_timeout(buffer_t *buf) +{ + // Convert from 100ms slots to seconds + uint32_t buffer_age_s = (protocol_core_monotonic_time - buf->adaptation_timestamp) / 10; + + if ((buf->priority == QOS_NORMAL) && (buffer_age_s > LOWPAN_TX_BUFFER_AGE_LIMIT_LOW_PRIORITY)) { + return true; + } else if ((buf->priority == QOS_HIGH) && (buffer_age_s > LOWPAN_TX_BUFFER_AGE_LIMIT_HIGH_PRIORITY)) { + return true; + } else if ((buf->priority == QOS_NETWORK_CTRL) && (buffer_age_s > LOWPAN_TX_BUFFER_AGE_LIMIT_HIGH_PRIORITY)) { + return true; + } else if ((buf->priority == QOS_EXPEDITE_FORWARD) && (buffer_age_s > LOWPAN_TX_BUFFER_AGE_LIMIT_EF_PRIORITY)) { + return true; + } + return false; +} + int8_t lowpan_adaptation_interface_tx(protocol_interface_info_entry_t *cur, buffer_t *buf) { bool is_room_for_new_message; @@ -1288,6 +1334,18 @@ int8_t lowpan_adaptation_interface_tx(protocol_interface_info_entry_t *cur, buff buffer_priority_set(buf, QOS_HIGH); } + if (!buf->adaptation_timestamp) { + // Set TX start timestamp + buf->adaptation_timestamp = protocol_core_monotonic_time; + if (!buf->adaptation_timestamp) { + buf->adaptation_timestamp--; + } + } else if (lowpan_adaptation_interface_check_buffer_timeout(buf)) { + // Remove old buffers + socket_tx_buffer_event_and_free(buf, SOCKET_TX_FAIL); + return -1; + } + //Update priority status lowpan_adaptation_priority_status_update(cur, interface_ptr, buf->priority); @@ -1310,17 +1368,17 @@ int8_t lowpan_adaptation_interface_tx(protocol_interface_info_entry_t *cur, buff if (!lowpan_buffer_tx_allowed(interface_ptr, buf)) { - if (buf->priority == QOS_NORMAL) { - - if (random_early_detection_congestion_check(cur->random_early_detection)) { - random_early_detetction_aq_calc(cur->random_early_detection, interface_ptr->directTxQueue_size); + if (random_early_detection_congestion_check(cur->random_early_detection)) { + // If we need to drop packet we drop oldest normal Priority packet. + buffer_t *dropped = lowpan_adaptation_get_oldest_packet(interface_ptr, QOS_NORMAL); + if (dropped) { + ns_list_remove(&interface_ptr->directTxQueue, dropped); + interface_ptr->directTxQueue_size--; + socket_tx_buffer_event_and_free(dropped, SOCKET_TX_FAIL); protocol_stats_update(STATS_AL_TX_CONGESTION_DROP, 1); - goto tx_error_handler; } } - - lowpan_adaptation_tx_queue_write(interface_ptr, buf); - random_early_detetction_aq_calc(cur->random_early_detection, interface_ptr->directTxQueue_size); + lowpan_adaptation_tx_queue_write(cur, interface_ptr, buf); return 0; } @@ -1516,9 +1574,13 @@ int8_t lowpan_adaptation_interface_tx_confirm(protocol_interface_info_entry_t *c tr_error("No data request for this confirmation %u", confirm->msduHandle); return -1; } - //Check status for buffer_t *buf = tx_ptr->buf; + // Update adaptation layer latency for unicast packets. Given as seconds. + if (buf->link_specific.ieee802_15_4.requestAck && buf->adaptation_timestamp) { + protocol_stats_update(STATS_AL_TX_LATENCY, ((protocol_core_monotonic_time - buf->adaptation_timestamp) + 5) / 10); + } + //Indirect data expiration if (confirm->status == MLME_TRANSACTION_EXPIRED && !active_direct_confirm) { if (buf->link_specific.ieee802_15_4.indirectTTL > 7000) { @@ -1561,6 +1623,11 @@ int8_t lowpan_adaptation_interface_tx_confirm(protocol_interface_info_entry_t *c } } else if ((confirm->status == MLME_BUSY_CHAN) && !ws_info(cur)) { lowpan_data_request_to_mac(cur, buf, tx_ptr, interface_ptr); + } else if ((buf->link_specific.ieee802_15_4.requestAck) && (confirm->status == MLME_TRANSACTION_EXPIRED)) { + lowpan_adaptation_tx_queue_write_to_front(cur, interface_ptr, buf); + ns_list_remove(&interface_ptr->activeUnicastList, tx_ptr); + ns_dyn_mem_free(tx_ptr); + interface_ptr->activeTxList_size--; } else { @@ -1596,13 +1663,11 @@ int8_t lowpan_adaptation_interface_tx_confirm(protocol_interface_info_entry_t *c if (active_direct_confirm == true) { //Check Possibility for exit from High Priority state lowpan_adaptation_high_priority_state_exit(interface_ptr); - buffer_t *buf_from_queue = lowpan_adaptation_tx_queue_read(interface_ptr); + buffer_t *buf_from_queue = lowpan_adaptation_tx_queue_read(cur, interface_ptr); while (buf_from_queue) { lowpan_adaptation_interface_tx(cur, buf_from_queue); - buf_from_queue = lowpan_adaptation_tx_queue_read(interface_ptr); + buf_from_queue = lowpan_adaptation_tx_queue_read(cur, interface_ptr); } - //Update Average QUEUE - random_early_detetction_aq_calc(cur->random_early_detection, interface_ptr->directTxQueue_size); } return 0; } @@ -1806,8 +1871,7 @@ int8_t lowpan_adaptation_free_messages_from_queues_by_address(struct protocol_in ns_list_remove(&interface_ptr->directTxQueue, entry); interface_ptr->directTxQueue_size--; //Update Average QUEUE - random_early_detetction_aq_calc(cur->random_early_detection, interface_ptr->directTxQueue_size); - lowpan_adaptation_tx_queue_level_update(interface_ptr); + lowpan_adaptation_tx_queue_level_update(cur, interface_ptr); socket_tx_buffer_event_and_free(entry, SOCKET_TX_FAIL); } } diff --git a/source/6LoWPAN/lowpan_adaptation_interface.h b/source/6LoWPAN/lowpan_adaptation_interface.h index 5b88e28723..7e8227bb25 100644 --- a/source/6LoWPAN/lowpan_adaptation_interface.h +++ b/source/6LoWPAN/lowpan_adaptation_interface.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -64,6 +64,8 @@ int8_t lowpan_adaptation_indirect_queue_params_set(struct protocol_interface_inf void lowpan_adaptation_expedite_forward_enable(struct protocol_interface_info_entry *cur); +bool lowpan_adaptation_expedite_forward_state_get(struct protocol_interface_info_entry *cur); + void lowpan_adaptation_interface_slow_timer(struct protocol_interface_info_entry *cur); #endif /* LOWPAN_ADAPTATION_INTERFACE_H_ */ diff --git a/source/6LoWPAN/ws/ws_bbr_api.c b/source/6LoWPAN/ws/ws_bbr_api.c index 1fc5a5940c..051fca51ad 100644 --- a/source/6LoWPAN/ws/ws_bbr_api.c +++ b/source/6LoWPAN/ws/ws_bbr_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2021, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -42,6 +42,7 @@ #include "ws_management_api.h" #include "net_rpl.h" #include "Service_Libs/nd_proxy/nd_proxy.h" +#include "Service_Libs/utils/ns_time.h" #include "6LoWPAN/ws/ws_bbr_api_internal.h" #include "6LoWPAN/ws/ws_pae_controller.h" #include "6LoWPAN/lowpan_adaptation_interface.h" @@ -96,9 +97,6 @@ static uint8_t current_global_prefix[16] = {0}; // DHCP requires 16 bytes prefix static uint32_t bbr_delay_timer = BBR_CHECK_INTERVAL; // initial delay. static uint32_t global_prefix_unavailable_timer = 0; // initial delay. -static uint8_t *dhcp_vendor_data_ptr = NULL; -static uint8_t dhcp_vendor_data_len = 0; - static rpl_dodag_conf_t rpl_conf = { // Lifetime values .default_lifetime = 120, @@ -485,9 +483,38 @@ static bool wisun_dhcp_address_add_cb(int8_t interfaceId, dhcp_address_cache_upd return true; } +static uint8_t *ws_bbr_dhcp_server_dynamic_vendor_data_write(int8_t interfaceId, uint8_t *ptr, uint16_t *data_len) +{ + // If local time is not available vendor data is not written and data_len is not modified + (void)interfaceId; + + uint64_t time_read; + + if (0 != ns_time_system_time_read(&time_read)) { + return ptr; + } + + if (data_len) { + *data_len += net_vendor_option_current_time_length(); + } + if (!ptr) { + return ptr; + } + time_read += 2208988800; // Time starts now from the 0 era instead of First day of Unix (1 Jan 1970) + + uint32_t era = time_read / (uint64_t)(4294967296); + uint32_t timestamp = time_read - (era * (uint64_t)(4294967296)); + ptr = net_vendor_option_current_time_write(ptr, era, timestamp, 0); + + return ptr; +} + + static void ws_bbr_dhcp_server_dns_info_update(protocol_interface_info_entry_t *cur, uint8_t *global_id) { //add DNS server information to DHCP server that is learned from the backbone interface. + uint8_t *dhcp_vendor_data_ptr = NULL; + uint8_t dhcp_vendor_data_len = 0; uint8_t dns_server_address[16]; uint8_t *dns_search_list_ptr = NULL; uint8_t dns_search_list_len = 0; @@ -497,33 +524,40 @@ static void ws_bbr_dhcp_server_dns_info_update(protocol_interface_info_entry_t * DHCPv6_server_service_set_dns_server(cur->id, global_id, dns_server_address, dns_search_list_ptr, dns_search_list_len); } - //TODO Generate vendor data in Wi-SUN network include the cached DNS query results in some sort of TLV format + //Generate ARM specific vendor data in Wi-SUN network + // Cached DNS query results + // Network Time + int vendor_data_len = 0; for (int n = 0; n < MAX_DNS_RESOLUTIONS; n++) { if (pre_resolved_dns_queries[n].domain_name != NULL) { vendor_data_len += net_dns_option_vendor_option_data_dns_query_length(pre_resolved_dns_queries[n].domain_name); } } + if (vendor_data_len) { - ns_dyn_mem_free(dhcp_vendor_data_ptr); - dhcp_vendor_data_ptr = ns_dyn_mem_alloc(vendor_data_len); + dhcp_vendor_data_ptr = ns_dyn_mem_temporary_alloc(vendor_data_len); if (!dhcp_vendor_data_ptr) { tr_warn("Vendor info set fail"); return; } dhcp_vendor_data_len = vendor_data_len; } + // Write ARM vendor data + uint8_t *ptr = dhcp_vendor_data_ptr; + if (dhcp_vendor_data_ptr) { // Write vendor data - uint8_t *ptr = dhcp_vendor_data_ptr; for (int n = 0; n < MAX_DNS_RESOLUTIONS; n++) { if (pre_resolved_dns_queries[n].domain_name != NULL) { ptr = net_dns_option_vendor_option_data_dns_query_write(ptr, pre_resolved_dns_queries[n].address, pre_resolved_dns_queries[n].domain_name); } } } + DHCPv6_server_service_set_vendor_data_callback(cur->id, global_id, ARM_ENTERPRISE_NUMBER, ws_bbr_dhcp_server_dynamic_vendor_data_write); DHCPv6_server_service_set_vendor_data(cur->id, global_id, ARM_ENTERPRISE_NUMBER, dhcp_vendor_data_ptr, dhcp_vendor_data_len); + ns_dyn_mem_free(dhcp_vendor_data_ptr); } static void wisun_dhcp_address_remove_cb(int8_t interfaceId, uint8_t *targetAddress, void *prefix_info) diff --git a/source/6LoWPAN/ws/ws_bbr_api_internal.h b/source/6LoWPAN/ws/ws_bbr_api_internal.h index 24779fdc22..dab05547eb 100644 --- a/source/6LoWPAN/ws/ws_bbr_api_internal.h +++ b/source/6LoWPAN/ws/ws_bbr_api_internal.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/ws/ws_bootstrap.c b/source/6LoWPAN/ws/ws_bootstrap.c index 013c3c6e99..b3f97518c3 100644 --- a/source/6LoWPAN/ws/ws_bootstrap.c +++ b/source/6LoWPAN/ws/ws_bootstrap.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -49,6 +49,7 @@ #include "Common_Protocols/ip.h" #include "Service_Libs/Trickle/trickle.h" #include "Service_Libs/fhss/channel_list.h" +#include "Service_Libs/utils/ns_time.h" #include "6LoWPAN/ws/ws_common_defines.h" #include "6LoWPAN/ws/ws_common_defines.h" #include "6LoWPAN/ws/ws_config.h" @@ -199,57 +200,10 @@ static void ws_bootstrap_neighbor_delete(struct protocol_interface_info_entry *i ws_neighbor_class_entry_remove(&interface->ws_info->neighbor_storage, entry_ptr->index); } -static void ws_bootstap_eapol_neigh_entry_allocate(struct protocol_interface_info_entry *interface) -{ - uint8_t mac_64[8]; - memset(mac_64, 0, sizeof(mac_64)); - - mac_neighbor_table_entry_t *mac_entry = ws_bootstrap_mac_neighbor_add(interface, mac_64); - - if (!mac_entry) { - return; - } - mac_entry->lifetime = 0xffffffff; - mac_entry->link_lifetime = 0xffffffff; - ws_neighbor_class_entry_t *ws_neigh = ws_neighbor_class_entry_get(&interface->ws_info->neighbor_storage, mac_entry->index); - if (!ws_neigh) { - return; - } - - interface->ws_info->eapol_tx_index = mac_entry->index; -} - -ws_neighbor_class_entry_t *ws_bootstrap_eapol_tx_temporary_set(struct protocol_interface_info_entry *interface, const uint8_t *src64) -{ - mlme_device_descriptor_t device_desc; - mac_neighbor_table_entry_t *mac_entry = mac_neighbor_table_attribute_discover(mac_neighbor_info(interface), interface->ws_info->eapol_tx_index); - if (!mac_entry) { - return NULL; - } - - memcpy(mac_entry->mac64, src64, 8); - mac_helper_device_description_write(interface, &device_desc, src64, 0xffff, 0, false); - mac_helper_devicetable_direct_set(interface->mac_api, &device_desc, interface->ws_info->eapol_tx_index); - return ws_neighbor_class_entry_get(&interface->ws_info->neighbor_storage, mac_entry->index); -} - -void ws_bootstrap_eapol_tx_temporary_clear(struct protocol_interface_info_entry *interface) -{ - mac_neighbor_table_entry_t *mac_entry = mac_neighbor_table_attribute_discover(mac_neighbor_info(interface), interface->ws_info->eapol_tx_index); - if (!mac_entry) { - return; - } - - memset(mac_entry->mac64, 0xff, 8); - mac_helper_devicetable_remove(interface->mac_api, interface->ws_info->eapol_tx_index, NULL); -} - static void ws_bootstrap_neighbor_list_clean(struct protocol_interface_info_entry *interface) { mac_neighbor_table_neighbor_list_clean(mac_neighbor_info(interface)); - //Allocate EAPOL TX temporary neigh entry - ws_bootstap_eapol_neigh_entry_allocate(interface); } static void ws_address_reregister_trig(struct protocol_interface_info_entry *interface) @@ -561,14 +515,19 @@ static fhss_ws_neighbor_timing_info_t *ws_get_neighbor_info(const fhss_api_t *ap return NULL; } mac_neighbor_table_entry_t *mac_neighbor = mac_neighbor_table_address_discover(mac_neighbor_info(cur), eui64, MAC_ADDR_MODE_64_BIT); - if (!mac_neighbor) { + if (mac_neighbor) { + ws_neighbor_class_entry_t *ws_neighbor = ws_neighbor_class_entry_get(&cur->ws_info->neighbor_storage, mac_neighbor->index); + if (!ws_neighbor) { + return NULL; + } + return &ws_neighbor->fhss_data; + } + //Discover temporary entry + ws_neighbor_temp_class_t *temp_entry = ws_llc_get_eapol_temp_entry(cur, eui64); + if (!temp_entry) { return NULL; } - ws_neighbor_class_entry_t *ws_neighbor = ws_neighbor_class_entry_get(&cur->ws_info->neighbor_storage, mac_neighbor->index); - if (!ws_neighbor) { - return NULL; - } - return &ws_neighbor->fhss_data; + return &temp_entry->neigh_info_list.fhss_data; } static void ws_bootstrap_llc_hopping_update(struct protocol_interface_info_entry *cur, const fhss_ws_configuration_t *fhss_configuration) { @@ -909,17 +868,17 @@ static void ws_bootstrap_ll_address_validate(struct protocol_interface_info_entr * \return 0x0000 address unknown or other error * \return 0x0001 no ETX statistics on this interface */ -uint16_t ws_etx_read(protocol_interface_info_entry_t *interface, addrtype_t addr_type, const uint8_t *addr_ptr) +uint16_t ws_local_etx_read(protocol_interface_info_entry_t *interface, addrtype_t addr_type, const uint8_t *mac_adddress) { uint16_t etx; - if (!addr_ptr || !interface) { + if (!mac_adddress || !interface) { return 0; } uint8_t attribute_index; - mac_neighbor_table_entry_t *mac_neighbor = mac_neighbor_table_address_discover(mac_neighbor_info(interface), addr_ptr + PAN_ID_LEN, addr_type); + mac_neighbor_table_entry_t *mac_neighbor = mac_neighbor_table_address_discover(mac_neighbor_info(interface), mac_adddress, addr_type); if (!mac_neighbor) { return 0xffff; } @@ -933,6 +892,12 @@ uint16_t ws_etx_read(protocol_interface_info_entry_t *interface, addrtype_t addr etx = etx_local_etx_read(interface->id, attribute_index); + // if we have a measurement ready then we will check the RSL validity + if (etx != 0xffff && !ws_neighbour->candidate_parent) { + // RSL value measured is lower than acceptable ETX will be given as MAX + return WS_ETX_MAX << 1; // We use 8 bit fraction and ETX is usually 7 bit fraction + } + // If we dont have valid ETX for children we assume good ETX. // After enough packets is sent to children real calculated ETX is given. // This might result in ICMP source route errors returned to Border router causing secondary route uses @@ -942,6 +907,15 @@ uint16_t ws_etx_read(protocol_interface_info_entry_t *interface, addrtype_t addr return etx; } + +uint16_t ws_etx_read(protocol_interface_info_entry_t *interface, addrtype_t addr_type, const uint8_t *addr_ptr) +{ + if (!addr_ptr || !interface) { + return 0; + } + return ws_local_etx_read(interface, addr_type, addr_ptr + PAN_ID_LEN); +} + bool ws_bootstrap_nd_ns_transmit(protocol_interface_info_entry_t *cur, ipv6_neighbour_t *entry, bool unicast, uint8_t seq) { (void)cur; @@ -1026,6 +1000,41 @@ static void ws_bootstrap_dhcp_info_notify_cb(int8_t interface, dhcp_option_notif net_dns_query_result_set(interface, address, domain, server_info->life_time); } } + if (option_type == ARM_DHCP_VENDOR_DATA_NETWORK_TIME) { + // Process ARM Network Time + // Get Current time + // Get Round trip time of the DHCP request + // Estimated error is elapsed time of request + // If current time difference is larger than estimated error update current time + // set the time for server time + *.5 RTT + int32_t era; + uint32_t offset; + if (net_vendor_option_current_time_read(options->option.vendor_spesific.data, options->option.vendor_spesific.data_length, &era, &offset, NULL)) { + uint64_t current_time; + uint64_t network_time = (era * (uint64_t)(4294967296)) + offset - 2208988800; //Convert to First day of Unix (1 Jan 1970) + + tr_debug("Network Time option Era:%"PRId32" Offset:%"PRIu32" rtt: %"PRId32" time: %"PRIu64, era, offset, server_info->rtt, network_time); + if (0 == ns_time_system_time_read(¤t_time)) { + uint64_t difference; + // We only adjust clock if time has drifted more than 10 seconds to avoid constant changing of time + // If Round trip time is very high the accuracy is reduced. + uint32_t estimated_error = 10 + server_info->rtt / 10; + // Take into account the round trip time it took the response to arrive from the time server Write the time. + network_time += server_info->rtt / 20; + + if (current_time > network_time) { + difference = current_time - network_time; + } else { + difference = network_time - current_time; + } + if (difference > estimated_error) { + // Larger than 10 second difference update the time + int ret = ns_time_system_time_write(network_time); + tr_info("Network Time %s: Era:%"PRId32" Offset:%"PRIu32" old time: %"PRIu64" time: %"PRIu64, ret == 0 ? "updated" : "update FAILED", era, offset, current_time, network_time); + } + } + } + } options->option.vendor_spesific.data_length -= option_len; options->option.vendor_spesific.data += option_len; @@ -1126,7 +1135,8 @@ static int8_t ws_bootstrap_up(protocol_interface_info_entry_t *cur) dhcp_client_init(cur->id, DHCPV6_DUID_HARDWARE_IEEE_802_NETWORKS_TYPE); dhcp_service_link_local_rx_cb_set(cur->id, ws_bootstrap_dhcp_neighbour_update_cb); dhcp_client_configure(cur->id, true, true, true); //RENEW uses SOLICIT, Interface will use 1 instance for address get, IAID address hint is not used. - dhcp_client_solicit_timeout_set(cur->id, WS_DHCP_SOLICIT_TIMEOUT, WS_DHCP_SOLICIT_MAX_RT, WS_DHCP_SOLICIT_MAX_RC); + + dhcp_client_solicit_timeout_set(cur->id, WS_DHCP_SOLICIT_TIMEOUT, WS_DHCP_SOLICIT_MAX_RT, WS_DHCP_SOLICIT_MAX_RC, WS_DHCP_SOLICIT_MAX_DELAY); dhcp_client_option_notification_cb_set(cur->id, ws_bootstrap_dhcp_info_notify_cb); // Configure memory limits and garbage collection values; @@ -1387,6 +1397,12 @@ static void ws_bootstrap_candidate_parent_store(parent_info_t *parent, const str parent->signal_dbm = data->signal_dbm; memcpy(parent->addr, data->SrcAddr, 8); + if (ws_neighbor_class_rsl_from_dbm_calculate(parent->signal_dbm) > (DEVICE_MIN_SENS + CAND_PARENT_THRESHOLD + CAND_PARENT_HYSTERISIS)) { + parent->link_acceptable = true; + } + if (ws_neighbor_class_rsl_from_dbm_calculate(parent->signal_dbm) < (DEVICE_MIN_SENS + CAND_PARENT_THRESHOLD - CAND_PARENT_HYSTERISIS)) { + parent->link_acceptable = false; + } parent->age = protocol_core_monotonic_time; } @@ -1421,6 +1437,7 @@ static parent_info_t *ws_bootstrap_candidate_parent_allocate(protocol_interface_ } if (entry) { entry->tx_fail = 0; + entry->link_acceptable = false; } return entry; } @@ -1442,13 +1459,11 @@ static void ws_bootstrap_candidate_parent_mark_failure(protocol_interface_info_e { parent_info_t *entry = ws_bootstrap_candidate_parent_get(cur, addr, false); if (entry) { - ns_list_remove(&cur->ws_info->parent_list_reserved, entry); if (entry->tx_fail >= 2) { + ns_list_remove(&cur->ws_info->parent_list_reserved, entry); ns_list_add_to_end(&cur->ws_info->parent_list_free, entry); } else { entry->tx_fail++; - //New last - ns_list_add_to_end(&cur->ws_info->parent_list_reserved, entry); ws_bootstrap_candidate_parent_sort(cur, entry); } @@ -1466,14 +1481,16 @@ static bool ws_bootstrap_candidate_parent_compare(parent_info_t *p1, parent_info return false; } - if (ws_neighbor_class_rsl_from_dbm_calculate(p1->signal_dbm) < (DEVICE_MIN_SENS + CAND_PARENT_THRESHOLD + CAND_PARENT_HYSTERISIS) && - ws_neighbor_class_rsl_from_dbm_calculate(p2->signal_dbm) > (DEVICE_MIN_SENS + CAND_PARENT_THRESHOLD + CAND_PARENT_HYSTERISIS)) { - // above threshold is always better than not. + if (p2->tx_fail < p1->tx_fail) { return true; } - if (ws_neighbor_class_rsl_from_dbm_calculate(p2->signal_dbm) < (DEVICE_MIN_SENS + CAND_PARENT_THRESHOLD + CAND_PARENT_HYSTERISIS) && - ws_neighbor_class_rsl_from_dbm_calculate(p1->signal_dbm) > (DEVICE_MIN_SENS + CAND_PARENT_THRESHOLD + CAND_PARENT_HYSTERISIS)) { - // P2 is less than threshold and P1 is larger so P1 is always better. + + if (p1->link_acceptable && !p2->link_acceptable) { + // Link acceptable is always better than not + return true; + } + if (!p1->link_acceptable && p2->link_acceptable) { + // Link acceptable is always better than not return false; } @@ -1498,6 +1515,7 @@ static void ws_bootstrap_candidate_list_clean(struct protocol_interface_info_ent int pan_count = 0; ns_list_foreach_safe(parent_info_t, entry, &cur->ws_info->parent_list_reserved) { + if ((current_time - entry->age) > WS_PARENT_LIST_MAX_AGE) { ns_list_remove(&cur->ws_info->parent_list_reserved, entry); ns_list_add_to_end(&cur->ws_info->parent_list_free, entry); @@ -1534,6 +1552,9 @@ static void ws_bootstrap_candidate_parent_sort(struct protocol_interface_info_en return; } } + // This is the last entry + ns_list_remove(&cur->ws_info->parent_list_reserved, new_entry); + ns_list_add_to_end(&cur->ws_info->parent_list_reserved, new_entry); } static void ws_bootstrap_pan_information_store(struct protocol_interface_info_entry *cur, const struct mcps_data_ind_s *data, ws_utt_ie_t *ws_utt, ws_us_ie_t *ws_us, ws_pan_information_t *pan_information) @@ -1560,6 +1581,14 @@ static void ws_bootstrap_pan_information_store(struct protocol_interface_info_en } // Safe the information ws_bootstrap_candidate_parent_store(new_entry, data, ws_utt, ws_us, pan_information); + if (!new_entry->link_acceptable) { + // This entry is either poor quality or changed to poor quality link so we will remove this + // Todo in future possibility to try poor link parents if we have not found any good link parents + tr_info("neighbour not accepted: addr:%s panid:%x rsl:%d device_min_sens: %d", trace_array(new_entry->addr, 8), new_entry->pan_id, ws_neighbor_class_rsl_from_dbm_calculate(new_entry->signal_dbm), DEVICE_MIN_SENS); + ns_list_remove(&cur->ws_info->parent_list_reserved, new_entry); + ns_list_add_to_end(&cur->ws_info->parent_list_free, new_entry); + return; + } // set to the correct place in list ws_bootstrap_candidate_parent_sort(cur, new_entry); @@ -2052,10 +2081,6 @@ static void ws_bootstrap_neighbor_table_clean(struct protocol_interface_info_ent ns_list_foreach_safe(mac_neighbor_table_entry_t, cur, &mac_neighbor_info(interface)->neighbour_list) { ws_neighbor_class_entry_t *ws_neighbor = ws_neighbor_class_entry_get(&interface->ws_info->neighbor_storage, cur->index); - if (cur->index == interface->ws_info->eapol_tx_index) { - continue; - } - if (cur->link_role == PRIORITY_PARENT_NEIGHBOUR) { //This is our primary parent we cannot delete continue; @@ -2204,6 +2229,11 @@ static bool ws_neighbor_entry_nud_notify(mac_neighbor_table_entry_t *entry_ptr, return false; } + if (lowpan_adaptation_expedite_forward_state_get(cur)) { + //Do not send any probe or NUD when Expedite forward state is enabled + return false; + } + ws_bootsrap_create_ll_address(ll_address, entry_ptr->mac64); if (time_from_start > WS_NEIGHBOR_NUD_TIMEOUT) { @@ -2981,17 +3011,17 @@ static bool ws_rpl_new_parent_callback(uint8_t *ll_parent_address, void *handle, return false; } // +2 Is for PAN ID space - memcpy(mac64 + 2, replacing + 8, 8); - mac64[2] ^= 2; + memcpy(mac64, replacing + 8, 8); + mac64[0] ^= 2; - if (ws_etx_read(cur, ADDR_802_15_4_LONG, mac64) == 0xffff) { - //Not proped yet because ETX is 0xffff + if (ws_local_etx_read(cur, ADDR_802_15_4_LONG, mac64) == 0xffff) { + //Not probed yet because ETX is 0xffff return false; } uint16_t etx = 0; if (neigh_buffer.neighbor) { - etx = etx_local_etx_read(cur->id, neigh_buffer.neighbor->index); + etx = ws_local_etx_read(cur, ADDR_802_15_4_LONG, neigh_buffer.neighbor->mac64); } // Accept now only better one's when max candidates selected and max candidate list size is reached @@ -3534,7 +3564,7 @@ static uint16_t ws_bootstrap_routing_cost_calculate(protocol_interface_info_entr return 0xffff; } - uint16_t etx = etx_local_etx_read(cur->id, mac_neighbor->index); + uint16_t etx = ws_local_etx_read(cur, ADDR_802_15_4_LONG, mac_neighbor->mac64); if (etx == 0) { etx = WS_ETX_MAX; //SET maximum value here if ETX is unknown } else { @@ -4234,7 +4264,7 @@ int ws_bootstrap_neighbor_info_get(protocol_interface_info_entry_t *cur, ws_neig neighbor_ptr[count].rsl_out = ws_neighbor_class_rsl_out_get(ws_neighbor); // ETX is shown calculated as 8 bit integer, but more common way is to use 7 bit such that 128 means ETX:1.0 - neighbor_ptr[count].etx = etx_local_etx_read(cur->id, mac_entry->index); + neighbor_ptr[count].etx = ws_local_etx_read(cur, ADDR_802_15_4_LONG, mac_entry->mac64); if (neighbor_ptr[count].etx != 0xffff) { neighbor_ptr[count].etx = neighbor_ptr[count].etx >> 1; } diff --git a/source/6LoWPAN/ws/ws_bootstrap.h b/source/6LoWPAN/ws/ws_bootstrap.h index 535092501d..1d41c80a75 100644 --- a/source/6LoWPAN/ws/ws_bootstrap.h +++ b/source/6LoWPAN/ws/ws_bootstrap.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -91,10 +91,6 @@ bool ws_bootstrap_validate_channel_plan(struct ws_us_ie *ws_us, struct protocol_ bool ws_bootstrap_validate_channel_function(struct ws_us_ie *ws_us, struct ws_bs_ie *ws_bs); -struct ws_neighbor_class_entry *ws_bootstrap_eapol_tx_temporary_set(struct protocol_interface_info_entry *interface, const uint8_t *src64); - -void ws_bootstrap_eapol_tx_temporary_clear(struct protocol_interface_info_entry *interface); - void ws_bootstrap_neighbor_set_stable(struct protocol_interface_info_entry *interface, const uint8_t *src64); int ws_bootstrap_stack_info_get(protocol_interface_info_entry_t *cur, struct ws_stack_info *info_ptr); diff --git a/source/6LoWPAN/ws/ws_cfg_settings.c b/source/6LoWPAN/ws/ws_cfg_settings.c index 32254b214b..d01601da20 100644 --- a/source/6LoWPAN/ws/ws_cfg_settings.c +++ b/source/6LoWPAN/ws/ws_cfg_settings.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Arm Limited and affiliates. + * Copyright (c) 2020-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -467,10 +467,10 @@ static void ws_cfg_network_size_config_set_small(ws_cfg_nw_size_t *cfg) cfg->sec_prot.sec_prot_trickle_timer_exp = SEC_PROT_TIMER_EXPIRATIONS; cfg->sec_prot.sec_prot_retry_timeout = SEC_PROT_RETRY_TIMEOUT_SMALL; - cfg->sec_prot.initial_key_retry_delay = DEFAULT_INITIAL_KEY_RETRY_TIMER; - cfg->sec_prot.initial_key_imin = SMALL_NW_INITIAL_KEY_TRICKLE_IMIN_SECS; - cfg->sec_prot.initial_key_imax = SMALL_NW_INITIAL_KEY_TRICKLE_IMAX_SECS; - cfg->sec_prot.initial_key_retry_cnt = DEFAULT_INITIAL_KEY_RETRY_COUNT; + cfg->sec_prot.initial_key_retry_min = SMALL_NW_INITIAL_KEY_RETRY_MIN_SECS; + cfg->sec_prot.initial_key_retry_max = SMALL_NW_INITIAL_KEY_RETRY_MAX_SECS; + cfg->sec_prot.initial_key_retry_max_limit = SMALL_NW_INITIAL_KEY_RETRY_MAX_LIMIT_SECS; + cfg->sec_prot.initial_key_retry_cnt = SMALL_NW_INITIAL_KEY_RETRY_COUNT; // Multicast timing configuration cfg->mpl.mpl_trickle_imin = MPL_SMALL_IMIN; @@ -510,10 +510,10 @@ static void ws_cfg_network_size_config_set_medium(ws_cfg_nw_size_t *cfg) cfg->sec_prot.sec_prot_trickle_timer_exp = SEC_PROT_TIMER_EXPIRATIONS; cfg->sec_prot.sec_prot_retry_timeout = SEC_PROT_RETRY_TIMEOUT_SMALL; - cfg->sec_prot.initial_key_retry_delay = DEFAULT_INITIAL_KEY_RETRY_TIMER; - cfg->sec_prot.initial_key_imin = MEDIUM_NW_INITIAL_KEY_TRICKLE_IMIN_SECS; - cfg->sec_prot.initial_key_imax = MEDIUM_NW_INITIAL_KEY_TRICKLE_IMAX_SECS; - cfg->sec_prot.initial_key_retry_cnt = DEFAULT_INITIAL_KEY_RETRY_COUNT; + cfg->sec_prot.initial_key_retry_min = MEDIUM_NW_INITIAL_KEY_RETRY_MIN_SECS; + cfg->sec_prot.initial_key_retry_max = MEDIUM_NW_INITIAL_KEY_RETRY_MAX_SECS; + cfg->sec_prot.initial_key_retry_max_limit = MEDIUM_NW_INITIAL_KEY_RETRY_MAX_LIMIT_SECS; + cfg->sec_prot.initial_key_retry_cnt = MEDIUM_NW_INITIAL_KEY_RETRY_COUNT; // Multicast timing configuration cfg->mpl.mpl_trickle_imin = MPL_MEDIUM_IMIN; @@ -552,9 +552,9 @@ static void ws_cfg_network_size_config_set_large(ws_cfg_nw_size_t *cfg) cfg->sec_prot.sec_prot_trickle_timer_exp = SEC_PROT_TIMER_EXPIRATIONS; cfg->sec_prot.sec_prot_retry_timeout = SEC_PROT_RETRY_TIMEOUT_LARGE; - cfg->sec_prot.initial_key_retry_delay = NONE_INITIAL_KEY_RETRY_TIMER; - cfg->sec_prot.initial_key_imin = LARGE_NW_INITIAL_KEY_TRICKLE_IMIN_SECS; - cfg->sec_prot.initial_key_imax = LARGE_NW_INITIAL_KEY_TRICKLE_IMAX_SECS; + cfg->sec_prot.initial_key_retry_min = LARGE_NW_INITIAL_KEY_RETRY_MIN_SECS; + cfg->sec_prot.initial_key_retry_max = LARGE_NW_INITIAL_KEY_RETRY_MAX_SECS; + cfg->sec_prot.initial_key_retry_max_limit = LARGE_NW_INITIAL_KEY_RETRY_MAX_LIMIT_SECS; cfg->sec_prot.initial_key_retry_cnt = LARGE_NW_INITIAL_KEY_RETRY_COUNT; // Multicast timing configuration @@ -595,9 +595,9 @@ static void ws_cfg_network_size_config_set_xlarge(ws_cfg_nw_size_t *cfg) cfg->sec_prot.sec_prot_trickle_timer_exp = SEC_PROT_TIMER_EXPIRATIONS; cfg->sec_prot.sec_prot_retry_timeout = SEC_PROT_RETRY_TIMEOUT_LARGE; - cfg->sec_prot.initial_key_retry_delay = NONE_INITIAL_KEY_RETRY_TIMER; - cfg->sec_prot.initial_key_imin = EXTRA_LARGE_NW_INITIAL_KEY_TRICKLE_IMIN_SECS; - cfg->sec_prot.initial_key_imax = EXTRA_LARGE_NW_INITIAL_KEY_TRICKLE_IMAX_SECS; + cfg->sec_prot.initial_key_retry_min = EXTRA_LARGE_NW_INITIAL_KEY_RETRY_MIN_SECS; + cfg->sec_prot.initial_key_retry_max = EXTRA_LARGE_NW_INITIAL_KEY_RETRY_MAX_SECS; + cfg->sec_prot.initial_key_retry_max_limit = EXTRA_LARGE_NW_INITIAL_KEY_RETRY_MAX_LIMIT_SECS; cfg->sec_prot.initial_key_retry_cnt = EXTRA_LARGE_NW_INITIAL_KEY_RETRY_COUNT; // Multicast timing configuration @@ -637,10 +637,10 @@ static void ws_cfg_network_size_config_set_certificate(ws_cfg_nw_size_t *cfg) cfg->sec_prot.sec_prot_trickle_timer_exp = SEC_PROT_TIMER_EXPIRATIONS; cfg->sec_prot.sec_prot_retry_timeout = SEC_PROT_RETRY_TIMEOUT_SMALL; - cfg->sec_prot.initial_key_retry_delay = DEFAULT_INITIAL_KEY_RETRY_TIMER; - cfg->sec_prot.initial_key_imin = SMALL_NW_INITIAL_KEY_TRICKLE_IMIN_SECS; - cfg->sec_prot.initial_key_imax = SMALL_NW_INITIAL_KEY_TRICKLE_IMAX_SECS; - cfg->sec_prot.initial_key_retry_cnt = DEFAULT_INITIAL_KEY_RETRY_COUNT; + cfg->sec_prot.initial_key_retry_min = SMALL_NW_INITIAL_KEY_RETRY_MIN_SECS; + cfg->sec_prot.initial_key_retry_max = SMALL_NW_INITIAL_KEY_RETRY_MAX_SECS; + cfg->sec_prot.initial_key_retry_max_limit = SMALL_NW_INITIAL_KEY_RETRY_MAX_LIMIT_SECS; + cfg->sec_prot.initial_key_retry_cnt = SMALL_NW_INITIAL_KEY_RETRY_COUNT; // Multicast timing configuration for certification uses the LARGE values as it is the one mentioned ins specification cfg->mpl.mpl_trickle_imin = MPL_XLARGE_IMIN; @@ -1237,14 +1237,14 @@ static int8_t ws_cfg_sec_prot_default_set(ws_sec_prot_cfg_t *cfg) { cfg->sec_prot_trickle_imin = SEC_PROT_SMALL_IMIN; cfg->sec_prot_trickle_imax = SEC_PROT_SMALL_IMAX; - cfg->sec_prot_trickle_timer_exp = 2; + cfg->sec_prot_trickle_timer_exp = SEC_PROT_TIMER_EXPIRATIONS; cfg->sec_prot_retry_timeout = SEC_PROT_RETRY_TIMEOUT_SMALL; cfg->max_simult_sec_neg_tx_queue_min = MAX_SIMULTANEOUS_SECURITY_NEGOTIATIONS_TX_QUEUE_MIN; cfg->max_simult_sec_neg_tx_queue_max = MAX_SIMULTANEOUS_SECURITY_NEGOTIATIONS_TX_QUEUE_MAX; - cfg->initial_key_retry_delay = DEFAULT_INITIAL_KEY_RETRY_TIMER; - cfg->initial_key_imin = MEDIUM_NW_INITIAL_KEY_TRICKLE_IMIN_SECS; - cfg->initial_key_imax = MEDIUM_NW_INITIAL_KEY_TRICKLE_IMAX_SECS; - cfg->initial_key_retry_cnt = DEFAULT_INITIAL_KEY_RETRY_COUNT; + cfg->initial_key_retry_min = MEDIUM_NW_INITIAL_KEY_RETRY_MIN_SECS; + cfg->initial_key_retry_max = MEDIUM_NW_INITIAL_KEY_RETRY_MAX_SECS; + cfg->initial_key_retry_max_limit = MEDIUM_NW_INITIAL_KEY_RETRY_MAX_LIMIT_SECS; + cfg->initial_key_retry_cnt = MEDIUM_NW_INITIAL_KEY_RETRY_COUNT; return CFG_SETTINGS_OK; } @@ -1268,10 +1268,10 @@ int8_t ws_cfg_sec_prot_validate(ws_sec_prot_cfg_t *cfg, ws_sec_prot_cfg_t *new_c cfg->sec_prot_retry_timeout != new_cfg->sec_prot_retry_timeout || cfg->max_simult_sec_neg_tx_queue_min != new_cfg->max_simult_sec_neg_tx_queue_min || cfg->max_simult_sec_neg_tx_queue_max != new_cfg->max_simult_sec_neg_tx_queue_max || - cfg->initial_key_retry_delay != new_cfg->initial_key_retry_delay || - cfg->initial_key_imin != new_cfg->initial_key_retry_delay || - cfg->initial_key_imax != new_cfg->initial_key_retry_delay || - cfg->initial_key_retry_cnt != new_cfg->initial_key_retry_delay) { + cfg->initial_key_retry_min != new_cfg->initial_key_retry_min || + cfg->initial_key_retry_max != new_cfg->initial_key_retry_max || + cfg->initial_key_retry_max_limit != new_cfg->initial_key_retry_max_limit || + cfg->initial_key_retry_cnt != new_cfg->initial_key_retry_cnt) { return CFG_SETTINGS_CHANGED; } diff --git a/source/6LoWPAN/ws/ws_cfg_settings.h b/source/6LoWPAN/ws/ws_cfg_settings.h index 6b5dd98bce..827b45aeff 100644 --- a/source/6LoWPAN/ws/ws_cfg_settings.h +++ b/source/6LoWPAN/ws/ws_cfg_settings.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Arm Limited and affiliates. + * Copyright (c) 2020-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -117,10 +117,10 @@ typedef struct ws_sec_prot_cfg_s { uint8_t sec_prot_trickle_timer_exp; /**< Security protocol trickle timer expirations; default 2 */ uint16_t max_simult_sec_neg_tx_queue_min; /**< PAE authenticator max simultaneous security negotiations TX queue minimum */ uint16_t max_simult_sec_neg_tx_queue_max; /**< PAE authenticator max simultaneous security negotiations TX queue maximum */ - uint16_t initial_key_retry_delay; /**< Delay before starting initial key trickle; seconds; default 120 */ - uint16_t initial_key_imin; /**< Initial key trickle Imin; seconds; default 360 */ - uint16_t initial_key_imax; /**< Initial key trickle Imax; seconds; default 720 */ - uint8_t initial_key_retry_cnt; /**< Number of initial key retries; default 2 */ + uint16_t initial_key_retry_min; /**< Initial EAPOL-Key retry exponential backoff min; seconds; default 180 */ + uint16_t initial_key_retry_max; /**< Initial EAPOL-Key retry exponential backoff max; seconds; default 420 */ + uint16_t initial_key_retry_max_limit; /**< Initial EAPOL-Key retry exponential backoff max limit; seconds; default 720 */ + uint8_t initial_key_retry_cnt; /**< Number of initial key retries; default 4 */ } ws_sec_prot_cfg_t; /** diff --git a/source/6LoWPAN/ws/ws_common.c b/source/6LoWPAN/ws/ws_common.c index 4a77f37bab..42a9ceb764 100644 --- a/source/6LoWPAN/ws/ws_common.c +++ b/source/6LoWPAN/ws/ws_common.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -75,13 +75,6 @@ int8_t ws_generate_channel_list(uint32_t *channel_mask, uint16_t number_of_chann channel_mask[0 + (i / 32)] |= (1 << (i % 32)); } // Disable unsupported channels per regional frequency bands - if (regulatory_domain == REG_DOMAIN_NA) { - if (channel_plan_id == 1) { - ws_disable_channels_in_range(channel_mask, number_of_channels, 1, 7); - } else if (channel_plan_id == 5) { - ws_disable_channels_in_range(channel_mask, number_of_channels, 5, 7); - } - } if (regulatory_domain == REG_DOMAIN_BZ) { if (channel_plan_id == 255) { if (operating_class == 1) { @@ -93,17 +86,11 @@ int8_t ws_generate_channel_list(uint32_t *channel_mask, uint16_t number_of_chann } } else { if (channel_plan_id == 1) { - ws_disable_channels_in_range(channel_mask, number_of_channels, 1, 7); - ws_disable_channels_in_range(channel_mask, number_of_channels, 64, 64); - ws_disable_channels_in_range(channel_mask, number_of_channels, 72, 103); - ws_disable_channels_in_range(channel_mask, number_of_channels, 106, 111); + ws_disable_channels_in_range(channel_mask, number_of_channels, 26, 64); } else if (channel_plan_id == 2) { - ws_disable_channels_in_range(channel_mask, number_of_channels, 24, 24); - ws_disable_channels_in_range(channel_mask, number_of_channels, 32, 47); - ws_disable_channels_in_range(channel_mask, number_of_channels, 52, 55); + ws_disable_channels_in_range(channel_mask, number_of_channels, 12, 32); } else if (channel_plan_id == 5) { - ws_disable_channels_in_range(channel_mask, number_of_channels, 5, 10); - ws_disable_channels_in_range(channel_mask, number_of_channels, 19, 23); + ws_disable_channels_in_range(channel_mask, number_of_channels, 3, 10); } } } @@ -424,11 +411,11 @@ uint16_t ws_common_channel_number_calc(uint8_t regulatory_domain, uint8_t operat } } else { if (channel_plan_id == 1) { - return 136; + return 129; } else if (channel_plan_id == 2) { return 64; } else if (channel_plan_id == 5) { - return 24; + return 21; } } } else if (regulatory_domain == REG_DOMAIN_JP) { @@ -450,11 +437,11 @@ uint16_t ws_common_channel_number_calc(uint8_t regulatory_domain, uint8_t operat } } else { if (channel_plan_id == 1) { - return 136; + return 129; } else if (channel_plan_id == 2) { return 64; } else if (channel_plan_id == 5) { - return 24; + return 21; } } } else if (regulatory_domain == REG_DOMAIN_WW) { diff --git a/source/6LoWPAN/ws/ws_common.h b/source/6LoWPAN/ws/ws_common.h index 2dda3beac8..40fbd0a16d 100644 --- a/source/6LoWPAN/ws/ws_common.h +++ b/source/6LoWPAN/ws/ws_common.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -47,9 +47,10 @@ typedef struct parent_info_s { ws_pan_information_t pan_information; ws_utt_ie_t ws_utt; ws_us_ie_t ws_us; - uint32_t timestamp; /**< Timestamp when packet was received */ - uint32_t age; /**< Age of entry in 100ms ticks */ - uint8_t excluded_channel_data[32]; //Channel mask Max length and it accept 8 different range + uint32_t timestamp; /**< Timestamp when packet was received */ + uint32_t age; /**< Age of entry in 100ms ticks */ + uint8_t excluded_channel_data[32]; /**< Channel mask Max length and it accept 8 different range*/ + bool link_acceptable: 1; /**< True when Link quality is in acceptable level*/ ns_list_link_t link; } parent_info_t; @@ -88,7 +89,6 @@ typedef struct ws_info_s { trickle_params_t trickle_params_pan_discovery; uint8_t rpl_state; // state from rpl_event_t uint8_t pas_requests; // Amount of PAN solicits sent - uint8_t eapol_tx_index; uint8_t device_min_sens; // Device min sensitivity set by the application int8_t weakest_received_rssi; // Weakest received signal (dBm) parent_info_t parent_info[WS_PARENT_LIST_SIZE]; diff --git a/source/6LoWPAN/ws/ws_common_defines.h b/source/6LoWPAN/ws/ws_common_defines.h index 1657d9ee6b..8ea6ab3f06 100644 --- a/source/6LoWPAN/ws/ws_common_defines.h +++ b/source/6LoWPAN/ws/ws_common_defines.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/ws/ws_config.h b/source/6LoWPAN/ws/ws_config.h index fb2e23ca27..49723f009b 100644 --- a/source/6LoWPAN/ws/ws_config.h +++ b/source/6LoWPAN/ws/ws_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -173,6 +173,7 @@ extern uint8_t DEVICE_MIN_SENS; #define WS_DHCP_SOLICIT_TIMEOUT 60 #define WS_DHCP_SOLICIT_MAX_RT 900 #define WS_DHCP_SOLICIT_MAX_RC 0 +#define WS_DHCP_SOLICIT_MAX_DELAY 5 /* Neighbour table configuration @@ -241,17 +242,19 @@ extern uint8_t DEVICE_MIN_SENS; #define WISUN_1_0_ERRATA_FIX /* - * Security protocol message retry configuration parameters + * Security protocol message retry configuration parameters + * + * Trickle is reset on start (inconsistent heard is set) */ -#define SEC_PROT_SMALL_IMIN 30 // Retries done in 30 seconds -#define SEC_PROT_SMALL_IMAX 90 // Largest value 90 seconds -#define SEC_PROT_RETRY_TIMEOUT_SMALL 330 // Retry timeout for small network additional 30 seconds for authenticator delay +#define SEC_PROT_SMALL_IMIN 60 // Retries done in 60 seconds +#define SEC_PROT_SMALL_IMAX 120 // Largest value 120 seconds +#define SEC_PROT_RETRY_TIMEOUT_SMALL 450 // Retry timeout for small network additional 30 seconds for authenticator delay #define SEC_PROT_LARGE_IMIN 60 // Retries done in 60 seconds #define SEC_PROT_LARGE_IMAX 240 // Largest value 240 seconds #define SEC_PROT_RETRY_TIMEOUT_LARGE 750 // Retry timeout for large network additional 30 seconds for authenticator delay -#define SEC_PROT_TIMER_EXPIRATIONS 2 // Number of retries +#define SEC_PROT_TIMER_EXPIRATIONS 4 // Number of retries // Maximum number of simultaneous security negotiations #define MAX_SIMULTANEOUS_SECURITY_NEGOTIATIONS_TX_QUEUE_MIN 64 @@ -273,32 +276,51 @@ extern uint8_t DEVICE_MIN_SENS; /* * Security protocol initial EAPOL-key parameters + * + * Retry time is randomized between minimum and maximum retry time: rand(min,max). + * For each subsequent retry the maximum retry time is doubled until the maximum + * limit is reached. */ -// How long the wait is before the first initial EAPOL-key retry -#define DEFAULT_INITIAL_KEY_RETRY_TIMER 120 -#define NONE_INITIAL_KEY_RETRY_TIMER 0 +/* Small network initial EAPOL-key retry exponential backoff parameters + * 1st backoff 3 to 7 minutes, max 7 minutes, retries 2 + * Minimum time for sequence is 3 + 3 = 6 minutes + * Maximum time for sequence is 7 + 7 = 14 minutes + */ +#define SMALL_NW_INITIAL_KEY_RETRY_MIN_SECS 180 // 3 +#define SMALL_NW_INITIAL_KEY_RETRY_MAX_SECS 420 // 7 +#define SMALL_NW_INITIAL_KEY_RETRY_MAX_LIMIT_SECS 420 // 7 +#define SMALL_NW_INITIAL_KEY_RETRY_COUNT 2 -// Small network Default trickle values for sending of initial EAPOL-key -#define SMALL_NW_INITIAL_KEY_TRICKLE_IMIN_SECS 360 /* 6 to 8.3 minutes */ -#define SMALL_NW_INITIAL_KEY_TRICKLE_IMAX_SECS 500 +/* Medium network initial EAPOL-key retry exponential backoff parameters + * 1st backoff 3 to 7 minutes, max 12 minutes, retries 4 + * Minimum time for sequence is 3 + 3 + 3 + 3 = 12 minutes + * Maximum time for sequence is 7 + 12 + 12 + 12 = 43 minutes + */ +#define MEDIUM_NW_INITIAL_KEY_RETRY_MIN_SECS 180 // 3 +#define MEDIUM_NW_INITIAL_KEY_RETRY_MAX_SECS 420 // 7 +#define MEDIUM_NW_INITIAL_KEY_RETRY_MAX_LIMIT_SECS 720 // 12 +#define MEDIUM_NW_INITIAL_KEY_RETRY_COUNT 4 -// Small network Default trickle values for sending of initial EAPOL-key -#define MEDIUM_NW_INITIAL_KEY_TRICKLE_IMIN_SECS 360 /* 6 to 12 minutes */ -#define MEDIUM_NW_INITIAL_KEY_TRICKLE_IMAX_SECS 720 +/* Large network initial EAPOL-key retry exponential backoff parameters + * 1st backoff 5 to 10 minutes, max 15 minutes, retries 4 + * Minimum time for sequence is 5 + 5 + 5 + 5 = 20 minutes + * Maximum time for sequence is 10 + 15 + 15 + 15 = 55 minutes + */ +#define LARGE_NW_INITIAL_KEY_RETRY_MIN_SECS 300 // 5 +#define LARGE_NW_INITIAL_KEY_RETRY_MAX_SECS 600 // 10 +#define LARGE_NW_INITIAL_KEY_RETRY_MAX_LIMIT_SECS 900 // 15 +#define LARGE_NW_INITIAL_KEY_RETRY_COUNT 4 -// Large network trickle values for sending of initial EAPOL-key -#define LARGE_NW_INITIAL_KEY_TRICKLE_IMIN_SECS 600 /* 10 to 20 minutes */ -#define LARGE_NW_INITIAL_KEY_TRICKLE_IMAX_SECS 1200 -#define LARGE_NW_INITIAL_KEY_RETRY_COUNT 3 - -// Very slow network values for sending of initial EAPOL-key -#define EXTRA_LARGE_NW_INITIAL_KEY_TRICKLE_IMIN_SECS 600 /* 10 to 20 minutes */ -#define EXTRA_LARGE_NW_INITIAL_KEY_TRICKLE_IMAX_SECS 1200 -#define EXTRA_LARGE_NW_INITIAL_KEY_RETRY_COUNT 4 - -// How many times sending of initial EAPOL-key is retried -#define DEFAULT_INITIAL_KEY_RETRY_COUNT 2 +/* Extra large network initial EAPOL-key retry exponential backoff parameters + * 1st backoff 5 to 10 minutes, max 20 minutes, retries 4 + * Minimum time for sequence is 5 + 5 + 5 + 5 = 20 minutes + * Maximum time for sequence is 10 + 20 + 20 + 20 = 70 minutes + */ +#define EXTRA_LARGE_NW_INITIAL_KEY_RETRY_MIN_SECS 300 // 5 +#define EXTRA_LARGE_NW_INITIAL_KEY_RETRY_MAX_SECS 600 // 10 +#define EXTRA_LARGE_NW_INITIAL_KEY_RETRY_MAX_LIMIT_SECS 1200 // 20 +#define EXTRA_LARGE_NW_INITIAL_KEY_RETRY_COUNT 4 /* * RADIUS client retry timer defaults diff --git a/source/6LoWPAN/ws/ws_eapol_auth_relay.c b/source/6LoWPAN/ws/ws_eapol_auth_relay.c index 76f6221a74..f3ef62c969 100644 --- a/source/6LoWPAN/ws/ws_eapol_auth_relay.c +++ b/source/6LoWPAN/ws/ws_eapol_auth_relay.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -165,6 +165,13 @@ static void ws_eapol_auth_relay_socket_cb(void *cb) eui_64 = ptr; ptr += 8; uint16_t data_len = cb_data->d_len - 26; + /* If EAPOL PDU data length is zero (message contains only supplicant EUI-64 and KMP ID) + * i.e. is purge message and is not going to authenticator local relay then ignores message + */ + if (data_len == 1 && !addr_ipv6_equal(relay_ip_addr.address, eapol_auth_relay->relay_addr.address)) { + ns_dyn_mem_free(socket_pdu); + return; + } ws_eapol_relay_lib_send_to_relay(eapol_auth_relay->socket_id, eui_64, &relay_ip_addr, ptr, data_len); ns_dyn_mem_free(socket_pdu); diff --git a/source/6LoWPAN/ws/ws_eapol_auth_relay.h b/source/6LoWPAN/ws/ws_eapol_auth_relay.h index d0a7aa6c09..6f517500ce 100644 --- a/source/6LoWPAN/ws/ws_eapol_auth_relay.h +++ b/source/6LoWPAN/ws/ws_eapol_auth_relay.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/ws/ws_eapol_pdu.c b/source/6LoWPAN/ws/ws_eapol_pdu.c index e5c2f64c84..6ca3287e26 100644 --- a/source/6LoWPAN/ws/ws_eapol_pdu.c +++ b/source/6LoWPAN/ws/ws_eapol_pdu.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/ws/ws_eapol_pdu.h b/source/6LoWPAN/ws/ws_eapol_pdu.h index 5c5320c0a8..48a4cfe50a 100644 --- a/source/6LoWPAN/ws/ws_eapol_pdu.h +++ b/source/6LoWPAN/ws/ws_eapol_pdu.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/ws/ws_eapol_relay.c b/source/6LoWPAN/ws/ws_eapol_relay.c index 2c2a6a3b93..e1cfbf8d08 100644 --- a/source/6LoWPAN/ws/ws_eapol_relay.c +++ b/source/6LoWPAN/ws/ws_eapol_relay.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/ws/ws_eapol_relay.h b/source/6LoWPAN/ws/ws_eapol_relay.h index dbbfbc584a..94a8f44c56 100644 --- a/source/6LoWPAN/ws/ws_eapol_relay.h +++ b/source/6LoWPAN/ws/ws_eapol_relay.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/ws/ws_eapol_relay_lib.c b/source/6LoWPAN/ws/ws_eapol_relay_lib.c index 4352d77149..17fb0e221a 100644 --- a/source/6LoWPAN/ws/ws_eapol_relay_lib.c +++ b/source/6LoWPAN/ws/ws_eapol_relay_lib.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/ws/ws_eapol_relay_lib.h b/source/6LoWPAN/ws/ws_eapol_relay_lib.h index b1c387951a..36ff5584ae 100644 --- a/source/6LoWPAN/ws/ws_eapol_relay_lib.h +++ b/source/6LoWPAN/ws/ws_eapol_relay_lib.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/ws/ws_empty_functions.c b/source/6LoWPAN/ws/ws_empty_functions.c index 3f6279685d..f7e14fdb79 100644 --- a/source/6LoWPAN/ws/ws_empty_functions.c +++ b/source/6LoWPAN/ws/ws_empty_functions.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -440,11 +440,6 @@ int ws_statistics_stop(int8_t interface_id) return -1; } -void ns_time_api_system_time_callback_set(ns_time_api_system_time_callback callback) -{ - (void) callback; -} - int ws_stack_info_get(int8_t interface_id, ws_stack_info_t *info_ptr) { (void) interface_id; diff --git a/source/6LoWPAN/ws/ws_ie_lib.c b/source/6LoWPAN/ws/ws_ie_lib.c index 633b01c60e..5edd436dbc 100644 --- a/source/6LoWPAN/ws/ws_ie_lib.c +++ b/source/6LoWPAN/ws/ws_ie_lib.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/ws/ws_ie_lib.h b/source/6LoWPAN/ws/ws_ie_lib.h index 3be8bff8b5..3198763c07 100644 --- a/source/6LoWPAN/ws/ws_ie_lib.h +++ b/source/6LoWPAN/ws/ws_ie_lib.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/ws/ws_llc.h b/source/6LoWPAN/ws/ws_llc.h index e7df162ae4..9e905b7bbc 100644 --- a/source/6LoWPAN/ws/ws_llc.h +++ b/source/6LoWPAN/ws/ws_llc.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -232,6 +232,10 @@ bool ws_llc_eapol_relay_forward_filter(struct protocol_interface_info_entry *int ws_neighbor_temp_class_t *ws_llc_get_multicast_temp_entry(struct protocol_interface_info_entry *interface, const uint8_t *mac64); +ws_neighbor_temp_class_t *ws_llc_get_eapol_temp_entry(struct protocol_interface_info_entry *interface, const uint8_t *mac64); + + + void ws_llc_free_multicast_temp_entry(struct protocol_interface_info_entry *interface, ws_neighbor_temp_class_t *neighbor); #endif /* WS_LLC_H_ */ diff --git a/source/6LoWPAN/ws/ws_llc_data_service.c b/source/6LoWPAN/ws/ws_llc_data_service.c index c83f9b89b1..35e87582e7 100644 --- a/source/6LoWPAN/ws/ws_llc_data_service.c +++ b/source/6LoWPAN/ws/ws_llc_data_service.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -102,9 +102,24 @@ typedef struct { typedef NS_LIST_HEAD(llc_message_t, link) llc_message_list_t; #define MAX_NEIGH_TEMPORARY_MULTICAST_SIZE 5 -#define MAX_NEIGH_TEMPORRY_EAPOL_SIZE 20 +#define MAX_NEIGH_TEMPORRY_EAPOL_SIZE 5 #define MAX_NEIGH_TEMPORAY_LIST_SIZE (MAX_NEIGH_TEMPORARY_MULTICAST_SIZE + MAX_NEIGH_TEMPORRY_EAPOL_SIZE) +#define WS_LLC_EAPOL_DYNAMIC_ALLOCATE_MIN 10 +#define WS_LLC_EAPOL_DYNAMIC_ALLOCATE_MAX 100 +#define WS_LLC_EAPOL_DYNAMIC_HEAP_PERCENT 7 +/** + * 7 % from total heap take about + * + * How to max entry is defined: (Total heap / 100 * 7) / size of temporary entry + * + * 32 kBytes define 14 entry + * 64 kBytes define 29 entry + * 128 kBytes define 58 entry + * + */ + + typedef struct { ws_neighbor_temp_class_t neighbour_temporary_table[MAX_NEIGH_TEMPORAY_LIST_SIZE]; ws_neighbor_temp_list_t active_multicast_temp_neigh; @@ -112,6 +127,7 @@ typedef struct { ws_neighbor_temp_list_t free_temp_neigh; llc_message_list_t llc_eap_pending_list; /**< Active Message list */ uint16_t llc_eap_pending_list_size; /**< EAPOL active Message list size */ + uint16_t dynamic_alloc_max; /**< How big EAPOL temp entry list can be extend */ bool active_eapol_session: 1; /**< Indicating active EAPOL message */ } temp_entriest_t; @@ -171,9 +187,11 @@ static void ws_llc_mpx_init(mpx_class_t *mpx_class); static void ws_llc_temp_neigh_info_table_reset(temp_entriest_t *base); static ws_neighbor_temp_class_t *ws_allocate_multicast_temp_entry(temp_entriest_t *base, const uint8_t *mac64); -static ws_neighbor_temp_class_t *ws_llc_discover_eapol_temp_entry(temp_entriest_t *base, const uint8_t *mac64); -static void ws_llc_release_eapol_temp_entry(temp_entriest_t *base, const uint8_t *mac64); static ws_neighbor_temp_class_t *ws_allocate_eapol_temp_entry(temp_entriest_t *base, const uint8_t *mac64); +static void ws_llc_temp_entry_free(temp_entriest_t *base, ws_neighbor_temp_class_t *entry); +static ws_neighbor_temp_class_t *ws_llc_discover_temp_entry(ws_neighbor_temp_list_t *list, const uint8_t *mac64); +static void ws_llc_release_eapol_temp_entry(temp_entriest_t *base, const uint8_t *mac64); + static void ws_llc_mpx_eapol_send(llc_data_base_t *base, llc_message_t *message); @@ -432,6 +450,11 @@ static llc_data_base_t *ws_llc_base_allocate(void) ns_list_init(&temp_entries->active_eapol_temp_neigh); ns_list_init(&temp_entries->free_temp_neigh); ns_list_init(&temp_entries->llc_eap_pending_list); + + //Add to free list to full from static + for (int i = 0; i < MAX_NEIGH_TEMPORAY_LIST_SIZE; i++) { + ns_list_add_to_end(&temp_entries->free_temp_neigh, &temp_entries->neighbour_temporary_table[i]); + } base->temp_entries = temp_entries; ns_list_init(&base->llc_message_list); @@ -440,6 +463,15 @@ static llc_data_base_t *ws_llc_base_allocate(void) return base; } +static void ws_llc_mac_eapol_clear(llc_data_base_t *base) +{ + //Clear active EAPOL Session + if (base->temp_entries->active_eapol_session) { + base->temp_entries->active_eapol_session = false; + } +} + + /** WS LLC MAC data extension confirmation */ static void ws_llc_mac_confirm_cb(const mac_api_t *api, const mcps_data_conf_t *data, const mcps_data_conf_payload_t *conf_data) { @@ -458,12 +490,10 @@ static void ws_llc_mac_confirm_cb(const mac_api_t *api, const mcps_data_conf_t * uint8_t messsage_type = message->messsage_type; uint8_t mpx_user_handle = message->mpx_user_handle; if (message->eapol_temporary) { - //Clear - ws_bootstrap_eapol_tx_temporary_clear(interface); if (data->status == MLME_SUCCESS || data->status == MLME_NO_DATA) { //Update timeout - ws_neighbor_temp_class_t *temp_entry = ws_llc_discover_eapol_temp_entry(base->temp_entries, message->dst_address); + ws_neighbor_temp_class_t *temp_entry = ws_llc_discover_temp_entry(&base->temp_entries->active_eapol_temp_neigh, message->dst_address); if (temp_entry) { //Update Temporary Lifetime temp_entry->eapol_temp_info.eapol_timeout = interface->ws_info->cfg->timing.temp_eapol_min_timeout + 1; @@ -490,8 +520,11 @@ static void ws_llc_mac_confirm_cb(const mac_api_t *api, const mcps_data_conf_t * } if (neighbor_info.ws_neighbor && neighbor_info.neighbor && neighbor_info.neighbor->link_lifetime == WS_NEIGHBOR_LINK_TIMEOUT) { - etx_transm_attempts_update(interface->id, 1 + data->tx_retries, success, neighbor_info.neighbor->index, neighbor_info.neighbor->mac64); - //TODO discover RSL from Enchanced ACK Header IE elements + + if (!base->high_priority_mode) { + //Update ETX only when High priority state is not activated + etx_transm_attempts_update(interface->id, 1 + data->tx_retries, success, neighbor_info.neighbor->index, neighbor_info.neighbor->mac64); + } ws_utt_ie_t ws_utt; if (ws_wh_utt_read(conf_data->headerIeList, conf_data->headerIeListLength, &ws_utt)) { //UTT header @@ -1110,24 +1143,6 @@ static void ws_llc_lowpan_mpx_data_request(llc_data_base_t *base, mpx_user_t *us base->interface_ptr->mac_api->mcps_data_req_ext(base->interface_ptr->mac_api, &data_req, &message->ie_ext, NULL, message->priority); } -static bool ws_llc_eapol_temp_entry_set(llc_data_base_t *base, const uint8_t *mac64) -{ - //Discover Temporary entry - ws_neighbor_temp_class_t *temp_neigh = ws_llc_discover_eapol_temp_entry(base->temp_entries, mac64); - - if (!temp_neigh) { - return false; - } - ws_neighbor_class_entry_t *entry = ws_bootstrap_eapol_tx_temporary_set(base->interface_ptr, mac64); - if (!entry) { - return false; - } - *entry = temp_neigh->neigh_info_list; - return true; - -} - - static void ws_llc_eapol_data_req_init(mcps_data_req_t *data_req, llc_message_t *message) { memset(data_req, 0, sizeof(mcps_data_req_t)); @@ -1155,11 +1170,21 @@ static void ws_llc_eapol_data_req_init(mcps_data_req_t *data_req, llc_message_t static void ws_llc_mpx_eapol_send(llc_data_base_t *base, llc_message_t *message) { mcps_data_req_t data_req; + + //Discover Temporary entry + ws_neighbor_temp_class_t *temp_neigh = ws_llc_discover_temp_entry(&base->temp_entries->active_eapol_temp_neigh, message->dst_address); + + if (temp_neigh) { + message->eapol_temporary = true; + } else { + message->eapol_temporary = false; + } + + //Allocate message ID llc_message_id_allocate(message, base, true); base->llc_message_list_size++; random_early_detetction_aq_calc(base->interface_ptr->llc_random_early_detection, base->llc_message_list_size); ns_list_add_to_end(&base->llc_message_list, message); - message->eapol_temporary = ws_llc_eapol_temp_entry_set(base, message->dst_address); ws_llc_eapol_data_req_init(&data_req, message); base->temp_entries->active_eapol_session = true; base->interface_ptr->mac_api->mcps_data_req_ext(base->interface_ptr->mac_api, &data_req, &message->ie_ext, NULL, message->priority); @@ -1342,6 +1367,9 @@ static uint8_t ws_llc_mpx_data_purge_request(const mpx_api_t *api, struct mcps_p purge_req.msduHandle = message->msg_handle; purge_status = base->interface_ptr->mac_api->mcps_purge_req(base->interface_ptr->mac_api, &purge_req); if (purge_status == 0) { + if (message->messsage_type == WS_FT_EAPOL) { + ws_llc_mac_eapol_clear(base); + } llc_message_free(message, base); } @@ -1376,6 +1404,9 @@ static void ws_llc_clean(llc_data_base_t *base) mcps_purge_t purge_req; ns_list_foreach_safe(llc_message_t, message, &base->llc_message_list) { purge_req.msduHandle = message->msg_handle; + if (message->messsage_type == WS_FT_EAPOL) { + ws_llc_mac_eapol_clear(base); + } llc_message_free(message, base); base->interface_ptr->mac_api->mcps_purge_req(base->interface_ptr->mac_api, &purge_req); @@ -1394,32 +1425,34 @@ static void ws_llc_clean(llc_data_base_t *base) base->high_priority_mode = false; } +static void ws_llc_temp_entry_free(temp_entriest_t *base, ws_neighbor_temp_class_t *entry) +{ + //Pointer is static add to free list + if (entry >= &base->neighbour_temporary_table[0] && entry <= &base->neighbour_temporary_table[MAX_NEIGH_TEMPORAY_LIST_SIZE - 1]) { + ns_list_add_to_end(&base->free_temp_neigh, entry); + } else { + ns_dyn_mem_free(entry); + } +} + + static void ws_llc_temp_neigh_info_table_reset(temp_entriest_t *base) { - //Empty active list - ns_list_init(&base->active_multicast_temp_neigh); - ns_list_init(&base->active_eapol_temp_neigh); - ns_list_init(&base->free_temp_neigh); + //Empty active list eapol list + ns_list_foreach_safe(ws_neighbor_temp_class_t, entry, &base->active_eapol_temp_neigh) { + ns_list_remove(&base->active_eapol_temp_neigh, entry); + ws_llc_temp_entry_free(base, entry); + } - //Add to free list to full - for (int i = 0; i < MAX_NEIGH_TEMPORAY_LIST_SIZE; i++) { - ns_list_add_to_end(&base->free_temp_neigh, &base->neighbour_temporary_table[i]); + ns_list_foreach_safe(ws_neighbor_temp_class_t, entry, &base->active_multicast_temp_neigh) { + ns_list_remove(&base->active_multicast_temp_neigh, entry); + ws_llc_temp_entry_free(base, entry); } } -static ws_neighbor_temp_class_t *ws_llc_discover_mc_temp_entry(temp_entriest_t *base, const uint8_t *mac64) +static ws_neighbor_temp_class_t *ws_llc_discover_temp_entry(ws_neighbor_temp_list_t *list, const uint8_t *mac64) { - ns_list_foreach(ws_neighbor_temp_class_t, entry, &base->active_multicast_temp_neigh) { - if (memcmp(entry->mac64, mac64, 8) == 0) { - return entry; - } - } - return NULL; -} - -static ws_neighbor_temp_class_t *ws_llc_discover_eapol_temp_entry(temp_entriest_t *base, const uint8_t *mac64) -{ - ns_list_foreach(ws_neighbor_temp_class_t, entry, &base->active_eapol_temp_neigh) { + ns_list_foreach(ws_neighbor_temp_class_t, entry, list) { if (memcmp(entry->mac64, mac64, 8) == 0) { return entry; } @@ -1429,13 +1462,14 @@ static ws_neighbor_temp_class_t *ws_llc_discover_eapol_temp_entry(temp_entriest_ static void ws_llc_release_eapol_temp_entry(temp_entriest_t *base, const uint8_t *mac64) { - ws_neighbor_temp_class_t *neighbor = ws_llc_discover_eapol_temp_entry(base, mac64); + ws_neighbor_temp_class_t *neighbor = ws_llc_discover_temp_entry(&base->active_eapol_temp_neigh, mac64); if (!neighbor) { return; } ns_list_remove(&base->active_eapol_temp_neigh, neighbor); - ns_list_add_to_end(&base->free_temp_neigh, neighbor); + ws_llc_temp_entry_free(base, neighbor); + } ws_neighbor_temp_class_t *ws_llc_get_multicast_temp_entry(protocol_interface_info_entry_t *interface, const uint8_t *mac64) @@ -1445,7 +1479,17 @@ ws_neighbor_temp_class_t *ws_llc_get_multicast_temp_entry(protocol_interface_inf return NULL; } - return ws_llc_discover_mc_temp_entry(base->temp_entries, mac64); + return ws_llc_discover_temp_entry(&base->temp_entries->active_multicast_temp_neigh, mac64); +} + +ws_neighbor_temp_class_t *ws_llc_get_eapol_temp_entry(struct protocol_interface_info_entry *interface, const uint8_t *mac64) +{ + llc_data_base_t *base = ws_llc_discover_by_interface(interface); + if (!base) { + return NULL; + } + + return ws_llc_discover_temp_entry(&base->temp_entries->active_eapol_temp_neigh, mac64); } @@ -1464,7 +1508,7 @@ static void ws_init_temporary_neigh_data(ws_neighbor_temp_class_t *entry, const static ws_neighbor_temp_class_t *ws_allocate_multicast_temp_entry(temp_entriest_t *base, const uint8_t *mac64) { - ws_neighbor_temp_class_t *entry = ws_llc_discover_mc_temp_entry(base, mac64); + ws_neighbor_temp_class_t *entry = ws_llc_discover_temp_entry(&base->active_multicast_temp_neigh, mac64); if (entry) { ns_list_remove(&base->active_multicast_temp_neigh, entry); ns_list_add_to_start(&base->active_multicast_temp_neigh, entry); @@ -1492,25 +1536,30 @@ static ws_neighbor_temp_class_t *ws_allocate_multicast_temp_entry(temp_entriest_ static ws_neighbor_temp_class_t *ws_allocate_eapol_temp_entry(temp_entriest_t *base, const uint8_t *mac64) { - ws_neighbor_temp_class_t *entry = ws_llc_discover_eapol_temp_entry(base, mac64); + ws_neighbor_temp_class_t *entry = ws_llc_discover_temp_entry(&base->active_eapol_temp_neigh, mac64); if (entry) { //TODO referesh Timer here return entry; } - if (ns_list_count(&base->active_eapol_temp_neigh) < MAX_NEIGH_TEMPORRY_EAPOL_SIZE) { + //Take static if there is still space for multicast + if (ns_list_count(&base->free_temp_neigh) > (MAX_NEIGH_TEMPORARY_MULTICAST_SIZE - ns_list_count(&base->active_multicast_temp_neigh))) { entry = ns_list_get_first(&base->free_temp_neigh); + ns_list_remove(&base->free_temp_neigh, entry); + } else { + //Allocate Dynamic entry + //validate Can we allocate more + if (ns_list_count(&base->active_eapol_temp_neigh) < base->dynamic_alloc_max) { + entry = ns_dyn_mem_temporary_alloc(sizeof(ws_neighbor_temp_class_t)); + } } - if (!entry) { - return NULL; - } - - ns_list_remove(&base->free_temp_neigh, entry); //Add to list - ns_list_add_to_start(&base->active_eapol_temp_neigh, entry); - //Clear Old data - ws_init_temporary_neigh_data(entry, mac64); + if (entry) { + ns_list_add_to_start(&base->active_eapol_temp_neigh, entry); + //Clear Old data + ws_init_temporary_neigh_data(entry, mac64); + } return entry; } @@ -1622,12 +1671,40 @@ static void ws_llc_mcps_edfe_handler(const mac_api_t *api, mcps_edfe_response_t } +static uint16_t ws_llc_calculate_dynamic_entries_max(uint16_t min_entry, uint16_t max_entry, uint8_t dynamic_heap_percent) +{ + const mem_stat_t *mem_stats = ns_dyn_mem_get_mem_stat(); + if (!mem_stats) { + return min_entry; + } + + uint32_t total_heap_size = mem_stats->heap_sector_size; + total_heap_size = (total_heap_size / 100) * dynamic_heap_percent; + + uint16_t sizeof_entry = sizeof(ws_neighbor_temp_class_t) + 2 * sizeof(int); + + if (total_heap_size > (sizeof_entry * max_entry)) { + //Use given MAX entry size + return max_entry; + } + + if (total_heap_size < (sizeof_entry * min_entry)) { + //Use given Min entry size + return min_entry; + } + + uint16_t max_entry_possible = (uint16_t)total_heap_size / sizeof_entry; + tr_debug("Dynamic EAPOL entry max %d", max_entry_possible); + return max_entry_possible; +} + int8_t ws_llc_create(struct protocol_interface_info_entry *interface, ws_asynch_ind *asynch_ind_cb, ws_asynch_confirm *asynch_cnf_cb, ws_neighbor_info_request *ws_neighbor_info_request_cb) { llc_data_base_t *base = ws_llc_discover_by_interface(interface); if (base) { ws_llc_clean(base); + base->temp_entries->dynamic_alloc_max = ws_llc_calculate_dynamic_entries_max(WS_LLC_EAPOL_DYNAMIC_ALLOCATE_MIN, WS_LLC_EAPOL_DYNAMIC_ALLOCATE_MAX, WS_LLC_EAPOL_DYNAMIC_HEAP_PERCENT); return 0; } @@ -1647,6 +1724,7 @@ int8_t ws_llc_create(struct protocol_interface_info_entry *interface, ws_asynch_ //Init MPX class ws_llc_mpx_init(&base->mpx_data_base); ws_llc_temp_neigh_info_table_reset(base->temp_entries); + base->temp_entries->dynamic_alloc_max = ws_llc_calculate_dynamic_entries_max(WS_LLC_EAPOL_DYNAMIC_ALLOCATE_MIN, WS_LLC_EAPOL_DYNAMIC_ALLOCATE_MAX, WS_LLC_EAPOL_DYNAMIC_HEAP_PERCENT); return 0; } @@ -1948,7 +2026,7 @@ bool ws_llc_eapol_relay_forward_filter(struct protocol_interface_info_entry *int return false; } - ws_neighbor_temp_class_t *neighbor = ws_llc_discover_eapol_temp_entry(base->temp_entries, joiner_eui64); + ws_neighbor_temp_class_t *neighbor = ws_llc_discover_temp_entry(&base->temp_entries->active_eapol_temp_neigh, joiner_eui64); if (!neighbor) { llc_neighbour_req_t neighbor_info; //Discover here Normal Neighbour diff --git a/source/6LoWPAN/ws/ws_management_api.c b/source/6LoWPAN/ws/ws_management_api.c index d1bb845d8e..61c9e4b6e5 100644 --- a/source/6LoWPAN/ws/ws_management_api.c +++ b/source/6LoWPAN/ws/ws_management_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/ws/ws_mpx_header.c b/source/6LoWPAN/ws/ws_mpx_header.c index 6d0ad5ae56..14a805c207 100644 --- a/source/6LoWPAN/ws/ws_mpx_header.c +++ b/source/6LoWPAN/ws/ws_mpx_header.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/ws/ws_mpx_header.h b/source/6LoWPAN/ws/ws_mpx_header.h index 2e64b0571b..ee1d48d669 100644 --- a/source/6LoWPAN/ws/ws_mpx_header.h +++ b/source/6LoWPAN/ws/ws_mpx_header.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/ws/ws_neighbor_class.c b/source/6LoWPAN/ws/ws_neighbor_class.c index ab24bf0ed8..20d29cbc4d 100644 --- a/source/6LoWPAN/ws/ws_neighbor_class.c +++ b/source/6LoWPAN/ws/ws_neighbor_class.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/ws/ws_neighbor_class.h b/source/6LoWPAN/ws/ws_neighbor_class.h index 516196abdf..1bb82adb28 100644 --- a/source/6LoWPAN/ws/ws_neighbor_class.h +++ b/source/6LoWPAN/ws/ws_neighbor_class.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/ws/ws_pae_auth.c b/source/6LoWPAN/ws/ws_pae_auth.c index 452f3c5015..da2c3cf104 100644 --- a/source/6LoWPAN/ws/ws_pae_auth.c +++ b/source/6LoWPAN/ws/ws_pae_auth.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -44,6 +44,7 @@ #include "Security/protocols/fwh_sec_prot/auth_fwh_sec_prot.h" #include "Security/protocols/gkh_sec_prot/auth_gkh_sec_prot.h" #include "Security/protocols/radius_sec_prot/radius_client_sec_prot.h" +#include "Security/protocols/msg_sec_prot/msg_sec_prot.h" #include "6LoWPAN/ws/ws_cfg_settings.h" #include "6LoWPAN/ws/ws_pae_controller.h" #include "6LoWPAN/ws/ws_pae_timers.h" @@ -237,6 +238,10 @@ int8_t ws_pae_auth_init(protocol_interface_info_entry_t *interface_ptr, sec_prot goto error; } + if (msg_sec_prot_register(pae_auth->kmp_service) < 0) { + goto error; + } + if (tasklet_id < 0) { tasklet_id = eventOS_event_handler_create(ws_pae_auth_tasklet_handler, PAE_TASKLET_INIT); if (tasklet_id < 0) { @@ -964,10 +969,20 @@ static supp_entry_t *ws_pae_auth_waiting_supp_list_add(pae_auth_t *pae_auth, sup ns_list_add_to_start(&pae_auth->waiting_supp_list, supp_entry); pae_auth->waiting_supp_list_size++; } else { - // Create a new supplicant entry if not at limit - if (pae_auth->waiting_supp_list_size > WAITING_SUPPLICANT_LIST_MAX_SIZE) { - tr_info("PAE: waiting list full, eui-64: %s", trace_array(addr->eui_64, 8)); - return NULL; + // If the waiting list if full removes the oldest entry from the list + if (pae_auth->waiting_supp_list_size >= WAITING_SUPPLICANT_LIST_MAX_SIZE) { + supp_entry_t *delete_supp = ns_list_get_last(&pae_auth->waiting_supp_list); + if (!delete_supp) { + return NULL; + } + tr_info("PAE: waiting list full, eui-64: %s, deleted eui-64: %s", trace_array(addr->eui_64, 8), trace_array(delete_supp->addr.eui_64, 8)); + // Create new instance + kmp_api_t *new_kmp = ws_pae_auth_kmp_create_and_start(pae_auth->kmp_service, MSG_PROT, pae_auth->relay_socked_msg_if_instance_id, delete_supp, pae_auth->sec_cfg); + if (!new_kmp) { + return NULL; + } + kmp_api_create_request(new_kmp, MSG_PROT, &delete_supp->addr, &delete_supp->sec_keys); + (void) ws_pae_lib_supp_list_remove(pae_auth, &pae_auth->waiting_supp_list, delete_supp, ws_pae_auth_waiting_supp_deleted); } supp_entry = ws_pae_lib_supp_list_add(&pae_auth->waiting_supp_list, addr); if (!supp_entry) { @@ -981,7 +996,7 @@ static supp_entry_t *ws_pae_auth_waiting_supp_list_add(pae_auth_t *pae_auth, sup // 90 percent of the EAPOL temporary entry lifetime (10 ticks per second) supp_entry->waiting_ticks = pae_auth->sec_cfg->timing_cfg.temp_eapol_min_timeout * 900 / 100; - tr_debug("PAE: to waiting, list size %i, retry %i, eui-64: %s", pae_auth->waiting_supp_list_size, supp_entry->waiting_ticks, trace_array(supp_entry->addr.eui_64, 8)); + tr_info("PAE: to waiting, list size %i, retry %i, eui-64: %s", pae_auth->waiting_supp_list_size, supp_entry->waiting_ticks, trace_array(supp_entry->addr.eui_64, 8)); return supp_entry; } diff --git a/source/6LoWPAN/ws/ws_pae_auth.h b/source/6LoWPAN/ws/ws_pae_auth.h index 506ee4ee7b..4b6dd07432 100644 --- a/source/6LoWPAN/ws/ws_pae_auth.h +++ b/source/6LoWPAN/ws/ws_pae_auth.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/ws/ws_pae_controller.c b/source/6LoWPAN/ws/ws_pae_controller.c index 0f299ce55d..805cb07d8b 100644 --- a/source/6LoWPAN/ws/ws_pae_controller.c +++ b/source/6LoWPAN/ws/ws_pae_controller.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -122,7 +122,6 @@ static bool ws_pae_controller_auth_congestion_get(protocol_interface_info_entry_ #endif static pae_controller_t *ws_pae_controller_get(protocol_interface_info_entry_t *interface_ptr); static void ws_pae_controller_frame_counter_timer(uint16_t seconds, pae_controller_t *entry); -static void ws_pae_controller_frame_counter_timer_trigger(uint16_t seconds, pae_controller_t *entry); static void ws_pae_controller_frame_counter_store(pae_controller_t *entry, bool use_threshold); static void ws_pae_controller_nvm_frame_counter_write(frame_cnt_nvm_tlv_t *tlv_entry); static int8_t ws_pae_controller_nvm_frame_counter_read(uint32_t *restart_cnt, uint64_t *stored_time, uint16_t *pan_version, frame_counters_t *counters); @@ -516,10 +515,6 @@ static int8_t ws_pae_controller_nw_key_check_and_insert(protocol_interface_info_ controller->nw_frame_counter_set(controller->interface_ptr, curr_frame_counter, i); } } - /* Trigger storing of frame counters; there is 5 seconds delay to give time for the - other keys to be inserted, so that frame counters for several keys are updated on - a same time. */ - ws_pae_controller_frame_counter_timer_trigger(FRAME_COUNTER_STORE_TRIGGER, controller); } } @@ -614,6 +609,8 @@ static void ws_pae_controller_frame_counter_store_and_nw_keys_remove(protocol_in tr_info("NW keys remove"); + controller->gtk_index = -1; + nw_key_t *nw_key = controller->nw_key; for (uint8_t i = 0; i < GTK_NUM; i++) { // Deletes the key if it is set @@ -637,9 +634,12 @@ static void ws_pae_controller_nw_key_index_check_and_set(protocol_interface_info } if (controller->nw_send_key_index_set) { + controller->gtk_index = index; + /* Checks if frame counters needs to be stored for the new GTK that is taken into + use; this is the last check that stored counters are in sync before activating key */ + ws_pae_controller_frame_counter_store(controller, true); tr_info("NW send key index set: %i", index + 1); controller->nw_send_key_index_set(interface_ptr, index); - controller->gtk_index = index; } // Do not update PAN version for initial key index set @@ -661,13 +661,14 @@ static void ws_pae_controller_active_nw_key_set(protocol_interface_info_entry_t } if (controller->nw_send_key_index_set) { + controller->gtk_index = index; /* Checks if frame counters needs to be stored for the new GTK that is taken into use; this is the last check that stored counters are in sync before activating key */ ws_pae_controller_frame_counter_store(controller, true); // Activates key on MAC controller->nw_send_key_index_set(controller->interface_ptr, index); tr_info("NW send key index set: %i", index + 1); - controller->gtk_index = index; + } } @@ -721,11 +722,9 @@ int8_t ws_pae_controller_configure(protocol_interface_info_entry_t *interface_pt controller->sec_cfg.prot_cfg.sec_prot_trickle_params.k = 0; controller->sec_cfg.prot_cfg.sec_prot_trickle_params.TimerExpirations = sec_prot_cfg->sec_prot_trickle_timer_exp; controller->sec_cfg.prot_cfg.sec_prot_retry_timeout = sec_prot_cfg->sec_prot_retry_timeout * 10; - controller->sec_cfg.prot_cfg.initial_key_retry_delay = sec_prot_cfg->initial_key_retry_delay; - controller->sec_cfg.prot_cfg.initial_key_trickle_params.Imin = sec_prot_cfg->initial_key_imin; - controller->sec_cfg.prot_cfg.initial_key_trickle_params.Imax = sec_prot_cfg->initial_key_imax; - controller->sec_cfg.prot_cfg.initial_key_trickle_params.k = 0; - controller->sec_cfg.prot_cfg.initial_key_trickle_params.TimerExpirations = 2; + controller->sec_cfg.prot_cfg.initial_key_retry_min = sec_prot_cfg->initial_key_retry_min; + controller->sec_cfg.prot_cfg.initial_key_retry_max = sec_prot_cfg->initial_key_retry_max; + controller->sec_cfg.prot_cfg.initial_key_retry_max_limit = sec_prot_cfg->initial_key_retry_max_limit; controller->sec_cfg.prot_cfg.initial_key_retry_cnt = sec_prot_cfg->initial_key_retry_cnt; } @@ -803,7 +802,6 @@ static int8_t ws_pae_controller_frame_counter_read(pae_controller_t *controller) // Increments PAN version to ensure that it is fresh controller->sec_keys_nw_info.pan_version += PAN_VERSION_STORAGE_READ_INCREMENT; - bool updated = false; // Checks frame counters for (uint8_t index = 0; index < GTK_NUM; index++) { if (controller->frame_counters.counter[index].set) { @@ -819,15 +817,8 @@ static int8_t ws_pae_controller_frame_counter_read(pae_controller_t *controller) controller->frame_counters.counter[index].frame_counter; tr_info("Read frame counter: index %i value %"PRIu32"", index, controller->frame_counters.counter[index].frame_counter); - - updated = true; } } - if (updated) { - // Writes incremented frame counters - ws_pae_nvm_store_frame_counter_tlv_create((frame_cnt_nvm_tlv_t *) &controller->pae_nvm_buffer, controller->restart_cnt, controller->sec_keys_nw_info.pan_version, &controller->frame_counters); - ws_pae_controller_nvm_frame_counter_write((frame_cnt_nvm_tlv_t *) &controller->pae_nvm_buffer); - } } return ret_value; @@ -838,6 +829,7 @@ static void ws_pae_controller_frame_counter_reset(frame_counters_t *frame_counte for (uint8_t index = 0; index < GTK_NUM; index++) { ws_pae_controller_frame_counter_index_reset(frame_counters, index); } + frame_counters->active_gtk_index = -1; } static void ws_pae_controller_frame_counter_index_reset(frame_counters_t *frame_counters, uint8_t index) @@ -1714,13 +1706,6 @@ static void ws_pae_controller_frame_counter_timer(uint16_t seconds, pae_controll } } -static void ws_pae_controller_frame_counter_timer_trigger(uint16_t seconds, pae_controller_t *entry) -{ - if (entry->frame_cnt_store_timer > seconds) { - entry->frame_cnt_store_timer = seconds; - } -} - static void ws_pae_controller_frame_counter_store(pae_controller_t *entry, bool use_threshold) { bool update_needed = false; @@ -1733,7 +1718,7 @@ static void ws_pae_controller_frame_counter_store(pae_controller_t *entry, bool * frame counters will be still valid. */ if (entry->nw_key[i].installed) { - // Reads frame counter for the key + // Reads MAC frame counter for the key uint32_t curr_frame_counter; entry->nw_frame_counter_read(entry->interface_ptr, &curr_frame_counter, i); @@ -1754,13 +1739,22 @@ static void ws_pae_controller_frame_counter_store(pae_controller_t *entry, bool tr_debug("Stored updated frame counter: index %i value %"PRIu32"", i, frame_counter); } } else { - // For new or modified network keys, stores the frame counter value + // New or modified network key entry->frame_counters.counter[i].set = true; memcpy(entry->frame_counters.counter[i].gtk, entry->nw_key[i].gtk, GTK_LEN); entry->frame_counters.counter[i].frame_counter = curr_frame_counter; entry->frame_counters.counter[i].stored_frame_counter = curr_frame_counter; + tr_debug("Pending to store new frame counter: index %i value %"PRIu32"", i, curr_frame_counter); + } + + /* If currently active key is changed or active key is set for the first time, + stores the frame counter value */ + if (entry->gtk_index == i && entry->frame_counters.active_gtk_index != i) { + entry->frame_counters.active_gtk_index = entry->gtk_index; update_needed = true; - tr_debug("Stored new frame counter: index %i value %"PRIu32"", i, curr_frame_counter); + // Updates MAC frame counter for the key + entry->nw_frame_counter_set(entry->interface_ptr, entry->frame_counters.counter[i].frame_counter, i); + tr_debug("Stored frame counters, active key set: index %i value %"PRIu32"", i, entry->frame_counters.counter[i].frame_counter); } } } diff --git a/source/6LoWPAN/ws/ws_pae_controller.h b/source/6LoWPAN/ws/ws_pae_controller.h index 516a6cf22d..40cd01fb0b 100644 --- a/source/6LoWPAN/ws/ws_pae_controller.h +++ b/source/6LoWPAN/ws/ws_pae_controller.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/ws/ws_pae_key_storage.c b/source/6LoWPAN/ws/ws_pae_key_storage.c index e8026364a3..373f2c0619 100644 --- a/source/6LoWPAN/ws/ws_pae_key_storage.c +++ b/source/6LoWPAN/ws/ws_pae_key_storage.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Arm Limited and affiliates. + * Copyright (c) 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/ws/ws_pae_key_storage.h b/source/6LoWPAN/ws/ws_pae_key_storage.h index c0ca7cac04..39e6df60e0 100644 --- a/source/6LoWPAN/ws/ws_pae_key_storage.h +++ b/source/6LoWPAN/ws/ws_pae_key_storage.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Arm Limited and affiliates. + * Copyright (c) 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/ws/ws_pae_lib.c b/source/6LoWPAN/ws/ws_pae_lib.c index fb635e7741..bc14ba93ab 100644 --- a/source/6LoWPAN/ws/ws_pae_lib.c +++ b/source/6LoWPAN/ws/ws_pae_lib.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/ws/ws_pae_lib.h b/source/6LoWPAN/ws/ws_pae_lib.h index e29ef5bd0f..3d1c8a148e 100644 --- a/source/6LoWPAN/ws/ws_pae_lib.h +++ b/source/6LoWPAN/ws/ws_pae_lib.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/ws/ws_pae_nvm_data.c b/source/6LoWPAN/ws/ws_pae_nvm_data.c index ba575c2acb..27eacbc45f 100644 --- a/source/6LoWPAN/ws/ws_pae_nvm_data.c +++ b/source/6LoWPAN/ws/ws_pae_nvm_data.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Arm Limited and affiliates. + * Copyright (c) 2019-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/ws/ws_pae_nvm_data.h b/source/6LoWPAN/ws/ws_pae_nvm_data.h index 3d6e643231..9194e2b5b9 100644 --- a/source/6LoWPAN/ws/ws_pae_nvm_data.h +++ b/source/6LoWPAN/ws/ws_pae_nvm_data.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/ws/ws_pae_nvm_store.c b/source/6LoWPAN/ws/ws_pae_nvm_store.c index b4a9108bca..065d9d0598 100644 --- a/source/6LoWPAN/ws/ws_pae_nvm_store.c +++ b/source/6LoWPAN/ws/ws_pae_nvm_store.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Arm Limited and affiliates. + * Copyright (c) 2019-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/ws/ws_pae_nvm_store.h b/source/6LoWPAN/ws/ws_pae_nvm_store.h index bf18915c1b..32fd0bafde 100644 --- a/source/6LoWPAN/ws/ws_pae_nvm_store.h +++ b/source/6LoWPAN/ws/ws_pae_nvm_store.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/ws/ws_pae_supp.c b/source/6LoWPAN/ws/ws_pae_supp.c index d73de75a2b..6aab0d9cae 100644 --- a/source/6LoWPAN/ws/ws_pae_supp.c +++ b/source/6LoWPAN/ws/ws_pae_supp.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -78,8 +78,8 @@ #define STORED_KEYS_MAXIMUM_USE_COUNT 1 // Delay for sending the initial EAPOL-Key -#define INITIAL_KEY_TIMER_MIN 3 -#define INITIAL_KEY_TIMER_MAX 30 +#define INITIAL_KEY_TIMER_MIN 1 +#define INITIAL_KEY_TIMER_MAX 3 typedef struct { ns_list_link_t link; /**< Link */ @@ -94,16 +94,17 @@ typedef struct { supp_entry_t entry; /**< Supplicant data */ kmp_addr_t target_addr; /**< EAPOL target (parent) address */ uint16_t initial_key_timer; /**< Timer to trigger initial EAPOL-Key */ - uint16_t initial_key_retry_timer; /**< Timer to trigger initial EAPOL-Key 1st retry */ - trickle_t auth_trickle_timer; /**< Trickle timer for re-sending initial EAPOL-key or for GTK mismatch */ - trickle_params_t auth_trickle_params; /**< Trickle parameters for initial EAPOL-key or for GTK mismatch */ + trickle_t gtk_req_trickle_timer; /**< Trickle timer for re-sending initial EAPOL-key on GTK mismatch */ + trickle_params_t gtk_req_trickle_params; /**< Trickle parameters for initial EAPOL-key on GTK mismatch */ uint8_t new_br_eui_64[8]; /**< Border router EUI-64 indicated by bootstrap after bootstrap start */ uint8_t comp_br_eui_64[8]; /**< Border router EUI-64 indicated by bootstrap after bootstrap completed */ sec_prot_keys_nw_info_t *sec_keys_nw_info; /**< Security keys network information */ sec_cfg_t *sec_cfg; /**< Security configuration */ uint8_t nw_keys_used_cnt; /**< How many times bootstrap has been tried with current keys */ + uint16_t initial_key_retry_max_value; /**< Initial EAPOL-Key retry exponential backoff max value */ + uint16_t initial_key_retry_timer; /**< Initial EAPOL-Key retry exponential backoff timer */ uint8_t initial_key_retry_cnt; /**< initial EAPOL-Key retry counter */ - bool auth_trickle_running : 1; /**< Initial EAPOL-Key Trickle timer running */ + bool gtk_update_trickle_running : 1; /**< GTK update Initial EAPOL-Key Trickle timer running */ bool auth_requested : 1; /**< Authentication has been requested by the bootstrap */ bool timer_running : 1; /**< Timer is running */ bool new_br_eui_64_set : 1; /**< Border router address has been set after bootstrap start */ @@ -117,9 +118,9 @@ typedef struct { #define KEY_UPDATE_RETRY_COUNT 3 #define LIFETIME_MISMATCH_RETRY_COUNT 1 /* No retries */ -// Trickle timer on how long to wait response after last retry before failing authentication -#define LAST_INTERVAL_TRICKLE_IMIN_SECS 240 /* 4 minutes */ -#define LAST_INTERVAL_TRICKLE_IMAX_SECS 240 +// Timer on how long to wait response after last retry before failing authentication +#define LAST_INTERVAL_MIN_SECS 120 /* 2 minutes */ +#define LAST_INTERVAL_MAX_SECS 240 /* 4 minutes */ static void ws_pae_supp_free(pae_supp_t *pae_supp); static void ws_pae_supp_authenticate_response(pae_supp_t *pae_supp, auth_result_e result); @@ -131,8 +132,6 @@ static int8_t ws_pae_supp_nvm_keys_write(pae_supp_t *pae_supp); static pae_supp_t *ws_pae_supp_get(protocol_interface_info_entry_t *interface_ptr); static int8_t ws_pae_supp_event_send(kmp_service_t *service, void *data); static void ws_pae_supp_tasklet_handler(arm_event_s *event); -static void ws_pae_supp_initial_trickle_timer_start(pae_supp_t *pae_supp); -static void ws_pae_supp_initial_last_interval_trickle_timer_start(pae_supp_t *pae_supp); static void ws_pae_supp_initial_key_update_trickle_timer_start(pae_supp_t *pae_supp, uint8_t timer_expirations); static bool ws_pae_supp_authentication_ongoing(pae_supp_t *pae_supp); static int8_t ws_pae_supp_timer_if_start(kmp_service_t *service, kmp_api_t *kmp); @@ -220,7 +219,7 @@ int8_t ws_pae_supp_authenticate(protocol_interface_info_entry_t *interface_ptr, pae_supp->auth_requested = true; - // Randomizes the sending of initial EAPOL-Key messsage + // Randomizes the sending of initial EAPOL-Key message pae_supp->initial_key_timer = randLIB_get_random_in_range(INITIAL_KEY_TIMER_MIN, INITIAL_KEY_TIMER_MAX); // Starts supplicant timer @@ -322,7 +321,7 @@ int8_t ws_pae_supp_gtk_hash_update(protocol_interface_info_entry_t *interface_pt /* Mismatch, initiate EAPOL (if authentication not already ongoing or if not on wait time for the authenticator to answer) */ - if (!pae_supp->auth_trickle_running || pae_supp->initial_key_retry_cnt == 0) { + if (!pae_supp->gtk_update_trickle_running || pae_supp->initial_key_retry_cnt == 0) { uint8_t timer_expirations = KEY_UPDATE_RETRY_COUNT; // For GTK lifetime mismatch send only once if (mismatch == GTK_LIFETIME_MISMATCH) { @@ -334,7 +333,7 @@ int8_t ws_pae_supp_gtk_hash_update(protocol_interface_info_entry_t *interface_pt // Starts supplicant timer ws_pae_supp_timer_start(pae_supp); - tr_info("GTK update start imin: %i, imax: %i, max mismatch: %i, tr time: %i", pae_supp->sec_cfg->timer_cfg.gtk_request_imin, pae_supp->sec_cfg->timer_cfg.gtk_request_imax, pae_supp->sec_cfg->timer_cfg.gtk_max_mismatch, pae_supp->auth_trickle_timer.t); + tr_info("GTK update start imin: %i, imax: %i, max mismatch: %i, tr time: %i", pae_supp->sec_cfg->timer_cfg.gtk_request_imin, pae_supp->sec_cfg->timer_cfg.gtk_request_imax, pae_supp->sec_cfg->timer_cfg.gtk_max_mismatch, pae_supp->gtk_req_trickle_timer.t); } } @@ -426,7 +425,7 @@ static int8_t ws_pae_supp_nvm_keys_read(pae_supp_t *pae_supp) static void ws_pae_supp_authenticate_response(pae_supp_t *pae_supp, auth_result_e result) { - pae_supp->auth_trickle_running = false; + pae_supp->initial_key_retry_timer = 0; if (pae_supp->auth_requested && pae_supp->auth_completed) { pae_supp->auth_requested = false; pae_supp->auth_completed(pae_supp->interface_ptr, result, pae_supp->target_addr.eui_64); @@ -576,18 +575,19 @@ int8_t ws_pae_supp_init(protocol_interface_info_entry_t *interface_ptr, const se pae_supp->nw_key_index_set = NULL; pae_supp->gtk_hash_ptr_get = NULL; pae_supp->initial_key_timer = 0; - pae_supp->initial_key_retry_timer = 0; pae_supp->nw_keys_used_cnt = 0; - pae_supp->initial_key_retry_cnt = DEFAULT_INITIAL_KEY_RETRY_COUNT; + pae_supp->initial_key_retry_cnt = MEDIUM_NW_INITIAL_KEY_RETRY_COUNT; pae_supp->sec_keys_nw_info = sec_keys_nw_info; pae_supp->sec_cfg = sec_cfg; - pae_supp->auth_trickle_running = false; + pae_supp->gtk_update_trickle_running = false; pae_supp->auth_requested = false; pae_supp->timer_running = false; pae_supp->new_br_eui_64_set = false; pae_supp->new_br_eui_64_fresh = false; pae_supp->comp_br_eui_64_set = false; pae_supp->entry_address_active = false; + pae_supp->initial_key_retry_max_value = 0; + pae_supp->initial_key_retry_timer = 0; ws_pae_lib_supp_init(&pae_supp->entry); @@ -787,7 +787,7 @@ void ws_pae_supp_fast_timer(uint16_t ticks) static bool ws_pae_supp_authentication_ongoing(pae_supp_t *pae_supp) { /* When either bootstrap initial authentication or re-authentication is ongoing */ - if (pae_supp->initial_key_timer || pae_supp->auth_trickle_running || + if (pae_supp->initial_key_timer || pae_supp->initial_key_retry_timer || pae_supp->gtk_update_trickle_running || ws_pae_lib_supp_timer_is_running(&pae_supp->entry)) { return true; } @@ -799,67 +799,79 @@ void ws_pae_supp_slow_timer(uint16_t seconds) { ns_list_foreach(pae_supp_t, pae_supp, &pae_supp_list) { - // Checks whether initial EAPOL-Key message needs to be re-send or new GTK request to be sent - if (pae_supp->auth_trickle_running) { - if (pae_supp->initial_key_retry_timer > 0) { - if (pae_supp->initial_key_retry_timer > seconds) { - pae_supp->initial_key_retry_timer -= seconds; - } else { - pae_supp->initial_key_retry_timer = 0; - tr_info("initial key retry timer expired"); + bool key_expired = false; + + if (pae_supp->initial_key_retry_timer > seconds) { + pae_supp->initial_key_retry_timer -= seconds; + } else if (pae_supp->initial_key_retry_timer != 0) { + pae_supp->initial_key_retry_timer = 0; + key_expired = true; + } + + if (pae_supp->gtk_update_trickle_running) { + if (trickle_timer(&pae_supp->gtk_req_trickle_timer, &pae_supp->gtk_req_trickle_params, seconds)) { + key_expired = true; + } + } + + if (key_expired) { + if (pae_supp->initial_key_retry_cnt > 0) { + // On initial EAPOL-key TX failure, check for other parents + if (pae_supp->auth_requested && pae_supp->tx_failure_on_initial_key) { + // Returns same target if no other valid targets found + const uint8_t *next_target = pae_supp->auth_next_target(pae_supp->interface_ptr, kmp_address_eui_64_get(&pae_supp->target_addr), &pae_supp->sec_keys_nw_info->key_pan_id); + kmp_address_eui_64_set(&pae_supp->target_addr, next_target); + ws_pae_supp_address_set(pae_supp, &pae_supp->target_addr); + } + pae_supp->tx_failure_on_initial_key = false; + // Sends initial EAPOL-key + if (ws_pae_supp_initial_key_send(pae_supp) < 0) { + tr_info("EAPOL-Key send failed"); + } + } + + /* Wait time for the authenticator to answer the last re-transmit expires; + fails authentication */ + if (pae_supp->initial_key_retry_cnt == 0) { + bool retry = false; + // If making key update and GTKs do not match to GTK hash + if (!pae_supp->auth_requested && ws_pae_supp_gtk_hash_mismatch_check(pae_supp) < 0) { + tr_info("GTKs do not match to GTK hash"); + retry = true; + } + auth_result_e result = AUTH_RESULT_ERR_UNSPEC; + if (pae_supp->tx_failure_on_initial_key) { + result = AUTH_RESULT_ERR_TX_ERR; + pae_supp->tx_failure_on_initial_key = false; + } + ws_pae_supp_authenticate_response(pae_supp, result); + if (retry) { + // Start trickle timer to try re-authentication + ws_pae_supp_initial_key_update_trickle_timer_start(pae_supp, KEY_UPDATE_RETRY_COUNT); } } else { - // Checks if trickle timer expires - if (trickle_timer(&pae_supp->auth_trickle_timer, &pae_supp->auth_trickle_params, seconds)) { - if (pae_supp->initial_key_retry_cnt > 0) { - // On initial EAPOL-key TX failure, check for other parents - if (pae_supp->auth_requested && pae_supp->tx_failure_on_initial_key) { - // Returns same target if no other valid targets found - const uint8_t *next_target = pae_supp->auth_next_target(pae_supp->interface_ptr, kmp_address_eui_64_get(&pae_supp->target_addr), &pae_supp->sec_keys_nw_info->key_pan_id); - kmp_address_eui_64_set(&pae_supp->target_addr, next_target); - ws_pae_supp_address_set(pae_supp, &pae_supp->target_addr); - } - pae_supp->tx_failure_on_initial_key = false; - // Sends initial EAPOL-key - if (ws_pae_supp_initial_key_send(pae_supp) < 0) { - tr_info("EAPOL-Key send failed"); - } - } + if (pae_supp->initial_key_retry_cnt > 1) { + pae_supp->initial_key_retry_cnt--; - /* Wait time for the authenticator to answer the last re-transmit expires; - fails authentication */ - if (pae_supp->initial_key_retry_cnt == 0) { - bool retry = false; - // If making key update and GTKs do not match to GTK hash - if (!pae_supp->auth_requested && ws_pae_supp_gtk_hash_mismatch_check(pae_supp) < 0) { - tr_info("GTKs do not match to GTK hash"); - retry = true; - } - auth_result_e result = AUTH_RESULT_ERR_UNSPEC; - if (pae_supp->tx_failure_on_initial_key) { - result = AUTH_RESULT_ERR_TX_ERR; - pae_supp->tx_failure_on_initial_key = false; - } - ws_pae_supp_authenticate_response(pae_supp, result); - if (retry) { - // Start trickle timer to try re-authentication - ws_pae_supp_initial_key_update_trickle_timer_start(pae_supp, KEY_UPDATE_RETRY_COUNT); - } - } else { - if (pae_supp->initial_key_retry_cnt > 0) { - pae_supp->initial_key_retry_cnt--; - } - if (pae_supp->initial_key_retry_cnt == 0) { - // Starts wait time for the authenticator to answer - tr_info("Initial EAPOL-Key wait for last re-transmit answer"); - ws_pae_supp_initial_last_interval_trickle_timer_start(pae_supp); - } + pae_supp->initial_key_retry_max_value *= 2; + if (pae_supp->initial_key_retry_max_value > pae_supp->sec_cfg->prot_cfg.initial_key_retry_max_limit) { + pae_supp->initial_key_retry_max_value = pae_supp->sec_cfg->prot_cfg.initial_key_retry_max_limit; } - } + pae_supp->initial_key_retry_timer = randLIB_get_random_in_range( + pae_supp->sec_cfg->prot_cfg.initial_key_retry_min, + pae_supp->initial_key_retry_max_value); - // Sanity check, should be running until authentication failure - if (!trickle_running(&pae_supp->auth_trickle_timer, &pae_supp->auth_trickle_params)) { - ws_pae_supp_authenticate_response(pae_supp, AUTH_RESULT_ERR_UNSPEC); + tr_info("Initial EAPOL-Key retry timer %i seconds (range [%i,%i] seconds)", + pae_supp->initial_key_retry_timer, + pae_supp->sec_cfg->prot_cfg.initial_key_retry_min, + pae_supp->initial_key_retry_max_value); + } else if (pae_supp->initial_key_retry_cnt > 0) { + pae_supp->initial_key_retry_cnt = 0; + // Starts wait time for the authenticator to answer + pae_supp->initial_key_retry_timer = randLIB_get_random_in_range( + LAST_INTERVAL_MIN_SECS, LAST_INTERVAL_MAX_SECS); + tr_info("Initial EAPOL-Key wait for last re-transmit answer %i seconds (range [120,240] seconds)", + pae_supp->initial_key_retry_timer); } } } @@ -879,71 +891,37 @@ void ws_pae_supp_slow_timer(uint16_t seconds) } else { pae_supp->initial_key_timer = 0; pae_supp->tx_failure_on_initial_key = false; + pae_supp->initial_key_retry_cnt = pae_supp->sec_cfg->prot_cfg.initial_key_retry_cnt; // Sends initial EAPOL-Key message if (ws_pae_supp_initial_key_send(pae_supp) < 0) { tr_info("EAPOL-Key send failed"); } - // Start trickle timer - ws_pae_supp_initial_trickle_timer_start(pae_supp); + // Starts initial EAPOL-key retry exponential backoff timer + pae_supp->initial_key_retry_max_value = pae_supp->sec_cfg->prot_cfg.initial_key_retry_max; + pae_supp->initial_key_retry_timer = randLIB_get_random_in_range( + pae_supp->sec_cfg->prot_cfg.initial_key_retry_min, + pae_supp->initial_key_retry_max_value); + + tr_info("Initial EAPOL-Key retry timer %i seconds (range [%i,%i] seconds)", + pae_supp->initial_key_retry_timer, + pae_supp->sec_cfg->prot_cfg.initial_key_retry_min, + pae_supp->initial_key_retry_max_value); } } } } -static void ws_pae_supp_initial_trickle_timer_start(pae_supp_t *pae_supp) -{ - /* Starts trickle for initial EAPOL-key. Default sequence has fixed delay of 2 minutes, - * one re-transmit interval, last re-transmit interval transmit time and a wait time - * for the authenticator to answer the last re-transmit. - * - * Interval I [6,12] minutes. Sequence: - * - * fixed 2 minutes delay + I + last I transmit time t + wait for answer [2,4] minutes - * - * There are two retries. Minimum time that sequence takes before authentication failure - * is 16 minutes and maximum is 30 minutes. - * - * - * Extremely slow network - * - * Starts trickle for initial EAPOL-key, Interval I [10,60] minutes. Sequence: - * I + last I transmit time t + wait for answer [2,4] minutes - * There are two retries. Minimum time that sequence takes before authentication failure - * is 22 minutes and maximum is 124 minutes. - */ - pae_supp->auth_trickle_params = pae_supp->sec_cfg->prot_cfg.initial_key_trickle_params; - pae_supp->initial_key_retry_timer = pae_supp->sec_cfg->prot_cfg.initial_key_retry_delay; - - trickle_start(&pae_supp->auth_trickle_timer, &pae_supp->auth_trickle_params); - tr_info("Initial EAPOL-Key trickle I: [%i,%i] %i, t: %i", pae_supp->auth_trickle_params.Imin, pae_supp->auth_trickle_params.Imax, pae_supp->auth_trickle_timer.I, pae_supp->auth_trickle_timer.t); - pae_supp->auth_trickle_running = true; - pae_supp->initial_key_retry_cnt = pae_supp->sec_cfg->prot_cfg.initial_key_retry_cnt; -} - -static void ws_pae_supp_initial_last_interval_trickle_timer_start(pae_supp_t *pae_supp) -{ - // Starts trickle last to wait response after last retry before failing authentication - pae_supp->auth_trickle_params.Imin = LAST_INTERVAL_TRICKLE_IMIN_SECS; - pae_supp->auth_trickle_params.Imax = LAST_INTERVAL_TRICKLE_IMAX_SECS; - pae_supp->auth_trickle_params.k = 0; - pae_supp->auth_trickle_params.TimerExpirations = 1; - // Set I to [iMin,iMax] (4 to 4 minutes) -> t is [I/2 - I] (2 minutes to 4 minutes) - trickle_start(&pae_supp->auth_trickle_timer, &pae_supp->auth_trickle_params); - tr_info("Initial EAPOL-Key trickle I: [%i,%i] %i, t: %i", pae_supp->auth_trickle_params.Imin, pae_supp->auth_trickle_params.Imax, pae_supp->auth_trickle_timer.I, pae_supp->auth_trickle_timer.t); -} - static void ws_pae_supp_initial_key_update_trickle_timer_start(pae_supp_t *pae_supp, uint8_t timer_expirations) { // Starts trickle for the key update - pae_supp->auth_trickle_params.Imin = pae_supp->sec_cfg->timer_cfg.gtk_request_imin; - pae_supp->auth_trickle_params.Imax = pae_supp->sec_cfg->timer_cfg.gtk_request_imax; - pae_supp->auth_trickle_params.k = 0; - pae_supp->auth_trickle_params.TimerExpirations = timer_expirations; + pae_supp->gtk_req_trickle_params.Imin = pae_supp->sec_cfg->timer_cfg.gtk_request_imin; + pae_supp->gtk_req_trickle_params.Imax = pae_supp->sec_cfg->timer_cfg.gtk_request_imax; + pae_supp->gtk_req_trickle_params.k = 0; + pae_supp->gtk_req_trickle_params.TimerExpirations = timer_expirations; - trickle_start(&pae_supp->auth_trickle_timer, &pae_supp->auth_trickle_params); - tr_info("Initial EAPOL-Key trickle I: [%i,%i] %i, t: %i", pae_supp->auth_trickle_params.Imin, pae_supp->auth_trickle_params.Imax, pae_supp->auth_trickle_timer.I, pae_supp->auth_trickle_timer.t); - pae_supp->initial_key_retry_timer = NONE_INITIAL_KEY_RETRY_TIMER; // 0 seconds - pae_supp->auth_trickle_running = true; + trickle_start(&pae_supp->gtk_req_trickle_timer, &pae_supp->gtk_req_trickle_params); + tr_info("Initial EAPOL-Key trickle I: [%i,%i] %i, t: %i", pae_supp->gtk_req_trickle_params.Imin, pae_supp->gtk_req_trickle_params.Imax, pae_supp->gtk_req_trickle_timer.I, pae_supp->gtk_req_trickle_timer.t); + pae_supp->gtk_update_trickle_running = true; pae_supp->initial_key_retry_cnt = timer_expirations; } @@ -1216,7 +1194,8 @@ static void ws_pae_supp_kmp_api_create_indication(kmp_api_t *kmp, kmp_type_e typ } // Incoming KMP protocol has started, no longer runs trickle timer for re-sending EAPOL-key message - pae_supp->auth_trickle_running = false; + pae_supp->gtk_update_trickle_running = false; + pae_supp->initial_key_retry_timer = 0; // For now, accept every KMP-CREATE.indication kmp_api_create_response(kmp, KMP_RESULT_OK); @@ -1258,6 +1237,19 @@ static bool ws_pae_supp_kmp_api_finished_indication(kmp_api_t *kmp, kmp_result_e // Continues with trickle but selects different parent pae_supp->tx_failure_on_initial_key = true; } + + } else if ((type == IEEE_802_1X_MKA || type == IEEE_802_11_4WH || type == IEEE_802_11_GKH) && result != KMP_RESULT_OK) { + + if (!pae_supp->auth_requested && ws_pae_supp_gtk_hash_mismatch_check(pae_supp) < 0) { + // Start trickle timer + ws_pae_supp_initial_key_update_trickle_timer_start(pae_supp, KEY_UPDATE_RETRY_COUNT); + + // Starts supplicant timer + ws_pae_supp_timer_start(pae_supp); + + tr_info("GTK update re-start imin: %i, imax: %i, max mismatch: %i, tr time: %i", pae_supp->sec_cfg->timer_cfg.gtk_request_imin, pae_supp->sec_cfg->timer_cfg.gtk_request_imax, pae_supp->sec_cfg->timer_cfg.gtk_max_mismatch, pae_supp->gtk_req_trickle_timer.t); + } + } return false; diff --git a/source/6LoWPAN/ws/ws_pae_supp.h b/source/6LoWPAN/ws/ws_pae_supp.h index 0642872896..1ccd78c21e 100644 --- a/source/6LoWPAN/ws/ws_pae_supp.h +++ b/source/6LoWPAN/ws/ws_pae_supp.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/ws/ws_pae_time.c b/source/6LoWPAN/ws/ws_pae_time.c index a962b9415d..55a3e8b5c6 100644 --- a/source/6LoWPAN/ws/ws_pae_time.c +++ b/source/6LoWPAN/ws/ws_pae_time.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Arm Limited and affiliates. + * Copyright (c) 2020-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -25,6 +25,7 @@ #include "6LoWPAN/ws/ws_pae_time.h" #include "Security/protocols/sec_prot_certs.h" #include "Security/protocols/sec_prot_keys.h" +#include "Service_Libs/utils/ns_time.h" #ifdef HAVE_WS @@ -34,7 +35,6 @@ #define CURRENT_TIME_INIT_VALUE 1577836800 static uint64_t current_time = CURRENT_TIME_INIT_VALUE; -static ns_time_api_system_time_callback *system_time_callback = NULL; uint16_t ws_pae_time_to_short_convert(uint32_t time) { @@ -148,8 +148,9 @@ int8_t ws_pae_time_diff_calc(uint64_t curr_time, uint64_t comp_time, uint32_t *t uint64_t ws_pae_current_time_get(void) { - if (system_time_callback) { - return system_time_callback(); + uint64_t new_time; + if (ns_time_system_time_read(&new_time) == 0) { + return new_time; } return current_time; @@ -162,15 +163,15 @@ void ws_pae_current_time_update(uint16_t seconds) int8_t ws_pae_current_time_set(uint64_t time) { + uint64_t new_system_time; current_time = time; tr_debug("Current time set: %"PRIi64, time); - if (system_time_callback) { - uint64_t system_time = system_time_callback(); + if (ns_time_system_time_read(&new_system_time) == 0) { // System time has gone backwards - if (system_time < current_time || system_time > current_time + SYSTEM_TIME_MAXIMUM_DIFF) { - tr_error("FATAL: system time less than reference time or more than 12 months in future: %"PRIi64" reference time: %"PRIi64, system_time, current_time); + if (new_system_time < current_time || new_system_time > current_time + SYSTEM_TIME_MAXIMUM_DIFF) { + tr_error("FATAL: system time less than reference time or more than 12 months in future: %"PRIi64" reference time: %"PRIi64, new_system_time, current_time); return -1; } } @@ -178,10 +179,5 @@ int8_t ws_pae_current_time_set(uint64_t time) return 0; } -void ns_time_api_system_time_callback_set(ns_time_api_system_time_callback callback) -{ - system_time_callback = callback; -} - #endif /* HAVE_WS */ diff --git a/source/6LoWPAN/ws/ws_pae_time.h b/source/6LoWPAN/ws/ws_pae_time.h index 12655e2c2a..41f77ef9fe 100644 --- a/source/6LoWPAN/ws/ws_pae_time.h +++ b/source/6LoWPAN/ws/ws_pae_time.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Arm Limited and affiliates. + * Copyright (c) 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/ws/ws_pae_timers.c b/source/6LoWPAN/ws/ws_pae_timers.c index fb1abbe275..735917102b 100644 --- a/source/6LoWPAN/ws/ws_pae_timers.c +++ b/source/6LoWPAN/ws/ws_pae_timers.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/ws/ws_pae_timers.h b/source/6LoWPAN/ws/ws_pae_timers.h index 57fceb97cb..ba8fe1141f 100644 --- a/source/6LoWPAN/ws/ws_pae_timers.h +++ b/source/6LoWPAN/ws/ws_pae_timers.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Arm Limited and affiliates. + * Copyright (c) 2019-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/ws/ws_stats.c b/source/6LoWPAN/ws/ws_stats.c index a6e794e4b5..d2351c6e34 100644 --- a/source/6LoWPAN/ws/ws_stats.c +++ b/source/6LoWPAN/ws/ws_stats.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2019, 2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/ws/ws_stats.h b/source/6LoWPAN/ws/ws_stats.h index 5a315556f8..2d7dd93882 100644 --- a/source/6LoWPAN/ws/ws_stats.h +++ b/source/6LoWPAN/ws/ws_stats.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2019, 2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/6LoWPAN/ws/ws_test_api.c b/source/6LoWPAN/ws/ws_test_api.c index 682bbf7dd1..9dd322a752 100644 --- a/source/6LoWPAN/ws/ws_test_api.c +++ b/source/6LoWPAN/ws/ws_test_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/BorderRouter/border_router.c b/source/BorderRouter/border_router.c index dd12919d02..02836da0d8 100644 --- a/source/BorderRouter/border_router.c +++ b/source/BorderRouter/border_router.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2018, Arm Limited and affiliates. + * Copyright (c) 2012-2018, 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/BorderRouter/border_router.h b/source/BorderRouter/border_router.h index f8bbaba7a6..e693fbc302 100644 --- a/source/BorderRouter/border_router.h +++ b/source/BorderRouter/border_router.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017, Arm Limited and affiliates. + * Copyright (c) 2015, 2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Common_Protocols/icmpv6.c b/source/Common_Protocols/icmpv6.c index ba9bb0b684..b3721de742 100644 --- a/source/Common_Protocols/icmpv6.c +++ b/source/Common_Protocols/icmpv6.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2019, Arm Limited and affiliates. + * Copyright (c) 2013-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Common_Protocols/icmpv6.h b/source/Common_Protocols/icmpv6.h index 1e70594554..14eaf1941c 100644 --- a/source/Common_Protocols/icmpv6.h +++ b/source/Common_Protocols/icmpv6.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2018, Arm Limited and affiliates. + * Copyright (c) 2013-2018, 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Common_Protocols/icmpv6_prefix.c b/source/Common_Protocols/icmpv6_prefix.c index 2c63ddd7b2..62c7602b70 100644 --- a/source/Common_Protocols/icmpv6_prefix.c +++ b/source/Common_Protocols/icmpv6_prefix.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2017, 2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Common_Protocols/icmpv6_prefix.h b/source/Common_Protocols/icmpv6_prefix.h index 81baeb0887..ae7f365d04 100644 --- a/source/Common_Protocols/icmpv6_prefix.h +++ b/source/Common_Protocols/icmpv6_prefix.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Common_Protocols/icmpv6_radv.c b/source/Common_Protocols/icmpv6_radv.c index 446d05f38e..9ad0544322 100644 --- a/source/Common_Protocols/icmpv6_radv.c +++ b/source/Common_Protocols/icmpv6_radv.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Common_Protocols/icmpv6_radv.h b/source/Common_Protocols/icmpv6_radv.h index c526bdc441..2d6035a5c0 100644 --- a/source/Common_Protocols/icmpv6_radv.h +++ b/source/Common_Protocols/icmpv6_radv.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2015, 2017, Arm Limited and affiliates. + * Copyright (c) 2014-2015, 2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Common_Protocols/ip.h b/source/Common_Protocols/ip.h index 110ddd4b28..1007fb6d6f 100644 --- a/source/Common_Protocols/ip.h +++ b/source/Common_Protocols/ip.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017, Arm Limited and affiliates. + * Copyright (c) 2015, 2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Common_Protocols/ipv6.c b/source/Common_Protocols/ipv6.c index 045e6c471c..161845b7c1 100644 --- a/source/Common_Protocols/ipv6.c +++ b/source/Common_Protocols/ipv6.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2019, Arm Limited and affiliates. + * Copyright (c) 2013-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Common_Protocols/ipv6.h b/source/Common_Protocols/ipv6.h index 0927891c59..8890d9448f 100644 --- a/source/Common_Protocols/ipv6.h +++ b/source/Common_Protocols/ipv6.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2017, Arm Limited and affiliates. + * Copyright (c) 2013-2017, 2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Common_Protocols/ipv6_constants.h b/source/Common_Protocols/ipv6_constants.h index fec095738c..524e97e4c1 100644 --- a/source/Common_Protocols/ipv6_constants.h +++ b/source/Common_Protocols/ipv6_constants.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2017, Arm Limited and affiliates. + * Copyright (c) 2013-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Common_Protocols/ipv6_flow.c b/source/Common_Protocols/ipv6_flow.c index 60e1657881..574b8094a9 100644 --- a/source/Common_Protocols/ipv6_flow.c +++ b/source/Common_Protocols/ipv6_flow.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Common_Protocols/ipv6_flow.h b/source/Common_Protocols/ipv6_flow.h index 88edccfce4..34c9fd7179 100644 --- a/source/Common_Protocols/ipv6_flow.h +++ b/source/Common_Protocols/ipv6_flow.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017, Arm Limited and affiliates. + * Copyright (c) 2016-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Common_Protocols/ipv6_fragmentation.c b/source/Common_Protocols/ipv6_fragmentation.c index 1386b398ea..9fcec3e379 100644 --- a/source/Common_Protocols/ipv6_fragmentation.c +++ b/source/Common_Protocols/ipv6_fragmentation.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2019, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Common_Protocols/ipv6_fragmentation.h b/source/Common_Protocols/ipv6_fragmentation.h index 7adbe0148f..1ef642b64f 100644 --- a/source/Common_Protocols/ipv6_fragmentation.h +++ b/source/Common_Protocols/ipv6_fragmentation.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Common_Protocols/ipv6_resolution.c b/source/Common_Protocols/ipv6_resolution.c index 790b226b8a..20294caeac 100644 --- a/source/Common_Protocols/ipv6_resolution.c +++ b/source/Common_Protocols/ipv6_resolution.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2019, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Common_Protocols/ipv6_resolution.h b/source/Common_Protocols/ipv6_resolution.h index 63b6d4b5bc..34b204c895 100644 --- a/source/Common_Protocols/ipv6_resolution.h +++ b/source/Common_Protocols/ipv6_resolution.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, 2019, Arm Limited and affiliates. + * Copyright (c) 2015-2017, 2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Common_Protocols/mld.c b/source/Common_Protocols/mld.c index 9a90d66da0..dddfe0baa7 100644 --- a/source/Common_Protocols/mld.c +++ b/source/Common_Protocols/mld.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017, Arm Limited and affiliates. + * Copyright (c) 2016-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Common_Protocols/mld.h b/source/Common_Protocols/mld.h index 2661dea68d..aa12ba17bd 100644 --- a/source/Common_Protocols/mld.h +++ b/source/Common_Protocols/mld.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017, Arm Limited and affiliates. + * Copyright (c) 2016-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Common_Protocols/tcp.c b/source/Common_Protocols/tcp.c index 2a0b6d498a..18d25146b4 100644 --- a/source/Common_Protocols/tcp.c +++ b/source/Common_Protocols/tcp.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2019, Arm Limited and affiliates. + * Copyright (c) 2013-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Common_Protocols/tcp.h b/source/Common_Protocols/tcp.h index dbe0cb345c..cfd4cc5b40 100644 --- a/source/Common_Protocols/tcp.h +++ b/source/Common_Protocols/tcp.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2017, Arm Limited and affiliates. + * Copyright (c) 2013-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Common_Protocols/udp.c b/source/Common_Protocols/udp.c index 0159f450d1..0be6e0a1da 100644 --- a/source/Common_Protocols/udp.c +++ b/source/Common_Protocols/udp.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2017, 2019, Arm Limited and affiliates. + * Copyright (c) 2013-2017, 2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Common_Protocols/udp.h b/source/Common_Protocols/udp.h index f32a42a0f5..c45a1d3bb6 100644 --- a/source/Common_Protocols/udp.h +++ b/source/Common_Protocols/udp.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2017, Arm Limited and affiliates. + * Copyright (c) 2013-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Core/buffer_dyn.c b/source/Core/buffer_dyn.c index 268ee815ab..89fbd44b9f 100644 --- a/source/Core/buffer_dyn.c +++ b/source/Core/buffer_dyn.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2019, Arm Limited and affiliates. + * Copyright (c) 2011-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Core/include/ns_address_internal.h b/source/Core/include/ns_address_internal.h index 79bf398b70..cc4398ad9e 100644 --- a/source/Core/include/ns_address_internal.h +++ b/source/Core/include/ns_address_internal.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2010-2019, Arm Limited and affiliates. + * Copyright (c) 2008, 2010-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Core/include/ns_buffer.h b/source/Core/include/ns_buffer.h index 42defbc3cd..c24749407c 100644 --- a/source/Core/include/ns_buffer.h +++ b/source/Core/include/ns_buffer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2019, Arm Limited and affiliates. + * Copyright (c) 2008-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -218,6 +218,7 @@ typedef struct buffer { bool rpl_instance_known: 1; bool ip_routed_up: 1; uint8_t rpl_flag_error; + uint32_t adaptation_timestamp; /*!< Timestamp when buffer pushed to adaptation interface. Unit 100ms */ //uint8_t bc_sending_superframe; /*FHSS uses this randomly chosen superframe to send this packet (if broadcast)*/ //uint8_t fhss_channel_retries_left; //uint8_t ip_transmission_prev_seq; /*!< XXX: this stores the data packet seq. number, which is needed for re-transmission. */ diff --git a/source/Core/include/ns_error_types.h b/source/Core/include/ns_error_types.h index 31d15d3f32..a43af9dfe6 100644 --- a/source/Core/include/ns_error_types.h +++ b/source/Core/include/ns_error_types.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2015, 2017, Arm Limited and affiliates. + * Copyright (c) 2014-2015, 2017, 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Core/include/ns_monitor.h b/source/Core/include/ns_monitor.h index 867cff47fc..13724dcfe0 100644 --- a/source/Core/include/ns_monitor.h +++ b/source/Core/include/ns_monitor.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Arm Limited and affiliates. + * Copyright (c) 2019-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Core/include/ns_socket.h b/source/Core/include/ns_socket.h index 4af22a4249..ba5d1b6286 100644 --- a/source/Core/include/ns_socket.h +++ b/source/Core/include/ns_socket.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2017, 2019, Arm Limited and affiliates. + * Copyright (c) 2008-2017, 2019-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Core/include/sockbuf.h b/source/Core/include/sockbuf.h index b02d00bf9f..6e5d802701 100644 --- a/source/Core/include/sockbuf.h +++ b/source/Core/include/sockbuf.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017, Arm Limited and affiliates. + * Copyright (c) 2016-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Core/ns_address_internal.c b/source/Core/ns_address_internal.c index 6131df7a01..c7c69d2d39 100644 --- a/source/Core/ns_address_internal.c +++ b/source/Core/ns_address_internal.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2010-2019, Arm Limited and affiliates. + * Copyright (c) 2008, 2010-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Core/ns_monitor.c b/source/Core/ns_monitor.c index 83c4d3512c..ca20e3f496 100644 --- a/source/Core/ns_monitor.c +++ b/source/Core/ns_monitor.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Arm Limited and affiliates. + * Copyright (c) 2019-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Core/ns_socket.c b/source/Core/ns_socket.c index 60b5c96b75..77dade5ccf 100644 --- a/source/Core/ns_socket.c +++ b/source/Core/ns_socket.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2015, 2017-2019, Arm Limited and affiliates. + * Copyright (c) 2008-2015, 2017-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Core/sockbuf.c b/source/Core/sockbuf.c index 80e1bdd1da..fa459182ee 100644 --- a/source/Core/sockbuf.c +++ b/source/Core/sockbuf.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/DHCPv6_Server/DHCPv6_Server_service.c b/source/DHCPv6_Server/DHCPv6_Server_service.c index 7443f30507..790d7e6064 100644 --- a/source/DHCPv6_Server/DHCPv6_Server_service.c +++ b/source/DHCPv6_Server/DHCPv6_Server_service.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -88,36 +88,32 @@ static void DHCP_server_service_timer_stop(void) int DHCPv6_server_respond_client(dhcpv6_gua_server_entry_s *serverBase, dhcpv6_reply_packet_s *replyPacket, dhcp_ia_non_temporal_params_t *dhcp_ia_non_temporal_params, dhcpv6_gua_response_t *response, bool allocateNew) { dhcpv6_allocated_address_t *dhcp_allocated_address = NULL; - dhcpv6_ia_non_temporal_address_s nonTemporalAddress; - bool address_allocated = false; //Validate Client DUID dhcp_link_options_params_t clientDUID; + if (libdhcpv6_get_link_address_from_duid(replyPacket->clientDUID.duid, replyPacket->clientDUID.duid_length, replyPacket->clientDUID.type, &clientDUID) == 0) { dhcp_allocated_address = libdhcpv6_address_allocate(serverBase, clientDUID.link_id, clientDUID.link_type, dhcp_ia_non_temporal_params->iaId, dhcp_ia_non_temporal_params->T0, dhcp_ia_non_temporal_params->T1, allocateNew); } if (dhcp_allocated_address) { - address_allocated = true; - nonTemporalAddress.requestedAddress = dhcp_allocated_address->nonTemporalAddress; - nonTemporalAddress.validLifeTime = dhcp_allocated_address->lifetime; - nonTemporalAddress.preferredLifeTime = dhcp_allocated_address->preferredLifetime; - if (serverBase->addCb) { dhcp_address_cache_update_t update_info; update_info.allocatedAddress = dhcp_allocated_address->nonTemporalAddress; update_info.allocatedNewAddress = allocateNew; - update_info.validLifeTime = nonTemporalAddress.validLifeTime; + update_info.validLifeTime = dhcp_allocated_address->lifetime; if (!serverBase->addCb(serverBase->interfaceId, &update_info, serverBase->guaPrefix)) { - address_allocated = false; libdhcpv6_address_delete(serverBase, dhcp_allocated_address->nonTemporalAddress); + dhcp_allocated_address = NULL; } } } - response->responseLength = libdhcpv6_address_reply_message_len(replyPacket->clientDUID.duid_length, replyPacket->serverDUID.duid_length, 0, replyPacket->rapidCommit, address_allocated); + response->responseLength = libdhcpv6_address_reply_message_len(replyPacket->clientDUID.duid_length, replyPacket->serverDUID.duid_length, 0, replyPacket->rapidCommit, (dhcp_allocated_address != NULL)); //Calculate DNS LIST and Vendor data lengths here - response->responseLength += libdhcpv6_dns_server_message_sizes(serverBase); - response->responseLength += libdhcpv6_vendor_data_message_sizes(serverBase); + if (dhcp_allocated_address) { + response->responseLength += libdhcpv6_dns_server_message_sizes(serverBase); + response->responseLength += libdhcpv6_vendor_data_message_sizes(serverBase); + } response->responsePtr = ns_dyn_mem_temporary_alloc(response->responseLength); if (response->responsePtr) { @@ -126,9 +122,9 @@ int DHCPv6_server_respond_client(dhcpv6_gua_server_entry_s *serverBase, dhcpv6_r ptr = libdhcpv6_header_write(ptr, DHCPV6_REPLY_TYPE, replyPacket->transaction_ID); ptr = libdhcpv6_duid_option_write(ptr, DHCPV6_SERVER_ID_OPTION, &replyPacket->serverDUID); //16 ptr = libdhcpv6_duid_option_write(ptr, DHCPV6_CLIENT_ID_OPTION, &replyPacket->clientDUID); //16 - if (address_allocated) { + if (dhcp_allocated_address) { ptr = libdhcpv6_identity_association_option_write(ptr, replyPacket->iaId, replyPacket->T0, replyPacket->T1, true); - ptr = libdhcpv6_ia_address_option_write(ptr, nonTemporalAddress.requestedAddress, nonTemporalAddress.preferredLifeTime, nonTemporalAddress.validLifeTime); + ptr = libdhcpv6_ia_address_option_write(ptr, dhcp_allocated_address->nonTemporalAddress, dhcp_allocated_address->preferredLifetime, dhcp_allocated_address->lifetime); //Write DNS LIST and Vendor data here ptr = libdhcpv6_dns_server_message_writes(serverBase, ptr); ptr = libdhcpv6_vendor_data_message_writes(serverBase, ptr); @@ -468,7 +464,7 @@ int DHCPv6_server_service_set_dns_server(int8_t interface, uint8_t guaPrefix[sta return 0; } -int DHCPv6_server_service_set_vendor_data(int8_t interface, uint8_t guaPrefix[static 16], uint32_t enterprise_number, uint8_t *dhcp_vendor_data_ptr, uint8_t dhcp_vendor_data_len) +int DHCPv6_server_service_set_vendor_data(int8_t interface, uint8_t guaPrefix[static 16], uint32_t enterprise_number, uint8_t *dhcp_vendor_data_ptr, uint16_t dhcp_vendor_data_len) { dhcpv6_gua_server_entry_s *serverInfo = libdhcpv6_server_data_get_by_prefix_and_interfaceid(interface, guaPrefix); if (!serverInfo) { @@ -500,6 +496,21 @@ int DHCPv6_server_service_set_vendor_data(int8_t interface, uint8_t guaPrefix[st return 0; } +int DHCPv6_server_service_set_vendor_data_callback(int8_t interface, uint8_t guaPrefix[static 16], uint32_t enterprise_number, dhcp_vendor_data_cb *vendor_data_cb) +{ + dhcpv6_gua_server_entry_s *serverInfo = libdhcpv6_server_data_get_by_prefix_and_interfaceid(interface, guaPrefix); + if (!serverInfo) { + return -1; + } + + dhcpv6_vendor_data_t *vendor_data_entry = libdhcpv6_vendor_data_allocate(serverInfo, enterprise_number); + + if (!vendor_data_entry) { + return -1; + } + vendor_data_entry->vendor_data_cb = vendor_data_cb; + return 0; +} #else int DHCPv6_server_service_init(int8_t interface, uint8_t guaPrefix[static 16], uint8_t serverDUID[static 8], uint16_t serverDUIDType) diff --git a/source/DHCPv6_Server/DHCPv6_server_service.h b/source/DHCPv6_Server/DHCPv6_server_service.h index 5a9fb86949..e222807209 100644 --- a/source/DHCPv6_Server/DHCPv6_server_service.h +++ b/source/DHCPv6_Server/DHCPv6_server_service.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -98,7 +98,9 @@ int DHCPv6_server_service_set_address_validlifetime(int8_t interface, uint8_t gu int DHCPv6_server_service_set_dns_server(int8_t interface, uint8_t guaPrefix[static 16], uint8_t dns_server_address[static 16], uint8_t *dns_search_list_ptr, uint8_t dns_search_list_len); -int DHCPv6_server_service_set_vendor_data(int8_t interface, uint8_t guaPrefix[static 16], uint32_t enterprise_number, uint8_t *dhcp_vendor_data_ptr, uint8_t dhcp_vendor_data_len); +int DHCPv6_server_service_set_vendor_data(int8_t interface, uint8_t guaPrefix[static 16], uint32_t enterprise_number, uint8_t *dhcp_vendor_data_ptr, uint16_t dhcp_vendor_data_len); + +int DHCPv6_server_service_set_vendor_data_callback(int8_t interface, uint8_t guaPrefix[static 16], uint32_t enterprise_number, dhcp_vendor_data_cb *vendor_data_cb); #else #define DHCPv6_server_service_delete(interface, guaPrefix, delete_gua_addresses) diff --git a/source/DHCPv6_client/dhcpv6_client_api.h b/source/DHCPv6_client/dhcpv6_client_api.h index b7429c6125..26e87d530e 100644 --- a/source/DHCPv6_client/dhcpv6_client_api.h +++ b/source/DHCPv6_client/dhcpv6_client_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -51,8 +51,9 @@ void dhcp_client_configure(int8_t interface, bool renew_uses_solicit, bool one_c * /param timeout SOLICIT timeout initial value. 0 means use defaults * /param max_rt SOLICIT timeout max value. * /param max_rc SOLICIT re-transmission count. 0 means infinite. + * /param max_delay Max delay of first Solicit */ -void dhcp_client_solicit_timeout_set(int8_t interface, uint16_t timeout, uint16_t max_rt, uint8_t max_rc); +void dhcp_client_solicit_timeout_set(int8_t interface, uint16_t timeout, uint16_t max_rt, uint8_t max_rc, uint8_t max_delay); /* Delete dhcp client. * @@ -83,6 +84,7 @@ typedef struct dhcp_server_notify_info { uint16_t duid_type; uint16_t duid_length; uint32_t life_time; + uint32_t rtt; // Round trip time with 100ms tics. uint8_t *duid; } dhcp_server_notify_info_t; diff --git a/source/DHCPv6_client/dhcpv6_client_service.c b/source/DHCPv6_client/dhcpv6_client_service.c index 758ce3977b..15b2dbe4cc 100644 --- a/source/DHCPv6_client/dhcpv6_client_service.c +++ b/source/DHCPv6_client/dhcpv6_client_service.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -20,6 +20,7 @@ #include #include #include "nsdynmemLIB.h" +#include "randLIB.h" #include "ns_list.h" #include "common_functions.h" @@ -36,6 +37,7 @@ typedef struct { dhcp_client_options_notify_cb *option_information_cb; uint16_t service_instance; uint16_t relay_instance; + uint16_t sol_max_delay; uint16_t sol_timeout; uint16_t sol_max_rt; uint8_t sol_max_rc; @@ -104,6 +106,7 @@ void dhcp_client_init(int8_t interface, uint16_t link_type) dhcp_client->sol_timeout = 0; dhcp_client->sol_max_rt = 0; dhcp_client->sol_max_rc = 0; + dhcp_client->sol_max_delay = 0; dhcp_client->renew_uses_solicit = false; dhcp_client->one_instance_interface = false; dhcp_client->no_address_hint = false; @@ -139,13 +142,14 @@ void dhcp_client_configure(int8_t interface, bool renew_uses_solicit, bool one_c dhcp_client->no_address_hint = no_address_hint; } -void dhcp_client_solicit_timeout_set(int8_t interface, uint16_t timeout, uint16_t max_rt, uint8_t max_rc) +void dhcp_client_solicit_timeout_set(int8_t interface, uint16_t timeout, uint16_t max_rt, uint8_t max_rc, uint8_t max_delay) { // Set the default retry values for SOLICIT and RENEW messages. dhcp_client_class_t *dhcp_client = dhcpv6_client_entry_discover(interface); if (!dhcp_client) { return; } + dhcp_client->sol_max_delay = max_delay * 10; //Convert to ticks dhcp_client->sol_timeout = timeout; dhcp_client->sol_max_rt = max_rt; dhcp_client->sol_max_rc = max_rc; @@ -237,7 +241,7 @@ void dhcpv6_client_send_error_cb(dhcpv6_client_server_data_t *srv_data_ptr) } -static void dhcp_vendor_information_notify(uint8_t *ptr, uint16_t data_len, dhcp_client_class_t *dhcp_client, dhcpv6_client_server_data_t *srv_data_ptr) +static void dhcp_vendor_information_notify(uint8_t *ptr, uint16_t data_len, dhcp_client_class_t *dhcp_client, dhcpv6_client_server_data_t *srv_data_ptr, uint32_t message_rtt) { if (!dhcp_client->option_information_cb) { return; @@ -257,6 +261,8 @@ static void dhcp_vendor_information_notify(uint8_t *ptr, uint16_t data_len, dhcp server_info.duid = srv_data_ptr->serverDUID.duid + 2; // Skip the type server_info.duid_type = srv_data_ptr->serverDUID.type; server_info.duid_length = srv_data_ptr->serverDUID.duid_length - 2;// remove the type + server_info.rtt = message_rtt; + while (data_len >= 4) { type = common_read_16_bit(ptr); @@ -305,6 +311,7 @@ int dhcp_solicit_resp_cb(uint16_t instance_id, void *ptr, uint8_t msg_name, uin dhcp_duid_options_params_t clientId; dhcp_duid_options_params_t serverId; dhcpv6_client_server_data_t *srv_data_ptr = NULL; + uint32_t message_rtt; (void)instance_id; //Validate that started TR ID class is still at list @@ -323,6 +330,8 @@ int dhcp_solicit_resp_cb(uint16_t instance_id, void *ptr, uint8_t msg_name, uin } + message_rtt = dhcp_service_rtt_get(srv_data_ptr->transActionId); + //Clear Active Transaction state srv_data_ptr->transActionId = 0; @@ -395,7 +404,7 @@ int dhcp_solicit_resp_cb(uint16_t instance_id, void *ptr, uint8_t msg_name, uin } //Optional Options notify from Reply - dhcp_vendor_information_notify(msg_ptr, msg_len, dhcp_client, srv_data_ptr); + dhcp_vendor_information_notify(msg_ptr, msg_len, dhcp_client, srv_data_ptr, message_rtt); return RET_MSG_ACCEPTED; error_exit: @@ -498,8 +507,12 @@ dhcp_address_get: libdhcpv6_generic_nontemporal_address_message_write(payload_ptr, &solPacket, NULL, NULL); } + uint16_t delay_tx = 0; + if (dhcp_client->sol_max_delay) { + delay_tx = randLIB_get_random_in_range(0, dhcp_client->sol_max_delay); + } // send solicit - srv_data_ptr->transActionId = dhcp_service_send_req(dhcp_client->service_instance, 0, srv_data_ptr, dhcp_addr, payload_ptr, payload_len, dhcp_solicit_resp_cb); + srv_data_ptr->transActionId = dhcp_service_send_req(dhcp_client->service_instance, 0, srv_data_ptr, dhcp_addr, payload_ptr, payload_len, dhcp_solicit_resp_cb, delay_tx); if (srv_data_ptr->transActionId == 0) { ns_dyn_mem_free(payload_ptr); libdhcvp6_nontemporalAddress_server_data_free(srv_data_ptr); @@ -657,7 +670,7 @@ void dhcpv6_renew(protocol_interface_info_entry_t *interface, if_address_entry_t server_address = srv_data_ptr->server_address; } - srv_data_ptr->transActionId = dhcp_service_send_req(dhcp_client->service_instance, 0, srv_data_ptr, server_address, payload_ptr, payload_len, dhcp_solicit_resp_cb); + srv_data_ptr->transActionId = dhcp_service_send_req(dhcp_client->service_instance, 0, srv_data_ptr, server_address, payload_ptr, payload_len, dhcp_solicit_resp_cb, 0); if (srv_data_ptr->transActionId == 0) { ns_dyn_mem_free(payload_ptr); if (addr) { diff --git a/source/MAC/IEEE802_15_4/mac_cca_threshold.c b/source/MAC/IEEE802_15_4/mac_cca_threshold.c index ffb40f16bf..1b3a94253b 100644 --- a/source/MAC/IEEE802_15_4/mac_cca_threshold.c +++ b/source/MAC/IEEE802_15_4/mac_cca_threshold.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Arm Limited and affiliates. + * Copyright (c) 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/MAC/IEEE802_15_4/mac_cca_threshold.h b/source/MAC/IEEE802_15_4/mac_cca_threshold.h index 6e0da89bd0..ac1bb8b999 100644 --- a/source/MAC/IEEE802_15_4/mac_cca_threshold.h +++ b/source/MAC/IEEE802_15_4/mac_cca_threshold.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Arm Limited and affiliates. + * Copyright (c) 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/MAC/IEEE802_15_4/mac_data_buffer.h b/source/MAC/IEEE802_15_4/mac_data_buffer.h index ec694540da..a76016cb4d 100644 --- a/source/MAC/IEEE802_15_4/mac_data_buffer.h +++ b/source/MAC/IEEE802_15_4/mac_data_buffer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Arm Limited and affiliates. + * Copyright (c) 2019-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -100,6 +100,7 @@ typedef struct mac_pre_build_frame { uint16_t blacklist_period_ms; uint16_t initial_tx_channel; uint32_t tx_time; + uint32_t request_start_time_us; bool upper_layer_request: 1; bool mac_allocated_payload_ptr: 1; bool asynch_request: 1; diff --git a/source/MAC/IEEE802_15_4/mac_defines.h b/source/MAC/IEEE802_15_4/mac_defines.h index c13c708e08..c55b5085f4 100644 --- a/source/MAC/IEEE802_15_4/mac_defines.h +++ b/source/MAC/IEEE802_15_4/mac_defines.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019, Arm Limited and affiliates. + * Copyright (c) 2014-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/MAC/IEEE802_15_4/mac_fhss_callbacks.c b/source/MAC/IEEE802_15_4/mac_fhss_callbacks.c index 8925c5ae4a..3770c3f944 100644 --- a/source/MAC/IEEE802_15_4/mac_fhss_callbacks.c +++ b/source/MAC/IEEE802_15_4/mac_fhss_callbacks.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2018, 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/MAC/IEEE802_15_4/mac_fhss_callbacks.h b/source/MAC/IEEE802_15_4/mac_fhss_callbacks.h index 744e7c2485..b5132a265b 100644 --- a/source/MAC/IEEE802_15_4/mac_fhss_callbacks.h +++ b/source/MAC/IEEE802_15_4/mac_fhss_callbacks.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/MAC/IEEE802_15_4/mac_filter.c b/source/MAC/IEEE802_15_4/mac_filter.c index a1a3ea9472..6475ddfd66 100644 --- a/source/MAC/IEEE802_15_4/mac_filter.c +++ b/source/MAC/IEEE802_15_4/mac_filter.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/MAC/IEEE802_15_4/mac_filter.h b/source/MAC/IEEE802_15_4/mac_filter.h index 2df4e901cd..7224750471 100644 --- a/source/MAC/IEEE802_15_4/mac_filter.h +++ b/source/MAC/IEEE802_15_4/mac_filter.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/MAC/IEEE802_15_4/mac_header_helper_functions.c b/source/MAC/IEEE802_15_4/mac_header_helper_functions.c index 65f6e05f6b..001b258cf5 100644 --- a/source/MAC/IEEE802_15_4/mac_header_helper_functions.c +++ b/source/MAC/IEEE802_15_4/mac_header_helper_functions.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/MAC/IEEE802_15_4/mac_header_helper_functions.h b/source/MAC/IEEE802_15_4/mac_header_helper_functions.h index ce3d10d2a5..fa7bc0550c 100644 --- a/source/MAC/IEEE802_15_4/mac_header_helper_functions.h +++ b/source/MAC/IEEE802_15_4/mac_header_helper_functions.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/MAC/IEEE802_15_4/mac_indirect_data.c b/source/MAC/IEEE802_15_4/mac_indirect_data.c index 51af386bdd..c4d1a6f736 100644 --- a/source/MAC/IEEE802_15_4/mac_indirect_data.c +++ b/source/MAC/IEEE802_15_4/mac_indirect_data.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/MAC/IEEE802_15_4/mac_indirect_data.h b/source/MAC/IEEE802_15_4/mac_indirect_data.h index 3f78932a34..d27338f1bc 100644 --- a/source/MAC/IEEE802_15_4/mac_indirect_data.h +++ b/source/MAC/IEEE802_15_4/mac_indirect_data.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/MAC/IEEE802_15_4/mac_mcps_sap.c b/source/MAC/IEEE802_15_4/mac_mcps_sap.c index 9d65c24e6f..6e952174f4 100644 --- a/source/MAC/IEEE802_15_4/mac_mcps_sap.c +++ b/source/MAC/IEEE802_15_4/mac_mcps_sap.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019, Arm Limited and affiliates. + * Copyright (c) 2014-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -56,6 +56,8 @@ // Used to set TX time (us) with FHSS. Must be <= 65ms. #define MAC_TX_PROCESSING_DELAY_INITIAL 2000 +// Give up on data request after given timeout (seconds) +#define DATA_REQUEST_TIMEOUT_NORMAL_PRIORITY_S 10 typedef struct { uint8_t address[8]; @@ -275,7 +277,7 @@ void mcps_sap_data_req_handler_ext(protocol_interface_rf_mac_setup_s *rf_mac_set } break; case MAC_DATA_HIGH_PRIORITY: - buffer->priority = MAC_PD_DATA_HIGH_PRIOTITY; + buffer->priority = MAC_PD_DATA_HIGH_PRIORITY; break; case MAC_DATA_MEDIUM_PRIORITY: buffer->priority = MAC_PD_DATA_MEDIUM_PRIORITY; @@ -383,6 +385,8 @@ void mcps_sap_data_req_handler_ext(protocol_interface_rf_mac_setup_s *rf_mac_set buffer->tx_request_restart_cnt = rf_mac_setup->tx_failure_restart_max; //check that header + payload length is not bigger than MAC MTU + buffer->request_start_time_us = mac_mcps_sap_get_phy_timestamp(rf_mac_setup); + if (data_req->InDirectTx) { mac_indirect_queue_write(rf_mac_setup, buffer); } else { @@ -1100,6 +1104,17 @@ static void mac_mcps_asynch_finish(protocol_interface_rf_mac_setup_s *rf_mac_set } } +static bool mcps_sap_check_buffer_timeout(protocol_interface_rf_mac_setup_s *rf_mac_setup, mac_pre_build_frame_t *buffer) +{ + // Convert from 1us slots to seconds + uint32_t buffer_age_s = (mac_mcps_sap_get_phy_timestamp(rf_mac_setup) - buffer->request_start_time_us) / 1000000; + // Do not timeout broadcast frames. Broadcast interval could be very long. + if (buffer->fcf_dsn.ackRequested && (buffer_age_s > DATA_REQUEST_TIMEOUT_NORMAL_PRIORITY_S)) { + return true; + } + return false; +} + void mac_mcps_trig_buffer_from_queue(protocol_interface_rf_mac_setup_s *rf_mac_setup) { if (!rf_mac_setup) { @@ -1119,22 +1134,31 @@ void mac_mcps_trig_buffer_from_queue(protocol_interface_rf_mac_setup_s *rf_mac_s buffer = mcps_sap_pd_req_queue_read(rf_mac_setup, is_bc_queue, false); if (buffer) { - //Here - if (buffer->ExtendedFrameExchange) { - //Update here state and store peer - memcpy(rf_mac_setup->mac_edfe_info->PeerAddr, buffer->DstAddr, 8); - rf_mac_setup->mac_edfe_info->state = MAC_EDFE_FRAME_CONNECTING; - } - rf_mac_setup->active_pd_data_request = buffer; - if (mcps_pd_data_request(rf_mac_setup, buffer) != 0) { + if (mcps_sap_check_buffer_timeout(rf_mac_setup, buffer)) { + // Buffer is quite old. Return it to adaptation layer with timeout event. + rf_mac_setup->mac_tx_result = MAC_TX_TIMEOUT; if (buffer->ExtendedFrameExchange) { rf_mac_setup->mac_edfe_info->state = MAC_EDFE_FRAME_IDLE; } - rf_mac_setup->active_pd_data_request = NULL; mac_mcps_asynch_finish(rf_mac_setup, buffer); mcps_data_confirm_handle(rf_mac_setup, buffer, NULL); } else { - return; + if (buffer->ExtendedFrameExchange) { + //Update here state and store peer + memcpy(rf_mac_setup->mac_edfe_info->PeerAddr, buffer->DstAddr, 8); + rf_mac_setup->mac_edfe_info->state = MAC_EDFE_FRAME_CONNECTING; + } + rf_mac_setup->active_pd_data_request = buffer; + if (mcps_pd_data_request(rf_mac_setup, buffer) != 0) { + if (buffer->ExtendedFrameExchange) { + rf_mac_setup->mac_edfe_info->state = MAC_EDFE_FRAME_IDLE; + } + rf_mac_setup->active_pd_data_request = NULL; + mac_mcps_asynch_finish(rf_mac_setup, buffer); + mcps_data_confirm_handle(rf_mac_setup, buffer, NULL); + } else { + return; + } } } else { return; @@ -1434,12 +1458,6 @@ static void mac_common_data_confirmation_handle(protocol_interface_rf_mac_setup_ } else if (m_event == MAC_TX_DONE_PENDING) { buf->status = MLME_SUCCESS; } else if (m_event == MAC_TX_TIMEOUT) { - /* Make MAC Soft Reset */; - tr_debug("Driver TO event"); - //Disable allways - mac_mlme_mac_radio_disabled(rf_mac_setup); - //Enable Radio - mac_mlme_mac_radio_enable(rf_mac_setup); buf->status = MLME_TRANSACTION_EXPIRED; } else if (m_event == MAC_UNKNOWN_DESTINATION) { buf->status = MLME_UNAVAILABLE_KEY; @@ -1630,6 +1648,11 @@ static void mcps_data_confirm_handle(protocol_interface_rf_mac_setup_s *rf_ptr, confirm.timestamp = 0; } + if (buffer->fcf_dsn.ackRequested) { + // Update latency for unicast packets. Given as milliseconds. + sw_mac_stats_update(rf_ptr, STAT_MAC_TX_LATENCY, ((mac_mcps_sap_get_phy_timestamp(rf_ptr) - buffer->request_start_time_us) + 500) / 1000); + } + if (buffer->upper_layer_request) { //Check tunnel mcps_sap_prebuild_frame_buffer_free(buffer); @@ -2430,10 +2453,16 @@ static mac_pre_build_frame_t *mcps_sap_pd_req_queue_read(protocol_interface_rf_m mac_pre_build_frame_t *buffer = queue; mac_pre_build_frame_t *prev = NULL; - // With FHSS, check TX conditions + /* With FHSS, read buffer out from queue if: + * - Buffer has timed out, OR + * - Buffer is asynch request, OR + * - Queue is flushed, OR + * - Blacklisting AND FHSS allows buffer to be transmitted + */ if (rf_mac_setup->fhss_api) { while (buffer) { - if (buffer->asynch_request || + if (mcps_sap_check_buffer_timeout(rf_mac_setup, buffer) || + buffer->asynch_request || (flush == true) || ((mcps_check_packet_blacklist(rf_mac_setup, buffer) == false) && (rf_mac_setup->fhss_api->check_tx_conditions(rf_mac_setup->fhss_api, !mac_is_ack_request_set(buffer), diff --git a/source/MAC/IEEE802_15_4/mac_mcps_sap.h b/source/MAC/IEEE802_15_4/mac_mcps_sap.h index d79343546e..94247d58b8 100644 --- a/source/MAC/IEEE802_15_4/mac_mcps_sap.h +++ b/source/MAC/IEEE802_15_4/mac_mcps_sap.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -48,7 +48,7 @@ typedef enum { #define MAC_PD_DATA_NORMAL_PRIORITY 0 //Normal MCPS DATA REQ #define MAC_PD_DATA_MEDIUM_PRIORITY 1 //Indirect Data which is polled -#define MAC_PD_DATA_HIGH_PRIOTITY 2 //Beacon request Beacon response +#define MAC_PD_DATA_HIGH_PRIORITY 2 //Beacon request Beacon response #define MAC_PD_DATA_EF_PRIORITY 3 //Expedited forwarding #define MAC_PD_DATA_TX_IMMEDIATELY 4 //Only for packets whose transmission was interrupted by wrong channel type. E.g. unicast on broadcast channel. diff --git a/source/MAC/IEEE802_15_4/mac_mlme.c b/source/MAC/IEEE802_15_4/mac_mlme.c index c6c0d01cc4..9d39b35202 100644 --- a/source/MAC/IEEE802_15_4/mac_mlme.c +++ b/source/MAC/IEEE802_15_4/mac_mlme.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2019, Arm Limited and affiliates. + * Copyright (c) 2013-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -1837,7 +1837,7 @@ int8_t mac_mlme_beacon_tx(protocol_interface_rf_mac_setup_s *rf_ptr) ptr += BEACON_OPTION_JOIN_PRIORITY_LEN; }*/ } - buf->priority = MAC_PD_DATA_HIGH_PRIOTITY; + buf->priority = MAC_PD_DATA_HIGH_PRIORITY; mcps_sap_pd_req_queue_write(rf_ptr, buf); sw_mac_stats_update(rf_ptr, STAT_MAC_BEA_TX_COUNT, 0); return 0; diff --git a/source/MAC/IEEE802_15_4/mac_mlme.h b/source/MAC/IEEE802_15_4/mac_mlme.h index 2cf6a79a70..f436a5cceb 100644 --- a/source/MAC/IEEE802_15_4/mac_mlme.h +++ b/source/MAC/IEEE802_15_4/mac_mlme.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/MAC/IEEE802_15_4/mac_pd_sap.c b/source/MAC/IEEE802_15_4/mac_pd_sap.c index 2a61f10ee9..da3b6b7a53 100644 --- a/source/MAC/IEEE802_15_4/mac_pd_sap.c +++ b/source/MAC/IEEE802_15_4/mac_pd_sap.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/MAC/IEEE802_15_4/mac_pd_sap.h b/source/MAC/IEEE802_15_4/mac_pd_sap.h index 396e92bc7f..730c9b0e3e 100644 --- a/source/MAC/IEEE802_15_4/mac_pd_sap.h +++ b/source/MAC/IEEE802_15_4/mac_pd_sap.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/MAC/IEEE802_15_4/mac_security_mib.c b/source/MAC/IEEE802_15_4/mac_security_mib.c index ed06964ab5..13d2032a99 100644 --- a/source/MAC/IEEE802_15_4/mac_security_mib.c +++ b/source/MAC/IEEE802_15_4/mac_security_mib.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/MAC/IEEE802_15_4/mac_security_mib.h b/source/MAC/IEEE802_15_4/mac_security_mib.h index 150d8ea64a..84fb3ad131 100644 --- a/source/MAC/IEEE802_15_4/mac_security_mib.h +++ b/source/MAC/IEEE802_15_4/mac_security_mib.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/MAC/IEEE802_15_4/mac_timer.c b/source/MAC/IEEE802_15_4/mac_timer.c index a14aeaff2f..764cd25a73 100644 --- a/source/MAC/IEEE802_15_4/mac_timer.c +++ b/source/MAC/IEEE802_15_4/mac_timer.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/MAC/IEEE802_15_4/mac_timer.h b/source/MAC/IEEE802_15_4/mac_timer.h index d4f6958cda..aa0bee3efd 100644 --- a/source/MAC/IEEE802_15_4/mac_timer.h +++ b/source/MAC/IEEE802_15_4/mac_timer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/MAC/IEEE802_15_4/sw_mac.c b/source/MAC/IEEE802_15_4/sw_mac.c index 7e287ee514..675eda3b5c 100644 --- a/source/MAC/IEEE802_15_4/sw_mac.c +++ b/source/MAC/IEEE802_15_4/sw_mac.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -765,6 +765,11 @@ void sw_mac_stats_update(protocol_interface_rf_mac_setup_s *setup, mac_stats_typ case STAT_MAC_TX_CCA_FAIL: setup->mac_statistics->mac_failed_cca_count++; break; + case STAT_MAC_TX_LATENCY: + if (update_val > setup->mac_statistics->mac_tx_latency_max) { + setup->mac_statistics->mac_tx_latency_max = update_val; + } + break; } } } diff --git a/source/MAC/IEEE802_15_4/sw_mac_internal.h b/source/MAC/IEEE802_15_4/sw_mac_internal.h index b661c9628c..ecac04c7ff 100644 --- a/source/MAC/IEEE802_15_4/sw_mac_internal.h +++ b/source/MAC/IEEE802_15_4/sw_mac_internal.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017, Arm Limited and affiliates. + * Copyright (c) 2016-2017, 2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -35,6 +35,7 @@ typedef enum { STAT_MAC_TX_RETRY, STAT_MAC_TX_CCA_ATT, STAT_MAC_TX_CCA_FAIL, + STAT_MAC_TX_LATENCY } mac_stats_type_t; typedef enum arm_nwk_timer_id { diff --git a/source/MAC/ethernet/ethernet_mac_api.c b/source/MAC/ethernet/ethernet_mac_api.c index fb4d9d2176..6bf5fdba5b 100644 --- a/source/MAC/ethernet/ethernet_mac_api.c +++ b/source/MAC/ethernet/ethernet_mac_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/MAC/rf_driver_storage.c b/source/MAC/rf_driver_storage.c index 6257406c3e..8033dbddc6 100644 --- a/source/MAC/rf_driver_storage.c +++ b/source/MAC/rf_driver_storage.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/MAC/rf_driver_storage.h b/source/MAC/rf_driver_storage.h index d9a82d9531..c0c451b8ab 100644 --- a/source/MAC/rf_driver_storage.h +++ b/source/MAC/rf_driver_storage.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/MAC/serial/serial_mac_api.c b/source/MAC/serial/serial_mac_api.c index b3ffa24bea..295848de30 100644 --- a/source/MAC/serial/serial_mac_api.c +++ b/source/MAC/serial/serial_mac_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/MAC/virtual_rf/virtual_rf_client.c b/source/MAC/virtual_rf/virtual_rf_client.c index 81395991f3..9afa782b5a 100644 --- a/source/MAC/virtual_rf/virtual_rf_client.c +++ b/source/MAC/virtual_rf/virtual_rf_client.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/MAC/virtual_rf/virtual_rf_defines.h b/source/MAC/virtual_rf/virtual_rf_defines.h index 01919dabcc..dc38ccd15f 100644 --- a/source/MAC/virtual_rf/virtual_rf_defines.h +++ b/source/MAC/virtual_rf/virtual_rf_defines.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017, Arm Limited and affiliates. + * Copyright (c) 2016-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/MAC/virtual_rf/virtual_rf_driver.c b/source/MAC/virtual_rf/virtual_rf_driver.c index 78e8b9ef2c..0f3503fcb9 100644 --- a/source/MAC/virtual_rf/virtual_rf_driver.c +++ b/source/MAC/virtual_rf/virtual_rf_driver.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/MLE/mle.c b/source/MLE/mle.c index 8c24f6b0b1..4e2d0a876d 100644 --- a/source/MLE/mle.c +++ b/source/MLE/mle.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2019, Arm Limited and affiliates. + * Copyright (c) 2013-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/MLE/mle.h b/source/MLE/mle.h index 7d4389b433..0302886aa1 100644 --- a/source/MLE/mle.h +++ b/source/MLE/mle.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2019, Arm Limited and affiliates. + * Copyright (c) 2013-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/MLE/mle_tlv.c b/source/MLE/mle_tlv.c index 284fb435ff..d878ca9b80 100644 --- a/source/MLE/mle_tlv.c +++ b/source/MLE/mle_tlv.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/MLE/mle_tlv.h b/source/MLE/mle_tlv.h index f7a3829baf..9ccf872138 100644 --- a/source/MLE/mle_tlv.h +++ b/source/MLE/mle_tlv.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/MPL/mpl.c b/source/MPL/mpl.c index 1ab5b21cf1..face25a0f3 100644 --- a/source/MPL/mpl.c +++ b/source/MPL/mpl.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/MPL/mpl.h b/source/MPL/mpl.h index d5cd8152e4..557fd48459 100644 --- a/source/MPL/mpl.h +++ b/source/MPL/mpl.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/NWK_INTERFACE/Include/protocol.h b/source/NWK_INTERFACE/Include/protocol.h index 0ca9c30a65..a3a845ffba 100644 --- a/source/NWK_INTERFACE/Include/protocol.h +++ b/source/NWK_INTERFACE/Include/protocol.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019, Arm Limited and affiliates. + * Copyright (c) 2014-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/NWK_INTERFACE/Include/protocol_abstract.h b/source/NWK_INTERFACE/Include/protocol_abstract.h index 78aa552c38..f59ca2bf9e 100644 --- a/source/NWK_INTERFACE/Include/protocol_abstract.h +++ b/source/NWK_INTERFACE/Include/protocol_abstract.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/NWK_INTERFACE/Include/protocol_stats.h b/source/NWK_INTERFACE/Include/protocol_stats.h index 193a9538e9..0bf2e01f59 100644 --- a/source/NWK_INTERFACE/Include/protocol_stats.h +++ b/source/NWK_INTERFACE/Include/protocol_stats.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, 2019-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -45,7 +45,8 @@ typedef enum { STATS_ETX_1ST_PARENT, STATS_ETX_2ND_PARENT, STATS_AL_TX_QUEUE_SIZE, - STATS_AL_TX_CONGESTION_DROP + STATS_AL_TX_CONGESTION_DROP, + STATS_AL_TX_LATENCY } nwk_stats_type_t; diff --git a/source/NWK_INTERFACE/Include/protocol_timer.h b/source/NWK_INTERFACE/Include/protocol_timer.h index 2af1e35591..630770c244 100644 --- a/source/NWK_INTERFACE/Include/protocol_timer.h +++ b/source/NWK_INTERFACE/Include/protocol_timer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/NWK_INTERFACE/protocol_core.c b/source/NWK_INTERFACE/protocol_core.c index 45f0c41384..cab954193b 100644 --- a/source/NWK_INTERFACE/protocol_core.c +++ b/source/NWK_INTERFACE/protocol_core.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019, Arm Limited and affiliates. + * Copyright (c) 2014-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/NWK_INTERFACE/protocol_core_sleep.c b/source/NWK_INTERFACE/protocol_core_sleep.c index bc11ad738b..a0a1acbfe3 100644 --- a/source/NWK_INTERFACE/protocol_core_sleep.c +++ b/source/NWK_INTERFACE/protocol_core_sleep.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/NWK_INTERFACE/protocol_stats.c b/source/NWK_INTERFACE/protocol_stats.c index 074dc07951..6fecc591f0 100644 --- a/source/NWK_INTERFACE/protocol_stats.c +++ b/source/NWK_INTERFACE/protocol_stats.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, 2019-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -155,6 +155,11 @@ void protocol_stats_update(nwk_stats_type_t type, uint16_t update_val) case STATS_AL_TX_CONGESTION_DROP: nwk_stats_ptr->adapt_layer_tx_congestion_drop++; break; + case STATS_AL_TX_LATENCY: + if (update_val > nwk_stats_ptr->adapt_layer_tx_latency_max) { + nwk_stats_ptr->adapt_layer_tx_latency_max = update_val; + } + break; } } } diff --git a/source/NWK_INTERFACE/protocol_timer.c b/source/NWK_INTERFACE/protocol_timer.c index 6997849ee7..0c518ecf5d 100644 --- a/source/NWK_INTERFACE/protocol_timer.c +++ b/source/NWK_INTERFACE/protocol_timer.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/RPL/rpl_control.c b/source/RPL/rpl_control.c index 522d85107a..282eea4f6e 100644 --- a/source/RPL/rpl_control.c +++ b/source/RPL/rpl_control.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2019, Arm Limited and affiliates. + * Copyright (c) 2015-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/RPL/rpl_control.h b/source/RPL/rpl_control.h index e13f552a09..e5381afefd 100644 --- a/source/RPL/rpl_control.h +++ b/source/RPL/rpl_control.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2019, Arm Limited and affiliates. + * Copyright (c) 2015-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/RPL/rpl_data.c b/source/RPL/rpl_data.c index 099192a107..f94057e5e6 100644 --- a/source/RPL/rpl_data.c +++ b/source/RPL/rpl_data.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2018, 2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -351,8 +351,9 @@ static buffer_t *rpl_data_exthdr_provider_hbh_2(buffer_t *buf, rpl_instance_t *i // size because of the LL addresses used on the outer header, so // this is an unconditional change. Exception remains for local // DODAGs, where the destination address must be the DODAGID. - if (addr_ipv6_equal(route_info->next_hop_addr, buf->dst_sa.address) || (!rpl_policy_force_tunnel() && - addr_ipv6_equal(buf->dst_sa.address, dodag->id))) { + const uint8_t *ip_dest = buf->route->ip_dest ? buf->route->ip_dest : buf->dst_sa.address; + if (addr_ipv6_equal(route_info->next_hop_addr, ip_dest) || (!rpl_policy_force_tunnel() && + addr_ipv6_equal(ip_dest, dodag->id))) { destination_in_instance = true; if (buf->rpl_option) { @@ -997,7 +998,7 @@ static buffer_t *rpl_data_exthdr_provider_srh(buffer_t *buf, ipv6_exthdr_stage_t * (RFC 6554 4.1). When not tunnelling, we include all hops regardless, * which means the final destination is there as needed. */ - srh_info = rpl_data_sr_compute_header_size(final_rpl_dest, buf->options.tunnelled && buf->options.type == IPV6_NH_IPV6 ? buf->options.hop_limit : 0xFF); + srh_info = rpl_data_sr_compute_header_size(final_rpl_dest, buf->options.tunnelled ? buf->options.hop_limit : 0xFF); if (!srh_info) { /* No source routing header required - this must be because it's one hop. */ /* In this case, we do need to add a HbH option header */ @@ -1033,6 +1034,7 @@ static buffer_t *rpl_data_exthdr_provider_srh(buffer_t *buf, ipv6_exthdr_stage_t if (final_rpl_dest != buf->dst_sa.address) { memcpy(buf->dst_sa.address, final_rpl_dest, 16); } + buf->route->ip_dest = rpl_data_sr_next_hop(); *result = IPV6_EXTHDR_MODIFY_TUNNEL; buf->src_sa.addr_type = ADDR_NONE; // force auto-selection return buf; diff --git a/source/RPL/rpl_data.h b/source/RPL/rpl_data.h index 694106ff4e..4fa5635f27 100644 --- a/source/RPL/rpl_data.h +++ b/source/RPL/rpl_data.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/RPL/rpl_downward.c b/source/RPL/rpl_downward.c index 4b7fe15dd2..984c24953e 100644 --- a/source/RPL/rpl_downward.c +++ b/source/RPL/rpl_downward.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2019, Arm Limited and affiliates. + * Copyright (c) 2015-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/RPL/rpl_downward.h b/source/RPL/rpl_downward.h index 73cceeb856..73ec79aa8c 100644 --- a/source/RPL/rpl_downward.h +++ b/source/RPL/rpl_downward.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/RPL/rpl_mrhof.c b/source/RPL/rpl_mrhof.c index be3fd9a822..248838953f 100644 --- a/source/RPL/rpl_mrhof.c +++ b/source/RPL/rpl_mrhof.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/RPL/rpl_mrhof.h b/source/RPL/rpl_mrhof.h index e38d7c101a..42ac7d7efb 100644 --- a/source/RPL/rpl_mrhof.h +++ b/source/RPL/rpl_mrhof.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017, Arm Limited and affiliates. + * Copyright (c) 2015, 2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/RPL/rpl_objective.c b/source/RPL/rpl_objective.c index 5ffa3ab924..4a5948cf54 100644 --- a/source/RPL/rpl_objective.c +++ b/source/RPL/rpl_objective.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/RPL/rpl_objective.h b/source/RPL/rpl_objective.h index 7e8293a396..1d3bc66fda 100644 --- a/source/RPL/rpl_objective.h +++ b/source/RPL/rpl_objective.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017-2018, Arm Limited and affiliates. + * Copyright (c) 2015, 2017-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/RPL/rpl_of0.c b/source/RPL/rpl_of0.c index bfdee2a496..49df857330 100644 --- a/source/RPL/rpl_of0.c +++ b/source/RPL/rpl_of0.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/RPL/rpl_of0.h b/source/RPL/rpl_of0.h index 6e7db0a6f8..0f09658bab 100644 --- a/source/RPL/rpl_of0.h +++ b/source/RPL/rpl_of0.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017, Arm Limited and affiliates. + * Copyright (c) 2015, 2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/RPL/rpl_policy.c b/source/RPL/rpl_policy.c index 11a6737597..5f669c591c 100644 --- a/source/RPL/rpl_policy.c +++ b/source/RPL/rpl_policy.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2019, Arm Limited and affiliates. + * Copyright (c) 2015-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/RPL/rpl_policy.h b/source/RPL/rpl_policy.h index 91e4917587..b80e0e9f2a 100644 --- a/source/RPL/rpl_policy.h +++ b/source/RPL/rpl_policy.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, 2019, Arm Limited and affiliates. + * Copyright (c) 2015-2017, 2019-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/RPL/rpl_protocol.h b/source/RPL/rpl_protocol.h index 27d3b83703..bb6ac92126 100644 --- a/source/RPL/rpl_protocol.h +++ b/source/RPL/rpl_protocol.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017, Arm Limited and affiliates. + * Copyright (c) 2015, 2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/RPL/rpl_structures.h b/source/RPL/rpl_structures.h index 837d0fa9ab..0adeaacbf9 100644 --- a/source/RPL/rpl_structures.h +++ b/source/RPL/rpl_structures.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/RPL/rpl_upward.c b/source/RPL/rpl_upward.c index 496313a08a..283dff2b9c 100644 --- a/source/RPL/rpl_upward.c +++ b/source/RPL/rpl_upward.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2019, Arm Limited and affiliates. + * Copyright (c) 2015-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -533,6 +533,9 @@ bool rpl_neighbour_update_dtsn(rpl_neighbour_t *neighbour, uint8_t dtsn) rpl_instance_t *rpl_neighbour_instance(const rpl_neighbour_t *neighbour) { + if (!neighbour || !neighbour->dodag_version || !neighbour->dodag_version->dodag) { + return NULL; + } return neighbour->dodag_version->dodag->instance; } diff --git a/source/RPL/rpl_upward.h b/source/RPL/rpl_upward.h index b3b51b38bc..3a3cb183c2 100644 --- a/source/RPL/rpl_upward.h +++ b/source/RPL/rpl_upward.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2019, Arm Limited and affiliates. + * Copyright (c) 2015-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/Common/sec_lib.h b/source/Security/Common/sec_lib.h index a1601e7fcc..6091457380 100644 --- a/source/Security/Common/sec_lib.h +++ b/source/Security/Common/sec_lib.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2018, Arm Limited and affiliates. + * Copyright (c) 2013-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/Common/sec_lib_definitions.h b/source/Security/Common/sec_lib_definitions.h index d52883e19c..5eb91a74c1 100644 --- a/source/Security/Common/sec_lib_definitions.h +++ b/source/Security/Common/sec_lib_definitions.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/Common/security_lib.c b/source/Security/Common/security_lib.c index a48616a086..4d2c58d02b 100644 --- a/source/Security/Common/security_lib.c +++ b/source/Security/Common/security_lib.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2019, Arm Limited and affiliates. + * Copyright (c) 2013-2019, 2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/PANA/eap_protocol.c b/source/Security/PANA/eap_protocol.c index 8de694d335..33bd7c7229 100644 --- a/source/Security/PANA/eap_protocol.c +++ b/source/Security/PANA/eap_protocol.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019, Arm Limited and affiliates. + * Copyright (c) 2017-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/PANA/eap_protocol.h b/source/Security/PANA/eap_protocol.h index 93e1405161..1faa5e55bc 100644 --- a/source/Security/PANA/eap_protocol.h +++ b/source/Security/PANA/eap_protocol.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Arm Limited and affiliates. + * Copyright (c) 2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/PANA/pana.c b/source/Security/PANA/pana.c index f09eca992b..c46d14898a 100644 --- a/source/Security/PANA/pana.c +++ b/source/Security/PANA/pana.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2019, Arm Limited and affiliates. + * Copyright (c) 2013-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/PANA/pana.h b/source/Security/PANA/pana.h index a8b3f37256..7e463052dc 100644 --- a/source/Security/PANA/pana.h +++ b/source/Security/PANA/pana.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2018, Arm Limited and affiliates. + * Copyright (c) 2013-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/PANA/pana_avp.c b/source/Security/PANA/pana_avp.c index f9f32dbaa8..16d0b15167 100644 --- a/source/Security/PANA/pana_avp.c +++ b/source/Security/PANA/pana_avp.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018, Arm Limited and affiliates. + * Copyright (c) 2017-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/PANA/pana_avp.h b/source/Security/PANA/pana_avp.h index 5ee046c929..0603a95be5 100644 --- a/source/Security/PANA/pana_avp.h +++ b/source/Security/PANA/pana_avp.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018, Arm Limited and affiliates. + * Copyright (c) 2017-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/PANA/pana_client.c b/source/Security/PANA/pana_client.c index d724e28539..8947f0f446 100644 --- a/source/Security/PANA/pana_client.c +++ b/source/Security/PANA/pana_client.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019, Arm Limited and affiliates. + * Copyright (c) 2017-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/PANA/pana_eap_header.c b/source/Security/PANA/pana_eap_header.c index 8d9ae32728..9c32471cc9 100644 --- a/source/Security/PANA/pana_eap_header.c +++ b/source/Security/PANA/pana_eap_header.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019, Arm Limited and affiliates. + * Copyright (c) 2017-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/PANA/pana_eap_header.h b/source/Security/PANA/pana_eap_header.h index 2498134433..96113c3d98 100644 --- a/source/Security/PANA/pana_eap_header.h +++ b/source/Security/PANA/pana_eap_header.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019, Arm Limited and affiliates. + * Copyright (c) 2017-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/PANA/pana_header.c b/source/Security/PANA/pana_header.c index fc3135db43..31341301a3 100644 --- a/source/Security/PANA/pana_header.c +++ b/source/Security/PANA/pana_header.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Arm Limited and affiliates. + * Copyright (c) 2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/PANA/pana_header.h b/source/Security/PANA/pana_header.h index c70c6d4092..bf50b35da5 100644 --- a/source/Security/PANA/pana_header.h +++ b/source/Security/PANA/pana_header.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Arm Limited and affiliates. + * Copyright (c) 2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/PANA/pana_internal_api.h b/source/Security/PANA/pana_internal_api.h index 927f7ee18a..2ebaed41dd 100644 --- a/source/Security/PANA/pana_internal_api.h +++ b/source/Security/PANA/pana_internal_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/PANA/pana_nvm.h b/source/Security/PANA/pana_nvm.h index 325acd6b0e..341114c2c9 100644 --- a/source/Security/PANA/pana_nvm.h +++ b/source/Security/PANA/pana_nvm.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2015, 2017, Arm Limited and affiliates. + * Copyright (c) 2014-2015, 2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/PANA/pana_relay_table.c b/source/Security/PANA/pana_relay_table.c index 355aad1a4c..4dc6f07bdb 100644 --- a/source/Security/PANA/pana_relay_table.c +++ b/source/Security/PANA/pana_relay_table.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2017, Arm Limited and affiliates. + * Copyright (c) 2013-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/PANA/pana_relay_table.h b/source/Security/PANA/pana_relay_table.h index 23c9f075ca..6a1356c06f 100644 --- a/source/Security/PANA/pana_relay_table.h +++ b/source/Security/PANA/pana_relay_table.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2015, 2017, Arm Limited and affiliates. + * Copyright (c) 2013-2015, 2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/PANA/pana_server.c b/source/Security/PANA/pana_server.c index 092b4ad59c..354ca5f6b1 100644 --- a/source/Security/PANA/pana_server.c +++ b/source/Security/PANA/pana_server.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019, Arm Limited and affiliates. + * Copyright (c) 2017-2019, 2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/TLS/tls_ccm_crypt.c b/source/Security/TLS/tls_ccm_crypt.c index 8c98b7bde0..ce0cf3679d 100644 --- a/source/Security/TLS/tls_ccm_crypt.c +++ b/source/Security/TLS/tls_ccm_crypt.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018, Arm Limited and affiliates. + * Copyright (c) 2017-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/TLS/tls_ccm_crypt.h b/source/Security/TLS/tls_ccm_crypt.h index b82de08207..6ef1aff07e 100644 --- a/source/Security/TLS/tls_ccm_crypt.h +++ b/source/Security/TLS/tls_ccm_crypt.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018, Arm Limited and affiliates. + * Copyright (c) 2017-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/TLS/tls_lib.c b/source/Security/TLS/tls_lib.c index dcd4f8e53f..aa70856c18 100644 --- a/source/Security/TLS/tls_lib.c +++ b/source/Security/TLS/tls_lib.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2019, Arm Limited and affiliates. + * Copyright (c) 2013-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/TLS/tls_lib.h b/source/Security/TLS/tls_lib.h index c369e20635..a26aa4ff2d 100644 --- a/source/Security/TLS/tls_lib.h +++ b/source/Security/TLS/tls_lib.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2018, Arm Limited and affiliates. + * Copyright (c) 2013-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/eapol/eapol_helper.c b/source/Security/eapol/eapol_helper.c index 03d2afcb8a..b2c009fc4a 100644 --- a/source/Security/eapol/eapol_helper.c +++ b/source/Security/eapol/eapol_helper.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/eapol/eapol_helper.h b/source/Security/eapol/eapol_helper.h index d7fc8d5fe0..0454c122a9 100644 --- a/source/Security/eapol/eapol_helper.h +++ b/source/Security/eapol/eapol_helper.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/eapol/kde_helper.c b/source/Security/eapol/kde_helper.c index 13be8926ce..aa27d248e4 100644 --- a/source/Security/eapol/kde_helper.c +++ b/source/Security/eapol/kde_helper.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/eapol/kde_helper.h b/source/Security/eapol/kde_helper.h index b735828e61..153e86f365 100644 --- a/source/Security/eapol/kde_helper.h +++ b/source/Security/eapol/kde_helper.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/kmp/kmp_addr.c b/source/Security/kmp/kmp_addr.c index a09ab4ea74..facc28d1f3 100644 --- a/source/Security/kmp/kmp_addr.c +++ b/source/Security/kmp/kmp_addr.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/kmp/kmp_addr.h b/source/Security/kmp/kmp_addr.h index 43b549a77c..9873b9ede1 100644 --- a/source/Security/kmp/kmp_addr.h +++ b/source/Security/kmp/kmp_addr.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/kmp/kmp_api.c b/source/Security/kmp/kmp_api.c index 296f76362d..d7f114c5fe 100644 --- a/source/Security/kmp/kmp_api.c +++ b/source/Security/kmp/kmp_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/kmp/kmp_api.h b/source/Security/kmp/kmp_api.h index 3c880de292..5a5ae0ee20 100644 --- a/source/Security/kmp/kmp_api.h +++ b/source/Security/kmp/kmp_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -33,6 +33,7 @@ typedef enum { IEEE_802_1X_MKA = 1, RADIUS_IEEE_802_1X_MKA = 2, + MSG_PROT = 5, IEEE_802_11_4WH = 6, IEEE_802_11_GKH = 7, TLS_PROT = 8, diff --git a/source/Security/kmp/kmp_eapol_pdu_if.c b/source/Security/kmp/kmp_eapol_pdu_if.c index afcae84571..a51bb2e98f 100644 --- a/source/Security/kmp/kmp_eapol_pdu_if.c +++ b/source/Security/kmp/kmp_eapol_pdu_if.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/kmp/kmp_eapol_pdu_if.h b/source/Security/kmp/kmp_eapol_pdu_if.h index eaad14b075..294079bb43 100644 --- a/source/Security/kmp/kmp_eapol_pdu_if.h +++ b/source/Security/kmp/kmp_eapol_pdu_if.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/kmp/kmp_socket_if.c b/source/Security/kmp/kmp_socket_if.c index 6197e4304d..f586b90a9d 100644 --- a/source/Security/kmp/kmp_socket_if.c +++ b/source/Security/kmp/kmp_socket_if.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/kmp/kmp_socket_if.h b/source/Security/kmp/kmp_socket_if.h index 20a55c8f45..4d30260b67 100644 --- a/source/Security/kmp/kmp_socket_if.h +++ b/source/Security/kmp/kmp_socket_if.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/protocols/eap_tls_sec_prot/auth_eap_tls_sec_prot.c b/source/Security/protocols/eap_tls_sec_prot/auth_eap_tls_sec_prot.c index 122cfe4e02..4f1d3a725b 100644 --- a/source/Security/protocols/eap_tls_sec_prot/auth_eap_tls_sec_prot.c +++ b/source/Security/protocols/eap_tls_sec_prot/auth_eap_tls_sec_prot.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Arm Limited and affiliates. + * Copyright (c) 2019-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/protocols/eap_tls_sec_prot/auth_eap_tls_sec_prot.h b/source/Security/protocols/eap_tls_sec_prot/auth_eap_tls_sec_prot.h index 8c3e1185b9..b3c9c792a9 100644 --- a/source/Security/protocols/eap_tls_sec_prot/auth_eap_tls_sec_prot.h +++ b/source/Security/protocols/eap_tls_sec_prot/auth_eap_tls_sec_prot.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Arm Limited and affiliates. + * Copyright (c) 2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/protocols/eap_tls_sec_prot/eap_tls_sec_prot_lib.c b/source/Security/protocols/eap_tls_sec_prot/eap_tls_sec_prot_lib.c index 9592059724..34f79d3906 100644 --- a/source/Security/protocols/eap_tls_sec_prot/eap_tls_sec_prot_lib.c +++ b/source/Security/protocols/eap_tls_sec_prot/eap_tls_sec_prot_lib.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Arm Limited and affiliates. + * Copyright (c) 2019-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/protocols/eap_tls_sec_prot/eap_tls_sec_prot_lib.h b/source/Security/protocols/eap_tls_sec_prot/eap_tls_sec_prot_lib.h index 6af3687869..a645e21b63 100644 --- a/source/Security/protocols/eap_tls_sec_prot/eap_tls_sec_prot_lib.h +++ b/source/Security/protocols/eap_tls_sec_prot/eap_tls_sec_prot_lib.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Arm Limited and affiliates. + * Copyright (c) 2019-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/protocols/eap_tls_sec_prot/radius_eap_tls_sec_prot.c b/source/Security/protocols/eap_tls_sec_prot/radius_eap_tls_sec_prot.c index b37cdf028a..09944249d9 100644 --- a/source/Security/protocols/eap_tls_sec_prot/radius_eap_tls_sec_prot.c +++ b/source/Security/protocols/eap_tls_sec_prot/radius_eap_tls_sec_prot.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Arm Limited and affiliates. + * Copyright (c) 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/protocols/eap_tls_sec_prot/radius_eap_tls_sec_prot.h b/source/Security/protocols/eap_tls_sec_prot/radius_eap_tls_sec_prot.h index 03f510985f..5e2b2e19b1 100644 --- a/source/Security/protocols/eap_tls_sec_prot/radius_eap_tls_sec_prot.h +++ b/source/Security/protocols/eap_tls_sec_prot/radius_eap_tls_sec_prot.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Arm Limited and affiliates. + * Copyright (c) 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/protocols/eap_tls_sec_prot/supp_eap_tls_sec_prot.c b/source/Security/protocols/eap_tls_sec_prot/supp_eap_tls_sec_prot.c index 3384716879..aa296c39d1 100644 --- a/source/Security/protocols/eap_tls_sec_prot/supp_eap_tls_sec_prot.c +++ b/source/Security/protocols/eap_tls_sec_prot/supp_eap_tls_sec_prot.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Arm Limited and affiliates. + * Copyright (c) 2019-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/protocols/eap_tls_sec_prot/supp_eap_tls_sec_prot.h b/source/Security/protocols/eap_tls_sec_prot/supp_eap_tls_sec_prot.h index 78ececd7bc..30dfcda048 100644 --- a/source/Security/protocols/eap_tls_sec_prot/supp_eap_tls_sec_prot.h +++ b/source/Security/protocols/eap_tls_sec_prot/supp_eap_tls_sec_prot.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Arm Limited and affiliates. + * Copyright (c) 2019-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/protocols/fwh_sec_prot/auth_fwh_sec_prot.c b/source/Security/protocols/fwh_sec_prot/auth_fwh_sec_prot.c index ec89a9a09e..8138fe8ed4 100644 --- a/source/Security/protocols/fwh_sec_prot/auth_fwh_sec_prot.c +++ b/source/Security/protocols/fwh_sec_prot/auth_fwh_sec_prot.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/protocols/fwh_sec_prot/auth_fwh_sec_prot.h b/source/Security/protocols/fwh_sec_prot/auth_fwh_sec_prot.h index 67b96a41e0..beda6df752 100644 --- a/source/Security/protocols/fwh_sec_prot/auth_fwh_sec_prot.h +++ b/source/Security/protocols/fwh_sec_prot/auth_fwh_sec_prot.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/protocols/fwh_sec_prot/supp_fwh_sec_prot.c b/source/Security/protocols/fwh_sec_prot/supp_fwh_sec_prot.c index a1074f7ec2..84e91e61ca 100644 --- a/source/Security/protocols/fwh_sec_prot/supp_fwh_sec_prot.c +++ b/source/Security/protocols/fwh_sec_prot/supp_fwh_sec_prot.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/protocols/fwh_sec_prot/supp_fwh_sec_prot.h b/source/Security/protocols/fwh_sec_prot/supp_fwh_sec_prot.h index 2cb2284e3c..0335b5713d 100644 --- a/source/Security/protocols/fwh_sec_prot/supp_fwh_sec_prot.h +++ b/source/Security/protocols/fwh_sec_prot/supp_fwh_sec_prot.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/protocols/gkh_sec_prot/auth_gkh_sec_prot.c b/source/Security/protocols/gkh_sec_prot/auth_gkh_sec_prot.c index 4424b55a2c..b01d60c824 100644 --- a/source/Security/protocols/gkh_sec_prot/auth_gkh_sec_prot.c +++ b/source/Security/protocols/gkh_sec_prot/auth_gkh_sec_prot.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/protocols/gkh_sec_prot/auth_gkh_sec_prot.h b/source/Security/protocols/gkh_sec_prot/auth_gkh_sec_prot.h index daf09a4c3b..341a2c8be9 100644 --- a/source/Security/protocols/gkh_sec_prot/auth_gkh_sec_prot.h +++ b/source/Security/protocols/gkh_sec_prot/auth_gkh_sec_prot.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/protocols/gkh_sec_prot/supp_gkh_sec_prot.c b/source/Security/protocols/gkh_sec_prot/supp_gkh_sec_prot.c index 064f2bec76..a836e5870b 100644 --- a/source/Security/protocols/gkh_sec_prot/supp_gkh_sec_prot.c +++ b/source/Security/protocols/gkh_sec_prot/supp_gkh_sec_prot.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/protocols/gkh_sec_prot/supp_gkh_sec_prot.h b/source/Security/protocols/gkh_sec_prot/supp_gkh_sec_prot.h index a8832db62f..d1ba7d378d 100644 --- a/source/Security/protocols/gkh_sec_prot/supp_gkh_sec_prot.h +++ b/source/Security/protocols/gkh_sec_prot/supp_gkh_sec_prot.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/protocols/key_sec_prot/key_sec_prot.c b/source/Security/protocols/key_sec_prot/key_sec_prot.c index 6467839c46..540ed35c71 100644 --- a/source/Security/protocols/key_sec_prot/key_sec_prot.c +++ b/source/Security/protocols/key_sec_prot/key_sec_prot.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/protocols/key_sec_prot/key_sec_prot.h b/source/Security/protocols/key_sec_prot/key_sec_prot.h index e059ab7bc0..ed0436d5d2 100644 --- a/source/Security/protocols/key_sec_prot/key_sec_prot.h +++ b/source/Security/protocols/key_sec_prot/key_sec_prot.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/protocols/msg_sec_prot/msg_sec_prot.c b/source/Security/protocols/msg_sec_prot/msg_sec_prot.c new file mode 100644 index 0000000000..ddaf69a0ce --- /dev/null +++ b/source/Security/protocols/msg_sec_prot/msg_sec_prot.c @@ -0,0 +1,148 @@ +/* + * Copyright (c) 2021, Pelion and affiliates. + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "nsconfig.h" +#include +#include "ns_types.h" +#include "ns_list.h" +#include "ns_trace.h" +#include "nsdynmemLIB.h" +#include "fhss_config.h" +#include "NWK_INTERFACE/Include/protocol.h" +#include "6LoWPAN/ws/ws_config.h" +#include "Security/protocols/sec_prot_cfg.h" +#include "Security/kmp/kmp_addr.h" +#include "Security/kmp/kmp_api.h" +#include "Security/PANA/pana_eap_header.h" +#include "Security/eapol/eapol_helper.h" +#include "Security/eapol/kde_helper.h" +#include "Security/protocols/sec_prot_certs.h" +#include "Security/protocols/sec_prot_keys.h" +#include "Security/protocols/sec_prot.h" +#include "Security/protocols/sec_prot_lib.h" +#include "Security/protocols/msg_sec_prot/msg_sec_prot.h" + +#ifdef HAVE_WS + +#define TRACE_GROUP "msep" + +typedef enum { + MSG_STATE_INIT = SEC_STATE_INIT, + MSG_STATE_CREATE_REQ = SEC_STATE_CREATE_REQ, + MSG_STATE_FINISH = SEC_STATE_FINISH, + MSG_STATE_FINISHED = SEC_STATE_FINISHED +} msg_sec_prot_state_e; + +typedef struct { + sec_prot_common_t common; /**< Common data */ +} msg_sec_prot_int_t; + +static uint16_t msg_sec_prot_size(void); +static int8_t msg_sec_prot_init(sec_prot_t *prot); +static void msg_sec_prot_delete(sec_prot_t *prot); + +static void msg_sec_prot_create_request(sec_prot_t *prot, sec_prot_keys_t *sec_keys); +static void msg_sec_prot_state_machine(sec_prot_t *prot); +static int8_t msg_sec_prot_auth_rejected_send(sec_prot_t *prot, sec_prot_keys_t *sec_keys); + +#define msg_sec_prot_get(prot) (msg_sec_prot_int_t *) &prot->data + +int8_t msg_sec_prot_register(kmp_service_t *service) +{ + if (!service) { + return -1; + } + + if (kmp_service_sec_protocol_register(service, MSG_PROT, msg_sec_prot_size, msg_sec_prot_init) < 0) { + return -1; + } + + return 0; +} + +static uint16_t msg_sec_prot_size(void) +{ + return sizeof(msg_sec_prot_int_t); +} + +static int8_t msg_sec_prot_init(sec_prot_t *prot) +{ + prot->create_req = msg_sec_prot_create_request; + prot->delete = msg_sec_prot_delete; + prot->state_machine = msg_sec_prot_state_machine; + + msg_sec_prot_int_t *data = msg_sec_prot_get(prot); + sec_prot_init(&data->common); + sec_prot_state_set(prot, &data->common, MSG_STATE_INIT); + + return 0; +} + +static void msg_sec_prot_delete(sec_prot_t *prot) +{ + (void) prot; +} + +static void msg_sec_prot_create_request(sec_prot_t *prot, sec_prot_keys_t *sec_keys) +{ + (void) sec_keys; + + prot->state_machine(prot); +} + +static int8_t msg_sec_prot_auth_rejected_send(sec_prot_t *prot, sec_prot_keys_t *sec_keys) +{ + (void) sec_keys; + + uint8_t *eapol_pdu_frame = ns_dyn_mem_temporary_alloc(prot->header_size); + + // Send zero length message to relay which requests LLC to remove EAPOL temporary entry based on EUI-64 + if (prot->send(prot, eapol_pdu_frame, prot->header_size) < 0) { + return -1; + } + + return 0; +} + +static void msg_sec_prot_state_machine(sec_prot_t *prot) +{ + msg_sec_prot_int_t *data = msg_sec_prot_get(prot); + + switch (sec_prot_state_get(&data->common)) { + case MSG_STATE_INIT: + sec_prot_state_set(prot, &data->common, MSG_STATE_CREATE_REQ); + break; + case MSG_STATE_CREATE_REQ: + // KMP-CREATE.confirm + prot->create_conf(prot, sec_prot_result_get(&data->common)); + // Authentication rejected (will continue only after new EAPOL Initial-Key) + (void) msg_sec_prot_auth_rejected_send(prot, prot->sec_keys); + sec_prot_state_set(prot, &data->common, MSG_STATE_FINISH); + break; + case MSG_STATE_FINISH: + sec_prot_state_set(prot, &data->common, MSG_STATE_FINISHED); + /* fall through */ + case MSG_STATE_FINISHED: + prot->finished(prot); + break; + default: + break; + } +} + +#endif /* HAVE_WS */ + diff --git a/source/Security/protocols/msg_sec_prot/msg_sec_prot.h b/source/Security/protocols/msg_sec_prot/msg_sec_prot.h new file mode 100644 index 0000000000..611f30ce98 --- /dev/null +++ b/source/Security/protocols/msg_sec_prot/msg_sec_prot.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2021, Pelion and affiliates. + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef MSG_SEC_PROT_H_ +#define MSG_SEC_PROT_H_ + +/* + * Message security protocol. Protocol can be used for sending messages from + * authenticator EAPOL components to lower layers on authenticator. + * + */ + +/** + * msg_sec_prot_register register message security protocol to KMP service + * + * \param service KMP service + * + * \return < 0 failure + * \return >= 0 success + */ +int8_t msg_sec_prot_register(kmp_service_t *service); + +#endif /* MSG_SEC_PROT_H_ */ diff --git a/source/Security/protocols/radius_sec_prot/avp_helper.c b/source/Security/protocols/radius_sec_prot/avp_helper.c index 73cc2d98e5..9d0530495a 100644 --- a/source/Security/protocols/radius_sec_prot/avp_helper.c +++ b/source/Security/protocols/radius_sec_prot/avp_helper.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Arm Limited and affiliates. + * Copyright (c) 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/protocols/radius_sec_prot/avp_helper.h b/source/Security/protocols/radius_sec_prot/avp_helper.h index 8687a112fa..ecb8f22e9e 100644 --- a/source/Security/protocols/radius_sec_prot/avp_helper.h +++ b/source/Security/protocols/radius_sec_prot/avp_helper.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Arm Limited and affiliates. + * Copyright (c) 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/protocols/radius_sec_prot/radius_client_sec_prot.c b/source/Security/protocols/radius_sec_prot/radius_client_sec_prot.c index 882df678fd..21dc0bf7e0 100644 --- a/source/Security/protocols/radius_sec_prot/radius_client_sec_prot.c +++ b/source/Security/protocols/radius_sec_prot/radius_client_sec_prot.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Arm Limited and affiliates. + * Copyright (c) 2020-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -71,6 +71,7 @@ typedef enum { #define RADIUS_ACCESS_ACCEPT 2 #define RADIUS_ACCESS_REJECT 3 #define RADIUS_ACCESS_CHALLENGE 11 +#define RADIUS_MESSAGE_NONE 0 #define MS_MPPE_RECV_KEY_SALT_LEN 2 #define MS_MPPE_RECV_KEY_BLOCK_LEN 16 @@ -239,7 +240,7 @@ static int8_t radius_client_sec_prot_init(sec_prot_t *prot) data->send_radius_msg = NULL; data->identity_len = 0; data->identity = NULL; - data->radius_code = 0; + data->radius_code = RADIUS_MESSAGE_NONE; data->radius_identifier = 0; memset(data->request_authenticator, 0, 16); data->state_len = 0; @@ -247,6 +248,7 @@ static int8_t radius_client_sec_prot_init(sec_prot_t *prot) memset(data->remote_eui_64_hash, 0, 8); data->remote_eui_64_hash_set = false; data->new_pmk_set = false; + data->radius_id_range_set = false; if (!shared_data) { shared_data = ns_dyn_mem_alloc(sizeof(radius_client_sec_prot_shared_t)); @@ -379,6 +381,10 @@ static int8_t radius_client_sec_prot_receive(sec_prot_t *prot, void *pdu, uint16 uint8_t *radius_msg_ptr = pdu; uint8_t code = *radius_msg_ptr++; + if (code != RADIUS_ACCESS_ACCEPT && code != RADIUS_ACCESS_REJECT && code != RADIUS_ACCESS_CHALLENGE) { + return -1; + } + uint8_t identifier = *radius_msg_ptr++; /* If identifier does not match to sent identifier, silently ignore message, already checked on socket if before routing the request to receive, so @@ -430,6 +436,7 @@ static int8_t radius_client_sec_prot_receive(sec_prot_t *prot, void *pdu, uint16 // Message does not have radius EAP-TLS specific fields data->radius_code = code; prot->state_machine(prot); + data->radius_code = RADIUS_MESSAGE_NONE; return 0; } @@ -519,6 +526,7 @@ static int8_t radius_client_sec_prot_receive(sec_prot_t *prot, void *pdu, uint16 data->radius_code = code; data->recv_eap_msg_len += data->radius_eap_tls_header_size; prot->state_machine(prot); + data->radius_code = RADIUS_MESSAGE_NONE; return 0; } @@ -1127,6 +1135,16 @@ static void radius_client_sec_prot_state_machine(sec_prot_t *prot) return; } + if (data->radius_code != RADIUS_MESSAGE_NONE) { + // Received retry for already handled message from RADIUS server, ignore + if (data->recv_eap_msg) { + ns_dyn_mem_free(data->recv_eap_msg); + } + data->recv_eap_msg = NULL; + data->recv_eap_msg_len = 0; + return; + } + tr_info("Radius: send access request, eui-64: %s", trace_array(sec_prot_remote_eui_64_addr_get(prot), 8)); radius_client_sec_prot_allocate_and_create_radius_message(prot); diff --git a/source/Security/protocols/radius_sec_prot/radius_client_sec_prot.h b/source/Security/protocols/radius_sec_prot/radius_client_sec_prot.h index 9d3a467284..efedcbd6d1 100644 --- a/source/Security/protocols/radius_sec_prot/radius_client_sec_prot.h +++ b/source/Security/protocols/radius_sec_prot/radius_client_sec_prot.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Arm Limited and affiliates. + * Copyright (c) 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/protocols/sec_prot.h b/source/Security/protocols/sec_prot.h index ac283a00c1..b32f91777c 100644 --- a/source/Security/protocols/sec_prot.h +++ b/source/Security/protocols/sec_prot.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/protocols/sec_prot_certs.c b/source/Security/protocols/sec_prot_certs.c index dc76a22ba9..4c5045fa14 100644 --- a/source/Security/protocols/sec_prot_certs.c +++ b/source/Security/protocols/sec_prot_certs.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/protocols/sec_prot_certs.h b/source/Security/protocols/sec_prot_certs.h index 9a204aaa09..755a9741de 100644 --- a/source/Security/protocols/sec_prot_certs.h +++ b/source/Security/protocols/sec_prot_certs.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/protocols/sec_prot_cfg.h b/source/Security/protocols/sec_prot_cfg.h index 17efc2b589..adc4217281 100644 --- a/source/Security/protocols/sec_prot_cfg.h +++ b/source/Security/protocols/sec_prot_cfg.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Arm Limited and affiliates. + * Copyright (c) 2020-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,8 +23,9 @@ typedef struct sec_prot_cfg_s { trickle_params_t sec_prot_trickle_params; uint16_t sec_prot_retry_timeout; - uint16_t initial_key_retry_delay; - trickle_params_t initial_key_trickle_params; + uint16_t initial_key_retry_min; + uint16_t initial_key_retry_max; + uint16_t initial_key_retry_max_limit; uint8_t initial_key_retry_cnt; uint8_t max_ongoing_auth_constant; uint16_t max_ongoing_auth_size_scaler; diff --git a/source/Security/protocols/sec_prot_keys.c b/source/Security/protocols/sec_prot_keys.c index ff08f74942..02748f08fc 100644 --- a/source/Security/protocols/sec_prot_keys.c +++ b/source/Security/protocols/sec_prot_keys.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/protocols/sec_prot_keys.h b/source/Security/protocols/sec_prot_keys.h index 0304d9eb44..6215bdc759 100644 --- a/source/Security/protocols/sec_prot_keys.h +++ b/source/Security/protocols/sec_prot_keys.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -114,6 +114,7 @@ typedef struct { typedef struct { frame_counter_t counter[GTK_NUM]; /**< Frame counter for each GTK key */ + int8_t active_gtk_index; /**< Active GTK index */ } frame_counters_t; // Authenticator supplicant security key data diff --git a/source/Security/protocols/sec_prot_lib.c b/source/Security/protocols/sec_prot_lib.c index a6ba018ae6..7789020660 100644 --- a/source/Security/protocols/sec_prot_lib.c +++ b/source/Security/protocols/sec_prot_lib.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -88,6 +88,8 @@ void sec_prot_timer_timeout_handle(sec_prot_t *prot, sec_prot_common_t *data, co void sec_prot_timer_trickle_start(sec_prot_common_t *data, const trickle_params_t *trickle_params) { trickle_start(&data->trickle_timer, trickle_params); + trickle_inconsistent_heard(&data->trickle_timer, trickle_params); + tr_info("Security prot trickle start, I: %i, t: %i", data->trickle_timer.I, data->trickle_timer.t); data->trickle_running = true; } diff --git a/source/Security/protocols/sec_prot_lib.h b/source/Security/protocols/sec_prot_lib.h index 4d7fd088ee..83a01879c2 100644 --- a/source/Security/protocols/sec_prot_lib.h +++ b/source/Security/protocols/sec_prot_lib.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/protocols/tls_sec_prot/tls_sec_prot.c b/source/Security/protocols/tls_sec_prot/tls_sec_prot.c index 472c0411dc..545dbbcb87 100644 --- a/source/Security/protocols/tls_sec_prot/tls_sec_prot.c +++ b/source/Security/protocols/tls_sec_prot/tls_sec_prot.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Arm Limited and affiliates. + * Copyright (c) 2019-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/protocols/tls_sec_prot/tls_sec_prot.h b/source/Security/protocols/tls_sec_prot/tls_sec_prot.h index 129648e1cc..23f2a82879 100644 --- a/source/Security/protocols/tls_sec_prot/tls_sec_prot.h +++ b/source/Security/protocols/tls_sec_prot/tls_sec_prot.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Arm Limited and affiliates. + * Copyright (c) 2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/protocols/tls_sec_prot/tls_sec_prot_lib.c b/source/Security/protocols/tls_sec_prot/tls_sec_prot_lib.c index 1ba7f109ab..36f50a8b09 100644 --- a/source/Security/protocols/tls_sec_prot/tls_sec_prot_lib.c +++ b/source/Security/protocols/tls_sec_prot/tls_sec_prot_lib.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Arm Limited and affiliates. + * Copyright (c) 2019-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Security/protocols/tls_sec_prot/tls_sec_prot_lib.h b/source/Security/protocols/tls_sec_prot/tls_sec_prot_lib.h index fc4a40b9f0..209064b332 100644 --- a/source/Security/protocols/tls_sec_prot/tls_sec_prot_lib.h +++ b/source/Security/protocols/tls_sec_prot/tls_sec_prot_lib.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Arm Limited and affiliates. + * Copyright (c) 2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/CCM_lib/ccm_security.c b/source/Service_Libs/CCM_lib/ccm_security.c index 14deaa5226..04d1fe55d3 100644 --- a/source/Service_Libs/CCM_lib/ccm_security.c +++ b/source/Service_Libs/CCM_lib/ccm_security.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2015, 2017-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2015, 2017-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/CCM_lib/mbedOS/aes_mbedtls.c b/source/Service_Libs/CCM_lib/mbedOS/aes_mbedtls.c index 36bdd0f590..03594467bb 100644 --- a/source/Service_Libs/CCM_lib/mbedOS/aes_mbedtls.c +++ b/source/Service_Libs/CCM_lib/mbedOS/aes_mbedtls.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, Arm Limited and affiliates. + * Copyright (c) 2006-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/CCM_lib/mbedOS/aes_mbedtls_adapter.c b/source/Service_Libs/CCM_lib/mbedOS/aes_mbedtls_adapter.c index afc9132db8..c9aeeedebd 100644 --- a/source/Service_Libs/CCM_lib/mbedOS/aes_mbedtls_adapter.c +++ b/source/Service_Libs/CCM_lib/mbedOS/aes_mbedtls_adapter.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2019, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/Neighbor_cache/neighbor_cache.c b/source/Service_Libs/Neighbor_cache/neighbor_cache.c index 4f057a5574..c7ffeee88e 100644 --- a/source/Service_Libs/Neighbor_cache/neighbor_cache.c +++ b/source/Service_Libs/Neighbor_cache/neighbor_cache.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/Neighbor_cache/neighbor_table_definition.h b/source/Service_Libs/Neighbor_cache/neighbor_table_definition.h index 4141691095..783d7e75b7 100644 --- a/source/Service_Libs/Neighbor_cache/neighbor_table_definition.h +++ b/source/Service_Libs/Neighbor_cache/neighbor_table_definition.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/SHA256_Lib/ns_sha256.c b/source/Service_Libs/SHA256_Lib/ns_sha256.c index 10fce9c06a..cdbded6b9b 100644 --- a/source/Service_Libs/SHA256_Lib/ns_sha256.c +++ b/source/Service_Libs/SHA256_Lib/ns_sha256.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, Arm Limited and affiliates. + * Copyright (c) 2006-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/SHA256_Lib/shalib.c b/source/Service_Libs/SHA256_Lib/shalib.c index 6f1120f45c..bb3a71197b 100644 --- a/source/Service_Libs/SHA256_Lib/shalib.c +++ b/source/Service_Libs/SHA256_Lib/shalib.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/Trickle/trickle.c b/source/Service_Libs/Trickle/trickle.c index 77e58d09ad..2bab1f368a 100644 --- a/source/Service_Libs/Trickle/trickle.c +++ b/source/Service_Libs/Trickle/trickle.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/Trickle/trickle.h b/source/Service_Libs/Trickle/trickle.h index a6c957826c..e12cfe2f82 100644 --- a/source/Service_Libs/Trickle/trickle.h +++ b/source/Service_Libs/Trickle/trickle.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, 2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/blacklist/blacklist.c b/source/Service_Libs/blacklist/blacklist.c index f47b2097bf..d195ef93dc 100644 --- a/source/Service_Libs/blacklist/blacklist.c +++ b/source/Service_Libs/blacklist/blacklist.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018, Arm Limited and affiliates. + * Copyright (c) 2017-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/blacklist/blacklist.h b/source/Service_Libs/blacklist/blacklist.h index 224490194a..d2d1c072fc 100644 --- a/source/Service_Libs/blacklist/blacklist.h +++ b/source/Service_Libs/blacklist/blacklist.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Arm Limited and affiliates. + * Copyright (c) 2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/etx/etx.c b/source/Service_Libs/etx/etx.c index 22a86f1cca..73c0d12eca 100644 --- a/source/Service_Libs/etx/etx.c +++ b/source/Service_Libs/etx/etx.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019, Arm Limited and affiliates. + * Copyright (c) 2014-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -439,11 +439,6 @@ uint16_t etx_local_etx_read(int8_t interface_id, uint8_t attribute_index) } if (etx_info.cache_sample_requested && entry->etx_samples < etx_info.init_etx_sample_count) { - etx_sample_storage_t *storage = etx_info.etx_cache_storage_list + attribute_index; - if (storage->received_acks == 0 && storage->attempts_count) { - //No ack so return max value - return etx_info.max_etx; - } //Not ready yet return 0xffff; } diff --git a/source/Service_Libs/etx/etx.h b/source/Service_Libs/etx/etx.h index 9329d201b2..7b6a68760b 100644 --- a/source/Service_Libs/etx/etx.h +++ b/source/Service_Libs/etx/etx.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/fhss/channel_functions.c b/source/Service_Libs/fhss/channel_functions.c index 594686b9bb..27848430a2 100644 --- a/source/Service_Libs/fhss/channel_functions.c +++ b/source/Service_Libs/fhss/channel_functions.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/fhss/channel_functions.h b/source/Service_Libs/fhss/channel_functions.h index f6ceab73bb..14ed756114 100644 --- a/source/Service_Libs/fhss/channel_functions.h +++ b/source/Service_Libs/fhss/channel_functions.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Arm Limited and affiliates. + * Copyright (c) 2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/fhss/channel_list.c b/source/Service_Libs/fhss/channel_list.c index 0f59f584cf..a25ffe12b4 100644 --- a/source/Service_Libs/fhss/channel_list.c +++ b/source/Service_Libs/fhss/channel_list.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/fhss/channel_list.h b/source/Service_Libs/fhss/channel_list.h index 7e283b3dbe..d84918c87f 100644 --- a/source/Service_Libs/fhss/channel_list.h +++ b/source/Service_Libs/fhss/channel_list.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/fhss/fhss.c b/source/Service_Libs/fhss/fhss.c index ae960bc8d0..532a57c669 100644 --- a/source/Service_Libs/fhss/fhss.c +++ b/source/Service_Libs/fhss/fhss.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/fhss/fhss.h b/source/Service_Libs/fhss/fhss.h index 1f09840cbd..77b0aa75f3 100644 --- a/source/Service_Libs/fhss/fhss.h +++ b/source/Service_Libs/fhss/fhss.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/fhss/fhss_channel.c b/source/Service_Libs/fhss/fhss_channel.c index 8ad6c3cf52..901a02c945 100644 --- a/source/Service_Libs/fhss/fhss_channel.c +++ b/source/Service_Libs/fhss/fhss_channel.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/fhss/fhss_channel.h b/source/Service_Libs/fhss/fhss_channel.h index af35ba6475..98fe9157e7 100644 --- a/source/Service_Libs/fhss/fhss_channel.h +++ b/source/Service_Libs/fhss/fhss_channel.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/fhss/fhss_common.c b/source/Service_Libs/fhss/fhss_common.c index 0d9dc7c505..c968751c85 100644 --- a/source/Service_Libs/fhss/fhss_common.c +++ b/source/Service_Libs/fhss/fhss_common.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2018, 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/fhss/fhss_common.h b/source/Service_Libs/fhss/fhss_common.h index 71c2d9a4d1..7bc5e88ab7 100644 --- a/source/Service_Libs/fhss/fhss_common.h +++ b/source/Service_Libs/fhss/fhss_common.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/fhss/fhss_configuration_interface.c b/source/Service_Libs/fhss/fhss_configuration_interface.c index df247c80b5..6684d265ca 100644 --- a/source/Service_Libs/fhss/fhss_configuration_interface.c +++ b/source/Service_Libs/fhss/fhss_configuration_interface.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2019, 2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/fhss/fhss_statistics.c b/source/Service_Libs/fhss/fhss_statistics.c index b4ee75c48f..c8ee23a973 100644 --- a/source/Service_Libs/fhss/fhss_statistics.c +++ b/source/Service_Libs/fhss/fhss_statistics.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018, Arm Limited and affiliates. + * Copyright (c) 2017-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/fhss/fhss_statistics.h b/source/Service_Libs/fhss/fhss_statistics.h index bd2f81eaef..765df79b1f 100644 --- a/source/Service_Libs/fhss/fhss_statistics.h +++ b/source/Service_Libs/fhss/fhss_statistics.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Arm Limited and affiliates. + * Copyright (c) 2017, 2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/fhss/fhss_test_api.c b/source/Service_Libs/fhss/fhss_test_api.c index 02e63af682..421143e4fe 100644 --- a/source/Service_Libs/fhss/fhss_test_api.c +++ b/source/Service_Libs/fhss/fhss_test_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Arm Limited and affiliates. + * Copyright (c) 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/fhss/fhss_ws.c b/source/Service_Libs/fhss/fhss_ws.c index 6c4e62e0d9..090520570b 100644 --- a/source/Service_Libs/fhss/fhss_ws.c +++ b/source/Service_Libs/fhss/fhss_ws.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -130,10 +130,10 @@ fhss_structure_t *fhss_ws_enable(fhss_api_t *fhss_api, const fhss_ws_configurati tr_err("Invalid FHSS enable configuration"); return NULL; } - int channel_count = channel_list_count_channels(fhss_configuration->channel_mask); + int bc_channel_count = channel_list_count_channels(fhss_configuration->channel_mask); int uc_channel_count = channel_list_count_channels(fhss_configuration->unicast_channel_mask); - if (channel_count <= 0) { + if (bc_channel_count <= 0) { // There must be at least one configured channel in channel list return NULL; } @@ -147,7 +147,7 @@ fhss_structure_t *fhss_ws_enable(fhss_api_t *fhss_api, const fhss_ws_configurati return NULL; } memset(fhss_struct->ws, 0, sizeof(fhss_ws_t)); - if (fhss_ws_manage_channel_table_allocation(fhss_struct, channel_count)) { + if (fhss_ws_manage_channel_table_allocation(fhss_struct, uc_channel_count > bc_channel_count ? uc_channel_count : bc_channel_count)) { ns_dyn_mem_free(fhss_struct->ws); fhss_free_instance(fhss_api); tr_error("Failed to allocate channel tables"); @@ -161,10 +161,12 @@ fhss_structure_t *fhss_ws_enable(fhss_api_t *fhss_api, const fhss_ws_configurati for (uint8_t i = 0; i < 8; i++) { fhss_struct->ws->fhss_configuration.unicast_channel_mask[i] = fhss_configuration->channel_mask[i]; } - uc_channel_count = channel_count; + uc_channel_count = bc_channel_count; } - fhss_struct->number_of_channels = channel_count; + + fhss_struct->number_of_channels = fhss_configuration->channel_mask_size; fhss_struct->number_of_uc_channels = uc_channel_count; + fhss_struct->number_of_bc_channels = bc_channel_count; fhss_struct->optimal_packet_length = OPTIMAL_PACKET_LENGTH; fhss_ws_set_hop_count(fhss_struct, 0xff); fhss_struct->rx_channel = fhss_configuration->unicast_fixed_channel; @@ -499,16 +501,37 @@ static uint32_t fhss_ws_calculate_ufsi(fhss_structure_t *fhss_structure, uint32_ } } cur_slot--; - uint32_t remaining_time_ms = 0; - if (fhss_structure->ws->unicast_timer_running == true) { - remaining_time_ms = US_TO_MS(get_remaining_slots_us(fhss_structure, fhss_unicast_handler, MS_TO_US(dwell_time) - NS_TO_US((int64_t)(fhss_structure->ws->drift_per_millisecond_ns * dwell_time)))); - } + uint32_t time_to_tx = 0; uint32_t cur_time = fhss_structure->callbacks.read_timestamp(fhss_structure->fhss_api); - if (cur_time < tx_time) { + // High time to TX value (1000ms) is because actual TX time already passed. + if (US_TO_MS(tx_time - cur_time) < 1000) { time_to_tx = US_TO_MS(tx_time - cur_time); } - uint64_t ms_since_seq_start = (cur_slot * dwell_time) + (dwell_time - remaining_time_ms) + time_to_tx; + uint64_t ms_since_seq_start; + if (fhss_structure->ws->unicast_timer_running == true) { + // Allow timer interrupt to delay max 10 seconds, otherwise assume next_uc_timeout overflowed + if ((fhss_structure->ws->next_uc_timeout < cur_time) && ((cur_time - fhss_structure->ws->next_uc_timeout) < 10000000)) { + // The unicast timer has already expired, so count all previous slots + // plus 1 completed slot + // plus the time from timer expiration to now + // plus the time until Tx + ms_since_seq_start = ((cur_slot + 1) * dwell_time) + US_TO_MS(cur_time - fhss_structure->ws->next_uc_timeout) + time_to_tx; + } else { + // The unicast timer is still running, so count all previous slots + // plus the remaining time in the slot + // plus the time until Tx + uint32_t remaining_time_ms = US_TO_MS(fhss_structure->ws->next_uc_timeout - cur_time); + ms_since_seq_start = (cur_slot * dwell_time) + (dwell_time - remaining_time_ms) + time_to_tx; + } + } else { + // The unicast timer is not running. Act as if the slot has completed. + // count all previous slots + // plus 1 completed slot + // plus the time until Tx + ms_since_seq_start = ((cur_slot + 1) * dwell_time) + time_to_tx; + } + uint32_t seq_length = 0x10000; if (fhss_structure->ws->fhss_configuration.ws_uc_channel_function == WS_TR51CF) { ms_since_seq_start %= (dwell_time * fhss_structure->number_of_uc_channels); diff --git a/source/Service_Libs/fhss/fhss_ws.h b/source/Service_Libs/fhss/fhss_ws.h index 6e3b3d5d48..0aa9887289 100644 --- a/source/Service_Libs/fhss/fhss_ws.h +++ b/source/Service_Libs/fhss/fhss_ws.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Arm Limited and affiliates. + * Copyright (c) 2018-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/fhss/fhss_ws_empty_functions.c b/source/Service_Libs/fhss/fhss_ws_empty_functions.c index 4a68275472..9a43fff87f 100644 --- a/source/Service_Libs/fhss/fhss_ws_empty_functions.c +++ b/source/Service_Libs/fhss/fhss_ws_empty_functions.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Arm Limited and affiliates. + * Copyright (c) 2018-2019, 2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/fnv_hash/fnv_hash.c b/source/Service_Libs/fnv_hash/fnv_hash.c index fb93f18085..bcc5c12496 100644 --- a/source/Service_Libs/fnv_hash/fnv_hash.c +++ b/source/Service_Libs/fnv_hash/fnv_hash.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017, Arm Limited and affiliates. + * Copyright (c) 2016-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/fnv_hash/fnv_hash.h b/source/Service_Libs/fnv_hash/fnv_hash.h index 5be95a6a70..7ee5f02b9c 100644 --- a/source/Service_Libs/fnv_hash/fnv_hash.h +++ b/source/Service_Libs/fnv_hash/fnv_hash.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017, Arm Limited and affiliates. + * Copyright (c) 2016-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/hmac/hmac_md.c b/source/Service_Libs/hmac/hmac_md.c index a3eb539b61..0ef22158e1 100644 --- a/source/Service_Libs/hmac/hmac_md.c +++ b/source/Service_Libs/hmac/hmac_md.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/hmac/hmac_md.h b/source/Service_Libs/hmac/hmac_md.h index 7c55b77a45..fbb57bf18a 100644 --- a/source/Service_Libs/hmac/hmac_md.h +++ b/source/Service_Libs/hmac/hmac_md.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2018, 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/ieee_802_11/ieee_802_11.c b/source/Service_Libs/ieee_802_11/ieee_802_11.c index 6200ae0eb9..bfd0724f62 100644 --- a/source/Service_Libs/ieee_802_11/ieee_802_11.c +++ b/source/Service_Libs/ieee_802_11/ieee_802_11.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/ieee_802_11/ieee_802_11.h b/source/Service_Libs/ieee_802_11/ieee_802_11.h index 80dc118633..e7737297c2 100644 --- a/source/Service_Libs/ieee_802_11/ieee_802_11.h +++ b/source/Service_Libs/ieee_802_11/ieee_802_11.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/load_balance/load_balance.c b/source/Service_Libs/load_balance/load_balance.c index 74d02ae442..7d91760139 100644 --- a/source/Service_Libs/load_balance/load_balance.c +++ b/source/Service_Libs/load_balance/load_balance.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/load_balance/load_balance_api.h b/source/Service_Libs/load_balance/load_balance_api.h index 498847da8f..586505f1ff 100644 --- a/source/Service_Libs/load_balance/load_balance_api.h +++ b/source/Service_Libs/load_balance/load_balance_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/mac_neighbor_table/mac_neighbor_table.c b/source/Service_Libs/mac_neighbor_table/mac_neighbor_table.c index 1969159277..4784d8824c 100644 --- a/source/Service_Libs/mac_neighbor_table/mac_neighbor_table.c +++ b/source/Service_Libs/mac_neighbor_table/mac_neighbor_table.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/mac_neighbor_table/mac_neighbor_table.h b/source/Service_Libs/mac_neighbor_table/mac_neighbor_table.h index 7b2c6d4ef4..37908a0379 100644 --- a/source/Service_Libs/mac_neighbor_table/mac_neighbor_table.h +++ b/source/Service_Libs/mac_neighbor_table/mac_neighbor_table.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Arm Limited and affiliates. + * Copyright (c) 2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/mdns/fnet/fnet_stack/fnet_config.h b/source/Service_Libs/mdns/fnet/fnet_stack/fnet_config.h index 54bb282c4e..85d494dc86 100644 --- a/source/Service_Libs/mdns/fnet/fnet_stack/fnet_config.h +++ b/source/Service_Libs/mdns/fnet/fnet_stack/fnet_config.h @@ -1,6 +1,6 @@ /************************************************************************** * -* Copyright (c) 2017, Arm Limited and affiliates. +* Copyright (c) 2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * Copyright 2011-2016 by Andrey Butok. FNET Community. * Copyright 2008-2010 by Andrey Butok. Freescale Semiconductor, Inc. diff --git a/source/Service_Libs/mdns/fnet/fnet_stack/port/compiler/fnet_comp.h b/source/Service_Libs/mdns/fnet/fnet_stack/port/compiler/fnet_comp.h index d3109581b5..2fb633df5a 100644 --- a/source/Service_Libs/mdns/fnet/fnet_stack/port/compiler/fnet_comp.h +++ b/source/Service_Libs/mdns/fnet/fnet_stack/port/compiler/fnet_comp.h @@ -1,6 +1,6 @@ /************************************************************************** * -* Copyright (c) 2019 Arm Limited and affiliates. +* Copyright (c) 2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * Copyright 2011-2016 by Andrey Butok. FNET Community. * Copyright 2008-2010 by Andrey Butok. Freescale Semiconductor, Inc. diff --git a/source/Service_Libs/mdns/fnet/fnet_stack/port/compiler/fnet_comp_config.h b/source/Service_Libs/mdns/fnet/fnet_stack/port/compiler/fnet_comp_config.h index ab376cec25..d3fbb98bc6 100644 --- a/source/Service_Libs/mdns/fnet/fnet_stack/port/compiler/fnet_comp_config.h +++ b/source/Service_Libs/mdns/fnet/fnet_stack/port/compiler/fnet_comp_config.h @@ -1,6 +1,6 @@ /************************************************************************** * -* Copyright (c) 2019 Arm Limited and affiliates. +* Copyright (c) 2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * Copyright 2011-2016 by Andrey Butok. FNET Community. * Copyright 2008-2010 by Andrey Butok. Freescale Semiconductor, Inc. diff --git a/source/Service_Libs/mdns/fnet/fnet_stack/services/fnet_services.h b/source/Service_Libs/mdns/fnet/fnet_stack/services/fnet_services.h index 255b8ea950..847dcbade8 100644 --- a/source/Service_Libs/mdns/fnet/fnet_stack/services/fnet_services.h +++ b/source/Service_Libs/mdns/fnet/fnet_stack/services/fnet_services.h @@ -1,6 +1,6 @@ /************************************************************************** * -* Copyright (c) 2017, Arm Limited and affiliates. +* Copyright (c) 2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * Copyright 2011-2016 by Andrey Butok. FNET Community. * Copyright 2008-2010 by Andrey Butok. Freescale Semiconductor, Inc. diff --git a/source/Service_Libs/mdns/fnet/fnet_stack/services/fnet_services_config.h b/source/Service_Libs/mdns/fnet/fnet_stack/services/fnet_services_config.h index c93f83a0ca..5300fcfe6d 100644 --- a/source/Service_Libs/mdns/fnet/fnet_stack/services/fnet_services_config.h +++ b/source/Service_Libs/mdns/fnet/fnet_stack/services/fnet_services_config.h @@ -1,6 +1,6 @@ /************************************************************************** * -* Copyright (c) 2017, Arm Limited and affiliates. +* Copyright (c) 2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * Copyright 2011-2016 by Andrey Butok. FNET Community. * Copyright 2008-2010 by Andrey Butok. Freescale Semiconductor, Inc. diff --git a/source/Service_Libs/mdns/fnet/fnet_stack/services/mdns/fnet_mdns.c b/source/Service_Libs/mdns/fnet/fnet_stack/services/mdns/fnet_mdns.c index 94561a3a5b..a222aba949 100644 --- a/source/Service_Libs/mdns/fnet/fnet_stack/services/mdns/fnet_mdns.c +++ b/source/Service_Libs/mdns/fnet/fnet_stack/services/mdns/fnet_mdns.c @@ -1,6 +1,6 @@ /************************************************************************** * -* Copyright (c) 2017, 2019 Arm Limited and affiliates. +* Copyright (c) 2017, 2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * Copyright 2016 by Andrey Butok. FNET Community. * @@ -50,12 +50,12 @@ #define FNET_MDNS_DOMAIN_NAME "local" /* mDNS top level domain (TLD) name: local */ #define FNET_MDNS_PORT FNET_CFG_MDNS_PORT /* mDNS port */ -#define FNET_MDNS_WAIT 250 /* Wait 250ms to check domain name. */ -#define FNET_MDNS_PROBE_WAIT (5*1000) /* Wait 5 seconds before trying again. */ -#define FNET_MDNS_PROBE_DEFER_WAIT (1*1000) /* Defers to the winning host by waiting one second. */ -#define FNET_MDNS_SHARED_RESPONSE_DELAY (200) /* Delay for shared response. Random amount of time selected with uniform random distribution in the range 20-120 ms. */ +#define FNET_MDNS_WAIT 250 /* Wait 250ms to check domain name. */ +#define FNET_MDNS_PROBE_WAIT (5*1000) /* Wait 5 seconds before trying again. */ +#define FNET_MDNS_PROBE_DEFER_WAIT (1*1000) /* Defers to the winning host by waiting one second. */ +#define FNET_MDNS_SHARED_RESPONSE_DELAY (200) /* Delay for shared response. Random amount of time selected with uniform random distribution in the range 20-120 ms. */ -#define FNET_MDNS_ANNOUNCE_COUNT (2) /* The Multicast DNS responder MUST send at least two unsolicited responses. */ +#define FNET_MDNS_ANNOUNCE_COUNT (2) /* The Multicast DNS responder MUST send at least two unsolicited responses. */ #define FNET_MDNS_ANNOUNCE_INTERVAL (1000) /* one second apart. */ #define FNET_MDNS_HEADER_CLASS_IN 0x01 /* Internet */ @@ -141,11 +141,11 @@ typedef struct fnet_mdns_service_if_s { const char *service_type; /* Service Type. Null-terminated string. Example _http._tcp*/ fnet_uint16_t service_port; /* Service Port number (in network byte order). */ - const fnet_uint8_t *(*service_get_txt)(void); /* Call-back function, which returns pointer to the service TXT record (null-terminated). + const fnet_uint8_t *(*service_get_txt)(void); /* Call-back function, which returns pointer to the service TXT record (null-terminated). * If the service does not provide any TXT record, this parameter must be set to NULL. */ fnet_uint16_t offset_service_name; /* Pointer to service name. Offset from the start of the DNS message. Used for Domain Name Compression. */ fnet_uint16_t offset_service_type; /* Pointer to service type. Offset from the start of the DNS message. Used for Domain Name Compression. */ - fnet_mdns_query_type_t response_type; /* Response type used in mDNS response.*/ + fnet_mdns_query_type_t response_type; /* Response type used in mDNS response.*/ } fnet_mdns_service_if_t; /* MDNS interface structure */ @@ -158,9 +158,9 @@ typedef struct fnet_mdns_if fnet_uint32_t rr_ttl_ip; /* Resource record TTL for IP header, hop-count limit for a packet */ fnet_address_family_t addr_family; /* Address family (IPv6 or IPv4 or both) the server will listen and send */ fnet_size_t name_length; /* Length of the service name without index postfix */ - char host_name[FNET_MDNS_HOST_NAME_LEN_MAX+1]; /* Parsed "name" containing only legal symbols, optionally appended with host_name_count */ + char host_name[FNET_MDNS_HOST_NAME_LEN_MAX+1]; /* Parsed "name" containing only legal symbols, optionally appended with host_name_count */ fnet_uint32_t host_name_count; /* Count of try device name */ - char service_name[FNET_MDNS_HOST_NAME_LEN_MAX+1]; /* Service name, optionally appended with host_name_count */ + char service_name[FNET_MDNS_HOST_NAME_LEN_MAX+1]; /* Service name, optionally appended with host_name_count */ fnet_uint32_t probe_count; /* Number of sent probe queries without name conflict.*/ fnet_uint32_t announce_count; /* Count of sent annoncemnts */ fnet_socket_t socket_listen; /* Listening socket.*/ @@ -172,15 +172,15 @@ typedef struct fnet_mdns_if fnet_bool_t is_truncated; /* RFC6762:In query messages, if the TC bit is set, it means that additional Known-Answer records may be following shortly. A responder SHOULD * record this fact, and wait for those additional Known-Answer records, before deciding whether to respond.*/ fnet_bool_t is_legacy_unicast; /* If the source UDP port in a received Multicast DNS query is not port 5353*/ - fnet_bool_t is_shared; /* Response contains only shared records. + fnet_bool_t is_shared; /* Response contains only shared records. * RFC 6762: In any case where there may be multiple responses, such as queries * where the answer is a member of a shared resource record set, each * responder SHOULD delay its response by a random amount of time * selected with uniform random distribution in the range 20-120 ms. */ fnet_uint32_t is_shared_timestamp; /* Timestamp of shared response query.*/ struct sockaddr remote_address; /* Remote address.*/ - fnet_address_family_t response_address_family; /* Address family used in mDNS response.*/ - fnet_mdns_query_type_t response_type; /* Response type used in mDNS response.*/ + fnet_address_family_t response_address_family; /* Address family used in mDNS response.*/ + fnet_mdns_query_type_t response_type; /* Response type used in mDNS response.*/ fnet_mdns_service_if_t service_if_list[FNET_CFG_MDNS_SERVICE_MAX]; /* Service Discovery List */ } fnet_mdns_if_t; @@ -188,7 +188,7 @@ typedef struct fnet_mdns_if FNET_COMP_PACKED_BEGIN typedef struct fnet_mdns_header_s { - fnet_uint16_t ip FNET_COMP_PACKED; + fnet_uint16_t ip FNET_COMP_PACKED; fnet_uint16_t flags FNET_COMP_PACKED; /* flags */ fnet_uint16_t qdcount FNET_COMP_PACKED; /* count of questions */ fnet_uint16_t ancount FNET_COMP_PACKED; /* count of answers */ @@ -462,7 +462,7 @@ fnet_mdns_service_desc_t fnet_mdns_service_register(fnet_mdns_desc_t mdns_desc, for(i = 0; iservice_if_list[i].service_type == NULL) + if(mdns_if->service_if_list[i].service_type == NULL) { mdns_if->service_if_list[i].service_type = service->service_type; mdns_if->service_if_list[i].service_port = service->service_port; @@ -582,7 +582,7 @@ static void fnet_mdns_update_name(fnet_mdns_if_t *mdns_if, const fnet_char_t *na /* Copy name. */ fnet_strcpy(mdns_if->host_name, name); fnet_strcpy(mdns_if->service_name, name); - + /* Allow only legal characters in address record names.*/ for(c = mdns_if->host_name; *c != '\0'; c++) { @@ -607,7 +607,7 @@ static void fnet_mdns_update_name(fnet_mdns_if_t *mdns_if, const fnet_char_t *na FNET_DEBUG_MDNS("MDNS: Host-name set to (%s).", mdns_if->host_name); } /************************************************************************ -* DESCRIPTION: Update counter of host and service name. +* DESCRIPTION: Update counter of host and service name. ************************************************************************/ static void fnet_mdns_update_name_counter(fnet_mdns_if_t *mdns_if) { @@ -780,7 +780,7 @@ static fnet_bool_t fnet_mdns_cmp_rr_name(const char *rr_name, const char *name_1 } /************************************************************************ -* DESCRIPTION: Compare R name with sub-name. +* DESCRIPTION: Compare R name with sub-name. ************************************************************************/ static fnet_bool_t fnet_mdns_cmp_name(const char **rr_name_p, const char *name) { @@ -821,8 +821,8 @@ static fnet_bool_t fnet_mdns_cmp_name(const char **rr_name_p, const char *name) } /************************************************************************ -* DESCRIPTION: Put RR name to rr_name. Retutns pointer to the next pointer; 0 if error. -If rr_name or rr_name_size are 0, just skip name. +* DESCRIPTION: Put RR name to rr_name. Retutns pointer to the next pointer; 0 if error. +If rr_name or rr_name_size are 0, just skip name. ************************************************************************/ static const fnet_uint8_t *fnet_mdns_get_rr_name(char *rr_name, fnet_uint32_t rr_name_size, const fnet_uint8_t *rr, const fnet_uint8_t *packet) { @@ -832,7 +832,7 @@ static const fnet_uint8_t *fnet_mdns_get_rr_name(char *rr_name, fnet_uint32_t rr const fnet_uint8_t *ptr = rr; fnet_uint8_t length = *rr; fnet_uint16_t offset = 0; - const fnet_uint8_t *result = ptr; + const fnet_uint8_t *result = ptr; while(length != 0) { @@ -861,7 +861,7 @@ static const fnet_uint8_t *fnet_mdns_get_rr_name(char *rr_name, fnet_uint32_t rr { goto ERROR; } - + length = *ptr; if( rr_name && rr_name_size ) /* Copy to rr_name buffer.*/ @@ -872,7 +872,7 @@ static const fnet_uint8_t *fnet_mdns_get_rr_name(char *rr_name, fnet_uint32_t rr rr_name += (length+1); rr_name_size -= (length+1); - } + } else { goto ERROR; @@ -917,10 +917,10 @@ static fnet_mdns_query_type_t fnet_mdns_get_query_type(fnet_uint16_t type) break; case FNET_HTONS(FNET_MDNS_RR_ANY): query_rr_type = FNET_MDNS_QUERY_ANY; - break; + break; default: query_rr_type = FNET_MDNS_QUERY_NONE; - break; + break; } return query_rr_type; @@ -937,7 +937,7 @@ static void fnet_mdns_print_qe_name(const fnet_char_t *prefix, const fnet_char_t fnet_uint8_t name_length_index = 0; fnet_index_t i; - fnet_print("%s", prefix); /* Print prefix*/ + fnet_print("%s", prefix); /* Print prefix*/ for(i=0; iresponse_type |= query_type; } - mdns_if->response_address_family |= address_family; + mdns_if->response_address_family |= address_family; } } break; case FNET_MDNS_STATE_PROBING: /* Compare received hostname with my_device.local or my_device._hap._tcp.local*/ - if(fnet_mdns_is_our_host_name(mdns_if, qe_name) - || fnet_mdns_get_service_by_name(mdns_if, qe_name)) + if(fnet_mdns_is_our_host_name(mdns_if, qe_name) + || fnet_mdns_get_service_by_name(mdns_if, qe_name)) { #if FNET_CFG_DEBUG_MDNS && FNET_CFG_DEBUG fnet_mdns_print_qe_name("MDNS: RX Probe for:", qe_name); @@ -1059,19 +1059,19 @@ static const fnet_uint8_t * fnet_mdns_process_query(fnet_mdns_if_t *mdns_if, fne } /************************************************************************ -* DESCRIPTION: Avoid duplicate answer. +* DESCRIPTION: Avoid duplicate answer. ************************************************************************/ static void fnet_mdns_process_duplicate_answer(fnet_mdns_if_t *mdns_if, const fnet_uint8_t *an_ptr, const fnet_uint8_t *packet, fnet_uint32_t packet_size) { FNET_ASSERT(mdns_if != NULL); FNET_ASSERT(an_ptr != NULL); - FNET_ASSERT(packet != NULL); + FNET_ASSERT(packet != NULL); fnet_uint8_t our_rr[FNET_MDNS_RR_PROBE_LEN_MAX]; fnet_mdns_header_t *mdns_header = (fnet_mdns_header_t *)packet; fnet_uint16_t an_count = FNET_HTONS(mdns_header->ancount); const fnet_uint8_t *ptr = an_ptr; - fnet_mdns_rr_header_t *rr_header; + fnet_mdns_rr_header_t *rr_header; fnet_uint32_t i; fnet_mdns_query_type_t rr_type; fnet_bool_t skip; @@ -1090,7 +1090,7 @@ static void fnet_mdns_process_duplicate_answer(fnet_mdns_if_t *mdns_if, const fn } rr_type = fnet_mdns_get_query_type(rr_header->type); - + skip = FNET_FALSE; /* Generate our record.*/ @@ -1156,7 +1156,7 @@ static void fnet_mdns_process_duplicate_answer(fnet_mdns_if_t *mdns_if, const fn skip = FNET_TRUE; break; } - + if(skip == FNET_TRUE) { /* Skip RR record.*/ ptr += sizeof(fnet_mdns_rr_header_t) + FNET_HTONS(rr_header->data_length); @@ -1218,12 +1218,12 @@ static void fnet_mdns_process_simultaneous_probe(fnet_mdns_if_t *mdns_if, const if(fnet_mdns_is_rr_win(our_rr, ns_ptr, ns_count, packet) == FNET_TRUE) { fnet_uint32_t i; - - is_win = FNET_TRUE; - + + is_win = FNET_TRUE; + for(i = 0; iservice_if_list[i].service_type != NULL) + if(mdns_if->service_if_list[i].service_type != NULL) { /* Prepare and Compare Our RR SRV records */ if(fnet_mdns_add_rr_srv(mdns_if, our_rr, sizeof(our_rr), &mdns_if->service_if_list[i], mdns_if->rr_ttl, FNET_FALSE, FNET_FALSE) == NULL) @@ -1237,7 +1237,7 @@ static void fnet_mdns_process_simultaneous_probe(fnet_mdns_if_t *mdns_if, const else { is_win = FNET_FALSE; - break; + break; } } } @@ -1249,7 +1249,7 @@ static void fnet_mdns_process_simultaneous_probe(fnet_mdns_if_t *mdns_if, const /* RFC6762: If the host finds that its own data is lexicographically earlier, then it defers to the winning host by waiting one second, and then begins probing for this record again.*/ - mdns_if->probe_wait_interval = FNET_MDNS_PROBE_DEFER_WAIT; + mdns_if->probe_wait_interval = FNET_MDNS_PROBE_DEFER_WAIT; /* Save conflict timestamp.*/ mdns_if->host_name_conflict_timestamp = fnet_timer_get_ms(); //TBD move to state change. fnet_mdns_change_state(mdns_if, FNET_MDNS_STATE_PROBING_WAIT); /* Reset probing.*/ @@ -1259,7 +1259,7 @@ ERROR: } /************************************************************************ -* DESCRIPTION: Get pointer to Answer Record. +* DESCRIPTION: Get pointer to Answer Record. ************************************************************************/ static const fnet_uint8_t *fnet_mdns_get_an(const fnet_uint8_t *packet, fnet_uint32_t packet_size) { @@ -1267,7 +1267,7 @@ static const fnet_uint8_t *fnet_mdns_get_an(const fnet_uint8_t *packet, fnet_uin fnet_mdns_header_t *mdns_header = (fnet_mdns_header_t *)packet; fnet_uint16_t qd_count; /* Question Count */ - fnet_uint16_t an_count; /* Answer Record Count */ + fnet_uint16_t an_count; /* Answer Record Count */ const fnet_uint8_t *result = NULL; fnet_index_t i; const fnet_uint8_t *ptr; @@ -1276,7 +1276,7 @@ static const fnet_uint8_t *fnet_mdns_get_an(const fnet_uint8_t *packet, fnet_uin { qd_count = FNET_HTONS(mdns_header->qdcount); /* Question Count */ an_count = FNET_HTONS(mdns_header->ancount); /* Answer Record Count */ - + /* Skip mDNS header.*/ ptr = packet + sizeof(fnet_mdns_header_t); @@ -1307,7 +1307,7 @@ ERROR: } /************************************************************************ -* DESCRIPTION: Get pointer to Name Server (Authority Record). +* DESCRIPTION: Get pointer to Name Server (Authority Record). ************************************************************************/ static const fnet_uint8_t *fnet_mdns_get_ns(fnet_uint8_t *packet, fnet_uint32_t packet_size) { @@ -1315,8 +1315,8 @@ static const fnet_uint8_t *fnet_mdns_get_ns(fnet_uint8_t *packet, fnet_uint32_t fnet_mdns_header_t *mdns_header = (fnet_mdns_header_t *)packet; fnet_uint16_t qd_count; /* Question Count */ - fnet_uint16_t an_count; /* Answer Record Count */ - fnet_uint16_t ns_count; /* Authority Record Count */ + fnet_uint16_t an_count; /* Answer Record Count */ + fnet_uint16_t ns_count; /* Authority Record Count */ const fnet_uint8_t *result = NULL; fnet_index_t i; const fnet_uint8_t *ptr; @@ -1326,7 +1326,7 @@ static const fnet_uint8_t *fnet_mdns_get_ns(fnet_uint8_t *packet, fnet_uint32_t qd_count = FNET_HTONS(mdns_header->qdcount); /* Question Count */ an_count = FNET_HTONS(mdns_header->ancount); /* Answer Record Count */ ns_count = FNET_HTONS(mdns_header->nscount); /* Authority Record Count */ - + /* Skip mDNS header.*/ ptr = packet + sizeof(fnet_mdns_header_t); @@ -1363,7 +1363,7 @@ static const fnet_uint8_t *fnet_mdns_get_ns(fnet_uint8_t *packet, fnet_uint32_t { goto ERROR; } - } + } if(ns_count > 0) { @@ -1387,7 +1387,7 @@ static fnet_int32_t fnet_mdns_cmp_rr(fnet_uint8_t *our_rr, const fnet_uint8_t ** fnet_uint16_t rr_type; /* RR type */ fnet_uint16_t rr_class; /* RR class */ const fnet_uint8_t *rr_data; - fnet_uint16_t rr_data_length; + fnet_uint16_t rr_data_length; fnet_mdns_rr_header_t *rr_header; const fnet_uint8_t *ptr = *rr; fnet_char_t rr_name[FNET_MDNS_RR_NAME_LEN_MAX]; @@ -1395,7 +1395,7 @@ static fnet_int32_t fnet_mdns_cmp_rr(fnet_uint8_t *our_rr, const fnet_uint8_t ** fnet_uint16_t our_rr_class; /* RR class */ const fnet_uint8_t *our_rr_data; fnet_uint16_t our_rr_data_length; - fnet_mdns_rr_header_t *our_rr_header; + fnet_mdns_rr_header_t *our_rr_header; fnet_int32_t result; our_rr_header = (fnet_mdns_rr_header_t *)(our_rr + fnet_strlen((char *)our_rr)+1); @@ -1418,17 +1418,17 @@ static fnet_int32_t fnet_mdns_cmp_rr(fnet_uint8_t *our_rr, const fnet_uint8_t ** if(ptr) { rr_header = (fnet_mdns_rr_header_t *)ptr; - ptr += sizeof(fnet_mdns_rr_header_t); + ptr += sizeof(fnet_mdns_rr_header_t); rr_data_length = FNET_HTONS(rr_header->data_length); - + /* Compare RR names.*/ if(fnet_strcmp((char*)our_rr, (char*)rr_name) == 0) { rr_data = ptr; rr_class = FNET_HTONS(rr_header->rr_class) & (~FNET_HTONS(FNET_MDNS_HEADER_CACHE_FLUSH)); rr_type = FNET_HTONS(rr_header->type); - + /* RFC6762: The determination of "lexicographically later" is performed by first comparing the record class (excluding the cache-flush bit described in Section 10.2), then the record type, then raw comparison of the @@ -1447,7 +1447,7 @@ static fnet_int32_t fnet_mdns_cmp_rr(fnet_uint8_t *our_rr, const fnet_uint8_t ** { /* RFC6762: Otherwise, if the record types differ, then the numerically greater type is considered - "lexicographically later".*/ + "lexicographically later".*/ if(rr_type < our_rr_type) { result = 1; /* Win. */ @@ -1457,21 +1457,21 @@ static fnet_int32_t fnet_mdns_cmp_rr(fnet_uint8_t *our_rr, const fnet_uint8_t ** result = -1; /* Loss. */ } /* RFC6762: If the rrtype and rrclass both match, - then the rdata is compared.*/ - else if(rr_data_length) + then the rdata is compared.*/ + else if(rr_data_length) { int cmp_res; fnet_uint16_t cmp_length; - + cmp_length = (rr_data_length > our_rr_data_length)? our_rr_data_length : rr_data_length; /* Get min length value */ - + cmp_res = fnet_memcmp(rr_data, our_rr_data, cmp_length); - + if(cmp_res < 0) { result = 1; /* Win. */ - } - else if (cmp_res > 0) + } + else if (cmp_res > 0) { result = -1; /* Loss. */ } @@ -1498,7 +1498,7 @@ static fnet_int32_t fnet_mdns_cmp_rr(fnet_uint8_t *our_rr, const fnet_uint8_t ** } else { - result = 1; + result = 1; } } } @@ -1559,18 +1559,18 @@ static fnet_bool_t fnet_mdns_is_rr_win(fnet_uint8_t *our_rr, const fnet_uint8_t if(i == ns_count) { - result = FNET_FALSE; + result = FNET_FALSE; } else { - result = FNET_TRUE; + result = FNET_TRUE; } return result; } /************************************************************************ -* DESCRIPTION: Process MDNS response +* DESCRIPTION: Process MDNS response ************************************************************************/ static const fnet_uint8_t *fnet_mdns_process_response(fnet_mdns_if_t *mdns_if, const fnet_uint8_t * ptr, fnet_uint8_t *packet, fnet_uint32_t packet_size) { @@ -1581,7 +1581,7 @@ static const fnet_uint8_t *fnet_mdns_process_response(fnet_mdns_if_t *mdns_if, c fnet_char_t rr_name[FNET_MDNS_RR_NAME_LEN_MAX]; /* Header follows the hostname and the terminating zero */ - fnet_mdns_rr_header_t *rr_header; + fnet_mdns_rr_header_t *rr_header; if( packet_size > (sizeof(fnet_mdns_header_t) + sizeof(fnet_mdns_rr_header_t)) ) /* TND make it universal*/ { @@ -1599,8 +1599,8 @@ static const fnet_uint8_t *fnet_mdns_process_response(fnet_mdns_if_t *mdns_if, c && ( rr_header->rr_class == FNET_HTONS((FNET_MDNS_HEADER_CLASS_IN | FNET_MDNS_HEADER_CACHE_FLUSH)) ) #if 0 /* Cause of Test warnings.*/ && ((rr_header->type == FNET_HTONS(FNET_MDNS_RR_SRV)) || - (rr_header->type == FNET_HTONS(FNET_MDNS_RR_A)) || - (rr_header->type == FNET_HTONS(FNET_MDNS_RR_AAAA))) + (rr_header->type == FNET_HTONS(FNET_MDNS_RR_A)) || + (rr_header->type == FNET_HTONS(FNET_MDNS_RR_AAAA))) #endif ) /* service instance name */ { @@ -1655,7 +1655,7 @@ static void fnet_mdns_recv(fnet_mdns_if_t *mdns_if) const fnet_uint8_t *ptr; fnet_index_t i; fnet_size_t addr_len; - + /* Receive UDP data */ addr_len = sizeof(mdns_if->remote_address); received = fnet_socket_recvfrom( mdns_if->socket_listen, mdns_if->buffer, sizeof(mdns_if->buffer), 0u, &mdns_if->remote_address, &addr_len ); @@ -1670,9 +1670,9 @@ static void fnet_mdns_recv(fnet_mdns_if_t *mdns_if) if((size_t)received > sizeof(fnet_mdns_header_t)) { mdns_header = (fnet_mdns_header_t*)&mdns_if->buffer[0]; - + char *hostname = (char*)&mdns_if->buffer[sizeof(fnet_mdns_header_t)]; - + /* Query */ if( ((mdns_header->flags & FNET_HTONS(FNET_MDNS_HEADER_FLAGS_QR)) == 0) /* Query.*/ && ((mdns_header->flags & FNET_HTONS(FNET_MDNS_HEADER_FLAGS_OPCODE)) == 0) ) /* Standard Query */ @@ -1685,7 +1685,7 @@ static void fnet_mdns_recv(fnet_mdns_if_t *mdns_if) { mdns_if->is_legacy_unicast = FNET_FALSE; } - + if( (mdns_header->flags & FNET_HTONS(FNET_MDNS_HEADER_FLAGS_TC)) == 0) /* Trancation.*/ { mdns_if->is_truncated = FNET_FALSE; @@ -1694,7 +1694,7 @@ static void fnet_mdns_recv(fnet_mdns_if_t *mdns_if) { mdns_if->is_truncated = FNET_TRUE; } - + ptr = (fnet_uint8_t*)hostname; for(i=0; iqdcount); i++) { @@ -1704,14 +1704,14 @@ static void fnet_mdns_recv(fnet_mdns_if_t *mdns_if) return; } } - + /* Duplicate Suppression.*/ if(mdns_if->response_type != FNET_MDNS_QUERY_NONE) { const fnet_uint8_t *an_ptr; - + an_ptr = fnet_mdns_get_an(mdns_if->buffer, received); - + /* Eliminate duplicated answers */ if(an_ptr) { @@ -1728,7 +1728,7 @@ static void fnet_mdns_recv(fnet_mdns_if_t *mdns_if) ) { cnt = FNET_HTONS(mdns_header->nscount) + FNET_HTONS(mdns_header->arcount) + FNET_HTONS(mdns_header->ancount) + FNET_HTONS(mdns_header->qdcount); - + ptr = (fnet_uint8_t*)hostname; for(i=0; (i < cnt) && (ptr < (mdns_if->buffer + received)); i++) { @@ -1747,11 +1747,11 @@ static void fnet_mdns_recv(fnet_mdns_if_t *mdns_if) break; } } - + } /************************************************************************ -* DESCRIPTION: Prepare domain name - replace dots by length of string +* DESCRIPTION: Prepare domain name - replace dots by length of string ************************************************************************/ static fnet_uint8_t *fnet_mdns_add_domain_name(fnet_uint8_t *buf, fnet_uint32_t buf_size, const char * domain_name) { @@ -1760,7 +1760,7 @@ static fnet_uint8_t *fnet_mdns_add_domain_name(fnet_uint8_t *buf, fnet_uint32_t fnet_uint32_t domain_len = fnet_strlen(domain_name) + 1; fnet_uint32_t len = 0; - fnet_index_t i; + fnet_index_t i; fnet_index_t p = 0; fnet_uint8_t *result = NULL; @@ -1898,7 +1898,7 @@ static void fnet_mdns_send_probe(fnet_mdns_if_t *mdns_if) } nscount++; #endif - + /* Prepare RR AAAA record */ ptr = fnet_mdns_add_rr_aaaa(mdns_if, ptr, (buf_end - ptr), mdns_if->rr_ttl_ip, FNET_FALSE, FNET_TRUE); if(ptr == NULL) @@ -2031,7 +2031,7 @@ static void fnet_mdns_send_response(fnet_mdns_if_t *mdns_if, fnet_uint32_t ttl, /* Answer records */ for(i = 0; iservice_if_list[i].service_type) + if(mdns_if->service_if_list[i].service_type) { /* Prepare TXT record */ if(mdns_if->service_if_list[i].response_type & FNET_MDNS_QUERY_TXT) @@ -2076,7 +2076,7 @@ static void fnet_mdns_send_response(fnet_mdns_if_t *mdns_if, fnet_uint32_t ttl, #if FNET_CFG_IP4 // Do not send A record in IPV6 only stack /* Prepare RR A record */ - if(mdns_if->response_type & FNET_MDNS_QUERY_A) + if(mdns_if->response_type & FNET_MDNS_QUERY_A) { ptr = fnet_mdns_add_rr_a(mdns_if, ptr, (buf_end - ptr), ttl, flush, FNET_TRUE); if(ptr == NULL) @@ -2108,7 +2108,7 @@ static void fnet_mdns_send_response(fnet_mdns_if_t *mdns_if, fnet_uint32_t ttl, o All address records (type "A" and "AAAA") named in the SRV rdata.*/ for(i = 0; iservice_if_list[i].service_type) + if(mdns_if->service_if_list[i].service_type) { if(mdns_if->service_if_list[i].response_type & FNET_MDNS_QUERY_PTR) { @@ -2442,7 +2442,7 @@ static fnet_uint8_t * fnet_mdns_add_rr_aaaa(fnet_mdns_if_t *mdns_if, fnet_uint8_ fnet_netif_ip6_addr_info_t addr_info = {.state = FNET_NETIF_IP6_ADDR_STATE_NOT_USED}; fnet_netif_get_ip6_addr (mdns_if->netif, 0u, &addr_info); /* Just get 1st address.*/ - + ptr = fnet_mdns_add_host_name(mdns_if, ptr, (buf+buf_size) - ptr, compression); if(ptr == NULL) { @@ -2522,7 +2522,7 @@ static fnet_uint8_t * fnet_mdns_add_host_name(fnet_mdns_if_t *mdns_if, fnet_uint { FNET_ASSERT(mdns_if != NULL); FNET_ASSERT(buf != NULL); - + fnet_uint8_t *ptr = buf; fnet_uint8_t *result = NULL; @@ -2541,7 +2541,7 @@ static fnet_uint8_t * fnet_mdns_add_host_name(fnet_mdns_if_t *mdns_if, fnet_uint { /* Offset, used by Domain Name Compression.*/ fnet_uint16_t offset = ptr - mdns_if->buffer; - + if(offset <= 0x3FFF) /* Check offset maximum value.*/ { mdns_if->offset_host_name = offset; @@ -2578,7 +2578,7 @@ static fnet_uint8_t * fnet_mdns_add_service_name(fnet_mdns_if_t *mdns_if, fnet_u { FNET_ASSERT(mdns_if != NULL); FNET_ASSERT(buf != NULL); - + fnet_uint16_t offset; fnet_uint8_t *ptr = buf; fnet_uint8_t *result = NULL; @@ -2700,14 +2700,14 @@ ERROR: } /************************************************************************ -* DESCRIPTION: Determines if host_name is our fully qualified domain +* DESCRIPTION: Determines if host_name is our fully qualified domain * name FQDN (hostname.domain). ************************************************************************/ static fnet_bool_t fnet_mdns_is_our_host_name(fnet_mdns_if_t *mdns_if, char *host_name) { FNET_ASSERT(mdns_if != NULL); - return fnet_mdns_cmp_rr_name(host_name, "", mdns_if->host_name); + return fnet_mdns_cmp_rr_name(host_name, "", mdns_if->host_name); } /************************************************************************ @@ -2722,7 +2722,7 @@ static fnet_mdns_service_if_t *fnet_mdns_get_service_by_name(fnet_mdns_if_t *mdn for(i = 0; iservice_if_list[i].service_type != NULL) + if(mdns_if->service_if_list[i].service_type != NULL) { if(fnet_mdns_cmp_rr_name(service_name, mdns_if->service_name, mdns_if->service_if_list[i].service_type) == FNET_TRUE) { @@ -2747,7 +2747,7 @@ static fnet_mdns_service_if_t *fnet_mdns_get_service_by_type(fnet_mdns_if_t *mdn for(i = 0; iservice_if_list[i].service_type != NULL) + if(mdns_if->service_if_list[i].service_type != NULL) { if(fnet_mdns_cmp_rr_name(service_name, "", mdns_if->service_if_list[i].service_type) == FNET_TRUE) { diff --git a/source/Service_Libs/mdns/fnet/fnet_stack/services/mdns/fnet_mdns.h b/source/Service_Libs/mdns/fnet/fnet_stack/services/mdns/fnet_mdns.h index ff3e2f7119..3c2cd12bf2 100644 --- a/source/Service_Libs/mdns/fnet/fnet_stack/services/mdns/fnet_mdns.h +++ b/source/Service_Libs/mdns/fnet/fnet_stack/services/mdns/fnet_mdns.h @@ -1,6 +1,6 @@ /************************************************************************** * -* Copyright (c) 2017, Arm Limited and affiliates. +* Copyright (c) 2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * Copyright 2016 by Andrey Butok. FNET Community. * @@ -71,7 +71,7 @@ struct fnet_mdns_params }; /**************************************************************************/ /*! - * @brief The mDNS Service structure defining application-specific + * @brief The mDNS Service structure defining application-specific * service, advertised by the mDNS server. * @see fnet_mdns_service_register() ******************************************************************************/ @@ -79,7 +79,7 @@ typedef struct fnet_mdns_service { const char* service_type; /**< @brief Service Type. Null-terminated string. Example "_http._tcp". */ fnet_uint16_t service_port; /**< @brief Service Port number (in network byte order). */ - const fnet_uint8_t* (*service_get_txt)(void); /**< @brief Call-back function, which returns a pointer to the service TXT record (null-terminated). + const fnet_uint8_t* (*service_get_txt)(void); /**< @brief Call-back function, which returns a pointer to the service TXT record (null-terminated). If the service does not provide any TXT record, this parameter must be set to NULL. */ } fnet_mdns_service_t; @@ -173,7 +173,7 @@ fnet_mdns_service_desc_t fnet_mdns_service_register(fnet_mdns_desc_t mdns_desc, ****************************************************************************** * * This function unregisters application service, assigned to the @c service_desc - * descriptor, and stops its advertisement by the mDNS server. + * descriptor, and stops its advertisement by the mDNS server. * ******************************************************************************/ void fnet_mdns_service_unregister(fnet_mdns_service_desc_t service_desc); @@ -189,7 +189,7 @@ void fnet_mdns_service_unregister(fnet_mdns_service_desc_t service_desc); ****************************************************************************** * * This function sends unsolicited mDNS announcement.@n - * Application may call it when any advertised application-specific parameter + * Application may call it when any advertised application-specific parameter * has changed (e.g. network interface IP address or service TXT-record content).@n * RFC 6762: "At any time, if the rdata of any of a host's Multicast DNS records * changes, the host MUST repeat the Announcing step to diff --git a/source/Service_Libs/mdns/fnet/fnet_stack/services/poll/fnet_poll.c b/source/Service_Libs/mdns/fnet/fnet_stack/services/poll/fnet_poll.c index 8dbd864af9..608d7b5729 100644 --- a/source/Service_Libs/mdns/fnet/fnet_stack/services/poll/fnet_poll.c +++ b/source/Service_Libs/mdns/fnet/fnet_stack/services/poll/fnet_poll.c @@ -1,5 +1,5 @@ /************************************************************************** -* Copyright (c) 2017, Arm Limited and affiliates. +* Copyright (c) 2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * Copyright 2011-2016 by Andrey Butok. FNET Community. * Copyright 2008-2010 by Andrey Butok. Freescale Semiconductor, Inc. diff --git a/source/Service_Libs/mdns/fnet/fnet_stack/services/serial/fnet_serial.h b/source/Service_Libs/mdns/fnet/fnet_stack/services/serial/fnet_serial.h index 3bfde79520..f2268124e0 100644 --- a/source/Service_Libs/mdns/fnet/fnet_stack/services/serial/fnet_serial.h +++ b/source/Service_Libs/mdns/fnet/fnet_stack/services/serial/fnet_serial.h @@ -1,6 +1,6 @@ /************************************************************************** * -* Copyright (c) 2017, Arm Limited and affiliates. +* Copyright (c) 2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * Copyright 2011-2016 by Andrey Butok. FNET Community. * Copyright 2008-2010 by Andrey Butok. Freescale Semiconductor, Inc. diff --git a/source/Service_Libs/mdns/fnet/fnet_stack/stack/fnet_debug.h b/source/Service_Libs/mdns/fnet/fnet_stack/stack/fnet_debug.h index b918c9b10b..fa26aa6bd8 100644 --- a/source/Service_Libs/mdns/fnet/fnet_stack/stack/fnet_debug.h +++ b/source/Service_Libs/mdns/fnet/fnet_stack/stack/fnet_debug.h @@ -1,6 +1,6 @@ /************************************************************************** * -* Copyright (c) 2017, Arm Limited and affiliates. +* Copyright (c) 2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * Copyright 2011-2016 by Andrey Butok. FNET Community. * Copyright 2008-2010 by Andrey Butok. Freescale Semiconductor, Inc. diff --git a/source/Service_Libs/mdns/fnet/fnet_stack/stack/fnet_stdlib.c b/source/Service_Libs/mdns/fnet/fnet_stack/stack/fnet_stdlib.c index 61c2580ce4..0627d706b2 100644 --- a/source/Service_Libs/mdns/fnet/fnet_stack/stack/fnet_stdlib.c +++ b/source/Service_Libs/mdns/fnet/fnet_stack/stack/fnet_stdlib.c @@ -1,6 +1,6 @@ /************************************************************************** * -* Copyright (c) 2017, Arm Limited and affiliates. +* Copyright (c) 2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * Copyright 2011-2016 by Andrey Butok. FNET Community. * Copyright 2008-2010 by Freescale Semiconductor, Inc. diff --git a/source/Service_Libs/mdns/fnet_user_config.h b/source/Service_Libs/mdns/fnet_user_config.h index 3c74283898..d94de3e1a7 100644 --- a/source/Service_Libs/mdns/fnet_user_config.h +++ b/source/Service_Libs/mdns/fnet_user_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Arm Limited and affiliates. + * Copyright (c) 2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/mdns/ns_fnet_events.c b/source/Service_Libs/mdns/ns_fnet_events.c index 1749e7b258..71e150010d 100644 --- a/source/Service_Libs/mdns/ns_fnet_events.c +++ b/source/Service_Libs/mdns/ns_fnet_events.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018, Arm Limited and affiliates. + * Copyright (c) 2017-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/mdns/ns_fnet_events.h b/source/Service_Libs/mdns/ns_fnet_events.h index 9a3afae865..ded8a0207e 100644 --- a/source/Service_Libs/mdns/ns_fnet_events.h +++ b/source/Service_Libs/mdns/ns_fnet_events.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Arm Limited and affiliates. + * Copyright (c) 2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/mdns/ns_fnet_port.c b/source/Service_Libs/mdns/ns_fnet_port.c index 456a2f200e..5b7dc1553d 100644 --- a/source/Service_Libs/mdns/ns_fnet_port.c +++ b/source/Service_Libs/mdns/ns_fnet_port.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019, Arm Limited and affiliates. + * Copyright (c) 2017-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/mdns/ns_fnet_types.h b/source/Service_Libs/mdns/ns_fnet_types.h index 6609d381e4..9d8c9ed914 100644 --- a/source/Service_Libs/mdns/ns_fnet_types.h +++ b/source/Service_Libs/mdns/ns_fnet_types.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Arm Limited and affiliates. + * Copyright (c) 2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/mdns/ns_mdns_api.c b/source/Service_Libs/mdns/ns_mdns_api.c index e0c8958146..2afb44fffa 100644 --- a/source/Service_Libs/mdns/ns_mdns_api.c +++ b/source/Service_Libs/mdns/ns_mdns_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018, Arm Limited and affiliates. + * Copyright (c) 2017-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/mle_service/mle_service.c b/source/Service_Libs/mle_service/mle_service.c index 37e53276fe..27ff6fda9a 100644 --- a/source/Service_Libs/mle_service/mle_service.c +++ b/source/Service_Libs/mle_service/mle_service.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2019, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/mle_service/mle_service_api.h b/source/Service_Libs/mle_service/mle_service_api.h index 76a91950dc..d22f2b5e47 100644 --- a/source/Service_Libs/mle_service/mle_service_api.h +++ b/source/Service_Libs/mle_service/mle_service_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2019, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/mle_service/mle_service_buffer.c b/source/Service_Libs/mle_service/mle_service_buffer.c index 834f96edf0..ec115fde19 100644 --- a/source/Service_Libs/mle_service/mle_service_buffer.c +++ b/source/Service_Libs/mle_service/mle_service_buffer.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/mle_service/mle_service_buffer.h b/source/Service_Libs/mle_service/mle_service_buffer.h index 4f10475920..3c16bd309b 100644 --- a/source/Service_Libs/mle_service/mle_service_buffer.h +++ b/source/Service_Libs/mle_service/mle_service_buffer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/mle_service/mle_service_frame_counter_table.c b/source/Service_Libs/mle_service/mle_service_frame_counter_table.c index 14af37f30d..161d1388d2 100644 --- a/source/Service_Libs/mle_service/mle_service_frame_counter_table.c +++ b/source/Service_Libs/mle_service/mle_service_frame_counter_table.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, Arm Limited and affiliates. + * Copyright (c) 2018-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/mle_service/mle_service_frame_counter_table.h b/source/Service_Libs/mle_service/mle_service_frame_counter_table.h index 3505a5f458..4b0fab63fa 100644 --- a/source/Service_Libs/mle_service/mle_service_frame_counter_table.h +++ b/source/Service_Libs/mle_service/mle_service_frame_counter_table.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Arm Limited and affiliates. + * Copyright (c) 2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/mle_service/mle_service_interface.c b/source/Service_Libs/mle_service/mle_service_interface.c index 63ce08e351..4709e51041 100644 --- a/source/Service_Libs/mle_service/mle_service_interface.c +++ b/source/Service_Libs/mle_service/mle_service_interface.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Arm Limited and affiliates. + * Copyright (c) 2015-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/mle_service/mle_service_interface.h b/source/Service_Libs/mle_service/mle_service_interface.h index 32166cf343..b42c175876 100644 --- a/source/Service_Libs/mle_service/mle_service_interface.h +++ b/source/Service_Libs/mle_service/mle_service_interface.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/mle_service/mle_service_security.c b/source/Service_Libs/mle_service/mle_service_security.c index 33c11d2e48..bcb8cf2949 100644 --- a/source/Service_Libs/mle_service/mle_service_security.c +++ b/source/Service_Libs/mle_service/mle_service_security.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2019, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/mle_service/mle_service_security.h b/source/Service_Libs/mle_service/mle_service_security.h index 1d3e3f033e..1be73812c6 100644 --- a/source/Service_Libs/mle_service/mle_service_security.h +++ b/source/Service_Libs/mle_service/mle_service_security.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/nd_proxy/nd_proxy.c b/source/Service_Libs/nd_proxy/nd_proxy.c index d1501b865a..6d75180313 100644 --- a/source/Service_Libs/nd_proxy/nd_proxy.c +++ b/source/Service_Libs/nd_proxy/nd_proxy.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/nd_proxy/nd_proxy.h b/source/Service_Libs/nd_proxy/nd_proxy.h index 004d10f325..66ef803308 100644 --- a/source/Service_Libs/nd_proxy/nd_proxy.h +++ b/source/Service_Libs/nd_proxy/nd_proxy.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2018, 2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/nist_aes_kw/nist_aes_kw.c b/source/Service_Libs/nist_aes_kw/nist_aes_kw.c index 5345c0deda..98f6a69812 100644 --- a/source/Service_Libs/nist_aes_kw/nist_aes_kw.c +++ b/source/Service_Libs/nist_aes_kw/nist_aes_kw.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/nist_aes_kw/nist_aes_kw.h b/source/Service_Libs/nist_aes_kw/nist_aes_kw.h index 9f2eed8aab..216787cacb 100644 --- a/source/Service_Libs/nist_aes_kw/nist_aes_kw.h +++ b/source/Service_Libs/nist_aes_kw/nist_aes_kw.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/pan_blacklist/pan_blacklist.c b/source/Service_Libs/pan_blacklist/pan_blacklist.c index 0efcffc970..7fe33be24d 100644 --- a/source/Service_Libs/pan_blacklist/pan_blacklist.c +++ b/source/Service_Libs/pan_blacklist/pan_blacklist.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018, Arm Limited and affiliates. + * Copyright (c) 2017-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/pan_blacklist/pan_blacklist_api.h b/source/Service_Libs/pan_blacklist/pan_blacklist_api.h index f71cd80014..1c1a007e97 100644 --- a/source/Service_Libs/pan_blacklist/pan_blacklist_api.h +++ b/source/Service_Libs/pan_blacklist/pan_blacklist_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Arm Limited and affiliates. + * Copyright (c) 2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/random_early_detection/random_early_detection.c b/source/Service_Libs/random_early_detection/random_early_detection.c index b1a4b73d74..2dd82535df 100644 --- a/source/Service_Libs/random_early_detection/random_early_detection.c +++ b/source/Service_Libs/random_early_detection/random_early_detection.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Arm Limited and affiliates. + * Copyright (c) 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/random_early_detection/random_early_detection.h b/source/Service_Libs/random_early_detection/random_early_detection.h index 9f81ed660c..fc4ede2e00 100644 --- a/source/Service_Libs/random_early_detection/random_early_detection.h +++ b/source/Service_Libs/random_early_detection/random_early_detection.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Arm Limited and affiliates. + * Copyright (c) 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/random_early_detection/random_early_detection_api.h b/source/Service_Libs/random_early_detection/random_early_detection_api.h index dcefc35ec8..9fe9e595f4 100644 --- a/source/Service_Libs/random_early_detection/random_early_detection_api.h +++ b/source/Service_Libs/random_early_detection/random_early_detection_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Arm Limited and affiliates. + * Copyright (c) 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/utils/isqrt.c b/source/Service_Libs/utils/isqrt.c index 85ca0c07f3..3b087d2b44 100644 --- a/source/Service_Libs/utils/isqrt.c +++ b/source/Service_Libs/utils/isqrt.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/utils/isqrt.h b/source/Service_Libs/utils/isqrt.h index 373a74244a..7d5f7d495b 100644 --- a/source/Service_Libs/utils/isqrt.h +++ b/source/Service_Libs/utils/isqrt.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2015, 2017-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2015, 2017-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/utils/ns_conf.c b/source/Service_Libs/utils/ns_conf.c index affc32cc8b..e6f105c0e3 100644 --- a/source/Service_Libs/utils/ns_conf.c +++ b/source/Service_Libs/utils/ns_conf.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018, Arm Limited and affiliates. + * Copyright (c) 2017-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/utils/ns_crc.c b/source/Service_Libs/utils/ns_crc.c index 40e85f96f2..505f3bee99 100644 --- a/source/Service_Libs/utils/ns_crc.c +++ b/source/Service_Libs/utils/ns_crc.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017-2018, Arm Limited and affiliates. + * Copyright (c) 2015, 2017-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/utils/ns_crc.h b/source/Service_Libs/utils/ns_crc.h index 92fad32272..4011fb33a4 100644 --- a/source/Service_Libs/utils/ns_crc.h +++ b/source/Service_Libs/utils/ns_crc.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/utils/ns_file.h b/source/Service_Libs/utils/ns_file.h index 8ba32133a6..0ec436c59d 100644 --- a/source/Service_Libs/utils/ns_file.h +++ b/source/Service_Libs/utils/ns_file.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Arm Limited and affiliates. + * Copyright (c) 2017, 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/utils/ns_file_system.c b/source/Service_Libs/utils/ns_file_system.c index a7202ccdd0..729f7eaf4a 100644 --- a/source/Service_Libs/utils/ns_file_system.c +++ b/source/Service_Libs/utils/ns_file_system.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018, Arm Limited and affiliates. + * Copyright (c) 2017-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/utils/ns_time.c b/source/Service_Libs/utils/ns_time.c new file mode 100644 index 0000000000..9e8bf761b3 --- /dev/null +++ b/source/Service_Libs/utils/ns_time.c @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2021, Pelion and affiliates. + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include "ns_types.h" +#include "ns_time_api.h" //ns_time_api_system_time_callback + +static ns_time_api_system_time_callback *system_time_read_callback = NULL; +static ns_time_api_system_time_write_callback *system_time_write_callback = NULL; + +void ns_time_api_system_time_callback_set(ns_time_api_system_time_callback callback_rd) +{ + system_time_read_callback = callback_rd; +} + +void ns_time_api_system_time_write_callback_set(ns_time_api_system_time_write_callback callback_wr) +{ + system_time_write_callback = callback_wr; +} + +int ns_time_system_time_write(uint64_t time_write) +{ + if (system_time_write_callback) { + system_time_write_callback(time_write); + return 0; + } + + return -1; +} + +int ns_time_system_time_read(uint64_t *time_read) +{ + if (system_time_read_callback && time_read) { + uint64_t new_time = system_time_read_callback(); + *time_read = new_time; + return 0; + } + + return -1; +} diff --git a/source/Service_Libs/utils/ns_time.h b/source/Service_Libs/utils/ns_time.h new file mode 100644 index 0000000000..27299ce0bb --- /dev/null +++ b/source/Service_Libs/utils/ns_time.h @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2021, Pelion and affiliates. + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef _NS_TIME_H_ +#define _NS_TIME_H_ + +/** + * \file ns_time.h + * \brief Nanostack internal time handling API. + */ + +/** + * Write new time as a platform time + * + * Write a new time to platform provided time system. + * Platform time callbacks must be set by using method ns_time_api_system_time_callbacks_set. + * + * \param time_write time to be written as a new system time. + * + * \return 0 in success. + * \return <0 in case of errors. + * + */ +int ns_time_system_time_write(uint64_t time_write); + +/** + * Read platform time from a time callback + * + * Read a new time from time system provided by the platform. + * Platform time callbacks must be set by using the method ns_time_api_system_time_callbacks_set. + * + * \param time_read Address to variable where new time will be written. + * + * \return 0 in success. + * \return <0 in case of errors. + * + */ +int ns_time_system_time_read(uint64_t *time_read); + + + +#endif /* _NS_TIME_H_ */ diff --git a/source/Service_Libs/whiteboard/whiteboard.c b/source/Service_Libs/whiteboard/whiteboard.c index eb6c205bdb..7f9f723498 100644 --- a/source/Service_Libs/whiteboard/whiteboard.c +++ b/source/Service_Libs/whiteboard/whiteboard.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2018, Arm Limited and affiliates. + * Copyright (c) 2013-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/Service_Libs/whiteboard/whiteboard.h b/source/Service_Libs/whiteboard/whiteboard.h index e3e22db395..a345ad794b 100644 --- a/source/Service_Libs/whiteboard/whiteboard.h +++ b/source/Service_Libs/whiteboard/whiteboard.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2019, Arm Limited and affiliates. + * Copyright (c) 2013-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/configs/base/cfg_ethernet.h b/source/configs/base/cfg_ethernet.h index 6c1b6c0156..bbede4f134 100644 --- a/source/configs/base/cfg_ethernet.h +++ b/source/configs/base/cfg_ethernet.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/configs/base/cfg_local_socket.h b/source/configs/base/cfg_local_socket.h index 4eed70c531..9863bb429c 100644 --- a/source/configs/base/cfg_local_socket.h +++ b/source/configs/base/cfg_local_socket.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/configs/base/cfg_lowpan_border_router.h b/source/configs/base/cfg_lowpan_border_router.h index 56b598e7f1..a84e36f619 100644 --- a/source/configs/base/cfg_lowpan_border_router.h +++ b/source/configs/base/cfg_lowpan_border_router.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/configs/base/cfg_lowpan_host.h b/source/configs/base/cfg_lowpan_host.h index 11484d1b45..edc1452ca4 100644 --- a/source/configs/base/cfg_lowpan_host.h +++ b/source/configs/base/cfg_lowpan_host.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/configs/base/cfg_lowpan_router.h b/source/configs/base/cfg_lowpan_router.h index 6dd4a93471..2da787699c 100644 --- a/source/configs/base/cfg_lowpan_router.h +++ b/source/configs/base/cfg_lowpan_router.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/configs/base/cfg_rf_tunnel.h b/source/configs/base/cfg_rf_tunnel.h index 6e6b09acb0..7b149ef345 100644 --- a/source/configs/base/cfg_rf_tunnel.h +++ b/source/configs/base/cfg_rf_tunnel.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/configs/base/cfg_thread_border_router.h b/source/configs/base/cfg_thread_border_router.h index be579f1e39..94bd589ee7 100644 --- a/source/configs/base/cfg_thread_border_router.h +++ b/source/configs/base/cfg_thread_border_router.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/configs/base/cfg_thread_end_device.h b/source/configs/base/cfg_thread_end_device.h index 4cab9f26a1..4bd01abb70 100644 --- a/source/configs/base/cfg_thread_end_device.h +++ b/source/configs/base/cfg_thread_end_device.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/configs/base/cfg_thread_full_end_device.h b/source/configs/base/cfg_thread_full_end_device.h index 7a605f4d1d..94a65ec352 100644 --- a/source/configs/base/cfg_thread_full_end_device.h +++ b/source/configs/base/cfg_thread_full_end_device.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/configs/base/cfg_thread_router.h b/source/configs/base/cfg_thread_router.h index a15d0ba5a3..216d897c61 100644 --- a/source/configs/base/cfg_thread_router.h +++ b/source/configs/base/cfg_thread_router.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/configs/base/cfg_ws_border_router.h b/source/configs/base/cfg_ws_border_router.h index d2fec89889..b3df78d00a 100644 --- a/source/configs/base/cfg_ws_border_router.h +++ b/source/configs/base/cfg_ws_border_router.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Arm Limited and affiliates. + * Copyright (c) 2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/configs/base/cfg_ws_router.h b/source/configs/base/cfg_ws_router.h index 4822bbc37e..a8a07c5700 100644 --- a/source/configs/base/cfg_ws_router.h +++ b/source/configs/base/cfg_ws_router.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Arm Limited and affiliates. + * Copyright (c) 2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/configs/cfg_ethernet_host.h b/source/configs/cfg_ethernet_host.h index 7a68772bc1..38ed1114c6 100644 --- a/source/configs/cfg_ethernet_host.h +++ b/source/configs/cfg_ethernet_host.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Arm Limited and affiliates. + * Copyright (c) 2016, 2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/configs/cfg_generic.h b/source/configs/cfg_generic.h index 9ed2d221e5..d17b137850 100644 --- a/source/configs/cfg_generic.h +++ b/source/configs/cfg_generic.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2014, 2016-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/configs/cfg_lowpan_border_router.h b/source/configs/cfg_lowpan_border_router.h index 6ec843c10e..589fa2755a 100644 --- a/source/configs/cfg_lowpan_border_router.h +++ b/source/configs/cfg_lowpan_border_router.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2016, 2018, Arm Limited and affiliates. + * Copyright (c) 2015-2016, 2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/configs/cfg_lowpan_border_router_rf_tunnel.h b/source/configs/cfg_lowpan_border_router_rf_tunnel.h index bad9374019..e5128b8799 100644 --- a/source/configs/cfg_lowpan_border_router_rf_tunnel.h +++ b/source/configs/cfg_lowpan_border_router_rf_tunnel.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/configs/cfg_lowpan_border_router_rf_tunnel_ecc.h b/source/configs/cfg_lowpan_border_router_rf_tunnel_ecc.h index 63fd2ca007..195cd83980 100644 --- a/source/configs/cfg_lowpan_border_router_rf_tunnel_ecc.h +++ b/source/configs/cfg_lowpan_border_router_rf_tunnel_ecc.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2016, 2018, Arm Limited and affiliates. + * Copyright (c) 2015-2016, 2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/configs/cfg_lowpan_border_router_rf_tunnel_ecc_release.h b/source/configs/cfg_lowpan_border_router_rf_tunnel_ecc_release.h index 2a7ae8bf99..c0df866a62 100644 --- a/source/configs/cfg_lowpan_border_router_rf_tunnel_ecc_release.h +++ b/source/configs/cfg_lowpan_border_router_rf_tunnel_ecc_release.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2016, 2018, Arm Limited and affiliates. + * Copyright (c) 2015-2016, 2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/configs/cfg_lowpan_host.h b/source/configs/cfg_lowpan_host.h index 03533192aa..36fd650020 100644 --- a/source/configs/cfg_lowpan_host.h +++ b/source/configs/cfg_lowpan_host.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2016, 2018, Arm Limited and affiliates. + * Copyright (c) 2015-2016, 2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/configs/cfg_lowpan_router.h b/source/configs/cfg_lowpan_router.h index b119cc3e9d..58449203e7 100644 --- a/source/configs/cfg_lowpan_router.h +++ b/source/configs/cfg_lowpan_router.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2016, 2018, Arm Limited and affiliates. + * Copyright (c) 2015-2016, 2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/configs/cfg_lowpan_router_ecc.h b/source/configs/cfg_lowpan_router_ecc.h index be863e9c5b..37dc24ef6f 100644 --- a/source/configs/cfg_lowpan_router_ecc.h +++ b/source/configs/cfg_lowpan_router_ecc.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/configs/cfg_lowpan_router_ecc_release.h b/source/configs/cfg_lowpan_router_ecc_release.h index f189344917..c1ddcb5315 100644 --- a/source/configs/cfg_lowpan_router_ecc_release.h +++ b/source/configs/cfg_lowpan_router_ecc_release.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/configs/cfg_nanostack_full.h b/source/configs/cfg_nanostack_full.h index 9aa6ba0738..0510e0cb3f 100644 --- a/source/configs/cfg_nanostack_full.h +++ b/source/configs/cfg_nanostack_full.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2016, 2018, Arm Limited and affiliates. + * Copyright (c) 2014-2016, 2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/configs/cfg_nanostack_full_debug.h b/source/configs/cfg_nanostack_full_debug.h index 980a0499e4..19658939a6 100644 --- a/source/configs/cfg_nanostack_full_debug.h +++ b/source/configs/cfg_nanostack_full_debug.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2016, 2018, Arm Limited and affiliates. + * Copyright (c) 2015-2016, 2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/configs/cfg_rf_interface.h b/source/configs/cfg_rf_interface.h index e4d1787adf..e046bcf4a7 100644 --- a/source/configs/cfg_rf_interface.h +++ b/source/configs/cfg_rf_interface.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/configs/cfg_thread_border_router.h b/source/configs/cfg_thread_border_router.h index bf0df9a149..0a992bd360 100644 --- a/source/configs/cfg_thread_border_router.h +++ b/source/configs/cfg_thread_border_router.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018, Arm Limited and affiliates. + * Copyright (c) 2015-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/configs/cfg_thread_end_device.h b/source/configs/cfg_thread_end_device.h index 1b7d93d89c..b4ae613d6a 100644 --- a/source/configs/cfg_thread_end_device.h +++ b/source/configs/cfg_thread_end_device.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Arm Limited and affiliates. + * Copyright (c) 2016, 2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/configs/cfg_thread_full_end_device.h b/source/configs/cfg_thread_full_end_device.h index 92ebdccc05..f14397da44 100644 --- a/source/configs/cfg_thread_full_end_device.h +++ b/source/configs/cfg_thread_full_end_device.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Arm Limited and affiliates. + * Copyright (c) 2016, 2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/configs/cfg_thread_router.h b/source/configs/cfg_thread_router.h index f348ccd5de..850b030bb2 100644 --- a/source/configs/cfg_thread_router.h +++ b/source/configs/cfg_thread_router.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2016, 2018, Arm Limited and affiliates. + * Copyright (c) 2015-2016, 2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/configs/cfg_thread_thci.h b/source/configs/cfg_thread_thci.h index ad66413a0a..d2257b0e71 100644 --- a/source/configs/cfg_thread_thci.h +++ b/source/configs/cfg_thread_thci.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/configs/cfg_ws_border_router.h b/source/configs/cfg_ws_border_router.h index 102890cc60..8927f82837 100644 --- a/source/configs/cfg_ws_border_router.h +++ b/source/configs/cfg_ws_border_router.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Arm Limited and affiliates. + * Copyright (c) 2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/configs/cfg_ws_router.h b/source/configs/cfg_ws_router.h index b3ce93f785..a4cf952501 100644 --- a/source/configs/cfg_ws_router.h +++ b/source/configs/cfg_ws_router.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Arm Limited and affiliates. + * Copyright (c) 2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/ipv6_stack/ipv6_routing_table.c b/source/ipv6_stack/ipv6_routing_table.c index 0cbc0a4065..d036455eca 100644 --- a/source/ipv6_stack/ipv6_routing_table.c +++ b/source/ipv6_stack/ipv6_routing_table.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2019, Arm Limited and affiliates. + * Copyright (c) 2012-2019, 2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/ipv6_stack/ipv6_routing_table.h b/source/ipv6_stack/ipv6_routing_table.h index ce7eb22476..735ab3f56b 100644 --- a/source/ipv6_stack/ipv6_routing_table.h +++ b/source/ipv6_stack/ipv6_routing_table.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2014-2019, Arm Limited and affiliates. + * Copyright (c) 2012, 2014-2019, 2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/ipv6_stack/protocol_ipv6.c b/source/ipv6_stack/protocol_ipv6.c index b7cd9218fa..6041ac623a 100644 --- a/source/ipv6_stack/protocol_ipv6.c +++ b/source/ipv6_stack/protocol_ipv6.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2019, Arm Limited and affiliates. + * Copyright (c) 2012-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/ipv6_stack/protocol_ipv6.h b/source/ipv6_stack/protocol_ipv6.h index 51bbc911a7..4370cdbee0 100644 --- a/source/ipv6_stack/protocol_ipv6.h +++ b/source/ipv6_stack/protocol_ipv6.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2018, 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/libDHCPv6/dhcp_service_api.c b/source/libDHCPv6/dhcp_service_api.c index 78dddce5ad..db8dd42ba2 100644 --- a/source/libDHCPv6/dhcp_service_api.c +++ b/source/libDHCPv6/dhcp_service_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2018, Arm Limited and affiliates. + * Copyright (c) 2013-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -75,7 +75,9 @@ typedef struct { void *client_obj_ptr; uint32_t msg_tr_id; uint32_t message_tr_id; + uint32_t transmit_time; uint32_t first_transmit_time; + uint16_t delayed_tx; uint16_t timeout; uint16_t timeout_init; uint16_t timeout_max; @@ -768,7 +770,7 @@ int dhcp_service_send_resp(uint32_t msg_tr_id, uint8_t options, uint8_t *msg_ptr dhcp_tr_delete(msg_tr_ptr); return 0; } -uint32_t dhcp_service_send_req(uint16_t instance_id, uint8_t options, void *ptr, const uint8_t addr[static 16], uint8_t *msg_ptr, uint16_t msg_len, dhcp_service_receive_resp_cb *receive_resp_cb) +uint32_t dhcp_service_send_req(uint16_t instance_id, uint8_t options, void *ptr, const uint8_t addr[static 16], uint8_t *msg_ptr, uint16_t msg_len, dhcp_service_receive_resp_cb *receive_resp_cb, uint16_t delay_tx) { tr_debug("Send DHCPv6 request"); msg_tr_t *msg_tr_ptr; @@ -792,7 +794,9 @@ uint32_t dhcp_service_send_req(uint16_t instance_id, uint8_t options, void *ptr, msg_tr_ptr->instance_id = instance_id; msg_tr_ptr->socket = dhcp_service->dhcp_client_socket; msg_tr_ptr->recv_resp_cb = receive_resp_cb; - msg_tr_ptr->first_transmit_time = protocol_core_monotonic_time; + msg_tr_ptr->delayed_tx = delay_tx; + msg_tr_ptr->first_transmit_time = 0; + msg_tr_ptr->transmit_time = 0; dhcp_tr_set_retry_timers(msg_tr_ptr, msg_tr_ptr->msg_ptr[0]); common_write_24_bit(msg_tr_ptr->msg_tr_id, &msg_tr_ptr->msg_ptr[1]); @@ -824,6 +828,16 @@ void dhcp_service_update_server_address(uint32_t msg_tr_id, uint8_t *server_addr } } +uint32_t dhcp_service_rtt_get(uint32_t msg_tr_id) +{ + msg_tr_t *msg_tr_ptr = dhcp_tr_find(msg_tr_id); + + if (msg_tr_ptr && msg_tr_ptr->transmit_time) { + return protocol_core_monotonic_time - msg_tr_ptr->transmit_time; + } + return 0; +} + void dhcp_service_req_remove(uint32_t msg_tr_id) { if (dhcp_service) { @@ -850,8 +864,9 @@ void dhcp_service_send_message(msg_tr_t *msg_tr_ptr) const uint32_t address_pref = SOCKET_IPV6_PREFER_SRC_6LOWPAN_SHORT; dhcp_options_msg_t elapsed_time; - if (libdhcpv6_message_option_discover((msg_tr_ptr->msg_ptr + 4), (msg_tr_ptr->msg_len - 4), DHCPV6_ELAPSED_TIME_OPTION, &elapsed_time) == 0 && + if (msg_tr_ptr->first_transmit_time && libdhcpv6_message_option_discover((msg_tr_ptr->msg_ptr + 4), (msg_tr_ptr->msg_len - 4), DHCPV6_ELAPSED_TIME_OPTION, &elapsed_time) == 0 && elapsed_time.len == 2) { + uint32_t t = protocol_core_monotonic_time - msg_tr_ptr->first_transmit_time; // time in 1/10s ticks uint16_t cs; if (t > 0xffff / 10) { @@ -911,12 +926,25 @@ void dhcp_service_send_message(msg_tr_t *msg_tr_ptr) uint8_t *ptr = msg_tr_ptr->relay_start; *ptr = DHCPV6_RELAY_REPLY; - retval = socket_sendmsg(msg_tr_ptr->socket, &msghdr, NS_MSG_LEGACY0); + if (msg_tr_ptr->delayed_tx) { + retval = 0; + } else { + retval = socket_sendmsg(msg_tr_ptr->socket, &msghdr, NS_MSG_LEGACY0); + } } else { - int16_t tc = 0; - socket_setsockopt(msg_tr_ptr->socket, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_TCLASS, &tc, sizeof(tc)); - retval = socket_sendto(msg_tr_ptr->socket, &msg_tr_ptr->addr, msg_tr_ptr->msg_ptr, msg_tr_ptr->msg_len); + if (msg_tr_ptr->delayed_tx) { + retval = 0; + } else { + int16_t tc = 0; + socket_setsockopt(msg_tr_ptr->socket, SOCKET_IPPROTO_IPV6, SOCKET_IPV6_TCLASS, &tc, sizeof(tc)); + retval = socket_sendto(msg_tr_ptr->socket, &msg_tr_ptr->addr, msg_tr_ptr->msg_ptr, msg_tr_ptr->msg_len); + msg_tr_ptr->transmit_time = protocol_core_monotonic_time ? protocol_core_monotonic_time : 1; + if (msg_tr_ptr->first_transmit_time == 0 && retval == 0) { + //Mark first pushed message timestamp + msg_tr_ptr->first_transmit_time = protocol_core_monotonic_time ? protocol_core_monotonic_time : 1; + } + } } if (retval != 0) { tr_warn("dhcp service socket_sendto fails: %i", retval); @@ -928,6 +956,18 @@ bool dhcp_service_timer_tick(uint16_t ticks) { bool activeTimerNeed = false; ns_list_foreach_safe(msg_tr_t, cur_ptr, &dhcp_service->tr_list) { + + if (cur_ptr->delayed_tx) { + activeTimerNeed = true; + if (cur_ptr->delayed_tx <= ticks) { + cur_ptr->delayed_tx = 0; + dhcp_service_send_message(cur_ptr); + } else { + cur_ptr->delayed_tx -= ticks; + } + continue; + } + if (cur_ptr->timeout == 0) { continue; } @@ -1023,7 +1063,7 @@ int dhcp_service_send_resp(uint32_t msg_tr_id, uint8_t options, uint8_t *msg_ptr return -1; } -uint32_t dhcp_service_send_req(uint16_t instance_id, uint8_t options, void *ptr, const uint8_t addr[static 16], uint8_t *msg_ptr, uint16_t msg_len, dhcp_service_receive_resp_cb *receive_resp_cb) +uint32_t dhcp_service_send_req(uint16_t instance_id, uint8_t options, void *ptr, const uint8_t addr[static 16], uint8_t *msg_ptr, uint16_t msg_len, dhcp_service_receive_resp_cb *receive_resp_cb, uint16_t delay_tx) { (void)instance_id; (void)options; @@ -1032,6 +1072,7 @@ uint32_t dhcp_service_send_req(uint16_t instance_id, uint8_t options, void *ptr, (void)msg_ptr; (void)msg_len; (void)receive_resp_cb; + (void)delay_tx; return 0; } diff --git a/source/libDHCPv6/libDHCPv6.c b/source/libDHCPv6/libDHCPv6.c index abc29b2272..4c32076c4b 100644 --- a/source/libDHCPv6/libDHCPv6.c +++ b/source/libDHCPv6/libDHCPv6.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019, Arm Limited and affiliates. + * Copyright (c) 2014-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/libDHCPv6/libDHCPv6.h b/source/libDHCPv6/libDHCPv6.h index 5910bab190..247a251ee5 100644 --- a/source/libDHCPv6/libDHCPv6.h +++ b/source/libDHCPv6/libDHCPv6.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2015, 2017-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2015, 2017-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/libDHCPv6/libDHCPv6_server.c b/source/libDHCPv6/libDHCPv6_server.c index 858d2f0931..87bdfe5a93 100644 --- a/source/libDHCPv6/libDHCPv6_server.c +++ b/source/libDHCPv6/libDHCPv6_server.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019, Arm Limited and affiliates. + * Copyright (c) 2014-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -461,12 +461,12 @@ dhcpv6_vendor_data_t *libdhcpv6_vendor_data_allocate(dhcpv6_gua_server_entry_s * } ns_list_add_to_end(&serverInfo->vendorDataList, entry); entry->enterprise_number = enterprise_number; + entry->vendor_data_cb = NULL; entry->vendor_data = NULL; entry->vendor_data_length = 0; return entry; } - uint16_t libdhcpv6_dns_server_message_sizes(dhcpv6_gua_server_entry_s *serverInfo) { uint16_t message_size = 0; @@ -482,7 +482,13 @@ uint16_t libdhcpv6_vendor_data_message_sizes(dhcpv6_gua_server_entry_s *serverIn { uint16_t message_size = 0; ns_list_foreach(dhcpv6_vendor_data_t, cur, &serverInfo->vendorDataList) { - message_size += 4 + 4 + cur->vendor_data_length; //Type + Length + enterprise + vendor_data_length + uint16_t size = cur->vendor_data_length; //Type + Length + enterprise + vendor_data_length + if (cur->vendor_data_cb) { + cur->vendor_data_cb(serverInfo->interfaceId, NULL, &size); + } + if (size != 0) { + message_size += 2 + 2 + 4 + size; + } } return message_size; } @@ -510,7 +516,17 @@ uint8_t *libdhcpv6_vendor_data_message_writes(dhcpv6_gua_server_entry_s *serverI { ns_list_foreach(dhcpv6_vendor_data_t, cur, &serverInfo->vendorDataList) { - uint16_t length = cur->vendor_data_length + 4; + uint16_t length = cur->vendor_data_length; + + if (cur->vendor_data_cb) { + cur->vendor_data_cb(serverInfo->interfaceId, NULL, &length); + } + if (length == 0) { + // No vendor data + continue; + } + length += 4; + ptr = common_write_16_bit(DHCPV6_OPTION_VENDOR_SPECIFIC_INFO, ptr); ptr = common_write_16_bit(length, ptr); //Length ptr = common_write_32_bit(cur->enterprise_number, ptr); @@ -518,6 +534,9 @@ uint8_t *libdhcpv6_vendor_data_message_writes(dhcpv6_gua_server_entry_s *serverI memcpy(ptr, cur->vendor_data, cur->vendor_data_length); ptr += cur->vendor_data_length; } + if (cur->vendor_data_cb) { + ptr = cur->vendor_data_cb(serverInfo->interfaceId, ptr, NULL); + } } return ptr; } diff --git a/source/libDHCPv6/libDHCPv6_server.h b/source/libDHCPv6/libDHCPv6_server.h index 4dab618b92..f7615ba7da 100644 --- a/source/libDHCPv6/libDHCPv6_server.h +++ b/source/libDHCPv6/libDHCPv6_server.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2015, 2017-2018, Arm Limited and affiliates. + * Copyright (c) 2014-2015, 2017-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -32,6 +32,8 @@ #define DHCP_ADDRESS_ID_START 2 typedef void (dhcp_address_prefer_remove_cb)(int8_t interfaceId, uint8_t *targetAddress, void *prefix_info); +typedef uint8_t *(dhcp_vendor_data_cb)(int8_t interfaceId, uint8_t *ptr, uint16_t *dhcp_vendor_data_len); + typedef struct dhcpv6_allocated_address_entry_s { uint8_t linkId[8]; /*!< Services UL64 */ @@ -54,8 +56,9 @@ typedef struct dhcpv6_dns_server_data_s { typedef struct dhcpv6_vendor_data_s { uint32_t enterprise_number; + dhcp_vendor_data_cb *vendor_data_cb; // Additional vendor data that can be set for individual reply uint8_t *vendor_data; - uint8_t vendor_data_length; + uint16_t vendor_data_length; ns_list_link_t link; /*!< List link entry */ } dhcpv6_vendor_data_t; diff --git a/source/libDHCPv6/libDHCPv6_vendordata.c b/source/libDHCPv6/libDHCPv6_vendordata.c index 2854517d5e..fb6b909c7c 100644 --- a/source/libDHCPv6/libDHCPv6_vendordata.c +++ b/source/libDHCPv6/libDHCPv6_vendordata.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Arm Limited and affiliates. + * Copyright (c) 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -98,3 +98,61 @@ uint16_t net_dns_option_vendor_option_data_dns_query_read(uint8_t *ptr, uint16_t } return option_len; } + +uint16_t net_vendor_option_current_time_length(void) +{ + return 4 + 3 * sizeof(uint32_t); +} + +uint8_t *net_vendor_option_current_time_write(uint8_t *ptr, int32_t era, uint32_t offset, uint32_t fraction) +{ + /* + * Time value written using NTP time format + * Following rfc5905 + */ + + ptr = common_write_16_bit(ARM_DHCP_VENDOR_DATA_NETWORK_TIME, ptr); + ptr = common_write_16_bit(3 * sizeof(uint32_t), ptr); + ptr = common_write_32_bit((uint32_t)era, ptr); + ptr = common_write_32_bit(offset, ptr); + ptr = common_write_32_bit(fraction, ptr); + return ptr; +} + +uint8_t *net_vendor_option_current_time_read(uint8_t *ptr, uint16_t length, int32_t *era, uint32_t *offset, uint32_t *fraction) +{ + /* + * Time value written using NTP time format + * Following rfc5905 + */ + uint16_t option_len; + + if (length < net_vendor_option_current_time_length()) { + // Corrupted as there is no room for all fields + return 0; + } + + if (common_read_16_bit(ptr) != ARM_DHCP_VENDOR_DATA_NETWORK_TIME) { + return 0; + } + + option_len = common_read_16_bit(ptr + 2); + ptr += 4; + + if (option_len < 3 * sizeof(uint32_t)) { + // Corrupted as not enough room for fields + return 0; + } + + if (era) { + *era = (int32_t)common_read_32_bit(ptr); + } + if (offset) { + *offset = common_read_32_bit(ptr + sizeof(uint32_t)); + } + if (fraction) { + *fraction = common_read_32_bit(ptr + 2 * sizeof(uint32_t)); + } + + return ptr; +} diff --git a/source/libDHCPv6/libDHCPv6_vendordata.h b/source/libDHCPv6/libDHCPv6_vendordata.h index 1a1ef44f7f..a9974e8862 100644 --- a/source/libDHCPv6/libDHCPv6_vendordata.h +++ b/source/libDHCPv6/libDHCPv6_vendordata.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Arm Limited and affiliates. + * Copyright (c) 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -32,6 +32,40 @@ * */ #define ARM_DHCP_VENDOR_DATA_DNS_QUERY_RESULT 297 +/* ARM Defined vendor data option to distribute network time through DHCP server + * Format. This can be used to syncronice the times of Wi-SUN devices to match the + * time of border router. + * + * Following rfc5905 date format. + * +-------------+------------+-----+---------------+------------------+ + * | Date | MJD | NTP | NTP Timestamp | Epoch | + * | | | Era | Era Offset | | + * +-------------+------------+-----+---------------+------------------+ + * | 1 Jan -4712 | -2,400,001 | -49 | 1,795,583,104 | 1st day Julian | + * | 1 Jan -1 | -679,306 | -14 | 139,775,744 | 2 BCE | + * | 1 Jan 0 | -678,491 | -14 | 171,311,744 | 1 BCE | + * | 1 Jan 1 | -678,575 | -14 | 202,939,144 | 1 CE | + * | 4 Oct 1582 | -100,851 | -3 | 2,873,647,488 | Last day Julian | + * | 15 Oct 1582 | -100,840 | -3 | 2,874,597,888 | First day | + * | | | | | Gregorian | + * | 31 Dec 1899 | 15019 | -1 | 4,294,880,896 | Last day NTP Era | + * | | | | | -1 | + * | 1 Jan 1900 | 15020 | 0 | 0 | First day NTP | + * | | | | | Era 0 | + * | 1 Jan 1970 | 40,587 | 0 | 2,208,988,800 | First day UNIX | + * | 1 Jan 1972 | 41,317 | 0 | 2,272,060,800 | First day UTC | + * | 31 Dec 1999 | 51,543 | 0 | 3,155,587,200 | Last day 20th | + * | | | | | Century | + * | 8 Feb 2036 | 64,731 | 1 | 63,104 | First day NTP | + * | | | | | Era 1 | + * +-------------+------------+-----+---------------+------------------+ + * int32_t Era + * uint32_t offset + * uint32_t fraction + * + * */ +#define ARM_DHCP_VENDOR_DATA_NETWORK_TIME 298 + /* DHCPv6 vendor options to distribute ARM vendor data*/ uint16_t net_dns_option_vendor_option_data_dns_query_length(char *domain); @@ -40,5 +74,9 @@ uint8_t *net_dns_option_vendor_option_data_dns_query_write(uint8_t *ptr, uint8_t uint16_t net_dns_option_vendor_option_data_get_next(uint8_t *ptr, uint16_t length, uint16_t *type); uint16_t net_dns_option_vendor_option_data_dns_query_read(uint8_t *ptr, uint16_t length, uint8_t **address, char **domain); +uint16_t net_vendor_option_current_time_length(void); +uint8_t *net_vendor_option_current_time_write(uint8_t *ptr, int32_t era, uint32_t offset, uint32_t fraction); +uint8_t *net_vendor_option_current_time_read(uint8_t *ptr, uint16_t length, int32_t *era, uint32_t *offset, uint32_t *fraction); + #endif /* LIBDHCPV6_VENDOR_DATA_H_ */ diff --git a/source/libNET/src/multicast_api.c b/source/libNET/src/multicast_api.c index 2f654dacb5..dfc64cf97c 100644 --- a/source/libNET/src/multicast_api.c +++ b/source/libNET/src/multicast_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018, Arm Limited and affiliates. + * Copyright (c) 2017-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/libNET/src/net_6lowpan_parameter_api.c b/source/libNET/src/net_6lowpan_parameter_api.c index cd1649df3c..776c09f069 100644 --- a/source/libNET/src/net_6lowpan_parameter_api.c +++ b/source/libNET/src/net_6lowpan_parameter_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/libNET/src/net_dns.c b/source/libNET/src/net_dns.c index 7975ba89b6..7e4dc8d78c 100644 --- a/source/libNET/src/net_dns.c +++ b/source/libNET/src/net_dns.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Arm Limited and affiliates. + * Copyright (c) 2020-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/libNET/src/net_dns_internal.h b/source/libNET/src/net_dns_internal.h index bd58dbb51b..7f2d15ef31 100644 --- a/source/libNET/src/net_dns_internal.h +++ b/source/libNET/src/net_dns_internal.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Arm Limited and affiliates. + * Copyright (c) 2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/libNET/src/net_ipv6.c b/source/libNET/src/net_ipv6.c index f990c1b2b3..b9387b2d4c 100644 --- a/source/libNET/src/net_ipv6.c +++ b/source/libNET/src/net_ipv6.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/libNET/src/net_load_balance.c b/source/libNET/src/net_load_balance.c index a643d90fde..7dbbe1ae29 100644 --- a/source/libNET/src/net_load_balance.c +++ b/source/libNET/src/net_load_balance.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, Arm Limited and affiliates. + * Copyright (c) 2016-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/libNET/src/net_load_balance_internal.h b/source/libNET/src/net_load_balance_internal.h index 7c073eb4fe..2b3dd926ee 100644 --- a/source/libNET/src/net_load_balance_internal.h +++ b/source/libNET/src/net_load_balance_internal.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017, Arm Limited and affiliates. + * Copyright (c) 2016-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/libNET/src/net_mle.c b/source/libNET/src/net_mle.c index 39be3ee252..58c4776c49 100644 --- a/source/libNET/src/net_mle.c +++ b/source/libNET/src/net_mle.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017, 2019, Arm Limited and affiliates. + * Copyright (c) 2016-2017, 2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/libNET/src/net_rpl.c b/source/libNET/src/net_rpl.c index 70e26a5c29..e15dcdc7ac 100644 --- a/source/libNET/src/net_rpl.c +++ b/source/libNET/src/net_rpl.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019, Arm Limited and affiliates. + * Copyright (c) 2014-2019, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/libNET/src/net_short_address_extension.c b/source/libNET/src/net_short_address_extension.c index 3af8a11a6e..32e64edb5a 100644 --- a/source/libNET/src/net_short_address_extension.c +++ b/source/libNET/src/net_short_address_extension.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017, Arm Limited and affiliates. + * Copyright (c) 2014-2017, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/libNET/src/net_test.c b/source/libNET/src/net_test.c index 89cb141eaf..ad1c9b236d 100644 --- a/source/libNET/src/net_test.c +++ b/source/libNET/src/net_test.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018, Arm Limited and affiliates. + * Copyright (c) 2016-2018, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/libNET/src/ns_net.c b/source/libNET/src/ns_net.c index 09c3fc1b7b..dd3883c6ef 100644 --- a/source/libNET/src/ns_net.c +++ b/source/libNET/src/ns_net.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019, Arm Limited and affiliates. + * Copyright (c) 2014-2021, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/libNET/src/socket_api.c b/source/libNET/src/socket_api.c index d02df10121..2de5d0d298 100644 --- a/source/libNET/src/socket_api.c +++ b/source/libNET/src/socket_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019, Arm Limited and affiliates. + * Copyright (c) 2014-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/source/nsconfig.h b/source/nsconfig.h index dfb182a5af..0f55f1fdcf 100644 --- a/source/nsconfig.h +++ b/source/nsconfig.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019, Arm Limited and affiliates. + * Copyright (c) 2014-2020, Pelion and affiliates. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/sources.mk b/sources.mk index ef0ec51253..7c5af85feb 100644 --- a/sources.mk +++ b/sources.mk @@ -123,6 +123,7 @@ SRCS += \ source/Security/protocols/gkh_sec_prot/supp_gkh_sec_prot.c \ source/Security/protocols/radius_sec_prot/radius_client_sec_prot.c \ source/Security/protocols/radius_sec_prot/avp_helper.c \ + source/Security/protocols/msg_sec_prot/msg_sec_prot.c \ source/Security/protocols/tls_sec_prot/tls_sec_prot.c \ source/Security/protocols/tls_sec_prot/tls_sec_prot_lib.c \ source/Security/PANA/eap_protocol.c \ @@ -211,6 +212,7 @@ SRCS += \ source/Service_Libs/utils/ns_crc.c \ source/Service_Libs/utils/isqrt.c \ source/Service_Libs/utils/ns_file_system.c \ + source/Service_Libs/utils/ns_time.c \ source/Service_Libs/utils/ns_conf.c \ source/Service_Libs/mdns/ns_mdns_api.c \ source/Service_Libs/mdns/ns_fnet_port.c \