Repository navigation
wgengine/magicsock: treat EADDRNOTAVAIL as transient when reading - #22223
Merged
Merged
Conversation
nbeirne
commented
Nov 6, 2026
|
|
||
| // IsTransientReadError reports whether err is a UDP read error that may | ||
| // clear up if the socket is read again later. | ||
| func IsTransientReadError(err error) bool { |
Contributor
Author
There was a problem hiding this comment.
This function exists only for the 1.104.6 release. #22183 inverts the close condition on the read loop to retry every error except net.ErrClosed, rather than only the transient ones. That is a larger change though, and this change focuses on the immediate issue.
nbeirne
force-pushed
the
nbeirne/handle-eaddrnotavail
branch
2 times, most recently
from
November 6, 2026 22:05
6510d3a to
03123da
Compare
jwhited
approved these changes
Nov 7, 2026
A customer noticed that UDP reads returned EADDRNOTAVAIL during a link change while the interface had no IPv4 address. magicsock returned the error to wireguard-go, which treated it as permanent and shut down the receive loop. magicsock now retries the read when EADDRNOTAVAIL is returned on Unix. Each error is counted in the magicsock_recv_udp_error_unknown metric. EADDRNOTAVAIL isn't a documented result of a UDP recv. We suspect that certain macOS network extensions return it while the network interface is mid-change and has no address. We expect the error to stop once the interface has an address again. A short delay between retries prevents magicsock from spinning when the address doesn't come back right away. Updates #22097 Change-Id: I70790f78d9488999ce00f9685aec3f0fabc15699 Signed-off-by: Nick Beirne <[email protected]>
nbeirne
force-pushed
the
nbeirne/handle-eaddrnotavail
branch
from
November 9, 2026 15:46
03123da to
fcd30c0
Compare
illotum
approved these changes
Nov 9, 2026
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.
A customer found that reads return EADDRNOTAVAIL during a LinkChange. In the period where there was no IPv4 address, the read returned EADDRNOTAVAIL. magicsock returned the error to wireguard-go, which treated it as permanent, and stopped the receive loop.
This fix makes EADDRNOTAVAIL retry the read instead of exiting. These errors are counted in the magicsock_recv_udp_error_transient metric.
Updates #22097