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

Closed
gopherbot opened this issue Jul 26, 2022 · 4 comments
Labels
CherryPickApproved Used during the release process for point releases FrozenDueToAge
Milestone

Comments

@gopherbot
Copy link

@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 Used during the release process for point releases label Aug 10, 2022
@gopherbot gopherbot removed the CherryPickCandidate Used during the release process for point releases label Aug 10, 2022
@gopherbot
Copy link
Author

Change https://go.dev/cl/425488 mentions this issue: [release-branch.go1.18] net: fix WriteMsgUDPAddrPort addr handling

@gopherbot
Copy link
Author

Closed by merging bf812b3 to release-branch.go1.18.

gopherbot pushed a commit that referenced this issue Aug 26, 2022
WriteMsgUDPAddrPort should accept IPv4 target addresses on IPv6 UDP sockets.
An IPv4 target address will be converted to an IPv4-mapped IPv6 address.

Include the change in CL 420775 to also skip the test on DragonflyBSD.

Updates #52264.
Fixes #54074.

Change-Id: Ib9ed4c61fa1289ae7bbc8c4c9de1a9951b647ec0
GitHub-Last-Rev: 6776fdb
GitHub-Pull-Request: #52265
Reviewed-on: https://go-review.googlesource.com/c/go/+/399454
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-on: https://go-review.googlesource.com/c/go/+/425488
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
@golang golang locked and limited conversation to collaborators Aug 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CherryPickApproved Used during the release process for point releases FrozenDueToAge
Projects
None yet
Development

No branches or pull requests

4 participants