]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-tcp.c
Makefile.in: don't remove configure and config.h.in in make distclean.
[tcpdump] / print-tcp.c
index 12d24b5ca3a3552e002e4113f384d213bee72f0e..d9ca4a34b940c1a2d6058dde91fcedb28e752265 100644 (file)
@@ -44,6 +44,8 @@ __RCSID("$NetBSD: print-tcp.c,v 1.8 2007/07/24 11:53:48 drochner Exp $");
 #include "addrtoname.h"
 #include "extract.h"
 
+#include "diag-control.h"
+
 #include "tcp.h"
 
 #include "ip.h"
@@ -624,6 +626,13 @@ tcp_print(netdissect_options *ndo,
                                  * only do ND_TCHECK_LEN() if it returned 0.
                                  */
                                 ND_TCHECK_LEN(cp, datalen);
+                                /* Update the snapend to the end of the option
+                                 * before calling mptcp_print(). Some options
+                                 * (MPTCP or others) may be present after a
+                                 * MPTCP option. This prevents that, in
+                                 * mptcp_print(), the remaining length < the
+                                 * remaining caplen.
+                                 */
                                 snapend_save = ndo->ndo_snapend;
                                 ndo->ndo_snapend = ND_MIN(cp - 2 + len,
                                                           ndo->ndo_snapend);
@@ -699,7 +708,7 @@ tcp_print(netdissect_options *ndo,
          */
         ND_PRINT(", length %u", length);
 
-        if (length <= 0)
+        if (length == 0)
                 return;
 
         /*
@@ -744,8 +753,7 @@ tcp_print(netdissect_options *ndo,
                 smtp_print(ndo, bp, length);
         } else if (IS_SRC_OR_DST_PORT(WHOIS_PORT)) {
                 ND_PRINT(": ");
-                ndo->ndo_protocol = "whois";   /* needed by txtproto_print() */
-                txtproto_print(ndo, bp, length, NULL, 0); /* RFC 3912 */
+                whois_print(ndo, bp, length);
         } else if (IS_SRC_OR_DST_PORT(BGP_PORT))
                 bgp_print(ndo, bp, length);
         else if (IS_SRC_OR_DST_PORT(PPTP_PORT))
@@ -876,7 +884,7 @@ print_tcp_fastopen_option(netdissect_options *ndo, const u_char *cp,
 }
 
 #ifdef HAVE_LIBCRYPTO
-USES_APPLE_DEPRECATED_API
+DIAG_OFF_DEPRECATION
 static int
 tcp_verify_signature(netdissect_options *ndo,
                      const struct ip *ip, const struct tcphdr *tp,
@@ -956,5 +964,5 @@ tcp_verify_signature(netdissect_options *ndo,
         else
                 return (SIGNATURE_INVALID);
 }
-USES_APPLE_RST
+DIAG_ON_DEPRECATION
 #endif /* HAVE_LIBCRYPTO */