Skip to content

Commit

Permalink
fix the SMContextCount may not be unique
Browse files Browse the repository at this point in the history
  • Loading branch information
free5gc-org committed Jun 23, 2022
1 parent 8bc2b93 commit 6069df8
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions internal/context/sm_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ func init() {
}

func GetSMContextCount() uint64 {
atomic.AddUint64(&smContextCount, 1)
return smContextCount
return atomic.AddUint64(&smContextCount, 1)
}

type SMContext struct {
Expand Down Expand Up @@ -394,19 +393,31 @@ func (smContext *SMContext) isAllowedPDUSessionType(requestedPDUSessionType uint
switch supportedPDUSessionType {
case "IPv4":
if !allowIPv4 {
return fmt.Errorf("No SupportedPDUSessionType[%q] in DNN[%s] configuration", supportedPDUSessionType, smContext.Dnn)
return fmt.Errorf(
"No SupportedPDUSessionType[%q] in DNN[%s] configuration",
supportedPDUSessionType,
smContext.Dnn)
}
case "IPv6":
if !allowIPv6 {
return fmt.Errorf("No SupportedPDUSessionType[%q] in DNN[%s] configuration", supportedPDUSessionType, smContext.Dnn)
return fmt.Errorf(
"No SupportedPDUSessionType[%q] in DNN[%s] configuration",
supportedPDUSessionType,
smContext.Dnn)
}
case "IPv4v6":
if !allowIPv4 && !allowIPv6 {
return fmt.Errorf("No SupportedPDUSessionType[%q] in DNN[%s] configuration", supportedPDUSessionType, smContext.Dnn)
return fmt.Errorf(
"No SupportedPDUSessionType[%q] in DNN[%s] configuration",
supportedPDUSessionType,
smContext.Dnn)
}
case "Ethernet":
if !allowEthernet {
return fmt.Errorf("No SupportedPDUSessionType[%q] in DNN[%s] configuration", supportedPDUSessionType, smContext.Dnn)
return fmt.Errorf(
"No SupportedPDUSessionType[%q] in DNN[%s] configuration",
supportedPDUSessionType,
smContext.Dnn)
}
}

Expand Down

0 comments on commit 6069df8

Please sign in to comment.