Skip to content

Commit c6fe258

Browse files
midwellclaude
andcommitted
feat: answer a UE-requested modification instead of dropping it
A PDU SESSION MODIFICATION REQUEST was decoded, logged at debug and dropped. The UE is left retransmitting a request nothing will ever answer, and TS 24.501 subclause 6.4.2 expects an answer either way -- so the session ends up in the one state the specification does not describe. The SMF does not implement UE-requested modification, and saying so is an answer: the request is refused with a MODIFICATION REJECT carrying the cause, attached to the UpdateSmContext response per TS 23.502 subclause 4.3.3.2 step 3a. The UE stops asking and knows why, instead of retrying into silence. One case is not refused. TS 24.501 subclause 6.3.2.5 item d: a UE request for a session the network is already modifying is disregarded, not rejected -- the network's own procedure carries on as if the request had never arrived, so no reject, no state change, and T3591 keeps running. Refusing there would answer a procedure the UE is entitled to have ignored, and the back-off that cause 32 asks for would be applied to a session that is being modified perfectly well. The shared activeSmContext fixture now carries an empty tunnel. An active session always has one, and since #659 a policy update refuses a session without one as being released, so this change's tests of the network-initiated procedure would otherwise stop at that refusal. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: Edvin Lindqvist <edvin.lindqvist@forsway.com>
1 parent 061be74 commit c6fe258

6 files changed

Lines changed: 610 additions & 5 deletions

File tree

‎context/gsm_build.go‎

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,16 @@ func BuildGSMPDUSessionEstablishmentReject(smContext *SMContext, cause uint8) ([
209209
return m.PlainNasEncode()
210210
}
211211

212-
/*func BuildGSMPDUSessionModificationReject(smContext *SMContext, cause uint8) ([]byte, error) {
212+
// BuildGSMPDUSessionModificationRejectWithCause builds a PDU SESSION MODIFICATION REJECT for a
213+
// modification the network will not perform.
214+
//
215+
// 3GPP Reference: TS 24.501 subclause 8.3.8.
216+
//
217+
// The PDU session identity and the PTI are taken from the request rather than from the SM context.
218+
// The identity may not match the context at all — that is one of the reasons for refusing — and
219+
// the PTI identifies the UE's procedure, so echoing the context's value would leave the UE unable
220+
// to match the reject to what it asked for.
221+
func BuildGSMPDUSessionModificationRejectWithCause(pduSessionID int32, pti uint8, cause string) ([]byte, error) {
213222
m := nas.NewMessage()
214223
m.GsmMessage = nas.NewGsmMessage()
215224
m.GsmHeader.SetMessageType(nas.MsgTypePDUSessionModificationReject)
@@ -219,11 +228,16 @@ func BuildGSMPDUSessionEstablishmentReject(smContext *SMContext, cause uint8) ([
219228

220229
pDUSessionModificationReject.SetMessageType(nas.MsgTypePDUSessionModificationReject)
221230
pDUSessionModificationReject.SetExtendedProtocolDiscriminator(nasMessage.Epd5GSSessionManagementMessage)
222-
pDUSessionModificationReject.SetPDUSessionID(uint8(smContext.PDUSessionID))
223-
pDUSessionModificationReject.SetCauseValue(cause)
224-
231+
pDUSessionModificationReject.SetPDUSessionID(uint8(pduSessionID))
232+
pDUSessionModificationReject.SetPTI(pti)
233+
pDUSessionModificationReject.SetCauseValue(errors.ErrorCause[cause])
234+
235+
// No Back-off timer value IE. TS 24.501 subclause 6.4.2.4.3 item a has the UE fall back to its
236+
// configured SM Retry Timer, or 12 minutes, when the network sends #32 without one — which is
237+
// the behaviour wanted here. Sending the IE would also require the Re-attempt indicator to be
238+
// meaningful, and neither is mandatory.
225239
return m.PlainNasEncode()
226-
}*/
240+
}
227241

228242
func BuildGSMPDUSessionReleaseCommand(smContext *SMContext) ([]byte, error) {
229243
m := nas.NewMessage()

0 commit comments

Comments
 (0)