From 8a991edd3658555974f32f0a44759878aef67df9 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 18 Mar 2018 21:56:04 +0100 Subject: [PATCH] a_iface: If L3/DTAP returns error in COMPL L3, close SCCP connection It's pretty amazing that we print error messages anrd return error codes, but nobody ever looks at the error code and/or closes the connection. Let's change that. Change-Id: Iec693d8012a7816d1ded8206c2d979ac0546fb6e --- src/libmsc/a_iface.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/libmsc/a_iface.c b/src/libmsc/a_iface.c index fa8c5c33a..2b1baf0fb 100644 --- a/src/libmsc/a_iface.c +++ b/src/libmsc/a_iface.c @@ -535,9 +535,19 @@ static int sccp_sap_up(struct osmo_prim_hdr *oph, void *_scu) LOGP(DBSSAP, LOGL_DEBUG, "N-CONNECT.ind(%u, %s)\n", scu_prim->u.connect.conn_id, msgb_hexdump_l2(oph->msg)); rc = a_sccp_rx_dt(scu, &a_conn_info, oph->msg); - } else + } else { LOGP(DBSSAP, LOGL_DEBUG, "N-CONNECT.ind(%u)\n", scu_prim->u.connect.conn_id); - record_bsc_con(scu, a_conn_info.bsc, scu_prim->u.connect.conn_id); + rc = -ENODATA; + } + + if (rc < 0) { + /* initial message (COMPL L3) caused some error, we didn't allocate + * a subscriber_conn and must close the connection again */ + rc = osmo_sccp_tx_disconn(scu, a_conn_info.conn_id, + &a_conn_info.bsc->msc_addr, + SCCP_RETURN_CAUSE_UNQUALIFIED); + } else + record_bsc_con(scu, a_conn_info.bsc, scu_prim->u.connect.conn_id); } break;