From 7716a567fb84f3da3a9e4056228c7bbd93b631b2 Mon Sep 17 00:00:00 2001 From: Matt Layher Date: Fri, 28 Jul 2017 11:08:13 -0400 Subject: [PATCH] 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 TryBot-Result: Gobot Gobot Reviewed-by: Brad Fitzpatrick --- unix/linux/types.go | 3 +++ unix/ztypes_linux_386.go | 8 ++++++++ unix/ztypes_linux_amd64.go | 8 ++++++++ unix/ztypes_linux_arm.go | 8 ++++++++ unix/ztypes_linux_arm64.go | 8 ++++++++ unix/ztypes_linux_mips.go | 8 ++++++++ unix/ztypes_linux_mips64.go | 8 ++++++++ unix/ztypes_linux_mips64le.go | 8 ++++++++ unix/ztypes_linux_mipsle.go | 8 ++++++++ unix/ztypes_linux_ppc64.go | 8 ++++++++ unix/ztypes_linux_ppc64le.go | 8 ++++++++ unix/ztypes_linux_s390x.go | 8 ++++++++ 12 files changed, 91 insertions(+) diff --git a/unix/linux/types.go b/unix/linux/types.go index c1290869..e5769db5 100644 --- a/unix/linux/types.go +++ b/unix/linux/types.go @@ -316,6 +316,8 @@ type IPMreqn C.struct_ip_mreqn 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 @@ const ( 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 5a316acf..0dcebb50 100644 --- a/unix/ztypes_linux_386.go +++ b/unix/ztypes_linux_386.go @@ -285,6 +285,13 @@ type IPv6Mreq struct { 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 @@ const ( 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 f6b704e7..d70e5434 100644 --- a/unix/ztypes_linux_amd64.go +++ b/unix/ztypes_linux_amd64.go @@ -287,6 +287,13 @@ type IPv6Mreq struct { 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 @@ const ( 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 15104b70..497f5631 100644 --- a/unix/ztypes_linux_arm.go +++ b/unix/ztypes_linux_arm.go @@ -289,6 +289,13 @@ type IPv6Mreq struct { 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 @@ const ( 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 cbc46691..f0bdaede 100644 --- a/unix/ztypes_linux_arm64.go +++ b/unix/ztypes_linux_arm64.go @@ -288,6 +288,13 @@ type IPv6Mreq struct { 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 @@ const ( 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 ef7dd122..850a68cb 100644 --- a/unix/ztypes_linux_mips.go +++ b/unix/ztypes_linux_mips.go @@ -288,6 +288,13 @@ type IPv6Mreq struct { 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 @@ const ( 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 b7e9ffdb..92aac5d9 100644 --- a/unix/ztypes_linux_mips64.go +++ b/unix/ztypes_linux_mips64.go @@ -288,6 +288,13 @@ type IPv6Mreq struct { 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 @@ const ( 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 1b24cafe..623f5812 100644 --- a/unix/ztypes_linux_mips64le.go +++ b/unix/ztypes_linux_mips64le.go @@ -288,6 +288,13 @@ type IPv6Mreq struct { 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 @@ const ( 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 d49dfff2..56598a1b 100644 --- a/unix/ztypes_linux_mipsle.go +++ b/unix/ztypes_linux_mipsle.go @@ -288,6 +288,13 @@ type IPv6Mreq struct { 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 @@ const ( 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 ffe60bf4..acc7c819 100644 --- a/unix/ztypes_linux_ppc64.go +++ b/unix/ztypes_linux_ppc64.go @@ -289,6 +289,13 @@ type IPv6Mreq struct { 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 @@ const ( 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 4deb1e8d..b348885c 100644 --- a/unix/ztypes_linux_ppc64le.go +++ b/unix/ztypes_linux_ppc64le.go @@ -289,6 +289,13 @@ type IPv6Mreq struct { 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 @@ const ( 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 ba15cd41..a706e2f8 100644 --- a/unix/ztypes_linux_s390x.go +++ b/unix/ztypes_linux_s390x.go @@ -288,6 +288,13 @@ type IPv6Mreq struct { 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 @@ const ( SizeofIPMreq = 0x8 SizeofIPMreqn = 0xc SizeofIPv6Mreq = 0x14 + SizeofPacketMreq = 0x10 SizeofMsghdr = 0x38 SizeofCmsghdr = 0x10 SizeofInet4Pktinfo = 0xc