Skip to content

Commit 45f8519

Browse files
author
Mika Leppänen
committed
On stop (ifdown) stores frame counters regardless of threshold
1 parent 5c2fc55 commit 45f8519

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

source/6LoWPAN/ws/ws_pae_controller.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ static int8_t ws_pae_controller_nw_key_check_and_insert(protocol_interface_info_
109109
static void ws_pae_controller_active_nw_key_clear(nw_key_t *nw_key);
110110
static void ws_pae_controller_active_nw_key_set(protocol_interface_info_entry_t *cur, uint8_t index);
111111
static int8_t ws_pae_controller_gak_from_gtk(uint8_t *gak, uint8_t *gtk, char *network_name);
112+
static void ws_pae_controller_frame_counter_store_and_nw_keys_remove(protocol_interface_info_entry_t *interface_ptr, pae_controller_t *controller, bool use_threshold);
112113
static void ws_pae_controller_nw_key_index_check_and_set(protocol_interface_info_entry_t *interface_ptr, uint8_t index);
113114
static void ws_pae_controller_data_init(pae_controller_t *controller);
114115
static void ws_pae_controller_frame_counter_read(pae_controller_t *controller);
@@ -477,8 +478,15 @@ void ws_pae_controller_nw_keys_remove(protocol_interface_info_entry_t *interface
477478
return;
478479
}
479480

481+
/* Stores frame counters if incremented by threshold and removes network keys from PAE
482+
controller and MAC */
483+
ws_pae_controller_frame_counter_store_and_nw_keys_remove(interface_ptr, controller, true);
484+
}
485+
486+
static void ws_pae_controller_frame_counter_store_and_nw_keys_remove(protocol_interface_info_entry_t *interface_ptr, pae_controller_t *controller, bool use_threshold)
487+
{
480488
/* Checks if frame counters needs to be stored when keys are removed */
481-
ws_pae_controller_frame_counter_store(controller, true);
489+
ws_pae_controller_frame_counter_store(controller, use_threshold);
482490

483491
tr_info("NW keys remove");
484492

@@ -703,8 +711,8 @@ int8_t ws_pae_controller_stop(protocol_interface_info_entry_t *interface_ptr)
703711
return -1;
704712
}
705713

706-
// Removes network keys from PAE controller and MAC
707-
ws_pae_controller_nw_keys_remove(interface_ptr);
714+
// Stores frame counters and removes network keys from PAE controller and MAC
715+
ws_pae_controller_frame_counter_store_and_nw_keys_remove(interface_ptr, controller, false);
708716

709717
// If PAE has been initialized, deletes it
710718
if (controller->pae_delete) {

0 commit comments

Comments
 (0)