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
diff --git a/openbsc/src/libbsc/abis_rsl.c b/openbsc/src/libbsc/abis_rsl.c
index 42dad7f..03ad8da 100644
--- a/openbsc/src/libbsc/abis_rsl.c
+++ b/openbsc/src/libbsc/abis_rsl.c
@@ -1525,16 +1525,26 @@
 
 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);
 	}