Hoernchen has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmocom-bb/+/29879 )


Change subject: Revert "mobile/gsm48_rr.c: fix ACCH System Information parsing"
......................................................................

Revert "mobile/gsm48_rr.c: fix ACCH System Information parsing"

This reverts commit 1a8a80aeae4c2e5c870ae5b032d9a6ae60b67ac8.

We currently get ALL SI messages wrong - the protocol disseminator is
accidentally being used as SI msg type, and
6=radio resources management - but 6 is also type=si5ter.. so all SI we
receive end up being parsed as SI5, what a coincidence!

Change-Id: I3822f74295920680a935f3031c642ba00162d09d
---
M src/host/layer23/src/mobile/gsm48_rr.c
1 file changed, 15 insertions(+), 11 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/79/29879/1

diff --git a/src/host/layer23/src/mobile/gsm48_rr.c 
b/src/host/layer23/src/mobile/gsm48_rr.c
index be9a7e1..fa11001 100644
--- a/src/host/layer23/src/mobile/gsm48_rr.c
+++ b/src/host/layer23/src/mobile/gsm48_rr.c
@@ -1945,9 +1945,10 @@
 /* receive "SYSTEM INFORMATION 5" message (9.1.37) */
 static int gsm48_rr_rx_sysinfo5(struct osmocom_ms *ms, struct msgb *msg)
 {
-       struct gsm48_system_information_type_5 *si = msgb_l3(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_sysinfo *s = ms->cellsel.si;
-       int payload_len = msgb_l3len(msg) - sizeof(*si);
+       int payload_len = msgb_l3len(msg) - sizeof(*si) - 1;

        if (!s) {
                LOGP(DRR, LOGL_INFO, "No cell selected, SYSTEM INFORMATION 5 "
@@ -1974,9 +1975,10 @@
 /* receive "SYSTEM INFORMATION 5bis" message (9.1.38) */
 static int gsm48_rr_rx_sysinfo5bis(struct osmocom_ms *ms, struct msgb *msg)
 {
-       struct gsm48_system_information_type_5bis *si = msgb_l3(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_sysinfo *s = ms->cellsel.si;
-       int payload_len = msgb_l3len(msg) - sizeof(*si);
+       int payload_len = msgb_l3len(msg) - sizeof(*si) - 1;

        if (!s) {
                LOGP(DRR, LOGL_INFO, "No cell selected, SYSTEM INFORMATION 5bis"
@@ -2004,9 +2006,10 @@
 /* receive "SYSTEM INFORMATION 5ter" message (9.1.39) */
 static int gsm48_rr_rx_sysinfo5ter(struct osmocom_ms *ms, struct msgb *msg)
 {
-       struct gsm48_system_information_type_5ter *si = msgb_l3(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_sysinfo *s = ms->cellsel.si;
-       int payload_len = msgb_l3len(msg) - sizeof(*si);
+       int payload_len = msgb_l3len(msg) - sizeof(*si) - 1;

        if (!s) {
                LOGP(DRR, LOGL_INFO, "No cell selected, SYSTEM INFORMATION 5ter"
@@ -2034,10 +2037,11 @@
 /* receive "SYSTEM INFORMATION 6" message (9.1.39) */
 static int gsm48_rr_rx_sysinfo6(struct osmocom_ms *ms, struct msgb *msg)
 {
-       struct gsm48_system_information_type_6 *si = msgb_l3(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_sysinfo *s = ms->cellsel.si;
        struct rx_meas_stat *meas = &ms->meas;
-       int payload_len = msgb_l3len(msg) - sizeof(*si);
+       int payload_len = msgb_l3len(msg) - sizeof(*si) - 1;

        if (!s) {
                LOGP(DRR, LOGL_INFO, "No cell selected, SYSTEM INFORMATION 6 "
@@ -4754,7 +4758,7 @@
        struct gsm48_rrlayer *rr = &ms->rrlayer;
        struct gsm_settings *set = &ms->settings;
        struct abis_rsl_rll_hdr *rllh = msgb_l2(msg);
-       struct gsm48_hdr *sih = msgb_l3(msg);
+       struct gsm48_system_information_type_header *sih = msgb_l3(msg);
        uint8_t ind_ta, ind_tx_power;

        if (msgb_l2len(msg) < sizeof(*rllh) + 2 + 2) {
@@ -4778,7 +4782,7 @@
                rr->cd_now.ind_tx_power = ind_tx_power;
        }

-       switch (sih->msg_type) {
+       switch (sih->system_information) {
        case GSM48_MT_RR_SYSINFO_5:
                return gsm48_rr_rx_sysinfo5(ms, msg);
        case GSM48_MT_RR_SYSINFO_5bis:
@@ -4789,7 +4793,7 @@
                return gsm48_rr_rx_sysinfo6(ms, msg);
        default:
                LOGP(DRR, LOGL_NOTICE, "ACCH message type 0x%02x unknown.\n",
-                       sih->msg_type);
+                       sih->system_information);
                return -EINVAL;
        }
 }

--
To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/29879
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: I3822f74295920680a935f3031c642ba00162d09d
Gerrit-Change-Number: 29879
Gerrit-PatchSet: 1
Gerrit-Owner: Hoernchen <ew...@sysmocom.de>
Gerrit-MessageType: newchange

Reply via email to