]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-vxlan-gpe.c
IPoIB: Add the output with -e for a capture test
[tcpdump] / print-vxlan-gpe.c
index 038b772e65f5de90136e8d369f16b3784126b68b..d7a80f25dfdb83e64659320e41b35d6efae8fa8e 100644 (file)
@@ -34,7 +34,6 @@
 #include "netdissect.h"
 #include "extract.h"
 
-static const char tstr[] = " [|VXLAN-GPE]";
 static const struct tok vxlan_gpe_flags [] = {
     { 0x08, "I" },
     { 0x04, "P" },
@@ -64,18 +63,19 @@ vxlan_gpe_print(netdissect_options *ndo, const u_char *bp, u_int len)
     uint8_t next_protocol;
     uint32_t vni;
 
+    ndo->ndo_protocol = "vxlan_gpe";
     if (len < VXLAN_GPE_HDR_LEN)
         goto trunc;
 
     ND_TCHECK_LEN(bp, VXLAN_GPE_HDR_LEN);
 
-    flags = EXTRACT_U_1(bp);
+    flags = GET_U_1(bp);
     bp += 3;
 
-    next_protocol = EXTRACT_U_1(bp);
+    next_protocol = GET_U_1(bp);
     bp += 1;
 
-    vni = EXTRACT_BE_U_3(bp);
+    vni = GET_BE_U_3(bp);
     bp += 4;
 
     ND_PRINT("VXLAN-GPE, ");
@@ -92,7 +92,7 @@ vxlan_gpe_print(netdissect_options *ndo, const u_char *bp, u_int len)
         ip6_print(ndo, bp, len - VXLAN_GPE_HDR_LEN);
         break;
     case 0x3:
-        ether_print(ndo, bp, len - VXLAN_GPE_HDR_LEN, ndo->ndo_snapend - bp, NULL, NULL);
+        ether_print(ndo, bp, len - VXLAN_GPE_HDR_LEN, ND_BYTES_AVAILABLE_AFTER(bp), NULL, NULL);
         break;
     case 0x4:
         nsh_print(ndo, bp, len - VXLAN_GPE_HDR_LEN);
@@ -108,6 +108,6 @@ vxlan_gpe_print(netdissect_options *ndo, const u_char *bp, u_int len)
        return;
 
 trunc:
-       ND_PRINT("%s", tstr);
+       nd_print_trunc(ndo);
 }