Skip to content

Commit

Permalink
Merge pull request #134 from ming-hsien/fix/qosid_identical_err
Browse files Browse the repository at this point in the history
  • Loading branch information
ianchen0119 authored Dec 6, 2024
2 parents cf74911 + 8de73b9 commit af1eff8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion internal/context/gsm_build.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func BuildGSMPDUSessionEstablishmentAccept(smContext *SMContext) ([]byte, error)

qoSRules := nasType.QoSRules{
{
Identifier: 0x01,
Identifier: smContext.defRuleID,
DQR: true,
Operation: nasType.OperationCodeCreateNewQoSRule,
Precedence: 255,
Expand Down
7 changes: 7 additions & 0 deletions internal/context/sm_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ type SMContext struct {
SelectedSessionRuleID string

// QoS
defRuleID uint8
QoSRuleIDGenerator *idgenerator.IDGenerator
PacketFilterIDGenerator *idgenerator.IDGenerator
QFIGenerator *idgenerator.IDGenerator
Expand Down Expand Up @@ -299,6 +300,12 @@ func NewSMContext(id string, pduSessID int32) *SMContext {
smContext.Tunnel = NewUPTunnel()

smContext.QoSRuleIDGenerator = idgenerator.NewGenerator(1, 255)
if defRuleID, err := smContext.QoSRuleIDGenerator.Allocate(); err != nil {
logger.CtxLog.Warnln("Create Default QoS rule error ", err)
} else {
smContext.defRuleID = uint8(defRuleID)
}

smContext.PacketFilterIDGenerator = idgenerator.NewGenerator(1, 255)
smContext.QFIGenerator = idgenerator.NewGenerator(2, 63) // 1 always reserve for default Qos
smContext.PCCRuleIDToQoSRuleID = make(map[string]uint8)
Expand Down

0 comments on commit af1eff8

Please sign in to comment.