]> Cypherpunks repositories - gostls13.git/commit
net: fix ListenMulitcastUDP to work properly when interface has no IPv4
authorJesse Rittner <rittneje@gmail.com>
Sat, 25 Jan 2025 21:21:53 +0000 (16:21 -0500)
committerGopher Robot <gobot@golang.org>
Thu, 6 Feb 2025 17:36:55 +0000 (09:36 -0800)
commit0da7fafac4eabec799df40278f68ba86b574afea
tree33995ad9d6f79b17a87c4f31cfa5ab4e91f3b44b
parent65004c7bf4a1193af7742a6de9bc515c4b07bb75
net: fix ListenMulitcastUDP to work properly when interface has no IPv4

The existing implementation would either fail or bind to the wrong interface
when the requested interface had no IPv4 address, such as when the Ethernet cable
was unplugged.

Now on Linux, it will always bind to the requested interface.
On other operating systems, it will consistently fail if the requested interface
has no IPv4 address.

Fixes #70132

Change-Id: I22ec7f9d4adaa4b5afb21fc448050fb4219cacee
Reviewed-on: https://go-review.googlesource.com/c/go/+/644375
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
src/net/sockopt_posix.go
src/net/sockoptip4_bsdvar.go [moved from src/net/sockoptip_bsdvar.go with 100% similarity]
src/net/sockoptip4_linux.go [moved from src/net/sockoptip_linux.go with 68% similarity]
src/net/sockoptip4_posix_nonlinux.go [new file with mode: 0644]
src/net/sockoptip4_windows.go [moved from src/net/sockoptip_windows.go with 100% similarity]
src/net/sockoptip6_posix.go [moved from src/net/sockoptip_posix.go with 74% similarity]