summaryrefslogtreecommitdiff
path: root/cesar/cp/beacon/src/beacon.c
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/cp/beacon/src/beacon.c')
-rw-r--r--cesar/cp/beacon/src/beacon.c44
1 files changed, 30 insertions, 14 deletions
diff --git a/cesar/cp/beacon/src/beacon.c b/cesar/cp/beacon/src/beacon.c
index afdf81d046..f509711638 100644
--- a/cesar/cp/beacon/src/beacon.c
+++ b/cesar/cp/beacon/src/beacon.c
@@ -577,6 +577,34 @@ cp_beacon_poweron_init (cp_t *ctx)
}
/**
+ * Process the key change part of the beacon.
+ * \param ctx cp context.
+ * \param beacon The beacon to process.
+ */
+static void
+cp_beacon_process_bmi_eks (cp_t *ctx, const bsu_beacon_t *beacon)
+{
+ /* This only runs on a Sta. The CCo, being the origin of the change, doesn't
+ * need to process a beacon to know about it and react. */
+ dbg_assert (!cp_sta_own_data_get_cco_status (ctx));
+
+ if (beacon->bmis.eks.present)
+ {
+ if ((beacon->bmis.eks.kbc == BSU_BEACON_EKS_KBC_NEK)
+ && (ctx->mac_config->nek[bsu_nek_index_next (ctx->bsu)].eks
+ != beacon->bmis.eks.new_eks))
+ {
+ /* We don't have the new NEK. We need to ask for it. */
+ cp_fsm_post_new_event (ctx, bare, nek_request);
+ }
+
+ ctx->beacon.eks.kccd = beacon->bmis.eks.kccd;
+ ctx->beacon.eks.kbc = beacon->bmis.eks.kbc;
+ ctx->beacon.eks.new_eks = beacon->bmis.eks.new_eks;
+ }
+}
+
+/**
* Process the first beacon in the received list.
* \param ctx the control plane context.
*/
@@ -663,21 +691,9 @@ cp_beacon_process_beacon_central (
beacon->bmis.handover.hcd;
ctx->beacon.hoip.cco = beacon->bmis.handover.tei;
}
- if (beacon->bmis.eks.present)
- {
- if ((beacon->bmis.eks.kbc == BSU_BEACON_EKS_KBC_NEK) &&
- (ctx->mac_config->nek[bsu_nek_index_next (ctx->bsu)].eks !=
- beacon->bmis.eks.new_eks))
- {
- /* POST the FSM event. */
- cp_fsm_post_new_event (ctx, bare, nek_request);
- }
- ctx->beacon.eks.kccd = beacon->bmis.eks.kccd;
- ctx->beacon.eks.kbc = beacon->bmis.eks.kbc;
- ctx->beacon.eks.new_eks =
- beacon->bmis.eks.new_eks;
- }
+ cp_beacon_process_bmi_eks (ctx, beacon);
+
/** Update the schedules. */
cp_beacon_sta_compute_schedules (ctx, beacon);
if (CONFIG_CP_AV)