pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/32314 )
Change subject: sm: Fix swapped endianness in struct gprs_sm_pdp_addr ......................................................................
sm: Fix swapped endianness in struct gprs_sm_pdp_addr
Change-Id: Icd72bbe6d297bc583097c68d3cf86a616fabd36d --- M include/osmocom/gprs/sm/sm_private.h M tests/sm/sm_prim_test.ok 2 files changed, 16 insertions(+), 11 deletions(-)
Approvals: Jenkins Builder: Verified pespin: Looks good to me, approved
diff --git a/include/osmocom/gprs/sm/sm_private.h b/include/osmocom/gprs/sm/sm_private.h index e599759..7630001 100644 --- a/include/osmocom/gprs/sm/sm_private.h +++ b/include/osmocom/gprs/sm/sm_private.h @@ -43,8 +43,12 @@
struct gprs_sm_pdp_addr { #if OSMO_IS_LITTLE_ENDIAN - uint8_t spare:4, - organization:4; /* enum gprs_sm_pdp_addr_org */ + uint8_t organization:4, /* enum gprs_sm_pdp_addr_org */ + spare:4; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ + uint8_t spare:4, organization:4; +#endif uint8_t type; /* osmo_gprs_sm_pdp_addr_{etsi,ietf}_type */ union { /* IPv4 */ @@ -54,14 +58,6 @@ uint8_t addr6[16];
/* IPv4v6 */ -#elif OSMO_IS_BIG_ENDIAN -/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ - uint8_t organization:4, spare:4; - uint8_t type; - union { - uint32_t addr; - uint8_t addr6[16]; -#endif struct { uint32_t addr; uint8_t addr6[16]; diff --git a/tests/sm/sm_prim_test.ok b/tests/sm/sm_prim_test.ok index 82d4a97..fda8573 100644 --- a/tests/sm/sm_prim_test.ok +++ b/tests/sm/sm_prim_test.ok @@ -1,5 +1,5 @@ ==== test_sm_prim_ms() [start] ==== test_sm_prim_gmm_down_cb(): Rx GMMSM-ESTABLISH.request sess_id=0 -test_sm_prim_gmm_down_cb(): Rx GMMSM-UNITDATA.request sess_id=0 SMPDU=[8a 41 06 03 01 00 06 10 21 00 00 00 00 28 04 27 01 00 ] +test_sm_prim_gmm_down_cb(): Rx GMMSM-UNITDATA.request sess_id=0 SMPDU=[8a 41 06 03 01 00 06 01 21 00 00 00 00 28 04 27 01 00 ] test_sm_prim_up_cb(): Rx SMREG-PDP_ACTIVATE.confirm ==== test_sm_prim_ms() [end] ====