mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Let sentry understand tcpip.ErrMalformedHeader
Added a LINT IfChange/ThenChange check to catch this in the future. PiperOrigin-RevId: 357077564
This commit is contained in:
committed by
gVisor bot
parent
2129dfff61
commit
c39284f457
@@ -21,6 +21,8 @@ import (
|
||||
"gvisor.dev/gvisor/pkg/tcpip"
|
||||
)
|
||||
|
||||
// LINT.IfChange
|
||||
|
||||
// Mapping for tcpip.Error types.
|
||||
var (
|
||||
ErrUnknownProtocol = New((&tcpip.ErrUnknownProtocol{}).String(), linux.EINVAL)
|
||||
@@ -48,6 +50,7 @@ var (
|
||||
ErrBroadcastDisabled = New((&tcpip.ErrBroadcastDisabled{}).String(), linux.EACCES)
|
||||
ErrNotPermittedNet = New((&tcpip.ErrNotPermitted{}).String(), linux.EPERM)
|
||||
ErrBadBuffer = New((&tcpip.ErrBadBuffer{}).String(), linux.EFAULT)
|
||||
ErrMalformedHeader = New((&tcpip.ErrMalformedHeader{}).String(), linux.EINVAL)
|
||||
)
|
||||
|
||||
// TranslateNetstackError converts an error from the tcpip package to a sentry
|
||||
@@ -130,7 +133,11 @@ func TranslateNetstackError(err tcpip.Error) *Error {
|
||||
return ErrAddressFamilyNotSupported
|
||||
case *tcpip.ErrBadBuffer:
|
||||
return ErrBadBuffer
|
||||
case *tcpip.ErrMalformedHeader:
|
||||
return ErrMalformedHeader
|
||||
default:
|
||||
panic(fmt.Sprintf("unknown error %T", err))
|
||||
}
|
||||
}
|
||||
|
||||
// LINT.ThenChange(../tcpip/errors.go)
|
||||
|
||||
@@ -32,6 +32,8 @@ type Error interface {
|
||||
fmt.Stringer
|
||||
}
|
||||
|
||||
// LINT.IfChange
|
||||
|
||||
// ErrAborted indicates the operation was aborted.
|
||||
//
|
||||
// +stateify savable
|
||||
@@ -536,3 +538,5 @@ func (*ErrWouldBlock) IgnoreStats() bool {
|
||||
return true
|
||||
}
|
||||
func (*ErrWouldBlock) String() string { return "operation would block" }
|
||||
|
||||
// LINT.ThenChange(../syserr/netstack.go)
|
||||
|
||||
Reference in New Issue
Block a user