From 75e675468ec1083b9a64ea07852a4976406d3f33 Mon Sep 17 00:00:00 2001 From: Vinod Patmanathan Date: Fri, 24 Apr 2026 16:05:51 +0200 Subject: [PATCH] fix: set RatType correctly during registration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit During normal registration ue.RatType was never set: the only code path that assigned it was CreateUEContextProcedure, and it copied RestrictedRatList[0] — a list of RAT types the UE is *not* allowed to use — which is semantically wrong and also panics when the list is empty (minItem = -1 per spec). Set ue.RatType from the access type in HandleRegistrationRequest instead: - 3GPP access with NrLocation -> NR - 3GPP access with EutraLocation -> EUTRA - Non-3GPP access -> WLAN Remove the buggy RestrictedRatList[0] assignment in producer/ue_context.go. This makes RatType non-empty for downstream SBI consumers (Nsmf_PDUSession CreateSMContext, UE context management, location reporting, MT notifications). Signed-off-by: Vinod Patmanathan --- gmm/handler.go | 12 ++++++++++++ producer/ue_context.go | 4 +++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/gmm/handler.go b/gmm/handler.go index bd6dd444..d8f48719 100644 --- a/gmm/handler.go +++ b/gmm/handler.go @@ -626,6 +626,18 @@ func HandleRegistrationRequest(ctx ctxt.Context, ue *context.AmfUe, anType model ue.Location = ue.RanUe[anType].Location ue.Tai = ue.RanUe[anType].Tai + switch anType { + case models.AccessType__3_GPP_ACCESS: + switch { + case ue.Location.NrLocation != nil: + ue.RatType = models.RatType_NR + case ue.Location.EutraLocation != nil: + ue.RatType = models.RatType_EUTRA + } + case models.AccessType_NON_3_GPP_ACCESS: + ue.RatType = models.RatType_WLAN + } + // Check TAI taiList := make([]models.Tai, len(amfSelf.SupportTaiLists)) copy(taiList, amfSelf.SupportTaiLists) diff --git a/producer/ue_context.go b/producer/ue_context.go index 9ccd57d3..edb6b26a 100644 --- a/producer/ue_context.go +++ b/producer/ue_context.go @@ -134,7 +134,9 @@ func CreateUEContextProcedure(ueContextID string, createUeContextRequest models. ue.UdmGroupId = ueContextCreateData.UeContext.UdmGroupId ue.AusfGroupId = ueContextCreateData.UeContext.AusfGroupId // ueContextCreateData.UeContext.HpcfId - ue.RatType = ueContextCreateData.UeContext.RestrictedRatList[0] // minItem = -1 + // RestrictedRatList contains RAT types the UE cannot use, so it must + // not be copied into ue.RatType. RatType is set from the access type + // during HandleRegistrationRequest (gmm/handler.go). // ueContextCreateData.UeContext.ForbiddenAreaList // ueContextCreateData.UeContext.ServiceAreaRestriction // ueContextCreateData.UeContext.RestrictedCoreNwTypeList