ipsec, messages, imsd: the offered ESP ciphers are a list
imsd's Security-Client held one mechanism, its cipher the value of EALG, aes-cbc when unset. TS 33.203 7.2 has the UE's first REGISTER carry "a list of identifiers for the integrity and encryption algorithms, which the UE supports", and imsd can install three ciphers: an offer of one could not say so. EALG is now a comma-separated list, offered in the order written: one mechanism per cipher in a single Security-Client, each with the REGISTER's SPIs and ports (7.2 NOTE 1, NOTE 2). The default stays aes-cbc alone. A name imsd cannot install is ignored with a journal line where it used to go out as written, `3des` is offered as des-ede3-cbc, RFC 3329's name for it, a setting that names no cipher gives the default, and the bring-up logs what is offered (`ESP ciphers offered: …`). An offer of more than one cipher needs a further rule for the 401's list. O2 UK's P-CSCF lists six mechanisms and puts the SPIs on one: the sha1 entry without a cipher for a null offer, the sha1 entry with aes-cbc for an aes-cbc offer (2026-09-17, 2026-09-20). The second has the higher q, so with both ciphers offered the highest-q offered entry and the entry carrying the SPIs can be two entries. The entry carrying the SPIs is therefore taken when it is the only such entry and one of the offer; otherwise the highest-q offered entry, as before. With one cipher offered the two name the same algorithms; they can differ in mod or prot, and there the marked entry's are now taken, where 1.2.1 took the highest-q entry's. Tested: tests/Ipsec (the setting; the selection against two offered ciphers) and tests/Messages (a Security-Client of two mechanisms); the daemon of this commit against a stand-in P-CSCF on the workstation, with one cipher offered and with two.
This commit is contained in:
parent
6b0d6341d3
commit
ed2a009425
7 changed files with 233 additions and 68 deletions
21
AGENTS.md
21
AGENTS.md
|
|
@ -45,7 +45,7 @@ PipeWire. The verified device/carrier combinations are in the README.
|
|||
| `interfaces/Imsd-Sdp.cppm` | `imsd::sdp` — SDP offer/answer: the AMR-WB + AMR + telephone-event offer (optional IR.92 preconditions; `OfferedTelephoneEventPt` names its telephone-event numbers), the parser the media plane needs (the codec, its payload type and mode, and the telephone-event payload type the m-line lists at that codec's clock), `BuildAnswer` for the terminating side, the `CODECS` override. |
|
||||
| `interfaces/Imsd-Sms.cppm` | `imsd::sms` — the short message codecs SMS over IP rides on (TS 24.341 carries the bytes a 2G/3G phone puts in an RP-DATA, in a SIP MESSAGE body): the GSM 7-bit default alphabet with its extension table and the septet packing, UCS-2 (TS 23.038); the SM-TL PDUs (TS 23.040: SMS-SUBMIT built, one per segment with the concatenation header when the text needs more than one; SMS-DELIVER, SMS-STATUS-REPORT and SMS-SUBMIT-REPORT parsed; the SMS-DELIVER-REPORT that acknowledges a delivery; the user-data header — concatenation, application ports — and the `Reassembler` of a concatenated message); the SM-RL messages (TS 24.011: RP-DATA, RP-ACK, RP-ERROR in both directions, the cause values) and `RpCauseIsTemporary`, the causes of a submission after which imsd sends the segment again; EF_SMSP (TS 31.102 §4.2.27), where the (U)SIM names the service centre, and qmicli's hex dump of it. Byte-level only: no SIP, no clock, no I/O. |
|
||||
| `interfaces/Imsd-Aka.cppm` | `imsd::aka` — USIM AKA glue: the AKAv1-MD5 digest (RFC 3310), IMPI/IMPU/realm from IMSI + MCC/MNC, parsers for `qmicli --uim-get-card-status` and `mmcli` output, the AUTHENTICATE APDU and its response. |
|
||||
| `interfaces/Imsd-Ipsec.cppm` | `imsd::ipsec` — the two ESP SA pairs (TS 33.203) as `ip xfrm` argv lists, the Security-Server mechanism selection, and the reader that reconstructs SPIs/ports from `ip xfrm state`/`policy` text for a warm resume, and (1.0.0) `SaPeer`, the P-CSCF the kernel's pair is to, read from the `dir out` policies that carry imsd's fingerprint, `OwnXfrmDeleteCommands`, the deletes by exact key of what two rules select — the policies carrying imsd's fingerprint and the reqid-1/2 transport-mode ESP states in their direction or on the UE's ims-PDN address, whoever installed them (§12), and `FileNamesAnotherPair`, whether a state file's `spi_uc`/`spi_us` name the kernel's pair (unknown on either side decides nothing). |
|
||||
| `interfaces/Imsd-Ipsec.cppm` | `imsd::ipsec` — the two ESP SA pairs (TS 33.203) as `ip xfrm` argv lists, the ESP ciphers offered (`ParseEalgOffer`, `DefaultEalgOffer`), the Security-Server mechanism selection, and the reader that reconstructs SPIs/ports from `ip xfrm state`/`policy` text for a warm resume, and (1.0.0) `SaPeer`, the P-CSCF the kernel's pair is to, read from the `dir out` policies that carry imsd's fingerprint, `OwnXfrmDeleteCommands`, the deletes by exact key of what two rules select — the policies carrying imsd's fingerprint and the reqid-1/2 transport-mode ESP states in their direction or on the UE's ims-PDN address, whoever installed them (§12), and `FileNamesAnotherPair`, whether a state file's `spi_uc`/`spi_us` name the kernel's pair (unknown on either side decides nothing). |
|
||||
| `interfaces/Imsd-Messages.cppm` | `imsd::msg` — every SIP request and response imsd sends, built from an explicit `Context` and per-request variables so the builders are pure functions; `tests/Messages` is their suite. Also `IsEmergency`. Since 1.2.0 the SIP MESSAGE of SMS over IP (`BuildMessageSms`: an RP-DATA to the service centre's PSI, or an RP-ACK/RP-ERROR to the IP-SM-GW with In-Reply-To — TS 24.341 5.3.1.2 and 5.3.2.4), the `+g.3gpp.smsip` Contact tag behind `Context::smsOverIp`, `BuildResponse`, the final for an inbound MESSAGE outside a call's dialog (the 200, the 480, the 488): each Via row echoed in order and the To echoed with a tag added unless it already holds `tag=` (RFC 3261 8.2.6.2); since 1.2.1 `BuildBadRequest`, the 400 to a request cut short of the Content-Length read from it — any but an ACK or a CANCEL, in a call's dialog or not —, in that shape, a To tag it adds made from the request's header section and a secret of the run (RFC 3261 8.2.7); of requests that came whole, in-dialog requests, a MESSAGE among them, and the shell's answers to any other request outside a call — a NOTIFY, an OPTIONS, a method it does not handle; not an INVITE, whose 486 while a call exists is `BuildInviteResponse`'s — keep `BuildResponse200`'s hop-by-hop shape; and `ScPsi`, the service centre's PSI from its international number — never a dialled-number guess. |
|
||||
| `interfaces/Imsd-Engine.cppm` | `imsd::engine` — the decisions as pure reducers: `CallMachine` (one call's dialog, returning `Action`s for the shell), `RegRecovery` (the registration recovery policy, §7.4) and, since 1.2.0, SMS over IP (§7.9): `SmsOutbound` (one short message of ours on its way to the service centre, segment by segment, since 1.2.1 a segment that gets no answer, or an RP-ERROR with cause 41, sent once more with TP-RD set — TS 23.040 9.2.3.6 —, returning `SmsAction`s) and `OnSmsMessage` (what an inbound MESSAGE outside a call's dialog leads to: its final, the message or status report it delivered, the delivery report to send), and `RecentTransactions` (an inbound request's retransmission — the same Call-ID, CSeq and Via branch within 32 s (`TimerJ`), the branch being the value of the first `branch=` of its first Via row and a request with none or an empty one never matched — answered with the same final and not handled again) and, since 1.2.1, `RecentSubmissions` (the Call-IDs of the MESSAGEs our submissions went out in, an hour each, by which a submit report for one that is no longer in flight is known for ours — TS 24.341 5.3.1.2); `SameRecipient` and `StatusReportBook`, a status report's match to the message that asked for one — TP-MR and recipient — and its word for the whole message, with `SmsWordOrder`, the order of a message's words: the submission's first, a report's held until then (§7.9); `RunToken`, `SentSmsId` and `ReceivedSmsId`, the ids (§8.4); `StoredSms` with `FormatStoredSms`/`ParseStoredSms`, the record codec of the received-message store, and `StoredSmsBefore`, `List`'s order. |
|
||||
| `interfaces/Imsd-Qmi.cppm` | `imsd::qmi` — the QMI WDS request bytes `imsd-pcscf` sends (Bind Mux Data Port, Set IP Family, Get Packet Service Status, Get Current Settings, Get Profile Settings), the message/TLV parser, the P-CSCF list readers (0x22 flag, 0x23 IPv4, 0x24 FQDN, 0x2E IPv6 — the last one libqmi does not model). |
|
||||
|
|
@ -254,8 +254,11 @@ What the suites pin:
|
|||
text, what is refused), the address-list parser, hex/base64, MD5.
|
||||
- `Aka` — the AKAv1-MD5 digest, identity derivation, the `qmicli`/`mmcli`
|
||||
text parsers, the AUTHENTICATE APDU and its response parser.
|
||||
- `Ipsec` — the exact `ip xfrm` argv lists for the SA pairs, the
|
||||
Security-Server mechanism selection, the SA reader (the entry it
|
||||
- `Ipsec` — the exact `ip xfrm` argv lists for the SA pairs, the `EALG`
|
||||
setting, the Security-Server mechanism selection against one offered
|
||||
cipher and against two (KPN's entry and Odido's, O2's six with the SPIs
|
||||
on the null entry and on the aes-cbc one, a list whose every entry
|
||||
carries them), the SA reader (the entry it
|
||||
rebuilds names the pair's integrity algorithm and cipher, read from the
|
||||
lines the kernel prints for them), the SA peer
|
||||
(`SaPeer`: the one address a reqid-1 and a reqid-2 `dir out` transport
|
||||
|
|
@ -283,7 +286,8 @@ What the suites pin:
|
|||
TLVs) and the error names (OutOfCall, NoEffect, an unknown code as `?`).
|
||||
- `Messages` — the outgoing SIP messages: the initial and the protected
|
||||
REGISTER, the reg-event SUBSCRIBE and the INVITEs byte-for-byte, their
|
||||
variants, the in-dialog requests, the ACKs, the CANCEL and
|
||||
variants (a Security-Client for another offer among them), the in-dialog
|
||||
requests, the ACKs, the CANCEL and
|
||||
`BuildResponse200` by their lines, `BuildInviteResponse` by the lines of
|
||||
one 180 and by a 486 without a Record-Route (`tests/Engine` checks the
|
||||
responses `CallMachine` builds with it); the
|
||||
|
|
@ -485,7 +489,11 @@ Rules:
|
|||
reaches); a resume whose rebuilt entry names another algorithm than
|
||||
`hmac-sha-1-96` or another cipher than `aes-cbc` (pinned in `tests/Ipsec`
|
||||
on the lines `ip xfrm state` prints; no such pair has been resumed on a
|
||||
network); a Security-Server list `PersistState` writes empty (one with
|
||||
network); a list that marks one of two offered ciphers (pinned in
|
||||
`tests/Ipsec` with two of O2's recorded lists, each its answer to an
|
||||
offer of one cipher, and run against a stand-in P-CSCF that marks the
|
||||
lower-q of the two as far as the `SA:` line; no capture holds O2's
|
||||
answer to imsd offering two); a Security-Server list `PersistState` writes empty (one with
|
||||
a quote, a backslash or a newline — neither KPN's nor O2's list has
|
||||
one; the resume of such a file ran with a hand-edited empty key,
|
||||
2026-10-11); a state write of a standing registration after a fresh
|
||||
|
|
@ -1549,7 +1557,8 @@ account `user`, its old default.
|
|||
|
||||
Lines the operator (and the scripts) look for, all prefixed `imsd: `:
|
||||
|
||||
- `LOCAL=… P-CSCF=…`, `SIP transport: …`, `SIM slot=… IMSI=… domain=…` at start.
|
||||
- `LOCAL=… P-CSCF=…`, `SIP transport: …`, `ESP ciphers offered: …`, `SIM slot=… IMSI=… domain=…` at start;
|
||||
`EALG entry '…' is not a cipher imsd can install; ignored` for a name in `EALG` that imsd cannot install.
|
||||
- `RESUME via existing SA (cseq N)`, `REGISTERED (resumed + true-refreshed)`,
|
||||
`FRESH registration`, `Security-Server: …`, `REGISTERED (fresh)`.
|
||||
- `bring-up deferred: …; next: fresh registration in N s` — one line; `in N
|
||||
|
|
|
|||
Loading…
Reference in a new issue