Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/tcpdump do tcp/udp checksum only if it is IPv4.



details:   https://anonhg.NetBSD.org/src/rev/0112e344dade
branches:  trunk
changeset: 474263:0112e344dade
user:      itojun <itojun%NetBSD.org@localhost>
date:      Fri Jul 02 14:51:22 1999 +0000

description:
do tcp/udp checksum only if it is IPv4.
TODO: IPv6 tcp/udp pseudo header checksum

diffstat:

 usr.sbin/tcpdump/print-tcp.c |  6 +++---
 usr.sbin/tcpdump/print-udp.c |  6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diffs (54 lines):

diff -r ae7678132d48 -r 0112e344dade usr.sbin/tcpdump/print-tcp.c
--- a/usr.sbin/tcpdump/print-tcp.c      Fri Jul 02 14:50:25 1999 +0000
+++ b/usr.sbin/tcpdump/print-tcp.c      Fri Jul 02 14:51:22 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: print-tcp.c,v 1.12 1999/07/02 11:31:36 itojun Exp $    */
+/*     $NetBSD: print-tcp.c,v 1.13 1999/07/02 14:51:22 itojun Exp $    */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
@@ -27,7 +27,7 @@
 static const char rcsid[] =
     "@(#) Header: print-tcp.c,v 1.55 97/06/15 13:20:28 leres Exp  (LBL)";
 #else
-__RCSID("$NetBSD: print-tcp.c,v 1.12 1999/07/02 11:31:36 itojun Exp $");
+__RCSID("$NetBSD: print-tcp.c,v 1.13 1999/07/02 14:51:22 itojun Exp $");
 #endif
 #endif
 
@@ -369,7 +369,7 @@
                return;
        }
 
-       if (vflag) {
+       if (ip->ip_v == 4 && vflag) {
                int sum;
                if (TTEST2(tp->th_sport, length)) {
                        sum = tcp_cksum(ip, tp, length);
diff -r ae7678132d48 -r 0112e344dade usr.sbin/tcpdump/print-udp.c
--- a/usr.sbin/tcpdump/print-udp.c      Fri Jul 02 14:50:25 1999 +0000
+++ b/usr.sbin/tcpdump/print-udp.c      Fri Jul 02 14:51:22 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: print-udp.c,v 1.11 1999/07/02 11:31:37 itojun Exp $    */
+/*     $NetBSD: print-udp.c,v 1.12 1999/07/02 14:51:22 itojun Exp $    */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
@@ -27,7 +27,7 @@
 static const char rcsid[] =
     "@(#) Header: print-udp.c,v 1.60 97/07/27 21:58:48 leres Exp  (LBL)";
 #else
-__RCSID("$NetBSD: print-udp.c,v 1.11 1999/07/02 11:31:37 itojun Exp $");
+__RCSID("$NetBSD: print-udp.c,v 1.12 1999/07/02 14:51:22 itojun Exp $");
 #endif
 #endif
 
@@ -517,7 +517,7 @@
        }
 #endif
 
-       if (ip && vflag) {
+       if (ip->ip_v == 4 && vflag) {
                int sum = up->uh_sum;
                if (sum == 0) {
                        (void)printf(" [no cksum]");



Home | Main Index | Thread Index | Old Index