fix(netwatch): detect IPv6 default routes on Linux#132
Merged
Conversation
4 tasks
|
Documentation for this PR has been generated and is available at: https://n0-computer.github.io/net-tools/pr/132/docs/net_tools/ Last updated: 2026-04-13T09:07:33Z |
d3ddb83 to
3139478
Compare
3139478 to
42d8b42
Compare
dignifiedquire
approved these changes
Apr 10, 2026
Closed
11 tasks
e0e2249 to
b0bbcce
Compare
Frando
added a commit
that referenced
this pull request
Apr 13, 2026
## Description Add patchbay tests that exercise netwatch's interface and route detection inside virtual network namespaces. The tests cover v4-only, v6-only, dual-stack, and v4-to-v6 replug scenarios. Also adds patchbay CI workflow, nextest patchbay profile, and a cargo-make task to match the iroh project's patchbay setup. ## Notes & open questions Two of the four tests are currently ignored: they expose a bug where default_route() fails to detect IPv6 default routes on Linux because /proc/net/route only contains IPv4 entries and the netlink fallback is never reached. See #132 for a fix. <!-- Any notes, remarks or open questions you have to make about the PR. --> ## Change checklist - [ ] Self-review. - [ ] Documentation updates following the [style guide](https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html#appendix-a-full-conventions-text), if relevant. - [ ] Tests if relevant. - [ ] All breaking changes documented.
default_route() reads /proc/net/route first, which contains only IPv4 entries. When no IPv4 default route exists it returns Ok(None), and the code treated any Ok result as final without falling through to the netlink-based detection that handles both address families. On a v6-only network this made default_route_interface permanently None, which caused iroh's has_usable_network() to return false after network switches. The 5-second debounce timeout would expire before the QUIC stack learned about the change, leaving connections stuck on dead paths. The fix narrows the early return to Ok(Some(..)) so that Ok(None) falls through to the netlink path.
b0bbcce to
3e2f897
Compare
dignifiedquire
approved these changes
Apr 13, 2026
Frando
added a commit
to n0-computer/iroh
that referenced
this pull request
Apr 14, 2026
## Description Adds a patchbay test matrix for testing uplink switching across IP family transitions (v4/v6/dual-stack) for both client and server side. Each test holepunches a direct path, replugs the switching side to a different router, and verifies that a new direct path is selected and data flows over it. The tests all pass. Initially, the server side tests failed, and this uncovered two issues which are now fixed: * We currently fail to detect the default route when switching to a v6-only interface in netwatch, see n0-computer/net-tools#132. This leads to iroh not forwarding the major network change to quinn, because we only do this if we determine the network to be usable, which fails because the default route check fails. * noq's `handle_network_change` only checks whether a path is recoverable on the client side; the server side always assumed paths were recoverable, so dead direct paths were never proactively abandoned after a server replug. See n0-computer/noq#579
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
default_route()is special-cased on linux to not use rtnetlink but read/proc/net/routefirst, which contains only IPv4 entries. When no IPv4 default route exists it returnsOk(None), and the code treated any Ok result as final without falling through to the netlink-based detection that handles both address families.On a v6-only network this made default_route_interface permanently
None, which caused iroh'shas_usable_network()to return false after network switches.The fix narrows the early return to Ok(Some(..)) so that Ok(None) falls through to the netlink path.
Breaking Changes
Notes & open questions
Why do we even special case linux here and not just rely on rtnetlink always?
Change checklist