Structure alignment problems in PCUIFv9 and PCUIFv10

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Vadim Yanitskiy vyanitskiy at sysmocom.de
Fri Sep 18 17:52:17 UTC 2020


Hi all,

we seem to have problems with structure alignment in the new version of
the PCUIF protocol:

  PCUIFv9:  sizeof(struct gsm_pcu_if) ->  212;  212 % 4 == 0
  PCUIFv10: sizeof(struct gsm_pcu_if) -> 1006; 1006 % 4 != 0

I think we would need to add/remove some padding.  The question is
whether we should make sure that all structures are aligned, or having
the top level struct gsm_pcu_if aligned would be enough?

Even in PCUIFv9 not all structures are properly aligned:

  sizeof(struct gsm_pcu_if_data_cnf_dt) -> 21; 21 % 4 -> 1,
  sizeof(struct gsm_pcu_if_rts_req)     -> 13; 13 % 4 -> 1,
  sizeof(struct gsm_pcu_if_rach_ind)    -> 15; 15 % 4 -> 3,
  sizeof(struct gsm_pcu_if_pag_req)     -> 11; 11 % 4 -> 3,
  sizeof(struct gsm_pcu_if_susp_req)    -> 11; 11 % 4 -> 3.

I devise by 4 because the widest member is uint32_t in all cases.

Kind regards,
Vadim.

-- 
- Vadim Yanitskiy <vyanitskiy at sysmocom.de>    http://www.sysmocom.de/
=======================================================================
* sysmocom - systems for mobile communications GmbH
* Alt-Moabit 93
* 10559 Berlin, Germany
* Sitz / Registered office: Berlin, HRB 134158 B
* Geschaeftsfuehrer / Managing Director: Harald Welte




More information about the OpenBSC mailing list