Skip to content
This repository was archived by the owner on May 23, 2023. It is now read-only.

Commit 7197b5f

Browse files
Squashed 'features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/' changes from c9bf20f..43c7ec2
43c7ec2 Merge branch 'release_internal' into release_external ed76459 Merge pull request ARMmbed#1558 from ARMmbed/IOTTHD-2195 8d3bcb7 Add new function to unit tests 56f66a4 Review correction 8b7d018 Move indirect queue size public API to net_interface d877c9e Review corrections c25e476 Remove Eclipse project files for external release d51f442 Merge branch 'release_internal' into release_external 135c48d Increase Thread SED buffer size for big packets 70931a7 Fix indirect queue packet ordering 10e51a4 API for changing Thread SED parent buffer size 6122d24 dereference null value issue fixed. (ARMmbed#1557) d1378dc Clear IPv6 neighbor cache in partition change (ARMmbed#1554) 7610e91 Child neighbor entry updates (ARMmbed#1550) c727295 cleared neighbours with child address that are not ours (ARMmbed#1549) 80b4d72 Thread partition merge mode TLV change (ARMmbed#1546) edd7599 RLOC was updated before clearing child info (ARMmbed#1547) a666056 router short address set to 0xfffe for non routers (ARMmbed#1543) 759ab05 delete route set and link set entries for a router ID (ARMmbed#1540) 23a1265 REED advertisement handling (Thread spec 5.16.3): (ARMmbed#1535) 0a32cb4 added active and pending timestamps to child update response (ARMmbed#1533) d0eec80 Fix error case memory leak (ARMmbed#1537) da9860f Pending set after link sync (ARMmbed#1526) ffa1569 Thread router network data update after link sync (ARMmbed#1530) 3b46d8d Fix defects found by coverity (ARMmbed#1529) 3a57101 Fix compiler warnings and update traces (ARMmbed#1523) c288227 Add extension check for partition weight drop in parent selection (ARMmbed#1521) d8dea28 network data cleared after router forms new partition (ARMmbed#1525) 44a85e5 removed router flagging for thread_management_server file (ARMmbed#1524) 1cbced9 Merge pull request ARMmbed#1520 from ARMmbed/IOTTHD-2105_2 3d07365 Review corrections to network data clearing 22a0375 Clear network data from lost children ffd8517 added a new thread management function (ARMmbed#1519) 80af9cb Thread BR network data clearing (ARMmbed#1518) 5a6f6b5 thread nvm valgrind uninitialized data fix (ARMmbed#1517) d5e2198 Add API for partition weighting set (ARMmbed#1513) 8811d6f multicast forwarding scope changed and address registration updated. (ARMmbed#1516) c277384 printf to tr_info (ARMmbed#1515) bb21264 Thread combined nvm test (ARMmbed#1507) 76f7725 Primary BBR fixes from interop (ARMmbed#1512) 12ed5ab FHSS unit test: fixed fhss mac interface test (cherry picked from commit 805eb42e4416b00cc018dc32dceb353d0b6c8bb6) dd21ea9 Remvoed unnecessary trace print's. cb6e78b FHSS unit test: fixed fhss beacon tasklet test (cherry picked from commit abe6d671b058f4f069741eab24d51e4d62d550b0) 237b3d4 Fhss info print (ARMmbed#1486) 0f39a47 FHSS: Do not update synch monitor right after superframe change (cherry picked from commit 99d50ad9d7f8dad80f10c2a4303f4e75ab31a3c2) c9a098f Fixed Timeoout force which actually never generate timeout. 957c7fb Pana server and client update: ae230e5 FHSS: Update Beacon synch info in critical state 84bd8a4 FHSS: Synchronization must be done in critical state fb1b163 Pan coordinator blacklist update 39fe6ba Added missing HAVE_RPL compiler flag 16a1bc5 MLE bootsrap and message timeout update eeb2d39 enable BBR to support multicast registration in non commercial networks (ARMmbed#1509) 4ea2bf8 uri modified. (ARMmbed#1510) f443853 timeout corrected for neighbour entry (ARMmbed#1508) ea93c1f Thread dev conf taken use (ARMmbed#1503) 5d5b239 bug fix in bbr start (ARMmbed#1505) 8dbd521 commented a trace. (ARMmbed#1504) 145dbdf device conf copy fix (ARMmbed#1502) f60268f eid&random mac moved to device conf struct (ARMmbed#1497) df18635 Let MAC choose address when mesh forwarding 42f916b fixed BBR stop to remove network data and routing information (ARMmbed#1500) e058c2a pbbr changes (ARMmbed#1499) 1ece307 Merge pull request ARMmbed#1485 from ARMmbed/merge_release_back dda8164 thread address handling updated. (ARMmbed#1496) 1dc21a1 thread extension fixes. (ARMmbed#1495) 543fe98 Merge branch 'release_internal' bade70e Dua req changes (ARMmbed#1494) 1979df8 added status to MLR response and implemeted BMLR.ntf multicast. (ARMmbed#1492) 1807c01 mle class initialisation (ARMmbed#1488) d809831 Merge pull request ARMmbed#1479 from ARMmbed/merge_release_to_master bce812d Update license to Thread test file (ARMmbed#1483) aaa4b1f Revert eclipse file removal git-subtree-dir: features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack git-subtree-split: 43c7ec2
1 parent 041b6fa commit 7197b5f

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

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

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

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
}

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)