aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bts-sysmo/oml.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2012-04-19 09:35:03 +0200
committerHarald Welte <laforge@gnumonks.org>2012-04-19 09:35:03 +0200
commitb03f8ae4f05b16997c3db5ed9454672a0d18e679 (patch)
tree6cb7c72d105387906241088fc52ef8f7c6179e33 /src/osmo-bts-sysmo/oml.c
parentd9ab45d1aac21c761c461659e2179d1077b5b7a5 (diff)
ciphering: Better state tracking and HACK around L1 race condition
We now check if the received message is an LAPDm I frame in order to determine if we have received the first valid encrypted message on the radio link. This relates to the fact that we often see 'old' UI frames coming up from L1, even after it has confirmed decryption has been enabled.
Diffstat (limited to 'src/osmo-bts-sysmo/oml.c')
-rw-r--r--src/osmo-bts-sysmo/oml.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/osmo-bts-sysmo/oml.c b/src/osmo-bts-sysmo/oml.c
index 00c088cd..bb5b9a9a 100644
--- a/src/osmo-bts-sysmo/oml.c
+++ b/src/osmo-bts-sysmo/oml.c
@@ -660,6 +660,8 @@ int lchan_activate(struct gsm_lchan *lchan)
/* send the primitive for all GsmL1_Sapi_* that match the LCHAN */
l1if_req_compl(fl1h, msg, 0, lchan_act_compl_cb, lchan);
+ /* FIXME: check if encryption parameters are present, and issue
+ * MPH-CONFIG.req */
}
lchan->state = LCHAN_S_ACT_REQ;
@@ -728,6 +730,20 @@ static int chmod_modif_compl_cb(struct msgb *l1_msg, void *data)
case GsmL1_ConfigParamId_SetNbTsc:
case GsmL1_ConfigParamId_SetTxPowerLevel:
case GsmL1_ConfigParamId_SetCipheringParams:
+ switch (lchan->ciph_state) {
+ case LCHAN_CIPH_RX_REQ:
+ LOGPC(DL1C, LOGL_INFO, "RX_REQ -> RX_CONF\n");
+ lchan->ciph_state = LCHAN_CIPH_RX_CONF;
+ break;
+ case LCHAN_CIPH_TXRX_REQ:
+ LOGPC(DL1C, LOGL_INFO, "TX_REQ -> TX_CONF\n");
+ lchan->ciph_state = LCHAN_CIPH_TXRX_CONF;
+ break;
+ default:
+ LOGPC(DL1C, LOGL_INFO, "unhandled state %u\n", lchan->ciph_state);
+ break;
+ }
+ break;
default:
LOGPC(DL1C, LOGL_INFO, "\n");
break;
@@ -791,7 +807,7 @@ int l1if_enable_ciphering(struct femtol1_hdl *fl1h,
struct msgb *msg = l1p_msgb_alloc();
struct GsmL1_MphConfigReq_t *cfgr;
- LOGP(DL1C, LOGL_DEBUG, "%s enable_ciphering(dir_downlink=%u)\n",
+ LOGP(DL1C, LOGL_NOTICE, "%s enable_ciphering(dir_downlink=%u)\n",
gsm_lchan_name(lchan), dir_downlink);
cfgr = prim_init(msgb_l1prim(msg), GsmL1_PrimId_MphConfigReq, fl1h);
@@ -893,6 +909,7 @@ int lchan_deactivate(struct gsm_lchan *lchan)
}
lchan->state = LCHAN_S_ACT_REQ;
+ lchan->ciph_state = 0; /* FIXME: do this in common/\*.c */
return 0;
}