Commit 8ad0706b authored by Guido Casati's avatar Guido Casati

Minor code improvements

* comments
* cleanup
* debug logs
* clang formatted
parent e88fe80f
...@@ -202,9 +202,12 @@ static inline uint64_t BIT_STRING_to_uint64(const BIT_STRING_t *asn) { ...@@ -202,9 +202,12 @@ static inline uint64_t BIT_STRING_to_uint64(const BIT_STRING_t *asn) {
int shift; int shift;
DevCheck ((asn->size > 0) && (asn->size <= 8), asn->size, 0, 0); DevCheck ((asn->size > 0) && (asn->size <= 8), asn->size, 0, 0);
shift = ((asn->size - 1) * 8) - asn->bits_unused; shift = ((asn->size - 1) * 8) - asn->bits_unused;
for (index = 0; index < (asn->size - 1); index++) { for (index = 0; index < (asn->size - 1); index++) {
#ifdef DEBUG_BITSTRING
printf("asn->buf[%ld]: 0x%02x\n", index, asn->buf[index]);
fflush(stdout);
#endif
result |= ((uint64_t)asn->buf[index]) << shift; result |= ((uint64_t)asn->buf[index]) << shift;
shift -= 8; shift -= 8;
} }
......
...@@ -771,6 +771,18 @@ int do_RRCReconfiguration(const gNB_RRC_UE_t *UE, ...@@ -771,6 +771,18 @@ int do_RRCReconfiguration(const gNB_RRC_UE_t *UE,
return((enc_rval.encoded+7)/8); return((enc_rval.encoded+7)/8);
} }
/**
* @brief Encode the RRCSetupRequest message (5.3.3.3 of TS 38.331)
* 1) the UE sets the UE identity as follows:
* - If upper layers provide a 5G-S-TMSI (ng-5G-S-TMSI):
* Sets the ue-Identity to ng-5G-S-TMSI-Part1.
* - Otherwise:
* Draws a 39-bit random value in the range 0..239-1
* and sets the ue-Identity to this value.
* 2) the UE sets the establishmentCause in accordance
* with the information received from upper layers.
* @return length of encoded message in bytes
*/
int do_RRCSetupRequest(uint8_t *buffer, size_t buffer_size, uint8_t *rv, uint64_t fiveG_S_TMSI) int do_RRCSetupRequest(uint8_t *buffer, size_t buffer_size, uint8_t *rv, uint64_t fiveG_S_TMSI)
{ {
NR_UL_CCCH_Message_t ul_ccch_msg = {0}; NR_UL_CCCH_Message_t ul_ccch_msg = {0};
...@@ -808,8 +820,15 @@ int do_RRCSetupRequest(uint8_t *buffer, size_t buffer_size, uint8_t *rv, uint64_ ...@@ -808,8 +820,15 @@ int do_RRCSetupRequest(uint8_t *buffer, size_t buffer_size, uint8_t *rv, uint64_
for (i = 0; i < str->size - 1; i++) { for (i = 0; i < str->size - 1; i++) {
int shift = ((str->size - i - 1) * 8) - str->bits_unused; int shift = ((str->size - i - 1) * 8) - str->bits_unused;
str->buf[i] = (fiveG_S_TMSI_part1 >> shift) & mask; str->buf[i] = (fiveG_S_TMSI_part1 >> shift) & mask;
#ifdef DEBUG_BITSTRING
LOG_D(NR_RRC, "ue-Identity: str->buf[%d] = 0x%02x\n", i, str->buf[i]);
#endif
} }
str->buf[i] = (fiveG_S_TMSI_part1 << str->bits_unused) & mask; str->buf[i] = (fiveG_S_TMSI_part1 << str->bits_unused) & mask;
#ifdef DEBUG_BITSTRING
/* Revert to long */
LOG_I(NR_RRC, "5G-S-TMSI-Part1 = %ld\n", BIT_STRING_to_uint64(str));
#endif
} }
rrcSetupRequest->rrcSetupRequest.establishmentCause = NR_EstablishmentCause_mo_Signalling; //EstablishmentCause_mo_Data; rrcSetupRequest->rrcSetupRequest.establishmentCause = NR_EstablishmentCause_mo_Signalling; //EstablishmentCause_mo_Data;
......
...@@ -1352,13 +1352,15 @@ static int handle_rrcSetupComplete(const protocol_ctxt_t *const ctxt_pP, ...@@ -1352,13 +1352,15 @@ static int handle_rrcSetupComplete(const protocol_ctxt_t *const ctxt_pP,
if (setup_complete_ies->ng_5G_S_TMSI_Value != NULL) { if (setup_complete_ies->ng_5G_S_TMSI_Value != NULL) {
uint64_t fiveg_s_TMSI = 0; uint64_t fiveg_s_TMSI = 0;
/* Extract UE identity */
if (setup_complete_ies->ng_5G_S_TMSI_Value->present == NR_RRCSetupComplete_IEs__ng_5G_S_TMSI_Value_PR_ng_5G_S_TMSI_Part2) { if (setup_complete_ies->ng_5G_S_TMSI_Value->present == NR_RRCSetupComplete_IEs__ng_5G_S_TMSI_Value_PR_ng_5G_S_TMSI_Part2) {
/* 5G-S-TMSI Part 2 */
const BIT_STRING_t *part2 = &setup_complete_ies->ng_5G_S_TMSI_Value->choice.ng_5G_S_TMSI_Part2; const BIT_STRING_t *part2 = &setup_complete_ies->ng_5G_S_TMSI_Value->choice.ng_5G_S_TMSI_Part2;
if (part2->size != 2) { if (part2->size != 2) {
LOG_E(NR_RRC, "wrong ng_5G_S_TMSI_Part2 size, expected 2, provided %lu", part2->size); LOG_E(NR_RRC, "wrong ng_5G_S_TMSI_Part2 size, expected 2, provided %lu", part2->size);
return -1; return -1;
} }
/* Set 5G-S-TMSI */
if (UE->Initialue_identity_5g_s_TMSI.presence) { if (UE->Initialue_identity_5g_s_TMSI.presence) {
uint16_t stmsi_part2 = BIT_STRING_to_uint16(part2); uint16_t stmsi_part2 = BIT_STRING_to_uint16(part2);
LOG_I(RRC, "s_tmsi part2 %d (%02x %02x)\n", stmsi_part2, part2->buf[0], part2->buf[1]); LOG_I(RRC, "s_tmsi part2 %d (%02x %02x)\n", stmsi_part2, part2->buf[0], part2->buf[1]);
...@@ -1369,12 +1371,12 @@ static int handle_rrcSetupComplete(const protocol_ctxt_t *const ctxt_pP, ...@@ -1369,12 +1371,12 @@ static int handle_rrcSetupComplete(const protocol_ctxt_t *const ctxt_pP,
UE->Initialue_identity_5g_s_TMSI.presence = false; UE->Initialue_identity_5g_s_TMSI.presence = false;
} }
} else if (setup_complete_ies->ng_5G_S_TMSI_Value->present == NR_RRCSetupComplete_IEs__ng_5G_S_TMSI_Value_PR_ng_5G_S_TMSI) { } else if (setup_complete_ies->ng_5G_S_TMSI_Value->present == NR_RRCSetupComplete_IEs__ng_5G_S_TMSI_Value_PR_ng_5G_S_TMSI) {
/* 5G-S-TMSI */
const NR_NG_5G_S_TMSI_t *bs_stmsi = &setup_complete_ies->ng_5G_S_TMSI_Value->choice.ng_5G_S_TMSI; const NR_NG_5G_S_TMSI_t *bs_stmsi = &setup_complete_ies->ng_5G_S_TMSI_Value->choice.ng_5G_S_TMSI;
if (bs_stmsi->size != 6) { if (bs_stmsi->size != 6) {
LOG_E(NR_RRC, "wrong ng_5G_S_TMSI size, expected 6, provided %lu", bs_stmsi->size); LOG_E(NR_RRC, "wrong ng_5G_S_TMSI size, expected 6, provided %lu", bs_stmsi->size);
return -1; return -1;
} }
fiveg_s_TMSI = BIT_STRING_to_uint64(bs_stmsi); fiveg_s_TMSI = BIT_STRING_to_uint64(bs_stmsi);
UE->Initialue_identity_5g_s_TMSI.presence = true; UE->Initialue_identity_5g_s_TMSI.presence = true;
} }
...@@ -1384,13 +1386,15 @@ static int handle_rrcSetupComplete(const protocol_ctxt_t *const ctxt_pP, ...@@ -1384,13 +1386,15 @@ static int handle_rrcSetupComplete(const protocol_ctxt_t *const ctxt_pP,
uint8_t amf_pointer = (fiveg_s_TMSI >> 32) & 0x3F; uint8_t amf_pointer = (fiveg_s_TMSI >> 32) & 0x3F;
uint32_t fiveg_tmsi = (uint32_t) fiveg_s_TMSI; uint32_t fiveg_tmsi = (uint32_t) fiveg_s_TMSI;
LOG_I(NR_RRC, LOG_I(NR_RRC,
"5g_s_TMSI: 0x%lX, amf_set_id: 0x%X (%d), amf_pointer: 0x%X (%d), 5g TMSI: 0x%X \n", "5G-S-TMSI: 0x%lX (%d) - AMF Set ID: 0x%X (%d) - AMF pointer: 0x%X (%d) - 5G-TMSI: 0x%X (%d)\n",
fiveg_s_TMSI, fiveg_s_TMSI,
(int)fiveg_s_TMSI,
amf_set_id, amf_set_id,
amf_set_id, (int)amf_set_id,
amf_pointer, amf_pointer,
amf_pointer, amf_pointer,
fiveg_tmsi); fiveg_tmsi,
(int)fiveg_tmsi);
UE->Initialue_identity_5g_s_TMSI.amf_set_id = amf_set_id; UE->Initialue_identity_5g_s_TMSI.amf_set_id = amf_set_id;
UE->Initialue_identity_5g_s_TMSI.amf_pointer = amf_pointer; UE->Initialue_identity_5g_s_TMSI.amf_pointer = amf_pointer;
UE->Initialue_identity_5g_s_TMSI.fiveg_tmsi = fiveg_tmsi; UE->Initialue_identity_5g_s_TMSI.fiveg_tmsi = fiveg_tmsi;
......
...@@ -670,6 +670,11 @@ static int ngap_gNB_handle_error_indication(sctp_assoc_t assoc_id, uint32_t stre ...@@ -670,6 +670,11 @@ static int ngap_gNB_handle_error_indication(sctp_assoc_t assoc_id, uint32_t stre
return 0; return 0;
} }
/**
* @brief Handle Initial Context Setup Request message sent by the AMF to request the setup of a UE context
* Direction: AMF → NG-RAN node
* @ref 3GPP TS 38.413, caluse 9.2.2.1
*/
static int ngap_gNB_handle_initial_context_request(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) static int ngap_gNB_handle_initial_context_request(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu)
{ {
int i; int i;
...@@ -722,10 +727,12 @@ static int ngap_gNB_handle_initial_context_request(sctp_assoc_t assoc_id, uint32 ...@@ -722,10 +727,12 @@ static int ngap_gNB_handle_initial_context_request(sctp_assoc_t assoc_id, uint32
memset(msg, 0, sizeof(*msg)); memset(msg, 0, sizeof(*msg));
msg->gNB_ue_ngap_id = ue_desc_p->gNB_ue_ngap_id; msg->gNB_ue_ngap_id = ue_desc_p->gNB_ue_ngap_id;
msg->amf_ue_ngap_id = ue_desc_p->amf_ue_ngap_id; msg->amf_ue_ngap_id = ue_desc_p->amf_ue_ngap_id;
/* id-UEAggregateMaximumBitRate */
/*
* id-UEAggregateMaximumBitRate: Applicable for Non-GBR QoS flows
*/
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_InitialContextSetupRequestIEs_t, ie, container, NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_InitialContextSetupRequestIEs_t, ie, container,
NGAP_ProtocolIE_ID_id_UEAggregateMaximumBitRate, false); NGAP_ProtocolIE_ID_id_UEAggregateMaximumBitRate, false);
if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */ if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */
asn_INTEGER2ulong(&(ie->value.choice.UEAggregateMaximumBitRate.uEAggregateMaximumBitRateUL), asn_INTEGER2ulong(&(ie->value.choice.UEAggregateMaximumBitRate.uEAggregateMaximumBitRateUL),
&(msg->ue_ambr.br_ul)); &(msg->ue_ambr.br_ul));
...@@ -735,71 +742,78 @@ static int ngap_gNB_handle_initial_context_request(sctp_assoc_t assoc_id, uint32 ...@@ -735,71 +742,78 @@ static int ngap_gNB_handle_initial_context_request(sctp_assoc_t assoc_id, uint32
NGAP_WARN("could not find NGAP_ProtocolIE_ID_id_UEAggregateMaximumBitRate\n"); NGAP_WARN("could not find NGAP_ProtocolIE_ID_id_UEAggregateMaximumBitRate\n");
} }
/*
/* id-GUAMI */ * id-GUAMI: IE containing the AMF identity.
*/
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_InitialContextSetupRequestIEs_t, ie, container, NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_InitialContextSetupRequestIEs_t, ie, container,
NGAP_ProtocolIE_ID_id_GUAMI, true); NGAP_ProtocolIE_ID_id_GUAMI, true);
/* PLMN */
TBCD_TO_MCC_MNC(&ie->value.choice.GUAMI.pLMNIdentity, msg->guami.mcc, TBCD_TO_MCC_MNC(&ie->value.choice.GUAMI.pLMNIdentity, msg->guami.mcc, msg->guami.mnc, msg->guami.mnc_len);
msg->guami.mnc, msg->guami.mnc_len); /* AMF IDs */
OCTET_STRING_TO_INT8(&ie->value.choice.GUAMI.aMFRegionID, msg->guami.amf_region_id);
OCTET_STRING_TO_INT8(&ie->value.choice.GUAMI.aMFRegionID, msg->guami.amf_region_id); OCTET_STRING_TO_INT16(&ie->value.choice.GUAMI.aMFSetID, msg->guami.amf_set_id);
OCTET_STRING_TO_INT16(&ie->value.choice.GUAMI.aMFSetID, msg->guami.amf_set_id); OCTET_STRING_TO_INT8(&ie->value.choice.GUAMI.aMFPointer, msg->guami.amf_pointer);
OCTET_STRING_TO_INT8(&ie->value.choice.GUAMI.aMFPointer, msg->guami.amf_pointer); NGAP_INFO("[SCTP %u] Received Initial Context Setup Request from %s with GUAMI %03d/%02d:0x%02x/0x%04x/0x%02x\n",
assoc_id,
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_InitialContextSetupRequestIEs_t, ie, container, NGAP_ProtocolIE_ID_id_PDUSessionResourceSetupListCxtReq, false); amf_desc_p->amf_name,
if (ie != NULL) { msg->guami.mcc,
msg->nb_of_pdusessions = ie->value.choice.PDUSessionResourceSetupListCxtReq.list.count; msg->guami.mnc,
msg->guami.amf_region_id,
for (i = 0; i < ie->value.choice.PDUSessionResourceSetupListCxtReq.list.count; i++) { msg->guami.amf_set_id,
NGAP_PDUSessionResourceSetupItemCxtReq_t *item_p = ie->value.choice.PDUSessionResourceSetupListCxtReq.list.array[i]; msg->guami.amf_pointer);
msg->pdusession_param[i].pdusession_id = item_p->pDUSessionID;
/* PDU Session Resource Setup Request List */
OCTET_STRING_TO_INT8(&item_p->s_NSSAI.sST, msg->pdusession_param[i].nssai.sst); NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_InitialContextSetupRequestIEs_t,
if (item_p->s_NSSAI.sD != NULL) { ie,
uint8_t *sd_p = (uint8_t *)&msg->pdusession_param[i].nssai.sd; container,
sd_p[0] = item_p->s_NSSAI.sD->buf[0]; NGAP_ProtocolIE_ID_id_PDUSessionResourceSetupListCxtReq,
sd_p[1] = item_p->s_NSSAI.sD->buf[1]; false);
sd_p[2] = item_p->s_NSSAI.sD->buf[2]; if (ie != NULL) {
} else { msg->nb_of_pdusessions = ie->value.choice.PDUSessionResourceSetupListCxtReq.list.count;
msg->pdusession_param[i].nssai.sd = 0xffffff; for (i = 0; i < ie->value.choice.PDUSessionResourceSetupListCxtReq.list.count; i++) {
} /* PDU Session ID (mandatory) */
NGAP_PDUSessionResourceSetupItemCxtReq_t *item_p = ie->value.choice.PDUSessionResourceSetupListCxtReq.list.array[i];
if (item_p->nAS_PDU) { msg->pdusession_param[i].pdusession_id = item_p->pDUSessionID;
allocCopy(&msg->pdusession_param[i].nas_pdu, *item_p->nAS_PDU); /* S-NSSAI (mandatory) */
} OCTET_STRING_TO_INT8(&item_p->s_NSSAI.sST, msg->pdusession_param[i].nssai.sst);
allocCopy(&msg->pdusession_param[i].pdusessionTransfer, item_p->pDUSessionResourceSetupRequestTransfer); if (item_p->s_NSSAI.sD != NULL) {
uint8_t *sd_p = (uint8_t *)&msg->pdusession_param[i].nssai.sd;
sd_p[0] = item_p->s_NSSAI.sD->buf[0];
sd_p[1] = item_p->s_NSSAI.sD->buf[1];
sd_p[2] = item_p->s_NSSAI.sD->buf[2];
} else {
msg->pdusession_param[i].nssai.sd = 0xffffff;
} }
/* PDU Session ID (optional) */
if (item_p->nAS_PDU) {
allocCopy(&msg->pdusession_param[i].nas_pdu, *item_p->nAS_PDU);
}
/* PDU Session Resource Setup Request Transfer (mandatory) */
allocCopy(&msg->pdusession_param[i].pdusessionTransfer, item_p->pDUSessionResourceSetupRequestTransfer);
} }
}
/* id-AllowedNSSAI */ /* id-AllowedNSSAI (mandatory) */
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_InitialContextSetupRequestIEs_t, ie, container, NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_InitialContextSetupRequestIEs_t, ie, container,
NGAP_ProtocolIE_ID_id_AllowedNSSAI, true); NGAP_ProtocolIE_ID_id_AllowedNSSAI, true);
NGAP_AllowedNSSAI_Item_t *allow_nssai_item_p = NULL;
//if (ie != NULL) { /* checked by macro but cppcheck doesn't see it */ AssertFatal(ie, "AllowedNSSAI not present, forging 2 NSSAI\n");
NGAP_AllowedNSSAI_Item_t *allow_nssai_item_p = NULL; msg->nb_allowed_nssais = ie->value.choice.AllowedNSSAI.list.count;
for (i = 0; i < ie->value.choice.AllowedNSSAI.list.count; i++) {
//NGAP_DEBUG("AllowedNSSAI.list.count %d\n", ie->value.choice.AllowedNSSAI.list.count); allow_nssai_item_p = ie->value.choice.AllowedNSSAI.list.array[i];
//DevAssert(ie->value.choice.AllowedNSSAI.list.count > 0); OCTET_STRING_TO_INT8(&allow_nssai_item_p->s_NSSAI.sST, msg->allowed_nssai[i].sst);
//DevAssert(ie->value.choice.AllowedNSSAI.list.count <= NGAP_maxnoofAllowedS_NSSAIs); if (allow_nssai_item_p->s_NSSAI.sD != NULL) {
msg->allowed_nssai[i].sd = 0;
AssertFatal(ie, "AllowedNSSAI not present, forging 2 NSSAI\n"); BUFFER_TO_INT24((uint8_t *)allow_nssai_item_p->s_NSSAI.sD->buf, msg->allowed_nssai[i].sd);
} else {
NGAP_DEBUG("AllowedNSSAI.list.count %d\n", ie->value.choice.AllowedNSSAI.list.count); msg->allowed_nssai[i].sd = 0xffffff;
msg->nb_allowed_nssais = ie->value.choice.AllowedNSSAI.list.count;
for(i = 0; i < ie->value.choice.AllowedNSSAI.list.count; i++) {
allow_nssai_item_p = ie->value.choice.AllowedNSSAI.list.array[i];
OCTET_STRING_TO_INT8(&allow_nssai_item_p->s_NSSAI.sST, msg->allowed_nssai[i].sst);
if(allow_nssai_item_p->s_NSSAI.sD != NULL) {
msg->allowed_nssai[i].sd = 0;
BUFFER_TO_INT24((uint8_t *)allow_nssai_item_p->s_NSSAI.sD->buf, msg->allowed_nssai[i].sd);
} else {
msg->allowed_nssai[i].sd = 0xffffff;
}
} }
NGAP_DEBUG("Allowed NSSAI %d of %d: SD %d SST %d \n",
i,
msg->nb_allowed_nssais,
msg->allowed_nssai[i].sd,
msg->allowed_nssai[i].sst);
}
/* id-UESecurityCapabilities */ /* id-UESecurityCapabilities */
NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_InitialContextSetupRequestIEs_t, ie, container, NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_InitialContextSetupRequestIEs_t, ie, container,
......
...@@ -95,7 +95,7 @@ int ngap_gNB_handle_nas_first_req(instance_t instance, ngap_nas_first_req_t *UEf ...@@ -95,7 +95,7 @@ int ngap_gNB_handle_nas_first_req(instance_t instance, ngap_nas_first_req_t *UEf
amf_desc_p = ngap_gNB_nnsf_select_amf_by_guami(instance_p, UEfirstReq->establishment_cause, UEfirstReq->ue_identity.guami); amf_desc_p = ngap_gNB_nnsf_select_amf_by_guami(instance_p, UEfirstReq->establishment_cause, UEfirstReq->ue_identity.guami);
if (amf_desc_p) { if (amf_desc_p) {
NGAP_INFO("UE %d: Chose AMF '%s' (assoc_id %d) through GUAMI MCC %d MNC %d AMFRI %d AMFSI %d AMFPT %d\n", NGAP_INFO("UE %d: Chose AMF '%s' (assoc_id %d) through GUAMI MCC %03d MNC %02d AMFRI %02x AMFSI %04x AMFPT %02x\n",
UEfirstReq->gNB_ue_ngap_id, UEfirstReq->gNB_ue_ngap_id,
amf_desc_p->amf_name, amf_desc_p->amf_name,
amf_desc_p->assoc_id, amf_desc_p->assoc_id,
...@@ -115,7 +115,7 @@ int ngap_gNB_handle_nas_first_req(instance_t instance, ngap_nas_first_req_t *UEf ...@@ -115,7 +115,7 @@ int ngap_gNB_handle_nas_first_req(instance_t instance, ngap_nas_first_req_t *UEf
if (amf_desc_p) { if (amf_desc_p) {
NGAP_INFO( NGAP_INFO(
"UE %d: Chose AMF '%s' (assoc_id %d) through S-TMSI AMFSI %d and selected PLMN Identity index %d MCC %d MNC %d\n", "UE %d: Chose AMF '%s' (assoc_id %d) through S-TMSI AMFSI %d and selected PLMN Identity index %d MCC %03d MNC %02d\n",
UEfirstReq->gNB_ue_ngap_id, UEfirstReq->gNB_ue_ngap_id,
amf_desc_p->amf_name, amf_desc_p->amf_name,
amf_desc_p->assoc_id, amf_desc_p->assoc_id,
...@@ -134,7 +134,7 @@ int ngap_gNB_handle_nas_first_req(instance_t instance, ngap_nas_first_req_t *UEf ...@@ -134,7 +134,7 @@ int ngap_gNB_handle_nas_first_req(instance_t instance, ngap_nas_first_req_t *UEf
amf_desc_p = ngap_gNB_nnsf_select_amf_by_plmn_id(instance_p, UEfirstReq->establishment_cause, UEfirstReq->selected_plmn_identity); amf_desc_p = ngap_gNB_nnsf_select_amf_by_plmn_id(instance_p, UEfirstReq->establishment_cause, UEfirstReq->selected_plmn_identity);
if (amf_desc_p) { if (amf_desc_p) {
NGAP_INFO("UE %d: Chose AMF '%s' (assoc_id %d) through selected PLMN Identity index %d MCC %d MNC %d\n", NGAP_INFO("UE %d: Chose AMF '%s' (assoc_id %d) through selected PLMN Identity index %d MCC %03d MNC %02d\n",
UEfirstReq->gNB_ue_ngap_id, UEfirstReq->gNB_ue_ngap_id,
amf_desc_p->amf_name, amf_desc_p->amf_name,
amf_desc_p->assoc_id, amf_desc_p->assoc_id,
...@@ -240,7 +240,6 @@ int ngap_gNB_handle_nas_first_req(instance_t instance, ngap_nas_first_req_t *UEf ...@@ -240,7 +240,6 @@ int ngap_gNB_handle_nas_first_req(instance_t instance, ngap_nas_first_req_t *UEf
/* optional */ /* optional */
if (UEfirstReq->ue_identity.presenceMask & NGAP_UE_IDENTITIES_FiveG_s_tmsi) { if (UEfirstReq->ue_identity.presenceMask & NGAP_UE_IDENTITIES_FiveG_s_tmsi) {
NGAP_DEBUG("FIVEG_S_TMSI_PRESENT\n");
asn1cSequenceAdd(out->protocolIEs.list, NGAP_InitialUEMessage_IEs_t, ie); asn1cSequenceAdd(out->protocolIEs.list, NGAP_InitialUEMessage_IEs_t, ie);
ie->id = NGAP_ProtocolIE_ID_id_FiveG_S_TMSI; ie->id = NGAP_ProtocolIE_ID_id_FiveG_S_TMSI;
ie->criticality = NGAP_Criticality_reject; ie->criticality = NGAP_Criticality_reject;
...@@ -248,6 +247,13 @@ int ngap_gNB_handle_nas_first_req(instance_t instance, ngap_nas_first_req_t *UEf ...@@ -248,6 +247,13 @@ int ngap_gNB_handle_nas_first_req(instance_t instance, ngap_nas_first_req_t *UEf
AMF_SETID_TO_BIT_STRING(UEfirstReq->ue_identity.s_tmsi.amf_set_id, &ie->value.choice.FiveG_S_TMSI.aMFSetID); AMF_SETID_TO_BIT_STRING(UEfirstReq->ue_identity.s_tmsi.amf_set_id, &ie->value.choice.FiveG_S_TMSI.aMFSetID);
AMF_POINTER_TO_BIT_STRING(UEfirstReq->ue_identity.s_tmsi.amf_pointer, &ie->value.choice.FiveG_S_TMSI.aMFPointer); AMF_POINTER_TO_BIT_STRING(UEfirstReq->ue_identity.s_tmsi.amf_pointer, &ie->value.choice.FiveG_S_TMSI.aMFPointer);
M_TMSI_TO_OCTET_STRING(UEfirstReq->ue_identity.s_tmsi.m_tmsi, &ie->value.choice.FiveG_S_TMSI.fiveG_TMSI); M_TMSI_TO_OCTET_STRING(UEfirstReq->ue_identity.s_tmsi.m_tmsi, &ie->value.choice.FiveG_S_TMSI.fiveG_TMSI);
NGAP_DEBUG("FIVEG_S_TMSI_PRESENT: AMF Set ID: 0x%04x (%d) - AMF Pointer: 0x%02x (%d) - 5G-TMSI: 0x%X (%d)\n",
UEfirstReq->ue_identity.s_tmsi.amf_set_id,
UEfirstReq->ue_identity.s_tmsi.amf_set_id,
UEfirstReq->ue_identity.s_tmsi.amf_pointer,
UEfirstReq->ue_identity.s_tmsi.amf_pointer,
UEfirstReq->ue_identity.s_tmsi.m_tmsi,
UEfirstReq->ue_identity.s_tmsi.m_tmsi);
} }
/* optional */ /* optional */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment