gsm48: Separate CM Service Reject sending and creation.
Split out the msg generation from the sending, this will
be used by the nat to send a refusal message.
diff --git a/openbsc/src/gsm_04_08.c b/openbsc/src/gsm_04_08.c
index e3eafe6..21bdfc5 100644
--- a/openbsc/src/gsm_04_08.c
+++ b/openbsc/src/gsm_04_08.c
@@ -709,19 +709,17 @@
static int gsm48_tx_mm_serv_rej(struct gsm_subscriber_connection *conn,
enum gsm48_reject_value value)
{
- struct msgb *msg = gsm48_msgb_alloc();
- struct gsm48_hdr *gh;
+ struct msgb *msg;
- gh = (struct gsm48_hdr *) msgb_put(msg, sizeof(*gh) + 1);
+ msg = gsm48_create_mm_serv_rej(value);
+ if (!msg) {
+ LOGP(DMM, LOGL_ERROR, "Failed to allocate CM Service Reject.\n");
+ return -1;
+ }
+ DEBUGP(DMM, "-> CM SERVICE Reject cause: %d\n", value);
msg->lchan = conn->lchan;
use_subscr_con(conn);
-
- gh->proto_discr = GSM48_PDISC_MM;
- gh->msg_type = GSM48_MT_MM_CM_SERV_REJ;
- gh->data[0] = value;
- DEBUGP(DMM, "-> CM SERVICE Reject cause: %d\n", value);
-
return gsm48_conn_sendmsg(msg, conn, NULL);
}