include Global RNC-ID in RESET

According to 3GPP TS 25.413 8.26.2.2, "The RNC shall include the Global
RNC-ID IE in the RESET message."

Related: SYS#6441
Change-Id: I2cd5d7ea86a6ed0916befe219dbf21373afbd95b
This commit is contained in:
Neels Hofmeyr 2023-05-11 21:43:18 +02:00
parent d482f8666c
commit 7867adc490
2 changed files with 31 additions and 1 deletions

View File

@ -12,3 +12,4 @@ libosmo-sigtran >=1.7.0 Ensure SCCP CR max payload length of 130 bytes is enfor
Uses osmo_scu_prim_hdr_name_c()
libosmo-mgcp-client > 1.11.0 mgcp_client_pool_empty(), mgcp_client_conf_alloc()
libosmo-sigtran >1.7.0 Require presence of vty 'cs7 instance'/'sccp max-optional-data' that the deprecated+fatal 'hnbgw'/'sccp cr...' tells the user to use instead.
libosmo-ranap >1.4.0 ranap_new_msg_reset2()

View File

@ -25,6 +25,7 @@
#include <osmocom/sigtran/sccp_helpers.h>
#include <asn1c/asn1helpers.h>
#include <osmocom/ranap/ranap_ies_defs.h>
#include <osmocom/ranap/ranap_msg_factory.h>
@ -127,6 +128,9 @@ static void tx_reset(struct hnbgw_cnlink *cnlink)
.present = RANAP_Cause_PR_transmissionNetwork,
.choice. transmissionNetwork = RANAP_CauseTransmissionNetwork_signalling_transport_resource_failure,
};
RANAP_GlobalRNC_ID_t grnc_id;
RANAP_GlobalRNC_ID_t *use_grnc_id = NULL;
uint8_t plmn_buf[3];
if (!cnlink)
return;
@ -144,7 +148,32 @@ static void tx_reset(struct hnbgw_cnlink *cnlink)
cnlink_is_cs(cnlink) ? "IuCS" : "IuPS",
cnlink_sccp_addr_to_str(cnlink, &cnlink->remote_addr));
msg = ranap_new_msg_reset(cnlink->pool->domain, &cause);
if (g_hnbgw->config.plmn.mcc) {
osmo_plmn_to_bcd(plmn_buf, &g_hnbgw->config.plmn);
grnc_id = (RANAP_GlobalRNC_ID_t){
.pLMNidentity = {
.buf = plmn_buf,
.size = 3,
},
.rNC_ID = g_hnbgw->config.rnc_id,
};
use_grnc_id = &grnc_id;
} else {
/* If no PLMN is configured, omit the Global RNC Id from the RESET message.
*
* According to 3GPP TS 25.413 8.26.2.2, "The RNC shall include the Global RNC-ID IE in the RESET
* message", so it should be considered a mandatory IE when coming from us, the RNC.
*
* But osmo-hnbgw < v1.5 worked well with osmo-hnbgw.cfg files that have no PLMN configured, and we are
* trying to stay backwards compatible for those users. Such a site should still work, but they should
* now see these error logs and can adjust the config.
*/
LOG_CNLINK(cnlink, DRANAP, LOGL_ERROR,
"No local PLMN is configured, so outgoing RESET messages omit the mandatory Global RNC-ID"
" IE. You should set a 'hnbgw' / 'plmn' in your config file (since v1.5)\n");
}
msg = ranap_new_msg_reset2(cnlink->pool->domain, &cause, use_grnc_id);
osmo_sccp_tx_unitdata_msg(cnlink->hnbgw_sccp_user->sccp_user,
&cnlink->hnbgw_sccp_user->local_addr,