Skip to content

fix: improve holepunching after network changes#3928

Merged
flub merged 33 commits intomainfrom
flub/network-change
Mar 24, 2026
Merged

fix: improve holepunching after network changes#3928
flub merged 33 commits intomainfrom
flub/network-change

Conversation

@flub
Copy link
Copy Markdown
Contributor

@flub flub commented Feb 11, 2026

Description

When the network changes we should recover our connection and
holepunch again. Because quinn now tracks 4-tuples a lot of network
paths would turn into black holes because the source address would no
longer match.

This hooks up network changes to quinn so that it will close and open
new paths correctly when this happens. This should result in most
paths not being validated after a network change which in turn means
any new ADD_ADDRESS and REACH_OUT frames will be sent on the validated
path instead of a path that is no longer functional.

Breaking Changes

n/a

Notes & open questions

The first few commits do some renaming and documenting of stuff that's not
strictly required. It was nicer and easier to build on top of that. If
you, the reviewer, would prefer I can split those off into a refactoring
PR and base this one on top of that.

Change checklist

  • I still need to check if the server updates quinn so it can do
    the correct ADD_ADDRESS and REMOVE_ADDRESS stuff.
  • I still need to check the sequencing of the above so things
    happen in the correct order.
  • Investigate endpoint_relay_connect_loop test failure
  • Self-review.
  • Documentation updates following the style guide, if relevant.
  • Tests if relevant.

@flub flub marked this pull request as draft February 11, 2026 17:42
@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 11, 2026

Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/3928/docs/iroh/

Last updated: 2026-03-24T10:32:57Z

@n0bot n0bot bot added this to iroh Feb 11, 2026
@github-project-automation github-project-automation bot moved this to 🚑 Needs Triage in iroh Feb 11, 2026
@flub flub linked an issue Feb 12, 2026 that may be closed by this pull request
}
}
PathEvent::Closed { id, .. } | PathEvent::LocallyClosed { id, .. } => {
PathEvent::LocallyClosed { id, .. } => {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm reading things correctly, this event is only emitted when we opened a path, and the PathOpen timer fires without the path being established by then. So I think the below code should also run on PathEvent::Abandoned so that if one connection abandones a path, this is forwarded to all other connections?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm postponing thinking about this for #3930

@ramfox ramfox added this to the iroh: v0.97 milestone Feb 17, 2026
@ramfox ramfox moved this from 🚑 Needs Triage to 🏗 In progress in iroh Feb 17, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 25, 2026

Netsim report & logs for this PR have been generated and is available at: LOGS
This report will remain available for 3 days.

Last updated for commit: e0e7bba

flub added 2 commits February 25, 2026 18:00
- relay paths are **always** recoverable
- ip paths are recoverable when the local ip is not set
flub added a commit that referenced this pull request Feb 26, 2026
I can't work with obscure names that seem obvious to the persons
writing them, so add doc comments explaining how things works.

The RemoteStateActor did get a bit messy from all the changes. Make
functions follow the naming conventions again, move them to their more
logically grouped places and rename and document for clarity.

Finally netmon, netwatch etc are all just meaningless names to
me. Even after all this time. Name the variables and fields after the
information they actually contain.

This is all noise from #3928 that I'm splitting off so that that PR
can contain just the relevant changes (and is easier to rebase/merge
main).
github-merge-queue bot pushed a commit that referenced this pull request Feb 26, 2026
## Description

I can't work with obscure names that seem obvious to the persons
writing them, so add doc comments explaining how things works.

The RemoteStateActor did get a bit messy from all the changes. Make
functions follow the naming conventions again, move them to their more
logically grouped places and rename and document for clarity.

Finally netmon, netwatch etc are all just meaningless names to
me. Even after all this time. Name the variables and fields after the
information they actually contain.

## Breaking Changes

n/a

## Notes & open questions

This is all noise from #3928 that I'm splitting off so that that PR
can contain just the relevant changes (and is easier to rebase/merge
main).

## Change checklist

- [x] Self-review.
- [x] 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.
divagant-martian and others added 7 commits March 4, 2026 09:16
# Conflicts:
#	Cargo.lock
#	Cargo.toml
#	iroh/src/socket.rs
#	iroh/src/socket/remote_map/remote_state.rs
- Use FourTuple accessors instead of private field access
- Use n0_future::time::sleep_until for wasm compat
- Gate default_route_interface access behind cfg(not(wasm))
- Fix "addreses" typo
@dignifiedquire dignifiedquire self-assigned this Mar 23, 2026
aws-lc-rs 1.16.2 no longer uses the OpenSSL license, and cargo-deny
treats unmatched license allowances as errors.
@dignifiedquire dignifiedquire marked this pull request as ready for review March 23, 2026 18:19
@flub flub added this pull request to the merge queue Mar 24, 2026
Merged via the queue into main with commit cc21f51 Mar 24, 2026
55 of 56 checks passed
@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in iroh Mar 24, 2026
@flub flub deleted the flub/network-change branch March 24, 2026 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

When switching from 5G to Wi-Fi iroh does not switch from relay to direct connection Holepunch after networks changes

5 participants