Repository navigation
device packages: make USB the last gateway, not the first - #102
Conversation
|
Thanks for tracking this down; IPv4 going into a dead cable is a nasty one to notice. The reasoning holds on my Pixel 7 Pro too: 600 and 700 are really our Wi-Fi and mobile-data metrics, Because this changes the reference phone's package, I'll run it on my cheetah before merging: a Two things from you:
A |
|
Tested the shipped file on raven ( |
|
One more package for this PR: the Pixel 7a's device package ( |
20-usb-gadget.network gave usb0 the laptop as its Gateway=, which networkd installs as the default route at metric 0, ahead of Wi-Fi (600) and mobile data (700). With ConfigureWithoutCarrier=yes the route stays after an unplug, and usb0 keeps its carrier then anyway. So once the phone left the desk, IPv4 still went into the dead cable: on raven, github.com (IPv4 only) failed on Wi-Fi while sites with IPv6 loaded. The gateway is now a [Route] at metric 2000: the laptop's shared connection is the fallback when there is no Wi-Fi or mobile data, and SSH over the cable is unaffected (it uses the link's own subnet). Both packages' tests check that usb0 sets no metric-0 default route. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
felix and husky ship the same 20-usb-gadget.network as raven and cheetah, with the laptop as usb0's Gateway= at metric 0, a route that outlives an unplug. They get the same fix: the gateway is a [Route] at metric 2000, after Wi-Fi (600) and mobile data (700), and the same test. Not tested on those phones. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lynx's package (derekross#88) ships the same 20-usb-gadget.network as the others, with the laptop as usb0's Gateway= at metric 0, a route that outlives an unplug. It gets the same fix: the gateway is a [Route] at metric 2000, after Wi-Fi (600) and mobile data (700), and the same test. Not tested on a Pixel 7a. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
13427b5 to
40a9a82
Compare
|
Added lynx in |
|
Thanks for adding the Pixel 7a and for testing the shipped file on raven behind an undo timer. That's the check I was after. The five Next I'll run it on my Pixel 7 Pro, under a timer that undoes the change, and then merge. At the squash I'll set the other four versions to the next free ones and put them all in the subject, so there's nothing more you need to do here. |
|
Tested on a Pixel 7 Pro (cheetah): A probe on the phone logged every 3-4 s:
The unplug and replug times below are from the laptop's kernel log. Before, with the package's file (
After, with this PR's cheetah file. The file was byte for byte the one at
Not tested: a package built from this branch, a reboot with it, and the other phones' files. |
|
Thanks for keeping this current with main. And thank you, Jeremy, for the Pixel 7 Pro run: reproducing #103 with the package's file first, then fixing it with this PR's file behind an undo timer, is exactly the evidence this change needed on that phone. All five changed files and their tests pass here, and so does CI. One more package, I'm afraid: the Pixel 7's device package ( On my side, I'll run the cheetah file on my own Pixel 7 Pro under an undo timer, as planned, then merge. At the squash I'll put the versions in the subject and write the message myself, so the merge commit from main doesn't land in it. |
|
Ran it on my Pixel 7 Pro as planned: the PR's cheetah file as a |
panther shipped the same 20-usb-gadget.network with Gateway= under [Network]; it gets felix's [Route] block at metric 2000 and the same test. Versions: cheetah 0.1.35, raven 0.1.28, felix 0.1.5, husky 0.1.1, panther 0.1.2 (lynx was already 0.2.1). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks again, both of you. Since I hadn't heard back on the Pixel 7's file, I added it myself with the same |
|
Thanks you so much @derekross |
|
You're welcome 🫂🤙🏻💜 |
…e-husky 0.1.1, device-lynx 0.2.1, device-panther 0.1.2: USB is the last gateway (derekross#102) usb0's network file set Gateway= under [Network], a metric-0 default route ahead of Wi-Fi (600) and mobile data (700). Its route outlives an unplug, so with the cable out IPv4 went into a dead link (derekross#103). Each device package now puts the gateway in a [Route] at metric 2000, so USB is the last way out; each package test checks it. Tegu already had its gateway in a [Route] at 2048. Behaviour change: with a SIM and no Wi-Fi, traffic now goes over mobile data rather than the laptop. Tested on two Pixel 7 Pros (2026-10-30): with the file as a /run override behind an undo timer, Wi-Fi at 600 and usb0 at 2000, route to 1.1.1.1 via Wi-Fi, HTTPS to github.com 200, the laptop link still up; one owner's unplug test kept IPv4 working. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The USB gadget network gives usb0 the laptop as its
Gateway=, so networkd makes it the default route at metric 0, ahead of Wi-Fi (600) and mobile data (700). WithConfigureWithoutCarrier=yesthat route survives an unplug, so once the phone leaves the desk, IPv4 still goes into the dead cable. On raven, github.com (IPv4 only) failed on Wi-Fi while sites with IPv6 loaded fine.The gateway is now a
[Route]at metric 2000, so the laptop's shared connection is only the fallback. SSH over the cable is unaffected, since it uses the link's own subnet. raven, cheetah, felix and husky ship the same20-usb-gadget.network, so all four get the change, and each package's tests now check that usb0 sets no metric-0 default route. Version bumps are left out.Tested on raven by moving the route to metric 2000 live: github.com then went out over Wi-Fi, and SSH over USB kept working. cheetah, felix and husky are untested.
tools/pr-checkpasses.Fixes #103.
🤖 Generated with Claude Code