diff options
author | Vadim Yanitskiy <vyanitskiy@sysmocom.de> | 2022-03-13 14:15:22 +0300 |
---|---|---|
committer | Vadim Yanitskiy <vyanitskiy@sysmocom.de> | 2022-03-13 18:20:40 +0300 |
commit | 2902d91d69d2583bc7dd835fe6b389bc1a78dd27 (patch) | |
tree | 9487b5c8c9e3bf37c9515eedf8ef4d7392c733a6 | |
parent | 798a71eb300dfeb4c76e8c3d2973173ae81e1602 (diff) |
gsm48_make_ho_cmd(): optionally add Cipher Mode Setting IE
According to 3GPP TS 44.018, section 9.1.15, the RR Handover Command
message may optionally contain the Cipher Mode Setting IE (10.5.2.9).
Section 9.1.15.10 states that this IE may be omitted in case of the
intra-RAT GERAN-to-GERAN handover, however in case of the inter-RAT
handover (e.g. EUTRAN-to-GERAN), this IE *shall* always be included.
Change-Id: I1d270e82d0a9b12897fc94dae4e8999aa132a22f
Related: SYS#5838
-rw-r--r-- | include/osmocom/bsc/gsm_04_08_rr.h | 3 | ||||
-rw-r--r-- | src/osmo-bsc/gsm_04_08_rr.c | 13 | ||||
-rw-r--r-- | src/osmo-bsc/handover_fsm.c | 1 |
3 files changed, 17 insertions, 0 deletions
diff --git a/include/osmocom/bsc/gsm_04_08_rr.h b/include/osmocom/bsc/gsm_04_08_rr.h index 613787db4..75307d63f 100644 --- a/include/osmocom/bsc/gsm_04_08_rr.h +++ b/include/osmocom/bsc/gsm_04_08_rr.h @@ -3,6 +3,8 @@ #include <stdint.h> #include <osmocom/core/msgb.h> +enum handover_scope; + struct amr_mode; struct amr_multirate_conf; struct bsc_subscr; @@ -25,6 +27,7 @@ int gsm48_multirate_config(struct msgb *msg, const struct gsm48_multi_rate_conf *mr_conf, const struct amr_mode *modes, unsigned int num_modes); struct msgb *gsm48_make_ho_cmd(const struct gsm_lchan *new_lchan, + enum handover_scope ho_scope, uint8_t power_command, uint8_t ho_ref); int gsm48_send_rr_ass_cmd(struct gsm_lchan *dest_lchan, struct gsm_lchan *lchan, uint8_t power_command); int gsm48_send_rr_app_info(struct gsm_lchan *lchan, uint8_t apdu_id, uint8_t apdu_flags, diff --git a/src/osmo-bsc/gsm_04_08_rr.c b/src/osmo-bsc/gsm_04_08_rr.c index 3f11e4893..cf7411866 100644 --- a/src/osmo-bsc/gsm_04_08_rr.c +++ b/src/osmo-bsc/gsm_04_08_rr.c @@ -534,6 +534,7 @@ return_msg: /* Chapter 9.1.15: Handover Command */ struct msgb *gsm48_make_ho_cmd(const struct gsm_lchan *new_lchan, + enum handover_scope ho_scope, uint8_t power_command, uint8_t ho_ref) { struct msgb *msg = gsm48_msgb_alloc_name("GSM 04.08 HO CMD"); @@ -574,6 +575,18 @@ struct msgb *gsm48_make_ho_cmd(const struct gsm_lchan *new_lchan, new_lchan->ts->hopping.ma_data); } + /* (O) Cipher Mode Setting, TV (see 3GPP TS 44.018, 9.1.15.10). + * Omitted in the case of intra-RAT (GERAN-to-GERAN) handover. + * Shall be included in the case of inter-RAT handover. */ + if (ho_scope & HO_INTER_BSC_IN) { + uint8_t cms = 0x00; + /* This formula copied from gsm48_send_rr_ciph_mode() */ + if (new_lchan->encr.alg_id > ALG_A5_NR_TO_RSL(0)) + cms = (new_lchan->encr.alg_id - 2) << 1 | 1; + /* T (4 bit) + V (4 bit), see 3GPP TS 44.018, 10.5.2.9 */ + msgb_v_put(msg, GSM48_IE_CIP_MODE_SET | (cms & 0x0f)); + } + /* in case of multi rate we need to attach a config */ if (gsm48_chan_mode_to_non_vamos(new_lchan->current_ch_mode_rate.chan_mode) == GSM48_CMODE_SPEECH_AMR) { if (put_mr_config_for_ms(msg, &new_lchan->current_mr_conf, diff --git a/src/osmo-bsc/handover_fsm.c b/src/osmo-bsc/handover_fsm.c index e957a968c..b3f78c0c0 100644 --- a/src/osmo-bsc/handover_fsm.c +++ b/src/osmo-bsc/handover_fsm.c @@ -1216,6 +1216,7 @@ static void ho_fsm_wait_rr_ho_detect_onenter(struct osmo_fsm_inst *fi, uint32_t struct handover *ho = &conn->ho; struct msgb *rr_ho_cmd = gsm48_make_ho_cmd(ho->new_lchan, + ho->scope, ho->new_lchan->ms_power, ho->ho_ref); if (!rr_ho_cmd) { |