imsd/packaging/imsd.service
Jorijn van der Graaf 7eb2deae0c
ims-pdn-up, imsd: register on the PDN's own address, not the kernel's temporary one
imsd took the first global IPv6 on the ims netdev as its address, and
the kernel lists the temporary (privacy) SLAAC address first: `temporary
dynamic`, preferred for a day and valid for two by its lifetimes (read
2026-09-24). Contact, Via and the four SAs were bound to it, so once the
kernel removes it the registration has lost its address. The address
ModemManager assigned — the one the script installs — sat third on the
list. Seen on the dev phone; a field unit's journal shows the split too
— imsd registered on an address other than the one the script installed
(ims ledger F18).

Hand the assigned address to the daemon as LOCAL through /run/imsd.env,
next to DEV. For a manual run without it, prefer a global address that
is neither `temporary` nor `dynamic`, then any non-temporary one.

A restart after the upgrade finds the registration's SAs on the old
address. It resumes there while that address is still on the link, and
moves to the PDN's address in place: with its next fresh registration,
or when the old address leaves the link first. When the address it is
registered on leaves the netdev and the PDN's own address is not there
to move to, a registered imsd exits at its next recovery step, non-zero,
for a systemd restart, which runs the PDN bring-up again.

Tested on the dev phone (KPN) in builds of this series; not every path
has run there.
2026-10-06 14:01:33 +02:00

37 lines
1.5 KiB
Desktop File

# SPDX-License-Identifier: GPL-3.0-only
# SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
[Unit]
Description=Userspace IMS/VoLTE daemon (SIP register + calls over the ims PDN)
# needs the ims PDN (multiplexed netdev + global v6) — ims-pdn-up.sh
# creates/connects the bearer through ModemManager and configures the netdev
After=ModemManager.service network.target
Wants=ModemManager.service
[Service]
Type=simple
# bring up the ims PDN first; waits for modem + network registration,
# idempotent. worst case ~14 min (2 min modem wait + 5 min registration
# gate + connect retries), hence TimeoutStartSec
ExecStartPre=/usr/libexec/ims-pdn-up.sh
TimeoutStartSec=900
# /run/imsd.env: written by ims-pdn-up.sh (DEV= the connected ims netdev,
# LOCAL= the PDN address ModemManager assigned to it).
# /etc/imsd.env: admin configuration — PCSCF= is REQUIRED (the carrier's
# P-CSCF address; see the README's Configuration section) and wins over the
# runtime-derived values.
EnvironmentFile=-/run/imsd.env
EnvironmentFile=-/etc/imsd.env
# registration state (imsreg.state) + media stats live here
StateDirectory=imsd
ExecStart=/usr/bin/imsd
# registration: resume an existing SA when possible (avoids fresh-SA
# throttles); a failed bring-up exits nonzero and systemd retries, as does
# a registered imsd whose PDN address left the netdev
Restart=on-failure
RestartSec=120
# SIGTERM: engine keeps the SA + registration state for the next resume
KillMode=mixed
TimeoutStopSec=10
[Install]
WantedBy=multi-user.target