From 0293703b0ad8c5db21b6ee27bfb7addec1877064 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan-Luis=20de=20Sousa-Valadas=20Casta=C3=B1o?= Date: Tue, 12 Aug 2025 11:06:45 +0000 Subject: [PATCH] unix: add IFAL_* consts and ifaddrlblmsg on linux Implments consts and structs related to ifaddrlabel Change-Id: I6dd78e74a8e32a26286b95b0a7a20343cb16a446 GitHub-Last-Rev: 11be45c36dcbd7aa31009dfaf966eaebcbf9bbb0 GitHub-Pull-Request: golang/sys#252 Reviewed-on: https://go-review.googlesource.com/c/sys/+/683775 Reviewed-by: Tobias Klauser Reviewed-by: Michael Pratt Reviewed-by: Florian Lehner LUCI-TryBot-Result: Go LUCI Reviewed-by: Cherry Mui Auto-Submit: Tobias Klauser --- unix/linux/types.go | 6 ++++++ unix/ztypes_linux.go | 12 ++++++++++++ 2 files changed, 18 insertions(+) diff --git a/unix/linux/types.go b/unix/linux/types.go index 8dec5a30..2ac19032 100644 --- a/unix/linux/types.go +++ b/unix/linux/types.go @@ -121,6 +121,7 @@ struct termios2 { #include #include #include +#include #include #include #include @@ -878,6 +879,8 @@ const ( IFA_FLAGS = C.IFA_FLAGS IFA_RT_PRIORITY = C.IFA_RT_PRIORITY IFA_TARGET_NETNSID = C.IFA_TARGET_NETNSID + IFAL_LABEL = C.IFAL_LABEL + IFAL_ADDRESS = C.IFAL_ADDRESS RT_SCOPE_UNIVERSE = C.RT_SCOPE_UNIVERSE RT_SCOPE_SITE = C.RT_SCOPE_SITE RT_SCOPE_LINK = C.RT_SCOPE_LINK @@ -935,6 +938,7 @@ const ( SizeofRtAttr = C.sizeof_struct_rtattr SizeofIfInfomsg = C.sizeof_struct_ifinfomsg SizeofIfAddrmsg = C.sizeof_struct_ifaddrmsg + SizeofIfAddrlblmsg = C.sizeof_struct_ifaddrlblmsg SizeofIfaCacheinfo = C.sizeof_struct_ifa_cacheinfo SizeofRtMsg = C.sizeof_struct_rtmsg SizeofRtNexthop = C.sizeof_struct_rtnexthop @@ -956,6 +960,8 @@ type IfInfomsg C.struct_ifinfomsg type IfAddrmsg C.struct_ifaddrmsg +type IfAddrlblmsg C.struct_ifaddrlblmsg + type IfaCacheinfo C.struct_ifa_cacheinfo type RtMsg C.struct_rtmsg diff --git a/unix/ztypes_linux.go b/unix/ztypes_linux.go index 0c66bf0d..944e75a1 100644 --- a/unix/ztypes_linux.go +++ b/unix/ztypes_linux.go @@ -632,6 +632,8 @@ const ( IFA_FLAGS = 0x8 IFA_RT_PRIORITY = 0x9 IFA_TARGET_NETNSID = 0xa + IFAL_LABEL = 0x2 + IFAL_ADDRESS = 0x1 RT_SCOPE_UNIVERSE = 0x0 RT_SCOPE_SITE = 0xc8 RT_SCOPE_LINK = 0xfd @@ -689,6 +691,7 @@ const ( SizeofRtAttr = 0x4 SizeofIfInfomsg = 0x10 SizeofIfAddrmsg = 0x8 + SizeofIfAddrlblmsg = 0xc SizeofIfaCacheinfo = 0x10 SizeofRtMsg = 0xc SizeofRtNexthop = 0x8 @@ -740,6 +743,15 @@ type IfAddrmsg struct { Index uint32 } +type IfAddrlblmsg struct { + Family uint8 + _ uint8 + Prefixlen uint8 + Flags uint8 + Index uint32 + Seq uint32 +} + type IfaCacheinfo struct { Prefered uint32 Valid uint32