aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/osmocom/msc/gsm_data.h3
-rw-r--r--include/osmocom/msc/transaction.h3
-rw-r--r--src/libmsc/a_iface.c5
-rw-r--r--src/libmsc/a_iface_bssap.c2
-rw-r--r--src/libmsc/gsm_04_08.c3
-rw-r--r--src/libmsc/gsm_04_11.c4
6 files changed, 16 insertions, 4 deletions
diff --git a/include/osmocom/msc/gsm_data.h b/include/osmocom/msc/gsm_data.h
index f3e1b94b1..6f0aca4b1 100644
--- a/include/osmocom/msc/gsm_data.h
+++ b/include/osmocom/msc/gsm_data.h
@@ -20,7 +20,8 @@
#include "gsm_data_shared.h"
-
+/* TS 48.008 DLCI containing DCCH/ACCH + SAPI */
+#define OMSC_LINKID_CB(__msgb) (__msgb)->cb[3]
/** annotations for msgb ownership */
#define __uses
diff --git a/include/osmocom/msc/transaction.h b/include/osmocom/msc/transaction.h
index 272fb3b2e..63b1cc519 100644
--- a/include/osmocom/msc/transaction.h
+++ b/include/osmocom/msc/transaction.h
@@ -31,6 +31,9 @@ struct gsm_trans {
/* The current transaction ID */
uint8_t transaction_id;
+ /* The DLCI (DCCH/ACCH + SAPI) of this transaction */
+ uint8_t dlci;
+
/* To whom we belong, unique identifier of remote MM entity */
struct vlr_subscr *vsub;
diff --git a/src/libmsc/a_iface.c b/src/libmsc/a_iface.c
index 2b1baf0fb..6f2000e00 100644
--- a/src/libmsc/a_iface.c
+++ b/src/libmsc/a_iface.c
@@ -145,14 +145,13 @@ int a_iface_tx_dtap(struct msgb *msg)
struct gsm_subscriber_connection *conn;
struct msgb *msg_resp;
- /* FIXME: Set this to some meaninful value! */
- uint8_t link_id = 0x00;
+ uint8_t link_id = OMSC_LINKID_CB(msg);
OSMO_ASSERT(msg);
conn = (struct gsm_subscriber_connection *)msg->dst;
OSMO_ASSERT(conn);
OSMO_ASSERT(conn->a.scu);
- LOGPCONN(conn, LOGL_DEBUG, "Passing DTAP message from MSC to BSC\n");
+ LOGPCONN(conn, LOGL_DEBUG, "Passing DTAP message (DLCI=0x%02x) from MSC to BSC\n", link_id);
msg->l3h = msg->data;
msg_resp = gsm0808_create_dtap(msg, link_id);
diff --git a/src/libmsc/a_iface_bssap.c b/src/libmsc/a_iface_bssap.c
index 1665e2307..d0d6bc03e 100644
--- a/src/libmsc/a_iface_bssap.c
+++ b/src/libmsc/a_iface_bssap.c
@@ -610,6 +610,7 @@ static int rx_dtap(const struct osmo_sccp_user *scu, const struct a_conn_info *a
{
struct gsm_network *network = a_conn_info->network;
struct gsm_subscriber_connection *conn;
+ struct dtap_header *dtap = (struct dtap_header *) msg->l2h;
conn = subscr_conn_lookup_a(network, a_conn_info->conn_id);
if (!conn) {
@@ -620,6 +621,7 @@ static int rx_dtap(const struct osmo_sccp_user *scu, const struct a_conn_info *a
/* msc_dtap expects the dtap payload in l3h */
msg->l3h = msg->l2h + 3;
+ OMSC_LINKID_CB(msg) = dtap->link_id;
/* Forward dtap payload into the msc */
msc_dtap(conn, conn->a.conn_id, msg);
diff --git a/src/libmsc/gsm_04_08.c b/src/libmsc/gsm_04_08.c
index a90ff172f..e5ddb44d4 100644
--- a/src/libmsc/gsm_04_08.c
+++ b/src/libmsc/gsm_04_08.c
@@ -164,6 +164,7 @@ static int gsm48_conn_sendmsg(struct msgb *msg, struct gsm_subscriber_connection
* work that the caller no longer has to do */
if (trans) {
gh->proto_discr = trans->protocol | (trans->transaction_id << 4);
+ OMSC_LINKID_CB(msg) = trans->dlci;
}
return msc_tx_dtap(conn, msg);
@@ -3110,6 +3111,7 @@ int mncc_tx_to_cc(struct gsm_network *net, int msg_type, void *arg)
/* Assign conn */
trans->conn = msc_subscr_conn_get(conn, MSC_CONN_USE_TRANS_CC);
+ trans->dlci = 0x00; /* SAPI=0, not SACCH */
vlr_subscr_put(vsub);
} else {
/* update the subscriber we deal with */
@@ -3262,6 +3264,7 @@ static int gsm0408_rcv_cc(struct gsm_subscriber_connection *conn, struct msgb *m
}
/* Assign transaction */
trans->conn = msc_subscr_conn_get(conn, MSC_CONN_USE_TRANS_CC);
+ trans->dlci = OMSC_LINKID_CB(msg); /* DLCI as received from BSC */
cm_service_request_concludes(conn, msg);
}
diff --git a/src/libmsc/gsm_04_11.c b/src/libmsc/gsm_04_11.c
index f82aa6d55..aa6049002 100644
--- a/src/libmsc/gsm_04_11.c
+++ b/src/libmsc/gsm_04_11.c
@@ -137,6 +137,7 @@ static int gsm411_cp_sendmsg(struct msgb *msg, struct gsm_trans *trans,
/* Outgoing needs the highest bit set */
gh->proto_discr = trans->protocol | (trans->transaction_id<<4);
gh->msg_type = msg_type;
+ OMSC_LINKID_CB(msg) = trans->dlci;
DEBUGP(DLSMS, "sending CP message (trans=%x)\n", trans->transaction_id);
@@ -947,6 +948,7 @@ int gsm0411_rcv_sms(struct gsm_subscriber_connection *conn,
gsm411_rl_recv, gsm411_mn_send);
trans->conn = msc_subscr_conn_get(conn, MSC_CONN_USE_TRANS_SMS);
+ trans->dlci = OMSC_LINKID_CB(msg); /* DLCI as received from BSC */
new_trans = 1;
cm_service_request_concludes(conn, msg);
@@ -1029,6 +1031,8 @@ int gsm411_send_sms(struct gsm_subscriber_connection *conn, struct gsm_sms *sms)
trans->sms.sms = sms;
trans->conn = msc_subscr_conn_get(conn, MSC_CONN_USE_TRANS_SMS);
+ trans->dlci = 0x03;
+ /* FIXME: specify SACCH in case we already have active TCH */
/* Hardcode SMSC Originating Address for now */
data = (uint8_t *)msgb_put(msg, 8);