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: ULCL not working; close #141 #147

Merged
merged 1 commit into from
Feb 28, 2025
Merged
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
35 changes: 26 additions & 9 deletions internal/context/sm_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -576,23 +576,43 @@ func (c *SMContext) AllocUeIP() error {
return nil
}

// This function create a data path to be default data path.
func (c *SMContext) SelectDefaultDataPath() error {
// This function create ULCL data paths.
func (c *SMContext) SelectULCLDataPaths() error {
if c.SelectionParam == nil || c.SelectedUPF == nil {
return fmt.Errorf("SelectDefaultDataPath err: SelectionParam or SelectedUPF is nil")
return fmt.Errorf("SelectULCLDataPath err: SelectionParam or SelectedUPF is nil")
}

var defaultPath *DataPath
if GetSelf().ULCLSupport && CheckUEHasPreConfig(c.Supi) {
c.Log.Infof("Has pre-config default path")
c.Log.Infof("Has pre-config ULCL paths")
uePreConfigPaths := GetUEPreConfigPaths(c.Supi, c.SelectedUPF.Name)
for _, dp := range uePreConfigPaths.DataPathPool {
if !dp.IsDefaultPath {
c.Tunnel.AddDataPath(dp)
}
}
}
return nil
}

// This function create a data path to be default data path.
func (c *SMContext) SelectDefaultDataPath() error {
if c.SelectionParam == nil || c.SelectedUPF == nil {
return fmt.Errorf("SelectDefaultDataPath err: SelectionParam or SelectedUPF is nil")
}

defaultPath := c.Tunnel.DataPathPool.GetDefaultPath()
if defaultPath != nil {
// A default path already exists.
// Use this one.
c.Log.Infof("Has default path")
defaultPath = c.Tunnel.DataPathPool.GetDefaultPath()
} else if GetSelf().ULCLSupport && CheckUEHasPreConfig(c.Supi) {
// Fallback on pre-config default path
c.Log.Infof("Has pre-config default path")
uePreConfigPaths := GetUEPreConfigPaths(c.Supi, c.SelectedUPF.Name)
defaultPath = uePreConfigPaths.DataPathPool.GetDefaultPath()
} else if c.Tunnel.DataPathPool.GetDefaultPath() == nil {
c.Tunnel.AddDataPath(defaultPath)
} else {
// UE has no pre-config path and default path
// Use default route
c.Log.Infof("Has no pre-config route. Has no default path")
Expand All @@ -603,9 +623,6 @@ func (c *SMContext) SelectDefaultDataPath() error {
defaultPath.IsDefaultPath = true
c.Tunnel.AddDataPath(defaultPath)
}
} else {
c.Log.Infof("Has no pre-config route. Has default path")
defaultPath = c.Tunnel.DataPathPool.GetDefaultPath()
}

if defaultPath == nil {
Expand Down
10 changes: 10 additions & 0 deletions internal/sbi/processor/pdu_session.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,16 @@ func (p *Processor) HandlePDUSessionSMContextCreate(
return
}

// SelectULCLDataPaths() will create other paths if ULCL is enabled.
if err = smContext.SelectULCLDataPaths(); err != nil {
smContext.SetState(smf_context.InActive)
smContext.Log.Errorf("PDUSessionSMContextCreate err: %v", err)
p.makeEstRejectResAndReleaseSMContext(c, smContext,
nasMessage.Cause5GSMInsufficientResourcesForSpecificSliceAndDNN,
&smf_errors.InsufficientResourceSliceDnn)
return
}

// generate goroutine to handle PFCP and
// reply PDUSessionSMContextCreate rsp immediately
needUnlock = false
Expand Down
Loading