aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2020-03-08 17:09:29 +0100
committerHarald Welte <laforge@osmocom.org>2020-03-08 17:12:15 +0100
commit6a5039674f3d3253133ada666368b9342cc18a93 (patch)
treebeee1bc8be9df54ce7089b91164980d17007efde
parent3f35ab258d4b715c3429fa47beb801db32652e83 (diff)
l1sap: Use msgb_pull_l2() and unify l1sap_tch_ind + l1sap_ph_data_ind
In l1sap_ph_data_ind() we can use msgb_pull_l2() which is an exact implementation of the functionality there. In l1sap_tch_ind(), the existing code is actually wrong by making the assumption that the msgb contains exactly an entire osmo_phsap_prim. Better to also dynamically compute the number of bytes to ensure we only pull those ahead of the L2 header, no matter what their exact count. Change-Id: I13f7f8ba93795e40b1fb4a306fe765e059f642cf
-rw-r--r--src/common/l1sap.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index 05dbb6f8..673430de 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -1355,8 +1355,7 @@ static int l1sap_ph_data_ind(struct gsm_bts_trx *trx,
l1sap_tx_ciph_req(lchan->ts->trx, chan_nr, 1, 0);
/* SDCCH, SACCH and FACCH all go to LAPDm */
- msgb_pull(msg, (msg->l2h - msg->data));
- msg->l1h = NULL;
+ msgb_pull_to_l2(msg);
lapdm_phsap_up(&l1sap->oph, le);
/* don't free, because we forwarded data */
@@ -1393,7 +1392,7 @@ static int l1sap_tch_ind(struct gsm_bts_trx *trx, struct osmo_phsap_prim *l1sap,
if (gsm_bts_has_feature(trx->bts, BTS_FEAT_MEAS_PAYLOAD_COMB))
process_l1sap_meas_data(trx, l1sap, PRIM_TCH);
- msgb_pull(msg, sizeof(*l1sap));
+ msgb_pull_to_l2(msg);
/* Low level layers always call us when TCH content is expected, even if
* the content is not available due to decoding issues. Content not