summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/header/ipv4.go
diff options
context:
space:
mode:
authorTamir Duberstein <tamird@google.com>2019-07-12 16:17:18 -0700
committergVisor bot <gvisor-bot@google.com>2019-07-12 16:19:18 -0700
commit17bab652afebdc43d77969431b9147cca039f61e (patch)
treef9bbcbf019be64a95d0a1164dc75029e61abc442 /pkg/tcpip/header/ipv4.go
parentc8ae00eb8aec51d09d688f05ea86674bc5449f8f (diff)
Check that IP headers contain correct version
PiperOrigin-RevId: 257888338
Diffstat (limited to 'pkg/tcpip/header/ipv4.go')
-rw-r--r--pkg/tcpip/header/ipv4.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/pkg/tcpip/header/ipv4.go b/pkg/tcpip/header/ipv4.go
index 7b8034de4..94a3af289 100644
--- a/pkg/tcpip/header/ipv4.go
+++ b/pkg/tcpip/header/ipv4.go
@@ -272,6 +272,10 @@ func (b IPv4) IsValid(pktSize int) bool {
return false
}
+ if IPVersion(b) != IPv4Version {
+ return false
+ }
+
return true
}