Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions internal/context/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,26 @@ func AddAusfUeContextToPool(ausfUeContext *AusfUeContext) {
ausfContext.UePool.Store(ausfUeContext.Supi, ausfUeContext)
}

func AddAusfUeContextToPoolIfNoOngoing(ausfUeContext *AusfUeContext) (existing *AusfUeContext, ok bool) {
for {
// TODO: model ServingNetworkName in the context key/lookup lifecycle if
// AUSF needs to separate the same SUPI across serving networks.
context, loaded := ausfContext.UePool.LoadOrStore(ausfUeContext.Supi, ausfUeContext)
if !loaded {
return nil, true
}

existingContext := context.(*AusfUeContext)
if existingContext.AuthStatus == models.AusfUeAuthenticationAuthResult_ONGOING {
return existingContext, false
}

if ausfContext.UePool.CompareAndSwap(ausfUeContext.Supi, existingContext, ausfUeContext) {
return existingContext, true
}
}
}

func CheckIfAusfUeContextExists(ref string) bool {
_, ok := ausfContext.UePool.Load(ref)
return ok
Expand Down
16 changes: 15 additions & 1 deletion internal/sbi/processor/ue_authentication.go
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,21 @@ func (p *Processor) UeAuthPostRequestProcedure(c *gin.Context, updateAuthenticat
ausfUeContext.ServingNetworkName = snName
ausfUeContext.AuthStatus = models.AusfUeAuthenticationAuthResult_ONGOING
ausfUeContext.UdmUeauUrl = udmUrl
ausf_context.AddAusfUeContextToPool(ausfUeContext)
if updateAuthenticationInfo.ResynchronizationInfo != nil {
ausf_context.AddAusfUeContextToPool(ausfUeContext)
} else if existingContext, ok := ausf_context.AddAusfUeContextToPoolIfNoOngoing(ausfUeContext); !ok {
logger.UeAuthLog.Warnf("authentication already in progress for SUPI %s with status %s",
ueid, existingContext.AuthStatus)
problemDetails := models.ProblemDetails{
Title: "Authentication already in progress",
Cause: "AUTHENTICATION_IN_PROGRESS",
Detail: "an authentication procedure for this SUPI is already in progress",
Status: http.StatusConflict,
}
c.Set(sbi.IN_PB_DETAILS_CTX_STR, problemDetails.Cause)
c.JSON(http.StatusConflict, problemDetails)
return
}

logger.UeAuthLog.Infof("Add SuciSupiPair (%s, %s) to map.\n", supiOrSuci, ueid)
ausf_context.AddSuciSupiPairToMap(supiOrSuci, ueid)
Expand Down
Loading