Skip to content

Commit

Permalink
Fix: "5GSM Cause" IE of "PDU Session Release Command" NAS Message is …
Browse files Browse the repository at this point in the history
…incorrect (#42)
  • Loading branch information
matsumu-y authored Mar 1, 2022
1 parent 8fb00a9 commit 75ba80e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions context/gsm_build.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ func BuildGSMPDUSessionEstablishmentReject(smContext *SMContext, cause uint8) ([
return m.PlainNasEncode()
}

func BuildGSMPDUSessionReleaseCommand(smContext *SMContext) ([]byte, error) {
func BuildGSMPDUSessionReleaseCommand(smContext *SMContext, cause uint8) ([]byte, error) {
m := nas.NewMessage()
m.GsmMessage = nas.NewGsmMessage()
m.GsmHeader.SetMessageType(nas.MsgTypePDUSessionReleaseCommand)
Expand All @@ -175,7 +175,7 @@ func BuildGSMPDUSessionReleaseCommand(smContext *SMContext) ([]byte, error) {
pDUSessionReleaseCommand.SetExtendedProtocolDiscriminator(nasMessage.Epd5GSSessionManagementMessage)
pDUSessionReleaseCommand.SetPDUSessionID(uint8(smContext.PDUSessionID))
pDUSessionReleaseCommand.SetPTI(smContext.Pti)
pDUSessionReleaseCommand.SetCauseValue(0x0)
pDUSessionReleaseCommand.SetCauseValue(cause)

return m.PlainNasEncode()
}
Expand Down
7 changes: 6 additions & 1 deletion producer/pdu_session.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,12 @@ func HandlePDUSessionSMContextUpdate(smContextRef string, body models.UpdateSmCo
}
}

if buf, err := smf_context.BuildGSMPDUSessionReleaseCommand(smContext); err != nil {
cause := nasMessage.Cause5GSMRegularDeactivation
if m.PDUSessionReleaseRequest.Cause5GSM != nil {
cause = m.PDUSessionReleaseRequest.Cause5GSM.GetCauseValue()
}

if buf, err := smf_context.BuildGSMPDUSessionReleaseCommand(smContext, cause); err != nil {
logger.PduSessLog.Errorf("Build GSM PDUSessionReleaseCommand failed: %+v", err)
} else {
response.BinaryDataN1SmMessage = buf
Expand Down

0 comments on commit 75ba80e

Please sign in to comment.