]> The Tcpdump Group git mirrors - tcpdump/commitdiff
TCP: Fix fetching the header payload length
authorFrancois-Xavier Le Bail <[email protected]>
Tue, 30 Apr 2019 21:18:55 +0000 (23:18 +0200)
committerFrancois-Xavier Le Bail <[email protected]>
Tue, 30 Apr 2019 21:54:27 +0000 (23:54 +0200)
... and a Clang warning.

The warning was:
./print-tcp.c:402:120: warning: address of array
      'ip6->ip6_ctlun.ip6_un1.ip6_un1_plen' will always evaluate to 'true'
      [-Wpointer-bool-conversion]
  ...& 0xf0) >> 4) == 6 && ip6->ip6_ctlun.ip6_un1.ip6_un1_plen) {
                        ~~ ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~

print-tcp.c

index 2db0f547b25a17117a24ed0b553731f3c7fd43de..f3b635b4deca7270a7dd515d1db932675d2dbe09 100644 (file)
@@ -399,7 +399,7 @@ tcp_print(netdissect_options *ndo,
                                 else
                                         ND_PRINT(" (correct)");
                         }
-                } else if (IP_V(ip) == 6 && ip6->ip6_plen) {
+                } else if (IP_V(ip) == 6 && GET_BE_U_2(ip6->ip6_plen)) {
                         if (ND_TTEST_LEN(tp->th_sport, length)) {
                                 sum = tcp6_cksum(ndo, ip6, tp, length);
                                 tcp_sum = GET_BE_U_2(tp->th_sum);