Skip to content

fix(iroh): Use valid available IPv6 address, ignoring have_ipv6 #3419

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 1, 2025

Conversation

matheus23
Copy link
Member

Description

Sometimes net_report says udp_v6: false, even though I can clearly send and receive to/from the other iroh endpoint I want to talk to.
Here are some logs from that situation:

2025-07-29T10:15:43.281088Z DEBUG ep{me=68b3f4f4cc}:actor: iroh::net_report: generated report in 728ms report=Report { udp_v4: true, udp_v6: false, mapping_varies_by_dest_ipv4: Some(false), mapping_varies_by_dest_ipv6: None, preferred_relay: Some(RelayUrl("[https://euc1-1.relay.n0.iroh.iroh.link./")](https://euc1-1.relay.n0.iroh.iroh.link./%22))), relay_latency: RelayLatencies { ipv4: {RelayUrl("[https://aps1-1.relay.n0.iroh.iroh.link./"](https://aps1-1.relay.n0.iroh.iroh.link./%22)): 182.188896ms, RelayUrl("[https://euc1-1.relay.n0.iroh.iroh.link./"](https://euc1-1.relay.n0.iroh.iroh.link./%22)): 21.317467ms, RelayUrl("[https://use1-1.relay.n0.iroh.iroh.link./"](https://use1-1.relay.n0.iroh.iroh.link./%22)): 117.29417ms}, ipv6: {}, https: {} }, global_v4: Some(176.199.xxx.xxx:26608), global_v6: None, captive_portal: None }
2025-07-29T10:15:55.933530Z DEBUG ep{me=68b3f4f4cc}:disco_in{node=e10b5cdea1 src=Ip([2a01:599:b2f:a1ad:495a:8b14:xxxx:xxxx]:49154)}:handle_disco{dm=Pong(Pong { tx_id: TransactionId(0xBC381DA98EFD2B20CAE0A96E), ping_observed_addr: Udp([2a02:8071:d85:19c0:9676:965:xxxx:xxxx]:38391) })}:handle_pong{m=Pong { tx_id: TransactionId(0xBC381DA98EFD2B20CAE0A96E), ping_observed_addr: Udp([2a02:8071:d85:19c0:9676:965:xxxx:xxxx]:38391) } src=Udp([2a01:599:b2f:a1ad:495a:8b14:xxxx:xxxx]:49154)}: iroh::_events::holepunched: remote_node=e10b5cdea1 path=[2a01:599:b2f:a1ad:495a:8b14:xxxx:xxxx]:49154 direction="outgoing"

Now, the udp_v6: false value originally comes from netwatch's InterfaceState, as it sees my (what is now and probably was at the time fe80-prefixed) link-local address and characterizes it as "not reachable from the public internet".

But this PR instead ignores that value iff we have any UdpSendAddr::Valid, since that would mean it's an address that we've successfully sent and received from with the particular peer we care about.

Change checklist

  • Self-review.

@matheus23 matheus23 self-assigned this Jul 30, 2025
Copy link

github-actions bot commented Jul 30, 2025

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

Last updated: 2025-08-01T09:44:29Z

Copy link

github-actions bot commented Jul 30, 2025

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: 71d77c2

@n0bot n0bot bot added this to iroh Jul 30, 2025
@github-project-automation github-project-automation bot moved this to 🏗 In progress in iroh Jul 30, 2025
@matheus23 matheus23 marked this pull request as ready for review August 1, 2025 07:50
@matheus23
Copy link
Member Author

Unfortunately further testing didn't have the intended result: I wasn't able to reproduce the case I had above where I was magically able to send/receive IPv6 traffic to someone else's home address, but not to the relays (which I agree is very unusual).

In any case, I still believe this is a valid change. If we end up for some reason having a valid IPv6 addr, we should probably use it.
If it's the case that it's only valid because we had IPv6 in the past, but not in the future, then it'll become invalid after 6.5 seconds and we'll use a valid/outdated/unconfirmed IPv4 address instead then.

@matheus23 matheus23 enabled auto-merge August 1, 2025 09:43
@matheus23 matheus23 added this pull request to the merge queue Aug 1, 2025
Merged via the queue into main with commit fe7240d Aug 1, 2025
29 checks passed
@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in iroh Aug 1, 2025
@matheus23 matheus23 deleted the matheus23/use-ipv6-if-valid branch August 1, 2025 10:18
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.

2 participants