From fe16172d1123f5350a8c5585395465de6866de4c Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Mon, 2 Dec 2024 21:16:52 -0800 Subject: [PATCH] unix: define IfMsghdr2, IfData64, and RtMsghdr2 on darwin Change-Id: I6943f6b5bd9f7d0ef5bad24ed638b8cf5dd0353d Reviewed-on: https://go-review.googlesource.com/c/sys/+/633077 LUCI-TryBot-Result: Go LUCI Auto-Submit: Ian Lance Taylor Reviewed-by: Damien Neil Reviewed-by: Michael Knyszek --- unix/types_darwin.go | 9 ++++++ unix/ztypes_darwin_amd64.go | 60 +++++++++++++++++++++++++++++++++++++ unix/ztypes_darwin_arm64.go | 60 +++++++++++++++++++++++++++++++++++++ 3 files changed, 129 insertions(+) diff --git a/unix/types_darwin.go b/unix/types_darwin.go index 36e2f045d..0dd00770b 100644 --- a/unix/types_darwin.go +++ b/unix/types_darwin.go @@ -256,18 +256,25 @@ type FdSet C.fd_set const ( SizeofIfMsghdr = C.sizeof_struct_if_msghdr + SizeofIfMsghdr2 = C.sizeof_struct_if_msghdr2 SizeofIfData = C.sizeof_struct_if_data + SizeofIfData64 = C.sizeof_struct_if_data64 SizeofIfaMsghdr = C.sizeof_struct_ifa_msghdr SizeofIfmaMsghdr = C.sizeof_struct_ifma_msghdr SizeofIfmaMsghdr2 = C.sizeof_struct_ifma_msghdr2 SizeofRtMsghdr = C.sizeof_struct_rt_msghdr + SizeofRtMsghdr2 = C.sizeof_struct_rt_msghdr2 SizeofRtMetrics = C.sizeof_struct_rt_metrics ) type IfMsghdr C.struct_if_msghdr +type IfMsghdr2 C.struct_if_msghdr2 + type IfData C.struct_if_data +type IfData64 C.struct_if_data64 + type IfaMsghdr C.struct_ifa_msghdr type IfmaMsghdr C.struct_ifma_msghdr @@ -276,6 +283,8 @@ type IfmaMsghdr2 C.struct_ifma_msghdr2 type RtMsghdr C.struct_rt_msghdr +type RtMsghdr2 C.struct_rt_msghdr2 + type RtMetrics C.struct_rt_metrics // Berkeley packet filter diff --git a/unix/ztypes_darwin_amd64.go b/unix/ztypes_darwin_amd64.go index d003c3d43..17c53bd9b 100644 --- a/unix/ztypes_darwin_amd64.go +++ b/unix/ztypes_darwin_amd64.go @@ -462,11 +462,14 @@ type FdSet struct { const ( SizeofIfMsghdr = 0x70 + SizeofIfMsghdr2 = 0xa0 SizeofIfData = 0x60 + SizeofIfData64 = 0x80 SizeofIfaMsghdr = 0x14 SizeofIfmaMsghdr = 0x10 SizeofIfmaMsghdr2 = 0x14 SizeofRtMsghdr = 0x5c + SizeofRtMsghdr2 = 0x5c SizeofRtMetrics = 0x38 ) @@ -480,6 +483,20 @@ type IfMsghdr struct { Data IfData } +type IfMsghdr2 struct { + Msglen uint16 + Version uint8 + Type uint8 + Addrs int32 + Flags int32 + Index uint16 + Snd_len int32 + Snd_maxlen int32 + Snd_drops int32 + Timer int32 + Data IfData64 +} + type IfData struct { Type uint8 Typelen uint8 @@ -512,6 +529,34 @@ type IfData struct { Reserved2 uint32 } +type IfData64 struct { + Type uint8 + Typelen uint8 + Physical uint8 + Addrlen uint8 + Hdrlen uint8 + Recvquota uint8 + Xmitquota uint8 + Unused1 uint8 + Mtu uint32 + Metric uint32 + Baudrate uint64 + Ipackets uint64 + Ierrors uint64 + Opackets uint64 + Oerrors uint64 + Collisions uint64 + Ibytes uint64 + Obytes uint64 + Imcasts uint64 + Omcasts uint64 + Iqdrops uint64 + Noproto uint64 + Recvtiming uint32 + Xmittiming uint32 + Lastchange Timeval32 +} + type IfaMsghdr struct { Msglen uint16 Version uint8 @@ -557,6 +602,21 @@ type RtMsghdr struct { Rmx RtMetrics } +type RtMsghdr2 struct { + Msglen uint16 + Version uint8 + Type uint8 + Index uint16 + Flags int32 + Addrs int32 + Refcnt int32 + Parentflags int32 + Reserved int32 + Use int32 + Inits uint32 + Rmx RtMetrics +} + type RtMetrics struct { Locks uint32 Mtu uint32 diff --git a/unix/ztypes_darwin_arm64.go b/unix/ztypes_darwin_arm64.go index 0d45a941a..2392226a7 100644 --- a/unix/ztypes_darwin_arm64.go +++ b/unix/ztypes_darwin_arm64.go @@ -462,11 +462,14 @@ type FdSet struct { const ( SizeofIfMsghdr = 0x70 + SizeofIfMsghdr2 = 0xa0 SizeofIfData = 0x60 + SizeofIfData64 = 0x80 SizeofIfaMsghdr = 0x14 SizeofIfmaMsghdr = 0x10 SizeofIfmaMsghdr2 = 0x14 SizeofRtMsghdr = 0x5c + SizeofRtMsghdr2 = 0x5c SizeofRtMetrics = 0x38 ) @@ -480,6 +483,20 @@ type IfMsghdr struct { Data IfData } +type IfMsghdr2 struct { + Msglen uint16 + Version uint8 + Type uint8 + Addrs int32 + Flags int32 + Index uint16 + Snd_len int32 + Snd_maxlen int32 + Snd_drops int32 + Timer int32 + Data IfData64 +} + type IfData struct { Type uint8 Typelen uint8 @@ -512,6 +529,34 @@ type IfData struct { Reserved2 uint32 } +type IfData64 struct { + Type uint8 + Typelen uint8 + Physical uint8 + Addrlen uint8 + Hdrlen uint8 + Recvquota uint8 + Xmitquota uint8 + Unused1 uint8 + Mtu uint32 + Metric uint32 + Baudrate uint64 + Ipackets uint64 + Ierrors uint64 + Opackets uint64 + Oerrors uint64 + Collisions uint64 + Ibytes uint64 + Obytes uint64 + Imcasts uint64 + Omcasts uint64 + Iqdrops uint64 + Noproto uint64 + Recvtiming uint32 + Xmittiming uint32 + Lastchange Timeval32 +} + type IfaMsghdr struct { Msglen uint16 Version uint8 @@ -557,6 +602,21 @@ type RtMsghdr struct { Rmx RtMetrics } +type RtMsghdr2 struct { + Msglen uint16 + Version uint8 + Type uint8 + Index uint16 + Flags int32 + Addrs int32 + Refcnt int32 + Parentflags int32 + Reserved int32 + Use int32 + Inits uint32 + Rmx RtMetrics +} + type RtMetrics struct { Locks uint32 Mtu uint32