mirror of
https://github.com/rwinkhart/sys.git
synced 2026-09-05 16:47:27 -04:00
unix: add SetsockoptTCPMD5Sig on linux
This allows to set the TCP MD5 signature (see https://www.rfc-editor.org/rfc/rfc2385) using TCPMD5Sig introduced in CL 106656. Also export the storage data field in SockaddrStorage and convert it to a byte array so the address in TCPMD5Sig.Addr can be set from an net.IP without conversion. Change-Id: I6bccfab57c188fcef857a6a3c514c943ca00b670 Reviewed-on: https://go-review.googlesource.com/c/sys/+/472835 Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
This commit is contained in:
committed by
Gopher Robot
parent
a6bfb89d2f
commit
147085206c
@@ -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*})`)
|
||||
|
||||
Reference in New Issue
Block a user