X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/0db4dcafe5ae38201d3869c96a96cb714d82ff35..9f957a5883cb4c5c99cefa71b42fc9d2d27d73e1:/print-geneve.c diff --git a/print-geneve.c b/print-geneve.c index d1ed242f..724e9f02 100644 --- a/print-geneve.c +++ b/print-geneve.c @@ -112,9 +112,9 @@ geneve_opts_print(netdissect_options *ndo, const u_char *bp, u_int len) ND_PRINT((ndo, "%s", sep)); sep = ", "; - opt_class = EXTRACT_16BITS(bp); - opt_type = *(bp + 2); - opt_len = 4 + ((*(bp + 3) & OPT_LEN_MASK) * 4); + opt_class = EXTRACT_BE_U_2(bp); + opt_type = EXTRACT_U_1(bp + 2); + opt_len = 4 + ((EXTRACT_U_1(bp + 3) & OPT_LEN_MASK) * 4); ND_PRINT((ndo, "class %s (0x%x) type 0x%x%s len %u", format_opt_class(opt_class), opt_class, opt_type, @@ -132,7 +132,7 @@ geneve_opts_print(netdissect_options *ndo, const u_char *bp, u_int len) ND_PRINT((ndo, " data")); for (i = 4; i < opt_len; i += 4) { - ND_PRINT((ndo, " %08x", EXTRACT_32BITS(data))); + ND_PRINT((ndo, " %08x", EXTRACT_BE_U_4(data))); data++; } } @@ -155,9 +155,9 @@ geneve_print(netdissect_options *ndo, const u_char *bp, u_int len) ND_PRINT((ndo, "Geneve")); - ND_TCHECK2(*bp, 8); + ND_TCHECK_8(bp); - ver_opt = *bp; + ver_opt = EXTRACT_U_1(bp); bp += 1; len -= 1; @@ -167,19 +167,19 @@ geneve_print(netdissect_options *ndo, const u_char *bp, u_int len) return; } - flags = *bp; + flags = EXTRACT_U_1(bp); bp += 1; len -= 1; - prot = EXTRACT_16BITS(bp); + prot = EXTRACT_BE_U_2(bp); bp += 2; len -= 2; - vni = EXTRACT_24BITS(bp); + vni = EXTRACT_BE_U_3(bp); bp += 3; len -= 3; - reserved = *bp; + reserved = EXTRACT_U_1(bp); bp += 1; len -= 1; @@ -202,7 +202,7 @@ geneve_print(netdissect_options *ndo, const u_char *bp, u_int len) return; } - ND_TCHECK2(*bp, opts_len); + ND_TCHECK_LEN(bp, opts_len); if (opts_len > 0) { ND_PRINT((ndo, ", options [")); @@ -223,7 +223,7 @@ geneve_print(netdissect_options *ndo, const u_char *bp, u_int len) else ND_PRINT((ndo, "\n\t")); - if (ethertype_print(ndo, prot, bp, len, len, NULL, NULL) == 0) { + if (ethertype_print(ndo, prot, bp, len, ndo->ndo_snapend - bp, NULL, NULL) == 0) { if (prot == ETHERTYPE_TEB) ether_print(ndo, bp, len, ndo->ndo_snapend - bp, NULL, NULL); else