]> The Tcpdump Group git mirrors - tcpdump/commitdiff
do not try to compute tcp/udp checksum for fragmented datagram.
authoritojun <itojun>
Fri, 17 Nov 2000 19:08:14 +0000 (19:08 +0000)
committeritojun <itojun>
Fri, 17 Nov 2000 19:08:14 +0000 (19:08 +0000)
from: [email protected]

interface.h
print-ip.c
print-ip6.c
print-tcp.c
print-udp.c

index 46bb1f047d73b4563281df306fb13ef8abee4db5..e6e1d36311f3203fca078094110e12effb880f3b 100644 (file)
@@ -18,7 +18,7 @@
  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- * @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.144 2000-11-02 02:18:30 fenner Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.145 2000-11-17 19:08:14 itojun Exp $ (LBL)
  */
 
 #ifndef tcpdump_interface_h
@@ -261,10 +261,10 @@ extern void chdlc_if_print(u_char *, const struct pcap_pkthdr *,
     const u_char *);
 extern void snmp_print(const u_char *, u_int);
 extern void sunrpcrequest_print(const u_char *, u_int, const u_char *);
-extern void tcp_print(const u_char *, u_int, const u_char *);
+extern void tcp_print(const u_char *, u_int, const u_char *, int);
 extern void tftp_print(const u_char *, u_int);
 extern void timed_print(const u_char *, u_int);
-extern void udp_print(const u_char *, u_int, const u_char *);
+extern void udp_print(const u_char *, u_int, const u_char *, int);
 extern void wb_print(const void *, u_int);
 extern int ah_print(register const u_char *, register const u_char *);
 extern int esp_print(register const u_char *, register const u_char *, int *);
index b97fcd5e49b19728e853f4d212d96f6f2a33658e..be5ff1326e80eb48417831fc998927a2ca3ac018 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-ip.c,v 1.90 2000-11-02 02:18:30 fenner Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-ip.c,v 1.91 2000-11-17 19:08:15 itojun Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -363,11 +363,11 @@ again:
                    }
 
                case IPPROTO_TCP:
-                       tcp_print(cp, len, (const u_char *)ip);
+                       tcp_print(cp, len, (const u_char *)ip, (off &~ 0x6000));
                        break;
 
                case IPPROTO_UDP:
-                       udp_print(cp, len, (const u_char *)ip);
+                       udp_print(cp, len, (const u_char *)ip, (off &~ 0x6000));
                        break;
 
                case IPPROTO_ICMP:
index 7eab7e05aa30079397e35de75f0572c08cb64c35..9074a9a5d82741516ab6746ef6a10393ddeac0d6 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-ip6.c,v 1.15 2000-11-09 07:43:50 itojun Exp $";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-ip6.c,v 1.16 2000-11-17 19:08:15 itojun Exp $";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -58,6 +58,7 @@ ip6_print(register const u_char *bp, register int length)
        register int len;
        register const u_char *cp;
        int nh;
+       int fragmented = 0;
        u_int flow;
        
        ip6 = (const struct ip6_hdr *)bp;
@@ -119,6 +120,7 @@ ip6_print(register const u_char *bp, register int length)
                        if (snapend <= cp + advance)
                                goto end;
                        nh = *cp;
+                       fragmented = 1;
                        break;
                case IPPROTO_ROUTING:
                        advance = rt6_print(cp, (const u_char *)ip6);
@@ -126,11 +128,11 @@ ip6_print(register const u_char *bp, register int length)
                        break;
                case IPPROTO_TCP:
                        tcp_print(cp, len + sizeof(struct ip6_hdr) - (cp - bp),
-                               (const u_char *)ip6);
+                               (const u_char *)ip6, fragmented);
                        goto end;
                case IPPROTO_UDP:
                        udp_print(cp, len + sizeof(struct ip6_hdr) - (cp - bp),
-                               (const u_char *)ip6);
+                               (const u_char *)ip6, fragmented);
                        goto end;
                case IPPROTO_ICMPV6:
                        icmp6_print(cp, (const u_char *)ip6);
index 2c50ae842d229f0460c60578dbfed3368ece5a04..852300ce51898114c89e589a56c8ebbaff1c9435 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-tcp.c,v 1.79 2000-10-07 05:53:14 itojun Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-tcp.c,v 1.80 2000-11-17 19:08:16 itojun Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -229,7 +229,7 @@ static int tcp6_cksum(const struct ip6_hdr *ip6, const struct tcphdr *tp,
 
 void
 tcp_print(register const u_char *bp, register u_int length,
-         register const u_char *bp2)
+         register const u_char *bp2, int fragmented)
 {
        register const struct tcphdr *tp;
        register const struct ip *ip;
@@ -444,7 +444,7 @@ tcp_print(register const u_char *bp, register u_int length,
                return;
        }
 
-       if (IP_V(ip) == 4 && vflag) {
+       if (IP_V(ip) == 4 && vflag && !fragmented) {
                int sum;
                if (TTEST2(tp->th_sport, length)) {
                        sum = tcp_cksum(ip, tp, length);
@@ -455,7 +455,7 @@ tcp_print(register const u_char *bp, register u_int length,
                }
        }
 #ifdef INET6
-       if (IP_V(ip) == 6 && ip6->ip6_plen && vflag) {
+       if (IP_V(ip) == 6 && ip6->ip6_plen && vflag && !fragmented) {
                int sum;
                if (TTEST2(tp->th_sport, length)) {
                        sum = tcp6_cksum(ip6, tp, length);
index 75287c876dd765109ab9357f3175e4943eb5fad5..a95683ec45a48341d5567886b670850151ecc745 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-udp.c,v 1.88 2000-10-30 06:22:15 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-udp.c,v 1.89 2000-11-17 19:08:16 itojun Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -415,7 +415,8 @@ static int udp6_cksum(const struct ip6_hdr *ip6, const struct udphdr *up,
 #endif
 
 void
-udp_print(register const u_char *bp, u_int length, register const u_char *bp2)
+udp_print(register const u_char *bp, u_int length,
+         register const u_char *bp2, int fragmented)
 {
        register const struct udphdr *up;
        register const struct ip *ip;
@@ -601,7 +602,7 @@ udp_print(register const u_char *bp, u_int length, register const u_char *bp2)
        }
 #endif
 
-       if (IP_V(ip) == 4 && vflag) {
+       if (IP_V(ip) == 4 && vflag && !fragmented) {
                int sum = up->uh_sum;
                if (sum == 0) {
                        (void)printf(" [no cksum]");
@@ -614,7 +615,7 @@ udp_print(register const u_char *bp, u_int length, register const u_char *bp2)
                }
        }
 #ifdef INET6
-       if (IP_V(ip) == 6 && ip6->ip6_plen && vflag) {
+       if (IP_V(ip) == 6 && ip6->ip6_plen && vflag && !fragmented) {
                int sum = up->uh_sum;
                /* for IPv6, UDP checksum is mandatory */
                if (TTEST2(cp[0], length)) {