Skip to content

Commit 7d555a3

Browse files
Merge commit '7197b5fd51825257ee04dac5dfd0d16ea1896853'
* commit '7197b5fd51825257ee04dac5dfd0d16ea1896853': Squashed 'features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/' changes from c9bf20f..43c7ec2
2 parents dc7be49 + 7197b5f commit 7d555a3

Some content is hidden

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

52 files changed

+1509
-815
lines changed

features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/net_interface.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -987,6 +987,23 @@ void arm_print_protocols2(void (*print_fn)(const char *fmt, ...), char sep);
987987
*
988988
*/
989989
extern void net_get_version_information(uint8_t *ptr);
990+
991+
/**
992+
* \brief Set buffer size for sleepy device parent.
993+
*
994+
* This function can be used to set sleepy device parent buffer size and packet threshold.
995+
*
996+
* Note! In Thread mode parent buffer size is automatically set during Thread initialization.
997+
*
998+
* \param big_packet_threshold Indicate how long packets are considered big. For Thread, must be 106 bytes.
999+
* \param small_packets_per_child_count Number of small packets stored for each sleepy children. For Thread, must be at least 1.
1000+
* \param big_packets_total_count Total number of big packets parent can store for all sleepy children. For Thread, must be at least 1.
1001+
* \return 0 on success, <0 on errors.
1002+
*/
1003+
1004+
extern int arm_nwk_sleepy_device_parent_buffer_size_set(int8_t interface_id, uint16_t big_packet_threshold, uint16_t small_packets_per_child_count, uint16_t big_packets_total_count);
1005+
1006+
9901007
#ifdef __cplusplus
9911008
}
9921009
#endif

features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/nanostack/thread_management_if.h

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,12 @@ typedef struct link_configuration {
7474
uint8_t master_key[16]; /**< Master key of the thread network*/
7575
uint8_t PSKc[16]; /**< PSKc value that is calculated from commissioning credentials credentials,XPANID and network name*/
7676
uint8_t mesh_local_ula_prefix[8]; /**< Mesh local ula prefix*/
77-
uint8_t mesh_local_eid[8]; /**< Mesh local extented id*/
7877
uint8_t extented_pan_id[8]; /**< Extended pan id*/
79-
uint8_t extended_random_mac[8]; /**< Extended random mac which is generated during commissioning*/
8078
uint8_t channel_mask[8]; /**< channel page and mask only supported is page 0*/
8179
uint8_t channel_page;/**< channel page supported pages 0*/
82-
char *PSKc_ptr; /**< Commissioning credentials. TODO! think if we need the actual credentials*/
83-
uint8_t PSKc_len; /**< Length of PSKc */
8480
uint16_t key_rotation; /**< Key rotation time in hours*/
8581
uint32_t key_sequence; /**< Key sequence counter */
8682
uint16_t panId; /**< network id*/
87-
uint8_t Protocol_id; /**< current protocol id*/
8883
uint8_t version; /**< current protocol version*/
8984
uint16_t rfChannel; /**< current rf channel*/
9085
uint8_t securityPolicy; /**< Commission Security Policy*/
@@ -108,6 +103,8 @@ typedef struct link_configuration {
108103
*/
109104
typedef struct {
110105
uint8_t eui64[8];/**< eui64 of the device. This field is used to identify device when joining to network Mandatory*/
106+
uint8_t mesh_local_eid[8]; /**< Mesh local extented id*/
107+
uint8_t extended_random_mac[8]; /**< Extended random mac which is generated during commissioning*/
111108
uint8_t *PSKd_ptr;/**< Device credentials used to authenticate device to commissioner Mandatory length 6-32*/
112109
uint8_t PSKd_len;/**< Length of PSKd_ptr*/
113110
char *provisioning_uri_ptr;/**< Provisioning url max 64 bytes*/
@@ -200,6 +197,22 @@ link_configuration_s *thread_management_configuration_get(int8_t interface_id);
200197
*/
201198
int thread_management_link_configuration_store(int8_t interface_id, link_configuration_s *link_config);
202199

200+
/** Configure extra TLVs in nanostack .
201+
*
202+
* Storing is asynchronous operation and this method makes a request to store link
203+
* configuration settings. Operation will be completed in the background.
204+
* Once settings has been stored the Thread network will be restarted with new
205+
* configuration settings.
206+
*
207+
* /param interface Id of network interface. -1 if interface_id is not available.
208+
* /param additional_ptr Pointer to the extra TLV that is to be configured in nanostack
209+
* /param additional_len Length of the additional TLV
210+
*
211+
* /return 0 if store request is successful.
212+
* /return < 0 if request is failed.
213+
*/
214+
int thread_management_link_configuration_add(int8_t interface_id, uint8_t *additional_ptr, uint8_t additional_len);
215+
203216
/** Delete Thread network link configuration settings.
204217
*
205218
* Deletion is asynchronous operation and this method makes a request to delete link
@@ -399,6 +412,34 @@ int thread_management_device_certificate_set(int8_t interface_id, const unsigned
399412
*/
400413
int thread_management_network_certificate_set(int8_t interface_id, const unsigned char *network_certificate_ptr, uint16_t network_certificate_len, const unsigned char *priv_key_ptr, uint16_t priv_key_len);
401414

415+
/**
416+
* Set Thread partition weighting.
417+
*
418+
* This function sets weighting value for Thread network partition. Interface will be restarted if interface is active and
419+
* new weighting value is different than previous weighting value.
420+
*
421+
* \param interface_id Network interface ID.
422+
* \param partition_weighting New weighting value for Thread partition
423+
*
424+
* \return 0, OK.
425+
* \return <0 fail.
426+
*/
427+
int thread_management_partition_weighting_set(int8_t interface_id, uint8_t partition_weighting);
428+
429+
/**
430+
* Set Thread Sleepy End Device parent packet buffer size.
431+
*
432+
* This function can be used to adjust count of packets SED parent is storing.
433+
*
434+
* \param interface_id Network interface ID.
435+
* \param small_packets_per_child_count Number of small packets parent is storing for each SED.
436+
* \param big_packets_total_count Number of big packets parent can store for all SEDs.
437+
*
438+
* \return 0, OK.
439+
* \return <0 fail.
440+
*/
441+
int thread_management_sed_parent_buffer_size_set(int8_t interface_id, uint16_t small_packets_per_child_count, uint16_t big_packets_total_count);
442+
402443
#ifdef __cplusplus
403444
}
404445
#endif

features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/source/6LoWPAN/Bootstraps/Generic/protocol_6lowpan_bootstrap.c

Lines changed: 33 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ static void protocol_6lowpan_neighbor_information_remove(int8_t interface_id, ml
100100
static int8_t protocol_6lowpan_host_challenge(int8_t interface_id, const uint8_t *mac64);
101101
static int8_t protocol_6lowpan_router_challenge(int8_t interface_id, const uint8_t *mac64);
102102
static void protocol_6lowpan_address_reg_ready(protocol_interface_info_entry_t *cur_interface);
103+
static void coordinator_black_list(protocol_interface_info_entry_t *cur);
103104

104105
static mle_6lowpan_data_t *mle_6lowpan_data;
105106

@@ -663,17 +664,17 @@ static uint16_t mle_router_synch(protocol_interface_info_entry_t *cur, const uin
663664
if (retrans) {
664665
if (destAddress) {
665666
timeout.retrans_max = 3;
666-
timeout.timeout_init = 1;
667-
timeout.timeout_max = 3;
667+
timeout.timeout_init = 2;
668+
timeout.timeout_max = 4;
668669
} else {
669670
timeout.retrans_max = 2;
670-
timeout.timeout_init = 2;
671+
timeout.timeout_init = 4;
671672
timeout.timeout_max = 4;
672673
}
673674
} else {
674675
timeout.retrans_max = 1;
675-
timeout.timeout_init = 1;
676-
timeout.timeout_max = 3;
676+
timeout.timeout_init = 2;
677+
timeout.timeout_max = 4;
677678
}
678679

679680
timeout.delay = delay;
@@ -706,7 +707,7 @@ static int mle_router_accept_request_build(protocol_interface_info_entry_t *cur,
706707
bufId = mle_service_msg_allocate(cur->id, 64, true,type);
707708
timeout.retrans_max = 2;
708709
timeout.timeout_init = 2;
709-
timeout.timeout_max = 2;
710+
timeout.timeout_max = 4;
710711
}
711712

712713
if (bufId == 0) {
@@ -814,6 +815,7 @@ static bool mle_parent_link_req_cb(int8_t interface_id, uint16_t msgId, bool use
814815
if (cur->nwk_bootstrap_state == ER_MLE_LINK_REQ) {
815816
//Enter ND scan
816817
bootsrap_next_state_kick(ER_SCAN, cur);
818+
pan_coordinator_blacklist_free(&cur->pan_cordinator_black_list);
817819
}
818820
#ifdef HAVE_RPL
819821
else if (cur->nwk_bootstrap_state == ER_ROUTER_SYNCH) {
@@ -840,12 +842,19 @@ static bool mle_parent_link_req_cb(int8_t interface_id, uint16_t msgId, bool use
840842
if (usedAllRetries) {
841843
switch (cur->nwk_bootstrap_state) {
842844
case ER_MLE_LINK_REQ:
843-
case ER_ROUTER_SYNCH:
844845
case ER_MLE_LINK_ADDRESS_SYNCH:
845846
case ER_MLE_LINK_SHORT_SYNCH:
847+
if (cur->nwk_bootstrap_state == ER_MLE_LINK_REQ) {
848+
coordinator_black_list(cur);
849+
}
846850
tr_debug("Link synch fail %u", cur->nwk_bootstrap_state);
847851
bootsrap_next_state_kick(ER_BOOTSTRAP_CONNECTION_DOWN, cur);
848852
break;
853+
#ifdef HAVE_RPL
854+
case ER_ROUTER_SYNCH:
855+
bootsrap_next_state_kick(ER_RPL_MC, cur);
856+
break;
857+
#endif // HAVE_RPL
849858
default:
850859
break;
851860
}
@@ -869,6 +878,7 @@ static bool mle_accept_request_cb(int8_t interface_id, uint16_t msgId, bool used
869878
//If message has been sent by MLE service sends MLE reject to clear link
870879
if (mle_service_check_msg_sent(msgId)) {
871880
uint8_t *address_ptr = mle_service_get_msg_destination_address_pointer(msgId);
881+
tr_debug("No accept for Accept/Request");
872882
mle_service_reject_message_build(cur->id, address_ptr, false);
873883
}
874884
return false;
@@ -2278,15 +2288,8 @@ static void nwk_6lowpan_bootsrap_pana_authentication_start(protocol_interface_in
22782288

22792289
#endif
22802290

2281-
static void nwk_6lowpan_network_authentication_fail(protocol_interface_info_entry_t *cur)
2291+
static void coordinator_black_list(protocol_interface_info_entry_t *cur)
22822292
{
2283-
nwk_scan_params_t *scan_params =
2284-
&cur->mac_parameters->nwk_scan_params;
2285-
2286-
tr_warn("Pana Auhth er");
2287-
2288-
scan_params->nwk_cur_active = mac_helper_free_pan_descriptions(scan_params->nwk_cur_active);
2289-
//Black List coordinator
22902293
uint8_t coord_pan_address[10];
22912294
addrtype_t cord_adr_type = mac_helper_coordinator_address_get(cur, coord_pan_address +2);
22922295

@@ -2299,6 +2302,18 @@ static void nwk_6lowpan_network_authentication_fail(protocol_interface_info_entr
22992302

23002303
pan_cordinator_blacklist_pan_set(&cur->pan_cordinator_black_list, coord_pan_address, 300);
23012304
}
2305+
}
2306+
2307+
static void nwk_6lowpan_network_authentication_fail(protocol_interface_info_entry_t *cur)
2308+
{
2309+
nwk_scan_params_t *scan_params =
2310+
&cur->mac_parameters->nwk_scan_params;
2311+
2312+
tr_warn("Pana Auhth er");
2313+
2314+
scan_params->nwk_cur_active = mac_helper_free_pan_descriptions(scan_params->nwk_cur_active);
2315+
//Black List coordinator
2316+
coordinator_black_list(cur);
23022317

23032318
nwk_bootsrap_state_update(ARM_NWK_AUHTENTICATION_FAIL, cur);
23042319
}
@@ -2374,6 +2389,7 @@ static void nwk_6lowpan_network_authentication_done(protocol_interface_info_entr
23742389
tr_debug("Link request start fail");
23752390
}
23762391
#else
2392+
pan_coordinator_blacklist_free(&cur->pan_cordinator_black_list);
23772393
cur->nwk_bootstrap_state = ER_SCAN;
23782394
nwk_6lowpan_router_scan_state(cur);
23792395
#endif
@@ -2538,7 +2554,7 @@ void protocol_6lowpan_mac_scan_confirm(int8_t if_id, const mlme_scan_conf_t* con
25382554

25392555
void bootstrap_timer_handle(uint16_t ticks)
25402556
{
2541-
ticks;
2557+
(void)ticks;
25422558
ns_list_foreach(protocol_interface_info_entry_t, cur, &protocol_interface_info_list) {
25432559
if (cur->nwk_id == IF_6LoWPAN) {
25442560
if (cur->nwk_bootstrap_state == ER_ACTIVE_SCAN || cur->nwk_bootstrap_state == ER_WARM_ACTIVE_SCAN) {
@@ -2728,6 +2744,7 @@ static void protocol_6lowpan_generate_link_reject(protocol_interface_info_entry_
27282744
address[8] ^= 2;
27292745
}
27302746
if (mac_helper_default_security_level_get(cur)) {
2747+
tr_debug("Drop link by asymmetric security");
27312748
mle_service_reject_message_build(cur->id, address, false);
27322749
return;
27332750
}

features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/source/6LoWPAN/Mesh/mesh.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ buffer_t *mesh_up(buffer_t *buf)
243243
memcpy(buf->dst_sa.address + 2, route.address, route.addr_len);
244244

245245
/* Set src MAC address from our interface */
246+
buf->src_sa.addr_type = ADDR_NONE;
246247
if (!mac_helper_write_our_addr(cur, &buf->src_sa)) {
247248
goto drop;
248249
}

0 commit comments

Comments
 (0)