[sys] windows: add iphlpapi routing functions

13 views
Skip to first unread message

Ian Chen (Gerrit)

unread,
Aug 12, 2025, 10:34:08 AMAug 12
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

Ian Chen has uploaded the change for review

Commit message

windows: add iphlpapi routing functions

NotifyRouteChange2 registers to be notified for changes to IP route entries.
Call GetIpForwardEntry2 on received row to retrieve complete information.
GetIpForwardTable2 retrieves the full routing table.
FreeMibTable frees the buffer allocated by the functions that return tables of
network interfaces, addresses, and routes.
Change-Id: I9fba75f1f728661e45dc3092e35eb9099b0570dd

Change diff

diff --git a/windows/syscall_windows.go b/windows/syscall_windows.go
index 640f6b1..4640759 100644
--- a/windows/syscall_windows.go
+++ b/windows/syscall_windows.go
@@ -890,8 +890,12 @@
//sys MultiByteToWideChar(codePage uint32, dwFlags uint32, str *byte, nstr int32, wchar *uint16, nwchar int32) (nwrite int32, err error) = kernel32.MultiByteToWideChar
//sys getBestInterfaceEx(sockaddr unsafe.Pointer, pdwBestIfIndex *uint32) (errcode error) = iphlpapi.GetBestInterfaceEx
//sys GetIfEntry2Ex(level uint32, row *MibIfRow2) (errcode error) = iphlpapi.GetIfEntry2Ex
+//sys GetIpForwardEntry2(row *MibIpForwardRow2) (errcode error) = iphlpapi.GetIpForwardEntry2
+//sys GetIpForwardTable2(family uint16, table **MibIpForwardTable2) (errcode error) = iphlpapi.GetIpForwardTable2
//sys GetUnicastIpAddressEntry(row *MibUnicastIpAddressRow) (errcode error) = iphlpapi.GetUnicastIpAddressEntry
+//sys FreeMibTable(memory unsafe.Pointer) = iphlpapi.FreeMibTable
//sys NotifyIpInterfaceChange(family uint16, callback uintptr, callerContext unsafe.Pointer, initialNotification bool, notificationHandle *Handle) (errcode error) = iphlpapi.NotifyIpInterfaceChange
+//sys NotifyRouteChange2(family uint16, callback uintptr, callerContext unsafe.Pointer, initialNotification bool, notificationHandle *Handle) (errcode error) = iphlpapi.NotifyRouteChange2
//sys NotifyUnicastIpAddressChange(family uint16, callback uintptr, callerContext unsafe.Pointer, initialNotification bool, notificationHandle *Handle) (errcode error) = iphlpapi.NotifyUnicastIpAddressChange
//sys CancelMibChangeNotify2(notificationHandle Handle) (errcode error) = iphlpapi.CancelMibChangeNotify2

diff --git a/windows/types_windows.go b/windows/types_windows.go
index 958bcf4..f49c0aa 100644
--- a/windows/types_windows.go
+++ b/windows/types_windows.go
@@ -2298,6 +2298,82 @@
OutQLen uint64
}

+// IP_ADDRESS_PREFIX stores an IP address prefix. See
+// https://learn.microsoft.com/en-us/windows/win32/api/netioapi/ns-netioapi-ip_address_prefix.
+type IpAddressPrefix struct {
+ Prefix RawSockaddrInet6 // SOCKADDR_INET union
+ PrefixLength uint8
+}
+
+// NL_ROUTE_ORIGIN enumeration from nldef.h or
+// https://learn.microsoft.com/en-us/windows/win32/api/nldef/ne-nldef-nl_route_origin.
+const (
+ NlroManual = 0
+ NlroWellKnown = 1
+ NlroDHCP = 2
+ NlroRouterAdvertisement = 3
+ Nlro6to4 = 4
+)
+
+// NL_ROUTE_ORIGIN enumeration from nldef.h or
+// https://learn.microsoft.com/en-us/windows/win32/api/nldef/ne-nldef-nl_route_protocol.
+const (
+ MIB_IPPROTO_OTHER = 1
+ MIB_IPPROTO_LOCAL = 2
+ MIB_IPPROTO_NETMGMT = 3
+ MIB_IPPROTO_ICMP = 4
+ MIB_IPPROTO_EGP = 5
+ MIB_IPPROTO_GGP = 6
+ MIB_IPPROTO_HELLO = 7
+ MIB_IPPROTO_RIP = 8
+ MIB_IPPROTO_IS_IS = 9
+ MIB_IPPROTO_ES_IS = 10
+ MIB_IPPROTO_CISCO = 11
+ MIB_IPPROTO_BBN = 12
+ MIB_IPPROTO_OSPF = 13
+ MIB_IPPROTO_BGP = 14
+ MIB_IPPROTO_IDPR = 15
+ MIB_IPPROTO_EIGRP = 16
+ MIB_IPPROTO_DVMRP = 17
+ MIB_IPPROTO_RPL = 18
+ MIB_IPPROTO_DHCP = 19
+ MIB_IPPROTO_NT_AUTOSTATIC = 10002
+ MIB_IPPROTO_NT_STATIC = 10006
+ MIB_IPPROTO_NT_STATIC_NON_DOD = 10007
+)
+
+// MIB_IPFORWARD_ROW2 stores information about an IP route entry. See
+// https://learn.microsoft.com/en-us/windows/win32/api/netioapi/ns-netioapi-mib_ipforward_row2.
+type MibIpForwardRow2 struct {
+ InterfaceLuid uint64
+ InterfaceIndex uint32
+ DestinationPrefix IpAddressPrefix
+ NextHop RawSockaddrInet6 // SOCKADDR_INET union
+ SitePrefixLength uint8
+ ValidLifetime uint32
+ PreferredLifetime uint32
+ Metric uint32
+ Protocol uint32
+ Loopback uint8
+ AutoconfigureAddress uint8
+ Publish uint8
+ Immortal uint8
+ Age uint32
+ Origin uint32
+}
+
+// MIB_IPFORWARD_TABLE2 contains a table of IP route entries. See
+// https://learn.microsoft.com/en-us/windows/win32/api/netioapi/ns-netioapi-mib_ipforward_table2.
+type MibIpForwardTable2 struct {
+ NumEntries uint32
+ Table [1]MibIpForwardRow2
+}
+
+// Rows returns the IP route entries in the table.
+func (t *MibIpForwardTable2) Rows() []MibIpForwardRow2 {
+ return unsafe.Slice(&t.Table[0], t.NumEntries)
+}
+
// MIB_UNICASTIPADDRESS_ROW stores information about a unicast IP address. See
// https://learn.microsoft.com/en-us/windows/win32/api/netioapi/ns-netioapi-mib_unicastipaddress_row.
type MibUnicastIpAddressRow struct {
diff --git a/windows/zsyscall_windows.go b/windows/zsyscall_windows.go
index a58bc48..b8f14f3 100644
--- a/windows/zsyscall_windows.go
+++ b/windows/zsyscall_windows.go
@@ -182,13 +182,17 @@
procDwmGetWindowAttribute = moddwmapi.NewProc("DwmGetWindowAttribute")
procDwmSetWindowAttribute = moddwmapi.NewProc("DwmSetWindowAttribute")
procCancelMibChangeNotify2 = modiphlpapi.NewProc("CancelMibChangeNotify2")
+ procFreeMibTable = modiphlpapi.NewProc("FreeMibTable")
procGetAdaptersAddresses = modiphlpapi.NewProc("GetAdaptersAddresses")
procGetAdaptersInfo = modiphlpapi.NewProc("GetAdaptersInfo")
procGetBestInterfaceEx = modiphlpapi.NewProc("GetBestInterfaceEx")
procGetIfEntry = modiphlpapi.NewProc("GetIfEntry")
procGetIfEntry2Ex = modiphlpapi.NewProc("GetIfEntry2Ex")
+ procGetIpForwardEntry2 = modiphlpapi.NewProc("GetIpForwardEntry2")
+ procGetIpForwardTable2 = modiphlpapi.NewProc("GetIpForwardTable2")
procGetUnicastIpAddressEntry = modiphlpapi.NewProc("GetUnicastIpAddressEntry")
procNotifyIpInterfaceChange = modiphlpapi.NewProc("NotifyIpInterfaceChange")
+ procNotifyRouteChange2 = modiphlpapi.NewProc("NotifyRouteChange2")
procNotifyUnicastIpAddressChange = modiphlpapi.NewProc("NotifyUnicastIpAddressChange")
procAddDllDirectory = modkernel32.NewProc("AddDllDirectory")
procAssignProcessToJobObject = modkernel32.NewProc("AssignProcessToJobObject")
@@ -1622,6 +1626,11 @@
return
}

+func FreeMibTable(memory unsafe.Pointer) {
+ syscall.Syscall(procFreeMibTable.Addr(), 1, uintptr(memory), 0, 0)
+ return
+}
+
func GetAdaptersAddresses(family uint32, flags uint32, reserved uintptr, adapterAddresses *IpAdapterAddresses, sizePointer *uint32) (errcode error) {
r0, _, _ := syscall.Syscall6(procGetAdaptersAddresses.Addr(), 5, uintptr(family), uintptr(flags), uintptr(reserved), uintptr(unsafe.Pointer(adapterAddresses)), uintptr(unsafe.Pointer(sizePointer)), 0)
if r0 != 0 {
@@ -1662,6 +1671,22 @@
return
}

+func GetIpForwardEntry2(row *MibIpForwardRow2) (errcode error) {
+ r0, _, _ := syscall.Syscall(procGetIpForwardEntry2.Addr(), 1, uintptr(unsafe.Pointer(row)), 0, 0)
+ if r0 != 0 {
+ errcode = syscall.Errno(r0)
+ }
+ return
+}
+
+func GetIpForwardTable2(family uint16, table **MibIpForwardTable2) (errcode error) {
+ r0, _, _ := syscall.Syscall(procGetIpForwardTable2.Addr(), 2, uintptr(family), uintptr(unsafe.Pointer(table)), 0)
+ if r0 != 0 {
+ errcode = syscall.Errno(r0)
+ }
+ return
+}
+
func GetUnicastIpAddressEntry(row *MibUnicastIpAddressRow) (errcode error) {
r0, _, _ := syscall.Syscall(procGetUnicastIpAddressEntry.Addr(), 1, uintptr(unsafe.Pointer(row)), 0, 0)
if r0 != 0 {
@@ -1682,6 +1707,18 @@
return
}

+func NotifyRouteChange2(family uint16, callback uintptr, callerContext unsafe.Pointer, initialNotification bool, notificationHandle *Handle) (errcode error) {
+ var _p0 uint32
+ if initialNotification {
+ _p0 = 1
+ }
+ r0, _, _ := syscall.Syscall6(procNotifyRouteChange2.Addr(), 5, uintptr(family), uintptr(callback), uintptr(callerContext), uintptr(_p0), uintptr(unsafe.Pointer(notificationHandle)), 0)
+ if r0 != 0 {
+ errcode = syscall.Errno(r0)
+ }
+ return
+}
+
func NotifyUnicastIpAddressChange(family uint16, callback uintptr, callerContext unsafe.Pointer, initialNotification bool, notificationHandle *Handle) (errcode error) {
var _p0 uint32
if initialNotification {

Change information

Files:
  • M windows/syscall_windows.go
  • M windows/types_windows.go
  • M windows/zsyscall_windows.go
Change size: M
Delta: 3 files changed, 117 insertions(+), 0 deletions(-)
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: sys
Gerrit-Branch: master
Gerrit-Change-Id: I9fba75f1f728661e45dc3092e35eb9099b0570dd
Gerrit-Change-Number: 695195
Gerrit-PatchSet: 1
Gerrit-Owner: Ian Chen <databa...@gmail.com>
unsatisfied_requirement
satisfied_requirement
open
diffy

Ian Chen (Gerrit)

unread,
Aug 12, 2025, 10:42:30 AMAug 12
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

Ian Chen uploaded new patchset

Ian Chen uploaded patch set #2 to this change.
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: newpatchset
Gerrit-Project: sys
Gerrit-Branch: master
Gerrit-Change-Id: I9fba75f1f728661e45dc3092e35eb9099b0570dd
Gerrit-Change-Number: 695195
Gerrit-PatchSet: 2
Gerrit-Owner: Ian Chen <databa...@gmail.com>
unsatisfied_requirement
satisfied_requirement
open
diffy

Ian Chen (Gerrit)

unread,
Aug 23, 2025, 3:57:49 PMAug 23
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
Attention needed from Alex Brainman, Brad Fitzpatrick and Quim Muntal

Ian Chen uploaded new patchset

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

Related details

Attention is currently required from:
  • Alex Brainman
  • Brad Fitzpatrick
  • Quim Muntal
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: newpatchset
Gerrit-Project: sys
Gerrit-Branch: master
Gerrit-Change-Id: I9fba75f1f728661e45dc3092e35eb9099b0570dd
Gerrit-Change-Number: 695195
Gerrit-PatchSet: 3
Gerrit-Owner: Ian Chen <databa...@gmail.com>
Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
Gerrit-Reviewer: Quim Muntal <quimm...@gmail.com>
Gerrit-CC: Gopher Robot <go...@golang.org>
Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
Gerrit-Attention: Quim Muntal <quimm...@gmail.com>
unsatisfied_requirement
satisfied_requirement
open
diffy

Ian Chen (Gerrit)

unread,
Aug 23, 2025, 3:59:13 PMAug 23
to goph...@pubsubhelper.golang.org, Quim Muntal, Alex Brainman, Brad Fitzpatrick, Gopher Robot, golang-co...@googlegroups.com
Attention needed from Alex Brainman, Brad Fitzpatrick and Quim Muntal

Ian Chen added 1 comment

Patchset-level comments
File-level comment, Patchset 3 (Latest):
Ian Chen . resolved

Regenerated after CL 691715 (reinstating SyscallN).

Open in Gerrit

Related details

Attention is currently required from:
  • Alex Brainman
  • Brad Fitzpatrick
  • Quim Muntal
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: sys
Gerrit-Branch: master
Gerrit-Change-Id: I9fba75f1f728661e45dc3092e35eb9099b0570dd
Gerrit-Change-Number: 695195
Gerrit-PatchSet: 3
Gerrit-Owner: Ian Chen <databa...@gmail.com>
Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
Gerrit-Reviewer: Quim Muntal <quimm...@gmail.com>
Gerrit-CC: Gopher Robot <go...@golang.org>
Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
Gerrit-Attention: Quim Muntal <quimm...@gmail.com>
Gerrit-Comment-Date: Sat, 23 Aug 2025 19:59:07 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
unsatisfied_requirement
satisfied_requirement
open
diffy

Sean Liao (Gerrit)

unread,
Aug 31, 2025, 8:00:16 AMAug 31
to Ian Chen, goph...@pubsubhelper.golang.org, Quim Muntal, Alex Brainman, Brad Fitzpatrick, Gopher Robot, golang-co...@googlegroups.com
Attention needed from Alex Brainman, Brad Fitzpatrick, Ian Chen and Quim Muntal

Sean Liao voted Commit-Queue+1

Commit-Queue+1
Open in Gerrit

Related details

Attention is currently required from:
  • Alex Brainman
  • Brad Fitzpatrick
  • Ian Chen
  • Quim Muntal
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: sys
Gerrit-Branch: master
Gerrit-Change-Id: I9fba75f1f728661e45dc3092e35eb9099b0570dd
Gerrit-Change-Number: 695195
Gerrit-PatchSet: 3
Gerrit-Owner: Ian Chen <databa...@gmail.com>
Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
Gerrit-Reviewer: Quim Muntal <quimm...@gmail.com>
Gerrit-Reviewer: Sean Liao <se...@liao.dev>
Gerrit-CC: Gopher Robot <go...@golang.org>
Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
Gerrit-Attention: Quim Muntal <quimm...@gmail.com>
Gerrit-Attention: Ian Chen <databa...@gmail.com>
Gerrit-Comment-Date: Sun, 31 Aug 2025 12:00:07 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
unsatisfied_requirement
satisfied_requirement
open
diffy

Quim Muntal (Gerrit)

unread,
Sep 4, 2025, 9:31:56 AMSep 4
to Ian Chen, goph...@pubsubhelper.golang.org, Go LUCI, Alex Brainman, Brad Fitzpatrick, Gopher Robot, golang-co...@googlegroups.com
Attention needed from Alex Brainman, Brad Fitzpatrick and Ian Chen

Quim Muntal added 2 comments

File windows/types_windows.go
Line 2304, Patchset 3 (Latest): Prefix RawSockaddrInet6 // SOCKADDR_INET union
Quim Muntal . unresolved

I don't like representing `SOCKADDR_INET` with a `RawSockaddrInet6`, as the former is a union that can't always be safely casted into the latter. Better do something like this: https://github.com/netbirdio/netbird/blob/71e944fa57868ce38a30bdd7267de5dbd52a72cb/client/internal/routemanager/systemops/systemops_windows.go#L86-L94.

And then add a helper to access access the address in a safe manner.

Line 2351, Patchset 3 (Latest): NextHop RawSockaddrInet6 // SOCKADDR_INET union
Quim Muntal . unresolved

Same as previous comment.

Open in Gerrit

Related details

Attention is currently required from:
  • Alex Brainman
  • Brad Fitzpatrick
  • Ian Chen
Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: sys
    Gerrit-Branch: master
    Gerrit-Change-Id: I9fba75f1f728661e45dc3092e35eb9099b0570dd
    Gerrit-Change-Number: 695195
    Gerrit-PatchSet: 3
    Gerrit-Owner: Ian Chen <databa...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Quim Muntal <quimm...@gmail.com>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-CC: Sean Liao <se...@liao.dev>
    Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Ian Chen <databa...@gmail.com>
    Gerrit-Comment-Date: Thu, 04 Sep 2025 13:31:45 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    unsatisfied_requirement
    satisfied_requirement
    open
    diffy

    Ian Chen (Gerrit)

    unread,
    Sep 4, 2025, 10:20:10 AMSep 4
    to goph...@pubsubhelper.golang.org, Go LUCI, Quim Muntal, Alex Brainman, Brad Fitzpatrick, Gopher Robot, golang-co...@googlegroups.com
    Attention needed from Alex Brainman, Brad Fitzpatrick and Quim Muntal

    Ian Chen added 1 comment

    File windows/types_windows.go
    Line 2304, Patchset 3 (Latest): Prefix RawSockaddrInet6 // SOCKADDR_INET union
    Quim Muntal . unresolved

    I don't like representing `SOCKADDR_INET` with a `RawSockaddrInet6`, as the former is a union that can't always be safely casted into the latter. Better do something like this: https://github.com/netbirdio/netbird/blob/71e944fa57868ce38a30bdd7267de5dbd52a72cb/client/internal/routemanager/systemops/systemops_windows.go#L86-L94.

    And then add a helper to access access the address in a safe manner.

    Ian Chen

    I don't like representing `SOCKADDR_INET` with a `RawSockaddrInet6`, as the former is a union that can't always be safely casted into the latter. Better do something like this: https://github.com/netbirdio/netbird/blob/71e944fa57868ce38a30bdd7267de5dbd52a72cb/client/internal/routemanager/systemops/systemops_windows.go#L86-L94.

    Your linked example is wrong. The actual `SOCKADDR_INET` union requires 4-byte alignment, because there are `uint32` fields in `SOCKADDR_IN6`.

    NetBird's definition only requires 2-byte alignment. It just happens to work here, because the field sits right after `InterfaceIndex uint32`.

    BTW, we already have `MibUnicastIpAddressRow` where the `Address` field is a `SOCKADDR_INET` union and is represented by a `RawSockaddrInet6`.

    And then add a helper to access access the address in a safe manner.

    I'm not sure how useful such helper methods are. User code will simply switch on `Family` and convert to the right `RawSockaddr*` type with `unsafe`.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Alex Brainman
    • Brad Fitzpatrick
    • Quim Muntal
    Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: sys
    Gerrit-Branch: master
    Gerrit-Change-Id: I9fba75f1f728661e45dc3092e35eb9099b0570dd
    Gerrit-Change-Number: 695195
    Gerrit-PatchSet: 3
    Gerrit-Owner: Ian Chen <databa...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Quim Muntal <quimm...@gmail.com>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-CC: Sean Liao <se...@liao.dev>
    Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Quim Muntal <quimm...@gmail.com>
    Gerrit-Comment-Date: Thu, 04 Sep 2025 14:20:05 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Quim Muntal <quimm...@gmail.com>
    unsatisfied_requirement
    satisfied_requirement
    open
    diffy

    Quim Muntal (Gerrit)

    unread,
    Sep 4, 2025, 10:29:42 AMSep 4
    to Ian Chen, goph...@pubsubhelper.golang.org, Go LUCI, Alex Brainman, Brad Fitzpatrick, Gopher Robot, golang-co...@googlegroups.com
    Attention needed from Alex Brainman, Brad Fitzpatrick and Ian Chen

    Quim Muntal added 1 comment

    File windows/types_windows.go
    Line 2304, Patchset 3 (Latest): Prefix RawSockaddrInet6 // SOCKADDR_INET union
    Quim Muntal . unresolved

    I don't like representing `SOCKADDR_INET` with a `RawSockaddrInet6`, as the former is a union that can't always be safely casted into the latter. Better do something like this: https://github.com/netbirdio/netbird/blob/71e944fa57868ce38a30bdd7267de5dbd52a72cb/client/internal/routemanager/systemops/systemops_windows.go#L86-L94.

    And then add a helper to access access the address in a safe manner.

    Ian Chen

    I don't like representing `SOCKADDR_INET` with a `RawSockaddrInet6`, as the former is a union that can't always be safely casted into the latter. Better do something like this: https://github.com/netbirdio/netbird/blob/71e944fa57868ce38a30bdd7267de5dbd52a72cb/client/internal/routemanager/systemops/systemops_windows.go#L86-L94.

    Your linked example is wrong. The actual `SOCKADDR_INET` union requires 4-byte alignment, because there are `uint32` fields in `SOCKADDR_IN6`.

    NetBird's definition only requires 2-byte alignment. It just happens to work here, because the field sits right after `InterfaceIndex uint32`.

    BTW, we already have `MibUnicastIpAddressRow` where the `Address` field is a `SOCKADDR_INET` union and is represented by a `RawSockaddrInet6`.

    And then add a helper to access access the address in a safe manner.

    I'm not sure how useful such helper methods are. User code will simply switch on `Family` and convert to the right `RawSockaddr*` type with `unsafe`.

    Quim Muntal

    Your linked example is wrong. The actual SOCKADDR_INET union requires 4-byte alignment, because there are uint32 fields in SOCKADDR_IN6.

    Didn't check the actual memory layout, but you got the idea 😊.

    BTW, we already have MibUnicastIpAddressRow where the Address field is a SOCKADDR_INET union and is represented by a RawSockaddrInet6.

    Yep, that's unfortunate, I prefer to do it better this time.

    I'm not sure how useful such helper methods are. User code will simply switch on Family and convert to the right RawSockaddr* type with unsafe.

    I'm fine leaving that method out of this CL.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Alex Brainman
    • Brad Fitzpatrick
    • Ian Chen
    Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: sys
    Gerrit-Branch: master
    Gerrit-Change-Id: I9fba75f1f728661e45dc3092e35eb9099b0570dd
    Gerrit-Change-Number: 695195
    Gerrit-PatchSet: 3
    Gerrit-Owner: Ian Chen <databa...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Quim Muntal <quimm...@gmail.com>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-CC: Sean Liao <se...@liao.dev>
    Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Attention: Ian Chen <databa...@gmail.com>
    Gerrit-Comment-Date: Thu, 04 Sep 2025 14:29:35 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Quim Muntal <quimm...@gmail.com>
    Comment-In-Reply-To: Ian Chen <databa...@gmail.com>
    unsatisfied_requirement
    satisfied_requirement
    open
    diffy

    Ian Chen (Gerrit)

    unread,
    Sep 4, 2025, 10:33:33 AMSep 4
    to goph...@pubsubhelper.golang.org, Go LUCI, Quim Muntal, Alex Brainman, Gopher Robot, golang-co...@googlegroups.com
    Attention needed from Alex Brainman and Ian Chen

    Ian Chen added 1 comment

    File windows/types_windows.go
    Line 2304, Patchset 3 (Latest): Prefix RawSockaddrInet6 // SOCKADDR_INET union
    Quim Muntal . unresolved

    I don't like representing `SOCKADDR_INET` with a `RawSockaddrInet6`, as the former is a union that can't always be safely casted into the latter. Better do something like this: https://github.com/netbirdio/netbird/blob/71e944fa57868ce38a30bdd7267de5dbd52a72cb/client/internal/routemanager/systemops/systemops_windows.go#L86-L94.

    And then add a helper to access access the address in a safe manner.

    Ian Chen

    I don't like representing `SOCKADDR_INET` with a `RawSockaddrInet6`, as the former is a union that can't always be safely casted into the latter. Better do something like this: https://github.com/netbirdio/netbird/blob/71e944fa57868ce38a30bdd7267de5dbd52a72cb/client/internal/routemanager/systemops/systemops_windows.go#L86-L94.

    Your linked example is wrong. The actual `SOCKADDR_INET` union requires 4-byte alignment, because there are `uint32` fields in `SOCKADDR_IN6`.

    NetBird's definition only requires 2-byte alignment. It just happens to work here, because the field sits right after `InterfaceIndex uint32`.

    BTW, we already have `MibUnicastIpAddressRow` where the `Address` field is a `SOCKADDR_INET` union and is represented by a `RawSockaddrInet6`.

    And then add a helper to access access the address in a safe manner.

    I'm not sure how useful such helper methods are. User code will simply switch on `Family` and convert to the right `RawSockaddr*` type with `unsafe`.

    Ian Chen

    User code will simply switch on `Family` and convert to the right `RawSockaddr*` type with `unsafe`.

    An example of how this might look like: https://github.com/database64128/ddns-go/blob/4c2cc44e2ca74a9dc99cf50a704b4db4ccda9b51/producer/win32iphlp/win32iphlp_windows.go#L384-L399

    As you can see, the conversion is quite trivial. Helper methods would not be useful here.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Alex Brainman
    • Ian Chen
    Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: sys
    Gerrit-Branch: master
    Gerrit-Change-Id: I9fba75f1f728661e45dc3092e35eb9099b0570dd
    Gerrit-Change-Number: 695195
    Gerrit-PatchSet: 3
    Gerrit-Owner: Ian Chen <databa...@gmail.com>
    Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Reviewer: Quim Muntal <quimm...@gmail.com>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-CC: Sean Liao <se...@liao.dev>
    Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
    Gerrit-Attention: Ian Chen <databa...@gmail.com>
    Gerrit-Comment-Date: Thu, 04 Sep 2025 14:33:28 +0000
    unsatisfied_requirement
    satisfied_requirement
    open
    diffy

    Ian Chen (Gerrit)

    unread,
    Sep 4, 2025, 10:40:08 AMSep 4
    to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
    Attention needed from Alex Brainman and Ian Chen

    Ian Chen uploaded new patchset

    Ian Chen uploaded patch set #4 to this change.
    Following approvals got outdated and were removed:
    • TryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Alex Brainman
    • Ian Chen
    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: sys
      Gerrit-Branch: master
      Gerrit-Change-Id: I9fba75f1f728661e45dc3092e35eb9099b0570dd
      Gerrit-Change-Number: 695195
      Gerrit-PatchSet: 4
      unsatisfied_requirement
      open
      diffy

      Ian Chen (Gerrit)

      unread,
      Sep 4, 2025, 10:43:11 AMSep 4
      to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
      Attention needed from Alex Brainman and Ian Chen

      Ian Chen uploaded new patchset

      Ian Chen uploaded patch set #5 to this change.
      Open in Gerrit

      Related details

      Attention is currently required from:
      • Alex Brainman
      • Ian Chen
      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: sys
      Gerrit-Branch: master
      Gerrit-Change-Id: I9fba75f1f728661e45dc3092e35eb9099b0570dd
      Gerrit-Change-Number: 695195
      Gerrit-PatchSet: 5
      unsatisfied_requirement
      open
      diffy

      Ian Chen (Gerrit)

      unread,
      Sep 4, 2025, 10:44:59 AMSep 4
      to goph...@pubsubhelper.golang.org, Go LUCI, Quim Muntal, Alex Brainman, Gopher Robot, golang-co...@googlegroups.com
      Attention needed from Alex Brainman and Quim Muntal

      Ian Chen added 2 comments

      File windows/types_windows.go
      Line 2304, Patchset 3: Prefix RawSockaddrInet6 // SOCKADDR_INET union
      Quim Muntal . resolved

      I don't like representing `SOCKADDR_INET` with a `RawSockaddrInet6`, as the former is a union that can't always be safely casted into the latter. Better do something like this: https://github.com/netbirdio/netbird/blob/71e944fa57868ce38a30bdd7267de5dbd52a72cb/client/internal/routemanager/systemops/systemops_windows.go#L86-L94.

      And then add a helper to access access the address in a safe manner.

      Ian Chen

      I don't like representing `SOCKADDR_INET` with a `RawSockaddrInet6`, as the former is a union that can't always be safely casted into the latter. Better do something like this: https://github.com/netbirdio/netbird/blob/71e944fa57868ce38a30bdd7267de5dbd52a72cb/client/internal/routemanager/systemops/systemops_windows.go#L86-L94.

      Your linked example is wrong. The actual `SOCKADDR_INET` union requires 4-byte alignment, because there are `uint32` fields in `SOCKADDR_IN6`.

      NetBird's definition only requires 2-byte alignment. It just happens to work here, because the field sits right after `InterfaceIndex uint32`.

      BTW, we already have `MibUnicastIpAddressRow` where the `Address` field is a `SOCKADDR_INET` union and is represented by a `RawSockaddrInet6`.

      And then add a helper to access access the address in a safe manner.

      I'm not sure how useful such helper methods are. User code will simply switch on `Family` and convert to the right `RawSockaddr*` type with `unsafe`.

      Ian Chen

      User code will simply switch on `Family` and convert to the right `RawSockaddr*` type with `unsafe`.

      An example of how this might look like: https://github.com/database64128/ddns-go/blob/4c2cc44e2ca74a9dc99cf50a704b4db4ccda9b51/producer/win32iphlp/win32iphlp_windows.go#L384-L399

      As you can see, the conversion is quite trivial. Helper methods would not be useful here.

      Ian Chen

      Added `SockaddrInet` with `Data [6]uint32` for the correct alignment requirement. Please take another look, thanks. 😊

      Line 2351, Patchset 3: NextHop RawSockaddrInet6 // SOCKADDR_INET union
      Quim Muntal . resolved

      Same as previous comment.

      Ian Chen

      Done

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Alex Brainman
      • Quim Muntal
      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: sys
        Gerrit-Branch: master
        Gerrit-Change-Id: I9fba75f1f728661e45dc3092e35eb9099b0570dd
        Gerrit-Change-Number: 695195
        Gerrit-PatchSet: 5
        Gerrit-Owner: Ian Chen <databa...@gmail.com>
        Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
        Gerrit-Reviewer: Quim Muntal <quimm...@gmail.com>
        Gerrit-CC: Gopher Robot <go...@golang.org>
        Gerrit-CC: Sean Liao <se...@liao.dev>
        Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
        Gerrit-Attention: Quim Muntal <quimm...@gmail.com>
        Gerrit-Comment-Date: Thu, 04 Sep 2025 14:44:55 +0000
        unsatisfied_requirement
        satisfied_requirement
        open
        diffy

        Ian Chen (Gerrit)

        unread,
        Sep 4, 2025, 10:49:24 AMSep 4
        to goph...@pubsubhelper.golang.org, Go LUCI, Quim Muntal, Alex Brainman, Gopher Robot, golang-co...@googlegroups.com
        Attention needed from Alex Brainman and Quim Muntal

        Ian Chen added 1 comment

        File windows/types_windows.go
        Line 2304, Patchset 3: Prefix RawSockaddrInet6 // SOCKADDR_INET union
        Quim Muntal . resolved

        I don't like representing `SOCKADDR_INET` with a `RawSockaddrInet6`, as the former is a union that can't always be safely casted into the latter. Better do something like this: https://github.com/netbirdio/netbird/blob/71e944fa57868ce38a30bdd7267de5dbd52a72cb/client/internal/routemanager/systemops/systemops_windows.go#L86-L94.

        And then add a helper to access access the address in a safe manner.

        Ian Chen

        I don't like representing `SOCKADDR_INET` with a `RawSockaddrInet6`, as the former is a union that can't always be safely casted into the latter. Better do something like this: https://github.com/netbirdio/netbird/blob/71e944fa57868ce38a30bdd7267de5dbd52a72cb/client/internal/routemanager/systemops/systemops_windows.go#L86-L94.

        Your linked example is wrong. The actual `SOCKADDR_INET` union requires 4-byte alignment, because there are `uint32` fields in `SOCKADDR_IN6`.

        NetBird's definition only requires 2-byte alignment. It just happens to work here, because the field sits right after `InterfaceIndex uint32`.

        BTW, we already have `MibUnicastIpAddressRow` where the `Address` field is a `SOCKADDR_INET` union and is represented by a `RawSockaddrInet6`.

        And then add a helper to access access the address in a safe manner.

        I'm not sure how useful such helper methods are. User code will simply switch on `Family` and convert to the right `RawSockaddr*` type with `unsafe`.

        Ian Chen

        User code will simply switch on `Family` and convert to the right `RawSockaddr*` type with `unsafe`.

        An example of how this might look like: https://github.com/database64128/ddns-go/blob/4c2cc44e2ca74a9dc99cf50a704b4db4ccda9b51/producer/win32iphlp/win32iphlp_windows.go#L384-L399

        As you can see, the conversion is quite trivial. Helper methods would not be useful here.

        Ian Chen

        Added `SockaddrInet` with `Data [6]uint32` for the correct alignment requirement. Please take another look, thanks. 😊

        Ian Chen

        Yep, that's unfortunate, I prefer to do it better this time.

        BTW I also updated that field to use the new type. `MibUnicastIpAddressRow` was added by me a few months ago, and it seems like I'm still the only user.

        Let me know whether this is an acceptable breaking change.

        Gerrit-Comment-Date: Thu, 04 Sep 2025 14:49:19 +0000
        unsatisfied_requirement
        satisfied_requirement
        open
        diffy

        Quim Muntal (Gerrit)

        unread,
        Sep 4, 2025, 11:12:45 AMSep 4
        to Ian Chen, goph...@pubsubhelper.golang.org, Go LUCI, Alex Brainman, Gopher Robot, golang-co...@googlegroups.com
        Attention needed from Alex Brainman and Ian Chen

        Quim Muntal voted and added 1 comment

        Votes added by Quim Muntal

        Code-Review+2
        Commit-Queue+1

        1 comment

        Patchset-level comments
        File-level comment, Patchset 5 (Latest):
        Quim Muntal . resolved

        Thanks.

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Alex Brainman
        • Ian Chen
        Submit Requirements:
        • requirement 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: sys
        Gerrit-Branch: master
        Gerrit-Change-Id: I9fba75f1f728661e45dc3092e35eb9099b0570dd
        Gerrit-Change-Number: 695195
        Gerrit-PatchSet: 5
        Gerrit-Owner: Ian Chen <databa...@gmail.com>
        Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
        Gerrit-Reviewer: Quim Muntal <quimm...@gmail.com>
        Gerrit-CC: Gopher Robot <go...@golang.org>
        Gerrit-CC: Sean Liao <se...@liao.dev>
        Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
        Gerrit-Attention: Ian Chen <databa...@gmail.com>
        Gerrit-Comment-Date: Thu, 04 Sep 2025 15:12:37 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: Yes
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Michael Pratt (Gerrit)

        unread,
        Sep 4, 2025, 4:15:46 PMSep 4
        to Ian Chen, goph...@pubsubhelper.golang.org, Michael Pratt, Go LUCI, Quim Muntal, Alex Brainman, Gopher Robot, golang-co...@googlegroups.com
        Attention needed from Alex Brainman and Ian Chen

        Michael Pratt added 2 comments

        File windows/types_windows.go
        Line 2303, Patchset 5 (Latest):type SockaddrInet struct {
        Michael Pratt . unresolved

        Should this be called RawSockaddrInet? It is more like RawSockaddrInet4 and RawSockaddrInet6 than SockaddrInet4 and SockaddrInet6.

        How do we expect users to use this type? Should there be helpers for converting to/from SockaddrInet4 and SockaddrInet6?

        Line 2388, Patchset 5 (Latest): Address SockaddrInet
        Michael Pratt . unresolved

        Changing the type of a field violates the Go 1 Compatibility promise. (Though we are sometimes more lenient on that in `syscall`).

        It does seem like the old type was a mistake, but I'm not sure this can be safely changed.

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Alex Brainman
        • Ian Chen
        Submit Requirements:
        • requirement satisfiedCode-Review
        • requirement is not satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        • requirement satisfiedTryBots-Pass
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: sys
        Gerrit-Branch: master
        Gerrit-Change-Id: I9fba75f1f728661e45dc3092e35eb9099b0570dd
        Gerrit-Change-Number: 695195
        Gerrit-PatchSet: 5
        Gerrit-Owner: Ian Chen <databa...@gmail.com>
        Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
        Gerrit-Reviewer: Quim Muntal <quimm...@gmail.com>
        Gerrit-CC: Gopher Robot <go...@golang.org>
        Gerrit-CC: Michael Pratt <mpr...@google.com>
        Gerrit-CC: Sean Liao <se...@liao.dev>
        Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
        Gerrit-Attention: Ian Chen <databa...@gmail.com>
        Gerrit-Comment-Date: Thu, 04 Sep 2025 20:15:41 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Ian Chen (Gerrit)

        unread,
        Sep 4, 2025, 4:26:10 PMSep 4
        to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
        Attention needed from Alex Brainman, Ian Chen and Quim Muntal

        Ian Chen uploaded new patchset

        Ian Chen uploaded patch set #6 to this change.
        Following approvals got outdated and were removed:
        • Code-Review: +2 by Quim Muntal
        • TryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
          Open in Gerrit

          Related details

          Attention is currently required from:
          • Alex Brainman
          • Ian Chen
          • Quim Muntal
          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: sys
          Gerrit-Branch: master
          Gerrit-Change-Id: I9fba75f1f728661e45dc3092e35eb9099b0570dd
          Gerrit-Change-Number: 695195
          Gerrit-PatchSet: 6
          Gerrit-Owner: Ian Chen <databa...@gmail.com>
          Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
          Gerrit-Reviewer: Quim Muntal <quimm...@gmail.com>
          Gerrit-CC: Gopher Robot <go...@golang.org>
          Gerrit-CC: Michael Pratt <mpr...@google.com>
          Gerrit-CC: Sean Liao <se...@liao.dev>
          Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
          unsatisfied_requirement
          open
          diffy

          Ian Chen (Gerrit)

          unread,
          Sep 4, 2025, 4:33:18 PMSep 4
          to goph...@pubsubhelper.golang.org, Michael Pratt, Go LUCI, Quim Muntal, Alex Brainman, Gopher Robot, golang-co...@googlegroups.com
          Attention needed from Alex Brainman, Michael Pratt and Quim Muntal

          Ian Chen added 2 comments

          File windows/types_windows.go
          Line 2303, Patchset 5:type SockaddrInet struct {
          Michael Pratt . resolved

          Should this be called RawSockaddrInet? It is more like RawSockaddrInet4 and RawSockaddrInet6 than SockaddrInet4 and SockaddrInet6.

          How do we expect users to use this type? Should there be helpers for converting to/from SockaddrInet4 and SockaddrInet6?

          Ian Chen

          Should this be called RawSockaddrInet? It is more like RawSockaddrInet4 and RawSockaddrInet6 than SockaddrInet4 and SockaddrInet6.

          Renamed and moved to the file where `RawSockaddrInet{4,6}` are defined.

          How do we expect users to use this type? Should there be helpers for converting to/from SockaddrInet4 and SockaddrInet6?

          Users are expected to switch on `Family` and use `unsafe` to convert to `*RawSockaddrInet{4,6}`. IMO helpers are unlikely to provide value to users. Earlier discussions also mentioned this.

          Line 2388, Patchset 5: Address SockaddrInet
          Michael Pratt . resolved

          Changing the type of a field violates the Go 1 Compatibility promise. (Though we are sometimes more lenient on that in `syscall`).

          It does seem like the old type was a mistake, but I'm not sure this can be safely changed.

          Ian Chen

          Reverted the change.

          Open in Gerrit

          Related details

          Attention is currently required from:
          • Alex Brainman
          • Michael Pratt
          • Quim Muntal
          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: sys
            Gerrit-Branch: master
            Gerrit-Change-Id: I9fba75f1f728661e45dc3092e35eb9099b0570dd
            Gerrit-Change-Number: 695195
            Gerrit-PatchSet: 5
            Gerrit-Owner: Ian Chen <databa...@gmail.com>
            Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
            Gerrit-Reviewer: Quim Muntal <quimm...@gmail.com>
            Gerrit-CC: Gopher Robot <go...@golang.org>
            Gerrit-CC: Michael Pratt <mpr...@google.com>
            Gerrit-CC: Sean Liao <se...@liao.dev>
            Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
            Gerrit-Attention: Michael Pratt <mpr...@google.com>
            Gerrit-Attention: Quim Muntal <quimm...@gmail.com>
            Gerrit-Comment-Date: Thu, 04 Sep 2025 20:33:14 +0000
            Gerrit-HasComments: Yes
            Gerrit-Has-Labels: No
            Comment-In-Reply-To: Michael Pratt <mpr...@google.com>
            unsatisfied_requirement
            satisfied_requirement
            open
            diffy

            Michael Pratt (Gerrit)

            unread,
            Sep 8, 2025, 12:10:55 PMSep 8
            to Ian Chen, goph...@pubsubhelper.golang.org, Michael Pratt, Go LUCI, Quim Muntal, Alex Brainman, Gopher Robot, golang-co...@googlegroups.com
            Attention needed from Alex Brainman, Ian Chen and Quim Muntal

            Michael Pratt voted and added 3 comments

            Votes added by Michael Pratt

            Code-Review+1

            3 comments

            Patchset-level comments
            File-level comment, Patchset 6 (Latest):
            Michael Pratt . resolved

            Thanks. I'll let @quimm...@gmail.com re-review and +2 the API changes.

            File windows/types_windows.go
            Line 2303, Patchset 5:type SockaddrInet struct {
            Michael Pratt . resolved

            Should this be called RawSockaddrInet? It is more like RawSockaddrInet4 and RawSockaddrInet6 than SockaddrInet4 and SockaddrInet6.

            How do we expect users to use this type? Should there be helpers for converting to/from SockaddrInet4 and SockaddrInet6?

            Ian Chen

            Should this be called RawSockaddrInet? It is more like RawSockaddrInet4 and RawSockaddrInet6 than SockaddrInet4 and SockaddrInet6.

            Renamed and moved to the file where `RawSockaddrInet{4,6}` are defined.

            How do we expect users to use this type? Should there be helpers for converting to/from SockaddrInet4 and SockaddrInet6?

            Users are expected to switch on `Family` and use `unsafe` to convert to `*RawSockaddrInet{4,6}`. IMO helpers are unlikely to provide value to users. Earlier discussions also mentioned this.

            Michael Pratt

            OK. I think a comment on `RawSockaddrInet` saying it can be converted to/from the other types would help users discover this.

            Line 2388, Patchset 5: Address SockaddrInet
            Michael Pratt . resolved

            Changing the type of a field violates the Go 1 Compatibility promise. (Though we are sometimes more lenient on that in `syscall`).

            It does seem like the old type was a mistake, but I'm not sure this can be safely changed.

            Ian Chen

            Reverted the change.

            Michael Pratt

            Thanks.

            I can't find a single use of `MibUnicastIpAddressRow` on GitHub, so I think there is an argument that we can change this as a bug in the API. But that should have a short proposal, so not part of the this CL.

            Open in Gerrit

            Related details

            Attention is currently required from:
            • Alex Brainman
            • Ian Chen
            • Quim Muntal
            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: sys
            Gerrit-Branch: master
            Gerrit-Change-Id: I9fba75f1f728661e45dc3092e35eb9099b0570dd
            Gerrit-Change-Number: 695195
            Gerrit-PatchSet: 6
            Gerrit-Owner: Ian Chen <databa...@gmail.com>
            Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
            Gerrit-Reviewer: Michael Pratt <mpr...@google.com>
            Gerrit-Reviewer: Quim Muntal <quimm...@gmail.com>
            Gerrit-CC: Gopher Robot <go...@golang.org>
            Gerrit-CC: Sean Liao <se...@liao.dev>
            Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
            Gerrit-Attention: Quim Muntal <quimm...@gmail.com>
            Gerrit-Attention: Ian Chen <databa...@gmail.com>
            Gerrit-Comment-Date: Mon, 08 Sep 2025 16:10:50 +0000
            Gerrit-HasComments: Yes
            Gerrit-Has-Labels: Yes
            Comment-In-Reply-To: Michael Pratt <mpr...@google.com>
            Comment-In-Reply-To: Ian Chen <databa...@gmail.com>
            unsatisfied_requirement
            satisfied_requirement
            open
            diffy

            Michael Pratt (Gerrit)

            unread,
            Sep 8, 2025, 12:10:58 PMSep 8
            to Ian Chen, goph...@pubsubhelper.golang.org, Michael Pratt, Go LUCI, Quim Muntal, Alex Brainman, Gopher Robot, golang-co...@googlegroups.com
            Attention needed from Alex Brainman, Ian Chen and Quim Muntal

            Michael Pratt voted Commit-Queue+1

            Commit-Queue+1
            Gerrit-Comment-Date: Mon, 08 Sep 2025 16:10:55 +0000
            Gerrit-HasComments: No
            Gerrit-Has-Labels: Yes
            unsatisfied_requirement
            satisfied_requirement
            open
            diffy

            Quim Muntal (Gerrit)

            unread,
            Sep 15, 2025, 10:31:50 AMSep 15
            to Ian Chen, goph...@pubsubhelper.golang.org, Go LUCI, Michael Pratt, Alex Brainman, Gopher Robot, golang-co...@googlegroups.com
            Attention needed from Alex Brainman and Ian Chen

            Quim Muntal voted Code-Review+2

            Code-Review+2
            Open in Gerrit

            Related details

            Attention is currently required from:
            • Alex Brainman
            • Ian Chen
            Submit Requirements:
            • requirement satisfiedCode-Review
            • requirement satisfiedNo-Unresolved-Comments
            • requirement is not satisfiedReview-Enforcement
            • requirement satisfiedTryBots-Pass
            Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
            Gerrit-MessageType: comment
            Gerrit-Project: sys
            Gerrit-Branch: master
            Gerrit-Change-Id: I9fba75f1f728661e45dc3092e35eb9099b0570dd
            Gerrit-Change-Number: 695195
            Gerrit-PatchSet: 6
            Gerrit-Owner: Ian Chen <databa...@gmail.com>
            Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
            Gerrit-Reviewer: Michael Pratt <mpr...@google.com>
            Gerrit-Reviewer: Quim Muntal <quimm...@gmail.com>
            Gerrit-CC: Gopher Robot <go...@golang.org>
            Gerrit-CC: Sean Liao <se...@liao.dev>
            Gerrit-Attention: Ian Chen <databa...@gmail.com>
            Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
            Gerrit-Comment-Date: Mon, 15 Sep 2025 14:31:42 +0000
            Gerrit-HasComments: No
            Gerrit-Has-Labels: Yes
            satisfied_requirement
            unsatisfied_requirement
            open
            diffy

            Quim Muntal (Gerrit)

            unread,
            Sep 15, 2025, 10:32:49 AMSep 15
            to Ian Chen, goph...@pubsubhelper.golang.org, Go LUCI, Michael Pratt, Alex Brainman, Gopher Robot, golang-co...@googlegroups.com
            Attention needed from Alex Brainman and Ian Chen

            Quim Muntal added 1 comment

            File windows/syscall_windows.go
            Line 921, Patchset 6 (Latest):// SOCKADDR_INET is a union that contains an IPv4, an IPv6 address, or an address family. See
            Quim Muntal . unresolved

            ```suggestion
            // RawSockaddrInet is a union that contains an IPv4, an IPv6 address, or an address family. See
            ```

            Open in Gerrit

            Related details

            Attention is currently required from:
            • Alex Brainman
            • Ian Chen
            Submit Requirements:
            • requirement satisfiedCode-Review
            • requirement is not satisfiedNo-Unresolved-Comments
            • requirement is not satisfiedReview-Enforcement
            • requirement satisfiedTryBots-Pass
            Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
            Gerrit-MessageType: comment
            Gerrit-Project: sys
            Gerrit-Branch: master
            Gerrit-Change-Id: I9fba75f1f728661e45dc3092e35eb9099b0570dd
            Gerrit-Change-Number: 695195
            Gerrit-PatchSet: 6
            Gerrit-Owner: Ian Chen <databa...@gmail.com>
            Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
            Gerrit-Reviewer: Michael Pratt <mpr...@google.com>
            Gerrit-Reviewer: Quim Muntal <quimm...@gmail.com>
            Gerrit-CC: Gopher Robot <go...@golang.org>
            Gerrit-CC: Sean Liao <se...@liao.dev>
            Gerrit-Attention: Ian Chen <databa...@gmail.com>
            Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
            Gerrit-Comment-Date: Mon, 15 Sep 2025 14:32:42 +0000
            Gerrit-HasComments: Yes
            Gerrit-Has-Labels: No
            satisfied_requirement
            unsatisfied_requirement
            open
            diffy

            Ian Chen (Gerrit)

            unread,
            Sep 15, 2025, 11:09:47 AMSep 15
            to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
            Attention needed from Alex Brainman, Ian Chen, Michael Pratt and Quim Muntal

            Ian Chen uploaded new patchset

            Ian Chen uploaded patch set #7 to this change.
            Following approvals got outdated and were removed:
            • Code-Review: +2 by Quim Muntal, +1 by Michael Pratt
            • TryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
              Open in Gerrit

              Related details

              Attention is currently required from:
              • Alex Brainman
              • Ian Chen
              • Michael Pratt
              • Quim Muntal
              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: sys
              Gerrit-Branch: master
              Gerrit-Change-Id: I9fba75f1f728661e45dc3092e35eb9099b0570dd
              Gerrit-Change-Number: 695195
              Gerrit-PatchSet: 7
              Gerrit-Owner: Ian Chen <databa...@gmail.com>
              Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
              Gerrit-Reviewer: Michael Pratt <mpr...@google.com>
              Gerrit-Reviewer: Quim Muntal <quimm...@gmail.com>
              Gerrit-CC: Gopher Robot <go...@golang.org>
              Gerrit-CC: Sean Liao <se...@liao.dev>
              Gerrit-Attention: Quim Muntal <quimm...@gmail.com>
              Gerrit-Attention: Ian Chen <databa...@gmail.com>
              Gerrit-Attention: Michael Pratt <mpr...@google.com>
              Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
              unsatisfied_requirement
              open
              diffy

              Ian Chen (Gerrit)

              unread,
              Sep 15, 2025, 11:11:10 AMSep 15
              to goph...@pubsubhelper.golang.org, Quim Muntal, Go LUCI, Michael Pratt, Alex Brainman, Gopher Robot, golang-co...@googlegroups.com
              Attention needed from Alex Brainman, Michael Pratt and Quim Muntal

              Ian Chen added 2 comments

              File windows/syscall_windows.go
              Line 921, Patchset 6:// SOCKADDR_INET is a union that contains an IPv4, an IPv6 address, or an address family. See
              Quim Muntal . resolved

              ```suggestion
              // RawSockaddrInet is a union that contains an IPv4, an IPv6 address, or an address family. See
              ```

              Ian Chen

              Done.

              File windows/types_windows.go
              Line 2303, Patchset 5:type SockaddrInet struct {
              Michael Pratt . resolved

              Should this be called RawSockaddrInet? It is more like RawSockaddrInet4 and RawSockaddrInet6 than SockaddrInet4 and SockaddrInet6.

              How do we expect users to use this type? Should there be helpers for converting to/from SockaddrInet4 and SockaddrInet6?

              Ian Chen

              Should this be called RawSockaddrInet? It is more like RawSockaddrInet4 and RawSockaddrInet6 than SockaddrInet4 and SockaddrInet6.

              Renamed and moved to the file where `RawSockaddrInet{4,6}` are defined.

              How do we expect users to use this type? Should there be helpers for converting to/from SockaddrInet4 and SockaddrInet6?

              Users are expected to switch on `Family` and use `unsafe` to convert to `*RawSockaddrInet{4,6}`. IMO helpers are unlikely to provide value to users. Earlier discussions also mentioned this.

              Michael Pratt

              OK. I think a comment on `RawSockaddrInet` saying it can be converted to/from the other types would help users discover this.

              Ian Chen

              Comment added.

              Open in Gerrit

              Related details

              Attention is currently required from:
              • Alex Brainman
              • Michael Pratt
              • Quim Muntal
              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: sys
                Gerrit-Branch: master
                Gerrit-Change-Id: I9fba75f1f728661e45dc3092e35eb9099b0570dd
                Gerrit-Change-Number: 695195
                Gerrit-PatchSet: 7
                Gerrit-Owner: Ian Chen <databa...@gmail.com>
                Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
                Gerrit-Reviewer: Michael Pratt <mpr...@google.com>
                Gerrit-Reviewer: Quim Muntal <quimm...@gmail.com>
                Gerrit-CC: Gopher Robot <go...@golang.org>
                Gerrit-CC: Sean Liao <se...@liao.dev>
                Gerrit-Attention: Quim Muntal <quimm...@gmail.com>
                Gerrit-Attention: Michael Pratt <mpr...@google.com>
                Gerrit-Attention: Alex Brainman <alex.b...@gmail.com>
                Gerrit-Comment-Date: Mon, 15 Sep 2025 15:11:05 +0000
                Gerrit-HasComments: Yes
                Gerrit-Has-Labels: No
                Comment-In-Reply-To: Quim Muntal <quimm...@gmail.com>
                Comment-In-Reply-To: Ian Chen <databa...@gmail.com>
                Comment-In-Reply-To: Michael Pratt <mpr...@google.com>
                unsatisfied_requirement
                satisfied_requirement
                open
                diffy

                Ian Chen (Gerrit)

                unread,
                Sep 24, 2025, 1:24:36 PMSep 24
                to goph...@pubsubhelper.golang.org, Quim Muntal, Go LUCI, Michael Pratt, Alex Brainman, Gopher Robot, golang-co...@googlegroups.com
                Attention needed from Alex Brainman, Michael Pratt and Quim Muntal

                Ian Chen added 1 comment

                Patchset-level comments
                File-level comment, Patchset 7 (Latest):
                Ian Chen . resolved

                Friendly ping.

                Gerrit-Comment-Date: Wed, 24 Sep 2025 17:24:31 +0000
                Gerrit-HasComments: Yes
                Gerrit-Has-Labels: No
                unsatisfied_requirement
                satisfied_requirement
                open
                diffy

                Ian Chen (Gerrit)

                unread,
                5:00 PM (7 hours ago) 5:00 PM
                to goph...@pubsubhelper.golang.org, Quim Muntal, Go LUCI, Michael Pratt, Alex Brainman, Gopher Robot, golang-co...@googlegroups.com
                Attention needed from Alex Brainman, Michael Pratt and Quim Muntal

                Ian Chen added 1 comment

                Patchset-level comments
                Ian Chen . resolved

                @quimm...@gmail.com Can you please +2 this change again? I'm not a trusted user, so your previous +2 vote was removed after your suggested change. Thanks.

                Gerrit-Comment-Date: Wed, 15 Oct 2025 21:00:15 +0000
                Gerrit-HasComments: Yes
                Gerrit-Has-Labels: No
                unsatisfied_requirement
                satisfied_requirement
                open
                diffy
                Reply all
                Reply to author
                Forward
                0 new messages