From 4e7e8a6fa0c109b79cb919ea3f71c8d11cd009d1 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 6 Aug 2024 19:21:10 +0200 Subject: [PATCH] Fix bug: correctly fill LCID in ue context setup resp Before this bug fix, when using F1, we get this warning: Constraint validation failed: LCID: constraint failed (/home/richie/openairinterface5g/cmake_targets/ran_build/build/openair2/F1AP/MESSAGES/F1AP_LCID.c:30) This is because (1) we don't actually store the LCID, then (2) we did not put it into the F1 ASN.1 structures. Fix both, to make this warning disappear. To actually print the full error message, increase the error buffer size. Also, for the future, to avoid guessing, print ASN.1 XML when we encounter a failed constraint validation. --- openair2/F1AP/f1ap_du_ue_context_management.c | 1 + openair2/F1AP/f1ap_encoder.c | 6 +++--- openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index 5ab1c07d6c..6d9771f1f4 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -593,6 +593,7 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(sctp_assoc_t assoc_id, f1ap_ue_context_set F1AP_SRBs_Setup_Item_t *srbs_setup_item=&srbs_setup_item_ies->value.choice.SRBs_Setup_Item; /* sRBID */ srbs_setup_item->sRBID = resp->srbs_to_be_setup[i].srb_id; + srbs_setup_item->lCID = resp->srbs_to_be_setup[i].lcid; } } diff --git a/openair2/F1AP/f1ap_encoder.c b/openair2/F1AP/f1ap_encoder.c index 870dfd73fc..5de4ba43db 100644 --- a/openair2/F1AP/f1ap_encoder.c +++ b/openair2/F1AP/f1ap_encoder.c @@ -40,13 +40,13 @@ int f1ap_encode_pdu(F1AP_F1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *length) { LOG_E(F1AP, "----------------- ASN1 ENCODER PRINT END----------------- \n"); } - char errbuf[128]; /* Buffer for error message */ + char errbuf[4096]; /* Buffer for error message */ size_t errlen = sizeof(errbuf); /* Size of the buffer */ int ret = asn_check_constraints(&asn_DEF_F1AP_F1AP_PDU, pdu, errbuf, &errlen); - /* assert(errlen < sizeof(errbuf)); // Guaranteed: you may rely on that */ if(ret) { - fprintf(stderr, "Constraint validation failed: %s\n", errbuf); + xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, pdu); + LOG_E(F1AP, "Constraint validation failed: %s\n", errbuf); } encoded = aper_encode_to_new_buffer(&asn_DEF_F1AP_F1AP_PDU, 0, pdu, (void **)buffer); diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c index 9b5bd938ec..bb84a4793c 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c +++ b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c @@ -233,7 +233,8 @@ static int handle_ue_context_srbs_setup(NR_UE_info_t *UE, nr_lc_config_t c = {.lcid = rlc_BearerConfig->logicalChannelIdentity, .priority = priority}; nr_mac_add_lcid(&UE->UE_sched_ctrl, &c); - (*resp_srbs)[i] = *srb; + (*resp_srbs)[i].srb_id = srb->srb_id; + (*resp_srbs)[i].lcid = c.lcid; int ret = ASN_SEQUENCE_ADD(&cellGroupConfig->rlc_BearerToAddModList->list, rlc_BearerConfig); DevAssert(ret == 0);