aboutsummaryrefslogtreecommitdiffstats
path: root/src/common/l1sap.c
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2019-10-09 04:48:54 +0700
committerlaforge <laforge@osmocom.org>2019-10-09 16:45:48 +0000
commitdf51be63290bc38c4fbe822dbd2550f5074a60e0 (patch)
tree174f6b69787066ce362e02db7a42f4f449a85984 /src/common/l1sap.c
parentd73832bc352c97815b57aeb47dcde42afc854086 (diff)
L1SAP: there can be no DATA.ind primitives on PTCCH/U, reject them
Diffstat (limited to 'src/common/l1sap.c')
-rw-r--r--src/common/l1sap.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index 87ef01bc..2008f0e3 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -1109,11 +1109,20 @@ static int l1sap_ph_data_ind(struct gsm_bts_trx *trx,
DEBUGPGT(DL1P, &g_time, "Rx PH-DATA.ind chan_nr=%s link_id=0x%02x len=%d\n",
rsl_chan_nr_str(chan_nr), link_id, len);
+ /* Actually, there can be no DATA.ind on PTCCH/U (rather RACH.ind instead),
+ * but some BTS models with buggy implementation may still be sending them
+ * to us. Let's keep this for backwards compatibility. */
+ if (L1SAP_IS_CHAN_PDCH(chan_nr) && L1SAP_IS_PTCCH(fn)) {
+ LOGPGT(DL1P, LOGL_NOTICE, &g_time, "There can be no DATA.ind on PTCCH/U. "
+ "This is probably a bug of the BTS model you're using, please fix!\n");
+ return -EINVAL;
+ }
+
if (ts_is_pdch(&trx->ts[tn])) {
lchan = get_lchan_by_chan_nr(trx, chan_nr);
if (!lchan)
LOGPGT(DL1P, LOGL_ERROR, &g_time, "No lchan for chan_nr=%s\n", rsl_chan_nr_str(chan_nr));
- if (lchan && lchan->loopback && !L1SAP_IS_PTCCH(fn)) {
+ if (lchan && lchan->loopback) {
/* we are in loopback mode (for BER testing)
* mode and need to enqeue the frame to be
* returned in downlink */
@@ -1128,21 +1137,14 @@ static int l1sap_ph_data_ind(struct gsm_bts_trx *trx,
/* don't send bad frames to PCU */
if (len == 0)
return -EINVAL;
- if (L1SAP_IS_PTCCH(fn)) {
- pcu_tx_data_ind(&trx->ts[tn], PCU_IF_SAPI_PTCCH, fn,
- trx->arfcn, L1SAP_FN2PTCCHBLOCK(fn),
- data, len, rssi, data_ind->ber10k,
- data_ind->ta_offs_256bits/64,
- data_ind->lqual_cb);
- } else {
- /* drop incomplete UL block */
- if (pr_info != PRES_INFO_BOTH)
- return 0;
- /* PDTCH / PACCH frame handling */
- pcu_tx_data_ind(&trx->ts[tn], PCU_IF_SAPI_PDTCH, fn, trx->arfcn,
- L1SAP_FN2MACBLOCK(fn), data, len, rssi, data_ind->ber10k,
- data_ind->ta_offs_256bits/64, data_ind->lqual_cb);
- }
+ /* drop incomplete UL block */
+ if (pr_info != PRES_INFO_BOTH)
+ return 0;
+
+ /* PDTCH / PACCH frame handling */
+ pcu_tx_data_ind(&trx->ts[tn], PCU_IF_SAPI_PDTCH, fn, trx->arfcn,
+ L1SAP_FN2MACBLOCK(fn), data, len, rssi, data_ind->ber10k,
+ data_ind->ta_offs_256bits/64, data_ind->lqual_cb);
return 0;
}