diff options
author | Harald Welte <laforge@gnumonks.org> | 2012-04-19 10:06:00 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2012-04-19 10:06:00 +0200 |
commit | f5a0a439e931113863ac3da54f309b1a9ce42d66 (patch) | |
tree | 921edbd3f8d44238ee6c5e70b0e7dc866187c295 /src/osmo-bts-sysmo/oml.c | |
parent | bf91f06ecaffe311c821c705c98fd3287f343e34 (diff) |
ciphering: Make sure to initialize lchan to no ciphering when activating
The ciphering parameters in L1 are persistent accross MPH
deactivate/activate, so we need to make sure to always initialize them
cleanly at RSL CHAN ACT time. This has the added benefit that we can
also activate channels that have encryption enabled from the very
beginning (required for encrypted handover).
Diffstat (limited to 'src/osmo-bts-sysmo/oml.c')
-rw-r--r-- | src/osmo-bts-sysmo/oml.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/osmo-bts-sysmo/oml.c b/src/osmo-bts-sysmo/oml.c index 5dc9733e..e4dcf338 100644 --- a/src/osmo-bts-sysmo/oml.c +++ b/src/osmo-bts-sysmo/oml.c @@ -678,11 +678,13 @@ 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_set_state(lchan, LCHAN_S_ACT_REQ); + /* set the initial ciphering parameters for both directions */ + l1if_set_ciphering(fl1h, lchan, 0); + l1if_set_ciphering(fl1h, lchan, 1); + lchan_init_lapdm(lchan); return 0; @@ -818,16 +820,13 @@ const enum GsmL1_CipherId_t rsl2l1_ciph[] = { [4] = GsmL1_CipherId_A53, }; -int l1if_enable_ciphering(struct femtol1_hdl *fl1h, +int l1if_set_ciphering(struct femtol1_hdl *fl1h, struct gsm_lchan *lchan, int dir_downlink) { struct msgb *msg = l1p_msgb_alloc(); struct GsmL1_MphConfigReq_t *cfgr; - 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); cfgr->cfgParamId = GsmL1_ConfigParamId_SetCipheringParams; @@ -843,6 +842,12 @@ int l1if_enable_ciphering(struct femtol1_hdl *fl1h, return -EINVAL; cfgr->cfgParams.setCipheringParams.cipherId = rsl2l1_ciph[lchan->encr.alg_id]; + LOGP(DL1C, LOGL_NOTICE, "%s SET_CIPHERING (ALG=%u %s)\n", + gsm_lchan_name(lchan), + cfgr->cfgParams.setCipheringParams.cipherId, + get_value_string(femtobts_dir_names, + cfgr->cfgParams.setCipheringParams.dir)); + memcpy(cfgr->cfgParams.setCipheringParams.u8Kc, lchan->encr.key, lchan->encr.key_len); |