Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: second ue release uecontext without authetication #136

Merged
merged 2 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions internal/context/amf_ran.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ func (ran *AmfRan) NewRanUe(ranUeNgapID int64) (*RanUe, error) {
ranUe.RanUeNgapId = ranUeNgapID
ranUe.Ran = ran
ranUe.Log = ran.Log
ranUe.FindAmfUe = nil
ranUe.UpdateLogFields()

if ranUeNgapID != RanUeNgapIdUnspecified {
Expand Down
5 changes: 3 additions & 2 deletions internal/context/ran_ue.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ type RanUe struct {
LastActTime *time.Time

/* Related Context*/
AmfUe *AmfUe
Ran *AmfRan
AmfUe *AmfUe
Ran *AmfRan
FindAmfUe *AmfUe

/* Routing ID */
RoutingID string
Expand Down
8 changes: 8 additions & 0 deletions internal/gmm/common/user_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@ func AttachRanUeToAmfUeAndReleaseOldIfAny(ue *context.AmfUe, ranUe *context.RanU
ue.AttachRanUe(ranUe)
}

func ClearHoldingRanUe(ranUe *context.RanUe) {
ranUe.DetachAmfUe()
ranUe.Log.Error("Clear Holding RanUE")
causeGroup := ngapType.CausePresentRadioNetwork
causeValue := ngapType.CauseRadioNetworkPresentReleaseDueToNgranGeneratedReason
ngap_message.SendUEContextReleaseCommand(ranUe, context.UeContextReleaseUeContext, causeGroup, causeValue)
}

func PurgeSubscriberData(ue *context.AmfUe, accessType models.AccessType) error {
logger.GmmLog.Debugln("PurgeSubscriberData")

Expand Down
5 changes: 5 additions & 0 deletions internal/nas/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ func HandleNAS(ue *amf_context.RanUe, procedureCode int64, nasPdu []byte, initia
ue.AmfUe.NasPduValue = nasPdu
ue.AmfUe.MacFailed = !integrityProtected

if ue.AmfUe.SecurityContextIsValid() && ue.FindAmfUe != nil {
gmm_common.ClearHoldingRanUe(ue.FindAmfUe.RanUe[ue.Ran.AnType])
ue.FindAmfUe = nil
}

if errDispatch := Dispatch(ue.AmfUe, ue.Ran.AnType, procedureCode, msg); errDispatch != nil {
ue.AmfUe.NASLog.Errorf("Handle NAS Error: %v", errDispatch)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/ngap/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ func handleInitialUEMessageMain(ran *context.AmfRan,
// Described in TS 23.502 4.2.2.2.2 step 4 (without UDSF deployment)
ranUe.Log.Infof("find AmfUe [%q:%q]", idType, id)
ranUe.Log.Debugf("AmfUe Attach RanUe [RanUeNgapID: %d]", ranUe.RanUeNgapId)
gmm_common.AttachRanUeToAmfUeAndReleaseOldIfAny(amfUe, ranUe)
ranUe.FindAmfUe = amfUe
} else if regReqType != nasMessage.RegistrationType5GSInitialRegistration {
if regReqType == nasMessage.RegistrationType5GSPeriodicRegistrationUpdating ||
regReqType == nasMessage.RegistrationType5GSMobilityRegistrationUpdating {
Expand Down
Loading