From 42ed1bf15d4659a3691f428c10faffcc975d8a5f Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Mon, 30 Oct 2023 17:21:54 +0100 Subject: [PATCH] sccp_scoc: Fix remote PC not assigned preventing RSLD to be sent in st WAIT_CONN_CONF Scenario: RUA Connect triggers SCCP CR towards peer, and we move to CONN_PEND_OUT state where we expect to receive CC. However, if some timer (like X31) times out before we receive CC (eg because CC takes a long time to come), we end up in state WAIT_CONN_CONF. In that state, according to Figure C.2/Q.714 (sheet 2 of 7), among other possibilite we wait for CC, and if it arrives, we send an RLSD to the peer to inform him that we released the conn, and wait for the peer to ack the RLSD, then release all state. Given the scenario above, scoc_fsm_wait_conn_conf() was not assigning the received OPC from the CC to the conn->remote_pc (unlike scoc_fsm_conn_pend_out() which does it properly). As a result, when trying to send teh RLSD it would fail and never transmit RLSD, taking then a long time to release through T(rel) (10-20 seconds), and probably longer in the peer (T(iar) or similar?). Rua Connect triggers tx of SCCP CC: Received SCCP User Primitive (N-CONNECT.request) XUA_AS(as-clnt-msc-0)[0x55f11c7df980]{AS_ACTIVE}: Received Event AS-TRANSFER.req //Tx CC SCCP-SCOC(929)[0x55f11c909c90]{IDLE}: State change to CONN_PEND_OUT (no timeout) ... X31 timeout triggers state change: map_sccp(...-SCCP-929)[0x55f11c909820]{wait_cc}: Timeout of X31 SCCP-SCOC(929)[0x55f11c909c90]{CONN_PEND_OUT}: Received Event N-DISCONNECT.req SCCP-SCOC(929)[0x55f11c909c90]{CONN_PEND_OUT}: State change to WAIT_CONN_CONF (no timeout) ... CC arrives, but conn_remote_pc is not properly assigned and tx of RLSD fails: SCCP-SCOC(929)[0x55f11c909c90]{WAIT_CONN_CONF}: Received Event RCOC-CONNECT_CONFIRM.ind MTP-TRANSFER.req from SCCP without DPC?!? called=RI=0 // PROBLEM HERE!!!! SCCP-SCOC(929)[0x55f11c909c90]{WAIT_CONN_CONF}: State change to DISCONN_PEND (no timeout) ... SCCP-SCOC(929)[0x55f11c909c90]{DISCONN_PEND}: Received Event T(rel)_expired Related: SYS#6616 Change-Id: I9f9f78c92dd95f38af7b03037e60a1c993d7e5b0 --- src/sccp_scoc.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/sccp_scoc.c b/src/sccp_scoc.c index e273d174..0e1eb342 100644 --- a/src/sccp_scoc.c +++ b/src/sccp_scoc.c @@ -1160,6 +1160,13 @@ static void scoc_fsm_wait_conn_conf(struct osmo_fsm_inst *fi, uint32_t event, vo conn_stop_connect_timer(conn); /* associate rem ref to conn */ conn->remote_ref = xua_msg_get_u32(xua, SUA_IEI_SRC_REF); + /* 3.1.4.2 The node sending the CC message (identified + * by the parameter OPC contained in the + * MTP-TRANSFER.indication primitive which conveyed the + * CC message [plus the MTP-SAP instance]) is associated + * with the connection section. */ + conn->remote_pc = xua->mtp.opc; + /* released to SCRC */ xua_gen_relre_and_send(conn, conn->release_cause, NULL); /* start rel timer */