Fix PLMN prints in NGAP/RRC

Also, replace NGAP_X with LOG_X to avoid false-positive format warnings in clang.

Closes #985
This commit is contained in:
Guido Casati
2025-09-06 12:38:34 +02:00
parent 3a734bc5d4
commit 4d96f40023
3 changed files with 62 additions and 43 deletions
+8 -1
View File
@@ -1127,7 +1127,14 @@ static int ngap_gNB_handle_paging(sctp_assoc_t assoc_id, uint32_t stream, NGAP_N
TBCD_TO_MCC_MNC(&(item_p->tAI.pLMNIdentity), msg->plmn_identity[i].mcc, msg->plmn_identity[i].mnc, msg->plmn_identity[i].mnc_digit_length);
OCTET_STRING_TO_INT16(&(item_p->tAI.tAC), msg->tac[i]);
msg->tai_size++;
NGAP_DEBUG("[SCTP %u] Received Paging: MCC %d, MNC %d, TAC %d\n", assoc_id, msg->plmn_identity[i].mcc, msg->plmn_identity[i].mnc, msg->tac[i]);
plmn_id_t *p = &msg->plmn_identity[i];
LOG_D(NGAP,
"[SCTP %u] PLMN in TAI list for Paging: MCC=%03d, MNC=%0*d, TAC=%d\n",
assoc_id,
p->mcc,
p->mnc_digit_length,
p->mnc,
msg->tac[i]);
}
//paging parameter values
+36 -29
View File
@@ -74,23 +74,27 @@ static ngap_gNB_amf_data_t *select_amf(ngap_gNB_instance_t *instance_p, const ng
// Select the AMF corresponding to the GUAMI from the RegisteredAMF IE
if (msg->ue_identity.presenceMask & NGAP_UE_IDENTITIES_guami) {
const nr_guami_t *guami = &msg->ue_identity.guami;
NGAP_DEBUG("GUAMI is present: MCC=%03d MNC=%03d RegionID=%d SetID=%d Pointer=%d\n",
guami->mcc,
guami->mnc,
guami->amf_region_id,
guami->amf_set_id,
guami->amf_pointer);
LOG_D(NGAP,
"GUAMI is present: MCC=%03d MNC=%0*d RegionID=%d SetID=%d Pointer=%d\n",
guami->mcc,
guami->mnc_len,
guami->mnc,
guami->amf_region_id,
guami->amf_set_id,
guami->amf_pointer);
amf = ngap_gNB_nnsf_select_amf_by_guami(instance_p, msg->establishment_cause, *guami);
if (amf) {
NGAP_INFO("UE %d: Chose AMF '%s' (assoc_id %d) through GUAMI MCC %d MNC %d AMFRI %d AMFSI %d AMFPT %d\n",
msg->gNB_ue_ngap_id,
amf->amf_name,
amf->assoc_id,
guami->mcc,
guami->mnc,
guami->amf_region_id,
guami->amf_set_id,
guami->amf_pointer);
LOG_I(NGAP,
"UE %d: Chose AMF '%s' (assoc_id %d) through GUAMI MCC=%03d MNC=%0*d AMFRI %d AMFSI %d AMFPT %d\n",
msg->gNB_ue_ngap_id,
amf->amf_name,
amf->assoc_id,
guami->mcc,
guami->mnc_len,
guami->mnc,
guami->amf_region_id,
guami->amf_set_id,
guami->amf_pointer);
return amf;
}
}
@@ -101,13 +105,15 @@ static ngap_gNB_amf_data_t *select_amf(ngap_gNB_instance_t *instance_p, const ng
const fiveg_s_tmsi_t *fgs_tmsi = &msg->ue_identity.s_tmsi;
amf = ngap_gNB_nnsf_select_amf_by_amf_setid(instance_p, msg->establishment_cause, msg->plmn, fgs_tmsi->amf_set_id);
if (amf) {
NGAP_INFO("UE %d: Chose AMF '%s' (assoc_id %d) through S-TMSI AMFSI %d and selected PLMN MCC %d MNC %d\n",
msg->gNB_ue_ngap_id,
amf->amf_name,
amf->assoc_id,
fgs_tmsi->amf_set_id,
msg->plmn.mcc,
msg->plmn.mnc);
LOG_I(NGAP,
"UE %d: Chose AMF '%s' (assoc_id %d) through S-TMSI AMFSI %d and selected PLMN MCC=%03d MNC=%0*d\n",
msg->gNB_ue_ngap_id,
amf->amf_name,
amf->assoc_id,
fgs_tmsi->amf_set_id,
msg->plmn.mcc,
msg->plmn.mnc_digit_length,
msg->plmn.mnc);
return amf;
}
}
@@ -117,13 +123,14 @@ static ngap_gNB_amf_data_t *select_amf(ngap_gNB_instance_t *instance_p, const ng
// Select the AMF based on the selected PLMN identity received through RRCSetupComplete
amf = ngap_gNB_nnsf_select_amf_by_plmn_id(instance_p, msg->establishment_cause, msg->plmn);
if (amf) {
NGAP_INFO("UE %d: Chose AMF '%s' (assoc_id %d) through selected PLMN MCC=%03d MNC=%0*d\n",
msg->gNB_ue_ngap_id,
amf->amf_name,
amf->assoc_id,
msg->plmn.mcc,
msg->plmn.mnc_digit_length,
msg->plmn.mnc);
LOG_I(NGAP,
"UE %d: Chose AMF '%s' (assoc_id %d) through selected PLMN MCC=%03d MNC=%0*d\n",
msg->gNB_ue_ngap_id,
amf->amf_name,
amf->assoc_id,
msg->plmn.mcc,
msg->plmn.mnc_digit_length,
msg->plmn.mnc);
return amf;
} else {
// Select the AMF with the highest capacity