From c7f11e56904d673b0acb156bb6a0eee81d8e772f Mon Sep 17 00:00:00 2001 From: Francisco Paisana Date: Fri, 6 Dec 2019 14:56:44 +0000 Subject: [PATCH] fixed issue with the liblte_s1ap transparent container packing --- lib/src/asn1/liblte_s1ap.cc | 4 ++++ lib/src/common/network_utils.cc | 2 +- srsenb/src/stack/rrc/rrc_mobility.cc | 3 ++- srsenb/src/stack/upper/s1ap.cc | 5 ++++- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/src/asn1/liblte_s1ap.cc b/lib/src/asn1/liblte_s1ap.cc index b7ee7ff9f..1edc854fc 100644 --- a/lib/src/asn1/liblte_s1ap.cc +++ b/lib/src/asn1/liblte_s1ap.cc @@ -8232,6 +8232,8 @@ LIBLTE_ERROR_ENUM liblte_s1ap_pack_targetenb_tosourceenb_transparentcontainer( liblte_value_2_bits(ie->iE_Extensions_present ? 1 : 0, ptr, 1); + liblte_align_up_zero(ptr, 8); + if (liblte_s1ap_pack_rrc_container(&ie->rRC_Container, ptr) != LIBLTE_SUCCESS) { return LIBLTE_ERROR_ENCODE_FAIL; } @@ -8262,6 +8264,8 @@ LIBLTE_ERROR_ENUM liblte_s1ap_unpack_targetenb_tosourceenb_transparentcontainer( ie->iE_Extensions_present = liblte_bits_2_value(ptr, 1); + liblte_align_up_zero(ptr, 8); + if (liblte_s1ap_unpack_rrc_container(ptr, &ie->rRC_Container) != LIBLTE_SUCCESS) { return LIBLTE_ERROR_DECODE_FAIL; } diff --git a/lib/src/common/network_utils.cc b/lib/src/common/network_utils.cc index 44a626f24..e9c13acc7 100644 --- a/lib/src/common/network_utils.cc +++ b/lib/src/common/network_utils.cc @@ -437,7 +437,7 @@ public: ssize_t n_recv = recvfrom(fd, pdu->msg, pdu->get_tailroom(), 0, (struct sockaddr*)&from, &fromlen); if (n_recv == -1 and errno != EAGAIN) { - log_h->error("Error reading from SCTP socket: %s\n", strerror(errno)); + log_h->error("Error reading from socket: %s\n", strerror(errno)); return true; } if (n_recv == -1 and errno == EAGAIN) { diff --git a/srsenb/src/stack/rrc/rrc_mobility.cc b/srsenb/src/stack/rrc/rrc_mobility.cc index 19414bbe9..dfde889f1 100644 --- a/srsenb/src/stack/rrc/rrc_mobility.cc +++ b/srsenb/src/stack/rrc/rrc_mobility.cc @@ -929,7 +929,8 @@ srslte::proc_outcome_t rrc::ue::rrc_mobility::sourceenb_ho_proc_t::react(ho_prep { asn1::bit_ref bref(e.rrc_container->msg, e.rrc_container->N_bytes); if (rrchocmd.unpack(bref) != asn1::SRSASN_SUCCESS) { - procError("Unpacking of RRC HO Command was unsuccessful\n"); + procError("Unpacking of RRC HOCommand was unsuccessful\n"); + parent->rrc_log->error_hex(e.rrc_container->msg, e.rrc_container->N_bytes, "Received container:\n"); return srslte::proc_outcome_t::error; } } diff --git a/srsenb/src/stack/upper/s1ap.cc b/srsenb/src/stack/upper/s1ap.cc index 714e3a395..987bbe165 100644 --- a/srsenb/src/stack/upper/s1ap.cc +++ b/srsenb/src/stack/upper/s1ap.cc @@ -84,6 +84,7 @@ srslte::proc_outcome_t s1ap::ue::ho_prep_proc_t::react(const LIBLTE_S1AP_MESSAGE /** * TS 36.413 - Section 8.4.1.2 - HandoverPreparation Successful Operation + * Description: MME returns back an HandoverCommand to the SeNB */ srslte::proc_outcome_t s1ap::ue::ho_prep_proc_t::react(LIBLTE_S1AP_MESSAGE_HANDOVERCOMMAND_STRUCT& msg) { @@ -117,6 +118,7 @@ srslte::proc_outcome_t s1ap::ue::ho_prep_proc_t::react(LIBLTE_S1AP_MESSAGE_HANDO LIBLTE_S1AP_TARGETENB_TOSOURCEENB_TRANSPARENTCONTAINER_STRUCT container; liblte_unpack( &msg.Target_ToSource_TransparentContainer.buffer[0], msg.Target_ToSource_TransparentContainer.n_octets, bit_ptr); + bit_msg.N_bits = bit_ptr - &bit_msg.msg[0]; liblte_s1ap_unpack_targetenb_tosourceenb_transparentcontainer(&bit_ptr, &container); if (container.iE_Extensions_present or container.ext) { procWarning("Not handling extensions\n"); @@ -129,6 +131,7 @@ srslte::proc_outcome_t s1ap::ue::ho_prep_proc_t::react(LIBLTE_S1AP_MESSAGE_HANDO return srslte::proc_outcome_t::error; } memcpy(rrc_container->msg, container.rRC_Container.buffer, container.rRC_Container.n_octets); + rrc_container->N_bytes = container.rRC_Container.n_octets; return srslte::proc_outcome_t::success; } @@ -239,7 +242,7 @@ bool s1ap::init(s1ap_args_t args_, mme_connect_timer.set(10000, mme_connect_run); // Setup S1Setup timeout s1setup_timeout = timers->get_unique_timer(); - uint32_t s1setup_timeout_val = 1000; + uint32_t s1setup_timeout_val = 5000; s1setup_timeout.set(s1setup_timeout_val, [this](uint32_t tid) { s1_setup_proc_t::s1setupresult res; res.success = false;