From f6160374604c57bf35e1219e85ad0a2d784358e8 Mon Sep 17 00:00:00 2001 From: Bostjan Meglic Date: Fri, 23 Jun 2023 05:10:27 +0000 Subject: [PATCH] [AMF] Fix search for correct SMF based on SmfInfo Each SMF's NfProfile can contain multiple SmfInfo items. The issue was that AMF checked only the first SmfInfo for correct S-NSSAI/NR-TAI information. In case of a 5G core setup with SMF handling 2 or more slices, and UE trying to establish multiple PDU sessions, AMF would report an error when trying to find the correct serving SMF. [amf] ERROR: [1:0] (NF discover) No [nsmf-pdusession] (../src/amf/nnrf-handler.c:85) --- src/amf/context.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/amf/context.c b/src/amf/context.c index 00e1a2a16..35c447047 100644 --- a/src/amf/context.c +++ b/src/amf/context.c @@ -2185,11 +2185,21 @@ void amf_sbi_select_nf( false) continue; - nf_info = ogs_sbi_nf_info_find( - &nf_instance->nf_info_list, nf_instance->nf_type); - if (nf_info) { - if (nf_instance->nf_type == OpenAPI_nf_type_SMF && - check_smf_info(nf_info, sess) == false) + if ((nf_instance->nf_type == OpenAPI_nf_type_SMF) && + (ogs_list_count(&nf_instance->nf_info_list) > 0)) { + bool match = false; + + ogs_list_for_each(&nf_instance->nf_info_list, nf_info) { + if (nf_info->nf_type != nf_instance->nf_type) + continue; + if (check_smf_info(nf_info, sess) == false) + continue; + + match = true; + break; + } + + if (!match) continue; }