Over IPv6, UDP packets must have a non-zero checksum (RFC2460,
section 8.1).  Currently, tcpdump ignores this and will print
"udp sum ok".  Maybe the author didn't understand how the Internet
checksum works and thought the checksum calculation would catch
this.

OK?
Any better phrasing than "invalid cksum", consistent (haha) with
tcpdump's output?

Index: print-udp.c
===================================================================
RCS file: /cvs/src/usr.sbin/tcpdump/print-udp.c,v
retrieving revision 1.34
diff -u -p -r1.34 print-udp.c
--- print-udp.c 12 Jan 2010 06:10:33 -0000      1.34
+++ print-udp.c 26 Jan 2014 16:01:09 -0000
@@ -581,7 +581,9 @@ udp_print(register const u_char *bp, u_i
        if (ip->ip_v == 6 && ip6->ip6_plen && vflag) {
                int sum = up->uh_sum;
                /* for IPv6, UDP checksum is mandatory */
-               if (TTEST2(cp[0], length)) {
+               if (sum == 0) {
+                       (void)printf(" [invalid cksum]");
+               } else if (TTEST2(cp[0], length)) {
                        sum = udp6_cksum(ip6, up, length + sizeof(struct 
udphdr));
                        if (sum != 0)
                                (void)printf(" [bad udp cksum %x!]", sum);
-- 
Christian "naddy" Weisgerber                          na...@mips.inka.de

Reply via email to