Skip to content

diam: keep only the P flag of the request in Answer - #276

Merged
fiorix merged 1 commit into
fiorix:mainfrom
hsdfat:answer-flags
Oct 31, 2026
Merged

fiorix merged 1 commit into
fiorix:mainfrom
hsdfat:answer-flags

Conversation

@hsdfat

@hsdfat hsdfat commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Message.Answer built the answer flags as CommandFlags &^ RequestFlag, so it copied every request flag except R. RFC 6733 §3 says:

  • T: "This flag MUST NOT be set in answer messages." An MME that retransmits an AIR or ULR after failover (§5.5.4) sets T, so the HSS answered with T set.
  • E: "MUST NOT be set in request messages". It is set by the answering side only for protocol errors.
  • Reserved bits: "MUST be set to zero".

§6.2 says the answer's P bit is set to the same value as in the request.

The answer flags are now CommandFlags & ProxiableFlag. E is left to the caller for protocol-error answers. The existing sm tests, which check that an error CEA does not have E set, still pass. In-repo callers (CEA, DWA) don't depend on the old copying.

Test: diam/answer_flags_test.go decodes a retransmitted S6a AIR (flags 0xd0) and checks several flag combinations. It fails on main (answer flags = 0x50, want 0x40).

Answer cleared the R flag and copied every other request flag into the
answer. A request sent again after a failover has the T flag set, so
its answer went out with T set too, which RFC 6733 section 3 forbids
("This flag MUST NOT be set in answer messages"). The E flag and the
reserved bits of a malformed request were copied in the same way.

Set the answer flags to the P flag of the request, as section 6.2
says, and leave E for the caller to set on a protocol error answer.
@fiorix
fiorix merged commit 49810d2 into fiorix:main Oct 31, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants