[go] syscall: make LoadConnectEx not IPv4-specific on Windows

1 view
Skip to first unread message

Gerrit Bot (Gerrit)

unread,
Dec 2, 2025, 8:54:24 PM (7 hours ago) Dec 2
to goph...@pubsubhelper.golang.org, Lin Lin, golang-co...@googlegroups.com

Gerrit Bot has uploaded the change for review

Commit message

syscall: make LoadConnectEx not IPv4-specific on Windows

Fixes #29759
Change-Id: Ia3b3d81701c75b5bb86b1308ce1afa4ee4ef8dbf
GitHub-Last-Rev: 9cd976861dc1e3befc88260ce6f9cc2cf0125d0e
GitHub-Pull-Request: golang/go#76667

Change diff

diff --git a/src/syscall/syscall_windows.go b/src/syscall/syscall_windows.go
index 3e63897..4eb2b4d 100644
--- a/src/syscall/syscall_windows.go
+++ b/src/syscall/syscall_windows.go
@@ -14,6 +14,7 @@
"internal/oserror"
"internal/race"
"internal/strconv"
+ strings "internal/stringslite"
"sync"
"unsafe"
)
@@ -1097,7 +1098,21 @@

func LoadConnectEx() error {
connectExFunc.once.Do(func() {
- var s Handle
+ var (
+ s Handle
+ err error
+ )
+ s, err = Socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)
+ if err != nil {
+ // This can occur when IPv4 is disabled. See https://go.dev/issue/29759.
+ if strings.Index(err.Error(), "address incompatible with the requested protocol was used") >= 0 {
+ s, err = Socket(AF_INET6, SOCK_STREAM, IPPROTO_TCP)
+ }
+ connectExFunc.err = err
+ if err != nil {
+ return
+ }
+ }
s, connectExFunc.err = Socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)
if connectExFunc.err != nil {
return

Change information

Files:
  • M src/syscall/syscall_windows.go
Change size: S
Delta: 1 file changed, 16 insertions(+), 1 deletion(-)
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newchange
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: Ia3b3d81701c75b5bb86b1308ce1afa4ee4ef8dbf
Gerrit-Change-Number: 726101
Gerrit-PatchSet: 1
Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
Gerrit-CC: Lin Lin <linsite...@gmail.com>
unsatisfied_requirement
satisfied_requirement
open
diffy

Gopher Robot (Gerrit)

unread,
Dec 2, 2025, 8:54:25 PM (7 hours ago) Dec 2
to Lin Lin, Gerrit Bot, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

Gopher Robot added 1 comment

Patchset-level comments
File-level comment, Patchset 1 (Latest):
Gopher Robot . unresolved

I spotted some possible problems with your PR:

  1. The commit message body is very brief. That can be OK if the change is trivial like correcting spelling or fixing a broken link, but usually the description should provide context for the change and explain what it does in complete sentences.

Please address any problems by updating the GitHub PR.

When complete, mark this comment as 'Done' and click the [blue 'Reply' button](https://go.dev/wiki/GerritBot#i-left-a-reply-to-a-comment-in-gerrit-but-no-one-but-me-can-see-it) above. These findings are based on heuristics; if a finding does not apply, briefly reply here saying so.

To update the commit title or commit message body shown here in Gerrit, you must edit the GitHub PR title and PR description (the first comment) in the GitHub web interface using the 'Edit' button or 'Edit' menu entry there. Note: pushing a new commit to the PR will not automatically update the commit message used by Gerrit.

For more details, see:

(In general for Gerrit code reviews, the change author is expected to [log in to Gerrit](https://go-review.googlesource.com/login/) with a Gmail or other Google account and then close out each piece of feedback by marking it as 'Done' if implemented as suggested or otherwise reply to each review comment. See the [Review](https://go.dev/doc/contribute#review) section of the Contributing Guide for details.)

Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: Ia3b3d81701c75b5bb86b1308ce1afa4ee4ef8dbf
    Gerrit-Change-Number: 726101
    Gerrit-PatchSet: 1
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-CC: Lin Lin <linsite...@gmail.com>
    Gerrit-Comment-Date: Wed, 03 Dec 2025 01:54:21 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    unsatisfied_requirement
    open
    diffy

    Gerrit Bot (Gerrit)

    unread,
    Dec 2, 2025, 9:03:08 PM (7 hours ago) Dec 2
    to Lin Lin, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

    Gerrit Bot uploaded new patchset

    Gerrit Bot uploaded patch set #2 to this change.
    Open in Gerrit

    Related details

    Attention set is empty
    Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: newpatchset
    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: Ia3b3d81701c75b5bb86b1308ce1afa4ee4ef8dbf
    Gerrit-Change-Number: 726101
    Gerrit-PatchSet: 2
    unsatisfied_requirement
    open
    diffy

    Gerrit Bot (Gerrit)

    unread,
    Dec 2, 2025, 9:29:58 PM (6 hours ago) Dec 2
    to Lin Lin, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
    Attention needed from Brad Fitzpatrick, Ian Lance Taylor and Tobias Klauser

    Gerrit Bot uploaded new patchset

    Gerrit Bot uploaded patch set #3 to this change.
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Brad Fitzpatrick
    • Ian Lance Taylor
    • Tobias Klauser
    Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: newpatchset
    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: Ia3b3d81701c75b5bb86b1308ce1afa4ee4ef8dbf
    Gerrit-Change-Number: 726101
    Gerrit-PatchSet: 3
    Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Tobias Klauser <tobias....@gmail.com>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-CC: Lin Lin <linsite...@gmail.com>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Attention: Tobias Klauser <tobias....@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    unsatisfied_requirement
    open
    diffy

    Gerrit Bot (Gerrit)

    unread,
    Dec 2, 2025, 9:38:30 PM (6 hours ago) Dec 2
    to Lin Lin, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
    Attention needed from Brad Fitzpatrick, Ian Lance Taylor and Tobias Klauser

    Gerrit Bot uploaded new patchset

    Gerrit Bot uploaded patch set #4 to this change.
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Brad Fitzpatrick
    • Ian Lance Taylor
    • Tobias Klauser
    Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: newpatchset
    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: Ia3b3d81701c75b5bb86b1308ce1afa4ee4ef8dbf
    Gerrit-Change-Number: 726101
    Gerrit-PatchSet: 4
    unsatisfied_requirement
    open
    diffy

    Lin Lin (Gerrit)

    unread,
    Dec 2, 2025, 9:46:26 PM (6 hours ago) Dec 2
    to Gerrit Bot, goph...@pubsubhelper.golang.org, Ian Lance Taylor, Brad Fitzpatrick, Tobias Klauser, Gopher Robot, golang-co...@googlegroups.com
    Attention needed from Brad Fitzpatrick, Ian Lance Taylor and Tobias Klauser

    Lin Lin added 1 comment

    Patchset-level comments
    File-level comment, Patchset 1:
    Gopher Robot . resolved

    I spotted some possible problems with your PR:

      1. The commit message body is very brief. That can be OK if the change is trivial like correcting spelling or fixing a broken link, but usually the description should provide context for the change and explain what it does in complete sentences.

    Please address any problems by updating the GitHub PR.

    When complete, mark this comment as 'Done' and click the [blue 'Reply' button](https://go.dev/wiki/GerritBot#i-left-a-reply-to-a-comment-in-gerrit-but-no-one-but-me-can-see-it) above. These findings are based on heuristics; if a finding does not apply, briefly reply here saying so.

    To update the commit title or commit message body shown here in Gerrit, you must edit the GitHub PR title and PR description (the first comment) in the GitHub web interface using the 'Edit' button or 'Edit' menu entry there. Note: pushing a new commit to the PR will not automatically update the commit message used by Gerrit.

    For more details, see:

    (In general for Gerrit code reviews, the change author is expected to [log in to Gerrit](https://go-review.googlesource.com/login/) with a Gmail or other Google account and then close out each piece of feedback by marking it as 'Done' if implemented as suggested or otherwise reply to each review comment. See the [Review](https://go.dev/doc/contribute#review) section of the Contributing Guide for details.)

    Lin Lin

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Brad Fitzpatrick
    • Ian Lance Taylor
    • Tobias Klauser
    Submit Requirements:
      • requirement is not satisfiedCode-Review
      • requirement satisfiedNo-Unresolved-Comments
      • requirement is not satisfiedReview-Enforcement
      • requirement is not satisfiedTryBots-Pass
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: Ia3b3d81701c75b5bb86b1308ce1afa4ee4ef8dbf
      Gerrit-Change-Number: 726101
      Gerrit-PatchSet: 4
      Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
      Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
      Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Reviewer: Tobias Klauser <tobias....@gmail.com>
      Gerrit-CC: Gopher Robot <go...@golang.org>
      Gerrit-CC: Lin Lin <linsite...@gmail.com>
      Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Attention: Tobias Klauser <tobias....@gmail.com>
      Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
      Gerrit-Comment-Date: Wed, 03 Dec 2025 02:46:18 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Gopher Robot <go...@golang.org>
      unsatisfied_requirement
      satisfied_requirement
      open
      diffy
      Reply all
      Reply to author
      Forward
      0 new messages