From: Francois-Xavier Le Bail Date: Sat, 3 Oct 2020 12:33:23 +0000 (+0200) Subject: VXLAN: Use a 'struct tok' for the flags X-Git-Tag: tcpdump-4.99-bp~150 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/495f136dddc1a611734974f42eceb5d608463898 VXLAN: Use a 'struct tok' for the flags Moreover: Use nd_print_protocol_caps(). --- diff --git a/print-vxlan.c b/print-vxlan.c index d2b896b0..be49d270 100644 --- a/print-vxlan.c +++ b/print-vxlan.c @@ -26,7 +26,10 @@ #include "netdissect.h" #include "extract.h" - +static const struct tok vxlan_flags [] = { + { 0x08, "I" }, + { 0, NULL } +}; #define VXLAN_HDR_LEN 8 /* @@ -61,8 +64,9 @@ vxlan_print(netdissect_options *ndo, const u_char *bp, u_int len) vni = GET_BE_U_3(bp); bp += 4; - ND_PRINT("VXLAN, "); - ND_PRINT("flags [%s] (0x%02x), ", flags & 0x08 ? "I" : ".", flags); + nd_print_protocol_caps(ndo); + ND_PRINT(", flags [%s] (0x%02x), ", + bittok2str_nosep(vxlan_flags, "invalid", flags), flags); ND_PRINT("vni %u\n", vni); ether_print(ndo, bp, len - VXLAN_HDR_LEN, ND_BYTES_AVAILABLE_AFTER(bp), NULL, NULL);