diff options
author | Vadim Yanitskiy <vyanitskiy@sysmocom.de> | 2022-08-27 18:45:05 +0700 |
---|---|---|
committer | Vadim Yanitskiy <vyanitskiy@sysmocom.de> | 2022-08-27 18:56:33 +0700 |
commit | 52da5b6f6474183bb399f6de7d731335bb050041 (patch) | |
tree | c33cc05a1b079d63e2907e85654ce4130b808132 | |
parent | 755546028ee8dd76eb567d04cf35fcc7950acca7 (diff) |
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
-rw-r--r-- | src/osmo-bts-trx/l1_if.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/osmo-bts-trx/l1_if.c b/src/osmo-bts-trx/l1_if.c index 92180b57..8c364c3c 100644 --- a/src/osmo-bts-trx/l1_if.c +++ b/src/osmo-bts-trx/l1_if.c @@ -326,8 +326,8 @@ static uint8_t trx_set_ts(struct gsm_bts_trx_ts *ts) /* 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 @@ int bts_model_l1sap_down(struct gsm_bts_trx *trx, struct osmo_phsap_prim *l1sap) 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 */ |