diff --git a/openbsc/include/openbsc/osmo_bsc.h b/openbsc/include/openbsc/osmo_bsc.h index 1d68cbe0b..032193e83 100644 --- a/openbsc/include/openbsc/osmo_bsc.h +++ b/openbsc/include/openbsc/osmo_bsc.h @@ -16,15 +16,16 @@ struct osmo_bsc_sccp_con { struct timer_list sccp_it_timeout; struct timer_list sccp_cc_timeout; + struct gsm_subscriber_connection *conn; uint8_t new_subscriber; }; struct bsc_api *osmo_bsc_api(); int bsc_queue_for_msc(struct gsm_subscriber_connection *conn, struct msgb *msg); -int bsc_open_connection(struct gsm_subscriber_connection *conn, struct msgb *msg); +int bsc_open_connection(struct osmo_bsc_sccp_con *sccp, struct msgb *msg); int bsc_create_new_connection(struct gsm_subscriber_connection *conn); -int bsc_delete_connection(struct gsm_subscriber_connection *conn); +int bsc_delete_connection(struct osmo_bsc_sccp_con *sccp); int bsc_scan_bts_msg(struct gsm_subscriber_connection *conn, struct msgb *msg); int bsc_scan_msc_msg(struct gsm_subscriber_connection *conn, struct msgb *msg); diff --git a/openbsc/src/bsc/osmo_bsc_api.c b/openbsc/src/bsc/osmo_bsc_api.c index b8423b27b..8ee857d11 100644 --- a/openbsc/src/bsc/osmo_bsc_api.c +++ b/openbsc/src/bsc/osmo_bsc_api.c @@ -99,12 +99,12 @@ static int bsc_compl_l3(struct gsm_subscriber_connection *conn, struct msgb *msg conn->bts->cell_identity); if (!resp) { LOGP(DMSC, LOGL_DEBUG, "Failed to create layer3 message.\n"); - bsc_delete_connection(conn); + bsc_delete_connection(conn->sccp_con); return BSC_API_CONN_POL_REJECT; } - if (bsc_open_connection(conn, resp) != 0) { - bsc_delete_connection(conn); + if (bsc_open_connection(conn->sccp_con, resp) != 0) { + bsc_delete_connection(conn->sccp_con); msgb_free(resp); return BSC_API_CONN_POL_REJECT; } diff --git a/openbsc/src/bsc/osmo_bsc_sccp.c b/openbsc/src/bsc/osmo_bsc_sccp.c index 620082f80..b1d128b40 100644 --- a/openbsc/src/bsc/osmo_bsc_sccp.c +++ b/openbsc/src/bsc/osmo_bsc_sccp.c @@ -126,29 +126,30 @@ int bsc_create_new_connection(struct gsm_subscriber_connection *conn) bsc_con->sccp = sccp; bsc_con->msc_con = net->msc_data->msc_con; + bsc_con->conn = conn; llist_add(&bsc_con->entry, &active_connections); conn->sccp_con = bsc_con; return 0; } -int bsc_open_connection(struct gsm_subscriber_connection *conn, struct msgb *msg) +int bsc_open_connection(struct osmo_bsc_sccp_con *conn, struct msgb *msg) { LOGP(DMSC, LOGL_ERROR, "Not implemented yet.\n"); return -1; } -int bsc_delete_connection(struct gsm_subscriber_connection *conn) +int bsc_delete_connection(struct osmo_bsc_sccp_con *sccp) { - struct osmo_bsc_sccp_con *sccp = conn->sccp_con; - if (!sccp) return 0; + if (sccp->conn) + LOGP(DMSC, LOGL_ERROR, "Should have been cleared.\n"); + llist_del(&sccp->entry); bsc_del_timer(&sccp->sccp_it_timeout); bsc_del_timer(&sccp->sccp_cc_timeout); talloc_free(sccp); - conn->sccp_con = NULL; return 0; }