From 3a5f08c221b32381623e50095de2751183e994c4 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Thu, 12 Jan 2012 23:12:28 +0100 Subject: lapdm: Make sure that the msgb_l3len(msg) == length... This code should not play with the internals of the msgb like this, this code got introduced in af48bed55607931307 and is breaking the osmo-bts usecase of forwarding an RSL message. Add a test case that fails without the new code. I would prefer if we could get rid of the manipulating the msgb like this, it is prone to errors like this one. --- src/gsm/lapdm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/gsm') diff --git a/src/gsm/lapdm.c b/src/gsm/lapdm.c index 3d2f3d83..e9ce881b 100644 --- a/src/gsm/lapdm.c +++ b/src/gsm/lapdm.c @@ -792,7 +792,7 @@ static int rslms_rx_rll_est_req(struct msgb *msg, struct lapdm_datalink *dl) /* Remove RLL header from msgb and set length to L3-info */ msgb_pull_l2h(msg); msg->len = length; - msg->tail = msg->data + length; + msg->tail = msg->l3h + length; /* prepare prim */ osmo_prim_init(&dp.oph, 0, PRIM_DL_EST, PRIM_OP_REQUEST, msg); @@ -845,7 +845,7 @@ static int rslms_rx_rll_udata_req(struct msgb *msg, struct lapdm_datalink *dl) /* Remove RLL header from msgb and set length to L3-info */ msgb_pull_l2h(msg); msg->len = length; - msg->tail = msg->data + length; + msg->tail = msg->l3h + length; /* Push L1 + LAPDm header on msgb */ msg->l2h = msgb_push(msg, 4 + !ui_bts); @@ -881,7 +881,7 @@ static int rslms_rx_rll_data_req(struct msgb *msg, struct lapdm_datalink *dl) /* Remove RLL header from msgb and set length to L3-info */ msgb_pull_l2h(msg); msg->len = length; - msg->tail = msg->data + length; + msg->tail = msg->l3h + length; /* prepare prim */ osmo_prim_init(&dp.oph, 0, PRIM_DL_DATA, PRIM_OP_REQUEST, msg); @@ -938,7 +938,7 @@ static int rslms_rx_rll_res_req(struct msgb *msg, struct lapdm_datalink *dl) /* Remove RLL header from msgb and set length to L3-info */ msgb_pull_l2h(msg); msg->len = length; - msg->tail = msg->data + length; + msg->tail = msg->l3h + length; /* prepare prim */ osmo_prim_init(&dp.oph, 0, (msg_type == RSL_MT_RES_REQ) ? PRIM_DL_RES -- cgit v1.2.3