summaryrefslogtreecommitdiff
path: root/cesar/bsu/test/utest
diff options
context:
space:
mode:
authorYacine Belkadi2013-04-02 17:19:37 +0200
committerYacine Belkadi2013-05-22 10:53:35 +0200
commitea60421c65baf82304c3b461d8bfb60106b4a404 (patch)
tree3f7396d019f98f6eeb58e8384db1b4ca9c12f562 /cesar/bsu/test/utest
parent7d5605d2370e0bf0ef1227cba9e4f5d7b37e839c (diff)
cesar/{bsu,cp/beacon}: let the bsu clear the previous NEK, refs #3794
After a NEK change, the previous NEK needs to be cleared. This was done by the cp. But: 1) The cp may run long after the NEK change, and may get interrupted. This delays the removal of the old key. 2) The cp only _guesses_ when the NEK change is done (see cp_beacon_countdowns()). If, for some reasons, the guess is wrong because the NEK change didn't happen yet, then the cp will actually clear the new key before it's used. It seems more reliable to let the bsu clear the old key, because the bsu is the one doing the NEK change.
Diffstat (limited to 'cesar/bsu/test/utest')
-rw-r--r--cesar/bsu/test/utest/src/bsut.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/cesar/bsu/test/utest/src/bsut.c b/cesar/bsu/test/utest/src/bsut.c
index 08d2ad206a..6a90df5d57 100644
--- a/cesar/bsu/test/utest/src/bsut.c
+++ b/cesar/bsu/test/utest/src/bsut.c
@@ -897,6 +897,26 @@ test_case_bsu_handle_key_change (test_t test)
test_fail_unless (t.bsu->sta_avln->beacon.bmis.eks.kccd == 1);
}
test_end;
+ test_begin (test, "Delete previous NEK after NEK change");
+ {
+ t.bsu->nek_switch = 0;
+ t.mac_config.nek[0].eks = MAC_EKS_MIN;
+ t.mac_config.nek[1].eks = MAC_EKS_MAX;
+ t.bsu->sta_avln->beacon.bmis.eks.present = true;
+ t.bsu->sta_avln->beacon.bmis.eks.kbc = BSU_BEACON_EKS_KBC_NEK;
+ t.bsu->sta_avln->beacon.bmis.eks.kccd = 1;
+
+ bsu_handle_key_change (t.bsu);
+
+ test_fail_unless (t.mac_config.nek[0].eks == MAC_EKS_MIN);
+ test_fail_unless (t.mac_config.nek[1].eks == MAC_EKS_MAX);
+
+ bsu_handle_key_change (t.bsu);
+
+ test_fail_unless (t.mac_config.nek[0].eks == MAC_EKS_CLEAR);
+ test_fail_unless (t.mac_config.nek[1].eks == MAC_EKS_MAX);
+ }
+ test_end;
bsu_test_uninit (&t);
}