aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2012-11-23 21:33:15 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2012-12-01 11:32:47 +0100
commit70ae5d3000edd12aee38497a6f541595a8c7dee8 (patch)
tree397a109e935f59783dc1c9b82b96b93b2463a696
parent6d818839a9febc5d8ff970b16822fe86f551f266 (diff)
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.
-rw-r--r--openbsc/include/openbsc/transaction.h1
-rw-r--r--openbsc/src/libmsc/osmo_msc.c14
-rw-r--r--openbsc/src/libmsc/transaction.c11
3 files changed, 21 insertions, 5 deletions
diff --git a/openbsc/include/openbsc/transaction.h b/openbsc/include/openbsc/transaction.h
index acb2e6c8b..04abb9c41 100644
--- a/openbsc/include/openbsc/transaction.h
+++ b/openbsc/include/openbsc/transaction.h
@@ -72,5 +72,6 @@ void trans_free(struct gsm_trans *trans);
int trans_assign_trans_id(struct gsm_subscriber *subscr,
uint8_t protocol, uint8_t ti_flag);
+int trans_has_conn(const struct gsm_subscriber_connection *conn);
#endif
diff --git a/openbsc/src/libmsc/osmo_msc.c b/openbsc/src/libmsc/osmo_msc.c
index 4dd172b88..90fa56507 100644
--- a/openbsc/src/libmsc/osmo_msc.c
+++ b/openbsc/src/libmsc/osmo_msc.c
@@ -53,7 +53,13 @@ static int msc_compl_l3(struct gsm_subscriber_connection *conn, struct msgb *msg
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 @@ void msc_release_connection(struct gsm_subscriber_connection *conn)
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 8a181b76b..bcfb6af3f 100644
--- a/openbsc/src/libmsc/transaction.c
+++ b/openbsc/src/libmsc/transaction.c
@@ -149,3 +149,14 @@ int trans_assign_trans_id(struct gsm_subscriber *subscr,
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;
+}