tcpdump: invalid v6 UDP checksums

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

tcpdump: invalid v6 UDP checksums

Christian Weisgerber
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                          [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: tcpdump: invalid v6 UDP checksums

Simon Perreault-3
Le 2014-01-26 11:27, Christian Weisgerber a écrit :
> Over IPv6, UDP packets must have a non-zero checksum (RFC2460,
> section 8.1).

That is no longer true.

http://tools.ietf.org/html/rfc6935#section-5

VXLAN and friends use zero UDP checksums over IPv6.

Simon