From 87a0a25c18e8007025ab889acd1cc9afd11658da Mon Sep 17 00:00:00 2001 From: Vasil Velichkov Date: Tue, 24 Sep 2019 21:27:51 +0300 Subject: [PATCH] M2AP: Align 8 bits in liblte_m2ap_unpack_protocolie_singlecontainer Alignment with more then 8 bits is unusual for APER encoding. It seems clangs uses different packing for the LIBLTE_BIT_MSG_STRUCT struct then gcc and puts more bytes between N_bits and header. typedef struct { uint32 N_bits; uint8 header[LIBLTE_MSG_HEADER_OFFSET]; uint8 msg[LIBLTE_MAX_MSG_SIZE_BITS]; } LIBLTE_BIT_MSG_STRUCT __attribute__((aligned(8))); Fixes a failure in srslte_asn1_m2ap_test when compiled with clang 272: Test command: lib/test/asn1/srslte_asn1_m2ap_test 272: Test timeout computed to be: 1500 272: 03:47:13.189195 [M2AP] [I] M2 Setup Request original message 272: 0000: 00 05 00 37 00 00 03 00 0d 00 08 00 00 f1 10 00 272: 0010: 1a 2d 00 00 0e 40 0a 03 80 65 6e 62 31 61 32 64 272: 0020: 30 00 0f 00 16 00 00 10 00 11 00 00 f1 10 1a 2d 272: 0030: 00 10 27 10 01 02 00 01 02 00 02 272: [m2_setup_request_test][Line 95]: FAIL at (plmn_id[0] & 0x0F) == 0 && (plmn_id[0] & 0xF0) >> 4 == 0 && (plmn_id[1] & 0x0F) == 1 1/1 Test #272: srslte_asn1_m2ap_test ............***Failed 0.00 sec --- lib/src/asn1/liblte_m2ap.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/asn1/liblte_m2ap.cc b/lib/src/asn1/liblte_m2ap.cc index d7f819066..3f955ed83 100644 --- a/lib/src/asn1/liblte_m2ap.cc +++ b/lib/src/asn1/liblte_m2ap.cc @@ -198,7 +198,7 @@ LIBLTE_ERROR_ENUM liblte_m2ap_unpack_protocolie_singlecontainer(uint8_t** // Enum - ie->criticality ie->criticality = (LIBLTE_M2AP_CRITICALITY_ENUM)liblte_bits_2_value(ptr, 2); - liblte_align_up(ptr, 16); + liblte_align_up(ptr, 8); err = LIBLTE_SUCCESS; }