chore: bump deps

This commit is contained in:
Roman Perekhod committed 2026-10-29 13:51:15 +01:00
1 parent d97113b872
commit 71e6837e86
32 files changed
+238 -57

No files matched your search

+2 -2
View File
@@ -100,7 +100,7 @@ require (
golang.org/x/crypto v0.58.0
golang.org/x/exp v0.0.0-20260410095643-746e56fc9e2f
golang.org/x/image v0.45.0
golang.org/x/net v0.61.0
golang.org/x/net v0.62.0
golang.org/x/oauth2 v0.36.0
golang.org/x/sync v0.24.0
golang.org/x/term v0.47.0
@@ -329,7 +329,7 @@ require (
github.com/yashtewari/glob-intersection v0.2.0 // indirect
github.com/zeebo/xxh3 v1.1.0 // indirect
go.etcd.io/etcd/api/v3 v3.6.11 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.6.11 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.7.3 // indirect
go.etcd.io/etcd/client/v3 v3.6.11 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
+4 -4
View File
@@ -950,8 +950,8 @@ go.etcd.io/bbolt v1.4.3 h1:dEadXpI6G79deX5prL3QRNP6JB8UxVkqo4UPnHaNXJo=
go.etcd.io/bbolt v1.4.3/go.mod h1:tKQlpPaYCVFctUIgFKFnAlvbmB3tpy1vkTnDWohtc0E=
go.etcd.io/etcd/api/v3 v3.6.11 h1:XFGTgrJ8nak3kB4NgMG8t7NT+lEeuuvKQAqUHKVgkWQ=
go.etcd.io/etcd/api/v3 v3.6.11/go.mod h1:HYfTh0jyh+uFgp6gMbxJteIDYY97yMuYz85Rnw6Gy9o=
go.etcd.io/etcd/client/pkg/v3 v3.6.11 h1:e41mp315Yn3QMGPmEzCyLsMINgJXTY/dX8kM++1csxU=
go.etcd.io/etcd/client/pkg/v3 v3.6.11/go.mod h1:DysuMe/inqRyC/1tjRR6hReH/VV9Lufs27YKSKBWWJg=
go.etcd.io/etcd/client/pkg/v3 v3.7.3 h1:5zMwNu3ycrzCeA5NwOfQbxFRhqq974chq1DrYMua4QI=
go.etcd.io/etcd/client/pkg/v3 v3.7.3/go.mod h1:/OhzqYrF0U7d1NOk55VMyUQGbYD1WoIe4bJwxb47wOk=
go.etcd.io/etcd/client/v3 v3.6.11 h1:LAByD96VmmeuairkvdAcE0RZnrmGz/q3ceeWePo9bwc=
go.etcd.io/etcd/client/v3 v3.6.11/go.mod h1:vOTDMCo+fGPEClJqcFEFSqZ+8e7WKV7AyqJjX//HR2w=
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
@@ -1098,8 +1098,8 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
golang.org/x/net v0.61.0 h1:RR+6j/BTBCrggOLugxa+66R8FvoN6MHlzDlZIbN9YFw=
golang.org/x/net v0.61.0/go.mod h1:WgDCOTH8iwtB66T4/GfI94AHo/hhdb7Hah9NDseQfiI=
golang.org/x/net v0.62.0 h1:18ELalfM5+XNRwzM2nYqXsZQ9ByS1uhj2O/U7+5jqRY=
golang.org/x/net v0.62.0/go.mod h1:WgDCOTH8iwtB66T4/GfI94AHo/hhdb7Hah9NDseQfiI=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
+1 -1
View File
@@ -187,7 +187,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Copyright 2020 The etcd Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
+5
View File
@@ -74,6 +74,11 @@ func purgeFile(lg *zap.Logger, dirname string, suffix string, max uint, interval
}
}
if err = os.Remove(f); err != nil {
if flock {
if closeErr := l.Close(); closeErr != nil {
lg.Error("failed to unlock/close", zap.String("path", l.Name()), zap.Error(closeErr))
}
}
lg.Error("failed to remove file", zap.String("path", f), zap.Error(err))
errC <- err
return
+4
View File
@@ -35,6 +35,10 @@ import (
// back to writing to the original writer.
// The decode overhead is only <30µs per write.
// Reference: https://github.com/coreos/pkg/blob/master/capnslog/journald_formatter.go
//
// Deprecated: NewJournalWriter will be removed in v3.8, so that client/pkg/v3
// no longer depends on github.com/coreos/go-systemd/v22. Copy this file if you
// need the writer, or use github.com/coreos/go-systemd/v22/journal directly.
func NewJournalWriter(wr io.Writer) (io.Writer, error) {
return &journalWriter{Writer: wr}, systemd.DialJournal()
}
+1 -1
View File
@@ -39,7 +39,7 @@ import (
"go.etcd.io/etcd/client/pkg/v3/verify"
)
// NewListener creates a new listner.
// NewListener creates a new listener.
func NewListener(addr, scheme string, tlsinfo *TLSInfo) (l net.Listener, err error) {
return newListener(addr, scheme, WithTLSInfo(tlsinfo))
}
+1 -1
View File
@@ -53,7 +53,7 @@ func (lo *ListenerOptions) IsSocketOpts() bool {
return lo.socketOpts.ReusePort || lo.socketOpts.ReuseAddress
}
// IsTLS returns true if listner options includes TLSInfo.
// IsTLS returns true if listener options includes TLSInfo.
func (lo *ListenerOptions) IsTLS() bool {
if lo.tlsInfo == nil {
return false
+31
View File
@@ -23,6 +23,12 @@ import (
"os"
"strings"
"sync"
"time"
)
const (
// tlsHandshakeTimeout bounds how long a single TLS handshake may block.
tlsHandshakeTimeout = 10 * time.Second
)
// tlsListener overrides a TLS listener so it will reject client
@@ -143,6 +149,7 @@ func (l *tlsListener) acceptLoop() {
}()
tlsConn := conn.(*tls.Conn)
_ = tlsConn.SetDeadline(time.Now().Add(tlsHandshakeTimeout))
herr := tlsConn.Handshake()
pendingMu.Lock()
delete(pending, conn)
@@ -152,6 +159,7 @@ func (l *tlsListener) acceptLoop() {
l.handshakeFailure(tlsConn, herr)
return
}
_ = tlsConn.SetDeadline(time.Time{})
if err := l.check(ctx, tlsConn); err != nil {
l.handshakeFailure(tlsConn, err)
return
@@ -166,6 +174,29 @@ func (l *tlsListener) acceptLoop() {
}
}
// ConfigureCRLVerification appends a VerifyConnection hook to cfg that
// rejects any peer certificate whose serial number appears in the CRL file
// configured on info. It is a no-op when CRLFile is empty. Any existing
// VerifyConnection hook is called first and its error short-circuits.
func (info TLSInfo) ConfigureCRLVerification(cfg *tls.Config) {
if len(info.CRLFile) == 0 {
return
}
crlFile := info.CRLFile
prev := cfg.VerifyConnection
cfg.VerifyConnection = func(cs tls.ConnectionState) error {
if prev != nil {
if err := prev(cs); err != nil {
return err
}
}
if len(cs.PeerCertificates) == 0 {
return nil
}
return checkCRL(crlFile, cs.PeerCertificates)
}
}
func checkCRL(crlPath string, cert []*x509.Certificate) error {
// TODO: cache
crlBytes, err := os.ReadFile(crlPath)
+1 -1
View File
@@ -39,7 +39,7 @@ func NewTimeoutTransport(info TLSInfo, dialtimeoutd, rdtimeoutd, wtimeoutd time.
tr.MaxIdleConnsPerHost = 1024
}
tr.Dial = (&rwTimeoutDialer{
tr.Dial = (&rwTimeoutDialer{ //nolint:staticcheck // TODO: remove for a supported version
Dialer: net.Dialer{
Timeout: dialtimeoutd,
KeepAlive: 30 * time.Second,
+34 -9
View File
@@ -23,15 +23,23 @@ import (
type Set interface {
Add(string)
Remove(string)
Contains(string) bool
Contains(val ...string) bool
Equals(Set) bool
Length() int
Values() []string
Copy() Set
Sub(Set) Set
// ContainsAll returns whether the set contains all given values
// Deprecated: Use Contains instead.
ContainsAll(values []string) bool
}
func NewUnsafeSet(values ...string) *unsafeSet {
type ThreadsafeSet interface {
Set
}
func NewUnsafeSet(values ...string) Set {
set := &unsafeSet{make(map[string]struct{})}
for _, v := range values {
set.Add(v)
@@ -39,11 +47,13 @@ func NewUnsafeSet(values ...string) *unsafeSet {
return set
}
func NewThreadsafeSet(values ...string) *tsafeSet {
func NewThreadsafeSet(values ...string) ThreadsafeSet {
us := NewUnsafeSet(values...)
return &tsafeSet{us, sync.RWMutex{}}
}
var _ Set = (*unsafeSet)(nil)
type unsafeSet struct {
d map[string]struct{}
}
@@ -59,12 +69,17 @@ func (us *unsafeSet) Remove(value string) {
}
// Contains returns whether the set contains the given value
func (us *unsafeSet) Contains(value string) (exists bool) {
_, exists = us.d[value]
return exists
func (us *unsafeSet) Contains(values ...string) (exists bool) {
for _, value := range values {
if _, exists := us.d[value]; !exists {
return false
}
}
return true
}
// ContainsAll returns whether the set contains all given values
// Deprecated: Use Contains instead.
func (us *unsafeSet) ContainsAll(values []string) bool {
for _, s := range values {
if !us.Contains(s) {
@@ -122,8 +137,10 @@ func (us *unsafeSet) Sub(other Set) Set {
return result
}
var _ ThreadsafeSet = (*tsafeSet)(nil)
type tsafeSet struct {
us *unsafeSet
us Set
m sync.RWMutex
}
@@ -139,10 +156,18 @@ func (ts *tsafeSet) Remove(value string) {
ts.us.Remove(value)
}
func (ts *tsafeSet) Contains(value string) (exists bool) {
func (ts *tsafeSet) Contains(values ...string) (exists bool) {
ts.m.RLock()
defer ts.m.RUnlock()
return ts.us.Contains(value)
return ts.us.Contains(values...)
}
// ContainsAll returns whether the set contains all given values
// Deprecated: Use Contains instead.
func (ts *tsafeSet) ContainsAll(values []string) bool {
ts.m.RLock()
defer ts.m.RUnlock()
return ts.us.ContainsAll(values)
}
func (ts *tsafeSet) Equals(other Set) bool {
-1
View File
@@ -47,7 +47,6 @@ func NewURLs(strs []string) (URLs, error) {
return nil, fmt.Errorf("URL must not contain a path: %s", in)
}
case "unix", "unixs":
break
default:
return nil, fmt.Errorf("URL scheme must be http, https, unix, or unixs: %s", in)
}
+11 -2
View File
@@ -66,9 +66,18 @@ func DisableVerifications() func() {
// Verify performs verification if the assertions are enabled.
// In the default setup running in tests and skipped in the production code.
func Verify(f func()) {
func Verify(msg string, f VerifyFunc) {
if IsVerificationEnabled(envVerifyValueAssert) {
f()
ok, details := f()
verifier(ok, msg, details)
}
}
type VerifyFunc func() (condition bool, details map[string]any)
func verifier(condition bool, msg string, details map[string]any) {
if !condition {
panic(fmt.Sprintf("%s. details: %v.", msg, details))
}
}
+21 -2
View File
@@ -51,6 +51,9 @@ type parser struct {
// context is the context element when parsing an HTML fragment
// (section 12.4).
context *Node
// textNodes holds buffers for TextNodes that have had multiple text
// tokens coalesced into them.
textNodes map[*Node][]byte
}
func (p *parser) top() *Node {
@@ -292,7 +295,7 @@ func (p *parser) fosterParent(n *Node) {
prev = parent.LastChild
}
if prev != nil && prev.Type == TextNode && n.Type == TextNode {
prev.Data += n.Data
p.appendText(prev, n.Data)
return
}
@@ -316,7 +319,7 @@ func (p *parser) addText(text string) {
t := p.top()
if n := t.LastChild; n != nil && n.Type == TextNode {
n.Data += text
p.appendText(n, text)
return
}
p.addChild(&Node{
@@ -325,6 +328,18 @@ func (p *parser) addText(text string) {
})
}
func (p *parser) appendText(n *Node, text string) {
if p.textNodes == nil {
p.textNodes = make(map[*Node][]byte)
}
b, ok := p.textNodes[n]
if !ok {
b = []byte(n.Data)
n.Data = ""
}
p.textNodes[n] = append(b, text...)
}
func attrCompare(a, b Attribute) int {
return cmp.Or(
cmp.Compare(a.Namespace, b.Namespace),
@@ -2242,6 +2257,10 @@ func (p *parser) parse() (err error) {
}
p.parseCurrentToken()
}
for n, b := range p.textNodes {
n.Data = string(b)
}
p.textNodes = nil
return nil
}
+11 -12
View File
@@ -246,18 +246,17 @@ func childTextNodesAreLiteral(n *Node) bool {
switch n.Data {
case "iframe", "noembed", "noframes", "noscript", "plaintext", "script", "style", "xmp":
// We need to check if n is a node that was fostered from a HTML namespace
// into a non-HTML namespace (in which case, different rules apply to it).
// We do this by walking up the tree until we find a node with a non-empty
// namespace. If we find such a node, we also have to check if it's
// an HTML integration point. If it isn't, then the node we're currently
// looking at is foster-parented and we should return false.
for p := n.Parent; p != nil; p = p.Parent {
if p.Namespace != "" {
if !htmlIntegrationPoint(p) {
return false
}
break
// n's text is literal only if the parser would keep n in the HTML
// namespace when the output is re-parsed. An ancestor may have been
// fostered under a foreign element (such as an HTML <mglyph> under
// <mtext>) where the parser would instead create it, and its
// descendants, in that element's namespace. We walk up the whole tree
// and check that every transition out of a non-HTML namespace happens
// at an HTML integration point. This is stricter than the parser, so
// some text that would be safe literally is escaped.
for c, p := n, n.Parent; p != nil; c, p = p, p.Parent {
if p.Namespace != "" && p.Namespace != c.Namespace && !htmlIntegrationPoint(p) {
return false
}
}
+7 -3
View File
@@ -129,7 +129,8 @@ func (m ControlMessage) Next(dataLen int) ControlMessage {
// MarshalHeader marshals the header fields of the control message at
// the head on m.
func (m ControlMessage) MarshalHeader(lvl, typ, dataLen int) error {
if len(m) < controlHeaderLen() {
l := controlHeaderLen()
if l <= 0 || len(m) < l {
return errors.New("short message")
}
h := (*cmsghdr)(unsafe.Pointer(&m[0]))
@@ -141,7 +142,7 @@ func (m ControlMessage) MarshalHeader(lvl, typ, dataLen int) error {
// message at the head on m.
func (m ControlMessage) ParseHeader() (lvl, typ, dataLen int, err error) {
l := controlHeaderLen()
if len(m) < l {
if l <= 0 || len(m) < l {
return 0, 0, 0, errors.New("short message")
}
h := (*cmsghdr)(unsafe.Pointer(&m[0]))
@@ -152,7 +153,7 @@ func (m ControlMessage) ParseHeader() (lvl, typ, dataLen int, err error) {
// the next control message.
func (m ControlMessage) Marshal(lvl, typ int, data []byte) (ControlMessage, error) {
l := len(data)
if len(m) < ControlMessageSpace(l) {
if controlHeaderLen() <= 0 || len(m) < ControlMessageSpace(l) {
return nil, errors.New("short message")
}
h := (*cmsghdr)(unsafe.Pointer(&m[0]))
@@ -167,6 +168,9 @@ func (m ControlMessage) Marshal(lvl, typ int, data []byte) (ControlMessage, erro
//
// Parse works for both standard and compatible messages.
func (m ControlMessage) Parse() ([]ControlMessage, error) {
if controlHeaderLen() <= 0 {
return nil, nil
}
var ms []ControlMessage
for len(m) >= controlHeaderLen() {
h := (*cmsghdr)(unsafe.Pointer(&m[0]))
+12
View File
@@ -75,6 +75,9 @@ func (c *payloadHandler) ReadBatch(ms []Message, flags int) (int, error) {
if !c.ok() {
return 0, errInvalidConn
}
if len(ms) == 0 {
return 0, nil
}
switch runtime.GOOS {
case "linux":
n, err := c.RecvMsgs([]socket.Message(ms), flags)
@@ -109,6 +112,9 @@ func (c *payloadHandler) WriteBatch(ms []Message, flags int) (int, error) {
if !c.ok() {
return 0, errInvalidConn
}
if len(ms) == 0 {
return 0, nil
}
switch runtime.GOOS {
case "linux":
n, err := c.SendMsgs([]socket.Message(ms), flags)
@@ -141,6 +147,9 @@ func (c *packetHandler) ReadBatch(ms []Message, flags int) (int, error) {
if !c.ok() {
return 0, errInvalidConn
}
if len(ms) == 0 {
return 0, nil
}
switch runtime.GOOS {
case "linux":
n, err := c.RecvMsgs([]socket.Message(ms), flags)
@@ -175,6 +184,9 @@ func (c *packetHandler) WriteBatch(ms []Message, flags int) (int, error) {
if !c.ok() {
return 0, errInvalidConn
}
if len(ms) == 0 {
return 0, nil
}
switch runtime.GOOS {
case "linux":
n, err := c.SendMsgs([]socket.Message(ms), flags)
+4 -4
View File
@@ -84,13 +84,13 @@ func (cm *ControlMessage) Parse(b []byte) error {
continue
}
switch {
case typ == ctlOpts[ctlTTL].name && l >= ctlOpts[ctlTTL].length:
case ctlOpts[ctlTTL].name > 0 && typ == ctlOpts[ctlTTL].name && l >= ctlOpts[ctlTTL].length:
ctlOpts[ctlTTL].parse(cm, m.Data(l))
case typ == ctlOpts[ctlDst].name && l >= ctlOpts[ctlDst].length:
case ctlOpts[ctlDst].name > 0 && typ == ctlOpts[ctlDst].name && l >= ctlOpts[ctlDst].length:
ctlOpts[ctlDst].parse(cm, m.Data(l))
case typ == ctlOpts[ctlInterface].name && l >= ctlOpts[ctlInterface].length:
case ctlOpts[ctlInterface].name > 0 && typ == ctlOpts[ctlInterface].name && l >= ctlOpts[ctlInterface].length:
ctlOpts[ctlInterface].parse(cm, m.Data(l))
case typ == ctlOpts[ctlPacketInfo].name && l >= ctlOpts[ctlPacketInfo].length:
case ctlOpts[ctlPacketInfo].name > 0 && typ == ctlOpts[ctlPacketInfo].name && l >= ctlOpts[ctlPacketInfo].length:
ctlOpts[ctlPacketInfo].parse(cm, m.Data(l))
}
}
+11 -2
View File
@@ -7,7 +7,8 @@
package ipv4
import (
"unsafe"
"encoding/binary"
"runtime"
"golang.org/x/net/internal/iana"
"golang.org/x/net/internal/socket"
@@ -66,10 +67,18 @@ func setControlMessage(c *socket.Conn, opt *rawOpt, cf ControlFlags, on bool) er
func marshalTTL(b []byte, cm *ControlMessage) []byte {
m := socket.ControlMessage(b)
if runtime.GOOS == "linux" {
m.MarshalHeader(iana.ProtocolIP, unix.IP_TTL, 4)
return m.Next(4)
}
m.MarshalHeader(iana.ProtocolIP, unix.IP_RECVTTL, 1)
return m.Next(1)
}
func parseTTL(cm *ControlMessage, b []byte) {
cm.TTL = int(*(*byte)(unsafe.Pointer(&b[:1][0])))
if runtime.GOOS == "linux" {
cm.TTL = int(binary.NativeEndian.Uint32(b[:4]))
return
}
cm.TTL = int(b[0])
}
+3
View File
@@ -111,6 +111,9 @@ func (h *Header) Parse(b []byte) error {
return errHeaderTooShort
}
hdrlen := int(b[0]&0x0f) << 2
if hdrlen < HeaderLen {
return errHeaderTooShort
}
if len(b) < hdrlen {
return errExtHeaderTooShort
}
+6
View File
@@ -65,6 +65,12 @@ func slicePacket(b []byte) (h, p []byte, err error) {
return nil, nil, errHeaderTooShort
}
hdrlen := int(b[0]&0x0f) << 2
if hdrlen < HeaderLen {
return nil, nil, errHeaderTooShort
}
if len(b) < hdrlen {
return nil, nil, errExtHeaderTooShort
}
return b[:hdrlen], b[hdrlen:], nil
}
+7 -3
View File
@@ -38,13 +38,17 @@ func (c *payloadHandler) ReadFrom(b []byte) (n int, cm *ControlMessage, src net.
return 0, nil, nil, &net.OpError{Op: "read", Net: c.PacketConn.LocalAddr().Network(), Source: c.PacketConn.LocalAddr(), Err: err}
}
hdrlen := int(h[0]&0x0f) << 2
if m.N < HeaderLen || hdrlen < HeaderLen {
return 0, nil, nil, &net.OpError{Op: "read", Net: c.PacketConn.LocalAddr().Network(), Source: c.PacketConn.LocalAddr(), Err: errHeaderTooShort}
}
if m.N < hdrlen {
return 0, nil, nil, &net.OpError{Op: "read", Net: c.PacketConn.LocalAddr().Network(), Source: c.PacketConn.LocalAddr(), Err: errExtHeaderTooShort}
}
if hdrlen > len(h) {
d := hdrlen - len(h)
copy(b, b[d:])
m.N -= d
} else {
m.N -= hdrlen
}
m.N -= hdrlen
default:
return 0, nil, nil, &net.OpError{Op: "read", Net: c.PacketConn.LocalAddr().Network(), Source: c.PacketConn.LocalAddr(), Err: errInvalidConnType}
}
+5
View File
@@ -7,6 +7,8 @@
package ipv4
import (
"errors"
"math"
"unsafe"
"golang.org/x/net/bpf"
@@ -15,6 +17,9 @@ import (
)
func (so *sockOpt) setAttachFilter(c *socket.Conn, f []bpf.RawInstruction) error {
if len(f) == 0 || len(f) > math.MaxUint16 {
return errors.New("invalid filter")
}
prog := unix.SockFprog{
Len: uint16(len(f)),
Filter: (*unix.SockFilter)(unsafe.Pointer(&f[0])),
+1 -1
View File
@@ -17,7 +17,7 @@ import (
var (
ctlOpts = [ctlMax]ctlOpt{
ctlTTL: {unix.IP_TTL, 1, marshalTTL, parseTTL},
ctlTTL: {unix.IP_TTL, 4, marshalTTL, parseTTL},
ctlPacketInfo: {unix.IP_PKTINFO, sizeofInetPktinfo, marshalPacketInfo, parsePacketInfo},
}
+1 -1
View File
@@ -19,7 +19,7 @@ const sockoptReceiveInterface = unix.IP_RECVIF
var (
ctlOpts = [ctlMax]ctlOpt{
ctlTTL: {unix.IP_RECVTTL, 4, marshalTTL, parseTTL},
ctlTTL: {unix.IP_RECVTTL, 1, marshalTTL, parseTTL},
ctlPacketInfo: {unix.IP_PKTINFO, sizeofInetPktinfo, marshalPacketInfo, parsePacketInfo},
}
+6
View File
@@ -66,6 +66,9 @@ func (c *payloadHandler) ReadBatch(ms []Message, flags int) (int, error) {
if !c.ok() {
return 0, errInvalidConn
}
if len(ms) == 0 {
return 0, nil
}
switch runtime.GOOS {
case "linux":
n, err := c.RecvMsgs([]socket.Message(ms), flags)
@@ -97,6 +100,9 @@ func (c *payloadHandler) WriteBatch(ms []Message, flags int) (int, error) {
if !c.ok() {
return 0, errInvalidConn
}
if len(ms) == 0 {
return 0, nil
}
switch runtime.GOOS {
case "linux":
n, err := c.SendMsgs([]socket.Message(ms), flags)
+4 -4
View File
@@ -130,13 +130,13 @@ func (cm *ControlMessage) Parse(b []byte) error {
continue
}
switch {
case typ == ctlOpts[ctlTrafficClass].name && l >= ctlOpts[ctlTrafficClass].length:
case ctlOpts[ctlTrafficClass].name > 0 && typ == ctlOpts[ctlTrafficClass].name && l >= ctlOpts[ctlTrafficClass].length:
ctlOpts[ctlTrafficClass].parse(cm, m.Data(l))
case typ == ctlOpts[ctlHopLimit].name && l >= ctlOpts[ctlHopLimit].length:
case ctlOpts[ctlHopLimit].name > 0 && typ == ctlOpts[ctlHopLimit].name && l >= ctlOpts[ctlHopLimit].length:
ctlOpts[ctlHopLimit].parse(cm, m.Data(l))
case typ == ctlOpts[ctlPacketInfo].name && l >= ctlOpts[ctlPacketInfo].length:
case ctlOpts[ctlPacketInfo].name > 0 && typ == ctlOpts[ctlPacketInfo].name && l >= ctlOpts[ctlPacketInfo].length:
ctlOpts[ctlPacketInfo].parse(cm, m.Data(l))
case typ == ctlOpts[ctlPathMTU].name && l >= ctlOpts[ctlPathMTU].length:
case ctlOpts[ctlPathMTU].name > 0 && typ == ctlOpts[ctlPathMTU].name && l >= ctlOpts[ctlPathMTU].length:
ctlOpts[ctlPathMTU].parse(cm, m.Data(l))
}
}
+9
View File
@@ -7,10 +7,16 @@
package ipv6
func (f *icmpv6Filter) accept(typ ICMPType) {
if typ < 0 || int(typ>>5) >= len(f.Filt) {
return
}
f.Filt[typ>>5] |= 1 << (uint32(typ) & 31)
}
func (f *icmpv6Filter) block(typ ICMPType) {
if typ < 0 || int(typ>>5) >= len(f.Filt) {
return
}
f.Filt[typ>>5] &^= 1 << (uint32(typ) & 31)
}
@@ -25,5 +31,8 @@ func (f *icmpv6Filter) setAll(block bool) {
}
func (f *icmpv6Filter) willBlock(typ ICMPType) bool {
if typ < 0 || int(typ>>5) >= len(f.Filt) {
return false
}
return f.Filt[typ>>5]&(1<<(uint32(typ)&31)) == 0
}
+9
View File
@@ -5,10 +5,16 @@
package ipv6
func (f *icmpv6Filter) accept(typ ICMPType) {
if typ < 0 || int(typ>>5) >= len(f.Data) {
return
}
f.Data[typ>>5] &^= 1 << (uint32(typ) & 31)
}
func (f *icmpv6Filter) block(typ ICMPType) {
if typ < 0 || int(typ>>5) >= len(f.Data) {
return
}
f.Data[typ>>5] |= 1 << (uint32(typ) & 31)
}
@@ -23,5 +29,8 @@ func (f *icmpv6Filter) setAll(block bool) {
}
func (f *icmpv6Filter) willBlock(typ ICMPType) bool {
if typ < 0 || int(typ>>5) >= len(f.Data) {
return false
}
return f.Data[typ>>5]&(1<<(uint32(typ)&31)) != 0
}
+9
View File
@@ -5,10 +5,16 @@
package ipv6
func (f *icmpv6Filter) accept(typ ICMPType) {
if typ < 0 || int(typ>>5) >= len(f.X__icmp6_filt) {
return
}
f.X__icmp6_filt[typ>>5] |= 1 << (uint32(typ) & 31)
}
func (f *icmpv6Filter) block(typ ICMPType) {
if typ < 0 || int(typ>>5) >= len(f.X__icmp6_filt) {
return
}
f.X__icmp6_filt[typ>>5] &^= 1 << (uint32(typ) & 31)
}
@@ -23,5 +29,8 @@ func (f *icmpv6Filter) setAll(block bool) {
}
func (f *icmpv6Filter) willBlock(typ ICMPType) bool {
if typ < 0 || int(typ>>5) >= len(f.X__icmp6_filt) {
return false
}
return f.X__icmp6_filt[typ>>5]&(1<<(uint32(typ)&31)) == 0
}
+9
View File
@@ -5,11 +5,17 @@
package ipv6
func (f *icmpv6Filter) accept(typ ICMPType) {
if typ < 0 || int(typ>>5) >= len(f.Filt) {
return
}
f.Filt[typ>>5] |= 1 << (uint32(typ) & 31)
}
func (f *icmpv6Filter) block(typ ICMPType) {
if typ < 0 || int(typ>>5) >= len(f.Filt) {
return
}
f.Filt[typ>>5] &^= 1 << (uint32(typ) & 31)
}
@@ -25,5 +31,8 @@ func (f *icmpv6Filter) setAll(block bool) {
}
func (f *icmpv6Filter) willBlock(typ ICMPType) bool {
if typ < 0 || int(typ>>5) >= len(f.Filt) {
return false
}
return f.Filt[typ>>5]&(1<<(uint32(typ)&31)) == 0
}
+5
View File
@@ -7,6 +7,8 @@
package ipv6
import (
"errors"
"math"
"unsafe"
"golang.org/x/net/bpf"
@@ -15,6 +17,9 @@ import (
)
func (so *sockOpt) setAttachFilter(c *socket.Conn, f []bpf.RawInstruction) error {
if len(f) == 0 || len(f) > math.MaxUint16 {
return errors.New("invalid filter")
}
prog := unix.SockFprog{
Len: uint16(len(f)),
Filter: (*unix.SockFilter)(unsafe.Pointer(&f[0])),
+3 -3
View File
@@ -2105,8 +2105,8 @@ go.etcd.io/etcd/api/v3/mvccpb
go.etcd.io/etcd/api/v3/v3rpc/rpctypes
go.etcd.io/etcd/api/v3/version
go.etcd.io/etcd/api/v3/versionpb
# go.etcd.io/etcd/client/pkg/v3 v3.6.11
## explicit; go 1.25.0
# go.etcd.io/etcd/client/pkg/v3 v3.7.3
## explicit; go 1.26.0
go.etcd.io/etcd/client/pkg/v3/fileutil
go.etcd.io/etcd/client/pkg/v3/logutil
go.etcd.io/etcd/client/pkg/v3/systemd
@@ -2308,7 +2308,7 @@ golang.org/x/image/webp
golang.org/x/mod/internal/lazyregexp
golang.org/x/mod/module
golang.org/x/mod/semver
# golang.org/x/net v0.61.0
# golang.org/x/net v0.62.0
## explicit; go 1.26.0
golang.org/x/net/bpf
golang.org/x/net/context