include Global RNC-ID in RESET, cfg: add 'hnbgw' / 'plmn MCC MNC'

Related: SYS#6441
Change-Id: If404c3859acdfba274c719c7cb7d16f97d831a2a
This commit is contained in:
Neels Hofmeyr 2023-05-11 21:43:18 +02:00
parent 29dd6a5feb
commit c0eac0e467
4 changed files with 45 additions and 1 deletions

View File

@ -254,6 +254,7 @@ struct hnbgw {
/*! The UDP port where we receive multiplexed CS user /*! The UDP port where we receive multiplexed CS user
* plane traffic from HNBs */ * plane traffic from HNBs */
uint16_t iuh_cs_mux_port; uint16_t iuh_cs_mux_port;
struct osmo_plmn_id plmn;
uint16_t rnc_id; uint16_t rnc_id;
bool hnbap_allow_tmsi; bool hnbap_allow_tmsi;
/*! print hnb-id (true) or MCC-MNC-LAC-RAC-SAC (false) in logs */ /*! print hnb-id (true) or MCC-MNC-LAC-RAC-SAC (false) in logs */

View File

@ -25,6 +25,7 @@
#include <osmocom/sigtran/sccp_helpers.h> #include <osmocom/sigtran/sccp_helpers.h>
#include <asn1c/asn1helpers.h>
#include <osmocom/ranap/ranap_ies_defs.h> #include <osmocom/ranap/ranap_ies_defs.h>
#include <osmocom/ranap/ranap_msg_factory.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, .present = RANAP_Cause_PR_transmissionNetwork,
.choice. transmissionNetwork = RANAP_CauseTransmissionNetwork_signalling_transport_resource_failure, .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) if (!cnlink)
return; return;
@ -140,7 +144,20 @@ static void tx_reset(struct hnbgw_cnlink *cnlink)
cnlink_is_cs(cnlink) ? "IuCS" : "IuPS", cnlink_is_cs(cnlink) ? "IuCS" : "IuPS",
osmo_sccp_inst_addr_name(cnlink->hnbgw_sccp_inst->sccp, &cnlink->remote_addr)); osmo_sccp_inst_addr_name(cnlink->hnbgw_sccp_inst->sccp, &cnlink->remote_addr));
msg = ranap_new_msg_reset(cnlink->pool->domain, &cause); /* If no PLMN is configured, omit the Global RNC Id from the RESET message */
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;
}
msg = ranap_new_msg_reset2(cnlink->pool->domain, &cause, use_grnc_id);
osmo_sccp_tx_unitdata_msg(cnlink->hnbgw_sccp_inst->sccp_user, osmo_sccp_tx_unitdata_msg(cnlink->hnbgw_sccp_inst->sccp_user,
&cnlink->local_addr, &cnlink->local_addr,

View File

@ -57,6 +57,9 @@ void g_hnbgw_alloc(void *ctx)
g_hnbgw->config.iuh_local_port = IUH_DEFAULT_SCTP_PORT; g_hnbgw->config.iuh_local_port = IUH_DEFAULT_SCTP_PORT;
g_hnbgw->config.log_prefix_hnb_id = true; g_hnbgw->config.log_prefix_hnb_id = true;
/* Set zero PLMN to detect a missing PLMN when transmitting RESET */
g_hnbgw->config.plmn = (struct osmo_plmn_id){ 0, 0, false };
g_hnbgw->next_ue_ctx_id = 23; g_hnbgw->next_ue_ctx_id = 23;
INIT_LLIST_HEAD(&g_hnbgw->hnb_list); INIT_LLIST_HEAD(&g_hnbgw->hnb_list);
INIT_LLIST_HEAD(&g_hnbgw->ue_list); INIT_LLIST_HEAD(&g_hnbgw->ue_list);

View File

@ -281,6 +281,28 @@ DEFUN(show_talloc, show_talloc_cmd, "show talloc", SHOW_STR "Display talloc info
return CMD_SUCCESS; return CMD_SUCCESS;
} }
DEFUN(cfg_hnbgw_plmn, cfg_hnbgw_plmn_cmd,
"plmn <1-999> <0-999>",
"Configure the HNBGW's PLMN. The PLMN is transmitted in RANAP RESET towards the CN.\n"
"MCC, Mobile Country Code\n"
"MNC, Mobile Network Code\n")
{
struct osmo_plmn_id plmn;
if (osmo_mcc_from_str(argv[0], &plmn.mcc)) {
vty_out(vty, "%% Error decoding MCC: %s%s", argv[0], VTY_NEWLINE);
return CMD_WARNING;
}
if (osmo_mnc_from_str(argv[1], &plmn.mnc, &plmn.mnc_3_digits)) {
vty_out(vty, "%% Error decoding MNC: %s%s", argv[1], VTY_NEWLINE);
return CMD_WARNING;
}
g_hnbgw->config.plmn = plmn;
return CMD_SUCCESS;
}
DEFUN(cfg_hnbgw_rnc_id, cfg_hnbgw_rnc_id_cmd, DEFUN(cfg_hnbgw_rnc_id, cfg_hnbgw_rnc_id_cmd,
"rnc-id <0-65535>", "rnc-id <0-65535>",
"Configure the HNBGW's RNC Id, the common RNC Id used for all connected hNodeB. It is sent to" "Configure the HNBGW's RNC Id, the common RNC Id used for all connected hNodeB. It is sent to"
@ -950,6 +972,7 @@ void hnbgw_vty_init(void)
install_element(CONFIG_NODE, &cfg_hnbgw_cmd); install_element(CONFIG_NODE, &cfg_hnbgw_cmd);
install_node(&hnbgw_node, config_write_hnbgw); install_node(&hnbgw_node, config_write_hnbgw);
install_element(HNBGW_NODE, &cfg_hnbgw_plmn_cmd);
install_element(HNBGW_NODE, &cfg_hnbgw_rnc_id_cmd); install_element(HNBGW_NODE, &cfg_hnbgw_rnc_id_cmd);
install_element(HNBGW_NODE, &cfg_hnbgw_log_prefix_cmd); install_element(HNBGW_NODE, &cfg_hnbgw_log_prefix_cmd);
install_element(HNBGW_NODE, &cfg_hnbgw_max_sccp_cr_payload_len_cmd); install_element(HNBGW_NODE, &cfg_hnbgw_max_sccp_cr_payload_len_cmd);