aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2016-03-17 11:37:22 +0100
committerHarald Welte <laforge@gnumonks.org>2016-03-17 13:50:31 +0100
commitb2b1112a6e20ad632dcec0d9f1afe1ab80583d2d (patch)
tree2621d3747d848cc7eb85c2e4754ae6f97c1f456c
parentf3ee66207de2859cf4751b44241c0f84cf0999b4 (diff)
Add explicit check for SI2quater index and count
Right now we do not support multiple SI2quater messages, so return error if either index or count is non-zero.
-rw-r--r--src/common/rsl.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/common/rsl.c b/src/common/rsl.c
index a503355d..ecf570c5 100644
--- a/src/common/rsl.c
+++ b/src/common/rsl.c
@@ -298,9 +298,10 @@ static int rsl_rx_bcch_info(struct gsm_bts_trx *trx, struct msgb *msg)
{
struct gsm_bts *bts = trx->bts;
struct tlv_parsed tp;
- uint8_t rsl_si;
+ uint8_t rsl_si, si2q_index, si2q_count;
enum osmo_sysinfo_type osmo_si;
-
+ struct gsm48_system_information_type_2quater *si2q;
+ struct bitvec bv;
rsl_tlv_parse(&tp, msgb_l3(msg), msgb_l3len(msg));
/* 9.3.30 System Info Type */
@@ -327,6 +328,24 @@ static int rsl_rx_bcch_info(struct gsm_bts_trx *trx, struct msgb *msg)
TLVP_VAL(&tp, RSL_IE_FULL_BCCH_INFO), len);
LOGP(DRSL, LOGL_INFO, " Rx RSL BCCH INFO (SI%s)\n",
get_value_string(osmo_sitype_strs, osmo_si));
+
+ if (SYSINFO_TYPE_2quater == osmo_si) {
+ si2q = (struct gsm48_system_information_type_2quater *)
+ bts->si_buf[SYSINFO_TYPE_2quater];
+ bv.data = si2q->rest_octets;
+ bv.data_len = 20;
+ bv.cur_bit = 3;
+ si2q_index = (uint8_t) bitvec_get_uint(&bv, 4);
+ si2q_count = (uint8_t) bitvec_get_uint(&bv, 4);
+ if (si2q_index || si2q_count) {
+ LOGP(DRSL, LOGL_ERROR,
+ " Rx RSL SI2quater witn unsupported "
+ "index %u, count %u\n",
+ si2q_index, si2q_count);
+ return rsl_tx_error_report(trx,
+ RSL_ERR_IE_CONTENT);
+ }
+ }
} else if (TLVP_PRESENT(&tp, RSL_IE_L3_INFO)) {
uint16_t len = TLVP_LEN(&tp, RSL_IE_L3_INFO);
if (len > sizeof(sysinfo_buf_t))