Watch
1
0
Fork
You've already forked SouveraineOS
0
SouveraineOS/blueline/cellular/blueline-clat.sh
Fimeg 7ec2479f83 blueline: consolidate wifi bring-up, adopt cellular/MMS path, task audit
wifi: bringup unit now carries the union ordering (slpi/adsp for TZ MSA,
rmtfs+tqftpserv for firmware serving — the 2026-07-20 boot proved the old
load unit's ordering incomplete) and supersedes blueline-wifi-load;
msa-release adopted into the repo (shutdown unload that keeps warm
reboots clean).

cellular: adopt blueline-clat service+script. clat script now pins a host
route to the Fido MMS proxy via the CLAT — with wifi up the wlan default
beat the clat default and MMS died off-carrier. mmsd config contract
documented (MMS_APN must match the bearer APN ltemobile.apn; shipped as
netsvcs which matches nothing).

tasks: retire 06 qtpim (no longer the contacts path), archive 10 (done),
index catches up on 11 (archived); 01 re-pointed at a contacts-store
decision.
2026-07-20 22:21:15 -04:00

58 lines
2 KiB
Shell

#!/bin/sh
# 464XLAT launcher: derive the CLAT IPv6 address from the cellular bearer's
# current /64 (changes per attach, so it cannot live in a static config),
# then run clatd against it. PLAT prefix is discovered via DNS64 (RFC 7050).
DEV="${CLAT_WAN_DEV:-qmapmux0.0}"
ADDR=""
i=0
while [ $i -lt 30 ]; do
ADDR="$(ip -6 addr show dev "$DEV" scope global 2>/dev/null \
| awk '/inet6/ { print $2; exit }' | cut -d/ -f1)"
[ -n "$ADDR" ] && break
i=$((i + 1))
sleep 2
done
if [ -z "$ADDR" ]; then
echo "no global IPv6 on $DEV after 60s, giving up" >&2
exit 1
fi
CLAT_V6="$(python3 -c "
import ipaddress, sys
net = ipaddress.IPv6Interface('$ADDR/64').network
print(net[0xc1a7])
")" || exit 1
# RFC 7050 PLAT discovery must query the CARRIER's DNS64 servers; the system
# resolver may prefer WiFi DNS (no DNS64) and discovery would fail.
DNS64="$(nmcli -g IP6.DNS device show "$DEV" 2>/dev/null \
| sed -e 's/ | /,/g' -e 's/\\//g')"
echo "bearer $DEV prefix holds $ADDR; CLAT address $CLAT_V6; DNS64 $DNS64"
# MMS must ride the CLAT: the Fido MMS proxy (205.151.11.13, from
# ~/.mms/modemmanager/mms CarrierMMSProxy) is only reachable from inside the
# carrier network, and while WiFi is up its default route (metric 600) beats
# the CLAT default (2048) — so without this pin, MMS send/receive dies the
# moment WiFi connects. Wait for clatd to create the device, then install a
# host route (replace = idempotent; re-runs on every service restart).
(
i=0
while [ $i -lt 30 ]; do
if ip link show clat >/dev/null 2>&1; then
ip route replace 205.151.11.13/32 dev clat
exit 0
fi
sleep 1
i=$((i + 1))
done
echo "clat device never appeared; MMS proxy route not installed" >&2
) &
# v4-conncheck off: WiFi may hold a v4 default route now but drop later;
# the CLAT must exist whenever the bearer does. Route metrics keep WiFi
# preferred (clat route is metric 2048).
exec /usr/bin/clatd clat-v6-addr="$CLAT_V6" plat-dev="$DEV" \
v4-conncheck-enable=0 ${DNS64:+dns64-servers="$DNS64"}