Skip to content

Commit dbfb9a5

Browse files
authored
Merge pull request #220 from wiwi878/fix/1029-n1-message-notify-ran-node-id
fix: validate missing anN2ApId in N1 message notify
2 parents aa086fc + 7340bfc commit dbfb9a5

4 files changed

Lines changed: 12 additions & 10 deletions

File tree

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ require (
88
github.com/free5gc/aper v1.1.1
99
github.com/free5gc/nas v1.2.3
1010
github.com/free5gc/ngap v1.1.3
11-
github.com/free5gc/openapi v1.2.4
11+
github.com/free5gc/openapi v1.2.5-0.20260527003827-02dc71b4d94f
1212
github.com/free5gc/sctp v1.1.2
1313
github.com/free5gc/util v1.3.2
1414
github.com/gin-gonic/gin v1.10.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ github.com/free5gc/nas v1.2.3 h1:vMA9NGORw0zr26vQWWSTy8X9HrA+wGxFvwc2g9KqUTw=
2727
github.com/free5gc/nas v1.2.3/go.mod h1:A8ODi6MW0fRJiLEH4GcUPbg3dd9xm3zi+fkBWqTjQ40=
2828
github.com/free5gc/ngap v1.1.3 h1:uT+IE5PkWOYjPdxCyOAwLDOXUiADcOQCs05CudyC36s=
2929
github.com/free5gc/ngap v1.1.3/go.mod h1:yGMO2GYV5DbbmudwD7Oo6dXQgz2ON29GhqtXDeXdyvA=
30-
github.com/free5gc/openapi v1.2.4 h1:uhyaTggUhd9xgMFcs5y2rCqFOfXuv6Zsr+cLUU/x6gs=
31-
github.com/free5gc/openapi v1.2.4/go.mod h1:V9CKQUqWp6kXL3SDtaIs4ZWeLipk5TSRXCnt+ntNceg=
30+
github.com/free5gc/openapi v1.2.5-0.20260527003827-02dc71b4d94f h1:AYnRO0Gj/kTmGw5tCI33R3XReV9T0sEEp7jFvnL/qok=
31+
github.com/free5gc/openapi v1.2.5-0.20260527003827-02dc71b4d94f/go.mod h1:V9CKQUqWp6kXL3SDtaIs4ZWeLipk5TSRXCnt+ntNceg=
3232
github.com/free5gc/sctp v1.1.2 h1:nNEr4uywIFmVBZauaNVJRkIDXr4nrpMmM0TPIck5QPA=
3333
github.com/free5gc/sctp v1.1.2/go.mod h1:wOvct9P1T6DGk1fxkleF7zeTHsU8ZKxKzewu2ciZh/4=
3434
github.com/free5gc/util v1.3.2 h1:3BjZq050WbaLJY0w1Bn51YZlCirs2ARoCUxD3LDSdbo=

internal/gmm/handler.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1215,10 +1215,11 @@ func handleRequestedNssai(ue *context.AmfUe, anType models.AccessType) error {
12151215
// Condition (A) Step 7: initial AMF find Target AMF via NRF ->
12161216
// Send Namf_Communication_N1MessageNotify to Target AMF
12171217
ueContext := consumer.GetConsumer().BuildUeContextModel(ue)
1218+
anN2ApId := int32(ue.RanUe[anType].RanUeNgapId)
12181219
registerContext := models.RegistrationContextContainer{
12191220
UeContext: &ueContext,
12201221
AnType: anType,
1221-
AnN2ApId: int32(ue.RanUe[anType].RanUeNgapId),
1222+
AnN2ApId: &anN2ApId,
12221223
RanNodeId: ue.RanUe[anType].Ran.RanId,
12231224
InitialAmfName: amfSelf.Name,
12241225
UserLocation: &ue.Location,

internal/sbi/processor/callback.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ func (p *Processor) N1MessageNotifyProcedure(n1MessageNotify models.N1MessageNot
283283
if registrationCtxtContainer == nil || registrationCtxtContainer.UeContext == nil ||
284284
registrationCtxtContainer.RanNodeId == nil || registrationCtxtContainer.UserLocation == nil ||
285285
registrationCtxtContainer.AnType == "" || registrationCtxtContainer.InitialAmfName == "" ||
286-
registrationCtxtContainer.AnN2ApId > 0 {
286+
registrationCtxtContainer.AnN2ApId == nil {
287287
problemDetails := &models.ProblemDetails{
288288
Status: http.StatusBadRequest,
289289
Cause: "MANDATORY_IE_MISSING",
@@ -322,15 +322,16 @@ func (p *Processor) N1MessageNotifyProcedure(n1MessageNotify models.N1MessageNot
322322
return problemDetails
323323
}
324324

325-
ranUe := ran.RanUeFindByRanUeNgapID(int64(registrationCtxtContainer.AnN2ApId))
325+
anN2ApId := *registrationCtxtContainer.AnN2ApId
326+
ranUe := ran.RanUeFindByRanUeNgapID(int64(anN2ApId))
326327
if ranUe == nil {
327328
logger.CallbackLog.Warnf("RanUe Context[AnN2ApId:%d] not found in RAN[RanId: %+v]",
328-
registrationCtxtContainer.AnN2ApId, *registrationCtxtContainer.RanNodeId)
329+
anN2ApId, *registrationCtxtContainer.RanNodeId)
329330

330331
problemDetails := &models.ProblemDetails{
331332
Status: http.StatusNotFound,
332333
Cause: "CONTEXT_NOT_FOUND",
333-
Detail: fmt.Sprintf("RanUe Context[AnN2ApId:%d] not found", registrationCtxtContainer.AnN2ApId),
334+
Detail: fmt.Sprintf("RanUe Context[AnN2ApId:%d] not found", anN2ApId),
334335
}
335336
return problemDetails
336337
}
@@ -355,9 +356,9 @@ func (p *Processor) N1MessageNotifyProcedure(n1MessageNotify models.N1MessageNot
355356

356357
amfUe.CopyDataFromUeContextModel(ueContext)
357358

358-
currentRanUe := ran.RanUeFindByRanUeNgapID(int64(registrationCtxtContainer.AnN2ApId))
359+
currentRanUe := ran.RanUeFindByRanUeNgapID(int64(anN2ApId))
359360
if currentRanUe == nil {
360-
logger.CallbackLog.Warnf("RanUe not found for AnN2ApId: %d", registrationCtxtContainer.AnN2ApId)
361+
logger.CallbackLog.Warnf("RanUe not found for AnN2ApId: %d", anN2ApId)
361362
return
362363
}
363364

0 commit comments

Comments
 (0)