Commit graph imsd/tests/Util
Author SHA1 Message Date
c93df591f1
imsd: no CRLF keepalive on the idle flow unless CRLF_KEEPALIVE names an interval
imsd sent a double CRLF, the ping of RFC 5626 4.4.1, on its idle TCP
flow to the P-CSCF every 30 seconds. On a phone that costs far more
than four bytes. The modem brings the ims bearer up for it; 11 to 13 s
later the bearer goes dormant, which the modem reports to
ModemManager, and 90 s after that the modem makes a file-system
request to rmtfs. Each of the two can wake a phone that has gone back to
sleep: in a loop of suspends on the dev phone (KPN, 2026-11-20, the
fp6 journal's 2026-11-20-modem-echo-wakes capture) the modem ended 29
sleeps of 29, 15 with the report and 14 with that request, and none
reached its 150-second alarm; with imsd held still all six did. Awake
and idle on a USB port the phone's battery lost 140 mA with the ping
and 59 mA without it (2026-11-24, one window of 40 min and one of 33).

No registration of imsd's negotiates keep-alives: its REGISTER has no
"outbound" in Supported and no reg-id (RFC 5626 4.2.1), and no "keep"
in the Via (RFC 6223).

The ping is now sent only where CRLF_KEEPALIVE=<whole seconds> names
an interval. An empty value is as none; any other that is no whole
number of seconds is reported in the journal and sends none
(imsd::util::WholeSeconds).

What a ping does for a flow, outside a call: sent more often than a
P-CSCF's timer for a flow it hears nothing on, it keeps that P-CSCF from
dropping the flow, and it draws the reset of a P-CSCF that has lost the
flow. The setting is for such a network. On the phone the ping also kept
the connection tracker's entry for the P-CSCF's ESP, without which the
firewall dropped what the network started; the commit before this one
gives the firewall a rule for ESP instead. Without the ping, a close by
the network is answered, outside a call, with a reconnect and a
re-REGISTER. A flow the network has dropped without closing, where it
answers the next bytes on it with a reset, is found at those bytes:
where they are the refresh's, it fails once and the same reconnect
follows; where they are a call's INVITE, the flow is reopened for the
call; where they are a call's BYE, the BYE is lost: imsd sends no BYE
again, as before. Where they are a text's MESSAGE, it is lost with the
flow and the text's wait decides. An incoming call sends no request on
the flow before its BYE, and without the ping the flow can have been
silent, or dropped without a close, since long before such a call came
(AGENTS.md §7.6). A flow that died with no close and no reset reaching
the phone is noticed when the refresh's re-REGISTER gets no answer, or
sooner where TCP gives up on bytes imsd sent on it before that (924.6 s
or more after them by the kernel's default tcp_retries2), and until
1.2.3 a ping's were among those every 30 s outside a call; a bearer that
left under a registered daemon was noticed at the refresh under the ping
as well (2026-10-02, AGENTS.md §7.2).

Tested: the suites, WholeSeconds in tests/Util; the daemon of this
commit and 1.2.3's on the workstation against a stand-in network that
prints every ping and can close a silent flow or forget it (the fp6
journal's 2026-11-24-crlf-keepalive capture, bench-keepalive.sh: no ping
by default, with CRLF_KEEPALIVE=0 or with an empty value, 1.2.3's three
in 100 s, the setting's, none over UDP, a value that is no number, the
reconnect at each close, the failed refresh and the reconnect on a
forgotten flow, neither a close nor a forgotten flow under the setting
or under 1.2.3's pings, a ping of 1.2.3's reset on a forgotten flow; and
bench-hangup.sh of the 2026-11-24-bye-resend capture: a placed call's
BYE not delivered where the network had forgotten or closed the flow
under the call, by this daemon as by 1.2.3's on the forgetting one). On
the dev phone on KPN, the binary of the range's tip: no packet on the
ims netdev in two idle minutes where 1.2.3 put one each way every 30 s,
the setting's start line and its pings, the line for a value that is no
number. And there, with builds of this change from before the commit of
the call's resend was put under it: the refresh after 1800 awake seconds
answered on the flow, silent until then, twice; and two loops of
suspends with no packet on the netdev, of six sleeps, none ended by the
modem, and of seven, one ended by it, for a file-system request no
packet had preceded (with the pings and the same ModemManager the modem
ended 5 of 8 on 2026-11-20). No network that closes or forgets an idle
flow has been met.
2026-11-25 11:50:16 +01:00
a63132deb8
tests: every suite returns 1 for a failure, not the count
Six suites ended in `return Failures;`. `crafter-build test` takes an
exit status of 77 for a skipped suite and then succeeds, and an exit
status keeps 8 bits: 77 failing checks read as a skip, 256 as a pass.
All nine now return 1 after any failure, as Engine, Sip and Sms did.

Tested with 77 failing checks added to Ipsec, to Messages and to Sdp
in turn (the fp6 journal's 2026-11-20-issues-2-5 capture, exit-status):
before, `crafter-build test` ended `8 passed, 1 skipped` with exit
status 0; now it ends `8 passed, 1 failed` with exit status 1.
2026-11-22 17:35:11 +01:00
910e2594a0
project, docs: the linter goes
The Catcrafts house-style rules (Crafter.LintRules) rode in project.cpp
as a dependency crafter-build cloned once and built on every load; the tree
never passed them (111 findings on the 1.1.0 tree, 156 on an early freeze
of this range (2e87e26), 100 of the 156 the shared naming rule's, each
for a variable whose name begins with a capital — the
fp6 journal's lint captures, lint-tip-2e87e26), CI never ran them,
and AGENTS.md kept a census nobody acted on. Out: the dependency, the
import and the five AddRules calls, the lint-disable comments in 25
files and on 4 lines, §4.2 and the census of §6 — now "Code style", the
three rules that were never the linter's; the cross-compiling section
becomes §4.2 and its six citations — §4.1's sysroot sentence, §9.1, the CI
workflow, the APKBUILD, build-package.sh, make-sysroot.sh — follow. Jorijn, 2026-10-17: "just
remove the linter, we are ignoring it anyway".
2026-11-19 16:43:16 +01:00
146d4368d0
util: canonical IPv6 text (RFC 5952 §4) and an address-list parser
imsd compares addresses as text against `ip xfrm` output, which prints
RFC 5952 form, while PCSCF= and LOCAL= arrive in whatever spelling the
user typed. CanonicalIp6 produces the §4 form from an IPv6 literal
(brackets accepted; a zone, a port, a dotted-quad tail, a name or an IPv4
address are refused; an IPv4-mapped address spelled in hex comes back in
hex, where inet_ntop writes it dotted), CanonicalAddr applies it to IPv6 only, and
ParseAddressList turns a comma-separated list into canonical,
deduplicated IPv6 literals in order, keeping the entries CanonicalIp6
accepts and naming every entry it refuses — an IPv4 address, a name, an
IPv6 literal with a zone or a dotted-quad tail — to a caller who asks for
them (duplicates and blanks are dropped
silently). Pure std, so the partitions stay free of inet_pton; nothing calls them yet.

Tested: crafter-build test, 7 passed.
2026-10-13 22:28:02 +02:00
6e77823933 imsd 0.2.7 — initial public snapshot
Userspace VoLTE/IMS daemon for mainline Linux phones (developed on the
Fairphone 6): a GLib-free core (SIP, SDP, USIM AKA, IPsec SA setup, RTP
media, call engine) behind a GDBus control daemon, a standalone AMR-WB
media leg, and a Plasma Dialer backend. C++26 modules built with Crafter
Build; the tree is clean under the project's house-style linter
(crafter-build lint) across all three build products.

Assisted-by: Claude:claude-fable-5
Signed-off-by: Jorijn van der Graaf <jorijnvdgraaf@catcrafts.net>
2026-07-22 23:04:21 +02:00