Skip to content

fm350gl: parse +CGCONTRDP leniently and reuse an already active context - #11

Closed
pjeweb wants to merge 1 commit into
mainfrom
osb/pr/fm350gl-cgcontrdp
Closed

pjeweb wants to merge 1 commit into
mainfrom
osb/pr/fm350gl-cgcontrdp

Conversation

@pjeweb

@pjeweb pjeweb commented Nov 23, 2026

Copy link
Copy Markdown

This fixes FM350-GL data connections on T-Mobile US. The module answers +CGCONTRDP with an empty bearer id, which the generic ModemManager parser rejects, so the first connection fails right after +CGACT succeeds. The attach bearer stays active, and every retry is then refused with +CME ERROR: 5847 until the module is reset. BELABOX's original plugin tolerated this answer; the 1.24 forward-port in patch 0001 lost that when it switched to the generic parser.

  • The fm350gl bearer parses +CGCONTRDP itself: lines matched by cid and address family, empty bearer id, IPv6 in dotted decimal, quoted fields that contain commas, and the MTU field.
  • IPv4 DNS comes from the IPv4 line and IPv6 DNS from the IPv6 line.
  • A missing or unparsable +CGCONTRDP only logs a warning, since +CGPADDR already gave the address (IPv4 falls back to a /32 with the address as gateway and no DNS).
  • When +CGACT=1,<cid> fails with 5847 and +CGACT? reports that cid active, the bearer reuses the context. +CGPADDR still has to return an address of the requested family.

The change is folded into patch 0001, the same way the earlier ATZ0 fix was, so the series stays at three patches. Its DEP-3 header describes the new parts, and the ADR has a new section on the regression. The patch contract now also fails if the bearer goes back to the generic parser or loses the regression test.

Testing and limits
  • The series applies cleanly to the pinned modemmanager_1.24.2.orig.tar.xz (sha256 checked) and gives exactly the tree I built and tested.
  • Built in Debian trixie with -Wall -Wextra, no new warnings. test-plugin-fm350gl: 16/16, including the T-Mobile and Verizon answers (addresses replaced with documentation ranges), all-contexts output with IMS lines, the old addr.mask layout, malformed input and the 5847 classification. Also clean under ASan, UBSan and LeakSanitizer.
  • Full meson test: 31 of 32 pass. test-plugin-generic fails in that container both before and after this change, because it needs a running daemon.
  • packaging/ci/contract.sh passes in a trixie container. The new contract checks fail against the old patch.
  • Not tested on hardware yet. On T-Mobile I expect IPv4 (static /32 from +CGPADDR) to carry data. IPv6 over RNDIS needed SLAAC on the host in earlier manual tests, so it needs a separate check.
  • No upstream MR: ModemManager has no fm350gl plugin, and this stays inside the existing owner-approved carry.

On T-Mobile US the FM350 answers +CGCONTRDP with an empty bearer id and
one line per IP family. The generic parser the forward-port switched to
requires a number there, so every first connection failed after +CGACT
had activated the attach bearer, and every retry was refused with CME
error 5847 because that context was still active.

The bearer now parses the answer itself (by cid and address family,
dotted-decimal IPv6, quoted fields with commas, MTU), takes IPv4 and IPv6
DNS from their own lines, and only warns when the answer is missing or
unparsable, since +CGPADDR already gave the address. A +CGACT=1 refused
with 5847 reuses the context when +CGACT? reports it active.

The change is folded into patch 0001, so the series stays at three
patches. The patch contract now also requires the bearer's own parser
and its empty-bearer-id test.
@pjeweb pjeweb added the upstream: waits for intent Needs an issue or maintainer agreement before an upstream proposal. label Nov 23, 2026
@pjeweb

pjeweb commented Nov 23, 2026

Copy link
Copy Markdown
Author

Superseded by the upstream PR CERALIVE#36, which carries the lenient +CGCONTRDP parser from this branch after review. The reuse of an already active context on CME error 5847 was dropped there because it could not reliably tell which APN the active context belonged to.

@pjeweb pjeweb added upstream: open An upstream pull request exists; see the linked comment for its current state. superseded Replaced or retired; follow the linked successor instead. and removed upstream: waits for intent Needs an issue or maintainer agreement before an upstream proposal. labels Nov 23, 2026
@pjeweb pjeweb closed this Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

superseded Replaced or retired; follow the linked successor instead. upstream: open An upstream pull request exists; see the linked comment for its current state.

Development

Successfully merging this pull request may close these issues.

1 participant