fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/29217 )
Change subject: osmo-bts-trx: fix handling of ciphering params in PRIM_INFO_MODIFY ......................................................................
osmo-bts-trx: fix handling of ciphering params in PRIM_INFO_MODIFY
The PRIM_INFO_MODIFY is sent on receipt of the RSL MODE MODIFY message, which may optionally contain new ciphering parameters. Before this patch, osmo-bts-trx would ignore the new parameters and continue using the old ciphering key/algorithm.
* Modify l1if_set_ciphering() to allow updating ciphering params. * Call l1if_set_ciphering() when handling PRIM_INFO_MODIFY.
This problem was uncovered by BTS_Tests.TC_rsl_modify_encr, which has been failing ever since it was introduced [1]. This patch makes it pass.
Change-Id: I2278703b487374c0de4cfc42b22e70aaf6548589 Related: [1] I4cbea499bb6a331d314e6573548a4540945208b5 osmo-ttcn3-hacks.git Related: OS#3750 --- M src/osmo-bts-trx/l1_if.c 1 file changed, 9 insertions(+), 2 deletions(-)
Approvals: Jenkins Builder: Verified osmith: Looks good to me, but someone else must approve laforge: Looks good to me, approved
diff --git a/src/osmo-bts-trx/l1_if.c b/src/osmo-bts-trx/l1_if.c index 92180b5..8c364c3 100644 --- a/src/osmo-bts-trx/l1_if.c +++ b/src/osmo-bts-trx/l1_if.c @@ -326,8 +326,8 @@ /* enable ciphering */ static int l1if_set_ciphering(struct gsm_lchan *lchan, uint8_t chan_nr, int downlink) { - /* ciphering already enabled in both directions */ - if (lchan->ciph_state == LCHAN_CIPH_RXTX_CONF) + /* ignore the request when the channel is not active */ + if (lchan->state != LCHAN_S_ACTIVE) return -EINVAL;
if (!downlink) { @@ -463,6 +463,13 @@ lchan->tch.amr_mr.mode[3].mode, amr_get_initial_mode(lchan), 0); + /* update ciphering params */ + l1if_set_ciphering(lchan, chan_nr, 0); + l1if_set_ciphering(lchan, chan_nr, 1); + if (lchan->encr.alg_id) + lchan->ciph_state = LCHAN_CIPH_RXTX_CONF; + else + lchan->ciph_state = LCHAN_CIPH_NONE; break; } /* here, type == PRIM_INFO_DEACTIVATE */