diff --git a/lib/src/asn1/liblte_s1ap.cc b/lib/src/asn1/liblte_s1ap.cc index 68481438a..056d27f2a 100644 --- a/lib/src/asn1/liblte_s1ap.cc +++ b/lib/src/asn1/liblte_s1ap.cc @@ -14469,7 +14469,7 @@ LIBLTE_ERROR_ENUM liblte_s1ap_pack_servedgummeis( } // Length liblte_value_2_bits(ie->len-1, ptr, 3); - liblte_align_up_zero(ptr, 8); + // liblte_align_up_zero(ptr, 8); uint32_t i; for(i=0;ilen;i++) { if(liblte_s1ap_pack_servedgummeisitem(&ie->buffer[i], ptr) != LIBLTE_SUCCESS) { @@ -14492,7 +14492,7 @@ LIBLTE_ERROR_ENUM liblte_s1ap_unpack_servedgummeis( { // Length ie->len = liblte_bits_2_value(ptr, 3) + 1; - liblte_align_up(ptr, 8); + // liblte_align_up(ptr, 8); if(ie->len > 32) { liblte_log_print("ServedGUMMEIs unpack error - max supported dynamic sequence length = 32, ie->len = %d\n", ie->len); return LIBLTE_ERROR_DECODE_FAIL; diff --git a/lib/test/asn1/CMakeLists.txt b/lib/test/asn1/CMakeLists.txt index fc1e6b325..885329bd4 100644 --- a/lib/test/asn1/CMakeLists.txt +++ b/lib/test/asn1/CMakeLists.txt @@ -18,6 +18,10 @@ # and at http://www.gnu.org/licenses/. # +add_executable(s1ap_test s1ap_test.cc) +target_link_libraries(s1ap_test srslte_common srslte_asn1) +add_test(s1ap_test s1ap_test) + add_executable(srslte_asn1_rrc_mcch_test srslte_asn1_rrc_mcch_test.cc) target_link_libraries(srslte_asn1_rrc_mcch_test rrc_asn1 srslte_common) add_test(srslte_asn1_rrc_mcch_test srslte_asn1_rrc_mcch_test) diff --git a/lib/test/asn1/s1ap_test.cc b/lib/test/asn1/s1ap_test.cc new file mode 100644 index 000000000..9cf92605f --- /dev/null +++ b/lib/test/asn1/s1ap_test.cc @@ -0,0 +1,58 @@ +/** + * + * \section COPYRIGHT + * + * Copyright 2013-2019 Software Radio Systems Limited + * + * \section LICENSE + * + * This file is part of the srsLTE library. + * + * srsUE is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of + * the License, or (at your option) any later version. + * + * srsUE is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * A copy of the GNU Affero General Public License can be found in + * the LICENSE file in the top-level directory of this distribution + * and at http://www.gnu.org/licenses/. + * + */ + +#include "srslte/asn1/liblte_s1ap.h" +#include "srslte/common/log_filter.h" +#include +#include + +void unpack_test_served_gummeis_with_multiple_plmns() { + srslte::log_filter log1("Log"); + log1.set_level(srslte::LOG_LEVEL_DEBUG); + log1.set_hex_limit(1024); + LIBLTE_S1AP_S1AP_PDU_STRUCT compare_pdu; + LIBLTE_S1AP_S1AP_PDU_STRUCT output_pdu; + LIBLTE_BYTE_MSG_STRUCT input_pdu; + + uint8_t pdu[] = {0x20, 0x11, 0x00, 0x26, 0x00, 0x00, 0x02, 0x00, 0x69, + 0x00, 0x1a, 0x01, 0x40, 0x00, 0xf1, 0x10, 0x00, 0xf1, + 0x10, 0x00, 0xf1, 0x10, 0x00, 0xf1, 0x10, 0x00, 0xf1, + 0x10, 0x00, 0xf1, 0x10, 0x00, 0x00, 0x88, 0x88, 0x00, + 0x7b, 0x00, 0x57, 0x40, 0x01, 0xff}; + + input_pdu.N_bytes = sizeof(pdu); + + memcpy(&input_pdu.msg, pdu, sizeof(pdu)); + + log1.debug_hex(input_pdu.msg, input_pdu.N_bytes, "Input message len = %d", + input_pdu.N_bytes); + assert(liblte_s1ap_unpack_s1ap_pdu((LIBLTE_BYTE_MSG_STRUCT *)&input_pdu, + &output_pdu) == LIBLTE_SUCCESS); +} + +int main(int argc, char **argv) { + unpack_test_served_gummeis_with_multiple_plmns(); +}