Commit ee78667
authored
fix(netwatch): detect IPv6 default routes on Linux (#132)
## Description
`default_route()` is special-cased on linux to not use rtnetlink but
read `/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 fix narrows the early return to Ok(Some(..)) so that Ok(None) falls
through to the netlink path.
<!-- A summary of what this pull request achieves and a rough list of
changes. -->
## Breaking Changes
<!-- Optional, if there are any breaking changes document them,
including how to migrate older code. -->
## Notes & open questions
Why do we even special case linux here and not just rely on rtnetlink
always?
## 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.1 parent ae5833e commit ee78667
2 files changed
Lines changed: 5 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
45 | | - | |
46 | | - | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
47 | 49 | | |
48 | 50 | | |
49 | 51 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
55 | 54 | | |
56 | 55 | | |
57 | 56 | | |
| |||
75 | 74 | | |
76 | 75 | | |
77 | 76 | | |
78 | | - | |
79 | 77 | | |
80 | 78 | | |
81 | 79 | | |
| |||
0 commit comments