aboutsummaryrefslogtreecommitdiffstats
path: root/src/sccp_state.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2013-04-22 18:55:50 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2013-04-22 18:55:50 +0200
commit6553f1b5e9fbdaef85bc17b19f2b1ba30553027d (patch)
treefae0ae4238d368a6e599b99acca9f2b4384a6e7a /src/sccp_state.c
parentc4e5066d1d3e4193bacda1bf516dceb607dfd2c6 (diff)
msc: Create a copy of the message for the forward_only case
We need to create a copy of the messages before we forward it to MSC. This is already done in the other code path.
Diffstat (limited to 'src/sccp_state.c')
-rw-r--r--src/sccp_state.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/sccp_state.c b/src/sccp_state.c
index c2b3834..08211b3 100644
--- a/src/sccp_state.c
+++ b/src/sccp_state.c
@@ -51,6 +51,19 @@ static void handle_local_sccp(struct mtp_link_set *set, struct msgb *inp, struct
static void send_local_rlsd(struct mtp_link_set *set, struct sccp_parse_result *res);
static void update_con_state(struct ss7_application *ss7, int rc, struct sccp_parse_result *result, struct msgb *msg, int from_msc, int sls);
+static void send_direct(struct msc_connection *msc, struct msgb *_msg)
+{
+ struct msgb *msg = msgb_alloc_headroom(4096, 128, "SCCP to MSC");
+ if (!msg) {
+ LOGP(DMSC, LOGL_ERROR, "Failed to alloc MSC msg.\n");
+ return;
+ }
+
+ msg->l2h = msgb_put(msg, msgb_l2len(_msg));
+ memcpy(msg->l2h, _msg->l2h, msgb_l2len(_msg));
+ msc_send_direct(msc, msg);
+}
+
/*
* methods called from the MTP Level3 part
*/
@@ -67,7 +80,7 @@ void app_forward_sccp(struct ss7_application *app, struct msgb *_msg, int sls)
msc = app->route_dst.msc;
if (app->forward_only) {
- msc_send_direct(msc, _msg);
+ send_direct(msc, _msg);
return;
}