diff options
author | delphij <delphij@FreeBSD.org> | 2015-01-06 19:03:11 +0000 |
---|---|---|
committer | delphij <delphij@FreeBSD.org> | 2015-01-06 19:03:11 +0000 |
commit | 08263d19579d35a7a65e0c8bcb768504ce76d04e (patch) | |
tree | b0af675e15d65cc0adac2367c37233a794389c9a /print-otv.c | |
parent | 89918529102669b0d24d8aac9e5516b010b1c81c (diff) | |
download | FreeBSD-src-08263d19579d35a7a65e0c8bcb768504ce76d04e.zip FreeBSD-src-08263d19579d35a7a65e0c8bcb768504ce76d04e.tar.gz |
Vendor import of tcpdump 4.6.2.
Diffstat (limited to 'print-otv.c')
-rw-r--r-- | print-otv.c | 38 |
1 files changed, 12 insertions, 26 deletions
diff --git a/print-otv.c b/print-otv.c index f312b0b..53a79de 100644 --- a/print-otv.c +++ b/print-otv.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" /* * OTV header, draft-hasmit-otv-04 @@ -41,14 +36,14 @@ */ void -otv_print(const u_char *bp, u_int len, u_int port) +otv_print(netdissect_options *ndo, const u_char *bp, u_int len) { - u_int8_t flags; - u_int32_t overlay_id; - u_int32_t instance_id; - + uint8_t flags; + uint32_t overlay_id; + uint32_t instance_id; + if (len < 8) { - printf("[|OTV]"); + ND_PRINT((ndo, "[|OTV]")); return; } @@ -61,19 +56,10 @@ otv_print(const u_char *bp, u_int len, u_int port) instance_id = EXTRACT_24BITS(bp); bp += 4; - printf("OTV, "); - - fputs("flags [", stdout); - if (flags & 0x08) - fputs("I", stdout); - else - fputs(".", stdout); - fputs("] ", stdout); - - printf("(0x%02x), ", flags); - printf("overlay %u, ", overlay_id); - printf("instance %u\n", instance_id); + ND_PRINT((ndo, "OTV, ")); + ND_PRINT((ndo, "flags [%s] (0x%02x), ", flags & 0x08 ? "I" : ".", flags)); + ND_PRINT((ndo, "overlay %u, ", overlay_id)); + ND_PRINT((ndo, "instance %u\n", instance_id)); - ether_print(gndo, bp, len - 8, len - 8, NULL, NULL); - return; + ether_print(ndo, bp, len - 8, len - 8, NULL, NULL); } |