Skip to content

Commit

Permalink
fix: ULCL not working; close #141
Browse files Browse the repository at this point in the history
  • Loading branch information
louisroyer committed Feb 28, 2025
1 parent ddfb1e6 commit e7ea3f5
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 9 deletions.
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

0 comments on commit e7ea3f5

Please sign in to comment.