Skip to content

Commit d104328

Browse files
author
Arto Kinnunen
committed
Squashed 'features/nanostack/sal-stack-nanostack/' changes from fb7413b..cc03296
cc03296 Merge branch 'release_internal' into release_external 59397d1 Fixed Wi-SUN border router restart after settings change 8295a43 PAE authenticator TLS authentication limit based on dynamic value 2776cfe RPL config update not re-start whole BR again just increment version number and with new parameters. bec4d48 Fixed FHSS testing now it follow configured channel count not a wi-sun configured Default. b9cad9d Remove floating point literals from Thread code 423a48f RPL link etx validation update 89a497a Merge branch 'release_internal' into release_external c8cc660 Merge pull request ARMmbed#2336 from ARMmbed/sync_with_mbedos ac5f369 MBEDTLS_SSL_EXPORT_KEYS added to Nanostack's tls_sec_prot_lib 6522a08 Added missing optimizations based on mbedtls/baremetal.h config 0e8739f Added new global rng, needed for MbedTLS optimisations d5db37e Prepare for upcoming MbedTLS changes 4271a9d Merge pull request ARMmbed#2335 from ARMmbed/sync_with_mbedos e2db6ff Fixed error of function 'mac_fcf_lenght' 28fc2a9 Fixed error of structure 194e81b Fixed spelling mistake of structure 00ea3fb Remove test files d7f7cc5 Merge branch 'release_internal' into release_external 132cd12 Merge pull request ARMmbed#2333 from ARMmbed/sync_with_mbedos 550a78e Fix function spelling mistake in Thread 74c6024 Fix function spelling mistake in border_router.c 89830ec Fix function spelling mistake in iphc_decompress.c 1728ae1 Fix function spelling mistake in lowpan_context.c ed5d253 Fix function spelling mistake in lowpan_context.h ecbca0a Fixed typo 'thead' in thread_neighbor_class.h 071911b Changed nanostack API network size to be a range of values 4756be4 NEW API for Validation RX Unicast schedule channel. 0b48e5c Channel Mask update ,support for excluded Channels and FHSS API pdate ead1ade Start sending PAS message after EAPOL parent TX fails. 8de473b Implemented 802.15.4 mode setting (ARMmbed#2328) 975b9e6 Added missing configuration api empty functions f7db06e Added configuration storage (ARMmbed#2283) e9561f0 Removed mbedTLS internal include file fe812c3 Changed certificate error message wording to be less fatal 97aaf5f Add network property API to Nanostack (ARMmbed#2318) cfd1a4d Fixed Route cost calculation 5094614 Added opeation mode validation for detect unsupported values. 44f85aa Enabled RPL candidate list filtering and only certificate setup accept without limit. 145c739 Wi-sun address registration trigger update d492575 Modified ARO registrations timeouts from the address lifetime b898f04 Removed Extra version number update at revocation start. b9d1409 Wi-sun config message consustent filter dcebff9 Use RPL parent soft filtering only after bootstrap. 523593e Fixed Broken new channel mask update. a3bcc2d Removed the PAN version change requirement from routers bc919d8 Merge pull request ARMmbed#2315 from ARMmbed/merge_release_internal_to_master git-subtree-dir: features/nanostack/sal-stack-nanostack git-subtree-split: cc03296
1 parent 2792e61 commit d104328

File tree

92 files changed

+4340
-1069
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+4340
-1069
lines changed

nanostack/fhss_config.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,12 @@ typedef struct fhss_ws_configuration {
116116
/** Broadcast fixed channel */
117117
uint8_t broadcast_fixed_channel;
118118

119-
/** Channel mask. */
119+
/** Channel mask. Wi-SUN will use this for broadcast */
120120
uint32_t channel_mask[8];
121121

122+
/** Wi-SUN specific unicast channel mask */
123+
uint32_t unicast_channel_mask[8];
124+
122125
/** Vendor defined channel function. */
123126
fhss_vendor_defined_cf *vendor_defined_cf;
124127

nanostack/fhss_ws_extension.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@
3030
extern "C" {
3131
#endif
3232

33+
/**
34+
* @brief ws_channel_mask_t WS neighbour supported channel mask
35+
*/
36+
typedef struct ws_channel_mask {
37+
uint16_t channel_count; /**<active channels at mask */
38+
uint32_t channel_mask[8]; /**< Supported channels */
39+
} ws_channel_mask_t;
40+
3341
/**
3442
* @brief unicast_timing_info Unicast timing/hopping schedule information structure.
3543
*/
@@ -64,6 +72,7 @@ typedef struct fhss_ws_neighbor_timing_info {
6472
uint8_t timing_accuracy; /**< Neighbor timing accuracy */
6573
unicast_timing_info_t uc_timing_info; /**< Neighbor unicast timing info */
6674
broadcast_timing_info_t bc_timing_info; /**< Neighbor broadcast timing info */
75+
ws_channel_mask_t uc_channel_list; /**< Neighbor Unicast channel list */
6776
uint32_t *excluded_channels; /**< Neighbor excluded channels (bit mask) */
6877
} fhss_ws_neighbor_timing_info_t;
6978

nanostack/mac_common_defines.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#define MAC_IEEE_802_15_4_MIN_MPDU_OVERHEAD 9 /**< Minimum overhead added by MAC to MPDU */
4444
#define MAC_IEEE_802_15_4_MAX_BEACON_OVERHEAD 75 /**< Maximum overhead which is added by the MAC for beacon */
4545
#define MAC_IEEE_802_15_4_MAX_PHY_PACKET_SIZE 127 /**< Maximum number of octets PHY layer is able to receive */
46+
#define MAC_IEEE_802_15_4G_MAX_PHY_PACKET_SIZE 2047 /**< Maximum number of octets PHY layer is able to receive */
4647

4748
#define MAC_IEEE_802_15_4_MAX_BEACON_PAYLOAD_LENGTH \
4849
(MAC_IEEE_802_15_4_MAX_PHY_PACKET_SIZE - MAC_IEEE_802_15_4_MAX_BEACON_OVERHEAD) /**< Maximum size of beacon payload */

nanostack/mlme.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ typedef enum {
264264
macAutoRequestKeyIndex = 0x7b, /*<The index of the key used for automatic data*/
265265
macDefaultKeySource = 0x7c, /*<Default key source*/
266266
//NON standard extension
267+
mac802_15_4Mode = 0xf6, /*<IEEE 802.15.4 mode*/
267268
macDeviceDescriptionPanIDUpdate = 0xf7, /*<Thread pending link update case this will update device descrioton list pan-id to new one*/
268269
macTXPower = 0xf8, /*<TX output power*/
269270
macCCAThreshold = 0xf9, /*<CCA threshold*/

nanostack/ns_sha256.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,45 +61,45 @@ static inline void ns_sha256_clone(ns_sha256_context *dst,
6161

6262
static inline void ns_sha256_starts(ns_sha256_context *ctx)
6363
{
64-
mbedtls_sha256_starts(ctx, 0);
64+
(void)mbedtls_sha256_starts_ret(ctx, 0);
6565
}
6666

6767
static inline void ns_sha256_update(ns_sha256_context *ctx, const void *input,
6868
size_t ilen)
6969
{
70-
mbedtls_sha256_update(ctx, input, ilen);
70+
(void)mbedtls_sha256_update_ret(ctx, input, ilen);
7171
}
7272

7373
static inline void ns_sha256_finish(ns_sha256_context *ctx, void *output)
7474
{
75-
mbedtls_sha256_finish(ctx, output);
75+
(void)mbedtls_sha256_finish_ret(ctx, output);
7676
}
7777

7878
static inline void ns_sha256(const void *input, size_t ilen, void *output)
7979
{
80-
mbedtls_sha256(input, ilen, output, 0);
80+
(void)mbedtls_sha256_ret(input, ilen, output, 0);
8181
}
8282

8383
/* Extensions to standard mbed TLS - output the first bits of a hash only */
8484
/* Number of bits must be a multiple of 32, and <=256 */
8585
static inline void ns_sha256_finish_nbits(ns_sha256_context *ctx, void *output, unsigned obits)
8686
{
8787
if (obits == 256) {
88-
mbedtls_sha256_finish(ctx, output);
88+
(void)mbedtls_sha256_finish_ret(ctx, output);
8989
} else {
9090
uint8_t sha256[32];
91-
mbedtls_sha256_finish(ctx, sha256);
91+
(void)mbedtls_sha256_finish_ret(ctx, sha256);
9292
memcpy(output, sha256, obits / 8);
9393
}
9494
}
9595

9696
static inline void ns_sha256_nbits(const void *input, size_t ilen, void *output, unsigned obits)
9797
{
9898
if (obits == 256) {
99-
mbedtls_sha256(input, ilen, output, 0);
99+
(void)mbedtls_sha256_ret(input, ilen, output, 0);
100100
} else {
101101
uint8_t sha256[32];
102-
mbedtls_sha256(input, ilen, sha256, 0);
102+
(void)mbedtls_sha256_ret(input, ilen, sha256, 0);
103103
memcpy(output, sha256, obits / 8);
104104
}
105105
}

nanostack/platform/arm_hal_phy.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ typedef enum {
7979
PHY_EXTENSION_SET_RF_CONFIGURATION, /**< Set RF configuration using phy_rf_channel_configuration_s structure */
8080
PHY_EXTENSION_FILTERING_SUPPORT, /**< Return filtering modes that can be supported by the PHY driver. See phy_link_filters_e */
8181
PHY_EXTENSION_SET_TX_POWER, /**< Set TX output power which is given as percentage of maximum. 0 is the lowest possible TX power and 100 is the highest possible TX power */
82-
PHY_EXTENSION_SET_CCA_THRESHOLD /**< Set CCA threshold which is given as percentage of maximum threshold. 0 is the lowest(strictest) possible threshold and 100 is the highest possible threshold */
82+
PHY_EXTENSION_SET_CCA_THRESHOLD, /**< Set CCA threshold which is given as percentage of maximum threshold. 0 is the lowest(strictest) possible threshold and 100 is the highest possible threshold */
83+
PHY_EXTENSION_SET_802_15_4_MODE /**< Set IEEE 802.15.4 mode as defined by phy_802_15_4_mode_t*/
8384
} phy_extension_type_e;
8485

8586
/** Address types */
@@ -172,6 +173,15 @@ typedef enum {
172173
MODULATION_INDEX_UNDEFINED ///< Modulation index undefined
173174
} phy_modulation_index_e;
174175

176+
/**
177+
* @brief enum phy_802_15_4_mode_t IEEE 802.15.4 mode
178+
*
179+
*/
180+
typedef enum {
181+
IEEE_802_15_4_2011, /**<IEEE 802.15.4-2011*/
182+
IEEE_802_15_4G_2012 /**<IEEE 802.15.4g-2012*/
183+
} phy_802_15_4_mode_t;
184+
175185
/** Channel configuration */
176186
typedef struct phy_rf_channel_configuration_s {
177187
uint32_t channel_0_center_frequency; ///< Center frequency

nanostack/socket_api.h

Lines changed: 42 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -694,27 +694,29 @@ static inline int8_t socket_read_session_address(int8_t socket, ns_address_t *ad
694694
*
695695
* IPv6 socket options summary
696696
*
697-
* | opt_name / cmsg_type | Data type | set/getsockopt | sendmsg | recvmsg |
698-
* | :--------------------------: | :--------------: | :-------------: | :-----: | :-------------------------------: |
699-
* | SOCKET_IPV6_TCLASS | int16_t | Yes | Yes | If enabled with RECVTCLASS |
700-
* | SOCKET_IPV6_UNICAST_HOPS | int16_t | Yes | No | No |
701-
* | SOCKET_IPV6_MULTICAST_HOPS | int16_t | Yes | No | No |
702-
* | SOCKET_IPV6_ADDR_PREFERENCES | int | Yes | No | No |
703-
* | SOCKET_IPV6_USE_MIN_MTU | int8_t | Yes | Yes | No |
704-
* | SOCKET_IPV6_DONTFRAG | int8_t | Yes | Yes | No |
705-
* | SOCKET_IPV6_FLOW_LABEL | int32_t | Yes | No | No |
706-
* | SOCKET_IPV6_HOPLIMIT | int16_t | No | Yes | If enabled with RECVHOPLIMIT |
707-
* | SOCKET_IPV6_PKTINFO | ns_in6_pktinfo_t | No | Yes | If enabled with RECVPKTINFO |
708-
* | SOCKET_IPV6_RECVPKTINFO | bool | Yes | No | No |
709-
* | SOCKET_IPV6_RECVHOPLIMIT | bool | Yes | No | No |
710-
* | SOCKET_IPV6_RECVTCLASS | bool | Yes | No | No |
711-
* | SOCKET_IPV6_MULTICAST_IF | int8_t | Yes | No | No |
712-
* | SOCKET_IPV6_MULTICAST_LOOP | bool | Yes | Yes | No |
713-
* | SOCKET_IPV6_JOIN_GROUP | ns_ipv6_mreq_t | Set only | No | No |
714-
* | SOCKET_IPV6_LEAVE_GROUP | ns_ipv6_mreq_t | Set only | No | No |
715-
* | SOCKET_BROADCAST_PAN | int8_t | Yes | No | No |
716-
* | SOCKET_LINK_LAYER_SECURITY | int8_t | Yes | No | No |
717-
* | SOCKET_INTERFACE_SELECT | int8_t | Yes | No | No |
697+
* | opt_name / cmsg_type | Data type | set/getsockopt | sendmsg | recvmsg |
698+
* | :--------------------------: | :---------- ----: | :-------------: | :-----: | :-------------------------------: |
699+
* | SOCKET_IPV6_TCLASS | int16_t | Yes | Yes | If enabled with RECVTCLASS |
700+
* | SOCKET_IPV6_UNICAST_HOPS | int16_t | Yes | No | No |
701+
* | SOCKET_IPV6_MULTICAST_HOPS | int16_t | Yes | No | No |
702+
* | SOCKET_IPV6_ADDR_PREFERENCES | int | Yes | No | No |
703+
* | SOCKET_IPV6_USE_MIN_MTU | int8_t | Yes | Yes | No |
704+
* | SOCKET_IPV6_DONTFRAG | int8_t | Yes | Yes | No |
705+
* | SOCKET_IPV6_FLOW_LABEL | int32_t | Yes | No | No |
706+
* | SOCKET_IPV6_HOPLIMIT | int16_t | No | Yes | If enabled with RECVHOPLIMIT |
707+
* | SOCKET_IPV6_PKTINFO | ns_in6_pktinfo_t | No | Yes | If enabled with RECVPKTINFO |
708+
* | SOCKET_IPV6_RECVPKTINFO | bool | Yes | No | No |
709+
* | SOCKET_IPV6_RECVHOPLIMIT | bool | Yes | No | No |
710+
* | SOCKET_IPV6_RECVTCLASS | bool | Yes | No | No |
711+
* | SOCKET_IPV6_MULTICAST_IF | int8_t | Yes | No | No |
712+
* | SOCKET_IPV6_MULTICAST_LOOP | bool | Yes | Yes | No |
713+
* | SOCKET_IPV6_JOIN_GROUP | ns_ipv6_mreq_t | Set only | No | No |
714+
* | SOCKET_IPV6_LEAVE_GROUP | ns_ipv6_mreq_t | Set only | No | No |
715+
* | SOCKET_BROADCAST_PAN | int8_t | Yes | No | No |
716+
* | SOCKET_LINK_LAYER_SECURITY | int8_t | Yes | No | No |
717+
* | SOCKET_INTERFACE_SELECT | int8_t | Yes | No | No |
718+
* | SOCKET_LATENCY | ns_ipv6_latency_t | Get only | No | No |
719+
* | SOCKET_STAGGER | ns_ipv6_stagger_t | Get only | No | No |
718720
*
719721
*/
720722

@@ -753,6 +755,10 @@ static inline int8_t socket_read_session_address(int8_t socket, ns_address_t *ad
753755
#define SOCKET_IPV6_JOIN_GROUP 15
754756
/** Leave a multicast group, using ns_ipv6_mreq_t */
755757
#define SOCKET_IPV6_LEAVE_GROUP 16
758+
/** Read estimated latency to reach destination */
759+
#define SOCKET_LATENCY 17
760+
/** Read estimated stagger value that can be used as initial delay after bootstrap or firmware update. */
761+
#define SOCKET_STAGGER 18
756762

757763
#define SOCKET_BROADCAST_PAN 0xfc /**< Internal use - transmit with IEEE 802.15.4 broadcast PAN ID */
758764
#define SOCKET_LINK_LAYER_SECURITY 0xfd /**< Not standard enable or disable socket security at link layer (For 802.15.4). */
@@ -765,6 +771,20 @@ typedef struct ns_ipv6_mreq {
765771
int8_t ipv6mr_interface; /**< interface id */
766772
} ns_ipv6_mreq_t;
767773

774+
/** Latency request used for getsockopt() */
775+
typedef struct {
776+
uint8_t dest_addr[16]; /**< [IN] IPv6 destination address */
777+
uint32_t latency; /**< [OUT] estimated latency value in milliseconds */
778+
} ns_ipv6_latency_t;
779+
780+
/** Stagger request used for getsockopt() */
781+
typedef struct {
782+
uint8_t dest_addr[16]; /**< [IN] IPv6 destination address */
783+
uint16_t data_amount; /**< [IN] Amount of data in kilobytes */
784+
uint16_t stagger_min; /**< [OUT] Minimum stagger value in seconds */
785+
uint16_t stagger_max; /**< [OUT] Maximum stagger value in seconds */
786+
uint16_t stagger_rand; /**< [OUT] Randomized stagger value in seconds */
787+
} ns_ipv6_stagger_t;
768788
/**
769789
* \brief Set an option for a socket
770790
*
@@ -804,6 +824,7 @@ int8_t socket_setsockopt(int8_t socket, uint8_t level, uint8_t opt_name, const v
804824
* \return 0 on success.
805825
* \return -1 invalid socket ID.
806826
* \return -2 invalid/unsupported option.
827+
* \return -3 data can't be retrieved.
807828
*/
808829
int8_t socket_getsockopt(int8_t socket, uint8_t level, uint8_t opt_name, void *opt_value, uint16_t *opt_len);
809830

nanostack/ws_bbr_api.h

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ int ws_bbr_start(int8_t interface_id, int8_t backbone_interface_id);
5252
#define BBR_GUA_ROUTE 0x0002 /**< More specific route is added for GUA prefix */
5353
#define BBR_BB_WAIT 0x0004 /**< Wait backbone availability before starting Wi-SUN network */
5454
#define BBR_DEFAULT_ROUTE 0x0008 /**< Add default route parameter to DIO */
55+
#define BBR_REQUIRE_DAO_REFRESH 0x0010 /**< Do not increment PAN version number when active forces DAO update from nodes*/
5556

5657
/**
5758
* Configure border router features.
@@ -158,4 +159,88 @@ int ws_bbr_eapol_node_limit_set(int8_t interface_id, uint16_t limit);
158159
*/
159160
int ws_bbr_ext_certificate_validation_set(int8_t interface_id, uint8_t validation);
160161

162+
/**
163+
* Sets RPL parameters
164+
*
165+
* Sets RPL DIO trickle parameters.
166+
*
167+
* \param interface_id Network interface ID.
168+
* \param dio_interval_min DIO trickle timer Imin parameter.
169+
* \param dio_interval_doublings DIO trickle timer Imax parameter as doublings of Imin
170+
* \param dio_redundancy_constant DIO trickle timer redundancy constant.
171+
*
172+
* \return 0, RPL parameters set.
173+
* \return <0 Node RPL parameters set failed.
174+
*/
175+
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);
176+
177+
/**
178+
* Gets RPL parameters
179+
*
180+
* Gets RPL DIO trickle parameters.
181+
*
182+
* \param interface_id Network interface ID.
183+
* \param dio_interval_min DIO trickle timer Imin parameter.
184+
* \param dio_interval_doublings DIO trickle timer Imax parameter as doublings of Imin
185+
* \param dio_redundancy_constant DIO trickle timer redundancy constant.
186+
*
187+
* \return 0, RPL parameters get.
188+
* \return <0 Node RPL parameters get failed.
189+
*/
190+
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);
191+
192+
/**
193+
* Validate RPL parameters
194+
*
195+
* Validates RPL DIO trickle parameters.
196+
*
197+
* \param interface_id Network interface ID.
198+
* \param dio_interval_min DIO trickle timer Imin parameter.
199+
* \param dio_interval_doublings DIO trickle timer Imax parameter as doublings of Imin
200+
* \param dio_redundancy_constant DIO trickle timer redundancy constant.
201+
*
202+
* \return 0, RPL parameters validated.
203+
* \return <0 Node RPL parameters validation failed.
204+
*/
205+
int ws_bbr_rpl_parameters_validate(int8_t interface_id, uint8_t dio_interval_min, uint8_t dio_interval_doublings, uint8_t dio_redundancy_constant);
206+
207+
/**
208+
* Sets PAN configuration
209+
*
210+
* Sets PAN configuration parameters.
211+
*
212+
* \param interface_id Network interface ID.
213+
* \param pan_id PAN ID; 0xffff default, generate the PAN ID.
214+
*
215+
* \return 0, PAN configuration set.
216+
* \return <0 PAN configuration set failed.
217+
*/
218+
int ws_bbr_pan_configuration_set(int8_t interface_id, uint16_t pan_id);
219+
220+
/**
221+
* Gets PAN configuration
222+
*
223+
* Gets PAN configuration parameters.
224+
*
225+
* \param interface_id Network interface ID.
226+
* \param pan_id PAN ID; 0xffff default
227+
*
228+
* \return 0, PAN configuration get.
229+
* \return <0 PAN configuration get failed.
230+
*/
231+
int ws_bbr_pan_configuration_get(int8_t interface_id, uint16_t *pan_id);
232+
233+
/**
234+
* Validates PAN configuration
235+
*
236+
* Validates PAN configuration parameters.
237+
*
238+
* \param interface_id Network interface ID.
239+
* \param pan_id PAN ID.
240+
*
241+
* \return 0, PAN configuration validated.
242+
* \return <0 PAN configuration validation failed.
243+
*/
244+
int ws_bbr_pan_configuration_validate(int8_t interface_id, uint16_t pan_id);
245+
161246
#endif /* WS_BBR_API_H_ */

0 commit comments

Comments
 (0)