fixed decoding of multiple s1ap plmns

This commit is contained in:
David Rupprecht 2018-12-15 12:35:39 +01:00 committed by Andre Puschmann
parent 0b4e272318
commit 3d458319c9
3 changed files with 64 additions and 2 deletions

View File

@ -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;i<ie->len;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;

View File

@ -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)

View File

@ -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 <assert.h>
#include <string.h>
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();
}