osmith has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-bsc-nat/+/27475 )

Change subject: sccp_sap_up_ran: ignore RAN until MSC is connected
......................................................................

sccp_sap_up_ran: ignore RAN until MSC is connected

Related: SYS#5560
Change-Id: Idf9501412484fa92e8836952609fba7c5443d6c9
---
M include/osmocom/bsc_nat/msc.h
M src/osmo-bsc-nat/bsc_nat_fsm.c
M src/osmo-bsc-nat/msc_fsm.c
3 files changed, 15 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  pespin: Looks good to me, approved
  laforge: Looks good to me, but someone else must approve



diff --git a/include/osmocom/bsc_nat/msc.h b/include/osmocom/bsc_nat/msc.h
index 47b4d13..db42526 100644
--- a/include/osmocom/bsc_nat/msc.h
+++ b/include/osmocom/bsc_nat/msc.h
@@ -36,4 +36,6 @@
 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);
diff --git a/src/osmo-bsc-nat/bsc_nat_fsm.c b/src/osmo-bsc-nat/bsc_nat_fsm.c
index 1d92ba3..ad10ea2 100644
--- a/src/osmo-bsc-nat/bsc_nat_fsm.c
+++ b/src/osmo-bsc-nat/bsc_nat_fsm.c
@@ -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 @@
        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 */
diff --git a/src/osmo-bsc-nat/msc_fsm.c b/src/osmo-bsc-nat/msc_fsm.c
index d8b89c6..e660c57 100644
--- a/src/osmo-bsc-nat/msc_fsm.c
+++ b/src/osmo-bsc-nat/msc_fsm.c
@@ -152,3 +152,8 @@
 {
        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;
+}

--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc-nat/+/27475
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc-nat
Gerrit-Branch: master
Gerrit-Change-Id: Idf9501412484fa92e8836952609fba7c5443d6c9
Gerrit-Change-Number: 27475
Gerrit-PatchSet: 4
Gerrit-Owner: osmith <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: osmith <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>
Gerrit-MessageType: merged

Reply via email to