@@ -81,7 +81,7 @@ static void ws_bootstrap_state_change(protocol_interface_info_entry_t *cur, icmp
81
81
static bool ws_bootstrap_state_discovery (struct protocol_interface_info_entry * cur );
82
82
static int8_t ws_bootsrap_event_trig (ws_bootsrap_event_type_e event_type , int8_t interface_id , arm_library_event_priority_e priority , void * event_data );
83
83
84
- static bool ws_bootstrap_neighbor_info_request (struct protocol_interface_info_entry * interface , const uint8_t * mac_64 , llc_neighbour_req_t * neighbor_buffer , bool request_new , bool multicast );
84
+ static bool ws_bootstrap_neighbor_info_request (struct protocol_interface_info_entry * interface , const uint8_t * mac_64 , llc_neighbour_req_t * neighbor_buffer , bool request_new );
85
85
static uint16_t ws_bootstrap_routing_cost_calculate (protocol_interface_info_entry_t * cur );
86
86
static uint16_t ws_bootstrap_rank_get (protocol_interface_info_entry_t * cur );
87
87
static uint16_t ws_bootstrap_min_rank_inc_get (protocol_interface_info_entry_t * cur );
@@ -97,13 +97,15 @@ static void ws_bootstrap_pan_version_increment(protocol_interface_info_entry_t *
97
97
static ws_nud_table_entry_t * ws_nud_entry_discover (protocol_interface_info_entry_t * cur , void * neighbor );
98
98
static void ws_nud_entry_remove (protocol_interface_info_entry_t * cur , mac_neighbor_table_entry_t * entry_ptr );
99
99
static bool ws_neighbor_entry_nud_notify (mac_neighbor_table_entry_t * entry_ptr , void * user_data );
100
+ static bool ws_rpl_dio_new_parent_accept (struct protocol_interface_info_entry * interface );
100
101
101
102
typedef enum {
102
103
WS_PARENT_SOFT_SYNCH = 0 , /**< let FHSS make decision if synchronization is needed*/
103
104
WS_PARENT_HARD_SYNCH , /**< Synch FHSS with latest synch information*/
104
105
WS_EAPOL_PARENT_SYNCH , /**< Broadcast synch with EAPOL parent*/
105
106
} ws_parent_synch_e ;
106
107
108
+
107
109
static void ws_bootsrap_create_ll_address (uint8_t * ll_address , const uint8_t * mac64 )
108
110
{
109
111
memcpy (ll_address , ADDR_LINK_LOCAL_PREFIX , 8 );
@@ -925,7 +927,7 @@ static void ws_bootstrap_pan_advertisement_analyse(struct protocol_interface_inf
925
927
// Save route cost for all neighbours
926
928
llc_neighbour_req_t neighbor_info ;
927
929
neighbor_info .neighbor = NULL ;
928
- if (ws_bootstrap_neighbor_info_request (cur , data -> SrcAddr , & neighbor_info , false, false )) {
930
+ if (ws_bootstrap_neighbor_info_request (cur , data -> SrcAddr , & neighbor_info , false)) {
929
931
neighbor_info .ws_neighbor -> routing_cost = pan_information .routing_cost ;
930
932
}
931
933
@@ -1080,10 +1082,10 @@ static void ws_bootstrap_pan_config_analyse(struct protocol_interface_info_entry
1080
1082
1081
1083
if (cur -> ws_info -> configuration_learned || cur -> bootsrap_mode == ARM_NWK_BOOTSRAP_MODE_6LoWPAN_BORDER_ROUTER ) {
1082
1084
//If we are border router or learned configuration we only update already learned neighbours.
1083
- neighbour_pointer_valid = ws_bootstrap_neighbor_info_request (cur , data -> SrcAddr , & neighbor_info , false, true );
1085
+ neighbour_pointer_valid = ws_bootstrap_neighbor_info_request (cur , data -> SrcAddr , & neighbor_info , false);
1084
1086
1085
1087
} else {
1086
- neighbour_pointer_valid = ws_bootstrap_neighbor_info_request (cur , data -> SrcAddr , & neighbor_info , true, true );
1088
+ neighbour_pointer_valid = ws_bootstrap_neighbor_info_request (cur , data -> SrcAddr , & neighbor_info , true);
1087
1089
if (!neighbour_pointer_valid ) {
1088
1090
return ;
1089
1091
}
@@ -1169,7 +1171,7 @@ static void ws_bootstrap_pan_config_solicit_analyse(struct protocol_interface_in
1169
1171
*/
1170
1172
1171
1173
llc_neighbour_req_t neighbor_info ;
1172
- if (ws_bootstrap_neighbor_info_request (cur , data -> SrcAddr , & neighbor_info , false, false )) {
1174
+ if (ws_bootstrap_neighbor_info_request (cur , data -> SrcAddr , & neighbor_info , false)) {
1173
1175
etx_lqi_dbm_update (cur -> id , data -> mpduLinkQuality , data -> signal_dbm , neighbor_info .neighbor -> index );
1174
1176
ws_neighbor_class_neighbor_unicast_time_info_update (neighbor_info .ws_neighbor , ws_utt , data -> timestamp );
1175
1177
ws_neighbor_class_neighbor_unicast_schedule_set (neighbor_info .ws_neighbor , ws_us );
@@ -1399,8 +1401,9 @@ static void ws_bootstrap_neighbor_table_clean(struct protocol_interface_info_ent
1399
1401
1400
1402
}
1401
1403
1402
- static bool ws_bootstrap_neighbor_info_request (struct protocol_interface_info_entry * interface , const uint8_t * mac_64 , llc_neighbour_req_t * neighbor_buffer , bool request_new , bool multicast )
1404
+ static bool ws_bootstrap_neighbor_info_request (struct protocol_interface_info_entry * interface , const uint8_t * mac_64 , llc_neighbour_req_t * neighbor_buffer , bool request_new )
1403
1405
{
1406
+ neighbor_buffer -> ws_neighbor = NULL ;
1404
1407
neighbor_buffer -> neighbor = mac_neighbor_table_address_discover (mac_neighbor_info (interface ), mac_64 , ADDR_802_15_4_LONG );
1405
1408
if (neighbor_buffer -> neighbor ) {
1406
1409
neighbor_buffer -> ws_neighbor = ws_neighbor_class_entry_get (& interface -> ws_info -> neighbor_storage , neighbor_buffer -> neighbor -> index );
@@ -1421,27 +1424,6 @@ static bool ws_bootstrap_neighbor_info_request(struct protocol_interface_info_en
1421
1424
return false;
1422
1425
}
1423
1426
1424
- if (multicast ) {
1425
- //for multicast neighbour we must limit if we have already enough information
1426
- if (interface -> bootsrap_mode == ARM_NWK_BOOTSRAP_MODE_6LoWPAN_BORDER_ROUTER ) {
1427
- //Border router never allocate neighbors by multicast
1428
- return false;
1429
- }
1430
-
1431
- uint16_t parent_candidate_size = rpl_control_parent_candidate_list_size (interface , false);
1432
-
1433
- //if we have enough candidates at list do not accept new multicast neighbours
1434
- if (parent_candidate_size >= 4 ) {
1435
- return false;
1436
- }
1437
-
1438
- parent_candidate_size = rpl_control_parent_candidate_list_size (interface , true);
1439
- //If we have already enough parent selected Candidates count is bigger tahn 4
1440
- if (parent_candidate_size >= 2 ) {
1441
- return false;
1442
- }
1443
- }
1444
-
1445
1427
ws_bootstrap_neighbor_table_clean (interface );
1446
1428
1447
1429
neighbor_buffer -> neighbor = ws_bootstrap_mac_neighbor_add (interface , mac_64 );
@@ -1458,6 +1440,24 @@ static bool ws_bootstrap_neighbor_info_request(struct protocol_interface_info_en
1458
1440
return true;
1459
1441
}
1460
1442
1443
+ static bool ws_rpl_dio_new_parent_accept (struct protocol_interface_info_entry * interface )
1444
+ {
1445
+ uint16_t parent_candidate_size = rpl_control_parent_candidate_list_size (interface , false);
1446
+ //TODO check bootstarap state for review
1447
+ //if we have enough candidates at list do not accept new multicast neighbours
1448
+ if (parent_candidate_size > WS_NEIGHBOUR_MAX_CANDIDATE_PROBE ) {
1449
+ return false;
1450
+ }
1451
+
1452
+ parent_candidate_size = rpl_control_parent_candidate_list_size (interface , true);
1453
+ //If we have already enough parent selected Candidates count is bigger tahn 4
1454
+ if (parent_candidate_size >= 2 ) {
1455
+ return false;
1456
+ }
1457
+
1458
+ return true;
1459
+ }
1460
+
1461
1461
1462
1462
static void ws_neighbor_entry_remove_notify (mac_neighbor_table_entry_t * entry_ptr , void * user_data )
1463
1463
{
@@ -2010,6 +2010,48 @@ static void ws_rpl_prefix_callback(prefix_entry_t *prefix, void *handle, uint8_t
2010
2010
}
2011
2011
}
2012
2012
2013
+ static bool ws_rpl_new_parent_callback_t (uint8_t * ll_parent_address , void * handle )
2014
+ {
2015
+
2016
+ protocol_interface_info_entry_t * cur = handle ;
2017
+ if (!cur -> rpl_domain || cur -> interface_mode != INTERFACE_UP ) {
2018
+ return false;
2019
+ }
2020
+
2021
+ uint8_t mac64 [8 ];
2022
+ memcpy (mac64 , ll_parent_address + 8 , 8 );
2023
+ mac64 [0 ] ^= 2 ;
2024
+ llc_neighbour_req_t neigh_buffer ;
2025
+ if (ws_bootstrap_neighbor_info_request (cur , mac64 , & neigh_buffer , false)) {
2026
+ return true;
2027
+ }
2028
+
2029
+ if (!ws_rpl_dio_new_parent_accept (cur )) {
2030
+ return false;
2031
+ }
2032
+
2033
+ //Discover Multicast temporary entry
2034
+
2035
+ ws_neighbor_temp_class_t * entry = ws_llc_get_multicast_temp_entry (cur , mac64 );
2036
+ if (!entry ) {
2037
+ return false;
2038
+ }
2039
+ //Create entry
2040
+ bool create_ok = ws_bootstrap_neighbor_info_request (cur , mac64 , & neigh_buffer , true);
2041
+ if (create_ok ) {
2042
+ ws_neighbor_class_entry_t * ws_neigh = neigh_buffer .ws_neighbor ;
2043
+ //Copy fhss temporary data
2044
+ * ws_neigh = entry -> neigh_info_list ;
2045
+ //ETX Create here
2046
+ etx_lqi_dbm_update (cur -> id , entry -> mpduLinkQuality , entry -> signal_dbm , neigh_buffer .neighbor -> index );
2047
+ mac_neighbor_table_trusted_neighbor (mac_neighbor_info (cur ), neigh_buffer .neighbor , true);
2048
+ }
2049
+ ws_llc_free_multicast_temp_entry (cur , entry );
2050
+
2051
+
2052
+ return create_ok ;
2053
+ }
2054
+
2013
2055
static void ws_bootstrap_rpl_activate (protocol_interface_info_entry_t * cur )
2014
2056
{
2015
2057
tr_debug ("RPL Activate" );
@@ -2018,7 +2060,7 @@ static void ws_bootstrap_rpl_activate(protocol_interface_info_entry_t *cur)
2018
2060
2019
2061
addr_add_router_groups (cur );
2020
2062
rpl_control_set_domain_on_interface (cur , protocol_6lowpan_rpl_domain , downstream );
2021
- rpl_control_set_callback (protocol_6lowpan_rpl_domain , ws_bootstrap_rpl_callback , ws_rpl_prefix_callback , cur );
2063
+ rpl_control_set_callback (protocol_6lowpan_rpl_domain , ws_bootstrap_rpl_callback , ws_rpl_prefix_callback , ws_rpl_new_parent_callback_t , cur );
2022
2064
// If i am router I Do this
2023
2065
rpl_control_force_leaf (protocol_6lowpan_rpl_domain , leaf );
2024
2066
rpl_control_request_parent_link_confirmation (true);
@@ -2520,7 +2562,7 @@ void ws_bootstrap_network_scan_process(protocol_interface_info_entry_t *cur)
2520
2562
2521
2563
// Add EAPOL neighbour
2522
2564
llc_neighbour_req_t neighbor_info ;
2523
- if (!ws_bootstrap_neighbor_info_request (cur , cur -> ws_info -> parent_info .addr , & neighbor_info , true, false )) {
2565
+ if (!ws_bootstrap_neighbor_info_request (cur , cur -> ws_info -> parent_info .addr , & neighbor_info , true)) {
2524
2566
return ;
2525
2567
}
2526
2568
0 commit comments