nitb: Release the channel if there is nothing on it
This is more a work around and one still needs to implement a
proper dispatch on the opening of the connection. If there is no
operation left, no transaction and no silent call, close down the
channel.
diff --git a/openbsc/src/libmsc/osmo_msc.c b/openbsc/src/libmsc/osmo_msc.c
index 4dd172b..90fa565 100644
--- a/openbsc/src/libmsc/osmo_msc.c
+++ b/openbsc/src/libmsc/osmo_msc.c
@@ -53,7 +53,13 @@
gsm0408_dispatch(conn, msg);
/* TODO: do better */
- return BSC_API_CONN_POL_ACCEPT;
+ if (conn->silent_call)
+ return BSC_API_CONN_POL_ACCEPT;
+ if (conn->loc_operation || conn->sec_operation || conn->anch_operation)
+ return BSC_API_CONN_POL_ACCEPT;
+ if (trans_has_conn(conn))
+ return BSC_API_CONN_POL_ACCEPT;
+ return BSC_API_CONN_POL_REJECT;
}
static void msc_dtap(struct gsm_subscriber_connection *conn, uint8_t link_id, struct msgb *msg)
@@ -162,10 +168,8 @@
if (conn->loc_operation || conn->sec_operation || conn->anch_operation)
return;
- llist_for_each_entry(trans, &conn->bts->network->trans_list, entry) {
- if (trans->conn == conn)
- return;
- }
+ if (trans_has_conn(conn))
+ return;
/* no more connections, asking to release the channel */
conn->in_release = 1;
diff --git a/openbsc/src/libmsc/transaction.c b/openbsc/src/libmsc/transaction.c
index 8a181b7..bcfb6af 100644
--- a/openbsc/src/libmsc/transaction.c
+++ b/openbsc/src/libmsc/transaction.c
@@ -149,3 +149,14 @@
return -1;
}
+
+int trans_has_conn(const struct gsm_subscriber_connection *conn)
+{
+ struct gsm_trans *trans;
+
+ llist_for_each_entry(trans, &conn->bts->network->trans_list, entry)
+ if (trans->conn == conn)
+ return 1;
+
+ return 0;
+}