]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-vxlan.c
NDOize AHCP, OTV and VXLAN decoders
[tcpdump] / print-vxlan.c
index 3ef9cf6a96249381638a534011f2fc5d7f845db7..6f60d92ae2a512d4c7cfd21a815d2fa751393a08 100644 (file)
 
 #include <tcpdump-stdinc.h>
 
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "interface.h"
+#include "netdissect.h"
 #include "extract.h"
 
 /*
  */
 
 void
-vxlan_print(const u_char *bp, u_int len)
+vxlan_print(netdissect_options *ndo, const u_char *bp, u_int len)
 {
     u_int8_t flags;
     u_int32_t vni;
 
     if (len < 8) {
-        printf("[|VXLAN]");
+        ND_PRINT((ndo, "[|VXLAN]"));
         return;
     }
 
@@ -54,18 +51,9 @@ vxlan_print(const u_char *bp, u_int len)
     vni = EXTRACT_24BITS(bp);
     bp += 4;
 
-    printf("VXLAN, ");
-
-    fputs("flags [", stdout);
-    if (flags & 0x08)
-        fputs("I", stdout);
-    else
-        fputs(".", stdout);
-    fputs("] ", stdout);
-
-    printf("(0x%02x), ", flags);
-    printf("vni %u\n", vni);
+    ND_PRINT((ndo, "VXLAN, "));
+    ND_PRINT((ndo, "flags [%s] (0x%02x), ", flags & 0x08 ? "I" : ".", flags));
+    ND_PRINT((ndo, "vni %u\n", vni));
 
-    ether_print(gndo, bp, len - 8, len - 8, NULL, NULL);
-    return;
+    ether_print(ndo, bp, len - 8, len - 8, NULL, NULL);
 }