]> The Tcpdump Group git mirrors - tcpdump/commitdiff
VXLAN: Use a 'struct tok' for the flags
authorFrancois-Xavier Le Bail <[email protected]>
Sat, 3 Oct 2020 12:33:23 +0000 (14:33 +0200)
committerFrancois-Xavier Le Bail <[email protected]>
Sat, 3 Oct 2020 19:33:22 +0000 (21:33 +0200)
Moreover:
Use nd_print_protocol_caps().

print-vxlan.c

index d2b896b094503dcf9f215c75fd65965f83e55753..be49d27023f4e611db58087e2a491bb6303def5d 100644 (file)
 #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);