From b1c119fd706060c1fa95f6e83dc98d6aacf7c7ad Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Tue, 6 Jul 2021 00:31:59 +0200 Subject: [PATCH] unix: move ICMP{,V6}_FILTER* const definitions The C headers defining these constants pull in which leads to definition conflicts between kernel and glibc headers when running mkerrors.sh for Linux kernel 5.13. Avoid these by moving this const definitions to linux/types.go. For golang/go#47057 Change-Id: I09a2391dfe4c6bb38b7069e952748070c10824e6 Reviewed-on: https://go-review.googlesource.com/c/sys/+/332929 Trust: Tobias Klauser Run-TryBot: Tobias Klauser TryBot-Result: Go Bot Reviewed-by: Ian Lance Taylor --- unix/linux/types.go | 13 +++++++++++++ unix/mkerrors.sh | 2 -- unix/zerrors_linux.go | 6 ------ unix/ztypes_linux.go | 10 ++++++++++ 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/unix/linux/types.go b/unix/linux/types.go index cc884adf..d57c1db7 100644 --- a/unix/linux/types.go +++ b/unix/linux/types.go @@ -98,6 +98,7 @@ struct termios2 { #include #include #include +#include #include #include #include @@ -804,6 +805,18 @@ type NdUseroptmsg C.struct_nduseroptmsg type NdMsg C.struct_ndmsg +// ICMP socket options + +const ( + ICMP_FILTER = C.ICMP_FILTER + + ICMPV6_FILTER = C.ICMPV6_FILTER + ICMPV6_FILTER_BLOCK = C.ICMPV6_FILTER_BLOCK + ICMPV6_FILTER_BLOCKOTHERS = C.ICMPV6_FILTER_BLOCKOTHERS + ICMPV6_FILTER_PASS = C.ICMPV6_FILTER_PASS + ICMPV6_FILTER_PASSONLY = C.ICMPV6_FILTER_PASSONLY +) + // Linux socket filter const ( diff --git a/unix/mkerrors.sh b/unix/mkerrors.sh index 6e6afcaa..2ed4b6d9 100755 --- a/unix/mkerrors.sh +++ b/unix/mkerrors.sh @@ -217,8 +217,6 @@ struct ltchars { #include #include #include -#include -#include #include #include #include diff --git a/unix/zerrors_linux.go b/unix/zerrors_linux.go index 52f5bbc1..70b4b521 100644 --- a/unix/zerrors_linux.go +++ b/unix/zerrors_linux.go @@ -981,12 +981,6 @@ const ( HPFS_SUPER_MAGIC = 0xf995e849 HUGETLBFS_MAGIC = 0x958458f6 IBSHIFT = 0x10 - ICMPV6_FILTER = 0x1 - ICMPV6_FILTER_BLOCK = 0x1 - ICMPV6_FILTER_BLOCKOTHERS = 0x3 - ICMPV6_FILTER_PASS = 0x2 - ICMPV6_FILTER_PASSONLY = 0x4 - ICMP_FILTER = 0x1 ICRNL = 0x100 IFA_F_DADFAILED = 0x8 IFA_F_DEPRECATED = 0x20 diff --git a/unix/ztypes_linux.go b/unix/ztypes_linux.go index c9d7eb41..3874bee8 100644 --- a/unix/ztypes_linux.go +++ b/unix/ztypes_linux.go @@ -681,6 +681,16 @@ type NdMsg struct { Type uint8 } +const ( + ICMP_FILTER = 0x1 + + ICMPV6_FILTER = 0x1 + ICMPV6_FILTER_BLOCK = 0x1 + ICMPV6_FILTER_BLOCKOTHERS = 0x3 + ICMPV6_FILTER_PASS = 0x2 + ICMPV6_FILTER_PASSONLY = 0x4 +) + const ( SizeofSockFilter = 0x8 )