unix: add SetsockoptPacketMreq on Linux
Add SetsockoptPacketMreq to set packet socket options used to
configure physical-layer multiācasting and promiscuous mode
(PACKET_ADD_MEMBERSHIP, PACKET_DROP_MEMBERSHIP).
Change-Id: I0f292315ad1c57e6a3d1dd12f5f29be70d8bfd54
Reviewed-on: https://go-review.googlesource.com/c/sys/+/165977
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
diff --git a/unix/syscall_linux.go b/unix/syscall_linux.go
index fea1fb3..7e429ab 100644
--- a/unix/syscall_linux.go
+++ b/unix/syscall_linux.go
@@ -1022,6 +1022,10 @@
return setsockopt(fd, level, opt, unsafe.Pointer(mreq), unsafe.Sizeof(*mreq))
}
+func SetsockoptPacketMreq(fd, level, opt int, mreq *PacketMreq) error {
+ return setsockopt(fd, level, opt, unsafe.Pointer(mreq), unsafe.Sizeof(*mreq))
+}
+
// SetsockoptSockFprog attaches a classic BPF or an extended BPF program to a
// socket to filter incoming packets. See 'man 7 socket' for usage information.
func SetsockoptSockFprog(fd, level, opt int, fprog *SockFprog) error {