unix: add PacketMreq on Linux
The packet_mreq structure is used on Linux to modify the behavior
of packet sockets using setsockopt. See 'man 7 packet' for more
details.
Change-Id: I34e5b99a6b6eb1f23d49a9c9f25ce7b77121c8f0
Reviewed-on: https://go-review.googlesource.com/51710
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
diff --git a/unix/linux/types.go b/unix/linux/types.go
index c129086..e5769db 100644
--- a/unix/linux/types.go
+++ b/unix/linux/types.go
@@ -316,6 +316,8 @@
type IPv6Mreq C.struct_ipv6_mreq
+type PacketMreq C.struct_packet_mreq
+
type Msghdr C.struct_msghdr
type Cmsghdr C.struct_cmsghdr
@@ -348,6 +350,7 @@
SizeofIPMreq = C.sizeof_struct_ip_mreq
SizeofIPMreqn = C.sizeof_struct_ip_mreqn
SizeofIPv6Mreq = C.sizeof_struct_ipv6_mreq
+ SizeofPacketMreq = C.sizeof_struct_packet_mreq
SizeofMsghdr = C.sizeof_struct_msghdr
SizeofCmsghdr = C.sizeof_struct_cmsghdr
SizeofInet4Pktinfo = C.sizeof_struct_in_pktinfo
diff --git a/unix/ztypes_linux_386.go b/unix/ztypes_linux_386.go
index 5a316ac..0dcebb5 100644
--- a/unix/ztypes_linux_386.go
+++ b/unix/ztypes_linux_386.go
@@ -285,6 +285,13 @@
Interface uint32
}
+type PacketMreq struct {
+ Ifindex int32
+ Type uint16
+ Alen uint16
+ Address [8]uint8
+}
+
type Msghdr struct {
Name *byte
Namelen uint32
@@ -377,6 +384,7 @@
SizeofIPMreq = 0x8
SizeofIPMreqn = 0xc
SizeofIPv6Mreq = 0x14
+ SizeofPacketMreq = 0x10
SizeofMsghdr = 0x1c
SizeofCmsghdr = 0xc
SizeofInet4Pktinfo = 0xc
diff --git a/unix/ztypes_linux_amd64.go b/unix/ztypes_linux_amd64.go
index f6b704e..d70e543 100644
--- a/unix/ztypes_linux_amd64.go
+++ b/unix/ztypes_linux_amd64.go
@@ -287,6 +287,13 @@
Interface uint32
}
+type PacketMreq struct {
+ Ifindex int32
+ Type uint16
+ Alen uint16
+ Address [8]uint8
+}
+
type Msghdr struct {
Name *byte
Namelen uint32
@@ -381,6 +388,7 @@
SizeofIPMreq = 0x8
SizeofIPMreqn = 0xc
SizeofIPv6Mreq = 0x14
+ SizeofPacketMreq = 0x10
SizeofMsghdr = 0x38
SizeofCmsghdr = 0x10
SizeofInet4Pktinfo = 0xc
diff --git a/unix/ztypes_linux_arm.go b/unix/ztypes_linux_arm.go
index 15104b7..497f563 100644
--- a/unix/ztypes_linux_arm.go
+++ b/unix/ztypes_linux_arm.go
@@ -289,6 +289,13 @@
Interface uint32
}
+type PacketMreq struct {
+ Ifindex int32
+ Type uint16
+ Alen uint16
+ Address [8]uint8
+}
+
type Msghdr struct {
Name *byte
Namelen uint32
@@ -381,6 +388,7 @@
SizeofIPMreq = 0x8
SizeofIPMreqn = 0xc
SizeofIPv6Mreq = 0x14
+ SizeofPacketMreq = 0x10
SizeofMsghdr = 0x1c
SizeofCmsghdr = 0xc
SizeofInet4Pktinfo = 0xc
diff --git a/unix/ztypes_linux_arm64.go b/unix/ztypes_linux_arm64.go
index cbc4669..f0bdaed 100644
--- a/unix/ztypes_linux_arm64.go
+++ b/unix/ztypes_linux_arm64.go
@@ -288,6 +288,13 @@
Interface uint32
}
+type PacketMreq struct {
+ Ifindex int32
+ Type uint16
+ Alen uint16
+ Address [8]uint8
+}
+
type Msghdr struct {
Name *byte
Namelen uint32
@@ -382,6 +389,7 @@
SizeofIPMreq = 0x8
SizeofIPMreqn = 0xc
SizeofIPv6Mreq = 0x14
+ SizeofPacketMreq = 0x10
SizeofMsghdr = 0x38
SizeofCmsghdr = 0x10
SizeofInet4Pktinfo = 0xc
diff --git a/unix/ztypes_linux_mips.go b/unix/ztypes_linux_mips.go
index ef7dd12..850a68c 100644
--- a/unix/ztypes_linux_mips.go
+++ b/unix/ztypes_linux_mips.go
@@ -288,6 +288,13 @@
Interface uint32
}
+type PacketMreq struct {
+ Ifindex int32
+ Type uint16
+ Alen uint16
+ Address [8]uint8
+}
+
type Msghdr struct {
Name *byte
Namelen uint32
@@ -380,6 +387,7 @@
SizeofIPMreq = 0x8
SizeofIPMreqn = 0xc
SizeofIPv6Mreq = 0x14
+ SizeofPacketMreq = 0x10
SizeofMsghdr = 0x1c
SizeofCmsghdr = 0xc
SizeofInet4Pktinfo = 0xc
diff --git a/unix/ztypes_linux_mips64.go b/unix/ztypes_linux_mips64.go
index b7e9ffd..92aac5d 100644
--- a/unix/ztypes_linux_mips64.go
+++ b/unix/ztypes_linux_mips64.go
@@ -288,6 +288,13 @@
Interface uint32
}
+type PacketMreq struct {
+ Ifindex int32
+ Type uint16
+ Alen uint16
+ Address [8]uint8
+}
+
type Msghdr struct {
Name *byte
Namelen uint32
@@ -382,6 +389,7 @@
SizeofIPMreq = 0x8
SizeofIPMreqn = 0xc
SizeofIPv6Mreq = 0x14
+ SizeofPacketMreq = 0x10
SizeofMsghdr = 0x38
SizeofCmsghdr = 0x10
SizeofInet4Pktinfo = 0xc
diff --git a/unix/ztypes_linux_mips64le.go b/unix/ztypes_linux_mips64le.go
index 1b24caf..623f581 100644
--- a/unix/ztypes_linux_mips64le.go
+++ b/unix/ztypes_linux_mips64le.go
@@ -288,6 +288,13 @@
Interface uint32
}
+type PacketMreq struct {
+ Ifindex int32
+ Type uint16
+ Alen uint16
+ Address [8]uint8
+}
+
type Msghdr struct {
Name *byte
Namelen uint32
@@ -382,6 +389,7 @@
SizeofIPMreq = 0x8
SizeofIPMreqn = 0xc
SizeofIPv6Mreq = 0x14
+ SizeofPacketMreq = 0x10
SizeofMsghdr = 0x38
SizeofCmsghdr = 0x10
SizeofInet4Pktinfo = 0xc
diff --git a/unix/ztypes_linux_mipsle.go b/unix/ztypes_linux_mipsle.go
index d49dfff..56598a1 100644
--- a/unix/ztypes_linux_mipsle.go
+++ b/unix/ztypes_linux_mipsle.go
@@ -288,6 +288,13 @@
Interface uint32
}
+type PacketMreq struct {
+ Ifindex int32
+ Type uint16
+ Alen uint16
+ Address [8]uint8
+}
+
type Msghdr struct {
Name *byte
Namelen uint32
@@ -380,6 +387,7 @@
SizeofIPMreq = 0x8
SizeofIPMreqn = 0xc
SizeofIPv6Mreq = 0x14
+ SizeofPacketMreq = 0x10
SizeofMsghdr = 0x1c
SizeofCmsghdr = 0xc
SizeofInet4Pktinfo = 0xc
diff --git a/unix/ztypes_linux_ppc64.go b/unix/ztypes_linux_ppc64.go
index ffe60bf..acc7c81 100644
--- a/unix/ztypes_linux_ppc64.go
+++ b/unix/ztypes_linux_ppc64.go
@@ -289,6 +289,13 @@
Interface uint32
}
+type PacketMreq struct {
+ Ifindex int32
+ Type uint16
+ Alen uint16
+ Address [8]uint8
+}
+
type Msghdr struct {
Name *byte
Namelen uint32
@@ -383,6 +390,7 @@
SizeofIPMreq = 0x8
SizeofIPMreqn = 0xc
SizeofIPv6Mreq = 0x14
+ SizeofPacketMreq = 0x10
SizeofMsghdr = 0x38
SizeofCmsghdr = 0x10
SizeofInet4Pktinfo = 0xc
diff --git a/unix/ztypes_linux_ppc64le.go b/unix/ztypes_linux_ppc64le.go
index 4deb1e8..b348885 100644
--- a/unix/ztypes_linux_ppc64le.go
+++ b/unix/ztypes_linux_ppc64le.go
@@ -289,6 +289,13 @@
Interface uint32
}
+type PacketMreq struct {
+ Ifindex int32
+ Type uint16
+ Alen uint16
+ Address [8]uint8
+}
+
type Msghdr struct {
Name *byte
Namelen uint32
@@ -383,6 +390,7 @@
SizeofIPMreq = 0x8
SizeofIPMreqn = 0xc
SizeofIPv6Mreq = 0x14
+ SizeofPacketMreq = 0x10
SizeofMsghdr = 0x38
SizeofCmsghdr = 0x10
SizeofInet4Pktinfo = 0xc
diff --git a/unix/ztypes_linux_s390x.go b/unix/ztypes_linux_s390x.go
index ba15cd4..a706e2f 100644
--- a/unix/ztypes_linux_s390x.go
+++ b/unix/ztypes_linux_s390x.go
@@ -288,6 +288,13 @@
Interface uint32
}
+type PacketMreq struct {
+ Ifindex int32
+ Type uint16
+ Alen uint16
+ Address [8]uint8
+}
+
type Msghdr struct {
Name *byte
Namelen uint32
@@ -382,6 +389,7 @@
SizeofIPMreq = 0x8
SizeofIPMreqn = 0xc
SizeofIPv6Mreq = 0x14
+ SizeofPacketMreq = 0x10
SizeofMsghdr = 0x38
SizeofCmsghdr = 0x10
SizeofInet4Pktinfo = 0xc