aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2013-01-16 21:07:43 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2013-01-16 21:07:43 +0100
commit164ee307b20aca437d941f76fbc2f5c25a2b88ec (patch)
tree065d157ca9a1f5a8007880805c7f2ed25270b013
parent69665f87221d4c88de865bd7fed48f7fea1498e6 (diff)
rsl: Properly parse the RLM cause from the error indication
The code predates the TLV parser and we were parsing the RLM from the wrong offset. In general we were using the length of the TLV which happened to be equal to the T200 indication. After consulting the RLM cuases not every of them should generate a BSC_RLLR_IND_ERR_IND as these are forwarded to the MSC as a SAPI reject right now. TLV parsing now generates this due a bug in the osmo-bts code: abis_rsl.c:1605 (bts=0,trx=0,ts=2,ss=0) SAPI=0 <0000> abis_rsl.c:1547 (bts=0,trx=0,ts=2,ss=0) ERROR INDICATION cause=Fraeme not implemented
-rw-r--r--openbsc/src/libbsc/abis_rsl.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/openbsc/src/libbsc/abis_rsl.c b/openbsc/src/libbsc/abis_rsl.c
index 42dad7fde..03ad8da9c 100644
--- a/openbsc/src/libbsc/abis_rsl.c
+++ b/openbsc/src/libbsc/abis_rsl.c
@@ -1525,16 +1525,26 @@ static int abis_rsl_rx_cchan(struct msgb *msg)
static int rsl_rx_rll_err_ind(struct msgb *msg)
{
+ struct tlv_parsed tp;
struct abis_rsl_rll_hdr *rllh = msgb_l2(msg);
- uint8_t *rlm_cause = rllh->data;
+ uint8_t rlm_cause;
+
+ rsl_tlv_parse(&tp, rllh->data, msgb_l2len(msg) - sizeof(*rllh));
+ if (!TLVP_PRESENT(&tp, RSL_IE_RLM_CAUSE)) {
+ LOGP(DRLL, LOGL_ERROR,
+ "%s ERROR INDICATION without mandantory cause.\n",
+ gsm_lchan_name(msg->lchan));
+ return -1;
+ }
+ rlm_cause = *TLVP_VAL(&tp, RSL_IE_RLM_CAUSE);
LOGP(DRLL, LOGL_ERROR, "%s ERROR INDICATION cause=%s\n",
gsm_lchan_name(msg->lchan),
- rsl_rlm_cause_name(rlm_cause[1]));
+ rsl_rlm_cause_name(rlm_cause));
rll_indication(msg->lchan, rllh->link_id, BSC_RLLR_IND_ERR_IND);
- if (rlm_cause[1] == RLL_CAUSE_T200_EXPIRED) {
+ if (rlm_cause == RLL_CAUSE_T200_EXPIRED) {
osmo_counter_inc(msg->lchan->ts->trx->bts->network->stats.chan.rll_err);
return rsl_rf_chan_release(msg->lchan, 1, SACCH_DEACTIVATE);
}