summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2017-12-06 03:36:48 +0700
committerHarald Welte <laforge@gnumonks.org>2017-12-13 10:22:16 +0000
commit1a8a80aeae4c2e5c870ae5b032d9a6ae60b67ac8 (patch)
tree5ed729d20172f4c7dd6ddd5577ac10a5c129700e
parent2cac7e8ceffc8e7d4667b2f9f7477364b80716d0 (diff)
mobile/gsm48_rr.c: fix ACCH System Information parsing
According to GSM 04.08, the System Information messages, such as SI5, SI5ter, SI5bis and SI6 (described in sections 9.1.37-40), have no the 'L2 Pseudo Length' (10.5.2.19) field, unlike others. So, previously the ACCH SI messages were ignored due to an implementation error - the gsm48_system_information_type_header struct isn't applicable here, because it assumes the 'l2_plen'. Since there is no (yet?) equivalent struct for the ACCH SI, this change replaces the wrong struct by the 'gsm48_hdr', which satisfies described requirements. Moreover, this change cleans up some gsm48_rr_rx_sysinfo* functions, getting rid of meaningless pionter shifting. Change-Id: I9166996f146af7973bf02a8a1c965581dc58a4a5
-rw-r--r--src/host/layer23/src/mobile/gsm48_rr.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/src/host/layer23/src/mobile/gsm48_rr.c b/src/host/layer23/src/mobile/gsm48_rr.c
index ac27214..403e32d 100644
--- a/src/host/layer23/src/mobile/gsm48_rr.c
+++ b/src/host/layer23/src/mobile/gsm48_rr.c
@@ -1943,10 +1943,9 @@ static int gsm48_rr_rx_sysinfo4(struct osmocom_ms *ms, struct msgb *msg)
/* receive "SYSTEM INFORMATION 5" message (9.1.37) */
static int gsm48_rr_rx_sysinfo5(struct osmocom_ms *ms, struct msgb *msg)
{
- /* NOTE: pseudo length is not in this structure, so we skip */
- struct gsm48_system_information_type_5 *si = msgb_l3(msg) + 1;
+ struct gsm48_system_information_type_5 *si = msgb_l3(msg);
struct gsm48_sysinfo *s = ms->cellsel.si;
- int payload_len = msgb_l3len(msg) - sizeof(*si) - 1;
+ int payload_len = msgb_l3len(msg) - sizeof(*si);
if (!s) {
LOGP(DRR, LOGL_INFO, "No cell selected, SYSTEM INFORMATION 5 "
@@ -1973,10 +1972,9 @@ static int gsm48_rr_rx_sysinfo5(struct osmocom_ms *ms, struct msgb *msg)
/* receive "SYSTEM INFORMATION 5bis" message (9.1.38) */
static int gsm48_rr_rx_sysinfo5bis(struct osmocom_ms *ms, struct msgb *msg)
{
- /* NOTE: pseudo length is not in this structure, so we skip */
- struct gsm48_system_information_type_5bis *si = msgb_l3(msg) + 1;
+ struct gsm48_system_information_type_5bis *si = msgb_l3(msg);
struct gsm48_sysinfo *s = ms->cellsel.si;
- int payload_len = msgb_l3len(msg) - sizeof(*si) - 1;
+ int payload_len = msgb_l3len(msg) - sizeof(*si);
if (!s) {
LOGP(DRR, LOGL_INFO, "No cell selected, SYSTEM INFORMATION 5bis"
@@ -2004,10 +2002,9 @@ static int gsm48_rr_rx_sysinfo5bis(struct osmocom_ms *ms, struct msgb *msg)
/* receive "SYSTEM INFORMATION 5ter" message (9.1.39) */
static int gsm48_rr_rx_sysinfo5ter(struct osmocom_ms *ms, struct msgb *msg)
{
- /* NOTE: pseudo length is not in this structure, so we skip */
- struct gsm48_system_information_type_5ter *si = msgb_l3(msg) + 1;
+ struct gsm48_system_information_type_5ter *si = msgb_l3(msg);
struct gsm48_sysinfo *s = ms->cellsel.si;
- int payload_len = msgb_l3len(msg) - sizeof(*si) - 1;
+ int payload_len = msgb_l3len(msg) - sizeof(*si);
if (!s) {
LOGP(DRR, LOGL_INFO, "No cell selected, SYSTEM INFORMATION 5ter"
@@ -2035,11 +2032,10 @@ static int gsm48_rr_rx_sysinfo5ter(struct osmocom_ms *ms, struct msgb *msg)
/* receive "SYSTEM INFORMATION 6" message (9.1.39) */
static int gsm48_rr_rx_sysinfo6(struct osmocom_ms *ms, struct msgb *msg)
{
- /* NOTE: pseudo length is not in this structure, so we skip */
- struct gsm48_system_information_type_6 *si = msgb_l3(msg) + 1;
+ struct gsm48_system_information_type_6 *si = msgb_l3(msg);
struct gsm48_sysinfo *s = ms->cellsel.si;
struct rx_meas_stat *meas = &ms->meas;
- int payload_len = msgb_l3len(msg) - sizeof(*si) - 1;
+ int payload_len = msgb_l3len(msg) - sizeof(*si);
if (!s) {
LOGP(DRR, LOGL_INFO, "No cell selected, SYSTEM INFORMATION 6 "
@@ -4748,7 +4744,7 @@ static int gsm48_rr_rx_acch(struct osmocom_ms *ms, struct msgb *msg)
struct gsm48_rrlayer *rr = &ms->rrlayer;
struct gsm_settings *set = &ms->settings;
struct abis_rsl_rll_hdr *rllh = msgb_l2(msg);
- struct gsm48_system_information_type_header *sih = msgb_l3(msg);
+ struct gsm48_hdr *sih = msgb_l3(msg);
uint8_t ind_ta, ind_tx_power;
if (msgb_l2len(msg) < sizeof(*rllh) + 2 + 2) {
@@ -4772,7 +4768,7 @@ static int gsm48_rr_rx_acch(struct osmocom_ms *ms, struct msgb *msg)
rr->cd_now.ind_tx_power = ind_tx_power;
}
- switch (sih->system_information) {
+ switch (sih->msg_type) {
case GSM48_MT_RR_SYSINFO_5:
return gsm48_rr_rx_sysinfo5(ms, msg);
case GSM48_MT_RR_SYSINFO_5bis:
@@ -4783,7 +4779,7 @@ static int gsm48_rr_rx_acch(struct osmocom_ms *ms, struct msgb *msg)
return gsm48_rr_rx_sysinfo6(ms, msg);
default:
LOGP(DRR, LOGL_NOTICE, "ACCH message type 0x%02x unknown.\n",
- sih->system_information);
+ sih->msg_type);
return -EINVAL;
}
}