mirror of https://gerrit.osmocom.org/libosmocore
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.
This commit is contained in:
parent
1e4400d26a
commit
087116aca7
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue