lapd_core: msgb_trim() the L2 padding from ESTABLISH.ind
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.
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 @@
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 @@
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 @@
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 {