Skip to content

omamobile-modem-sit 0.3.42: a default route on a down link no longer keeps the cellular route away - #759

Open
den-kloot wants to merge 1 commit into
derekross:mainfrom
den-kloot:omamobile-modem-sit-linkdown-route
Open

den-kloot wants to merge 1 commit into
derekross:mainfrom
den-kloot:omamobile-modem-sit-linkdown-route

Conversation

@den-kloot

@den-kloot den-kloot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

What and why

With Wi-Fi off, a short cellular dropout left the phone offline until a reboot.

What happened on a Pixel 9a: the network dropped packet registration for about four minutes. omamobile-sit-data's route watch saw the bearer go silent and removed the rmnet0 default route ("Cellular bearer carries nothing; its default route is removed"), as intended. The modem registered again and the bearer carried traffic again (incoming packets on rmnet0), but the route never came back.

The watch only puts the route back when nothing else leads out (not routed and not others). On the 9a something else always "leads out": the USB gadget's fallback route from 20-usb-gadget.network (ConfigureWithoutCarrier=yes, metric 2048) stays configured without a cable and shows up in ip -j route show default flagged linkdown. It also counted against cellular = routed and not others.

other_exits() now leaves default routes on a down link out. A route on a live link (Wi-Fi, a VPN tunnel, USB with a cable) still counts as before.

#750 also changes watch() and reads others, but it doesn't change how others is computed, so the two should combine without trouble.

Device and build

Checks (no phone needed)

  • tools/pr-check upstream/main passes
  • tests/all passes: not run. CI will show it.
  • tests/packages passes for the package I touched: packages/omamobile-modem-sit/test/all (scripts parse, unit tests plus RIL against sit-sim, staged layout). There is a new unit test, test_a_route_on_a_down_link_is_no_other_exit.
  • Each changed package has its version bumped, and the new version is in the commit subject
  • Commits have area prefixes and bodies that say why; any AI help is a Co-Authored-By: or Assisted-by: trailer, never a Signed-off-by:

On the phone

  • I ran this on my own phone: the same change applied to the installed 0.3.35 data_network.py, then omamobile-sit-data restarted
  • Test: Wi-Fi off, no USB cable, ip route del default dev rmnet0 metric 700. Within a second the journal shows "Nothing else leads out; the cellular default route is back", the route is back (next to the linkdown usb0 route), and HTTPS works. Without the fix the same situation stayed offline for 7 minutes, until a reboot.
  • What I did not test: a real dropout with the fix in place (there hasn't been one since). Also not the silent-bearer path end to end (looks_silent plus a failed ping), only the route coming back. Not tested on other phones, but the change is device-independent.
  • Nothing in this change writes outside slot B and userdata, weakens the storage guard, or reads registers from userspace (AGENTS.md §1)

🤖 Generated with Claude Code

@derekross

Copy link
Copy Markdown
Owner

Thank you for finding this, and for the careful write-up: a route on a link with no cable counting as a way out is an easy thing to miss, and your test on the 9a shows it plainly.

It isn't only the 9a's: the Pixel 7 Pro's 20-usb-gadget.network has the same ConfigureWithoutCarrier=yes fallback route, as do the other device packages, so every phone with the cable out has this problem, and every phone gets the fix. That's good, but it means I'd like to look at all of what it changes on mine before it merges.

  1. Please rebase onto today's main. omamobile-modem 0.1.26, omamobile-modem-sit 0.3.40, device-cheetah 0.1.57, omamobile-shell 0.2.131: sleep with the modem up on by default on the 7 Pro (carries #555 and #556) #791 added the sleep hold to data_network.py and its test, so the branch now conflicts on the import line of test/test_data_network.py (and the version). Taking both sides works: from data_network import Resolver, SleepHold, configuration, counters, guarded, looks_silent, other_exits, sleep_signal. With that, the package's tests pass on top of main. I'll set the version when I merge (0.3.42 if omamobile-modem-sit 0.3.41: a mistyped nr_after_radio_on keeps the default order #760 goes in first), so don't worry about the number.

  2. The same list feeds two more decisions in watch(), and both change with the cable out:

    Could you add one test for either of these, for example that a linkdown USB route plus the bearer's route gives cellular true, or that the hold waits the grace when the only other route is linkdown?

  3. A run on today's code. Your run used the change copied into 0.3.35. Once it's rebased I'll run it on my Pixel 7 Pro with the cable out (Wi-Fi off, the route removed by hand, then a look at the route, the DNS in use and one lookup), since this is a behaviour change on the reference phone too. If you can repeat your own check with a build of the rebased branch on the 9a, that would cover both phones.

Thanks again; this one will likely help a lot of people who use their phones away from home.

…keeps the cellular route away

After a silent spell (the network dropped packet registration for four minutes) omamobile-sit-data removed the cellular default route as intended, but never put it back once the bearer carried traffic again: it only re-adds the route when nothing else leads out, and the USB gadget's fallback route (20-usb-gadget.network, ConfigureWithoutCarrier=yes, metric 2048) is always there, flagged linkdown without a cable. On a Pixel 9a with Wi-Fi off the phone stayed offline until a reboot. Routes on a down link now count as no other exit.

The other device packages carry the same fallback route, so this changes two more things on every phone with the cable out, both decided from the same list:

- The carrier's DNS. "cellular = routed and not others" was never true on mobile data without a cable and without Wi-Fi, because the USB route counted as another way out, so the carrier's DNS was never used there. Now it is, which is what the resolver was written for.
- The return after a sleep (SleepHold, derekross#791). With the USB route counted, the cellular route came back at once after every sleep, logged as "behind Wi-Fi" even with Wi-Fi off. Now it waits for a route that leads out, or the 10 s grace, as intended.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@den-kloot
den-kloot force-pushed the omamobile-modem-sit-linkdown-route branch from 3be26d3 to b41dd2d Compare November 15, 2026 07:40
@den-kloot den-kloot changed the title omamobile-modem-sit 0.3.39: a default route on a down link no longer keeps the cellular route away omamobile-modem-sit 0.3.42: a default route on a down link no longer keeps the cellular route away Nov 15, 2026
@den-kloot

Copy link
Copy Markdown
Contributor Author

Thanks for looking at what else the list feeds; I had only followed it to the route.

Rebased onto main (ad58709c), head b41dd2dc.

  1. Rebase. The import line is the one you gave. version says 0.3.42; set whatever fits when you merge.

  2. The two other decisions. The commit message now names both: the carrier's DNS is used on mobile data with the cable out and Wi-Fi off, and after a sleep the route waits for a route that leads out or the 10 s grace, where the USB route used to bring it back at once. The new test is test_after_a_sleep_a_route_on_a_down_link_does_not_end_the_wait: with only the linkdown USB route the hold waits, with Wi-Fi beside it the route returns at once, and without Wi-Fi it returns after the grace.

  3. A run on the 9a with the rebased file (2026-11-15, 7.3.0-rc6, cable out). One limit to say first: the phone's package is 0.3.35, and I put only the rebased data_network.py over it. The unit and omamobile-sit-data are the same in 0.3.35 and main, and the modules it imports are too apart from paths.py's follow_screen, so the service ran today's code, but sitd did not.

    Step Result
    Wi-Fi off, the linkdown usb0 route still there "Default internet path cellular" 0.7 s later
    The DNS in use rmnet0: Default Route: yes, the carrier's two servers
    ip route del default dev rmnet0 metric 700 back after 0.58 s ("Nothing else leads out; the cellular default route is back")
    resolvectl query example.org after a cache flush answered over rmnet0 in 43 ms
    curl https://example.org 200

    Not run on the phone: the return after a sleep. That is in the unit test only.

    One thing the journal shows that isn't from this change: for the half second without the route it logs "Default internet path Wi-Fi/other", because "not cellular" is worded that way even when nothing leads out.

@derekross

Copy link
Copy Markdown
Owner

Thank you, this is everything I asked for: the rebase, a commit message that says what changes on every phone, and a test for the sleep hold. Your 9a table is very clear, including the honest note that sitd itself was still 0.3.35. I checked that both new tests fail when the filter goes back to main's.

Two things on my side before it merges:

  1. My Pixel 7 Pro run with the cable out, as I said. My phone is in the middle of a sleep test today, so it'll be after that. I'll run it on a build that also has omamobile-modem-sit 0.3.42: set the internet bearer up again when the modem drops it #817 (the internet bearer set up again when the modem drops it), because that's the order they'll merge in. The two fit together well. When the modem drops the bearer, omamobile-modem-sit 0.3.42: set the internet bearer up again when the modem drops it #817 stops and restarts the route service, so the route comes back from the fresh start. When the bearer stays, or the modem lists it again, it's your change that puts a removed route back on a phone with no cable.
  2. The version. omamobile-modem-sit 0.3.42: set the internet bearer up again when the modem drops it #817 also says 0.3.42, and since both branches write the same line, git wouldn't flag it. I'll set the number when I merge (0.3.43 or 0.3.44, depending on whether omamobile-modem-sit 0.3.43: a call the modem no longer lists ends here, sitd keeps running #754 goes first) and update the title to match, so there's nothing for you to do.

The "Wi-Fi/other" wording you noticed for the moment with no route at all is worth a small follow-up if you feel like it, but not here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants