]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-dtp.c
Do the dump file Capsicum stuff in a common routine.
[tcpdump] / print-dtp.c
index e502ad54ce1f394b6112124c0365dd751c1b5a76..5d84a770eecaa78ca44424869b441711dadd8d36 100644 (file)
  * Original code by Carles Kishimoto <[email protected]>
  */
 
+#define NETDISSECT_REWORKED
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
 #include <tcpdump-stdinc.h>
 
-#include "netdissect.h"
+#include "interface.h"
 #include "addrtoname.h"
 #include "extract.h"
 
@@ -52,8 +53,7 @@ dtp_print (netdissect_options *ndo, const u_char *pptr, u_int length)
 
     tptr = pptr;
 
-    if (!ND_TTEST2(*tptr, DTP_HEADER_LEN))
-       goto trunc;
+    ND_TCHECK2(*tptr, DTP_HEADER_LEN);
 
     ND_PRINT((ndo, "DTPv%u, length %u",
            (*tptr),
@@ -70,8 +70,7 @@ dtp_print (netdissect_options *ndo, const u_char *pptr, u_int length)
 
     while (tptr < (pptr+length)) {
 
-        if (!ND_TTEST2(*tptr, 4))
-            goto trunc;
+        ND_TCHECK2(*tptr, 4);
 
        type = EXTRACT_16BITS(tptr);
         len  = EXTRACT_16BITS(tptr+2);
@@ -96,7 +95,7 @@ dtp_print (netdissect_options *ndo, const u_char *pptr, u_int length)
                 break;
 
        case DTP_NEIGHBOR_TLV:
-                ND_PRINT((ndo, ", %s", etheraddr_string(tptr+4)));
+                ND_PRINT((ndo, ", %s", etheraddr_string(ndo, tptr+4)));
                 break;
 
         default: