sccp_sap_up_ran: ignore RAN until MSC is connected

Related: SYS#5560
Change-Id: Idf9501412484fa92e8836952609fba7c5443d6c9
This commit is contained in:
Oliver Smith 2022-03-11 13:13:08 +01:00
parent 70cd49dcae
commit 1968ca922b
3 changed files with 15 additions and 0 deletions

View File

@ -36,4 +36,6 @@ struct msc *msc_get(void);
void msc_tx_reset(struct msc *msc);
void msc_rx_reset_ack(struct msc *msc);
bool msc_is_connected(struct msc *msc);
void msc_free(struct msc *msc);

View File

@ -29,6 +29,7 @@
#include <osmocom/bsc_nat/bsc_nat_fsm.h>
#include <osmocom/bsc_nat/bssap.h>
#include <osmocom/bsc_nat/logging.h>
#include <osmocom/bsc_nat/msc.h>
#define DEFAULT_PC_RAN "0.23.1" /* same as default for OsmoMSC */
#define DEFAULT_PC_CN "0.23.3" /* same as default for OsmoBSC */
@ -208,10 +209,17 @@ static int sccp_sap_up_ran(struct osmo_prim_hdr *oph, void *scu)
struct osmo_scu_prim *prim = (struct osmo_scu_prim *) oph;
struct osmo_sccp_addr *addr; /* BSC's address */
struct osmo_sccp_addr peer_addr_out;
struct msc *msc;
int rc = -1;
LOGP(DMAIN, LOGL_DEBUG, "Rx %s from RAN\n", osmo_scu_prim_name(oph));
msc = msc_get();
if (!msc_is_connected(msc)) {
LOGP(DMAIN, LOGL_DEBUG, "Ignoring message from RAN, MSC is not connected yet\n");
goto error;
}
switch (OSMO_PRIM_HDR(oph)) {
case OSMO_PRIM(OSMO_SCU_PRIM_N_CONNECT, PRIM_OP_INDICATION):
/* indication of new inbound connection request */

View File

@ -152,3 +152,8 @@ void msc_rx_reset_ack(struct msc *msc)
{
osmo_fsm_inst_dispatch(msc->fi, MSC_FSM_EV_RX_RESET_ACK, NULL);
}
bool msc_is_connected(struct msc *msc)
{
return msc->fi->state == MSC_FSM_ST_CONNECTED;
}