Skip to content
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

net: WriteMsgUDPAddrPort should accept IPv4 destination addresses on IPv6 UDP sockets [1.18 backport] #54074

Open
gopherbot opened this issue Jul 26, 2022 · 2 comments
Labels
CherryPickApproved
Milestone

Comments

@gopherbot
Copy link

gopherbot commented Jul 26, 2022

@bradfitz requested issue #52264 to be considered for backport to the next 1.18 minor release.

@gopherbot, please backport to Go 1.18.

@dmitshur
Copy link
Contributor

dmitshur commented Aug 3, 2022

@bradfitz Can you please include a backport rationale in this backport request issue (per https://go.dev/wiki/MinorReleases), and comment if there's a good workaround available? Thanks.

@bradfitz
Copy link
Contributor

bradfitz commented Aug 4, 2022

WriteMsgUDPAddrPort is kinda unusable otherwise. It didn't work when you did a net.Listen("udp", ":n") instead of "udp4" and then tried to send a UDP packet to an IPv4 address, as the operating system might've opened a unspecified address listener and it depends on the OS type & configuration on whether it supported IPv6 too. If it did, the v4 send wouldn't work.

Workaround is to use old APIs, or try the call twice both ways (at which point you're better off using the old APIs, as the retry's error garbage negated all the benefits of the new API's alloc-free properties).

As this is new-sh API, it's also low risk to fix. No behavior change for the path where it worked previously. It only makes things that would've failed now work.

@joedian joedian added the CherryPickApproved label Aug 10, 2022
@gopherbot gopherbot removed the CherryPickCandidate label Aug 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CherryPickApproved
Projects
None yet
Development

No branches or pull requests

4 participants