From f3405e5b0342362d5d592f013014847a4dc135d8 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Mon, 16 Jun 2014 21:51:36 +0200 Subject: sysmobts: Add a hot-fix to avoid dumping -1 amount of data --- src/sysmo_l1_if.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/sysmo_l1_if.c b/src/sysmo_l1_if.c index b03fad0e..4274e77f 100644 --- a/src/sysmo_l1_if.c +++ b/src/sysmo_l1_if.c @@ -168,17 +168,28 @@ static int handle_ph_data_ind(struct femtol1_hdl *fl1h, { int rc = 0; - gsmtap_send(fl1h->gsmtap, data_ind->u16Arfcn | GSMTAP_ARFCN_F_UPLINK, - data_ind->u8Tn, GSMTAP_CHANNEL_PACCH, 0, - data_ind->u32Fn, 0, 0, data_ind->msgUnitParam.u8Buffer+1, - data_ind->msgUnitParam.u8Size-1); - DEBUGP(DL1IF, "Rx PH-DATA.ind %s (hL2 %08x): %s", get_value_string(femtobts_l1sapi_names, data_ind->sapi), data_ind->hLayer2, osmo_hexdump(data_ind->msgUnitParam.u8Buffer, data_ind->msgUnitParam.u8Size)); + /* + * TODO: Add proper bad frame handling here. This could be used + * to switch the used CS. Avoid a crash with the PCU right now + * feed "0 - 1" amount of data. + */ + if (data_ind->msgUnitParam.u8Size == 0) + return -1; + + gsmtap_send(fl1h->gsmtap, data_ind->u16Arfcn | GSMTAP_ARFCN_F_UPLINK, + data_ind->u8Tn, GSMTAP_CHANNEL_PACCH, 0, + data_ind->u32Fn, 0, 0, data_ind->msgUnitParam.u8Buffer+1, + data_ind->msgUnitParam.u8Size-1); + + + + switch (data_ind->sapi) { case GsmL1_Sapi_Pdtch: case GsmL1_Sapi_Pacch: -- cgit v1.2.3