gprs: Use new msgb->cb[] for storing a pointer to the NS-VC through which it was received
diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h
index 4344bf8..79e77e8 100644
--- a/openbsc/include/openbsc/gsm_data.h
+++ b/openbsc/include/openbsc/gsm_data.h
@@ -79,14 +79,17 @@
 	BTS_GPRS_EGPRS = 2,
 };
 
+struct gprs_nsvc;
 /* the data structure stored in msgb->cb for openbsc apps */
 struct openbsc_msgb_cb {
 	unsigned char *gmmh;
+	struct gprs_nsvc *nsvc;
 	u_int32_t tlli;
 };
 #define OBSC_MSGB_CB(__msgb)	((struct openbsc_msgb_cb *)&((__msgb)->cb[0]))
 #define msgb_tlli(__x)		OBSC_MSGB_CB(__x)->tlli
 #define msgb_gmmh(__x)		OBSC_MSGB_CB(__x)->gmmh
+#define msgb_nsvc(__x)		OBSC_MSGB_CB(__x)->nsvc
 #define msgb_llch(__x)		(__x)->l4h
 
 struct msgb;
diff --git a/openbsc/src/gprs_ns.c b/openbsc/src/gprs_ns.c
index c5166fa..b57de1d 100644
--- a/openbsc/src/gprs_ns.c
+++ b/openbsc/src/gprs_ns.c
@@ -292,9 +292,10 @@
 }
 
 /* Section 9.2.10: receive side */
-static int gprs_ns_rx_unitdata(struct msgb *msg, struct gprs_nsvc *nsvc)
+static int gprs_ns_rx_unitdata(struct msgb *msg)
 {
 	struct gprs_ns_hdr *nsh = (struct gprs_ns_hdr *)msg->l2h;
+	struct gprs_nsvc *nsvc = msgb_nsvc(msg);
 	u_int16_t bvci;
 
 	/* spare octet in data[0] */
@@ -306,9 +307,10 @@
 }
 
 /* Section 9.2.7 */
-static int gprs_ns_rx_status(struct msgb *msg, struct gprs_nsvc *nsvc)
+static int gprs_ns_rx_status(struct msgb *msg)
 {
 	struct gprs_ns_hdr *nsh = (struct gprs_ns_hdr *) msg->l2h;
+	struct gprs_nsvc *nsvc = msgb_nsvc(msg);
 	struct tlv_parsed tp;
 	u_int8_t cause;
 	int rc;
@@ -329,9 +331,10 @@
 }
 
 /* Section 7.3 */
-static int gprs_ns_rx_reset(struct msgb *msg, struct gprs_nsvc *nsvc)
+static int gprs_ns_rx_reset(struct msgb *msg)
 {
 	struct gprs_ns_hdr *nsh = (struct gprs_ns_hdr *) msg->l2h;
+	struct gprs_nsvc *nsvc = msgb_nsvc(msg);
 	struct tlv_parsed tp;
 	u_int8_t *cause;
 	u_int16_t *nsvci, *nsei;
@@ -385,9 +388,10 @@
 			return -EIO;
 		nsvc = nsvc_create(nsi, 0xffff);
 		nsvc->ip.bts_addr = *saddr;
-		rc = gprs_ns_rx_reset(msg, nsvc);
+		rc = gprs_ns_rx_reset(msg);
 		return rc;
 	}
+	msgb_nsvc(msg) = nsvc;
 
 	switch (nsh->pdu_type) {
 	case NS_PDUT_ALIVE:
@@ -404,13 +408,13 @@
 		break;
 	case NS_PDUT_UNITDATA:
 		/* actual user data */
-		rc = gprs_ns_rx_unitdata(msg, nsvc);
+		rc = gprs_ns_rx_unitdata(msg);
 		break;
 	case NS_PDUT_STATUS:
-		rc = gprs_ns_rx_status(msg, nsvc);
+		rc = gprs_ns_rx_status(msg);
 		break;
 	case NS_PDUT_RESET:
-		rc = gprs_ns_rx_reset(msg, nsvc);
+		rc = gprs_ns_rx_reset(msg);
 		break;
 	case NS_PDUT_RESET_ACK:
 		DEBUGP(DGPRS, "NS RESET ACK\n");