Skip to content

Commit

Permalink
Merge branch 'release_internal' into release_external
Browse files Browse the repository at this point in the history
* release_internal: (31 commits)
  Fix errors found from coverity scan (ARMmbed#2386)
  Added IID for border router info structure
  LLC secure data duplicate check update and EAPOL relay duplicate fix
  Remove Thread-protocol from README (ARMmbed#2383)
  EAPOL relay agent rx filter from joiner side
  Removed dead code part
  RPL new parent accept update and NUD operation
  ETX API update and RPL ETX threshold callback update.
  Wi-sun keep all candidates alive by NUD.
  Key storage settings are no longer cleared on delete
  Changed EAPOL initial-Key retries from 2 to 4 on large NW
  WS bootstrap: Default CCA threshold to -60dBm (ARMmbed#2377)
  Created extra large network setup for Wi-SUN
  Corrected PTK and PMK lifetime handling
  Cleared EAPOL temporary trace print's.
  Timed parent selection is now imim-imin*2 earlier there was just 5 seconds randomize.
  Added check for network name and DODAG ID IID (EUI-64) (ARMmbed#2373)
  Updated initial key trickles
  Fixed parent target address set.
  Updated Discovery and RPL setup large & medium size network
  ...
  • Loading branch information
Arto Kinnunen committed Jun 8, 2020
2 parents 9a21668 + 0ed25a7 commit b2bf24c
Show file tree
Hide file tree
Showing 53 changed files with 892 additions and 487 deletions.
22 changes: 7 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,29 @@ ARM Mesh networking stack

This repository contains the ARM mesh networking stack that provides support for the following mesh protocols:

* 6LoWPAN with Neighbor Discovery (ND) and Mesh Link Establishment (MLE)
* Thread
* Wi-SUN
* 6LoWPAN with Neighbor Discovery (ND) and Mesh Link Establishment (MLE)
* Wi-SUN

All networking stacks are using IEEE 802.15.4 based radios.
All networking stacks are using IEEE 802.15.4 based radios.

The full documentation is hosted in [Mbed OS documentation](https://os.mbed.com/docs/mbed-os/latest/reference/mesh-tech.html).

On mbed OS, mesh networking stacks can be used through [Mbed Mesh API](https://os.mbed.com/docs/mbed-os/latest/apis/mesh-api.html) and [Network Socket API](https://os.mbed.com/docs/mbed-os/v5.11/apis/network-socket.html).
On mbed OS, mesh networking stacks can be used through [Mbed Mesh API](https://os.mbed.com/docs/mbed-os/latest/apis/mesh-api.html) and [Network Socket API](https://os.mbed.com/docs/mbed-os/latest/apis/network-socket.html).

To see, how the mesh networking stack works, check the example application [mbed-os-example-mesh-minimal](https://github.com/ARMmbed/mbed-os-example-mesh-minimal).

##6LoWPAN with ND and MLE

## 6LoWPAN with ND and MLE

This networking stack is using standard 6LoWPAN and uses:

* Neighbor Discovery Protocol ([RFC4861](https://tools.ietf.org/html/rfc4861)) to locate other devices in the mesh network.
* Mesh-Link-Establishment ([draft-kelsey-intarea-mesh-link-establishment-06](https://tools.ietf.org/html/draft-kelsey-intarea-mesh-link-establishment-06)) is used for establishing and configuring secure radio links.

##Thread
Thread is standardized by [Thread group](https://www.threadgroup.org/).

![](docs/img/thread_certified.png)

mbed OS is now a Thread Certified Component. Using IPv6 with 6LoWPAN as the foundation, Thread technology provides a low-power, self-healing mesh network designed for the home.

##Wi-SUN
## Wi-SUN
Wi-SUN (Smart Utility Networks) specification is standardized by [Wi-SUN Alliance](https://www.wi-sun.org/).

Mbed OS release 5.12 contains the initial Mbed Wi-SUN FAN implementation. Functionality of the Mbed Wi-SUN network stack will be updated when the Wi-SUN protocol is specified further.

## License

Expand Down
Binary file removed docs/img/thread_certified.png
Binary file not shown.
2 changes: 2 additions & 0 deletions nanostack/ws_bbr_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ typedef struct bbr_information {
uint8_t dodag_id[16];
/** Address prefix given to devices in network set to 0 if not available*/
uint8_t prefix[8];
/** Address IID of the border router set to 0 if not available*/
uint8_t IID[8];
/** Amount of devices in the network. */
uint16_t devices_in_network;
/** Border router instance identifier defined in RPL */
Expand Down
20 changes: 13 additions & 7 deletions nanostack/ws_management_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,16 @@ extern "C" {
#define CHANNEL_SPACING_100 0x03 // 100 khz
#define CHANNEL_SPACING_250 0x04 // 250 khz

#define NETWORK_SIZE_CERTIFICATE 0x00
#define NETWORK_SIZE_SMALL 0x01
#define NETWORK_SIZE_MEDIUM 0x08
#define NETWORK_SIZE_LARGE 0x10
/*
* Network Size definitions are device amount in hundreds of devices.
* These definitions are meant to give some estimates of sizes. Any value can be given as parameter
*/

#define NETWORK_SIZE_CERTIFICATE 0x00 // Network configuration used in Wi-SUN certification
#define NETWORK_SIZE_SMALL 0x01 // Small networks
#define NETWORK_SIZE_MEDIUM 0x08 // 100 - 800 device networks are medium sized
#define NETWORK_SIZE_LARGE 0x0F // 800 - 1500 device networks are large
#define NETWORK_SIZE_XLARGE 0x19 // 2500+ devices
#define NETWORK_SIZE_AUTOMATIC 0xFF

/** Temporary API change flag. this will be removed when new version of API is implemented on applications
Expand Down Expand Up @@ -229,9 +235,9 @@ int ws_management_regulatory_domain_validate(
*
* timing parameters follows the specification example from Wi-SUN specification
*
* Default value: medium
* small network size: hundreds of devices
* Large network size: thousands of devices
* Default value: medium 100 - 800 device
* small network size: less than 100 devices
* Large network size: 800 - 1500 devices
* automatic: when discovering the network network size is learned
* from advertisements and timings adjusted accordingly
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ static void mle_neigh_entry_update_by_mle_tlv_list(int8_t interface_id, mac_neig
uint8_t link_idr;
uint8_t iop_flags;
if (mle_link_quality_tlv_parse(mac64, short_address, mle_tlv_info.dataPtr, mle_tlv_info.tlvLen, &iop_flags, &link_idr)) {
etx_remote_incoming_idr_update(interface_id, link_idr, entry_temp->index);
etx_remote_incoming_idr_update(interface_id, link_idr, entry_temp->index, entry_temp->mac64);

if ((iop_flags & MLE_NEIGHBOR_PRIORITY_LINK) == MLE_NEIGHBOR_PRIORITY_LINK) {
entry_temp->link_role = CHILD_NEIGHBOUR;
Expand Down Expand Up @@ -965,9 +965,9 @@ int protocol_6lowpan_router_synch_to_new_router(protocol_interface_info_entry_t
static uint8_t mle_calculate_idr(int8_t interface_id, mle_message_t *mle_msg, mac_neighbor_table_entry_t *entry_temp)
{
if (!entry_temp) {
return etx_lqi_dbm_update(-2, mle_msg->lqi, mle_msg->dbm, 0) >> 3;
return etx_lqi_dbm_update(-2, mle_msg->lqi, mle_msg->dbm, 0, NULL) >> 3;
}
return etx_lqi_dbm_update(interface_id, mle_msg->lqi, mle_msg->dbm, entry_temp->index) >> 3;
return etx_lqi_dbm_update(interface_id, mle_msg->lqi, mle_msg->dbm, entry_temp->index, entry_temp->mac64) >> 3;

}

Expand Down Expand Up @@ -1609,7 +1609,7 @@ static void lowpan_neighbor_entry_remove_notify(mac_neighbor_table_entry_t *entr
}
mac_helper_devicetable_remove(cur_interface->mac_api, entry_ptr->index, entry_ptr->mac64);
//Removes ETX neighbor
etx_neighbor_remove(cur_interface->id, entry_ptr->index);
etx_neighbor_remove(cur_interface->id, entry_ptr->index, entry_ptr->mac64);
//Remove MLE frame counter info
mle_service_frame_counter_entry_delete(cur_interface->id, entry_ptr->index);

Expand Down
2 changes: 1 addition & 1 deletion source/6LoWPAN/Thread/thread_bootstrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ static void thread_neighbor_remove(mac_neighbor_table_entry_t *entry_ptr, void *

thread_reset_neighbour_info(cur, entry_ptr);
//Removes ETX neighbor
etx_neighbor_remove(cur->id, entry_ptr->index);
etx_neighbor_remove(cur->id, entry_ptr->index, entry_ptr->mac64);
//Remove MLE frame counter info
mle_service_frame_counter_entry_delete(cur->id, entry_ptr->index);
}
Expand Down
2 changes: 1 addition & 1 deletion source/6LoWPAN/adaptation_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ static void lowpan_adaptation_etx_update_cb(protocol_interface_info_entry_t *cur
// Gets table entry
mac_neighbor_table_entry_t *neigh_table_ptr = mac_neighbor_table_address_discover(mac_neighbor_info(cur), buf->dst_sa.address + PAN_ID_LEN, buf->dst_sa.addr_type);
if (neigh_table_ptr) {
etx_transm_attempts_update(cur->id, 1 + confirm->tx_retries, success, neigh_table_ptr->index);
etx_transm_attempts_update(cur->id, 1 + confirm->tx_retries, success, neigh_table_ptr->index, neigh_table_ptr->mac64);
// Updates ETX statistics
etx_storage_t *etx_entry = etx_storage_entry_get(cur->id, neigh_table_ptr->index);
if (etx_entry) {
Expand Down
34 changes: 30 additions & 4 deletions source/6LoWPAN/ws/ws_bbr_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "ns_types.h"
#include "ns_trace.h"
#include "net_interface.h"
#include "socket_api.h"
#include "eventOS_event.h"
#include "NWK_INTERFACE/Include/protocol.h"
#include "6LoWPAN/Bootstraps/protocol_6lowpan.h"
Expand Down Expand Up @@ -94,7 +95,16 @@ static void ws_bbr_rpl_version_timer_start(protocol_interface_info_entry_t *cur,
//stable version for RPL so slow timer update is ok
cur->ws_info->rpl_version_timer = RPL_VERSION_LIFETIME;
} else {
cur->ws_info->rpl_version_timer = RPL_VERSION_LIFETIME_RESTART;
if (cur->ws_info->cfg->gen.network_size <= NETWORK_SIZE_SMALL) {
// handles also NETWORK_SIZE_CERTIFICATE
cur->ws_info->rpl_version_timer = RPL_VERSION_LIFETIME_RESTART_SMALL;
} else if (cur->ws_info->cfg->gen.network_size <= NETWORK_SIZE_MEDIUM) {
cur->ws_info->rpl_version_timer = RPL_VERSION_LIFETIME_RESTART_MEDIUM;
} else if (cur->ws_info->cfg->gen.network_size <= NETWORK_SIZE_LARGE) {
cur->ws_info->rpl_version_timer = RPL_VERSION_LIFETIME_RESTART_LARGE;
} else {
cur->ws_info->rpl_version_timer = RPL_VERSION_LIFETIME_RESTART_EXTRA_LARGE;
}
}
}

Expand Down Expand Up @@ -232,7 +242,10 @@ static if_address_entry_t *ws_bbr_slaac_generate(protocol_interface_info_entry_t

static void ws_bbr_slaac_remove(protocol_interface_info_entry_t *cur, uint8_t *ula_prefix)
{
icmpv6_slaac_prefix_update(cur, ula_prefix, 64, 0, 0);
if (cur) {
icmpv6_slaac_prefix_update(cur, ula_prefix, 64, 0, 0);
}

addr_policy_table_delete_entry(ula_prefix, 64);
}

Expand Down Expand Up @@ -361,14 +374,16 @@ static void ws_bbr_dhcp_server_start(protocol_interface_info_entry_t *cur, uint8
}
static void ws_bbr_dhcp_server_stop(protocol_interface_info_entry_t *cur, uint8_t *global_id)
{
if (!cur) {
return;
}
uint8_t temp_address[16];
memcpy(temp_address, global_id, 8);
memset(temp_address + 8, 0, 8);
tr_debug("DHCP server deactivate %s", trace_ipv6(temp_address));
DHCPv6_server_service_delete(cur->id, global_id, false);
//Delete Client
dhcp_client_global_address_delete(cur->id, NULL, temp_address);

}

static void ws_bbr_routing_stop(protocol_interface_info_entry_t *cur)
Expand Down Expand Up @@ -632,6 +647,11 @@ uint16_t test_pan_size_override = 0xffff;
uint16_t ws_bbr_pan_size(protocol_interface_info_entry_t *cur)
{
uint16_t result = 0;

if (!cur || !cur->rpl_domain) {
return 0;
}

if (test_pan_size_override != 0xffff) {
return test_pan_size_override;
}
Expand Down Expand Up @@ -710,7 +730,6 @@ void ws_bbr_stop(int8_t interface_id)
protocol_interface_info_entry_t *cur = protocol_stack_interface_info_get_by_id(interface_id);

ws_bbr_routing_stop(cur);

backbone_interface_id = -1;
current_instance_id++;

Expand Down Expand Up @@ -764,6 +783,13 @@ int ws_bbr_info_get(int8_t interface_id, bbr_information_t *info_ptr)
memcpy(info_ptr->dodag_id, current_dodag_id, 16);
memcpy(info_ptr->prefix, current_global_prefix, 8);

// Get the Wi-SUN interface generated address that is used in the RF interface.
const uint8_t *wisun_if_addr = addr_select_with_prefix(cur, current_global_prefix, 64, SOCKET_IPV6_PREFER_SRC_PUBLIC);

if (wisun_if_addr) {
memcpy(info_ptr->IID, wisun_if_addr + 8, 8);
}

info_ptr->devices_in_network = ws_bbr_pan_size(cur);
info_ptr->instance_id = current_instance_id;
info_ptr->version = dodag_info.version_num;
Expand Down
Loading

0 comments on commit b2bf24c

Please sign in to comment.