mirror of
https://github.com/rwinkhart/sys.git
synced 2026-09-03 15:47:35 -04:00
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>
This commit is contained in:
@@ -316,6 +316,8 @@ type IPMreqn C.struct_ip_mreqn
|
|||||||
|
|
||||||
type IPv6Mreq C.struct_ipv6_mreq
|
type IPv6Mreq C.struct_ipv6_mreq
|
||||||
|
|
||||||
|
type PacketMreq C.struct_packet_mreq
|
||||||
|
|
||||||
type Msghdr C.struct_msghdr
|
type Msghdr C.struct_msghdr
|
||||||
|
|
||||||
type Cmsghdr C.struct_cmsghdr
|
type Cmsghdr C.struct_cmsghdr
|
||||||
@@ -348,6 +350,7 @@ const (
|
|||||||
SizeofIPMreq = C.sizeof_struct_ip_mreq
|
SizeofIPMreq = C.sizeof_struct_ip_mreq
|
||||||
SizeofIPMreqn = C.sizeof_struct_ip_mreqn
|
SizeofIPMreqn = C.sizeof_struct_ip_mreqn
|
||||||
SizeofIPv6Mreq = C.sizeof_struct_ipv6_mreq
|
SizeofIPv6Mreq = C.sizeof_struct_ipv6_mreq
|
||||||
|
SizeofPacketMreq = C.sizeof_struct_packet_mreq
|
||||||
SizeofMsghdr = C.sizeof_struct_msghdr
|
SizeofMsghdr = C.sizeof_struct_msghdr
|
||||||
SizeofCmsghdr = C.sizeof_struct_cmsghdr
|
SizeofCmsghdr = C.sizeof_struct_cmsghdr
|
||||||
SizeofInet4Pktinfo = C.sizeof_struct_in_pktinfo
|
SizeofInet4Pktinfo = C.sizeof_struct_in_pktinfo
|
||||||
|
|||||||
@@ -285,6 +285,13 @@ type IPv6Mreq struct {
|
|||||||
Interface uint32
|
Interface uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type PacketMreq struct {
|
||||||
|
Ifindex int32
|
||||||
|
Type uint16
|
||||||
|
Alen uint16
|
||||||
|
Address [8]uint8
|
||||||
|
}
|
||||||
|
|
||||||
type Msghdr struct {
|
type Msghdr struct {
|
||||||
Name *byte
|
Name *byte
|
||||||
Namelen uint32
|
Namelen uint32
|
||||||
@@ -377,6 +384,7 @@ const (
|
|||||||
SizeofIPMreq = 0x8
|
SizeofIPMreq = 0x8
|
||||||
SizeofIPMreqn = 0xc
|
SizeofIPMreqn = 0xc
|
||||||
SizeofIPv6Mreq = 0x14
|
SizeofIPv6Mreq = 0x14
|
||||||
|
SizeofPacketMreq = 0x10
|
||||||
SizeofMsghdr = 0x1c
|
SizeofMsghdr = 0x1c
|
||||||
SizeofCmsghdr = 0xc
|
SizeofCmsghdr = 0xc
|
||||||
SizeofInet4Pktinfo = 0xc
|
SizeofInet4Pktinfo = 0xc
|
||||||
|
|||||||
@@ -287,6 +287,13 @@ type IPv6Mreq struct {
|
|||||||
Interface uint32
|
Interface uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type PacketMreq struct {
|
||||||
|
Ifindex int32
|
||||||
|
Type uint16
|
||||||
|
Alen uint16
|
||||||
|
Address [8]uint8
|
||||||
|
}
|
||||||
|
|
||||||
type Msghdr struct {
|
type Msghdr struct {
|
||||||
Name *byte
|
Name *byte
|
||||||
Namelen uint32
|
Namelen uint32
|
||||||
@@ -381,6 +388,7 @@ const (
|
|||||||
SizeofIPMreq = 0x8
|
SizeofIPMreq = 0x8
|
||||||
SizeofIPMreqn = 0xc
|
SizeofIPMreqn = 0xc
|
||||||
SizeofIPv6Mreq = 0x14
|
SizeofIPv6Mreq = 0x14
|
||||||
|
SizeofPacketMreq = 0x10
|
||||||
SizeofMsghdr = 0x38
|
SizeofMsghdr = 0x38
|
||||||
SizeofCmsghdr = 0x10
|
SizeofCmsghdr = 0x10
|
||||||
SizeofInet4Pktinfo = 0xc
|
SizeofInet4Pktinfo = 0xc
|
||||||
|
|||||||
@@ -289,6 +289,13 @@ type IPv6Mreq struct {
|
|||||||
Interface uint32
|
Interface uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type PacketMreq struct {
|
||||||
|
Ifindex int32
|
||||||
|
Type uint16
|
||||||
|
Alen uint16
|
||||||
|
Address [8]uint8
|
||||||
|
}
|
||||||
|
|
||||||
type Msghdr struct {
|
type Msghdr struct {
|
||||||
Name *byte
|
Name *byte
|
||||||
Namelen uint32
|
Namelen uint32
|
||||||
@@ -381,6 +388,7 @@ const (
|
|||||||
SizeofIPMreq = 0x8
|
SizeofIPMreq = 0x8
|
||||||
SizeofIPMreqn = 0xc
|
SizeofIPMreqn = 0xc
|
||||||
SizeofIPv6Mreq = 0x14
|
SizeofIPv6Mreq = 0x14
|
||||||
|
SizeofPacketMreq = 0x10
|
||||||
SizeofMsghdr = 0x1c
|
SizeofMsghdr = 0x1c
|
||||||
SizeofCmsghdr = 0xc
|
SizeofCmsghdr = 0xc
|
||||||
SizeofInet4Pktinfo = 0xc
|
SizeofInet4Pktinfo = 0xc
|
||||||
|
|||||||
@@ -288,6 +288,13 @@ type IPv6Mreq struct {
|
|||||||
Interface uint32
|
Interface uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type PacketMreq struct {
|
||||||
|
Ifindex int32
|
||||||
|
Type uint16
|
||||||
|
Alen uint16
|
||||||
|
Address [8]uint8
|
||||||
|
}
|
||||||
|
|
||||||
type Msghdr struct {
|
type Msghdr struct {
|
||||||
Name *byte
|
Name *byte
|
||||||
Namelen uint32
|
Namelen uint32
|
||||||
@@ -382,6 +389,7 @@ const (
|
|||||||
SizeofIPMreq = 0x8
|
SizeofIPMreq = 0x8
|
||||||
SizeofIPMreqn = 0xc
|
SizeofIPMreqn = 0xc
|
||||||
SizeofIPv6Mreq = 0x14
|
SizeofIPv6Mreq = 0x14
|
||||||
|
SizeofPacketMreq = 0x10
|
||||||
SizeofMsghdr = 0x38
|
SizeofMsghdr = 0x38
|
||||||
SizeofCmsghdr = 0x10
|
SizeofCmsghdr = 0x10
|
||||||
SizeofInet4Pktinfo = 0xc
|
SizeofInet4Pktinfo = 0xc
|
||||||
|
|||||||
@@ -288,6 +288,13 @@ type IPv6Mreq struct {
|
|||||||
Interface uint32
|
Interface uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type PacketMreq struct {
|
||||||
|
Ifindex int32
|
||||||
|
Type uint16
|
||||||
|
Alen uint16
|
||||||
|
Address [8]uint8
|
||||||
|
}
|
||||||
|
|
||||||
type Msghdr struct {
|
type Msghdr struct {
|
||||||
Name *byte
|
Name *byte
|
||||||
Namelen uint32
|
Namelen uint32
|
||||||
@@ -380,6 +387,7 @@ const (
|
|||||||
SizeofIPMreq = 0x8
|
SizeofIPMreq = 0x8
|
||||||
SizeofIPMreqn = 0xc
|
SizeofIPMreqn = 0xc
|
||||||
SizeofIPv6Mreq = 0x14
|
SizeofIPv6Mreq = 0x14
|
||||||
|
SizeofPacketMreq = 0x10
|
||||||
SizeofMsghdr = 0x1c
|
SizeofMsghdr = 0x1c
|
||||||
SizeofCmsghdr = 0xc
|
SizeofCmsghdr = 0xc
|
||||||
SizeofInet4Pktinfo = 0xc
|
SizeofInet4Pktinfo = 0xc
|
||||||
|
|||||||
@@ -288,6 +288,13 @@ type IPv6Mreq struct {
|
|||||||
Interface uint32
|
Interface uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type PacketMreq struct {
|
||||||
|
Ifindex int32
|
||||||
|
Type uint16
|
||||||
|
Alen uint16
|
||||||
|
Address [8]uint8
|
||||||
|
}
|
||||||
|
|
||||||
type Msghdr struct {
|
type Msghdr struct {
|
||||||
Name *byte
|
Name *byte
|
||||||
Namelen uint32
|
Namelen uint32
|
||||||
@@ -382,6 +389,7 @@ const (
|
|||||||
SizeofIPMreq = 0x8
|
SizeofIPMreq = 0x8
|
||||||
SizeofIPMreqn = 0xc
|
SizeofIPMreqn = 0xc
|
||||||
SizeofIPv6Mreq = 0x14
|
SizeofIPv6Mreq = 0x14
|
||||||
|
SizeofPacketMreq = 0x10
|
||||||
SizeofMsghdr = 0x38
|
SizeofMsghdr = 0x38
|
||||||
SizeofCmsghdr = 0x10
|
SizeofCmsghdr = 0x10
|
||||||
SizeofInet4Pktinfo = 0xc
|
SizeofInet4Pktinfo = 0xc
|
||||||
|
|||||||
@@ -288,6 +288,13 @@ type IPv6Mreq struct {
|
|||||||
Interface uint32
|
Interface uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type PacketMreq struct {
|
||||||
|
Ifindex int32
|
||||||
|
Type uint16
|
||||||
|
Alen uint16
|
||||||
|
Address [8]uint8
|
||||||
|
}
|
||||||
|
|
||||||
type Msghdr struct {
|
type Msghdr struct {
|
||||||
Name *byte
|
Name *byte
|
||||||
Namelen uint32
|
Namelen uint32
|
||||||
@@ -382,6 +389,7 @@ const (
|
|||||||
SizeofIPMreq = 0x8
|
SizeofIPMreq = 0x8
|
||||||
SizeofIPMreqn = 0xc
|
SizeofIPMreqn = 0xc
|
||||||
SizeofIPv6Mreq = 0x14
|
SizeofIPv6Mreq = 0x14
|
||||||
|
SizeofPacketMreq = 0x10
|
||||||
SizeofMsghdr = 0x38
|
SizeofMsghdr = 0x38
|
||||||
SizeofCmsghdr = 0x10
|
SizeofCmsghdr = 0x10
|
||||||
SizeofInet4Pktinfo = 0xc
|
SizeofInet4Pktinfo = 0xc
|
||||||
|
|||||||
@@ -288,6 +288,13 @@ type IPv6Mreq struct {
|
|||||||
Interface uint32
|
Interface uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type PacketMreq struct {
|
||||||
|
Ifindex int32
|
||||||
|
Type uint16
|
||||||
|
Alen uint16
|
||||||
|
Address [8]uint8
|
||||||
|
}
|
||||||
|
|
||||||
type Msghdr struct {
|
type Msghdr struct {
|
||||||
Name *byte
|
Name *byte
|
||||||
Namelen uint32
|
Namelen uint32
|
||||||
@@ -380,6 +387,7 @@ const (
|
|||||||
SizeofIPMreq = 0x8
|
SizeofIPMreq = 0x8
|
||||||
SizeofIPMreqn = 0xc
|
SizeofIPMreqn = 0xc
|
||||||
SizeofIPv6Mreq = 0x14
|
SizeofIPv6Mreq = 0x14
|
||||||
|
SizeofPacketMreq = 0x10
|
||||||
SizeofMsghdr = 0x1c
|
SizeofMsghdr = 0x1c
|
||||||
SizeofCmsghdr = 0xc
|
SizeofCmsghdr = 0xc
|
||||||
SizeofInet4Pktinfo = 0xc
|
SizeofInet4Pktinfo = 0xc
|
||||||
|
|||||||
@@ -289,6 +289,13 @@ type IPv6Mreq struct {
|
|||||||
Interface uint32
|
Interface uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type PacketMreq struct {
|
||||||
|
Ifindex int32
|
||||||
|
Type uint16
|
||||||
|
Alen uint16
|
||||||
|
Address [8]uint8
|
||||||
|
}
|
||||||
|
|
||||||
type Msghdr struct {
|
type Msghdr struct {
|
||||||
Name *byte
|
Name *byte
|
||||||
Namelen uint32
|
Namelen uint32
|
||||||
@@ -383,6 +390,7 @@ const (
|
|||||||
SizeofIPMreq = 0x8
|
SizeofIPMreq = 0x8
|
||||||
SizeofIPMreqn = 0xc
|
SizeofIPMreqn = 0xc
|
||||||
SizeofIPv6Mreq = 0x14
|
SizeofIPv6Mreq = 0x14
|
||||||
|
SizeofPacketMreq = 0x10
|
||||||
SizeofMsghdr = 0x38
|
SizeofMsghdr = 0x38
|
||||||
SizeofCmsghdr = 0x10
|
SizeofCmsghdr = 0x10
|
||||||
SizeofInet4Pktinfo = 0xc
|
SizeofInet4Pktinfo = 0xc
|
||||||
|
|||||||
@@ -289,6 +289,13 @@ type IPv6Mreq struct {
|
|||||||
Interface uint32
|
Interface uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type PacketMreq struct {
|
||||||
|
Ifindex int32
|
||||||
|
Type uint16
|
||||||
|
Alen uint16
|
||||||
|
Address [8]uint8
|
||||||
|
}
|
||||||
|
|
||||||
type Msghdr struct {
|
type Msghdr struct {
|
||||||
Name *byte
|
Name *byte
|
||||||
Namelen uint32
|
Namelen uint32
|
||||||
@@ -383,6 +390,7 @@ const (
|
|||||||
SizeofIPMreq = 0x8
|
SizeofIPMreq = 0x8
|
||||||
SizeofIPMreqn = 0xc
|
SizeofIPMreqn = 0xc
|
||||||
SizeofIPv6Mreq = 0x14
|
SizeofIPv6Mreq = 0x14
|
||||||
|
SizeofPacketMreq = 0x10
|
||||||
SizeofMsghdr = 0x38
|
SizeofMsghdr = 0x38
|
||||||
SizeofCmsghdr = 0x10
|
SizeofCmsghdr = 0x10
|
||||||
SizeofInet4Pktinfo = 0xc
|
SizeofInet4Pktinfo = 0xc
|
||||||
|
|||||||
@@ -288,6 +288,13 @@ type IPv6Mreq struct {
|
|||||||
Interface uint32
|
Interface uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type PacketMreq struct {
|
||||||
|
Ifindex int32
|
||||||
|
Type uint16
|
||||||
|
Alen uint16
|
||||||
|
Address [8]uint8
|
||||||
|
}
|
||||||
|
|
||||||
type Msghdr struct {
|
type Msghdr struct {
|
||||||
Name *byte
|
Name *byte
|
||||||
Namelen uint32
|
Namelen uint32
|
||||||
@@ -382,6 +389,7 @@ const (
|
|||||||
SizeofIPMreq = 0x8
|
SizeofIPMreq = 0x8
|
||||||
SizeofIPMreqn = 0xc
|
SizeofIPMreqn = 0xc
|
||||||
SizeofIPv6Mreq = 0x14
|
SizeofIPv6Mreq = 0x14
|
||||||
|
SizeofPacketMreq = 0x10
|
||||||
SizeofMsghdr = 0x38
|
SizeofMsghdr = 0x38
|
||||||
SizeofCmsghdr = 0x10
|
SizeofCmsghdr = 0x10
|
||||||
SizeofInet4Pktinfo = 0xc
|
SizeofInet4Pktinfo = 0xc
|
||||||
|
|||||||
Reference in New Issue
Block a user