summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYacine Belkadi2013-04-03 11:42:05 +0200
committerYacine Belkadi2013-05-22 10:53:37 +0200
commit788ef9b8c3584b453f22faf088a028335317f4a9 (patch)
treede230fb10cc4c38e0bd030b2793f9260c6788316
parente981d61d72c4d29f5bac7c7139ab50e98a0e625d (diff)
cesar/cp/beacon: add cp_beacon_process_bmi_eks()
To prepare for next commits, move the code processing the key change bentry into a new function cp_beacon_process_bmi_eks().
-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)