1
0
mirror of https://github.com/golang/go synced 2024-11-25 21:07:56 -07:00

internal/poll, net: use (*FD).SetsockoptInet4Addr in setIPv4MulticastInterface on windows

Change-Id: Ic29d15bf62d8e693ca969354b415d958823bf41d
Reviewed-on: https://go-review.googlesource.com/c/go/+/523915
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
This commit is contained in:
Tobias Klauser 2023-08-29 13:52:07 +02:00 committed by Damien Neil
parent a8d45a72eb
commit fc486e4758
2 changed files with 1 additions and 11 deletions

View File

@ -6,15 +6,6 @@ package poll
import "syscall"
// Setsockopt wraps the setsockopt network call.
func (fd *FD) Setsockopt(level, optname int32, optval *byte, optlen int32) error {
if err := fd.incref(); err != nil {
return err
}
defer fd.decref()
return syscall.Setsockopt(fd.Sysfd, level, optname, optval, optlen)
}
// WSAIoctl wraps the WSAIoctl network call.
func (fd *FD) WSAIoctl(iocc uint32, inbuf *byte, cbif uint32, outbuf *byte, cbob uint32, cbbr *uint32, overlapped *syscall.Overlapped, completionRoutine uintptr) error {
if err := fd.incref(); err != nil {

View File

@ -8,7 +8,6 @@ import (
"os"
"runtime"
"syscall"
"unsafe"
)
func setIPv4MulticastInterface(fd *netFD, ifi *Interface) error {
@ -18,7 +17,7 @@ func setIPv4MulticastInterface(fd *netFD, ifi *Interface) error {
}
var a [4]byte
copy(a[:], ip.To4())
err = fd.pfd.Setsockopt(syscall.IPPROTO_IP, syscall.IP_MULTICAST_IF, (*byte)(unsafe.Pointer(&a[0])), 4)
err = fd.pfd.SetsockoptInet4Addr(syscall.IPPROTO_IP, syscall.IP_MULTICAST_IF, a)
runtime.KeepAlive(fd)
return wrapSyscallError("setsockopt", err)
}