]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Don't print "bad length" for fragmented UDP packets
authorMartin Buck <[email protected]>
Tue, 16 May 2017 09:18:13 +0000 (11:18 +0200)
committerMartin Buck <[email protected]>
Tue, 16 May 2017 09:18:13 +0000 (11:18 +0200)
In case of fragmentation, it's perfectly OK for the total UDP length to be
larger than the length of the first packet, so don't raise a false alert.

Signed-off-by: Martin Buck <[email protected]>
print-udp.c

index 5a74ff2fc69c706d43002f6d770955c63c59ea95..b4e8271d643d20b8d4c8c3bd7327ad1fe24a0b5f 100644 (file)
@@ -690,14 +690,14 @@ udp_print(netdissect_options *ndo, register const u_char *bp, u_int length,
                                ND_PRINT((ndo, "kip "));
                        llap_print(ndo, cp, length);
                } else {
-                       if (ulen > length)
+                       if (ulen > length && !fragmented)
                                ND_PRINT((ndo, "UDP, bad length %u > %u",
                                    ulen, length));
                        else
                                ND_PRINT((ndo, "UDP, length %u", ulen));
                }
        } else {
-               if (ulen > length)
+               if (ulen > length && !fragmented)
                        ND_PRINT((ndo, "UDP, bad length %u > %u",
                            ulen, length));
                else