Skip to content

Commit

Permalink
Squashed 'connectivity/nanostack/sal-stack-nanostack/' changes from 2…
Browse files Browse the repository at this point in the history
…25a4af..154db5425e

154db5425e Merge branch 'release_internal' into release_external
dca258c3f0 Updated unit test
89df990e6d Set EAPOL relay state function to LLC as a callback
47d8f42bf5 Removed extra call to supplicant delete callback
00ebfd905f Added new configuration options for Border router
421f6a8191 Move RPL code to the 6lr state machine
e1e43b8ac2 Corrected pae controller BR EUI-64 flagging
aaefdaebab Refactored pae controller (ARMmbed#2707)
b82e0ee19a Update copyright text in CMakeLists.txt files (ARMmbed#2706)
5791a22d37 Renamed bootstrap files and separated pae controller callback functions (ARMmbed#2703)
4e3ec07caf MAC beacon payload max MTU allocation limited to for support MTU size 127.
a997ab6653 Iotthd 4698 (ARMmbed#2702)
e64b057bff Adjusted security protocols timeouts (ARMmbed#2701)
cb3db6419f Return invalid values from old API if new configuration is used
6872401f8d RPL address registration update
90a434d318 RPL DAO lifetime update
e39f6432eb Forward RPL configuration unmodified
58da4d6c93 Sync Cmake updates from Mbed OS (ARMmbed#2697)
4c229b46c9 Adjust Wi-SUN host/router config - HAVE_RPL (ARMmbed#2696)
40bd2320ba Update release v15.0.0 details to CHANGELOG (ARMmbed#2694)

git-subtree-dir: connectivity/nanostack/sal-stack-nanostack
git-subtree-split: 154db5425eb9f0df82ee081cb05e7d80cda11415
  • Loading branch information
artokin committed Dec 2, 2021
1 parent fa7202c commit 791d7fd
Show file tree
Hide file tree
Showing 83 changed files with 3,344 additions and 2,012 deletions.
33 changes: 33 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copyright (c) 2020-2021, Pelion and affiliates.
# SPDX-License-Identifier: Apache-2.0

add_subdirectory(source/6LoWPAN)
add_subdirectory(source/BorderRouter)
add_subdirectory(source/Common_Protocols)
add_subdirectory(source/Core)
add_subdirectory(source/DHCPv6_Server)
add_subdirectory(source/DHCPv6_client)
add_subdirectory(source/MAC)
add_subdirectory(source/MLE)
add_subdirectory(source/MPL)
add_subdirectory(source/NWK_INTERFACE)
add_subdirectory(source/RPL)
add_subdirectory(source/Security)
add_subdirectory(source/Service_Libs)
add_subdirectory(source/configs)
add_subdirectory(source/ipv6_stack)
add_subdirectory(source/libDHCPv6)
add_subdirectory(source/libNET)

target_include_directories(mbed-nanostack-sal_stack
INTERFACE
.
./nanostack
./nanostack/platform
./source
)

target_link_libraries(mbed-nanostack
INTERFACE
mbed-nanostack-coap_service
)
2 changes: 2 additions & 0 deletions nanostack/net_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ typedef enum arm_library_event_type_e {
#define SOCKET_NO_RAM (10 << 4)
/** TCP connection problem indication (RFC 1122 R1) */
#define SOCKET_CONNECTION_PROBLEM (11 << 4)
/** Socket is busy or Radio is returning CCA failure */
#define SOCKET_BUSY (12 << 4)

#define SOCKET_BIND_DONE SOCKET_CONNECT_DONE /**< Backward compatibility */
#define SOCKET_BIND_FAIL SOCKET_CONNECT_FAIL /**< Backward compatibility */
Expand Down
1 change: 1 addition & 0 deletions nanostack/socket_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ extern "C" {
* | | | TCP: some data acknowledged (d_len = data remaining in send queue) |
* | SOCKET_NO_RAM | 0xA0 | No RAM available. |
* | SOCKET_CONNECTION_PROBLEM | 0xB0 | TCP connection is retrying. |
* | SOCKET_BUSY | 0xC0 | Socket is busy or Radio channel is returning CCA failure. |
*
*
* \section socket-tcp How to use TCP sockets:
Expand Down
69 changes: 66 additions & 3 deletions nanostack/ws_bbr_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,22 @@ typedef struct bbr_timezone_configuration {
* "bit xxxxxxxxxxxxxxxS" 0 = false 1 = true Daylight saving time status*/
uint16_t status;
} bbr_timezone_configuration_t;


/**
* \brief Border router configuration.
*/
typedef struct bbr_configuration_s {
uint32_t dhcp_address_lifetime; /**< DHCP address lifetime in seconds minimum 2 hours and maximum few days*/
uint32_t rpl_default_lifetime; /**< RPL default lifetime value from 30 minutes to 16 hours*/
uint16_t dag_max_rank_increase; /**< DIO Max rank increase. Range 0-2048 */
uint16_t min_hop_rank_increase; /**< DIO Min hop rank increase. range 32-256 */
uint16_t options; /**< Border router configuration options */
uint8_t dio_interval_min; /**< DIO interval min. range 1-255 */
uint8_t dio_interval_doublings; /**< DIO interval doublings. range 1-8 */
uint8_t dio_redundancy_constant; /**< DIO redundancy constant. Range 0-10 */
} bbr_configuration_t;

/**
* Start backbone border router service.
*
Expand Down Expand Up @@ -270,7 +286,52 @@ int ws_bbr_eapol_node_limit_set(int8_t interface_id, uint16_t limit);
int ws_bbr_ext_certificate_validation_set(int8_t interface_id, uint8_t validation);

/**
* Sets RPL parameters
* Sets Border router configuration
*
* Sets the configuration to the border router. Use ws_configuration_get to get
* the settings and modify wanted parameters.
*
* Minor validation is done to parameters, but full validation must be done
* at application level
*
* \param interface_id Network interface ID.
* \param configuration_ptr Configuration structure.
*
* \return 0, Configuration parameters set.
* \return <0 Parameter set failed.
*/
int ws_bbr_configuration_set(int8_t interface_id, bbr_configuration_t *configuration_ptr);

/**
* Get Border router configuration
*
* Gets the current configuration to the border router.
*
* \param interface_id Network interface ID.
* \param configuration_ptr Configuration structure.
*
* \return 0, Configuration parameters set.
* \return <0 Parameter set failed.
*/
int ws_bbr_configuration_get(int8_t interface_id, bbr_configuration_t *configuration_ptr);

/**
* validate Border router configuration
*
* Minor validation is done to parameters.
* Full validation must be done at application level.
*
* \param interface_id Network interface ID.
* \param configuration_ptr Configuration structure.
*
* \return 0, Configuration parameters set.
* \return <0 Parameter set failed.
*/
int ws_bbr_configuration_validate(int8_t interface_id, bbr_configuration_t *configuration_ptr);

/**
* Sets RPL parameters (DEPRECATED)
* Use ws_bbr_configuration_set instead.
*
* Sets RPL DIO trickle parameters.
*
Expand All @@ -285,7 +346,8 @@ int ws_bbr_ext_certificate_validation_set(int8_t interface_id, uint8_t validatio
int ws_bbr_rpl_parameters_set(int8_t interface_id, uint8_t dio_interval_min, uint8_t dio_interval_doublings, uint8_t dio_redundancy_constant);

/**
* Gets RPL parameters
* Gets RPL parameters (DEPRECATED)
* Use ws_bbr_configuration_get instead.
*
* Gets RPL DIO trickle parameters.
*
Expand All @@ -300,7 +362,8 @@ int ws_bbr_rpl_parameters_set(int8_t interface_id, uint8_t dio_interval_min, uin
int ws_bbr_rpl_parameters_get(int8_t interface_id, uint8_t *dio_interval_min, uint8_t *dio_interval_doublings, uint8_t *dio_redundancy_constant);

/**
* Validate RPL parameters
* Validate RPL parameters (DEPRECATED)
* Use ws_bbr_configuration_validate instead.
*
* Validates RPL DIO trickle parameters.
*
Expand Down
114 changes: 114 additions & 0 deletions source/6LoWPAN/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# Copyright (c) 2020-2021, Pelion and affiliates.
# SPDX-License-Identifier: Apache-2.0

target_include_directories(mbed-nanostack-sal_stack
INTERFACE
.
./Bootstraps
./Fragmentation
./IPHC_Decode
./MAC
./Mesh
./ND
./NVM
./Thread
./ws
)

target_sources(mbed-nanostack-sal_stack
INTERFACE
adaptation_interface.c

Bootstraps/Generic/network_lib.c
Bootstraps/Generic/protocol_6lowpan.c
Bootstraps/Generic/protocol_6lowpan_bootstrap.c
Bootstraps/Generic/protocol_6lowpan_interface.c

Fragmentation/cipv6_fragmenter.c

IPHC_Decode/6lowpan_iphc.c
IPHC_Decode/iphc_compress.c
IPHC_Decode/iphc_decompress.c
IPHC_Decode/lowpan_context.c

MAC/beacon_handler.c
MAC/mac_data_poll.c
MAC/mac_helper.c
MAC/mac_ie_lib.c
MAC/mac_pairwise_key.c
MAC/mac_response_handler.c

Mesh/mesh.c

ND/nd_router_object.c

NVM/nwk_nvm.c

Thread/thread_bbr_api.c
Thread/thread_bbr_commercial.c
Thread/thread_beacon.c
Thread/thread_bootstrap.c
Thread/thread_border_router_api.c
Thread/thread_ccm.c
Thread/thread_commissioning_api.c
Thread/thread_commissioning_if.c
Thread/thread_common.c
Thread/thread_dhcpv6_server.c
Thread/thread_diagnostic.c
Thread/thread_discovery.c
Thread/thread_host_bootstrap.c
Thread/thread_joiner_application.c
Thread/thread_leader_service.c
Thread/thread_lowpower_api.c
Thread/thread_lowpower_private_api.c
Thread/thread_management_api.c
Thread/thread_management_client.c
Thread/thread_management_if.c
Thread/thread_management_server.c
Thread/thread_mdns.c
Thread/thread_meshcop_lib.c
Thread/thread_mle_message_handler.c
Thread/thread_nd.c
Thread/thread_neighbor_class.c
Thread/thread_net_config_api.c
Thread/thread_network_data_lib.c
Thread/thread_network_data_storage.c
Thread/thread_network_synch.c
Thread/thread_nvm_store.c
Thread/thread_resolution_client.c
Thread/thread_resolution_server.c
Thread/thread_router_bootstrap.c
Thread/thread_routing.c
Thread/thread_test_api.c

ws/ws_bbr_api.c
ws/ws_bootstrap.c
ws/ws_bootstrap_6lbr.c
ws/ws_bootstrap_6ln.c
ws/ws_bootstrap_6lr.c
ws/ws_bootstrap_ffn.c
ws/ws_cfg_settings.c
ws/ws_common.c
ws/ws_eapol_auth_relay.c
ws/ws_eapol_pdu.c
ws/ws_eapol_relay.c
ws/ws_eapol_relay_lib.c
ws/ws_empty_functions.c
ws/ws_ie_lib.c
ws/ws_llc_data_service.c
ws/ws_management_api.c
ws/ws_mpx_header.c
ws/ws_neighbor_class.c
ws/ws_pae_auth.c
ws/ws_pae_controller.c
ws/ws_pae_key_storage.c
ws/ws_pae_lib.c
ws/ws_pae_nvm_data.c
ws/ws_pae_nvm_store.c
ws/ws_pae_supp.c
ws/ws_pae_time.c
ws/ws_pae_timers.c
ws/ws_phy.c
ws/ws_stats.c
ws/ws_test_api.c
)
12 changes: 10 additions & 2 deletions source/6LoWPAN/ND/nd_router_object.c
Original file line number Diff line number Diff line change
Expand Up @@ -849,6 +849,7 @@ static void nd_update_registration(protocol_interface_info_entry_t *cur_interfac
/* Register with 2 seconds off the lifetime - don't want the NCE to expire before the route */
ipv6_route_add_metric(neigh->ip_address, 128, cur_interface->id, neigh->ip_address, ROUTE_ARO, NULL, 0, neigh->lifetime - 2, 32);

#ifdef HAVE_RPL
/* We need to know peer is a host before publishing - this needs MLE. Not yet established
* what to do without MLE - might need special external/non-external prioritisation at root.
* This "publish for RFD" rule comes from ZigBee IP.
Expand All @@ -861,6 +862,7 @@ static void nd_update_registration(protocol_interface_info_entry_t *cur_interfac
rpl_control_publish_host_address(protocol_6lowpan_rpl_domain, neigh->ip_address, neigh->lifetime);
}
}
#endif // HAVE_RPL
protocol_6lowpan_neighbor_address_state_synch(cur_interface, aro->eui64, neigh->ip_address + 8);

} else {
Expand All @@ -870,10 +872,13 @@ static void nd_update_registration(protocol_interface_info_entry_t *cur_interfac
neigh->lifetime = 2;
ipv6_neighbour_set_state(&cur_interface->ipv6_neighbour_cache, neigh, IP_NEIGHBOUR_STALE);
ipv6_route_add_metric(neigh->ip_address, 128, cur_interface->id, neigh->ip_address, ROUTE_ARO, NULL, 0, 4, 32);
#ifdef HAVE_RPL
rpl_control_unpublish_address(protocol_6lowpan_rpl_domain, neigh->ip_address);
#endif
}
}

#ifdef HAVE_RPL
void nd_remove_registration(protocol_interface_info_entry_t *cur_interface, addrtype_t ll_type, const uint8_t *ll_address)
{
ns_list_foreach_safe(ipv6_neighbour_t, cur, &cur_interface->ipv6_neighbour_cache.list) {
Expand All @@ -888,7 +893,9 @@ void nd_remove_registration(protocol_interface_info_entry_t *cur_interface, addr
}
}
}
#endif // HAVE_RPL

#ifdef HAVE_RPL
/* Process ICMP Neighbor Solicitation (RFC 4861 + RFC 6775) ARO. */
bool nd_ns_aro_handler(protocol_interface_info_entry_t *cur_interface, const uint8_t *aro_opt, const uint8_t *slla_opt, const uint8_t *src_addr, aro_t *aro_out)
{
Expand Down Expand Up @@ -1032,6 +1039,7 @@ bool nd_ns_aro_handler(protocol_interface_info_entry_t *cur_interface, const uin
return false; /* Tell ns_handler to not transmit now */
}
}
#endif //HAVE_RPL

buffer_t *nd_dac_handler(buffer_t *buf, protocol_interface_info_entry_t *cur)
{
Expand Down Expand Up @@ -1304,6 +1312,7 @@ void nd_ra_process_lowpan_context_option(protocol_interface_info_entry_t *cur, c
lowpan_context_update(&cur->lowpan_contexts, cid_flags, lifetime, opt + 8, ctx_len, true);
}
#ifdef HAVE_6LOWPAN_ROUTER
#ifdef HAVE_RPL
static void nd_ra_build(nd_router_t *cur, const uint8_t *address, protocol_interface_info_entry_t *cur_interface)
{
if (!(cur_interface->lowpan_info & INTERFACE_NWK_BOOTSRAP_ADDRESS_REGISTER_READY) || !icmp_nd_router_prefix_valid(cur)) {
Expand Down Expand Up @@ -1393,7 +1402,6 @@ void nd_ra_build_by_abro(const uint8_t *abro, const uint8_t *dest, protocol_inte
}
}


void nd_trigger_ras_from_rs(const uint8_t *unicast_adr, protocol_interface_info_entry_t *cur_interface)
{
ns_list_foreach(nd_router_t, cur, &nd_router_list) {
Expand Down Expand Up @@ -1470,7 +1478,7 @@ static nd_router_t *nd_router_object_scan_by_prefix(const uint8_t *ptr, nwk_inte

return NULL;
}

#endif //HAVE_RPL
#endif

void gp_address_add_to_end(gp_ipv6_address_list_t *list, const uint8_t address[static 16])
Expand Down
3 changes: 3 additions & 0 deletions source/6LoWPAN/adaptation_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -1747,6 +1747,9 @@ static uint8_t map_mlme_status_to_socket_event(uint8_t mlme_status)
case MLME_SUCCESS:
socket_event = SOCKET_TX_DONE;
break;
case MLME_BUSY_CHAN:
socket_event = SOCKET_BUSY;
break;
case MLME_TX_NO_ACK:
case MLME_SECURITY_FAIL:
case MLME_TRANSACTION_EXPIRED:
Expand Down
Loading

0 comments on commit 791d7fd

Please sign in to comment.