Project

General

Profile

Bug #3693

gsm_04_08.h: numerous packed structs with sub-byte ints lack the order-swap shims for big endian

Added by neels 28 days ago. Updated 23 days ago.

Status:
In Progress
Priority:
Low
Assignee:
-
Category:
-
Target version:
-
Start date:
11/14/2018
Due date:
% Done:

70%

Spec Reference:

Description

Came to my attention after Ruben reported build failures in http://lists.osmocom.org/pipermail/openbsc/2018-November/012370.html

Many of the packed structs in libosmocore's gsm_04_08.h should have big-endian shims like:

struct mtp_level_3_hdr {
#if OSMO_IS_LITTLE_ENDIAN
        uint8_t ser_ind : 4,
                 spare : 2,
                 ni : 2;
#elif OSMO_IS_BIG_ENDIAN
        uint8_t ni : 2,
                 spare : 2,
                 ser_ind : 4;
#endif
        uint32_t addr;
        uint8_t data[0];
} __attribute__((packed));

In particular, handover_test.c creates a measurement report using struct gsm48_meas_res, and on mips, this measurement report gets decoded to completely wrong values.

with handover_test 28, expecting:

- Sending measurement report from mobile #0 (rxlev=30, rxqual=6)
 * Neighbor cell #0, actual BTS 1 (rxlev=40)
DRSL abis_rsl.c:1538 (bts=0,trx=0,ts=1,ss=0): meas_rep_count++=1 meas_rep_last_seen_nr=0
DMEAS abis_rsl.c:1409 [(bts=0,trx=0,ts=1,ss=0)] MEASUREMENT RESULT NR=0 RXL-FULL-ul=-110dBm RXL-SUB-ul=-110dBm RXQ-FULL-ul=0 RXQ-SUB-ul=0 BS_POWER=0 L1_MS_PWR=-22dBm L1_FPC=0 L1_TA=0 RXL-FULL-dl=-80dBm RXL-SUB-dl=-80dBm RXQ-FULL-dl=6 RXQ-SUB-dl=6 NUM_NEIGH=1
DMEAS abis_rsl.c:1442 IDX=0 ARFCN=871 BSIC=63 => -70 dBm
DHODEC handover_decision_2.c:1131 (lchan 0.010 TCH/F) (subscr unknown) MEASUREMENT REPORT (1 neighbors)
DHODEC handover_decision_2.c:1136 (lchan 0.010 TCH/F) (subscr unknown)   0: arfcn=871 bsic=63 neigh_idx=0 rxlev=40 flags=0
DHODEC handover_decision_2.c:291 (lchan 0.010 TCH/F) (subscr unknown) neigh 871 new in report rxlev=40 last_seen_nr=0

On mips getting:

- Sending measurement report from mobile #0 (rxlev=30, rxqual=6)
 * Neighbor cell #0, actual BTS 1 (rxlev=40)
DRSL abis_rsl.c:1538 (bts=0,trx=0,ts=1,ss=0): meas_rep_count++=1 meas_rep_last_seen_nr=0
DMEAS abis_rsl.c:1409 [(bts=0,trx=0,ts=1,ss=0)] MEASUREMENT RESULT NR=0 RXL-FULL-ul=-110dBm RXL-SUB-ul=-110dBm RXQ-FULL-ul=0 RXQ-SUB-ul=0 BS_POWER=0 L1_MS_PWR=-22dBm L1_FPC=0 L1_TA=0 DTXu NOT VALID NUM_NEIGH=2
DMEAS abis_rsl.c:1442 IDX=28 ARFCN=0 BSIC=0 => -77 dBm
DMEAS abis_rsl.c:1442 IDX=0 ARFCN=871 BSIC=0 => -96 dBm
DHODEC handover_decision_2.c:1131 (lchan 0.010 TCH/F) (subscr unknown) MEASUREMENT REPORT (2 neighbors)
DHODEC handover_decision_2.c:1136 (lchan 0.010 TCH/F) (subscr unknown)   0: arfcn=0 bsic=0 neigh_idx=28 rxlev=33 flags=0
DHODEC handover_decision_2.c:1136 (lchan 0.010 TCH/F) (subscr unknown)   1: arfcn=871 bsic=0 neigh_idx=0 rxlev=14 flags=0
DHODEC handover_decision_2.c:291 (lchan 0.010 TCH/F) (subscr unknown) neigh 0 new in report rxlev=33 last_seen_nr=0
DHODEC handover_decision_2.c:291 (lchan 0.010 TCH/F) (subscr unknown) neigh 871 new in report rxlev=14 last_seen_nr=0

History

#1 Updated by neels 23 days ago

  • Status changed from New to In Progress
  • Priority changed from Normal to Low
  • % Done changed from 0 to 70

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)