diff --git a/unix/mkpost.go b/unix/mkpost.go index 783f11d96..ec31df2c5 100644 --- a/unix/mkpost.go +++ b/unix/mkpost.go @@ -110,6 +110,15 @@ func main() { icmpV6Regex := regexp.MustCompile(`type (ICMPv6Filter) struct {(\s+)X__icmp6_filt(\s+\S+\s+)}`) b = icmpV6Regex.ReplaceAll(b, []byte("type $1 struct {${2}Filt$3}")) + // Intentionally export address storage field in SockaddrStorage convert it to [N]byte. + convertSockaddrStorageData := regexp.MustCompile(`(X__ss_padding)\s+\[(\d+)\]u?int8`) + sockaddrStorageType := regexp.MustCompile(`type SockaddrStorage struct {[^}]*}`) + sockaddrStorageStructs := sockaddrStorageType.FindAll(b, -1) + for _, s := range sockaddrStorageStructs { + newNames := convertSockaddrStorageData.ReplaceAll(s, []byte("Data [$2]byte")) + b = bytes.Replace(b, s, newNames, 1) + } + // If we have empty Ptrace structs, we should delete them. Only s390x emits // nonempty Ptrace structs. ptraceRexexp := regexp.MustCompile(`type Ptrace((Psw|Fpregs|Per) struct {\s*})`) diff --git a/unix/syscall_linux.go b/unix/syscall_linux.go index bbcad678b..973533153 100644 --- a/unix/syscall_linux.go +++ b/unix/syscall_linux.go @@ -1364,6 +1364,10 @@ func SetsockoptTCPRepairOpt(fd, level, opt int, o []TCPRepairOpt) (err error) { return setsockopt(fd, level, opt, unsafe.Pointer(&o[0]), uintptr(SizeofTCPRepairOpt*len(o))) } +func SetsockoptTCPMD5Sig(fd, level, opt int, s *TCPMD5Sig) error { + return setsockopt(fd, level, opt, unsafe.Pointer(s), unsafe.Sizeof(*s)) +} + // Keyctl Commands (http://man7.org/linux/man-pages/man2/keyctl.2.html) // KeyctlInt calls keyctl commands in which each argument is an int. diff --git a/unix/ztypes_linux_386.go b/unix/ztypes_linux_386.go index 89c516a29..4ecc1495c 100644 --- a/unix/ztypes_linux_386.go +++ b/unix/ztypes_linux_386.go @@ -414,7 +414,7 @@ const ( type SockaddrStorage struct { Family uint16 - _ [122]int8 + Data [122]byte _ uint32 } diff --git a/unix/ztypes_linux_amd64.go b/unix/ztypes_linux_amd64.go index 62b4fb269..34fddff96 100644 --- a/unix/ztypes_linux_amd64.go +++ b/unix/ztypes_linux_amd64.go @@ -427,7 +427,7 @@ const ( type SockaddrStorage struct { Family uint16 - _ [118]int8 + Data [118]byte _ uint64 } diff --git a/unix/ztypes_linux_arm.go b/unix/ztypes_linux_arm.go index e86b35893..3b14a6031 100644 --- a/unix/ztypes_linux_arm.go +++ b/unix/ztypes_linux_arm.go @@ -405,7 +405,7 @@ const ( type SockaddrStorage struct { Family uint16 - _ [122]uint8 + Data [122]byte _ uint32 } diff --git a/unix/ztypes_linux_arm64.go b/unix/ztypes_linux_arm64.go index 6c6be4c91..0517651ab 100644 --- a/unix/ztypes_linux_arm64.go +++ b/unix/ztypes_linux_arm64.go @@ -406,7 +406,7 @@ const ( type SockaddrStorage struct { Family uint16 - _ [118]int8 + Data [118]byte _ uint64 } diff --git a/unix/ztypes_linux_loong64.go b/unix/ztypes_linux_loong64.go index 4982ea355..3b0c51813 100644 --- a/unix/ztypes_linux_loong64.go +++ b/unix/ztypes_linux_loong64.go @@ -407,7 +407,7 @@ const ( type SockaddrStorage struct { Family uint16 - _ [118]int8 + Data [118]byte _ uint64 } diff --git a/unix/ztypes_linux_mips.go b/unix/ztypes_linux_mips.go index 173141a67..fccdf4dd0 100644 --- a/unix/ztypes_linux_mips.go +++ b/unix/ztypes_linux_mips.go @@ -410,7 +410,7 @@ const ( type SockaddrStorage struct { Family uint16 - _ [122]int8 + Data [122]byte _ uint32 } diff --git a/unix/ztypes_linux_mips64.go b/unix/ztypes_linux_mips64.go index 93ae4c516..500de8fc0 100644 --- a/unix/ztypes_linux_mips64.go +++ b/unix/ztypes_linux_mips64.go @@ -409,7 +409,7 @@ const ( type SockaddrStorage struct { Family uint16 - _ [118]int8 + Data [118]byte _ uint64 } diff --git a/unix/ztypes_linux_mips64le.go b/unix/ztypes_linux_mips64le.go index 4e4e510ca..d0434cd2c 100644 --- a/unix/ztypes_linux_mips64le.go +++ b/unix/ztypes_linux_mips64le.go @@ -409,7 +409,7 @@ const ( type SockaddrStorage struct { Family uint16 - _ [118]int8 + Data [118]byte _ uint64 } diff --git a/unix/ztypes_linux_mipsle.go b/unix/ztypes_linux_mipsle.go index 3f5ba013d..84206ba53 100644 --- a/unix/ztypes_linux_mipsle.go +++ b/unix/ztypes_linux_mipsle.go @@ -410,7 +410,7 @@ const ( type SockaddrStorage struct { Family uint16 - _ [122]int8 + Data [122]byte _ uint32 } diff --git a/unix/ztypes_linux_ppc.go b/unix/ztypes_linux_ppc.go index 71dfe7cdb..ab078cf1f 100644 --- a/unix/ztypes_linux_ppc.go +++ b/unix/ztypes_linux_ppc.go @@ -417,7 +417,7 @@ const ( type SockaddrStorage struct { Family uint16 - _ [122]uint8 + Data [122]byte _ uint32 } diff --git a/unix/ztypes_linux_ppc64.go b/unix/ztypes_linux_ppc64.go index 3a2b7f0a6..42eb2c4ce 100644 --- a/unix/ztypes_linux_ppc64.go +++ b/unix/ztypes_linux_ppc64.go @@ -416,7 +416,7 @@ const ( type SockaddrStorage struct { Family uint16 - _ [118]uint8 + Data [118]byte _ uint64 } diff --git a/unix/ztypes_linux_ppc64le.go b/unix/ztypes_linux_ppc64le.go index a52d62756..31304a4e8 100644 --- a/unix/ztypes_linux_ppc64le.go +++ b/unix/ztypes_linux_ppc64le.go @@ -416,7 +416,7 @@ const ( type SockaddrStorage struct { Family uint16 - _ [118]uint8 + Data [118]byte _ uint64 } diff --git a/unix/ztypes_linux_riscv64.go b/unix/ztypes_linux_riscv64.go index dfc007d8a..c311f9612 100644 --- a/unix/ztypes_linux_riscv64.go +++ b/unix/ztypes_linux_riscv64.go @@ -434,7 +434,7 @@ const ( type SockaddrStorage struct { Family uint16 - _ [118]uint8 + Data [118]byte _ uint64 } diff --git a/unix/ztypes_linux_s390x.go b/unix/ztypes_linux_s390x.go index b53cb9103..bba3cefac 100644 --- a/unix/ztypes_linux_s390x.go +++ b/unix/ztypes_linux_s390x.go @@ -429,7 +429,7 @@ const ( type SockaddrStorage struct { Family uint16 - _ [118]int8 + Data [118]byte _ uint64 } diff --git a/unix/ztypes_linux_sparc64.go b/unix/ztypes_linux_sparc64.go index fe0aa3547..ad8a01380 100644 --- a/unix/ztypes_linux_sparc64.go +++ b/unix/ztypes_linux_sparc64.go @@ -411,7 +411,7 @@ const ( type SockaddrStorage struct { Family uint16 - _ [118]int8 + Data [118]byte _ uint64 }