Merge pull request #15187 from artokin/nanostack_release_v15_1_0

Nanostack release v15.1.0 to master
pull/15196/head
Martin Kojtal 2021-12-13 09:46:45 +00:00 committed by GitHub
commit ff061e8cf2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
100 changed files with 3000 additions and 2160 deletions

View File

@ -1,5 +1,20 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#################################################################################
## Copyright 2020-2021 Pelion.
##
## 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.
#################################################################################
target_include_directories(mbed-802.15.4-rf
INTERFACE

View File

@ -703,7 +703,8 @@ static void rf_handle_rx_done(void)
rf_state = RF_IDLE;
}
if (rf_read_bbc_register(BBC_PC, rf_module) & FCSOK) {
if (!rf_read_rx_buffer(cur_rx_packet_len, rf_module)) {
uint16_t rx_packet_len = rf_read_rx_frame_length(rf_module);
if (!rf_read_rx_buffer(rx_packet_len, rf_module)) {
uint8_t version = ((rx_buffer[1] & VERSION_FIELD_MASK) >> SHIFT_VERSION_FIELD);
if (((rx_buffer[0] & MAC_FRAME_TYPE_MASK) == MAC_TYPE_ACK) && (version < MAC_FRAME_VERSION_2)) {
rf_handle_ack(rx_buffer[2], rx_buffer[0] & MAC_DATA_PENDING);
@ -711,11 +712,11 @@ static void rf_handle_rx_done(void)
int8_t rssi = (int8_t) rf_read_rf_register(RF_EDV, rf_module);
// Cut CRC bytes
if (mac_mode == IEEE_802_15_4_2011) {
cur_rx_packet_len -= 2;
rx_packet_len -= 2;
} else {
cur_rx_packet_len -= 4;
rx_packet_len -= 4;
}
device_driver.phy_rx_cb(rx_buffer, cur_rx_packet_len, 0xf0, rssi, rf_radio_driver_id);
device_driver.phy_rx_cb(rx_buffer, rx_packet_len, 0xf0, rssi, rf_radio_driver_id);
// If auto ack used, must wait until RF returns to RF_TXPREP state
if ((version != MAC_FRAME_VERSION_2) && (rx_buffer[0] & FC_AR)) {
wait_us(100);

View File

@ -1,5 +1,20 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#################################################################################
## Copyright 2020-2021 Pelion.
##
## 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.
#################################################################################
target_include_directories(mbed-802.15.4-rf
INTERFACE

View File

@ -1,5 +1,20 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#################################################################################
## Copyright 2020-2021 Pelion.
##
## 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.
#################################################################################
target_include_directories(mbed-802.15.4-rf
INTERFACE

View File

@ -1,15 +1,16 @@
/*
* Copyright (c) 2014-2015 ARM Limited. All rights reserved.
* Copyright (c) 2014-2015, 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.
*
* 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
* 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.
* 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.
*/

View File

@ -1,15 +1,16 @@
/*
* Copyright (c) 2014-2015 ARM Limited. All rights reserved.
* Copyright (c) 2014-2015, 2017, 2019-2020, 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.
*
* 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
* 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.
* 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.
*/

View File

@ -1,15 +1,16 @@
/*
* Copyright (c) 2014-2015 ARM Limited. All rights reserved.
* 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); you may
* not use this file except in compliance with the License.
*
* 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
* 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.
* 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.
*/

View File

@ -1,15 +1,16 @@
/*
* Copyright (c) 2014-2015 ARM Limited. All rights reserved.
* Copyright (c) 2014-2016, 2020, 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.
*
* 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
* 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.
* 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.
*/

View File

@ -1,15 +1,16 @@
/*
* Copyright (c) 2014-2015 ARM Limited. All rights reserved.
* Copyright (c) 2014-2017, 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.
*
* 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
* 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.
* 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.
*/

View File

@ -1,15 +1,16 @@
/*
* Copyright (c) 2014-2015 ARM Limited. All rights reserved.
* Copyright (c) 2014-2017, 2019, 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.
*
* 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
* 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.
* 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.
*/

View File

@ -1,15 +1,16 @@
/*
* Copyright (c) 2014-2015 ARM Limited. All rights reserved.
* 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); you may
* not use this file except in compliance with the License.
*
* 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
* 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.
* 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.
*/

View File

@ -1,15 +1,16 @@
/*
* Copyright (c) 2017 ARM Limited. All rights reserved.
* Copyright (c) 2017, 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.
*
* 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
* 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.
* 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.
*/

View File

@ -1,15 +1,16 @@
/*
* Copyright (c) 2014-2015 ARM Limited. All rights reserved.
* 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); you may
* not use this file except in compliance with the License.
*
* 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
* 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.
* 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.
*/

View File

@ -1,15 +1,16 @@
/*
* Copyright (c) 2014-2015 ARM Limited. All rights reserved.
* Copyright (c) 2014-2016, 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.
*
* 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
* 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.
* 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.
*/

View File

@ -1,15 +1,16 @@
/*
* Copyright (c) 2014-2015 ARM Limited. All rights reserved.
* Copyright (c) 2014-2017, 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.
*
* 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
* 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.
* 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.
*/

View File

@ -1,15 +1,16 @@
/*
* Copyright (c) 2014-2015 ARM Limited. All rights reserved.
* Copyright (c) 2014-2018, 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.
*
* 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
* 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.
* 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.
*/

View File

@ -1,15 +1,16 @@
/*
* Copyright (c) 2014-2015 ARM Limited. All rights reserved.
* Copyright (c) 2014-2015, 2017, 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.
*
* 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
* 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.
* 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.
*/

View File

@ -1,4 +1,4 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# Copyright (c) 2020-2021, Pelion and affiliates.
# SPDX-License-Identifier: Apache-2.0
add_subdirectory(source/6LoWPAN)

View File

@ -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 */

View File

@ -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:

View File

@ -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.
*
@ -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.
*
@ -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.
*
@ -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.
*

View File

@ -1,4 +1,4 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# Copyright (c) 2020-2021, Pelion and affiliates.
# SPDX-License-Identifier: Apache-2.0
target_include_directories(mbed-nanostack-sal_stack
@ -84,8 +84,9 @@ target_sources(mbed-nanostack-sal_stack
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_bootstrap_lfn.c
ws/ws_cfg_settings.c
ws/ws_common.c
ws/ws_eapol_auth_relay.c

View File

@ -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.
@ -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 {
@ -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) {
@ -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)
{
@ -1032,6 +1039,7 @@ RESPONSE:
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)
{
@ -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)) {
@ -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) {
@ -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])

View File

@ -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:

View File

@ -31,6 +31,7 @@
#include "6LoWPAN/ws/ws_config.h"
#include "6LoWPAN/ws/ws_common.h"
#include "6LoWPAN/ws/ws_bootstrap.h"
#include "6LoWPAN/ws/ws_bootstrap_ffn.h"
#include "6LoWPAN/ws/ws_cfg_settings.h"
#include "6LoWPAN/ws/ws_pae_key_storage.h"
#include "6LoWPAN/ws/ws_pae_nvm_store.h"
@ -1209,6 +1210,94 @@ int ws_bbr_ext_certificate_validation_set(int8_t interface_id, uint8_t validatio
return -1;
#endif
}
int ws_bbr_configuration_set(int8_t interface_id, bbr_configuration_t *configuration_ptr)
{
#ifdef HAVE_WS_BORDER_ROUTER
protocol_interface_info_entry_t *cur = protocol_stack_interface_info_get_by_id(interface_id);
ws_bbr_cfg_t cfg;
if (!configuration_ptr || ws_cfg_bbr_get(&cfg) < 0) {
return -1;
}
cfg.dio_interval_min = configuration_ptr->dio_interval_min;
cfg.dio_interval_doublings = configuration_ptr->dio_interval_doublings;
cfg.dio_redundancy_constant = configuration_ptr->dio_redundancy_constant;
cfg.dag_max_rank_increase = configuration_ptr->dag_max_rank_increase;
cfg.min_hop_rank_increase = configuration_ptr->min_hop_rank_increase;
cfg.dhcp_address_lifetime = configuration_ptr->dhcp_address_lifetime;
cfg.rpl_default_lifetime = configuration_ptr->rpl_default_lifetime;
/* Configuration change is different from settings change as it changes
* PAN version instead of RPL version.
*/
ws_bbr_configure(interface_id, configuration_ptr->options);
if (ws_cfg_bbr_set(cur, &cfg, 0) < 0) {
return -2;
}
return 0;
#else
(void) interface_id;
(void) configuration_ptr;
return -1;
#endif
}
int ws_bbr_configuration_get(int8_t interface_id, bbr_configuration_t *configuration_ptr)
{
#ifdef HAVE_WS_BORDER_ROUTER
(void) interface_id;
ws_bbr_cfg_t cfg;
if (!configuration_ptr || ws_cfg_bbr_get(&cfg) < 0) {
return -1;
}
configuration_ptr->dio_interval_min = cfg.dio_interval_min;
configuration_ptr->dio_interval_doublings = cfg.dio_interval_doublings;
configuration_ptr->dio_redundancy_constant = cfg.dio_redundancy_constant;
configuration_ptr->dag_max_rank_increase = cfg.dag_max_rank_increase;
configuration_ptr->min_hop_rank_increase = cfg.min_hop_rank_increase;
configuration_ptr->dhcp_address_lifetime = cfg.dhcp_address_lifetime;
configuration_ptr->rpl_default_lifetime = cfg.rpl_default_lifetime;
configuration_ptr->options = configuration;
return 0;
#else
(void) interface_id;
(void) configuration_ptr;
return -1;
#endif
}
int ws_bbr_configuration_validate(int8_t interface_id, bbr_configuration_t *configuration_ptr)
{
#ifdef HAVE_WS_BORDER_ROUTER
(void) interface_id;
ws_bbr_cfg_t cfg;
if (!configuration_ptr || ws_cfg_bbr_get(&cfg) < 0) {
return -1;
}
cfg.dio_interval_min = configuration_ptr->dio_interval_min;
cfg.dio_interval_doublings = configuration_ptr->dio_interval_doublings;
cfg.dio_redundancy_constant = configuration_ptr->dio_redundancy_constant;
cfg.dag_max_rank_increase = configuration_ptr->dag_max_rank_increase;
cfg.min_hop_rank_increase = configuration_ptr->min_hop_rank_increase;
cfg.dhcp_address_lifetime = configuration_ptr->dhcp_address_lifetime;
cfg.rpl_default_lifetime = configuration_ptr->rpl_default_lifetime;
if (ws_cfg_bbr_validate(&cfg) < 0) {
return -3;
}
return 0;
#else
(void) interface_id;
(void) configuration_ptr;
return -1;
#endif
}
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)
{

View File

@ -18,7 +18,6 @@
#ifndef WS_BOOTSTRAP_H_
#define WS_BOOTSTRAP_H_
typedef enum {
WS_INIT_EVENT = 0, /**< tasklet initializion event*/
WS_DISCOVERY_START, /**< discovery start*/
@ -76,8 +75,6 @@ extern uint16_t test_pan_version;
int ws_bootstrap_init(int8_t interface_id, net_6lowpan_mode_e bootstrap_mode);
void ws_bootstrap_state_machine(protocol_interface_info_entry_t *cur);
int ws_bootstrap_restart(int8_t interface_id);
int ws_bootstrap_restart_delayed(int8_t interface_id);
@ -92,22 +89,20 @@ void ws_bootstrap_seconds_timer(protocol_interface_info_entry_t *cur, uint32_t s
void ws_bootstrap_trickle_timer(protocol_interface_info_entry_t *cur, uint16_t ticks);
void ws_bootstrap_primary_parent_update(protocol_interface_info_entry_t *interface, mac_neighbor_table_entry_t *neighbor);
void ws_bootstrap_secondary_parent_update(protocol_interface_info_entry_t *interface);
void ws_nud_entry_remove_active(protocol_interface_info_entry_t *cur, void *neighbor);
void ws_nud_active_timer(protocol_interface_info_entry_t *cur, uint16_t ticks);
void ws_dhcp_client_address_request(protocol_interface_info_entry_t *cur, uint8_t *prefix, uint8_t *parent_link_local);
void ws_dhcp_client_address_delete(protocol_interface_info_entry_t *cur, uint8_t *prefix);
bool ws_eapol_relay_state_active(protocol_interface_info_entry_t *cur);
void ws_bootstrap_eapol_parent_synch(struct protocol_interface_info_entry *cur, struct llc_neighbour_req *neighbor_info);
void ws_bootstrap_ll_address_validate(struct protocol_interface_info_entry *cur);
uint16_t ws_local_etx_read(protocol_interface_info_entry_t *interface, addrtype_t addr_type, const uint8_t *mac_adddress);
bool ws_bootstrap_nd_ns_transmit(protocol_interface_info_entry_t *cur, ipv6_neighbour_t *entry, bool unicast, uint8_t seq);
void ws_bootstrap_memory_configuration();
bool ws_bootstrap_validate_channel_plan(struct ws_us_ie *ws_us, struct protocol_interface_info_entry *cur);
bool ws_bootstrap_validate_channel_function(struct ws_us_ie *ws_us, struct ws_bs_ie *ws_bs);
@ -166,16 +161,15 @@ void ws_bootstrap_candidate_parent_sort(struct protocol_interface_info_entry *cu
parent_info_t *ws_bootstrap_candidate_parent_get_best(protocol_interface_info_entry_t *cur);
void ws_bootstrap_primary_parent_set(struct protocol_interface_info_entry *cur, struct llc_neighbour_req *neighbor_info, ws_parent_synch_e synch_req);
void ws_bootstrap_parent_confirm(protocol_interface_info_entry_t *cur, struct rpl_instance *instance);
bool ws_bootstrap_neighbor_info_request(struct protocol_interface_info_entry *interface, const uint8_t *mac_64, struct llc_neighbour_req *neighbor_buffer, bool request_new);
void ws_bootstrap_neighbor_list_clean(struct protocol_interface_info_entry *interface);
int8_t ws_bootstrap_neighbor_set(protocol_interface_info_entry_t *cur, parent_info_t *parent_ptr, bool clear_list);
void ws_address_reregister_trig(struct protocol_interface_info_entry *interface);
void ws_nud_table_reset(protocol_interface_info_entry_t *cur);
void ws_address_registration_update(protocol_interface_info_entry_t *interface, const uint8_t addr[16]);
void ws_bootstrap_configure_csma_ca_backoffs(protocol_interface_info_entry_t *cur, uint8_t max_backoffs, uint8_t min_be, uint8_t max_be);
void ws_bootstrap_fhss_configure_channel_masks(protocol_interface_info_entry_t *cur, fhss_ws_configuration_t *fhss_configuration);
int8_t ws_bootstrap_fhss_initialize(protocol_interface_info_entry_t *cur);
int8_t ws_bootstrap_fhss_set_defaults(protocol_interface_info_entry_t *cur, fhss_ws_configuration_t *fhss_configuration);
void ws_bootstrap_fhss_activate(protocol_interface_info_entry_t *cur);
uint16_t ws_bootstrap_randomize_fixed_channel(uint16_t configured_fixed_channel, uint8_t number_of_channels, uint32_t *channel_mask);
@ -186,9 +180,6 @@ void ws_bootstrap_configure_data_request_restart(protocol_interface_info_entry_t
void ws_bootstrap_llc_hopping_update(struct protocol_interface_info_entry *cur, const fhss_ws_configuration_t *fhss_configuration);
void ws_bootstrap_rpl_activate(protocol_interface_info_entry_t *cur);
void ws_bootstrap_rpl_scan_start(protocol_interface_info_entry_t *cur);
void ws_bootstrap_ip_stack_reset(protocol_interface_info_entry_t *cur);
void ws_bootstrap_ip_stack_activate(protocol_interface_info_entry_t *cur);
@ -201,13 +192,10 @@ void ws_bootstrap_network_start(protocol_interface_info_entry_t *cur);
#else
#define ws_bootstrap_init(interface_id, bootstrap_mode) (-1)
#define ws_bootstrap_state_machine(cur)
#define ws_bootstrap_restart(cur)
#define ws_bootstrap_neighbor_remove(cur, ll_address)
#define ws_bootstrap_aro_failure(cur, ll_address)
#define ws_bootstrap_neighbor_set_stable(interface, src64)
#define ws_bootstrap_primary_parent_update(interface, neighbor)
#define ws_bootstrap_secondary_parent_update(interface)
#define ws_bootstrap_stack_info_get(cur, info_ptr)
#define ws_bootstrap_neighbor_info_get(cur, neighbor_ptr, count)
#define ws_bootstrap_test_procedure_trigger(cur, procedure);

View File

@ -54,6 +54,7 @@
#include "6LoWPAN/ws/ws_common_defines.h"
#include "6LoWPAN/ws/ws_config.h"
#include "6LoWPAN/ws/ws_common.h"
#include "6LoWPAN/ws/ws_bootstrap_ffn.h"
#include "6LoWPAN/ws/ws_bootstrap.h"
#include "6LoWPAN/ws/ws_bbr_api_internal.h"
#include "6LoWPAN/ws/ws_common_defines.h"
@ -271,6 +272,123 @@ void ws_bootstrap_6lbr_asynch_confirm(struct protocol_interface_info_entry *inte
}
}
bool ws_bootstrap_6lbr_eapol_relay_state_active(protocol_interface_info_entry_t *cur)
{
(void) cur;
return true;
}
static void ws_bootstrap_6lbr_pan_version_increment(protocol_interface_info_entry_t *cur)
{
(void)cur;
ws_bbr_pan_version_increase(cur);
}
static void ws_bootstrap_6lbr_nw_info_updated(protocol_interface_info_entry_t *cur, uint16_t pan_id, uint16_t pan_version, char *network_name)
{
/* For border router, the PAE controller reads PAN ID, PAN version and network name from storage.
* If they are set, takes them into use here.
*/
if (cur->bootsrap_mode == ARM_NWK_BOOTSRAP_MODE_6LoWPAN_BORDER_ROUTER) {
// Get network name
ws_gen_cfg_t gen_cfg;
if (ws_cfg_gen_get(&gen_cfg) < 0) {
return;
}
// If PAN ID has not been set, set it
if (cur->ws_info->network_pan_id == 0xffff) {
cur->ws_info->network_pan_id = pan_id;
// Sets PAN version
cur->ws_info->pan_information.pan_version = pan_version;
cur->ws_info->pan_information.pan_version_set = true;
}
// If network name has not been set, set it
if (strlen(gen_cfg.network_name) == 0) {
strncpy(gen_cfg.network_name, network_name, 32);
}
// Stores the settings
ws_cfg_gen_set(cur, &gen_cfg, 0);
}
}
static bool ws_bootstrap_6lbr_eapol_congestion_get(protocol_interface_info_entry_t *cur, uint16_t active_supp)
{
if (cur == NULL || cur->random_early_detection == NULL || cur->llc_random_early_detection == NULL || cur->llc_eapol_random_early_detection == NULL) {
return false;
}
bool return_value = false;
static struct red_info_s *red_info = NULL;
uint16_t adaptation_average = 0;
uint16_t llc_average = 0;
uint16_t llc_eapol_average = 0;
uint16_t average_sum = 0;
uint8_t active_max = 0;
//TODO implement API for HEAP info request
uint32_t heap_size;
const mem_stat_t *mem_stats = ns_dyn_mem_get_mem_stat();
if (mem_stats) {
heap_size = mem_stats->heap_sector_size;
} else {
heap_size = 0;
}
/*
* For different memory sizes the max simultaneous authentications will be
* 32k: (32k / 50k) * 2 + 1 = 1
* 65k: (65k / 50k) * 2 + 1 = 3
* 250k: (250k / 50k) * 2 + 1 = 11
* 1000k: (1000k / 50k) * 2 + 1 = 41
* 2000k: (2000k / 50k) * 2 + 1 = 50 (upper limit)
*/
active_max = (heap_size / 50000) * 2 + 1;
if (active_max > 50) {
active_max = 50;
}
// Read the values for adaptation and LLC queues
adaptation_average = random_early_detetction_aq_read(cur->random_early_detection);
llc_average = random_early_detetction_aq_read(cur->llc_random_early_detection);
llc_eapol_average = random_early_detetction_aq_read(cur->llc_eapol_random_early_detection);
// Calculate combined average
average_sum = adaptation_average + llc_average + llc_eapol_average;
// Maximum for active supplicants based on memory reached, fail
if (active_supp >= active_max) {
return_value = true;
goto congestion_get_end;
}
// Always allow at least five negotiations (if memory does not limit)
if (active_supp < 5) {
goto congestion_get_end;
}
if (red_info == NULL) {
red_info = random_early_detection_create(
cur->ws_info->cfg->sec_prot.max_simult_sec_neg_tx_queue_min,
cur->ws_info->cfg->sec_prot.max_simult_sec_neg_tx_queue_max,
100, RED_AVERAGE_WEIGHT_DISABLED);
}
if (red_info == NULL) {
goto congestion_get_end;
}
// Check drop probability
average_sum = random_early_detetction_aq_calc(red_info, average_sum);
return_value = random_early_detection_congestion_check(red_info);
congestion_get_end:
tr_info("Active supplicant limit, active: %i max: %i summed averageQ: %i adapt averageQ: %i LLC averageQ: %i LLC EAPOL averageQ: %i drop: %s", active_supp, active_max, average_sum, adaptation_average, llc_average, llc_eapol_average, return_value ? "T" : "F");
return return_value;
}
void ws_bootstrap_6lbr_event_handler(protocol_interface_info_entry_t *cur, arm_event_s *event)
{
ws_bootsrap_event_type_e event_type;
@ -371,8 +489,11 @@ void ws_bootstrap_6lbr_event_handler(protocol_interface_info_entry_t *cur, arm_e
// Set PAN ID and network name to controller
ws_pae_controller_nw_info_set(cur, cur->ws_info->network_pan_id, cur->ws_info->pan_information.pan_version, cur->ws_info->cfg->gen.network_name);
// Set backbone IP address get callback
ws_pae_controller_auth_cb_register(cur, ws_bootstrap_6lbr_backbone_ip_addr_get);
// Set information callbacks (backbone IP address get callback, network information, congestion)
ws_pae_controller_information_cb_register(cur, ws_bootstrap_6lbr_backbone_ip_addr_get, &ws_bootstrap_6lbr_nw_info_updated, &ws_bootstrap_6lbr_eapol_congestion_get);
// Set PAN version control callbacks
ws_pae_controller_pan_version_cb_register(cur, &ws_bootstrap_6lbr_pan_version_increment);
// Set PAE port to 10254 and authenticator relay to 10253 (and to own ll address)
ws_pae_controller_authenticator_start(cur, PAE_AUTH_SOCKET_PORT, ll_addr, EAPOL_RELAY_SOCKET_PORT);
@ -402,7 +523,7 @@ void ws_bootstrap_6lbr_event_handler(protocol_interface_info_entry_t *cur, arm_e
// Activate RPL
// Activate IPv6 stack
ws_bootstrap_ip_stack_activate(cur);
ws_bootstrap_rpl_activate(cur);
ws_bootstrap_ffn_rpl_configure(cur);
ws_bootstrap_network_start(cur);
// Wait for RPL start
ws_bootstrap_event_routing_ready(cur);

View File

@ -22,6 +22,7 @@
void ws_bootstrap_6lbr_asynch_ind(struct protocol_interface_info_entry *cur, const struct mcps_data_ind_s *data, const struct mcps_data_ie_list *ie_ext, uint8_t message_type);
void ws_bootstrap_6lbr_asynch_confirm(struct protocol_interface_info_entry *interface, uint8_t asynch_message);
bool ws_bootstrap_6lbr_eapol_relay_state_active(protocol_interface_info_entry_t *cur);
void ws_bootstrap_6lbr_event_handler(protocol_interface_info_entry_t *cur, arm_event_s *event);
void ws_bootstrap_6lbr_state_machine(protocol_interface_info_entry_t *cur);
void ws_bootstrap_6lbr_seconds_timer(protocol_interface_info_entry_t *cur, uint32_t seconds);
@ -32,6 +33,7 @@ void ws_bootstrap_6lbr_seconds_timer(protocol_interface_info_entry_t *cur, uint3
#define ws_bootstrap_6lbr_asynch_ind(cur, data, ie_ext, message_type) ((void) 0)
#define ws_bootstrap_6lbr_asynch_confirm(interface, asynch_message) ((void) 0)
#define ws_bootstrap_6lbr_eapol_relay_state_active(cur) false
#define ws_bootstrap_6lbr_event_handler(cur, event) ((void) 0)
#define ws_bootstrap_6lbr_state_machine(cur) ((void) 0)
#define ws_bootstrap_6lbr_seconds_timer(cur, seconds) ((void) 0)

View File

@ -85,7 +85,7 @@
#define TRACE_GROUP "wsbs"
void ws_bootstrap_lfn_asynch_ind(struct protocol_interface_info_entry *cur, const struct mcps_data_ind_s *data, const struct mcps_data_ie_list *ie_ext, uint8_t message_type)
void ws_bootstrap_6ln_asynch_ind(struct protocol_interface_info_entry *cur, const struct mcps_data_ind_s *data, const struct mcps_data_ie_list *ie_ext, uint8_t message_type)
{
(void)ie_ext;
// Store weakest heard packet RSSI
@ -101,13 +101,20 @@ void ws_bootstrap_lfn_asynch_ind(struct protocol_interface_info_entry *cur, cons
tr_warn("Wi-SUN LFN Mode received message id: %x", message_type);
}
void ws_bootstrap_lfn_asynch_confirm(struct protocol_interface_info_entry *interface, uint8_t asynch_message)
void ws_bootstrap_6ln_asynch_confirm(struct protocol_interface_info_entry *interface, uint8_t asynch_message)
{
(void)asynch_message;
ws_stats_update(interface, STATS_WS_ASYNCH_TX, 1);
}
void ws_bootstrap_lfn_event_handler(protocol_interface_info_entry_t *cur, arm_event_s *event)
bool ws_bootstrap_6ln_eapol_relay_state_active(protocol_interface_info_entry_t *cur)
{
(void) cur;
return false;
}
void ws_bootstrap_6ln_event_handler(protocol_interface_info_entry_t *cur, arm_event_s *event)
{
(void)cur;
ws_bootsrap_event_type_e event_type;
@ -130,7 +137,7 @@ void ws_bootstrap_lfn_event_handler(protocol_interface_info_entry_t *cur, arm_ev
}
}
void ws_bootstrap_lfn_state_machine(protocol_interface_info_entry_t *cur)
void ws_bootstrap_6ln_state_machine(protocol_interface_info_entry_t *cur)
{
switch (cur->nwk_bootstrap_state) {
@ -162,11 +169,111 @@ void ws_bootstrap_lfn_state_machine(protocol_interface_info_entry_t *cur)
}
}
void ws_bootstrap_lfn_seconds_timer(protocol_interface_info_entry_t *cur, uint32_t seconds)
void ws_bootstrap_6ln_seconds_timer(protocol_interface_info_entry_t *cur, uint32_t seconds)
{
(void)cur;
(void)seconds;
}
int8_t ws_bootstrap_6ln_up(protocol_interface_info_entry_t *cur)
{
int8_t ret_val = -1;
if (!cur) {
return -1;
}
if ((cur->configure_flags & INTERFACE_SETUP_MASK) != INTERFACE_SETUP_READY) {
tr_error("Interface not yet fully configured");
return -2;
}
if (ws_bootstrap_fhss_initialize(cur) != 0) {
tr_error("fhss initialization failed");
return -3;
}
if (cur->bootsrap_mode == ARM_NWK_BOOTSRAP_MODE_6LoWPAN_BORDER_ROUTER) {
//BBR init like NVM read
ws_bbr_init(cur);
}
// Save FHSS api
cur->ws_info->fhss_api = ns_sw_mac_get_fhss_api(cur->mac_api);
ws_bootstrap_ll_address_validate(cur);
addr_interface_set_ll64(cur, NULL);
cur->nwk_nd_re_scan_count = 0;
// Trigger discovery for bootstrap
ret_val = nwk_6lowpan_up(cur);
if (ret_val) {
goto cleanup;
}
/* Wi-sun will trig event for stamechine this timer must be zero on init */
cur->bootsrap_state_machine_cnt = 0;
/* Disable SLLAO send/mandatory receive with the ARO */
cur->ipv6_neighbour_cache.use_eui64_as_slla_in_aro = true;
/* Omit sending of NA if ARO SUCCESS */
cur->ipv6_neighbour_cache.omit_na_aro_success = true;
/* Omit sending of NA and consider ACK to be success */
cur->ipv6_neighbour_cache.omit_na = true;
// do not process AROs from NA. This is overriden by Wi-SUN specific failure handling
cur->ipv6_neighbour_cache.recv_na_aro = false;
/* Disable NUD Probes */
cur->ipv6_neighbour_cache.send_nud_probes = false;
cur->ipv6_neighbour_cache.probe_avoided_routers = true;
/*Replace NS handler to disable multicast address queries */
cur->if_ns_transmit = ws_bootstrap_nd_ns_transmit;
// Configure memory limits and garbage collection values;
ws_bootstrap_memory_configuration();
ws_nud_table_reset(cur);
ws_bootstrap_candidate_table_reset(cur);
// Zero uptime counters
cur->ws_info->uptime = 0;
cur->ws_info->authentication_time = 0;
cur->ws_info->connected_time = 0;
blacklist_params_set(
WS_BLACKLIST_ENTRY_LIFETIME,
WS_BLACKLIST_TIMER_MAX_TIMEOUT,
WS_BLACKLIST_TIMER_TIMEOUT,
WS_BLACKLIST_ENTRY_MAX_NBR,
WS_BLACKLIST_PURGE_NBR,
WS_BLACKLIST_PURGE_TIMER_TIMEOUT);
ws_bootstrap_event_discovery_start(cur);
return 0;
cleanup:
return ret_val;
}
int8_t ws_bootstrap_6ln_down(protocol_interface_info_entry_t *cur)
{
if (!cur || !(cur->lowpan_info & INTERFACE_NWK_ACTIVE)) {
return -1;
}
tr_info("Wi-SUN ifdown");
// Reset MAC for safe upper layer memory free
protocol_mac_reset(cur);
ns_sw_mac_fhss_unregister(cur->mac_api);
ns_fhss_delete(cur->ws_info->fhss_api);
cur->ws_info->fhss_api = NULL;
// Reset WS information
ws_bootstrap_asynch_trickle_stop(cur);
ws_llc_reset(cur);
if (nd_proxy_downstream_interface_unregister(cur->id) != 0) {
tr_warn("nd proxy unregister failed");
}
ws_nud_table_reset(cur);
ws_pae_controller_stop(cur);
ws_bootstrap_candidate_table_reset(cur);
blacklist_clear();
cur->if_common_forwarding_out_cb = NULL;
return nwk_6lowpan_down(cur);
}
#endif //HAVE_WS_BORDER_ROUTER && HAVE_WS

View File

@ -0,0 +1,51 @@
/*
* 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 WS_BOOTSTRAP_6LN_H_
#define WS_BOOTSTRAP_6LN_H_
#if defined(HAVE_WS) && defined(HAVE_WS_HOST)
void ws_bootstrap_6ln_asynch_ind(struct protocol_interface_info_entry *cur, const struct mcps_data_ind_s *data, const struct mcps_data_ie_list *ie_ext, uint8_t message_type);
void ws_bootstrap_6ln_asynch_confirm(struct protocol_interface_info_entry *interface, uint8_t asynch_message);
bool ws_bootstrap_6ln_eapol_relay_state_active(protocol_interface_info_entry_t *cur);
void ws_bootstrap_6ln_event_handler(protocol_interface_info_entry_t *cur, arm_event_s *event);
void ws_bootstrap_6ln_state_machine(protocol_interface_info_entry_t *cur);
void ws_bootstrap_6ln_seconds_timer(protocol_interface_info_entry_t *cur, uint32_t seconds);
int8_t ws_bootstrap_6ln_up(protocol_interface_info_entry_t *cur);
int8_t ws_bootstrap_6ln_down(protocol_interface_info_entry_t *cur);
#define wisun_mode_host(cur) (cur->bootsrap_mode == ARM_NWK_BOOTSRAP_MODE_6LoWPAN_HOST)
#else
#define ws_bootstrap_6lr_asynch_ind(cur, data, ie_ext, message_type) ((void) 0)
#define ws_bootstrap_6lr_asynch_confirm(interface, asynch_message) ((void) 0)
#define ws_bootstrap_6ln_eapol_relay_state_active(false) false
#define ws_bootstrap_6lr_event_handler(cur, event) ((void) 0)
#define ws_bootstrap_6ln_state_machine(cur) ((void) 0)
#define ws_bootstrap_6ln_seconds_timer(cur, seconds) ((void) 0)
#define ws_bootstrap_6ln_up(cur)
#define ws_bootstrap_6ln_down(cur)
#define wisun_mode_host(cur) (false)
#endif //HAVE_WS
#endif /* WS_BOOTSTRAP_6LN_H_ */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,52 @@
/*
* 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 WS_BOOTSTRAP_6LR_H_
#define WS_BOOTSTRAP_6LR_H_
#if defined(HAVE_WS) && defined(HAVE_WS_ROUTER)
void ws_bootstrap_6lr_asynch_ind(struct protocol_interface_info_entry *cur, const struct mcps_data_ind_s *data, const struct mcps_data_ie_list *ie_ext, uint8_t message_type);
void ws_bootstrap_6lr_asynch_confirm(struct protocol_interface_info_entry *interface, uint8_t asynch_message);
bool ws_bootstrap_6lr_eapol_relay_state_active(protocol_interface_info_entry_t *cur);
void ws_bootstrap_6lr_event_handler(protocol_interface_info_entry_t *cur, arm_event_s *event);
void ws_bootstrap_6lr_state_machine(protocol_interface_info_entry_t *cur);
void ws_bootstrap_6lr_seconds_timer(protocol_interface_info_entry_t *cur, uint32_t seconds);
void ws_bootstrap_6lr_primary_parent_update(protocol_interface_info_entry_t *interface, mac_neighbor_table_entry_t *neighbor);
void ws_bootstrap_6lr_secondary_parent_update(protocol_interface_info_entry_t *interface);
void ws_bootstrap_6lr_address_registration_update(protocol_interface_info_entry_t *interface, const uint8_t addr[16]);
#define wisun_mode_router(cur) (cur->bootsrap_mode == ARM_NWK_BOOTSRAP_MODE_6LoWPAN_ROUTER)
#else
#define ws_bootstrap_6lr_asynch_ind(cur, data, ie_ext, message_type) ((void) 0)
#define ws_bootstrap_6lr_asynch_confirm(interface, asynch_message) ((void) 0)
#define ws_bootstrap_6lr_eapol_relay_state_active false
#define ws_bootstrap_6lr_event_handler(cur, event) ((void) 0)
#define ws_bootstrap_6lr_state_machine(cur) ((void) 0)
#define ws_bootstrap_6lr_seconds_timer(cur, seconds) ((void) 0)
#define ws_bootstrap_6lr_primary_parent_update(interface, neighbor) ((void) 0)
#define ws_bootstrap_6lr_secondary_parent_update(interface) ((void) 0)
#define ws_bootstrap_6lr_address_registration_update(interface, addr) ((void) 0)
#define wisun_mode_router(cur) (false)
#endif //HAVE_WS
#endif /* WS_BOOTSTRAP_6LR_H_ */

View File

@ -18,26 +18,15 @@
#ifndef WS_BOOTSTRAP_FFN_H_
#define WS_BOOTSTRAP_FFN_H_
#if defined(HAVE_WS) && defined(HAVE_WS_ROUTER)
#ifdef HAVE_WS
void ws_bootstrap_ffn_asynch_ind(struct protocol_interface_info_entry *cur, const struct mcps_data_ind_s *data, const struct mcps_data_ie_list *ie_ext, uint8_t message_type);
void ws_bootstrap_ffn_asynch_confirm(struct protocol_interface_info_entry *interface, uint8_t asynch_message);
void ws_bootstrap_ffn_event_handler(protocol_interface_info_entry_t *cur, arm_event_s *event);
void ws_bootstrap_ffn_state_machine(protocol_interface_info_entry_t *cur);
void ws_bootstrap_ffn_seconds_timer(protocol_interface_info_entry_t *cur, uint32_t seconds);
int8_t ws_bootstrap_ffn_up(protocol_interface_info_entry_t *cur);
int8_t ws_bootstrap_ffn_down(protocol_interface_info_entry_t *cur);
#define wisun_mode_router(cur) (cur->bootsrap_mode == ARM_NWK_BOOTSRAP_MODE_6LoWPAN_ROUTER)
void ws_dhcp_client_address_request(protocol_interface_info_entry_t *cur, uint8_t *prefix, uint8_t *parent_link_local);
#else
void ws_bootstrap_ffn_rpl_configure(protocol_interface_info_entry_t *cur);
#define ws_bootstrap_ffn_asynch_ind(cur, data, ie_ext, message_type) ((void) 0)
#define ws_bootstrap_ffn_asynch_confirm(interface, asynch_message) ((void) 0)
#define ws_bootstrap_ffn_event_handler(cur, event) ((void) 0)
#define ws_bootstrap_ffn_state_machine(cur) ((void) 0)
#define ws_bootstrap_ffn_seconds_timer(cur, seconds) ((void) 0)
#endif
#define wisun_mode_router(cur) (false)
#endif //HAVE_WS
#endif /* WS_BOOTSTRAP_H_ */
#endif /* WS_BOOTSTRAP_FFN_H_ */

View File

@ -1,43 +0,0 @@
/*
* 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 WS_BOOTSTRAP_LFN_H_
#define WS_BOOTSTRAP_LFN_H_
#if defined(HAVE_WS) && defined(HAVE_WS_HOST)
void ws_bootstrap_lfn_asynch_ind(struct protocol_interface_info_entry *cur, const struct mcps_data_ind_s *data, const struct mcps_data_ie_list *ie_ext, uint8_t message_type);
void ws_bootstrap_lfn_asynch_confirm(struct protocol_interface_info_entry *interface, uint8_t asynch_message);
void ws_bootstrap_lfn_event_handler(protocol_interface_info_entry_t *cur, arm_event_s *event);
void ws_bootstrap_lfn_state_machine(protocol_interface_info_entry_t *cur);
void ws_bootstrap_lfn_seconds_timer(protocol_interface_info_entry_t *cur, uint32_t seconds);
#define wisun_mode_host(cur) (cur->bootsrap_mode == ARM_NWK_BOOTSRAP_MODE_6LoWPAN_HOST)
#else
#define ws_bootstrap_ffn_asynch_ind(cur, data, ie_ext, message_type) ((void) 0)
#define ws_bootstrap_ffn_asynch_confirm(interface, asynch_message) ((void) 0)
#define ws_bootstrap_ffn_event_handler(cur, event) ((void) 0)
#define ws_bootstrap_lfn_state_machine(cur) ((void) 0)
#define ws_bootstrap_lfn_seconds_timer(cur, seconds) ((void) 0)
#define wisun_mode_host(cur) (false)
#endif //HAVE_WS
#endif /* WS_BOOTSTRAP_H_ */

View File

@ -792,6 +792,13 @@ int8_t ws_cfg_bbr_validate(ws_bbr_cfg_t *new_cfg)
return CFG_SETTINGS_CHANGED;
}
if (cfg->dio_interval_min == 0 ||
cfg->min_hop_rank_increase < 32 ||
cfg->dhcp_address_lifetime < 60 ||
cfg->rpl_default_lifetime < 60) {
return CFG_SETTINGS_ERROR_GEN_CONF;
}
return CFG_SETTINGS_OK;
}

View File

@ -33,9 +33,10 @@
#include "6LoWPAN/ws/ws_llc.h"
#include "6LoWPAN/ws/ws_common.h"
#include "6LoWPAN/ws/ws_bootstrap.h"
#include "6LoWPAN/ws/ws_bootstrap_6ln.h"
#include "6LoWPAN/ws/ws_bootstrap_6lr.h"
#include "6LoWPAN/ws/ws_bootstrap_6lbr.h"
#include "6LoWPAN/ws/ws_bootstrap_ffn.h"
#include "6LoWPAN/ws/ws_bootstrap_lfn.h"
#include "6LoWPAN/ws/ws_bbr_api_internal.h"
#include "6LoWPAN/ws/ws_pae_controller.h"
#include "6LoWPAN/ws/ws_cfg_settings.h"
@ -419,10 +420,10 @@ void ws_common_state_machine(protocol_interface_info_entry_t *cur)
{
if (wisun_mode_host(cur)) {
// Configure for LFN device
ws_bootstrap_lfn_state_machine(cur);
ws_bootstrap_6ln_state_machine(cur);
} else if (wisun_mode_router(cur)) {
// Configure FFN device
ws_bootstrap_ffn_state_machine(cur);
ws_bootstrap_6lr_state_machine(cur);
} else if (wisun_mode_border_router(cur)) {
// Configure as Border router
ws_bootstrap_6lbr_state_machine(cur);
@ -435,8 +436,8 @@ void ws_common_seconds_timer(protocol_interface_info_entry_t *cur, uint32_t seco
ws_bbr_seconds_timer(cur, seconds);
ws_bootstrap_seconds_timer(cur, seconds);
ws_bootstrap_6lbr_seconds_timer(cur, seconds);
ws_bootstrap_ffn_seconds_timer(cur, seconds);
ws_bootstrap_lfn_seconds_timer(cur, seconds);
ws_bootstrap_6lr_seconds_timer(cur, seconds);
ws_bootstrap_6ln_seconds_timer(cur, seconds);
blacklist_ttl_update(seconds);
}
@ -661,12 +662,12 @@ uint32_t ws_common_authentication_time_get(protocol_interface_info_entry_t *cur)
void ws_common_primary_parent_update(protocol_interface_info_entry_t *interface, mac_neighbor_table_entry_t *neighbor)
{
ws_bootstrap_primary_parent_update(interface, neighbor);
ws_bootstrap_6lr_primary_parent_update(interface, neighbor);
}
void ws_common_secondary_parent_update(protocol_interface_info_entry_t *interface)
{
ws_bootstrap_secondary_parent_update(interface);
ws_bootstrap_6lr_secondary_parent_update(interface);
}
void ws_common_border_router_alive_update(protocol_interface_info_entry_t *interface)

View File

@ -246,15 +246,21 @@ extern uint8_t DEVICE_MIN_SENS;
*
* Trickle is reset on start (inconsistent heard is set)
*/
#define SEC_PROT_TIMER_EXPIRATIONS 4 // Number of retries
#define SEC_PROT_END_DELAY 30 // 30 seconds 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
// Retry timeout for small network; additional 30 seconds for authenticator delay
#define SEC_PROT_RETRY_TIMEOUT_SMALL (SEC_PROT_SMALL_IMAX * SEC_PROT_TIMER_EXPIRATIONS + SEC_PROT_END_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
// Retry timeout for large network; additional 30 seconds for authenticator delay
#define SEC_PROT_RETRY_TIMEOUT_LARGE (SEC_PROT_LARGE_IMAX * SEC_PROT_TIMER_EXPIRATIONS + SEC_PROT_END_DELAY)
#define SEC_PROT_TIMER_EXPIRATIONS 4 // Number of retries
// Timeout for retrying side of the protocol (runs when trickle not running)
#define SEC_PROT_RETRYING_PROTOCOL_TIMEOUT (5 * 60 * 10) // 5 minutes in ticks
// Maximum number of simultaneous security negotiations
#define MAX_SIMULTANEOUS_SECURITY_NEGOTIATIONS_TX_QUEUE_MIN 64

View File

@ -117,7 +117,7 @@ typedef void ws_asynch_ind(struct protocol_interface_info_entry *interface, cons
typedef void ws_asynch_confirm(struct protocol_interface_info_entry *interface, uint8_t asynch_message);
/**
* @brief ws_asynch_confirm ws asynch data confirmation to asynch message request
* @brief ws_neighbor_info_request neighbor info request
* @param interface The interface pointer
* @param mac_64 Neighbor 64-bit address
* @param neighbor_buffer Buffer where neighbor infor is buffered
@ -128,15 +128,31 @@ typedef void ws_asynch_confirm(struct protocol_interface_info_entry *interface,
*/
typedef bool ws_neighbor_info_request(struct protocol_interface_info_entry *interface, const uint8_t *mac_64, struct llc_neighbour_req *neighbor_buffer, bool request_new);
/**
* @brief ws_eapol_relay_active_check check if eapol relay is active
* @param interface The interface pointer
*
* @return true eapol relay is active
* @return false eapol relay is not active
*/
typedef bool ws_eapol_relay_active_check(struct protocol_interface_info_entry *cur);
/**
* @brief ws_llc_create ws LLC module create
* @param interface Interface pointer
* @param asynch_ind_cb Asynch indication
* @param asynch_cnf_cb Asynch confirm
* @param ws_neighbor_info_request_cb neighbor info request
* @param eapol_relay_active_cb check if eapol relay is active
*
* @param ie_ext Information element list
*
* Function allocate and init LLC class and init it 2 supported 2 API: ws asynch and MPX user are internally registered.
*
* @return 0 on success
* @return < 0 on failure
*/
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);
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, ws_eapol_relay_active_check *eapol_relay_active_cb);
/**
* @brief ws_llc_reset Reset ws LLC parametrs and clean messages

View File

@ -32,6 +32,7 @@
#include "6LoWPAN/ws/ws_common_defines.h"
#include "6LoWPAN/ws/ws_common.h"
#include "6LoWPAN/ws/ws_bootstrap.h"
#include "6LoWPAN/ws/ws_bootstrap_ffn.h"
#include "6LoWPAN/ws/ws_ie_lib.h"
#include "6LoWPAN/ws/ws_llc.h"
#include "6LoWPAN/ws/ws_neighbor_class.h"
@ -153,6 +154,7 @@ typedef struct {
ws_asynch_ind *asynch_ind; /**< LLC Asynch data indication call back configured by user */
ws_asynch_confirm *asynch_confirm; /**< LLC Asynch data confirmation call back configured by user */
ws_neighbor_info_request *ws_neighbor_info_request_cb; /**< LLC Neighbour discover API*/
ws_eapol_relay_active_check *eapol_relay_active_cb; /**< EAPOL relay active check callback */
uint8_t ws_enhanced_response_elements[ENHANCED_FRAME_RESPONSE];
ns_ie_iovec_t ws_header_vector;
bool high_priority_mode;
@ -992,9 +994,9 @@ static uint16_t ws_mpx_header_size_get(llc_data_base_t *base, uint16_t user_id)
return header_size;
}
static bool ws_eapol_handshake_first_msg(uint8_t *pdu, uint16_t length, protocol_interface_info_entry_t *cur)
static bool ws_eapol_handshake_first_msg(llc_data_base_t *base, uint8_t *pdu, uint16_t length, protocol_interface_info_entry_t *cur)
{
if (!ws_eapol_relay_state_active(cur)) {
if (!base->eapol_relay_active_cb(cur)) {
return false;
}
@ -1246,8 +1248,8 @@ static void ws_llc_mpx_eapol_request(llc_data_base_t *base, mpx_user_t *user_cb,
wp_nested_ie_sub_list_t nested_wp_id;
memset(&nested_wp_id, 0, sizeof(wp_nested_ie_sub_list_t));
ie_header_mask.utt_ie = true;
ie_header_mask.bt_ie = ws_eapol_relay_state_active(base->interface_ptr);
ie_header_mask.ea_ie = ws_eapol_handshake_first_msg(data->msdu, data->msduLength, base->interface_ptr);
ie_header_mask.bt_ie = base->eapol_relay_active_cb(base->interface_ptr); /* Broadcast timing information */
ie_header_mask.ea_ie = ws_eapol_handshake_first_msg(base, data->msdu, data->msduLength, base->interface_ptr);
nested_wp_id.bs_ie = ie_header_mask.ea_ie;
@ -1746,7 +1748,7 @@ static uint16_t ws_llc_calculate_dynamic_entries_max(uint16_t min_entry, uint16_
}
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)
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, ws_eapol_relay_active_check eapol_relay_active_cb)
{
llc_data_base_t *base = ws_llc_discover_by_interface(interface);
if (base) {
@ -1765,6 +1767,7 @@ int8_t ws_llc_create(struct protocol_interface_info_entry *interface, ws_asynch_
base->asynch_ind = asynch_ind_cb;
base->asynch_confirm = asynch_cnf_cb;
base->ws_neighbor_info_request_cb = ws_neighbor_info_request_cb;
base->eapol_relay_active_cb = eapol_relay_active_cb;
//Register MAC Extensions
base->interface_ptr->mac_api->mac_mcps_extension_enable(base->interface_ptr->mac_api, &ws_llc_mac_indication_cb, &ws_llc_mac_confirm_cb, &ws_llc_ack_data_req_ext);
base->interface_ptr->mac_api->mac_mcps_edfe_enable(base->interface_ptr->mac_api, &ws_llc_mcps_edfe_handler);

View File

@ -327,9 +327,26 @@ int ws_management_regulatory_domain_get(
return -3;
}
*regulatory_domain = cfg.regulatory_domain;
*operating_class = cfg.operating_class;
*operating_mode = cfg.operating_mode;
if (regulatory_domain) {
*regulatory_domain = cfg.regulatory_domain;
}
// If phy_mode_id is set the new configuration mode is used and class and mode return invalid value
if (operating_class) {
if (cfg.phy_mode_id == 0xff) {
*operating_class = cfg.operating_class;
} else {
*operating_class = 0xff;
}
}
if (operating_mode) {
if (cfg.phy_mode_id == 0xff) {
*operating_mode = cfg.operating_mode;
} else {
*operating_mode = 0xff;
}
}
return 0;
}

View File

@ -295,7 +295,7 @@ void ws_pae_auth_cb_register(protocol_interface_info_entry_t *interface_ptr, ws_
#define ws_pae_auth_timing_adjust(timing)
#define ws_pae_auth_addresses_set(interface_ptr, local_port, remote_addr, remote_port) 1
#define ws_pae_auth_delete NULL
#define ws_pae_auth_cb_register(interface_ptr, hash_set, nw_key_insert, nw_key_index_set, nw_info_updated, ip_addr_get, congestion_get, nw_frame_cnt_read) {(void) hash_set;}
#define ws_pae_auth_cb_register(interface_ptr, hash_set, nw_key_insert, nw_key_index_set, nw_info_updated, ip_addr_get, congestion_get, nw_frame_cnt_read)
#define ws_pae_auth_start(interface_ptr)
#define ws_pae_auth_gtks_updated NULL
#define ws_pae_auth_nw_key_index_update NULL

View File

@ -64,11 +64,15 @@ typedef struct {
typedef struct {
ns_list_link_t link; /**< Link */
#ifdef HAVE_PAE_SUPP
uint8_t target_eui_64[8]; /**< EAPOL target */
uint16_t target_pan_id; /**< EAPOL target PAN ID */
#endif
uint8_t br_eui_64[8]; /**< Border router EUI-64 */
sec_prot_gtk_keys_t gtks; /**< GTKs */
#ifdef HAVE_PAE_AUTH
sec_prot_gtk_keys_t next_gtks; /**< Next GTKs */
#endif
sec_prot_keys_nw_info_t sec_keys_nw_info; /**< Security keys network information */
int8_t gtk_index; /**< GTK index */
uint8_t gtkhash[32]; /**< GTK hashes */
@ -80,17 +84,21 @@ typedef struct {
sec_cfg_t sec_cfg; /**< Security configuration (configuration set values) */
uint32_t restart_cnt; /**< Re-start counter */
protocol_interface_info_entry_t *interface_ptr; /**< List link entry */
ws_pae_controller_auth_completed *auth_completed; /**< Authentication completed callback, continue bootstrap */
ws_pae_controller_nw_key_set *nw_key_set; /**< Key set callback */
ws_pae_controller_nw_key_clear *nw_key_clear; /**< Key clear callback */
ws_pae_controller_nw_send_key_index_set *nw_send_key_index_set; /**< Send key index set callback */
ws_pae_controller_nw_frame_counter_set *nw_frame_counter_set; /**< Frame counter set callback */
ws_pae_controller_nw_frame_counter_read *nw_frame_counter_read; /**< Frame counter read callback */
#ifdef HAVE_PAE_SUPP
ws_pae_controller_auth_completed *auth_completed; /**< Authentication completed callback, continue bootstrap */
ws_pae_controller_auth_next_target *auth_next_target; /**< Authentication next target callback */
#endif
#ifdef HAVE_PAE_AUTH
ws_pae_controller_pan_ver_increment *pan_ver_increment; /**< PAN version increment callback */
ws_pae_controller_nw_info_updated *nw_info_updated; /**< Network information updated callback */
ws_pae_controller_auth_next_target *auth_next_target; /**< Authentication next target callback */
ws_pae_controller_congestion_get *congestion_get; /**< Congestion get callback */
ws_pae_controller_ip_addr_get *ip_addr_get; /**< IP address get callback */
#endif
ws_pae_delete *pae_delete; /**< PAE delete callback */
ws_pae_timer *pae_fast_timer; /**< PAE fast timer callback */
ws_pae_timer *pae_slow_timer; /**< PAE slow timer callback */
@ -128,10 +136,14 @@ static void ws_pae_controller_frame_counter_store(pae_controller_t *entry, bool
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);
static pae_controller_t *ws_pae_controller_get_or_create(int8_t interface_id);
#ifdef HAVE_PAE_AUTH
static void ws_pae_controller_gtk_hash_set(protocol_interface_info_entry_t *interface_ptr, uint8_t *gtkhash);
#endif
static int8_t ws_pae_controller_nw_key_check_and_insert(protocol_interface_info_entry_t *interface_ptr, sec_prot_gtk_keys_t *gtks, bool force_install);
static void ws_pae_controller_active_nw_key_clear(nw_key_t *nw_key);
#ifdef HAVE_PAE_SUPP
static void ws_pae_controller_active_nw_key_set(protocol_interface_info_entry_t *cur, uint8_t index);
#endif
static int8_t ws_pae_controller_gak_from_gtk(uint8_t *gak, uint8_t *gtk, char *network_name);
static void ws_pae_controller_frame_counter_store_and_nw_keys_remove(protocol_interface_info_entry_t *interface_ptr, pae_controller_t *controller, bool use_threshold);
#ifdef HAVE_PAE_AUTH
@ -250,7 +262,7 @@ int8_t ws_pae_controller_authenticator_start(protocol_interface_info_entry_t *in
return 0;
}
int8_t ws_pae_controller_cb_register(protocol_interface_info_entry_t *interface_ptr, ws_pae_controller_auth_completed *completed, ws_pae_controller_auth_next_target *auth_next_target, ws_pae_controller_nw_key_set *nw_key_set, ws_pae_controller_nw_key_clear *nw_key_clear, ws_pae_controller_nw_send_key_index_set *nw_send_key_index_set, ws_pae_controller_nw_frame_counter_set *nw_frame_counter_set, ws_pae_controller_nw_frame_counter_read *nw_frame_counter_read, ws_pae_controller_pan_ver_increment *pan_ver_increment, ws_pae_controller_nw_info_updated *nw_info_updated, ws_pae_controller_congestion_get *congestion_get)
int8_t ws_pae_controller_nw_key_cb_register(protocol_interface_info_entry_t *interface_ptr, ws_pae_controller_nw_key_set *nw_key_set, ws_pae_controller_nw_key_clear *nw_key_clear, ws_pae_controller_nw_send_key_index_set *nw_send_key_index_set, ws_pae_controller_nw_frame_counter_set *nw_frame_counter_set, ws_pae_controller_nw_frame_counter_read *nw_frame_counter_read)
{
if (!interface_ptr) {
return -1;
@ -261,21 +273,40 @@ int8_t ws_pae_controller_cb_register(protocol_interface_info_entry_t *interface_
return -1;
}
controller->nw_key_set = nw_key_set;
controller->nw_key_clear = nw_key_clear;
controller->nw_send_key_index_set = nw_send_key_index_set;
controller->nw_frame_counter_set = nw_frame_counter_set;
controller->nw_frame_counter_read = nw_frame_counter_read;
return 0;
}
int8_t ws_pae_controller_authentication_cb_register(protocol_interface_info_entry_t *interface_ptr, ws_pae_controller_auth_completed *completed, ws_pae_controller_auth_next_target *auth_next_target)
{
#ifdef HAVE_PAE_SUPP
if (!interface_ptr) {
return -1;
}
pae_controller_t *controller = ws_pae_controller_get(interface_ptr);
if (!controller) {
return -1;
}
controller->auth_completed = completed;
controller->nw_key_set = nw_key_set;
controller->nw_key_clear = nw_key_clear;
controller->nw_send_key_index_set = nw_send_key_index_set;
controller->nw_frame_counter_set = nw_frame_counter_set;
controller->nw_frame_counter_read = nw_frame_counter_read;
controller->pan_ver_increment = pan_ver_increment;
controller->nw_info_updated = nw_info_updated;
controller->auth_next_target = auth_next_target;
controller->congestion_get = congestion_get;
return 0;
#else
(void) interface_ptr;
(void) completed;
(void) auth_next_target;
return 0;
#endif
}
int8_t ws_pae_controller_auth_cb_register(protocol_interface_info_entry_t *interface_ptr, ws_pae_controller_ip_addr_get *ip_addr_get)
int8_t ws_pae_controller_information_cb_register(protocol_interface_info_entry_t *interface_ptr, ws_pae_controller_ip_addr_get *ip_addr_get, ws_pae_controller_nw_info_updated *nw_info_updated, ws_pae_controller_congestion_get *congestion_get)
{
#ifdef HAVE_PAE_AUTH
if (!interface_ptr) {
return -1;
}
@ -286,11 +317,42 @@ int8_t ws_pae_controller_auth_cb_register(protocol_interface_info_entry_t *inter
}
controller->ip_addr_get = ip_addr_get;
controller->nw_info_updated = nw_info_updated;
controller->congestion_get = congestion_get;
return 0;
#else
(void) interface_ptr;
(void) ip_addr_get;
(void) nw_info_updated;
(void) congestion_get;
return 0;
#endif
}
int8_t ws_pae_controller_pan_version_cb_register(protocol_interface_info_entry_t *interface_ptr, ws_pae_controller_pan_ver_increment *pan_ver_increment)
{
#ifdef HAVE_PAE_AUTH
if (!interface_ptr) {
return -1;
}
pae_controller_t *controller = ws_pae_controller_get(interface_ptr);
if (!controller) {
return -1;
}
controller->pan_ver_increment = pan_ver_increment;
return 0;
#else
(void) interface_ptr;
(void) pan_ver_increment;
return 0;
#endif
}
int8_t ws_pae_controller_set_target(protocol_interface_info_entry_t *interface_ptr, uint16_t target_pan_id, uint8_t *target_eui_64)
{
#ifdef HAVE_PAE_SUPP
if (!interface_ptr) {
return -1;
}
@ -304,6 +366,12 @@ int8_t ws_pae_controller_set_target(protocol_interface_info_entry_t *interface_p
memcpy(controller->target_eui_64, target_eui_64, 8);
return 0;
#else
(void) interface_ptr;
(void) target_pan_id;
(void) target_eui_64;
return -1;
#endif
}
static void ws_pae_controller_keys_nw_info_init(sec_prot_keys_nw_info_t *sec_keys_nw_info, sec_prot_gtk_keys_t *gtks)
@ -432,6 +500,8 @@ static int8_t ws_pae_controller_auth_nw_frame_counter_read(protocol_interface_in
int8_t ws_pae_controller_nw_key_valid(protocol_interface_info_entry_t *interface_ptr, uint8_t *br_iid)
{
(void) br_iid;
if (!interface_ptr) {
return -1;
}
@ -683,6 +753,7 @@ static void ws_pae_controller_nw_key_index_check_and_set(protocol_interface_info
}
#endif
#ifdef HAVE_PAE_SUPP
static void ws_pae_controller_active_nw_key_set(protocol_interface_info_entry_t *cur, uint8_t index)
{
pae_controller_t *controller = ws_pae_controller_get(cur);
@ -701,6 +772,7 @@ static void ws_pae_controller_active_nw_key_set(protocol_interface_info_entry_t
}
}
#endif
int8_t ws_pae_controller_init(protocol_interface_info_entry_t *interface_ptr)
{
@ -720,15 +792,21 @@ int8_t ws_pae_controller_init(protocol_interface_info_entry_t *interface_ptr)
}
controller->interface_ptr = interface_ptr;
controller->auth_completed = NULL;
controller->nw_key_set = NULL;
controller->nw_key_clear = NULL;
controller->nw_send_key_index_set = NULL;
controller->nw_frame_counter_set = NULL;
controller->nw_frame_counter_read = NULL;
#ifdef HAVE_PAE_SUPP
controller->auth_completed = NULL;
controller->auth_next_target = NULL;
#endif
#ifdef HAVE_PAE_AUTH
controller->pan_ver_increment = NULL;
controller->nw_info_updated = NULL;
controller->auth_next_target = NULL;
controller->congestion_get = NULL;
controller->ip_addr_get = NULL;
#endif
memset(&controller->sec_cfg, 0, sizeof(sec_cfg_t));
@ -773,7 +851,9 @@ int8_t ws_pae_controller_configure(protocol_interface_info_entry_t *interface_pt
static void ws_pae_controller_data_init(pae_controller_t *controller)
{
#ifdef HAVE_PAE_SUPP
memset(controller->target_eui_64, 0, 8);
#endif
memset(controller->br_eui_64, 0, 8);
memset(controller->gtkhash, 0, 32);
@ -782,7 +862,9 @@ static void ws_pae_controller_data_init(pae_controller_t *controller)
ws_pae_controller_active_nw_key_clear(&controller->nw_key[2]);
ws_pae_controller_active_nw_key_clear(&controller->nw_key[3]);
#ifdef HAVE_PAE_SUPP
controller->target_pan_id = 0xffff;
#endif
controller->pae_delete = NULL;
controller->pae_fast_timer = NULL;
controller->pae_slow_timer = NULL;
@ -803,7 +885,9 @@ static void ws_pae_controller_data_init(pae_controller_t *controller)
controller->auth_started = false;
ws_pae_controller_frame_counter_reset(&controller->frame_counters);
sec_prot_keys_gtks_init(&controller->gtks);
#ifdef HAVE_PAE_AUTH
sec_prot_keys_gtks_init(&controller->next_gtks);
#endif
sec_prot_certs_init(&controller->certs);
sec_prot_certs_ext_certificate_validation_set(&controller->certs, pae_controller_config.ext_cert_valid_enabled);
ws_pae_controller_keys_nw_info_init(&controller->sec_keys_nw_info, &controller->gtks);
@ -1006,7 +1090,6 @@ int8_t ws_pae_controller_auth_init(protocol_interface_info_entry_t *interface_pt
}
sec_prot_keys_gtks_updated_reset(&controller->gtks);
}
#endif
if (read_gtks_to && ws_pae_controller_nw_info_read(controller, read_gtks_to) >= 0) {
/* If network information i.e pan_id and network name exists updates bootstrap with it,
(in case already configured by application then no changes are made) */
@ -1020,6 +1103,7 @@ int8_t ws_pae_controller_auth_init(protocol_interface_info_entry_t *interface_pt
ws_pae_controller_nvm_nw_info_write(controller->interface_ptr, controller->sec_keys_nw_info.key_pan_id, controller->sec_keys_nw_info.network_name, gtk_eui64, NULL, system_time, controller->sec_keys_nw_info.system_time_changed);
}
}
#endif
ws_pae_key_storage_init();
if (read_gtks_to) {
@ -1539,6 +1623,7 @@ int8_t ws_pae_controller_gtk_update(int8_t interface_id, uint8_t *gtk[GTK_NUM])
int8_t ws_pae_controller_next_gtk_update(int8_t interface_id, uint8_t *gtk[GTK_NUM])
{
#ifdef HAVE_PAE_AUTH
if (!gtk) {
return -1;
}
@ -1558,6 +1643,11 @@ int8_t ws_pae_controller_next_gtk_update(int8_t interface_id, uint8_t *gtk[GTK_N
}
return 0;
#else
(void) interface_id;
(void) gtk;
return -1;
#endif
}
int8_t ws_pae_controller_active_key_update(int8_t interface_id, uint8_t index)
@ -1657,6 +1747,7 @@ void ws_pae_controller_forced_gc(bool full_gc)
}
}
#ifdef HAVE_PAE_AUTH
static void ws_pae_controller_gtk_hash_set(protocol_interface_info_entry_t *interface_ptr, uint8_t *gtkhash)
{
pae_controller_t *controller = ws_pae_controller_get(interface_ptr);
@ -1681,6 +1772,7 @@ static void ws_pae_controller_gtk_hash_set(protocol_interface_info_entry_t *inte
controller->gtkhash_set = true;
}
}
#endif
uint8_t *ws_pae_controller_gtk_hash_ptr_get(protocol_interface_info_entry_t *interface_ptr)
{

View File

@ -573,6 +573,22 @@ typedef void ws_pae_controller_nw_frame_counter_set(protocol_interface_info_entr
*/
typedef void ws_pae_controller_nw_frame_counter_read(protocol_interface_info_entry_t *interface_ptr, uint32_t *counter, uint8_t slot);
/**
* ws_pae_controller_nw_key_cb_register register network key control callbacks
*
* \param interface_ptr interface
* \param nw_key_set network key set callback
* \param nw_key_clear network key clear callback
* \param nw_send_key_index_set network send key index set callback
* \param nw_frame_counter_set network frame counter set callback
* \param nw_frame_counter_read network frame counter read callback
*
* \return < 0 failure
* \return >= 0 success
*
*/
int8_t ws_pae_controller_nw_key_cb_register(protocol_interface_info_entry_t *interface_ptr, ws_pae_controller_nw_key_set *nw_key_set, ws_pae_controller_nw_key_clear *nw_key_clear, ws_pae_controller_nw_send_key_index_set *nw_send_key_index_set, ws_pae_controller_nw_frame_counter_set *nw_frame_counter_set, ws_pae_controller_nw_frame_counter_read *nw_frame_counter_read);
/**
* ws_pae_controller_auth_completed authentication completed callback
*
@ -596,12 +612,29 @@ typedef void ws_pae_controller_auth_completed(protocol_interface_info_entry_t *i
typedef const uint8_t *ws_pae_controller_auth_next_target(protocol_interface_info_entry_t *interface_ptr, const uint8_t *previous_eui_64, uint16_t *pan_id);
/**
* ws_pae_controller_pan_ver_increment PAN version increment callback
* ws_pae_controller_authentication_cb_register register supplicant authentication control callbacks
*
* \param interface_ptr interface
* \param completed authentication completed callback
* \param next_target authentication next target callback
*
* \return < 0 failure
* \return >= 0 success
*
*/
typedef void ws_pae_controller_pan_ver_increment(protocol_interface_info_entry_t *interface_ptr);
int8_t ws_pae_controller_authentication_cb_register(protocol_interface_info_entry_t *interface_ptr, ws_pae_controller_auth_completed *completed, ws_pae_controller_auth_next_target *auth_next_target);
/**
* ws_pae_controller_ip_addr_get gets IP addressing information
*
* \param interface_ptr interface
* \param address IP address
*
* \return < 0 failure
* \return >= 0 success
*
*/
typedef int8_t ws_pae_controller_ip_addr_get(protocol_interface_info_entry_t *interface_ptr, uint8_t *address);
/**
* ws_pae_controller_nw_info_updated network information is updated (read from memory)
@ -626,17 +659,10 @@ typedef void ws_pae_controller_nw_info_updated(protocol_interface_info_entry_t *
typedef bool ws_pae_controller_congestion_get(protocol_interface_info_entry_t *interface_ptr, uint16_t active_supp);
/**
* ws_pae_controller_cb_register register controller callbacks
* ws_pae_controller_information_cb_register register information callbacks
*
* \param interface_ptr interface
* \param completed authentication completed callback
* \param next_target authentication next target callback
* \param nw_key_set network key set callback
* \param nw_key_clear network key clear callback
* \param nw_send_key_index_set network send key index set callback
* \param nw_frame_counter_set network frame counter set callback
* \param nw_frame_counter_read network frame counter read callback
* \param pan_ver_increment PAN version increment callback
* \param ip_addr_get IP address get callback
* \param nw_info_updated network information updated callback
* \param congestion_get congestion get callback
*
@ -644,31 +670,27 @@ typedef bool ws_pae_controller_congestion_get(protocol_interface_info_entry_t *i
* \return >= 0 success
*
*/
int8_t ws_pae_controller_cb_register(protocol_interface_info_entry_t *interface_ptr, ws_pae_controller_auth_completed *completed, ws_pae_controller_auth_next_target *auth_next_target, ws_pae_controller_nw_key_set *nw_key_set, ws_pae_controller_nw_key_clear *nw_key_clear, ws_pae_controller_nw_send_key_index_set *nw_send_key_index_set, ws_pae_controller_nw_frame_counter_set *nw_frame_counter_set, ws_pae_controller_nw_frame_counter_read *nw_frame_counter_read, ws_pae_controller_pan_ver_increment *pan_ver_increment, ws_pae_controller_nw_info_updated *nw_info_updated, ws_pae_controller_congestion_get *congestion_get);
int8_t ws_pae_controller_information_cb_register(protocol_interface_info_entry_t *interface_ptr, ws_pae_controller_ip_addr_get *ip_addr_get, ws_pae_controller_nw_info_updated *nw_info_updated, ws_pae_controller_congestion_get *congestion_get);
/**
* ws_pae_controller_ip_addr_get gets IP addressing information
* ws_pae_controller_pan_ver_increment PAN version increment callback
*
* \param interface_ptr interface
* \param address IP address
*
*/
typedef void ws_pae_controller_pan_ver_increment(protocol_interface_info_entry_t *interface_ptr);
/**
* ws_pae_controller_bbr_control_cb_register register PAN version control callbacks
*
* \param interface_ptr interface
* \param pan_ver_increment PAN version increment callback
*
* \return < 0 failure
* \return >= 0 success
*
*/
typedef int8_t ws_pae_controller_ip_addr_get(protocol_interface_info_entry_t *interface_ptr, uint8_t *address);
/**
* ws_pae_controller_auth_cb_register register authenticator callbacks
*
* \param interface_ptr interface
* \param ip_addr_get IP address get callback
*
* \return < 0 failure
* \return >= 0 success
*
*/
int8_t ws_pae_controller_auth_cb_register(protocol_interface_info_entry_t *interface_ptr, ws_pae_controller_ip_addr_get *ip_addr_get);
int8_t ws_pae_controller_pan_version_cb_register(protocol_interface_info_entry_t *interface_ptr, ws_pae_controller_pan_ver_increment *pan_ver_increment);
/**
* ws_pae_controller_fast_timer PAE controller fast timer call

View File

@ -42,6 +42,7 @@
#include "6LoWPAN/ws/ws_pae_key_storage.h"
#ifdef HAVE_WS
#ifdef HAVE_PAE_AUTH
#define TRACE_GROUP "wsks"
@ -1081,5 +1082,6 @@ static void ws_pae_key_storage_array_ptk_invalid(sec_prot_keys_storage_t *storag
storage_array->ptk_lifetime = 0;
}
#endif /* HAVE_PAE_AUTH */
#endif /* HAVE_WS */

View File

@ -18,6 +18,8 @@
#ifndef WS_PAE_KEY_STORAGE_H_
#define WS_PAE_KEY_STORAGE_H_
#ifdef HAVE_PAE_AUTH
/*
* Port access entity key storage functions.
*
@ -169,4 +171,22 @@ void ws_pae_key_storage_fast_timer(uint16_t ticks);
*/
uint16_t ws_pae_key_storage_storing_interval_get(void);
#else
#define ws_pae_key_storage_memory_set(key_storages_number, key_storage_size, key_storages)
#define ws_pae_key_storage_settings_set(alloc_max_number, alloc_size, storing_interval)
#define ws_pae_key_storage_init()
#define ws_pae_key_storage_delete()
#define ws_pae_key_storage_store()
#define ws_pae_key_storage_read(restart_cnt)
#define ws_pae_key_storage_remove()
#define ws_pae_key_storage_supp_write(instance, pae_supp)
#define ws_pae_key_storage_supp_read(instance, eui_64, gtks, certs)
#define ws_pae_key_storage_supp_delete(instance, eui64)
#define ws_pae_key_storage_timer(seconds)
#define ws_pae_key_storage_fast_timer(ticks)
#define ws_pae_key_storage_storing_interval_get() 0
#endif
#endif /* WS_PAE_KEY_STORAGE_H_ */

View File

@ -374,9 +374,6 @@ void ws_pae_lib_supp_list_to_inactive(void *instance, supp_list_t *active_supp_l
// Remove supplicant entry
ws_pae_lib_supp_list_remove(instance, active_supp_list, entry, supp_deleted);
if (supp_deleted) {
supp_deleted(instance);
}
}
void ws_pae_lib_supp_list_purge(void *instance, supp_list_t *active_supp_list, uint16_t max_number, uint8_t max_purge, ws_pae_lib_supp_deleted supp_deleted)

View File

@ -1007,6 +1007,7 @@ static int8_t ws_pae_supp_eapol_pdu_address_check(protocol_interface_info_entry_
static int8_t ws_pae_supp_parent_eui_64_get(protocol_interface_info_entry_t *interface_ptr, uint8_t *eui_64)
{
rpl_dodag_info_t dodag_info;
(void) dodag_info; // avoid unused warning in ws_host mode
if (!interface_ptr->rpl_domain) {
return -1;
}

View File

@ -265,8 +265,8 @@ void ws_pae_supp_cb_register(protocol_interface_info_entry_t *interface_ptr, ws_
#define ws_pae_supp_init(interface_ptr, certs, sec_timer_cfg, sec_prot_cfg) 1
#define ws_pae_supp_delete NULL
#define ws_pae_supp_timing_adjust(timing) 1
#define ws_pae_supp_cb_register(interface_ptr, completed, nw_key_insert, nw_key_index_set)
#define ws_pae_supp_nw_key_valid(interface_ptr) -1
#define ws_pae_supp_cb_register(interface_ptr, completed, auth_next_target,nw_key_insert, nw_key_index_set, gtk_hash_ptr_get, nw_info_updated)
#define ws_pae_supp_nw_key_valid(interface_ptr, br_iid) -1
#define ws_pae_supp_fast_timer NULL
#define ws_pae_supp_slow_timer NULL
#define ws_pae_supp_authenticate(interface_ptr, dest_pan_id, dest_eui_64) PAE_SUPP_NOT_ENABLED
@ -276,6 +276,7 @@ void ws_pae_supp_cb_register(protocol_interface_info_entry_t *interface_ptr, ws_
#define ws_pae_supp_nw_key_index_update NULL
#define ws_pae_supp_gtks_set(interface_ptr, gtks)
#define ws_pae_supp_eapol_target_remove(interface_ptr)
#define ws_pae_supp_nw_info_set NULL
#endif

View File

@ -218,7 +218,7 @@ int ws_test_procedure_trigger(int8_t interface_id, ws_test_proc_t procedure, voi
}
}
return ws_bootstrap_test_procedure_trigger(cur, procedure);
return ws_bootstrap_test_procedure_trigger(cur, (ws_bootsrap_procedure_t) procedure);
}
#endif // HAVE_WS

View File

@ -1,4 +1,4 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# Copyright (c) 2020-2021, Pelion and affiliates.
# SPDX-License-Identifier: Apache-2.0
target_include_directories(mbed-nanostack-sal_stack

View File

@ -1,4 +1,4 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# Copyright (c) 2020-2021, Pelion and affiliates.
# SPDX-License-Identifier: Apache-2.0
target_include_directories(mbed-nanostack-sal_stack

View File

@ -326,6 +326,7 @@ void icmpv6_stop_router_advertisements(protocol_interface_info_entry_t *cur, con
static void icmpv6_send_ra(protocol_interface_info_entry_t *cur, const uint8_t *dest, const uint8_t *abro)
{
#ifndef HAVE_RPL
(void) dest;
(void) abro;
#endif
if (cur->nwk_id == IF_6LoWPAN) {

View File

@ -1,4 +1,4 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# Copyright (c) 2020-2021, Pelion and affiliates.
# SPDX-License-Identifier: Apache-2.0
target_include_directories(mbed-nanostack-sal_stack

View File

@ -1438,6 +1438,10 @@ buffer_t *socket_tx_buffer_event(buffer_t *buf, uint8_t status)
if (buf->ack_receive_cb) {
buf->ack_receive_cb(buf, status);
}
if (status == SOCKET_BUSY) {
//SOCKET_BUSY shuold not be forward further and switched back orginal behaviour
status = SOCKET_TX_FAIL;
}
/* Suppress events once socket orphaned */
if (!buf->socket || (buf->socket->flags & (SOCKET_FLAG_PENDING | SOCKET_FLAG_CLOSED))) {

View File

@ -1,4 +1,4 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# Copyright (c) 2020-2021, Pelion and affiliates.
# SPDX-License-Identifier: Apache-2.0
target_include_directories(mbed-nanostack-sal_stack

View File

@ -1,4 +1,4 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# Copyright (c) 2020-2021, Pelion and affiliates.
# SPDX-License-Identifier: Apache-2.0
target_include_directories(mbed-nanostack-sal_stack

View File

@ -1,4 +1,4 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# Copyright (c) 2020-2021, Pelion and affiliates.
# SPDX-License-Identifier: Apache-2.0
target_include_directories(mbed-nanostack-sal_stack

View File

@ -71,6 +71,7 @@ static void mac_mlme_start_confirm_handler(protocol_interface_rf_mac_setup_s *rf
static void mac_mlme_scan_confirm_handler(protocol_interface_rf_mac_setup_s *rf_ptr, const mlme_scan_conf_t *conf);
static int mac_mlme_set_symbol_rate(protocol_interface_rf_mac_setup_s *rf_mac_setup);
static int mac_mlme_allocate_tx_buffers(protocol_interface_rf_mac_setup_s *rf_mac_setup, arm_device_driver_list_s *dev_driver, uint16_t mtu_size);
static int mac_mlme_allocate_beacon_payload_buffer(protocol_interface_rf_mac_setup_s *rf_mac_setup, uint16_t mtu_size);
static void mac_mlme_energy_scan_start(protocol_interface_rf_mac_setup_s *rf_mac_setup, uint8_t channel)
{
@ -1133,7 +1134,6 @@ static int mac_mlme_set_symbol_rate(protocol_interface_rf_mac_setup_s *rf_mac_se
static int mac_mlme_allocate_tx_buffers(protocol_interface_rf_mac_setup_s *rf_mac_setup, arm_device_driver_list_s *dev_driver, uint16_t mtu_size)
{
ns_dyn_mem_free(rf_mac_setup->dev_driver_tx_buffer.buf);
ns_dyn_mem_free(rf_mac_setup->mac_beacon_payload);
uint16_t total_length = 0;
//Allocate tx buffer by given MTU + header + tail
total_length = mtu_size;
@ -1142,15 +1142,26 @@ static int mac_mlme_allocate_tx_buffers(protocol_interface_rf_mac_setup_s *rf_ma
if (!rf_mac_setup->dev_driver_tx_buffer.buf) {
return -1;
}
//allocate Beacon Payload buffer
rf_mac_setup->max_beacon_payload_length = mtu_size - MAC_IEEE_802_15_4_MAX_BEACON_OVERHEAD;
rf_mac_setup->mac_beacon_payload = ns_dyn_mem_alloc(rf_mac_setup->max_beacon_payload_length);
return 0;
}
static int mac_mlme_allocate_beacon_payload_buffer(protocol_interface_rf_mac_setup_s *rf_mac_setup, uint16_t mtu_size)
{
rf_mac_setup->mac_beacon_payload = ns_dyn_mem_alloc(mtu_size);
if (!rf_mac_setup->mac_beacon_payload) {
return -1;
}
rf_mac_setup->max_beacon_payload_length = mtu_size;
rf_mac_setup->mac_beacon_payload_size = 0;
memset(rf_mac_setup->mac_beacon_payload, 0, rf_mac_setup->max_beacon_payload_length);
return 0;
}
protocol_interface_rf_mac_setup_s *mac_mlme_data_base_allocate(uint8_t *mac64, arm_device_driver_list_s *dev_driver, mac_description_storage_size_t *storage_sizes, uint16_t mtu_size)
{
//allocate security
@ -1191,6 +1202,11 @@ protocol_interface_rf_mac_setup_s *mac_mlme_data_base_allocate(uint8_t *mac64, a
mac_mlme_data_base_deallocate(entry);
return NULL;
}
//Allocate Default Beacon pyload data
if (mac_mlme_allocate_beacon_payload_buffer(entry, MAC_IEEE_802_15_4_MAX_BEACON_PAYLOAD_LENGTH)) {
mac_mlme_data_base_deallocate(entry);
return NULL;
}
entry->mac_tasklet_id = mac_mcps_sap_tasklet_init();
if (entry->mac_tasklet_id < 0) {
@ -1213,7 +1229,6 @@ protocol_interface_rf_mac_setup_s *mac_mlme_data_base_allocate(uint8_t *mac64, a
entry->mac_mlme_retry_max = MAC_DEFAULT_MAX_FRAME_RETRIES;
memset(entry->mac_default_key_source, 0xff, 8);
memset(entry->mac_auto_request.Keysource, 0xff, 8);
memset(entry->mac_beacon_payload, 0, entry->max_beacon_payload_length);
entry->mac_auto_request.SecurityLevel = 6;
entry->mac_auto_request.KeyIndex = 0xff;
mac_pd_sap_rf_low_level_function_set(entry, entry->dev_driver);

View File

@ -1,4 +1,4 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# Copyright (c) 2020-2021, Pelion and affiliates.
# SPDX-License-Identifier: Apache-2.0
target_include_directories(mbed-nanostack-sal_stack

View File

@ -1,4 +1,4 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# Copyright (c) 2020-2021, Pelion and affiliates.
# SPDX-License-Identifier: Apache-2.0
target_include_directories(mbed-nanostack-sal_stack

View File

@ -1,4 +1,4 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# Copyright (c) 2020-2021, Pelion and affiliates.
# SPDX-License-Identifier: Apache-2.0
target_include_directories(mbed-nanostack-sal_stack

View File

@ -91,12 +91,10 @@ typedef enum icmp_state {
ER_SCAN = 2,
ER_ADDRESS_REQ = 3,
ER_BIND_COMP = 4,
#ifdef HAVE_RPL
ER_RPL_MC = 5,
ER_RPL_SCAN = 6,
ER_RPL_UNICAST = 7,
ER_DAO_TX = 8,
#endif
ER_PANA_AUTH = 9,
ER_PANA_AUTH_DONE = 10,
ER_PANA_AUTH_ERROR = 11,
@ -104,9 +102,7 @@ typedef enum icmp_state {
ER_MLE_LINK_REQ = 13,
ER_MLE_LINK_SHORT_SYNCH = 14,
ER_MLE_LINK_ADDRESS_SYNCH = 15,
#ifdef HAVE_RPL
ER_ROUTER_SYNCH = 17,
#endif
ER_PANA_PING = 18,
ER_PARENT_SYNCH_LOST = 19,
ER_MLE_SCAN = 20,

View File

@ -1,4 +1,4 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# Copyright (c) 2020-2021, Pelion and affiliates.
# SPDX-License-Identifier: Apache-2.0
target_include_directories(mbed-nanostack-sal_stack

View File

@ -132,6 +132,19 @@ void rpl_control_event(struct rpl_domain *domain, rpl_event_t event)
}
}
static void rpl_control_convert_internal_config(rpl_dodag_conf_int_t *conf, const rpl_dodag_conf_t *external_conf)
{
conf->dio_interval_min = external_conf->dio_interval_min;
conf->dio_interval_doublings = external_conf->dio_interval_doublings;
conf->dio_redundancy_constant = external_conf->dio_redundancy_constant;
conf->default_lifetime = external_conf->default_lifetime;
conf->dag_max_rank_increase = external_conf->dag_max_rank_increase;
conf->min_hop_rank_increase = external_conf->min_hop_rank_increase;
conf->objective_code_point = external_conf->objective_code_point;
conf->lifetime_unit = external_conf->lifetime_unit;
conf->options = rpl_conf_options(external_conf->authentication, external_conf->path_control_size);
conf->reserved = 0;
}
/* When we join a new instance, we need to publish existing addresses.
* Later addresses additions/removals are handled by rpl_control_addr_notifier.
@ -660,7 +673,9 @@ rpl_dodag_t *rpl_control_create_dodag_root(rpl_domain_t *domain, uint8_t instanc
return NULL;
}
rpl_dodag_update_config(dodag, conf, NULL, NULL);
rpl_dodag_conf_int_t internal_conf;
rpl_control_convert_internal_config(&internal_conf, conf);
rpl_dodag_update_config(dodag, &internal_conf, NULL, NULL);
rpl_dodag_set_root(dodag, true);
rpl_dodag_version_t *version = rpl_create_dodag_version(dodag, rpl_seq_init());
if (!version) {
@ -717,11 +732,12 @@ void rpl_control_update_dodag_config(struct rpl_dodag *dodag, const rpl_dodag_co
{
if (rpl_dodag_am_root(dodag)) {
rpl_dodag_update_config(dodag, conf, NULL, NULL);
rpl_dodag_conf_int_t internal_conf;
rpl_control_convert_internal_config(&internal_conf, conf);
rpl_dodag_update_config(dodag, &internal_conf, NULL, NULL);
}
}
void rpl_control_set_dodag_pref(rpl_dodag_t *dodag, uint8_t pref)
{
if (rpl_dodag_am_root(dodag)) {
@ -839,34 +855,33 @@ static const uint8_t *rpl_control_find_option_in_buffer(const buffer_t *buf, uin
*
* Figure 24: Format of the DODAG Configuration Option
*/
static const uint8_t *rpl_control_read_conf(rpl_dodag_conf_t *conf_out, const uint8_t *opt)
static const uint8_t *rpl_control_read_conf(rpl_dodag_conf_int_t *conf_out, const uint8_t *opt)
{
conf_out->authentication = opt[2] & 0x08;
conf_out->path_control_size = opt[2] & 0x07;
conf_out->options = opt[2];
conf_out->dio_interval_doublings = opt[3];
conf_out->dio_interval_min = opt[4];
conf_out->dio_redundancy_constant = opt[5];
conf_out->dag_max_rank_increase = common_read_16_bit(opt + 6);
conf_out->min_hop_rank_increase = common_read_16_bit(opt + 8);
conf_out->objective_code_point = common_read_16_bit(opt + 10);
conf_out->reserved = opt[12];
conf_out->default_lifetime = opt[13];
conf_out->lifetime_unit = common_read_16_bit(opt + 14);
return opt + 16;
}
static uint8_t *rpl_control_write_conf(uint8_t *opt_out, const rpl_dodag_conf_t *conf)
static uint8_t *rpl_control_write_conf(uint8_t *opt_out, const rpl_dodag_conf_int_t *conf)
{
opt_out[0] = RPL_DODAG_CONF_OPTION;
opt_out[1] = 14;
opt_out[2] = conf->authentication ? RPL_CONF_FLAG_AUTH : 0;
opt_out[2] |= conf->path_control_size;
opt_out[2] = conf->options;
opt_out[3] = conf->dio_interval_doublings;
opt_out[4] = conf->dio_interval_min;
opt_out[5] = conf->dio_redundancy_constant;
common_write_16_bit(conf->dag_max_rank_increase, opt_out + 6);
common_write_16_bit(conf->min_hop_rank_increase, opt_out + 8);
common_write_16_bit(conf->objective_code_point, opt_out + 10);
opt_out[12] = 0; // reserved
opt_out[12] = conf->reserved;
opt_out[13] = conf->default_lifetime;
common_write_16_bit(conf->lifetime_unit, opt_out + 14);
return opt_out + 16;
@ -1174,7 +1189,7 @@ malformed:
/* Update DODAG config information, if option present, and either we don't have it or version is newer */
const uint8_t *dodag_conf_ptr = rpl_control_find_option_in_buffer(buf, 24, RPL_DODAG_CONF_OPTION, 14);
if (dodag_conf_ptr) {
rpl_dodag_conf_t conf_buf;
rpl_dodag_conf_int_t conf_buf;
rpl_control_read_conf(&conf_buf, dodag_conf_ptr);
if (!rpl_dodag_update_config(dodag, &conf_buf, buf->src_sa.address, &become_leaf)) {
goto invalid_parent;
@ -1182,7 +1197,7 @@ malformed:
}
/* If we don't have any DODAG config information, ask by unicast DIS */
const rpl_dodag_conf_t *conf = rpl_dodag_get_config(dodag);
const rpl_dodag_conf_int_t *conf = rpl_dodag_get_config(dodag);
if (!conf) {
/* TODO - rate limit DIS? */
if (domain->new_parent_add && !domain->new_parent_add(buf->src_sa.address, domain->cb_handle, instance, rank)) {
@ -1361,7 +1376,7 @@ void rpl_control_transmit(rpl_domain_t *domain, protocol_interface_info_entry_t
/* Transmit a DIO (unicast or multicast); cur may be NULL if multicast */
void rpl_control_transmit_dio(rpl_domain_t *domain, protocol_interface_info_entry_t *cur, uint8_t instance_id, uint8_t dodag_version, uint16_t rank, uint8_t g_mop_prf, uint8_t dtsn, rpl_dodag_t *dodag, const uint8_t dodagid[16], const rpl_dodag_conf_t *conf, const uint8_t *dst)
void rpl_control_transmit_dio(rpl_domain_t *domain, protocol_interface_info_entry_t *cur, uint8_t instance_id, uint8_t dodag_version, uint16_t rank, uint8_t g_mop_prf, uint8_t dtsn, rpl_dodag_t *dodag, const uint8_t dodagid[16], const rpl_dodag_conf_int_t *conf, const uint8_t *dst)
{
uint16_t length;
@ -1931,7 +1946,7 @@ bool rpl_control_read_dodag_info(const rpl_instance_t *instance, rpl_dodag_info_
return rpl_upward_read_dodag_info(instance, dodag_info);
}
const rpl_dodag_conf_t *rpl_control_get_dodag_config(const rpl_instance_t *instance)
const rpl_dodag_conf_int_t *rpl_control_get_dodag_config(const rpl_instance_t *instance)
{
rpl_dodag_t *dodag = rpl_instance_current_dodag(instance);
if (!dodag) {

View File

@ -18,8 +18,6 @@
#ifndef RPL_CONTROL_H_
#define RPL_CONTROL_H_
#ifdef HAVE_RPL
#include "ns_list.h"
#include "ipv6_stack/ipv6_routing_table.h"
@ -85,6 +83,29 @@ typedef struct rpl_dodag_conf {
uint16_t lifetime_unit; /* seconds */
} rpl_dodag_conf_t;
/* Internally used configuration parameters for a DODAG, obtained through DIO DODAG Configuration options
*
* This structure has all the fields that are in the configuration
* to allow forwarding new bits that are added in future specifications.
*/
typedef struct rpl_dodag_conf_int {
uint8_t options; /* Flags|A|PCS */
uint8_t reserved; /* Reserved fields in options (byte 12)*/
uint8_t dio_interval_min; /* log2 milliseconds */
uint8_t dio_interval_doublings;
uint8_t dio_redundancy_constant;
uint8_t default_lifetime; /* lifetime units */
uint16_t dag_max_rank_increase;
uint16_t min_hop_rank_increase;
uint16_t objective_code_point;
uint16_t lifetime_unit; /* seconds */
} rpl_dodag_conf_int_t;
/* Helpers to handle configuration option bits*/
#define rpl_conf_options(security, path_control_size) ((security ? 1:0) << 4) | (path_control_size & 0x07)
#define rpl_conf_option_security(conf) (bool)((conf)->options & 0x08)
#define rpl_conf_option_path_control_size(conf) ((conf)->options & 0x07)
/* Descriptor for a route from a DIO Route Information option.
* Used to hold the "master copy" in the DODAG structure - the table for the
* current DODAG is used to populate routes in our system routing table, and to
@ -104,6 +125,8 @@ typedef struct rpl_dio_route {
uint8_t prefix[]; /* Variable-length prefix */
} rpl_dio_route_t;
#ifdef HAVE_RPL
typedef NS_LIST_HEAD(rpl_dio_route_t, link) rpl_dio_route_list_t;
/******************************* RPL internal API ****************************/
@ -112,7 +135,7 @@ void *rpl_realloc(void *p, uint16_t old_size, uint16_t new_size);
void rpl_free(void *p, uint16_t size);
void rpl_control_transmit(struct rpl_domain *domain, struct protocol_interface_info_entry *cur, uint8_t code, struct buffer *buf, const uint8_t *dst);
void rpl_control_transmit_multicast_dio(struct rpl_domain *domain, struct rpl_instance *instance, uint8_t instance_id, uint8_t dodag_version, uint16_t rank, uint8_t g_mop_prf, uint8_t dtsn, const uint8_t dodagid[16], const struct rpl_dodag_conf *conf);
void rpl_control_transmit_dio(struct rpl_domain *domain, struct protocol_interface_info_entry *cur, uint8_t instance_id, uint8_t dodag_version, uint16_t rank, uint8_t g_mop_prf, uint8_t dtsn, struct rpl_dodag *dodag, const uint8_t dodagid[16], const struct rpl_dodag_conf *conf, const uint8_t *dst);
void rpl_control_transmit_dio(struct rpl_domain *domain, struct protocol_interface_info_entry *cur, uint8_t instance_id, uint8_t dodag_version, uint16_t rank, uint8_t g_mop_prf, uint8_t dtsn, struct rpl_dodag *dodag, const uint8_t dodagid[16], const struct rpl_dodag_conf_int *conf, const uint8_t *dst);
bool rpl_control_transmit_dao(struct rpl_domain *domain, struct protocol_interface_info_entry *cur, struct rpl_instance *instance, uint8_t instance_id, uint8_t dao_sequence, const uint8_t dodagid[16], const uint8_t *opts, uint16_t opts_size, const uint8_t *dst);
void rpl_control_disable_ra_routes(struct rpl_domain *domain);
void rpl_control_event(struct rpl_domain *domain, rpl_event_t event);
@ -207,7 +230,7 @@ struct rpl_instance *rpl_control_enumerate_instances(rpl_domain_t *domain, struc
struct rpl_instance *rpl_control_lookup_instance(rpl_domain_t *domain, uint8_t instance_id, const uint8_t *dodagid);
bool rpl_control_get_instance_dao_target_count(rpl_domain_t *domain, uint8_t instance_id, const uint8_t *dodagid, const uint8_t *prefix, uint16_t *target_count);
bool rpl_control_read_dodag_info(const struct rpl_instance *instance, struct rpl_dodag_info_t *dodag_info);
const rpl_dodag_conf_t *rpl_control_get_dodag_config(const struct rpl_instance *instance);
const rpl_dodag_conf_int_t *rpl_control_get_dodag_config(const struct rpl_instance *instance);
const uint8_t *rpl_control_preferred_parent_addr(const struct rpl_instance *instance, bool global);
uint16_t rpl_control_current_rank(const struct rpl_instance *instance);
uint8_t rpl_policy_mrhof_parent_set_size_get(const rpl_domain_t *domain);
@ -215,15 +238,39 @@ void rpl_control_instant_poison(struct protocol_interface_info_entry *cur, rpl_d
#else /* HAVE_RPL */
#define rpl_control_set_memory_limits(soft_limit, hard_limit)
#define rpl_control_fast_timer(ticks) ((void) 0)
#define rpl_control_slow_timer(seconds) ((void) 0)
#define rpl_control_transmit_dis(domain, cur, pred, instance_id, dodagid, version, dst) ((void) 0)
#define rpl_control_transmit_dio_trigger(cur, domain) ((void) 0)
#define rpl_control_parent_selection_trigger(domain) ((void) 0)
#define rpl_control_force_leaf(domain, leaf) ((void) 0)
#define rpl_control_poison(domain, poison_count) ((void) 0)
#define rpl_control_dao_timeout(domain, seconds) ((void) 0)
#define rpl_control_set_domain_on_interface(cur, domain, downstream) ((void) 0)
#define rpl_control_remove_domain_from_interface(cur) ((void) 0)
#define rpl_control_free_domain_instances_from_interface(cur) ((void) 0)
#define rpl_control_set_callback(domain, callback, prefix_learn_cb, new_parent_add, parent_dis, cb_handle) ((void) 0)
#define rpl_control_is_dodag_parent(interface, ll_addr) (false)
#define rpl_control_is_dodag_parent_candidate(interface, ll_addr, candidate_cmp_limiter) (false)
#define rpl_control_probe_parent_candidate(interface, ll_addr) (false)
#define rpl_control_neighbor_info_get(interface, ll_addr, global_address) (0xffff)
#define rpl_possible_better_candidate(interface, rpl_instance, ll_addr, candidate_rank, etx) (false)
#define rpl_control_parent_candidate_list_size(interface, parent_list) (0)
#define rpl_control_candidate_list_size(interface, rpl_instance) (0)
#define rpl_control_selected_parent_count(interface, rpl_instance) (0)
#define rpl_control_neighbor_delete(interface, ll_addr) ((void) 0)
#define rpl_control_find_worst_neighbor(interface, rpl_instance, ll_addr) (false)
#define rpl_control_register_address(interface, addr) ((void) 0)
#define rpl_control_address_register_done(interface, ll_addr, status) (false)
#define rpl_control_enumerate_instances(domain, instance) (NULL)
#define rpl_control_read_dodag_info(instance, dodag_info) (false)
#define rpl_control_get_dodag_config(instance) (NULL)
#define rpl_control_preferred_parent_addr(instance, global) (NULL)
#define rpl_control_current_rank(instance) (RPL_RANK_INFINITE)
#define rpl_policy_mrhof_parent_set_size_get(domain) (0)
#define rpl_control_set_mrhof_parent_set_size(parent_set_size)
#define rpl_control_instant_poison(cur, domain) ((void) 0)
#endif /* HAVE_RPL */
#endif /* RPL_CONTROL_H_ */

View File

@ -134,7 +134,7 @@ void rpl_downward_convert_dodag_preferences_to_dao_path_control(rpl_dodag_t *dod
}
rpl_instance_t *instance = dodag->instance;
uint8_t pcs = dodag->config.path_control_size;
uint8_t pcs = rpl_conf_option_path_control_size(&dodag->config);
uint_fast8_t bit = 0;
rpl_neighbour_t *last = NULL;
@ -477,14 +477,14 @@ static uint8_t *rpl_downward_write_target(uint8_t *ptr, rpl_dao_target_t *target
* Figure 26: Format of the Transit Information Option
*
*/
static uint8_t *rpl_downward_write_transit(uint8_t *ptr, rpl_dao_target_t *target, uint8_t path_control, const uint8_t *parent, bool no_path)
static uint8_t *rpl_downward_write_transit(uint8_t *ptr, rpl_dao_target_t *target, uint8_t path_control, const uint8_t *parent, uint8_t path_lifetime)
{
*ptr++ = RPL_TRANSIT_OPTION;
*ptr++ = parent ? 16 + 4 : 4;
*ptr++ = target->external ? TRANSIT_FLAG_EXTERNAL : 0;
*ptr++ = path_control;
*ptr++ = target->path_sequence;
*ptr++ = no_path ? 0 : target->info.non_root.path_lifetime;
*ptr++ = path_lifetime;
if (parent) {
ptr = (uint8_t *) memcpy(ptr, parent, 16) + 16;
}
@ -770,7 +770,11 @@ void rpl_instance_send_dao_update(rpl_instance_t *instance)
* (^ Repeat if more targets with different transit info/parents)
*/
const rpl_dodag_conf_int_t *conf = rpl_dodag_get_config(dodag);
if (!conf) {
rpl_instance_dao_trigger(instance, 0);
return;
}
uint8_t *opts = ns_dyn_mem_temporary_alloc(1280);
if (!opts) {
rpl_instance_dao_trigger(instance, 0);
@ -778,13 +782,13 @@ void rpl_instance_send_dao_update(rpl_instance_t *instance)
}
uint8_t *ptr = opts;
rpl_downward_reset_assigning(instance, PCSMASK(dodag->config.path_control_size));
rpl_downward_reset_assigning(instance, PCSMASK(rpl_conf_option_path_control_size(&dodag->config)));
ns_list_foreach(rpl_dao_target_t, t, &instance->dao_targets) {
/* Self-published targets can defer path lifetime choice */
if (t->info.non_root.path_lifetime == 0) {
uint32_t lifetime = t->lifetime;
const rpl_dodag_conf_t *conf = rpl_dodag_get_config(dodag);
uint16_t unit = conf->lifetime_unit;
uint8_t def = conf->default_lifetime;
if (lifetime != 0xFFFFFFFF) {
@ -835,20 +839,31 @@ void rpl_instance_send_dao_update(rpl_instance_t *instance)
ptr = rpl_downward_write_target(ptr, t2);
}
uint8_t path_lifetime;
uint8_t path_life_adjust_t_default = conf->default_lifetime - (conf->default_lifetime / 8);
if (target->info.non_root.path_lifetime < path_life_adjust_t_default || target->info.non_root.path_lifetime >= conf->default_lifetime) {
path_lifetime = target->info.non_root.path_lifetime;
} else {
//Adjust from 7/8-0.99 to 1*default
//to pass conformance tests that expect to see exactly the default lifetime in a smoothly-running system
path_lifetime = conf->default_lifetime;
}
/* Then output the transit information for the original target */
if (storing) {
/* Just one transit info */
ptr = rpl_downward_write_transit(ptr, target, path_control, NULL, false);
ptr = rpl_downward_write_transit(ptr, target, path_control, NULL, path_lifetime);
} else if (target->own) {
/* One transit info for each DAO parent */
ns_list_foreach(rpl_neighbour_t, neighbour, &instance->candidate_neighbours) {
if (neighbour->dao_path_control & path_control) {
ptr = rpl_downward_write_transit(ptr, target, neighbour->dao_path_control & path_control, neighbour->global_address, false);
ptr = rpl_downward_write_transit(ptr, target, neighbour->dao_path_control & path_control, neighbour->global_address, path_lifetime);
}
}
} else {
/* Attached host - single transit is us */
ptr = rpl_downward_write_transit(ptr, target, path_control, our_addr, false);
ptr = rpl_downward_write_transit(ptr, target, path_control, our_addr, path_lifetime);
}
}
@ -1601,7 +1616,7 @@ void rpl_instance_dao_acked(rpl_instance_t *instance, const uint8_t src[16], int
}
rpl_dodag_t *dodag = rpl_instance_current_dodag(instance);
const rpl_dodag_conf_t *conf = dodag ? rpl_dodag_get_config(dodag) : NULL;
const rpl_dodag_conf_int_t *conf = dodag ? rpl_dodag_get_config(dodag) : NULL;
instance->dao_in_transit = false;
instance->dao_retry_timer = 0;
if (!retry) {
@ -1917,11 +1932,11 @@ static void rpl_instance_address_registration_cancel(rpl_instance_t *instance)
instance->pending_neighbour_confirmation = false;
}
static void rpl_instance_address_registration_retry(rpl_dao_target_t *dao_target)
static void rpl_instance_address_registration_retry(rpl_dao_target_t *dao_target, uint8_t response_wait_time)
{
dao_target->active_confirmation_state = true; // Active timer is set true so the response_wait_time runs out
dao_target->trig_confirmation_state = true;
dao_target->response_wait_time = 20; // Wait 20 seconds before retry
dao_target->response_wait_time = response_wait_time; // Wait 20 seconds before retry
}
void rpl_instance_parent_address_reg_timer_update(rpl_instance_t *instance, uint16_t seconds)
@ -2003,28 +2018,36 @@ bool rpl_instance_address_registration_done(protocol_interface_info_entry_t *int
tr_debug("Address %s register to %s", trace_ipv6(dao_target->prefix), trace_ipv6(neighbour->ll_address));
if (status != SOCKET_TX_DONE) {
if (neighbour->addr_reg_failures > 0) {
// Neighbor should be blacklisted after this.
tr_error("Address registration failed delete neighbor");
rpl_instance_address_registration_cancel(instance);
rpl_delete_neighbour(instance, neighbour);
return true;
if (status == SOCKET_TX_DONE) {
/* State_timer is 1/10 s. Set renewal to 75-85% of lifetime */
if_address_entry_t *address = rpl_interface_addr_get(interface, dao_target->prefix);
if (address && address->source != ADDR_SOURCE_DHCP) {
address->state_timer = (address->preferred_lifetime * randLIB_get_random_in_range(75, 85) / 10);
}
tr_warn("Address registration ACK fail retry selection");
neighbour->addr_reg_failures++;
rpl_instance_address_registration_retry(dao_target);
neighbour->addr_reg_failures = 0;
neighbour->confirmed = true;
dao_target->response_wait_time = 6;
return false;
}
/* State_timer is 1/10 s. Set renewal to 75-85% of lifetime */
if_address_entry_t *address = rpl_interface_addr_get(interface, dao_target->prefix);
if (address && address->source != ADDR_SOURCE_DHCP) {
address->state_timer = (address->preferred_lifetime * randLIB_get_random_in_range(75, 85) / 10);
if (status == SOCKET_BUSY) {
tr_warn("Address registration CCA fail retry selection");
rpl_instance_address_registration_retry(dao_target, 4);
return false;
}
neighbour->addr_reg_failures = 0;
neighbour->confirmed = true;
dao_target->response_wait_time = 6;
if (neighbour->addr_reg_failures > 0) {
// Neighbor should be blacklisted after this.
tr_error("Address registration failed delete neighbor");
rpl_instance_address_registration_cancel(instance);
rpl_delete_neighbour(instance, neighbour);
return true;
}
tr_warn("Address registration ACK fail retry selection");
neighbour->addr_reg_failures++;
rpl_instance_address_registration_retry(dao_target, 20);
return false;
}
#endif /* HAVE_RPL */

View File

@ -87,7 +87,7 @@ bool rpl_policy_join_dodag(rpl_domain_t *domain, uint8_t g_mop_prf, uint8_t inst
return true;
}
bool rpl_policy_join_config(rpl_domain_t *domain, const rpl_dodag_conf_t *conf, bool *leaf_only)
bool rpl_policy_join_config(rpl_domain_t *domain, const rpl_dodag_conf_int_t *conf, bool *leaf_only)
{
(void)domain;
(void)conf;
@ -99,7 +99,7 @@ bool rpl_policy_join_config(rpl_domain_t *domain, const rpl_dodag_conf_t *conf,
}
/* We don't support authentication */
if (conf->authentication) {
if (rpl_conf_option_security(conf)) {
return false;
}

View File

@ -26,7 +26,7 @@ void rpl_policy_force_tunnel_set(bool enable);
bool rpl_policy_join_instance(rpl_domain_t *domain, uint8_t instance_id, const uint8_t *dodagid);
bool rpl_policy_join_dodag(rpl_domain_t *domain, uint8_t g_mop_prf, uint8_t instance_id, const uint8_t *dodagid);
bool rpl_policy_join_config(rpl_domain_t *domain, const rpl_dodag_conf_t *conf, bool *leaf_only);
bool rpl_policy_join_config(rpl_domain_t *domain, const rpl_dodag_conf_int_t *conf, bool *leaf_only);
bool rpl_policy_request_dao_acks(const rpl_domain_t *domain, uint8_t mop);
uint16_t rpl_policy_initial_dao_ack_wait(const rpl_domain_t *domain, uint8_t mop);

View File

@ -81,7 +81,7 @@ struct rpl_dodag {
uint32_t timestamp; /* How long since we heard a DIO */
uint8_t id[16]; /* Root identifier */
uint8_t g_mop_prf; /* Grounded, Mode, Preference */
rpl_dodag_conf_t config; /* Configuration from DIO */
rpl_dodag_conf_int_t config; /* Configuration from DIO */
uint8_t info_version; /* Version for g_mop_prf and config */
bool root: 1; /* We are the root of this DODAG */
bool was_root: 1; /* If we have ever been a root in this DODAG */

View File

@ -729,7 +729,7 @@ void rpl_delete_dodag_root(rpl_dodag_t *dodag)
/* Convert RPL configuration to generic trickle parameters. Returns true if
* the value in the generic object has changed.
*/
static bool rpl_dodag_conf_convert_trickle_parameters(trickle_params_t *params_out, const rpl_dodag_conf_t *conf)
static bool rpl_dodag_conf_convert_trickle_parameters(trickle_params_t *params_out, const rpl_dodag_conf_int_t *conf)
{
/* Convert trickle parameters into 100ms ticks */
uint32_t Imin_ms = conf->dio_interval_min < 32 ? (1ul << conf->dio_interval_min) : 0xfffffffful;
@ -756,7 +756,7 @@ uint8_t rpl_dodag_mop(const rpl_dodag_t *dodag)
return dodag->g_mop_prf & RPL_MODE_MASK;
}
bool rpl_dodag_update_config(rpl_dodag_t *dodag, const rpl_dodag_conf_t *conf, const uint8_t *src, bool *become_leaf)
bool rpl_dodag_update_config(rpl_dodag_t *dodag, const rpl_dodag_conf_int_t *conf, const uint8_t *src, bool *become_leaf)
{
/* If already have config, don't update unless it's coming from preferred parent */
if (dodag->have_config) {
@ -863,7 +863,7 @@ bool rpl_dodag_is_current(const rpl_dodag_t *dodag)
return dodag->instance->current_dodag_version && dodag->instance->current_dodag_version->dodag == dodag;
}
const rpl_dodag_conf_t *rpl_dodag_get_config(const rpl_dodag_t *dodag)
const rpl_dodag_conf_int_t *rpl_dodag_get_config(const rpl_dodag_t *dodag)
{
return dodag->have_config ? &dodag->config : NULL;
}
@ -1677,7 +1677,7 @@ void rpl_instance_dio_trigger(rpl_instance_t *instance, protocol_interface_info_
}
// Always send config in unicasts (as required), never in multicasts (optional)
rpl_dodag_conf_t *conf;
rpl_dodag_conf_int_t *conf;
if (addr) {
conf = &dodag->config;
//Unicast

View File

@ -108,7 +108,7 @@ uint8_t rpl_dodag_get_version_number_as_root(const rpl_dodag_t *dodag);
void rpl_dodag_set_version_number_as_root(rpl_dodag_t *dodag, uint8_t number);
void rpl_dodag_set_leaf(rpl_dodag_t *dodag, bool leaf);
bool rpl_dodag_am_leaf(const rpl_dodag_t *dodag);
const rpl_dodag_conf_t *rpl_dodag_get_config(const rpl_dodag_t *dodag);
const rpl_dodag_conf_int_t *rpl_dodag_get_config(const rpl_dodag_t *dodag);
void rpl_dodag_inconsistency(rpl_dodag_t *dodag);
void rpl_dodag_increment_dtsn(rpl_dodag_t *dodag);
rpl_cmp_t rpl_dodag_pref_compare(const rpl_dodag_t *a, const rpl_dodag_t *b);
@ -138,7 +138,7 @@ rpl_neighbour_t *rpl_lookup_neighbour_by_ll_address(const rpl_instance_t *instan
rpl_neighbour_t *rpl_lookup_last_candidate_from_list(const rpl_instance_t *instance);
rpl_neighbour_t *rpl_create_neighbour(rpl_dodag_version_t *instance, const uint8_t *ll_addr, int8_t if_id, uint8_t g_mop_prf, uint8_t dtsn);
void rpl_delete_neighbour(rpl_instance_t *instance, rpl_neighbour_t *neighbour);
bool rpl_dodag_update_config(rpl_dodag_t *dodag, const rpl_dodag_conf_t *conf, const uint8_t *src, bool *become_leaf);
bool rpl_dodag_update_config(rpl_dodag_t *dodag, const rpl_dodag_conf_int_t *conf, const uint8_t *src, bool *become_leaf);
const uint8_t *rpl_neighbour_ll_address(const rpl_neighbour_t *neighbour);
const uint8_t *rpl_neighbour_global_address(const rpl_neighbour_t *neighbour);
void rpl_neighbour_update_global_address(rpl_neighbour_t *neighbour, const uint8_t *addr);

View File

@ -1,4 +1,4 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# Copyright (c) 2020-2021, Pelion and affiliates.
# SPDX-License-Identifier: Apache-2.0
target_include_directories(mbed-nanostack-sal_stack

View File

@ -411,7 +411,7 @@ static void auth_eap_tls_sec_prot_state_machine(sec_prot_t *prot)
tr_info("EAP-TLS start, eui-64: %s", trace_array(sec_prot_remote_eui_64_addr_get(prot), 8));
// Set default timeout for the total maximum length of the negotiation
sec_prot_default_timeout_set(&data->common);
sec_prot_timeout_set(&data->common, SEC_PROT_RETRYING_PROTOCOL_TIMEOUT);
// KMP-CREATE.confirm
prot->create_conf(prot, SEC_RESULT_OK);

View File

@ -436,7 +436,7 @@ static void radius_eap_tls_sec_prot_state_machine(sec_prot_t *prot)
tr_info("EAP-TLS: start, eui-64: %s", trace_array(sec_prot_remote_eui_64_addr_get(prot), 8));
// Set default timeout for the total maximum length of the negotiation
sec_prot_default_timeout_set(&data->common);
sec_prot_timeout_set(&data->common, SEC_PROT_RETRYING_PROTOCOL_TIMEOUT);
// KMP-CREATE.confirm
prot->create_conf(prot, SEC_RESULT_OK);
@ -482,7 +482,7 @@ static void radius_eap_tls_sec_prot_state_machine(sec_prot_t *prot)
sec_prot_timer_trickle_stop(&data->common);
// Set timeout to wait for RADIUS client to continue
data->common.ticks = RADIUS_EAP_TLS_CLIENT_TIMEOUT;
sec_prot_timeout_set(&data->common, RADIUS_EAP_TLS_CLIENT_TIMEOUT);
// Send to radius client
data->radius_client_send(data->radius_client_prot, (void *) &data->recv_eapol_pdu, length);
@ -547,7 +547,7 @@ static void radius_eap_tls_sec_prot_state_machine(sec_prot_t *prot)
sec_prot_timer_trickle_stop(&data->common);
// Set timeout to wait for RADIUS client to continue
data->common.ticks = RADIUS_EAP_TLS_CLIENT_TIMEOUT;
sec_prot_timeout_set(&data->common, RADIUS_EAP_TLS_CLIENT_TIMEOUT);
// Send to radius client
data->radius_client_send(data->radius_client_prot, (void *) &data->recv_eapol_pdu, length);

View File

@ -406,7 +406,7 @@ static void supp_eap_tls_sec_prot_state_machine(sec_prot_t *prot)
}
// Set retry timeout based on network size
data->common.ticks = prot->sec_cfg->prot_cfg.sec_prot_retry_timeout;
sec_prot_timeout_set(&data->common, prot->sec_cfg->prot_cfg.sec_prot_retry_timeout);
// Store sequence ID
supp_eap_tls_sec_prot_seq_id_update(prot);
@ -451,7 +451,7 @@ static void supp_eap_tls_sec_prot_state_machine(sec_prot_t *prot)
supp_eap_tls_sec_prot_seq_id_update(prot);
sec_prot_state_set(prot, &data->common, EAP_TLS_STATE_REQUEST);
data->common.ticks = prot->sec_cfg->prot_cfg.sec_prot_retry_timeout;
sec_prot_timeout_set(&data->common, prot->sec_cfg->prot_cfg.sec_prot_retry_timeout);
// Initialize TLS protocol
if (supp_eap_tls_sec_prot_init_tls(prot) < 0) {
@ -485,7 +485,7 @@ static void supp_eap_tls_sec_prot_state_machine(sec_prot_t *prot)
// Store sequence ID
if (supp_eap_tls_sec_prot_seq_id_update(prot)) {
// When receiving a new sequence number, adds more time for re-send if no response
data->common.ticks = prot->sec_cfg->prot_cfg.sec_prot_retry_timeout;
sec_prot_timeout_set(&data->common, prot->sec_cfg->prot_cfg.sec_prot_retry_timeout);
}
// All fragments received for a message

View File

@ -120,7 +120,7 @@ static int8_t auth_fwh_sec_prot_init(sec_prot_t *prot)
sec_prot_init(&data->common);
sec_prot_state_set(prot, &data->common, FWH_STATE_INIT);
data->common.ticks = 15 * 10; // 15 seconds
sec_prot_timeout_set(&data->common, 15 * 10); // 15 seconds
uint8_t eui64[8] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08};
sec_prot_lib_nonce_init(data->nonce, eui64, 1000);
@ -348,7 +348,7 @@ static void auth_fwh_sec_prot_state_machine(sec_prot_t *prot)
tr_info("4WH: start, eui-64: %s", trace_array(sec_prot_remote_eui_64_addr_get(prot), 8));
// Set default timeout for the total maximum length of the negotiation
sec_prot_default_timeout_set(&data->common);
sec_prot_timeout_set(&data->common, SEC_PROT_RETRYING_PROTOCOL_TIMEOUT);
uint8_t *pmk = sec_prot_keys_pmk_get(prot->sec_keys);
if (!pmk) { // If PMK is not set fails

View File

@ -139,7 +139,7 @@ static int8_t supp_fwh_sec_prot_init(sec_prot_t *prot)
sec_prot_init(&data->common);
sec_prot_state_set(prot, &data->common, FWH_STATE_INIT);
data->common.ticks = prot->sec_cfg->prot_cfg.sec_prot_retry_timeout;
sec_prot_timeout_set(&data->common, prot->sec_cfg->prot_cfg.sec_prot_retry_timeout);
data->msg3_received = false;
data->msg3_retry_wait = false;
data->recv_replay_cnt = 0;
@ -314,7 +314,7 @@ static void supp_fwh_sec_prot_state_machine(sec_prot_t *prot)
}
// Set default timeout for the total maximum length of the negotiation
sec_prot_default_timeout_set(&data->common);
sec_prot_timeout_set(&data->common, prot->sec_cfg->prot_cfg.sec_prot_retry_timeout);
tr_info("4WH: start");
@ -337,7 +337,7 @@ static void supp_fwh_sec_prot_state_machine(sec_prot_t *prot)
if (sec_prot_result_ok_check(&data->common)) {
// Send 4WH message 2
supp_fwh_sec_prot_message_send(prot, FWH_MESSAGE_2);
data->common.ticks = prot->sec_cfg->prot_cfg.sec_prot_retry_timeout;
sec_prot_timeout_set(&data->common, prot->sec_cfg->prot_cfg.sec_prot_retry_timeout);
sec_prot_state_set(prot, &data->common, FWH_STATE_MESSAGE_3);
} else {
// Ready to be deleted
@ -365,7 +365,7 @@ static void supp_fwh_sec_prot_state_machine(sec_prot_t *prot)
// Send 4WH message 2
supp_fwh_sec_prot_message_send(prot, FWH_MESSAGE_2);
data->common.ticks = prot->sec_cfg->prot_cfg.sec_prot_retry_timeout;
sec_prot_timeout_set(&data->common, prot->sec_cfg->prot_cfg.sec_prot_retry_timeout);
return;
} else if (data->recv_msg != FWH_MESSAGE_3) {
return;
@ -392,7 +392,7 @@ static void supp_fwh_sec_prot_state_machine(sec_prot_t *prot)
// Sends 4WH Message 4
supp_fwh_sec_prot_message_send(prot, FWH_MESSAGE_4);
data->common.ticks = prot->sec_cfg->prot_cfg.sec_prot_retry_timeout;
sec_prot_timeout_set(&data->common, prot->sec_cfg->prot_cfg.sec_prot_retry_timeout);
sec_prot_state_set(prot, &data->common, FWH_STATE_FINISH);
break;
@ -412,7 +412,7 @@ static void supp_fwh_sec_prot_state_machine(sec_prot_t *prot)
sec_prot_keys_ptk_write(prot->sec_keys, data->new_ptk, prot->sec_cfg->timer_cfg.ptk_lifetime);
sec_prot_keys_ptk_eui_64_write(prot->sec_keys, data->remote_eui64);
data->common.ticks = 60 * 10; // 60 seconds
sec_prot_timeout_set(&data->common, 60 * 10); // 60 seconds
// KMP-FINISHED.indication
prot->finished_ind(prot, sec_prot_result_get(&data->common), prot->sec_keys);
sec_prot_state_set(prot, &data->common, FWH_STATE_MESSAGE_3_RETRY_WAIT);

View File

@ -295,7 +295,7 @@ static void auth_gkh_sec_prot_state_machine(sec_prot_t *prot)
tr_info("GKH start, eui-64: %s", trace_array(sec_prot_remote_eui_64_addr_get(prot), 8));
// Set default timeout for the total maximum length of the negotiation
sec_prot_default_timeout_set(&data->common);
sec_prot_timeout_set(&data->common, SEC_PROT_RETRYING_PROTOCOL_TIMEOUT);
// KMP-CREATE.confirm
prot->create_conf(prot, SEC_RESULT_OK);

View File

@ -247,7 +247,7 @@ static void supp_gkh_sec_prot_state_machine(sec_prot_t *prot)
}
// Set default timeout for the total maximum length of the negotiation
sec_prot_default_timeout_set(&data->common);
sec_prot_timeout_set(&data->common, prot->sec_cfg->prot_cfg.sec_prot_retry_timeout);
supp_gkh_sec_prot_security_replay_counter_update(prot);

View File

@ -370,7 +370,7 @@ static void supp_key_sec_prot_state_machine(sec_prot_t *prot)
// KMP-FINISHED.indication,
prot->finished_ind(prot, sec_prot_result_get(&data->common), 0);
sec_prot_state_set(prot, &data->common, KEY_STATE_FINISHED);
data->common.ticks = KEY_SEC_FINISHED_TIMEOUT;
sec_prot_timeout_set(&data->common, KEY_SEC_FINISHED_TIMEOUT);
break;
case KEY_STATE_FINISHED:
@ -416,7 +416,7 @@ static void auth_key_sec_prot_state_machine(sec_prot_t *prot)
// KMP-FINISHED.indication,
prot->finished_ind(prot, sec_prot_result_get(&data->common), 0);
sec_prot_state_set(prot, &data->common, KEY_STATE_FINISHED);
data->common.ticks = KEY_SEC_FINISHED_TIMEOUT;
sec_prot_timeout_set(&data->common, KEY_SEC_FINISHED_TIMEOUT);
break;
case KEY_STATE_FINISHED: {

View File

@ -1089,7 +1089,7 @@ static void radius_client_sec_prot_state_machine(sec_prot_t *prot)
tr_info("Radius: start, eui-64: %s", trace_array(sec_prot_remote_eui_64_addr_get(prot), 8));
// Set default timeout for the total maximum length of the negotiation
sec_prot_default_timeout_set(&data->common);
sec_prot_timeout_set(&data->common, SEC_PROT_RETRYING_PROTOCOL_TIMEOUT);
sec_prot_state_set(prot, &data->common, RADIUS_STATE_CREATE_RESP);
@ -1148,7 +1148,7 @@ static void radius_client_sec_prot_state_machine(sec_prot_t *prot)
sec_prot_timer_trickle_stop(&data->common);
// Set timeout to wait for EAP-TLS to continue
data->common.ticks = prot->sec_cfg->prot_cfg.sec_prot_retry_timeout;
sec_prot_timeout_set(&data->common, prot->sec_cfg->prot_cfg.sec_prot_retry_timeout);
// Send to radius EAP-TLS
if (data->radius_eap_tls_send && data->radius_eap_tls_prot && data->recv_eap_msg && data->recv_eap_msg_len > 0) {

View File

@ -174,9 +174,9 @@ bool sec_prot_result_ok_check(sec_prot_common_t *data)
return false;
}
void sec_prot_default_timeout_set(sec_prot_common_t *data)
void sec_prot_timeout_set(sec_prot_common_t *data, uint16_t ticks)
{
data->ticks = SEC_TOTAL_TIMEOUT;
data->ticks = ticks;
}
void sec_prot_lib_nonce_generate(uint8_t *nonce)

View File

@ -26,7 +26,6 @@
*/
#define EUI64_LEN 8
#define SEC_TOTAL_TIMEOUT 30 * 60 * 10 // 30 minutes
#define SEC_FINISHED_TIMEOUT 5 * 10 // 5 seconds
#define FWH_NONCE_LENGTH 32
@ -299,11 +298,12 @@ bool sec_prot_result_timeout_check(sec_prot_common_t *data);
bool sec_prot_result_ok_check(sec_prot_common_t *data);
/**
* sec_prot_default_timeout_set sets default timeout for protocol
* sec_prot_timeout_set sets timeout for protocol
*
* \param data common data
* \param ticks ticks
*
*/
void sec_prot_default_timeout_set(sec_prot_common_t *data);
void sec_prot_timeout_set(sec_prot_common_t *data, uint16_t ticks);
#endif /* SEC_PROT_LIB_H_ */

View File

@ -320,7 +320,7 @@ static void client_tls_sec_prot_state_machine(sec_prot_t *prot)
sec_prot_state_set(prot, &data->common, TLS_STATE_CREATE_REQ);
prot->timer_start(prot);
// Set default timeout for the total maximum length of the negotiation
sec_prot_default_timeout_set(&data->common);
sec_prot_timeout_set(&data->common, prot->sec_cfg->prot_cfg.sec_prot_retry_timeout);
break;
// Wait KMP-CREATE.request
@ -355,6 +355,8 @@ static void client_tls_sec_prot_state_machine(sec_prot_t *prot)
data->calculating = false;
}
sec_prot_timeout_set(&data->common, prot->sec_cfg->prot_cfg.sec_prot_retry_timeout);
if (data->tls_send.data) {
prot->send(prot, data->tls_send.data, data->tls_send.handled_len);
eap_tls_sec_prot_lib_message_init(&data->tls_send);
@ -415,7 +417,7 @@ static void server_tls_sec_prot_state_machine(sec_prot_t *prot)
sec_prot_state_set(prot, &data->common, TLS_STATE_CLIENT_HELLO);
prot->timer_start(prot);
// Set default timeout for the total maximum length of the negotiation
sec_prot_default_timeout_set(&data->common);
sec_prot_timeout_set(&data->common, prot->sec_cfg->prot_cfg.sec_prot_retry_timeout);
break;
// Wait EAP request, Identity (starts handshake on supplicant)
@ -474,6 +476,8 @@ static void server_tls_sec_prot_state_machine(sec_prot_t *prot)
data->calculating = false;
}
sec_prot_timeout_set(&data->common, prot->sec_cfg->prot_cfg.sec_prot_retry_timeout);
if (data->tls_send.data) {
prot->send(prot, data->tls_send.data, data->tls_send.handled_len);
eap_tls_sec_prot_lib_message_init(&data->tls_send);

View File

@ -1,4 +1,4 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# Copyright (c) 2020-2021, Pelion and affiliates.
# SPDX-License-Identifier: Apache-2.0
target_include_directories(mbed-nanostack-sal_stack

View File

@ -1,4 +1,4 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# Copyright (c) 2020-2021, Pelion and affiliates.
# SPDX-License-Identifier: Apache-2.0
target_include_directories(mbed-nanostack-sal_stack

View File

@ -0,0 +1,20 @@
/*
* 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 "cfg_ws_border_router.h"
#define HAVE_PAE_SUPP

View File

@ -18,9 +18,7 @@
#define HAVE_WS
#define HAVE_WS_HOST
#define HAVE_WS_VERSION_1_1
#define HAVE_RPL
#define HAVE_MPL
#define HAVE_6LOWPAN_ND
#define HAVE_IPV6_ND
#define HAVE_PAE_SUPP
#define HAVE_6LOWPAN_ROUTER
#define HAVE_6LOWPAN_ROUTER

View File

@ -17,5 +17,6 @@
#include "cfg_ws_host.h"
#define HAVE_RPL
#define HAVE_WS_ROUTER
#define HAVE_EAPOL_RELAY

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2016-2019, Pelion and affiliates.
* Copyright (c) 2014, 2016-2021, Pelion and affiliates.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -20,7 +20,7 @@
#include "base/cfg_lowpan_border_router.h"
#include "base/cfg_local_socket.h"
#include "base/cfg_rf_tunnel.h"
#include "base/cfg_ws_border_router.h"
#include "base/cfg_ws_full.h"
#define FEA_TRACE_SUPPORT
#define EXTRA_CONSISTENCY_CHECKS

View File

@ -0,0 +1,20 @@
/*
* 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 "cfg_ws_border_router.h"
#define HAVE_PAE_SUPP

View File

@ -20,4 +20,5 @@
#define FEA_TRACE_SUPPORT
#define EXTRA_CONSISTENCY_CHECKS
#define HAVE_PAE_SUPP

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, Pelion 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");
@ -20,4 +20,5 @@
#define FEA_TRACE_SUPPORT
#define EXTRA_CONSISTENCY_CHECKS
#define HAVE_PAE_SUPP

View File

@ -1,4 +1,4 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# Copyright (c) 2020-2021, Pelion and affiliates.
# SPDX-License-Identifier: Apache-2.0
target_include_directories(mbed-nanostack-sal_stack

View File

@ -1,4 +1,4 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# Copyright (c) 2020-2021, Pelion and affiliates.
# SPDX-License-Identifier: Apache-2.0
target_include_directories(mbed-nanostack-sal_stack

View File

@ -1,4 +1,4 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# Copyright (c) 2020-2021, Pelion and affiliates.
# SPDX-License-Identifier: Apache-2.0
target_include_directories(mbed-nanostack-sal_stack

View File

@ -248,7 +248,7 @@ void net_load_balance_internal_state_activate(protocol_interface_info_entry_t *i
if (state && interface_ptr->rpl_domain) {
struct rpl_instance *instance = rpl_control_lookup_instance(interface_ptr->rpl_domain, 1, NULL);
if (instance) {
const rpl_dodag_conf_t *dodag_config = rpl_control_get_dodag_config(instance);
const rpl_dodag_conf_int_t *dodag_config = rpl_control_get_dodag_config(instance);
if (dodag_config) {
//dio max Period caluclate in seconds
uint32_t Imax_ms = (dodag_config->dio_interval_min + dodag_config->dio_interval_doublings) < 32 ?

View File

@ -24,8 +24,9 @@ SRCS += \
source/6LoWPAN/ws/ws_neighbor_class.c \
source/6LoWPAN/ws/ws_bootstrap.c \
source/6LoWPAN/ws/ws_bootstrap_6lbr.c \
source/6LoWPAN/ws/ws_bootstrap_6lr.c \
source/6LoWPAN/ws/ws_bootstrap_6ln.c \
source/6LoWPAN/ws/ws_bootstrap_ffn.c \
source/6LoWPAN/ws/ws_bootstrap_lfn.c \
source/6LoWPAN/ws/ws_common.c \
source/6LoWPAN/ws/ws_management_api.c \
source/6LoWPAN/ws/ws_bbr_api.c \