aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2013-06-18 21:41:34 +0200
committerHarald Welte <laforge@gnumonks.org>2013-06-18 21:41:34 +0200
commit087116aca771ae3cd2dcbcbd8cb63a91dfc75f20 (patch)
treea3e8fcb7e592dae243ae11e8585adca9a2526af4
parent1e4400d26a7e3a947a1d6235e7d0615506311860 (diff)
lapd_core: msgb_trim() the L2 padding from ESTABLISH.ind0.6.1
When a SABM(E) frame arrives, we have to trim the L2 padding (0x2b for gsm) before handing the data off to L3, just like we do with I frames. Also, we should use mggb_trim() or even msgb_l3trim() instead of manually fiddling with msgb->length and ->tail pointers.
-rw-r--r--src/gsm/lapd_core.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/gsm/lapd_core.c b/src/gsm/lapd_core.c
index 9dbdfcf..116e311 100644
--- a/src/gsm/lapd_core.c
+++ b/src/gsm/lapd_core.c
@@ -899,6 +899,7 @@ static int lapd_rx_u(struct msgb *msg, struct lapd_msg_ctx *lctx)
msgb_free(msg);
} else {
/* 5.4.1.4 Contention resolution establishment */
+ msgb_trim(msg, length);
rc = send_dl_l3(prim, op, lctx, msg);
}
break;
@@ -1016,6 +1017,7 @@ static int lapd_rx_u(struct msgb *msg, struct lapd_msg_ctx *lctx)
msgb_free(msg);
return 0;
}
+ msgb_trim(msg, length);
rc = send_dl_l3(PRIM_DL_UNIT_DATA, PRIM_OP_INDICATION, lctx,
msg);
break;
@@ -1545,8 +1547,7 @@ static int lapd_rx_i(struct msgb *msg, struct lapd_msg_ctx *lctx)
if (!lctx->more && !dl->rcv_buffer) {
LOGP(DLLAPD, LOGL_INFO, "message in single I frame\n");
/* send a DATA INDICATION to L3 */
- msg->len = length;
- msg->tail = msg->data + length;
+ msgb_trim(msg, length);
rc = send_dl_l3(PRIM_DL_DATA, PRIM_OP_INDICATION, lctx,
msg);
} else {