pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/38551?usp=email )
Change subject: WIP: sccp: Send RELRE when CREQ is refused by peer ......................................................................
WIP: sccp: Send RELRE when CREQ is refused by peer
WIP attempt to make sure the peer drops the conn if it refuses to create a new conn, perhaps due to conn already established according to peer state.
Related: SYS#6602 Change-Id: Iea2e6f684a6cdbc978833785704b8cf2cbd4e645 --- M src/sccp_scoc.c 1 file changed, 9 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-sigtran refs/changes/51/38551/1
diff --git a/src/sccp_scoc.c b/src/sccp_scoc.c index 0e1eb34..d14a90e 100644 --- a/src/sccp_scoc.c +++ b/src/sccp_scoc.c @@ -1061,6 +1061,7 @@ struct sccp_connection *conn = fi->priv; struct osmo_scu_prim *prim = NULL; struct xua_msg *xua = NULL; + uint32_t sccp_cause;
switch (event) { case SCOC_E_SCU_N_DISC_REQ: @@ -1081,11 +1082,17 @@ xua = data; /* stop conn timer */ conn_stop_connect_timer(conn); - /* release local res + ref (implicit by going to idle) */ + /* Tx RELRE in case CREQ was refused due to misaligned state + * where peer thinks this conn already exists... (SYS#6602) + * Note: this is a deviation from Figure C.2/Q.714 (sheet 2 of 7) + */ + sccp_cause = xua_msg_get_u32(xua, SUA_IEI_CAUSE); + if (sccp_cause == (SUA_CAUSE_T_REFUSAL | SCCP_REFUSAL_END_USER_FAILURE)) + xua_gen_relre_and_send(conn, SCCP_RELEASE_CAUSE_REMOTE_PROCEDURE_ERROR, NULL); /* N-DISCONNECT.ind to user */ scu_gen_encode_and_send(conn, event, xua, OSMO_SCU_PRIM_N_DISCONNECT, PRIM_OP_INDICATION); - /* below implicitly releases resources + local ref */ + /* below going to idle implicitly releases resources + local ref */ osmo_fsm_inst_state_chg(fi, S_IDLE, 0, 0); break; case SCOC_E_RCOC_RLSD_IND: