msc: Add net parameter to trans_alloc

The trans_alloc function still uses the subscr object to access the
network object.

This patch adds an explicit net parameter to this function and
removes the access to subscr to obtain it.

Sponsored-by: On-Waves ehf
diff --git a/openbsc/include/openbsc/transaction.h b/openbsc/include/openbsc/transaction.h
index 795b9cd..82891b8 100644
--- a/openbsc/include/openbsc/transaction.h
+++ b/openbsc/include/openbsc/transaction.h
@@ -66,7 +66,8 @@
 struct gsm_trans *trans_find_by_callref(struct gsm_network *net,
 					uint32_t callref);
 
-struct gsm_trans *trans_alloc(struct gsm_subscriber *subscr,
+struct gsm_trans *trans_alloc(struct gsm_network *net,
+			      struct gsm_subscriber *subscr,
 			      uint8_t protocol, uint8_t trans_id,
 			      uint32_t callref);
 void trans_free(struct gsm_trans *trans);
diff --git a/openbsc/src/libmsc/gsm_04_08.c b/openbsc/src/libmsc/gsm_04_08.c
index ede6db3..ac1e916 100644
--- a/openbsc/src/libmsc/gsm_04_08.c
+++ b/openbsc/src/libmsc/gsm_04_08.c
@@ -3078,7 +3078,7 @@
 						GSM48_CC_CAUSE_DEST_OOO);
 		}
 		/* Create transaction */
-		trans = trans_alloc(subscr, GSM48_PDISC_CC, 0xff, data->callref);
+		trans = trans_alloc(net, subscr, GSM48_PDISC_CC, 0xff, data->callref);
 		if (!trans) {
 			DEBUGP(DCC, "No memory for trans.\n");
 			subscr_put(subscr);
@@ -3262,7 +3262,8 @@
 		DEBUGP(DCC, "Unknown transaction ID %x, "
 			"creating new trans.\n", transaction_id);
 		/* Create transaction */
-		trans = trans_alloc(conn->subscr, GSM48_PDISC_CC,
+		trans = trans_alloc(conn->bts->network, conn->subscr,
+				    GSM48_PDISC_CC,
 				    transaction_id, new_callref++);
 		if (!trans) {
 			DEBUGP(DCC, "No memory for trans.\n");
diff --git a/openbsc/src/libmsc/gsm_04_11.c b/openbsc/src/libmsc/gsm_04_11.c
index bc9d59e..9941e6b 100644
--- a/openbsc/src/libmsc/gsm_04_11.c
+++ b/openbsc/src/libmsc/gsm_04_11.c
@@ -765,7 +765,8 @@
 
 	if (!trans) {
 		DEBUGP(DLSMS, " -> (new transaction)\n");
-		trans = trans_alloc(conn->subscr, GSM48_PDISC_SMS,
+		trans = trans_alloc(conn->bts->network, conn->subscr,
+				    GSM48_PDISC_SMS,
 				    transaction_id, new_callref++);
 		if (!trans) {
 			DEBUGP(DLSMS, " -> No memory for trans\n");
@@ -838,7 +839,8 @@
 	DEBUGP(DLSMS, "send_sms_lchan()\n");
 
 	/* FIXME: allocate transaction with message reference */
-	trans = trans_alloc(conn->subscr, GSM48_PDISC_SMS,
+	trans = trans_alloc(conn->bts->network, conn->subscr,
+			    GSM48_PDISC_SMS,
 			    transaction_id, new_callref++);
 	if (!trans) {
 		LOGP(DLSMS, LOGL_ERROR, "No memory for trans\n");
diff --git a/openbsc/src/libmsc/transaction.c b/openbsc/src/libmsc/transaction.c
index 5621067..2101ae9 100644
--- a/openbsc/src/libmsc/transaction.c
+++ b/openbsc/src/libmsc/transaction.c
@@ -61,12 +61,12 @@
 	return NULL;
 }
 
-struct gsm_trans *trans_alloc(struct gsm_subscriber *subscr,
+struct gsm_trans *trans_alloc(struct gsm_network *net,
+			      struct gsm_subscriber *subscr,
 			      uint8_t protocol, uint8_t trans_id,
 			      uint32_t callref)
 {
 	struct gsm_trans *trans;
-	struct gsm_network *net = subscr->group->net;
 
 	DEBUGP(DCC, "subscr=%p, net=%p\n", subscr, net);