diff options
Diffstat (limited to 'print-vxlan.c')
-rw-r--r-- | print-vxlan.c | 36 |
1 files changed, 11 insertions, 25 deletions
diff --git a/print-vxlan.c b/print-vxlan.c index 9f8c3fb..62b4b2b 100644 --- a/print-vxlan.c +++ b/print-vxlan.c @@ -13,20 +13,15 @@ * Original code by Francesco Fondelli (francesco dot fondelli, gmail dot com) */ +#define NETDISSECT_REWORKED #ifdef HAVE_CONFIG_H #include "config.h" #endif #include <tcpdump-stdinc.h> -#include <stdio.h> -#include <stdlib.h> - #include "interface.h" #include "extract.h" -#include "addrtoname.h" - -#include "udp.h" /* * VXLAN header, draft-mahalingam-dutt-dcops-vxlan-03 @@ -37,17 +32,17 @@ * |R|R|R|R|I|R|R|R| Reserved | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | VXLAN Network Identifier (VNI) | Reserved | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ void -vxlan_print(const u_char *bp, u_int len, u_int port) +vxlan_print(netdissect_options *ndo, const u_char *bp, u_int len) { - u_int8_t flags; - u_int32_t vni; - + uint8_t flags; + uint32_t vni; + if (len < 8) { - printf("[|VXLAN]"); + ND_PRINT((ndo, "[|VXLAN]")); return; } @@ -57,18 +52,9 @@ vxlan_print(const u_char *bp, u_int len, u_int port) 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); } |