diff options
author | Philipp Maier <pmaier@sysmocom.de> | 2018-08-07 11:31:51 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2018-08-07 15:11:41 +0000 |
commit | 628a05e738b5f37e2fecd544780240e56db54036 (patch) | |
tree | 6f6d89d30b77177980ed5a01c00057dc6f05d32a /src/osmo-bsc/osmo_bsc_sigtran.c | |
parent | bf4e29a7dff6e3b5ce9e4da150b8b1dfce86be83 (diff) |
GSCON: call api of a_reset.c with msc object directly
The API of a_reset.c is currently called with a pointer to struct
reset_ctx. This puts the responsibility of checking the presence of
msc->a.reset_fsm to the caller. It would be much more effective if the
caller would check if msc->a.reset_fsm before dereferencing it.
This also fixes at least one segfault that ocurrs when gscon_timer_cb()
is called but no sccp connection is present yet. Therefore the pointer
to bsc_msc_data would not be populated. This is now detected by
a_reset.c itsself.
- minor code cleanups
- call a_reset.c functions with msc (struct bsc_msc_data)
Change-Id: I0802aaadf0af4e58e41c98999e8c6823838adb61
Related: OS#3447
Diffstat (limited to 'src/osmo-bsc/osmo_bsc_sigtran.c')
-rw-r--r-- | src/osmo-bsc/osmo_bsc_sigtran.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/osmo-bsc/osmo_bsc_sigtran.c b/src/osmo-bsc/osmo_bsc_sigtran.c index b97d51bce..7e5f5f68e 100644 --- a/src/osmo-bsc/osmo_bsc_sigtran.c +++ b/src/osmo-bsc/osmo_bsc_sigtran.c @@ -240,7 +240,7 @@ static int sccp_sap_up(struct osmo_prim_hdr *oph, void *_scu) /* Incoming data is a sign of a vital connection */ conn = get_bsc_conn_by_conn_id(scu_prim->u.data.conn_id); if (conn) { - a_reset_conn_success(conn->sccp.msc->a.reset_fsm); + a_reset_conn_success(conn->sccp.msc); handle_data_from_msc(conn, oph->msg); } break; @@ -284,7 +284,7 @@ enum bsc_con osmo_bsc_sigtran_new_conn(struct gsm_subscriber_connection *conn, s LOGP(DMSC, LOGL_NOTICE, "Initializing resources for new SIGTRAN connection to MSC: %s...\n", osmo_sccp_addr_name(ss7, &msc->a.msc_addr)); - if (a_reset_conn_ready(msc->a.reset_fsm) == false) { + if (a_reset_conn_ready(msc) == false) { LOGP(DMSC, LOGL_ERROR, "MSC is not connected. Dropping.\n"); return BSC_CON_REJECT_NO_LINK; } @@ -314,7 +314,7 @@ int osmo_bsc_sigtran_open_conn(struct gsm_subscriber_connection *conn, struct ms msc = conn->sccp.msc; - if (a_reset_conn_ready(msc->a.reset_fsm) == false) { + if (a_reset_conn_ready(msc) == false) { LOGP(DMSC, LOGL_ERROR, "MSC is not connected. Dropping.\n"); return -EINVAL; } @@ -373,7 +373,7 @@ int osmo_bsc_sigtran_send(struct gsm_subscriber_connection *conn, struct msgb *m } else LOGP(DMSC, LOGL_ERROR, "Tx MSC (message too short)\n"); - if (a_reset_conn_ready(msc->a.reset_fsm) == false) { + if (a_reset_conn_ready(msc) == false) { LOGP(DMSC, LOGL_ERROR, "MSC is not connected. Dropping.\n"); msgb_free(msg); return -EINVAL; @@ -532,9 +532,7 @@ int osmo_bsc_sigtran_init(struct llist_head *mscs) return -EINVAL; /* Start MSC-Reset procedure */ - msc->a.reset_fsm = a_reset_alloc(msc, msc_name, osmo_bsc_sigtran_reset_cb, msc); - if (!msc->a.reset_fsm) - return -EINVAL; + a_reset_alloc(msc, msc_name, osmo_bsc_sigtran_reset_cb); /* If we have detected that the SS7 configuration of the MSC we have just initalized * was incomplete or completely missing, we can not tolerate another incomplete |