From b0b76af0c3a2d54f07c7492184fa036da977c08f Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Wed, 14 Apr 2021 17:14:07 +0200 Subject: [PATCH] SRVCC: Parse Last Used E-UTRAN PLMN Id in Handover Request Whenever SRVCC EUTRAN->GERAN is performed by the CN, it will set the Last Used E-UTRAN PLMN Id in order for the BSS to inform the MS about EUTRAN neighbors once the call is over. The last part (sending EUTRAN neighs) is already implemented, since same thing is done as per CSFB. However, we lacked the first part, where the EUTRAN PLMN Id is recorded for later use. Actually, in both cases, we end up building the list of neighbors without taking into accound the PLMN value (hence no filtering of configured neighs), but it only sends such a list if any PLMN was stored there, which means this patch is still necessary for a quick fallback to 4G after the call is over. Related: SYS#5337 Depends: libosmocore.git Change-Id I0e55e947b6fef6dad0cf1a6c16b781bef4cc76c5 Change-Id: Ia5008f11a4c36ef8085a2037d4abddd131086e6e --- TODO-RELEASE | 1 + include/osmocom/bsc/gsm_data.h | 2 ++ src/osmo-bsc/handover_fsm.c | 36 ++++++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+) diff --git a/TODO-RELEASE b/TODO-RELEASE index 1a72401a7..de9e62cca 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -8,3 +8,4 @@ # If any interfaces have been removed or changed since the last public release: c:r:0. #library what description / commit summary line libosmocore >1.5.1 needs osmo_bts_features_name(), osmo_bts_features_desc() +libosmogsm >1.5.1 enum entry GSM0808_FE_IE_LAST_USED_EUTRAN_PLMN_ID diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h index 448098b9b..0bc881bf9 100644 --- a/include/osmocom/bsc/gsm_data.h +++ b/include/osmocom/bsc/gsm_data.h @@ -202,6 +202,8 @@ struct handover_in_req { uint16_t msc_assigned_cic; char msc_assigned_rtp_addr[INET6_ADDRSTRLEN]; uint16_t msc_assigned_rtp_port; + bool last_eutran_plmn_valid; + struct osmo_plmn_id last_eutran_plmn; }; struct handover { diff --git a/src/osmo-bsc/handover_fsm.c b/src/osmo-bsc/handover_fsm.c index f6dad9d0f..53cafed06 100644 --- a/src/osmo-bsc/handover_fsm.c +++ b/src/osmo-bsc/handover_fsm.c @@ -417,6 +417,32 @@ static void handover_start_intra_bsc(struct gsm_subscriber_connection *conn) lchan_activate(ho->new_lchan, &info); } +/* 3GPP TS 48.008 § 3.2.2.58 Old BSS to New BSS Information */ +static void parse_old2new_bss_info(struct gsm_subscriber_connection *conn, + const uint8_t* data, uint16_t len, + struct handover_in_req *req) +{ + /* § 3.2.2.58: Information contained here shall take precedence over + duplicate information from Information Elements in the HANDOVER + REQUEST as long as the coding is understood by the new BSS */ + /* § 3.2.2.58: <>. See also 3.1.19.7. */ + struct tlv_parsed tp; + if (tlv_parse(&tp, &gsm0808_old_bss_to_new_bss_info_att_tlvdef, data, len, 0, 0) <= 0) { + LOG_HO(conn, LOGL_NOTICE, "Failed to parse IE \"Old BSS to New BSS information\"\n"); + return; + } + + if (TLVP_VAL(&tp, GSM0808_FE_IE_LAST_USED_EUTRAN_PLMN_ID)) { + req->last_eutran_plmn_valid = true; + osmo_plmn_from_bcd(TLVP_VAL(&tp, GSM0808_FE_IE_LAST_USED_EUTRAN_PLMN_ID), + &req->last_eutran_plmn); + } +} + /* 3GPP TS 48.008 § 3.2.1.8 Handover Request */ static bool parse_ho_request(struct gsm_subscriber_connection *conn, const struct msgb *msg, struct handover_in_req *req) @@ -557,6 +583,10 @@ static bool parse_ho_request(struct gsm_subscriber_connection *conn, const struc return false; } + if ((e = TLVP_GET(tp, GSM0808_IE_OLD_BSS_TO_NEW_BSS_INFORMATION))) { + parse_old2new_bss_info(conn, e->val, e->len, req); + } + /* A lot of IEs remain ignored... */ return true; @@ -691,6 +721,12 @@ void handover_start_inter_bsc_in(struct gsm_subscriber_connection *conn, info.encr.key_len = req->ei.key_len; } + if (req->last_eutran_plmn_valid) { + conn->last_eutran_plmn_valid = true; + memcpy(&conn->last_eutran_plmn, &req->last_eutran_plmn, + sizeof(conn->last_eutran_plmn)); + } + lchan_activate(ho->new_lchan, &info); }