summaryrefslogtreecommitdiffhomepage
path: root/pkg
diff options
context:
space:
mode:
authorKevin Krakauer <krakauer@google.com>2021-02-11 15:59:20 -0800
committergVisor bot <gvisor-bot@google.com>2021-02-11 16:01:43 -0800
commitc39284f457383dabd52f468a10072ca6d2211cbb (patch)
treedc3cf96f9608670971e10e0985616b3d2583fd83 /pkg
parent2129dfff61526879ca6a681e7a498d1e0d9ace34 (diff)
Let sentry understand tcpip.ErrMalformedHeader
Added a LINT IfChange/ThenChange check to catch this in the future. PiperOrigin-RevId: 357077564
Diffstat (limited to 'pkg')
-rw-r--r--pkg/syserr/netstack.go7
-rw-r--r--pkg/tcpip/errors.go4
2 files changed, 11 insertions, 0 deletions
diff --git a/pkg/syserr/netstack.go b/pkg/syserr/netstack.go
index a6a91e064..0b9139570 100644
--- a/pkg/syserr/netstack.go
+++ b/pkg/syserr/netstack.go
@@ -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)
diff --git a/pkg/tcpip/errors.go b/pkg/tcpip/errors.go
index af46da1d2..3b7cc52f3 100644
--- a/pkg/tcpip/errors.go
+++ b/pkg/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)