diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2012-01-14 21:44:03 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2012-01-14 21:44:03 +0100 |
commit | 7be8c2b686701cf0b71eec0bd083d3b33e9a5c41 (patch) | |
tree | 217cadb3a8a791a7db85e18b24741c9ee19a5227 /src | |
parent | 301f01e938e72423079afe1a1836937053481fd6 (diff) | |
parent | 3a5f08c221b32381623e50095de2751183e994c4 (diff) |
Merge remote-tracking branch 'origin/zecke/lapd-fixes'
Diffstat (limited to 'src')
-rw-r--r-- | src/gsm/lapd_core.c | 10 | ||||
-rw-r--r-- | src/gsm/lapdm.c | 8 |
2 files changed, 13 insertions, 5 deletions
diff --git a/src/gsm/lapd_core.c b/src/gsm/lapd_core.c index b1b5a1ba..fb79a2f0 100644 --- a/src/gsm/lapd_core.c +++ b/src/gsm/lapd_core.c @@ -1731,7 +1731,15 @@ static int lapd_data_req(struct osmo_dlsap_prim *dp, struct lapd_msg_ctx *lctx) struct lapd_datalink *dl = lctx->dl; struct msgb *msg = dp->oph.msg; - LOGP(DLLAPD, LOGL_INFO, "writing message to send-queue\n"); + if (msgb_l3len(msg) == 0) { + LOGP(DLLAPD, LOGL_ERROR, + "writing an empty message is not possible.\n"); + msgb_free(msg); + return -1; + } + + LOGP(DLLAPD, LOGL_INFO, + "writing message to send-queue: l3len: %d\n", msgb_l3len(msg)); /* Write data into the send queue */ msgb_enqueue(&dl->send_queue, msg); 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 |