bsc_api: Remove the lchan from the USSD code...
diff --git a/openbsc/src/gsm_04_08.c b/openbsc/src/gsm_04_08.c
index 8dece0b..f87406a 100644
--- a/openbsc/src/gsm_04_08.c
+++ b/openbsc/src/gsm_04_08.c
@@ -3113,7 +3113,7 @@
 			"GSM 04.08 discriminator 0x%02x\n", pdisc);
 		break;
 	case GSM48_PDISC_NC_SS:
-		rc = handle_rcv_ussd(msg);
+		rc = handle_rcv_ussd(conn, msg);
 		break;
 	default:
 		LOGP(DRLL, LOGL_NOTICE, "Unknown "
diff --git a/openbsc/src/gsm_04_80.c b/openbsc/src/gsm_04_80.c
index 7d6679b..e5f05f3 100644
--- a/openbsc/src/gsm_04_80.c
+++ b/openbsc/src/gsm_04_80.c
@@ -246,8 +246,9 @@
 }
 
 /* Send response to a mobile-originated ProcessUnstructuredSS-Request */
-int gsm0480_send_ussd_response(const struct msgb *in_msg, const char *response_text,
-						const struct ussd_request *req)
+int gsm0480_send_ussd_response(struct gsm_subscriber_connection *conn,
+			       const struct msgb *in_msg, const char *response_text,
+			       const struct ussd_request *req)
 {
 	struct msgb *msg = gsm48_msgb_alloc();
 	struct gsm48_hdr *gh;
@@ -258,8 +259,6 @@
 	if (((strlen(response_text) * 7) % 8) != 0)
 		response_len += 1;
 
-	msg->lchan = in_msg->lchan;
-
 	/* First put the payload text into the message */
 	ptr8 = msgb_put(msg, response_len);
 	gsm_7bit_encode(ptr8, response_text);
@@ -295,17 +294,16 @@
 					| (1<<7);  /* TI direction = 1 */
 	gh->msg_type = GSM0480_MTYPE_RELEASE_COMPLETE;
 
-	return gsm0808_submit_dtap(&msg->lchan->conn, msg, 0);
+	return gsm0808_submit_dtap(conn, msg, 0);
 }
 
-int gsm0480_send_ussd_reject(const struct msgb *in_msg,
-				const struct ussd_request *req)
+int gsm0480_send_ussd_reject(struct gsm_subscriber_connection *conn,
+			     const struct msgb *in_msg,
+			     const struct ussd_request *req)
 {
 	struct msgb *msg = gsm48_msgb_alloc();
 	struct gsm48_hdr *gh;
 
-	msg->lchan = in_msg->lchan;
-
 	/* First insert the problem code */
 	msgb_push_TLV1(msg, GSM_0480_PROBLEM_CODE_TAG_GENERAL,
 			GSM_0480_GEN_PROB_CODE_UNRECOGNISED);
@@ -325,5 +323,5 @@
 	gh->proto_discr |= req->transaction_id | (1<<7);  /* TI direction = 1 */
 	gh->msg_type = GSM0480_MTYPE_RELEASE_COMPLETE;
 
-	return gsm0808_submit_dtap(&msg->lchan->conn, msg, 0);
+	return gsm0808_submit_dtap(conn, msg, 0);
 }
diff --git a/openbsc/src/ussd.c b/openbsc/src/ussd.c
index 5476919..7f14899 100644
--- a/openbsc/src/ussd.c
+++ b/openbsc/src/ussd.c
@@ -38,11 +38,11 @@
 const char USSD_TEXT_OWN_NUMBER[] = "*#100#";
 
 /* Forward declarations of network-specific handler functions */
-static int send_own_number(const struct msgb *msg, const struct ussd_request *req);
+static int send_own_number(struct gsm_subscriber_connection *conn, const struct msgb *msg, const struct ussd_request *req);
 
 
 /* Entrypoint - handler function common to all mobile-originated USSDs */
-int handle_rcv_ussd(struct msgb *msg)
+int handle_rcv_ussd(struct gsm_subscriber_connection *conn, struct msgb *msg)
 {
 	struct ussd_request req;
 
@@ -52,20 +52,20 @@
 
 	if (strstr(USSD_TEXT_OWN_NUMBER, req.text) != NULL) {
 		DEBUGP(DMM, "USSD: Own number requested\n");
-		return send_own_number(msg, &req);
+		return send_own_number(conn, msg, &req);
 	} else {
 		DEBUGP(DMM, "Unhandled USSD %s\n", req.text);
-		return gsm0480_send_ussd_reject(msg, &req);
+		return gsm0480_send_ussd_reject(conn, msg, &req);
 	}
 }
 
 /* A network-specific handler function */
-static int send_own_number(const struct msgb *msg, const struct ussd_request *req)
+static int send_own_number(struct gsm_subscriber_connection *conn, const struct msgb *msg, const struct ussd_request *req)
 {
-	char *own_number = msg->lchan->conn.subscr->extension;
+	char *own_number = conn->subscr->extension;
 	char response_string[GSM_EXTENSION_LENGTH + 20];
 
 	/* Need trailing CR as EOT character */
 	snprintf(response_string, sizeof(response_string), "Your extension is %s\r", own_number);
-	return gsm0480_send_ussd_response(msg, response_string, req);
+	return gsm0480_send_ussd_response(conn, msg, response_string, req);
 }