Skip to content

Commit 3f7eae6

Browse files
author
Juha Heiskanen
committed
EAPOL FHSS temp entry discover
Extented Wi-SUN FHSS neighbour data discovery with EAPOL temp entry discovery. Remoived Temp MAC neighbour usage for EAPOL temp neighbour.
1 parent 5200b66 commit 3f7eae6

File tree

6 files changed

+28
-93
lines changed

6 files changed

+28
-93
lines changed

source/6LoWPAN/ws/ws_bootstrap.c

Lines changed: 10 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -199,56 +199,10 @@ static void ws_bootstrap_neighbor_delete(struct protocol_interface_info_entry *i
199199
ws_neighbor_class_entry_remove(&interface->ws_info->neighbor_storage, entry_ptr->index);
200200
}
201201

202-
static void ws_bootstap_eapol_neigh_entry_allocate(struct protocol_interface_info_entry *interface)
203-
{
204-
uint8_t mac_64[8];
205-
memset(mac_64, 0, sizeof(mac_64));
206-
mac_neighbor_table_entry_t *mac_entry = ws_bootstrap_mac_neighbor_allocate(interface, mac_64);
207-
208-
if (!mac_entry) {
209-
return;
210-
}
211-
mac_entry->lifetime = 0xffffffff;
212-
mac_entry->link_lifetime = 0xffffffff;
213-
ws_neighbor_class_entry_t *ws_neigh = ws_neighbor_class_entry_get(&interface->ws_info->neighbor_storage, mac_entry->index);
214-
if (!ws_neigh) {
215-
return;
216-
}
217-
218-
interface->ws_info->eapol_tx_index = mac_entry->index;
219-
}
220-
221-
ws_neighbor_class_entry_t *ws_bootstrap_eapol_tx_temporary_set(struct protocol_interface_info_entry *interface, const uint8_t *src64)
222-
{
223-
mlme_device_descriptor_t device_desc;
224-
mac_neighbor_table_entry_t *mac_entry = mac_neighbor_table_attribute_discover(mac_neighbor_info(interface), interface->ws_info->eapol_tx_index);
225-
if (!mac_entry) {
226-
return NULL;
227-
}
228-
229-
memcpy(mac_entry->mac64, src64, 8);
230-
mac_helper_device_description_write(interface, &device_desc, src64, 0xffff, 0, false);
231-
mac_helper_devicetable_direct_set(interface->mac_api, &device_desc, mac_entry->index);
232-
return ws_neighbor_class_entry_get(&interface->ws_info->neighbor_storage, mac_entry->index);
233-
}
234-
235-
void ws_bootstrap_eapol_tx_temporary_clear(struct protocol_interface_info_entry *interface)
236-
{
237-
mac_neighbor_table_entry_t *mac_entry = mac_neighbor_table_attribute_discover(mac_neighbor_info(interface), interface->ws_info->eapol_tx_index);
238-
if (!mac_entry) {
239-
return;
240-
}
241-
242-
memset(mac_entry->mac64, 0xff, 8);
243-
mac_helper_devicetable_remove(interface->mac_api, interface->ws_info->eapol_tx_index, NULL);
244-
}
245-
246202
static void ws_bootstrap_neighbor_list_clean(struct protocol_interface_info_entry *interface)
247203
{
248204

249205
mac_neighbor_table_neighbor_list_clean(mac_neighbor_info(interface));
250-
//Allocate EAPOL TX temporary neigh entries
251-
ws_bootstap_eapol_neigh_entry_allocate(interface);
252206
}
253207

254208
static void ws_address_reregister_trig(struct protocol_interface_info_entry *interface)
@@ -560,14 +514,19 @@ static fhss_ws_neighbor_timing_info_t *ws_get_neighbor_info(const fhss_api_t *ap
560514
return NULL;
561515
}
562516
mac_neighbor_table_entry_t *mac_neighbor = mac_neighbor_table_address_discover(mac_neighbor_info(cur), eui64, MAC_ADDR_MODE_64_BIT);
563-
if (!mac_neighbor) {
564-
return NULL;
517+
if (mac_neighbor) {
518+
ws_neighbor_class_entry_t *ws_neighbor = ws_neighbor_class_entry_get(&cur->ws_info->neighbor_storage, mac_neighbor->index);
519+
if (!ws_neighbor) {
520+
return NULL;
521+
}
522+
return &ws_neighbor->fhss_data;
565523
}
566-
ws_neighbor_class_entry_t *ws_neighbor = ws_neighbor_class_entry_get(&cur->ws_info->neighbor_storage, mac_neighbor->index);
567-
if (!ws_neighbor) {
524+
//Discover temporary entry
525+
ws_neighbor_temp_class_t *temp_entry = ws_llc_get_eapol_temp_entry(cur, eui64);
526+
if (!temp_entry) {
568527
return NULL;
569528
}
570-
return &ws_neighbor->fhss_data;
529+
return &temp_entry->neigh_info_list.fhss_data;
571530
}
572531
static void ws_bootstrap_llc_hopping_update(struct protocol_interface_info_entry *cur, const fhss_ws_configuration_t *fhss_configuration)
573532
{
@@ -2082,11 +2041,6 @@ static void ws_bootstrap_neighbor_table_clean(struct protocol_interface_info_ent
20822041
ns_list_foreach_safe(mac_neighbor_table_entry_t, cur, &mac_neighbor_info(interface)->neighbour_list) {
20832042
ws_neighbor_class_entry_t *ws_neighbor = ws_neighbor_class_entry_get(&interface->ws_info->neighbor_storage, cur->index);
20842043

2085-
if (cur->index == interface->ws_info->eapol_tx_index) {
2086-
//Skip EAPOL temp entries
2087-
continue;
2088-
}
2089-
20902044
if (cur->link_role == PRIORITY_PARENT_NEIGHBOUR) {
20912045
//This is our primary parent we cannot delete
20922046
continue;

source/6LoWPAN/ws/ws_bootstrap.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,6 @@ bool ws_bootstrap_validate_channel_plan(struct ws_us_ie *ws_us, struct protocol_
9191

9292
bool ws_bootstrap_validate_channel_function(struct ws_us_ie *ws_us, struct ws_bs_ie *ws_bs);
9393

94-
struct ws_neighbor_class_entry *ws_bootstrap_eapol_tx_temporary_set(struct protocol_interface_info_entry *interface, const uint8_t *src64);
95-
96-
void ws_bootstrap_eapol_tx_temporary_clear(struct protocol_interface_info_entry *interface);
97-
9894
void ws_bootstrap_neighbor_set_stable(struct protocol_interface_info_entry *interface, const uint8_t *src64);
9995

10096
int ws_bootstrap_stack_info_get(protocol_interface_info_entry_t *cur, struct ws_stack_info *info_ptr);

source/6LoWPAN/ws/ws_common.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ typedef struct ws_info_s {
8989
trickle_params_t trickle_params_pan_discovery;
9090
uint8_t rpl_state; // state from rpl_event_t
9191
uint8_t pas_requests; // Amount of PAN solicits sent
92-
uint8_t eapol_tx_index;
9392
uint8_t device_min_sens; // Device min sensitivity set by the application
9493
int8_t weakest_received_rssi; // Weakest received signal (dBm)
9594
parent_info_t parent_info[WS_PARENT_LIST_SIZE];

source/6LoWPAN/ws/ws_llc.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,10 @@ bool ws_llc_eapol_relay_forward_filter(struct protocol_interface_info_entry *int
232232

233233
ws_neighbor_temp_class_t *ws_llc_get_multicast_temp_entry(struct protocol_interface_info_entry *interface, const uint8_t *mac64);
234234

235+
ws_neighbor_temp_class_t *ws_llc_get_eapol_temp_entry(struct protocol_interface_info_entry *interface, const uint8_t *mac64);
236+
237+
238+
235239
void ws_llc_free_multicast_temp_entry(struct protocol_interface_info_entry *interface, ws_neighbor_temp_class_t *neighbor);
236240

237241
#endif /* WS_LLC_H_ */

source/6LoWPAN/ws/ws_llc_data_service.c

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -463,17 +463,12 @@ static llc_data_base_t *ws_llc_base_allocate(void)
463463
return base;
464464
}
465465

466-
static void ws_llc_mac_eapol_clear(llc_data_base_t *base, llc_message_t *message)
466+
static void ws_llc_mac_eapol_clear(llc_data_base_t *base)
467467
{
468-
//Clear active EAPOL Session Count
468+
//Clear active EAPOL Session
469469
if (base->temp_entries->active_eapol_session) {
470470
base->temp_entries->active_eapol_session = false;
471471
}
472-
473-
if (message->eapol_temporary) {
474-
//Clear
475-
ws_bootstrap_eapol_tx_temporary_clear(base->interface_ptr);
476-
}
477472
}
478473

479474

@@ -495,8 +490,6 @@ static void ws_llc_mac_confirm_cb(const mac_api_t *api, const mcps_data_conf_t *
495490
uint8_t messsage_type = message->messsage_type;
496491
uint8_t mpx_user_handle = message->mpx_user_handle;
497492
if (message->eapol_temporary) {
498-
//Clear
499-
ws_bootstrap_eapol_tx_temporary_clear(interface);
500493

501494
if (data->status == MLME_SUCCESS || data->status == MLME_NO_DATA) {
502495
//Update timeout
@@ -1182,17 +1175,6 @@ static void ws_llc_mpx_eapol_send(llc_data_base_t *base, llc_message_t *message)
11821175
ws_neighbor_temp_class_t *temp_neigh = ws_llc_discover_temp_entry(&base->temp_entries->active_eapol_temp_neigh, message->dst_address);
11831176

11841177
if (temp_neigh) {
1185-
//Discover Free MAC &Wi-sun tx entry
1186-
ws_neighbor_class_entry_t *entry = ws_bootstrap_eapol_tx_temporary_set(base->interface_ptr, message->dst_address);
1187-
if (!entry) {
1188-
//No temp entry add to pending list
1189-
//Move to pending list
1190-
ns_list_add_to_end(&base->temp_entries->llc_eap_pending_list, message);
1191-
base->temp_entries->llc_eap_pending_list_size++;
1192-
random_early_detetction_aq_calc(base->interface_ptr->llc_eapol_random_early_detection, base->temp_entries->llc_eap_pending_list_size);
1193-
return;
1194-
}
1195-
*entry = temp_neigh->neigh_info_list;
11961178
message->eapol_temporary = true;
11971179
} else {
11981180
message->eapol_temporary = false;
@@ -1386,7 +1368,7 @@ static uint8_t ws_llc_mpx_data_purge_request(const mpx_api_t *api, struct mcps_p
13861368
purge_status = base->interface_ptr->mac_api->mcps_purge_req(base->interface_ptr->mac_api, &purge_req);
13871369
if (purge_status == 0) {
13881370
if (message->messsage_type == WS_FT_EAPOL) {
1389-
ws_llc_mac_eapol_clear(base, message);
1371+
ws_llc_mac_eapol_clear(base);
13901372
}
13911373
llc_message_free(message, base);
13921374
}
@@ -1423,7 +1405,7 @@ static void ws_llc_clean(llc_data_base_t *base)
14231405
ns_list_foreach_safe(llc_message_t, message, &base->llc_message_list) {
14241406
purge_req.msduHandle = message->msg_handle;
14251407
if (message->messsage_type == WS_FT_EAPOL) {
1426-
ws_llc_mac_eapol_clear(base, message);
1408+
ws_llc_mac_eapol_clear(base);
14271409
}
14281410
llc_message_free(message, base);
14291411
base->interface_ptr->mac_api->mcps_purge_req(base->interface_ptr->mac_api, &purge_req);
@@ -1500,6 +1482,16 @@ ws_neighbor_temp_class_t *ws_llc_get_multicast_temp_entry(protocol_interface_inf
15001482
return ws_llc_discover_temp_entry(&base->temp_entries->active_multicast_temp_neigh, mac64);
15011483
}
15021484

1485+
ws_neighbor_temp_class_t *ws_llc_get_eapol_temp_entry(struct protocol_interface_info_entry *interface, const uint8_t *mac64)
1486+
{
1487+
llc_data_base_t *base = ws_llc_discover_by_interface(interface);
1488+
if (!base) {
1489+
return NULL;
1490+
}
1491+
1492+
return ws_llc_discover_temp_entry(&base->temp_entries->active_eapol_temp_neigh, mac64);
1493+
}
1494+
15031495

15041496
static void ws_init_temporary_neigh_data(ws_neighbor_temp_class_t *entry, const uint8_t *mac64)
15051497
{

test/nanostack/unittest/stub/ws_bootstrap_stub.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -136,16 +136,6 @@ bool ws_bootstrap_validate_channel_function(ws_us_ie_t *ws_us, ws_bs_ie_t *ws_bs
136136
return true;
137137
}
138138

139-
struct ws_neighbor_class_entry *ws_bootstrap_eapol_tx_temporary_set(struct protocol_interface_info_entry *interface, const uint8_t *src64)
140-
{
141-
return NULL;
142-
}
143-
144-
void ws_bootstrap_eapol_tx_temporary_clear(struct protocol_interface_info_entry *interface)
145-
{
146-
147-
}
148-
149139
int ws_bootstrap_stack_info_get(protocol_interface_info_entry_t *cur, struct ws_stack_info *info_ptr)
150140
{
151141
return 0;

0 commit comments

Comments
 (0)