When the (original) length is < length of the header, output example:
[length 19 < 20] (invalid)
(The minimal IPv4 header must be 20 bytes in length.)
Place the 'length' test before the 'version' test.
Add a test file.
(cherry picked from commit
4c39f476dfd20e6815bcc38df51294ce96a73b28)
ND_PRINT(" ");
}
+ ND_ICHECK_ZU(length, <, sizeof (struct ip));
ND_ICHECKMSG_U("version", IP_V(ip), !=, 4);
ND_TCHECK_SIZE(ip);
- if (length < sizeof (struct ip)) {
- ND_PRINT("truncated-ip %u", length);
- return;
- }
hlen = IP_HL(ip) * 4;
if (hlen < sizeof (struct ip)) {
ND_PRINT("bad-hlen %u", hlen);
# DNSSEC from https://bugzilla.redhat.com/show_bug.cgi?id=205842, -vv exposes EDNS DO
dnssec-vv dnssec.pcap dnssec-vv.out -vv
+#IPv4 tests
+ipv4_invalid_length ipv4_invalid_length.pcap ipv4_invalid_length.out -v
+
#IPv6 tests
ipv6-bad-version ipv6-bad-version.pcap ipv6-bad-version.out
ipv6-routing-header ipv6-routing-header.pcap ipv6-routing-header.out -v
--- /dev/null
+ 1 14:57:25.640485 IP [length 19 < 20] (invalid)