X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/84ef17ac0eecb3efc11a63c3f2c578ae78732c02..00ecef01d7dd1f53c58ddeb0f906f3ec602283f0:/print-mpls.c diff --git a/print-mpls.c b/print-mpls.c index c566ea14..e45f2826 100644 --- a/print-mpls.c +++ b/print-mpls.c @@ -29,10 +29,10 @@ /* \summary: Multi-Protocol Label Switching (MPLS) printer */ #ifdef HAVE_CONFIG_H -#include "config.h" +#include #endif -#include +#include "netdissect-stdinc.h" #include "netdissect.h" #include "extract.h" @@ -64,26 +64,27 @@ mpls_print(netdissect_options *ndo, const u_char *bp, u_int length) uint16_t label_stack_depth = 0; enum mpls_packet_type pt = PT_UNKNOWN; + ndo->ndo_protocol = "mpls"; p = bp; - ND_PRINT((ndo, "MPLS")); + ND_PRINT("MPLS"); do { ND_TCHECK_LEN(p, sizeof(label_entry)); if (length < sizeof(label_entry)) { - ND_PRINT((ndo, "[|MPLS], length %u", length)); + ND_PRINT("[|MPLS], length %u", length); return; } label_entry = EXTRACT_BE_U_4(p); - ND_PRINT((ndo, "%s(label %u", + ND_PRINT("%s(label %u", (label_stack_depth && ndo->ndo_vflag) ? "\n\t" : " ", - MPLS_LABEL(label_entry))); + MPLS_LABEL(label_entry)); label_stack_depth++; if (ndo->ndo_vflag && MPLS_LABEL(label_entry) < sizeof(mpls_labelname) / sizeof(mpls_labelname[0])) - ND_PRINT((ndo, " (%s)", mpls_labelname[MPLS_LABEL(label_entry)])); - ND_PRINT((ndo, ", exp %u", MPLS_EXP(label_entry))); + ND_PRINT(" (%s)", mpls_labelname[MPLS_LABEL(label_entry)]); + ND_PRINT(", exp %u", MPLS_EXP(label_entry)); if (MPLS_STACK(label_entry)) - ND_PRINT((ndo, ", [S]")); - ND_PRINT((ndo, ", ttl %u)", MPLS_TTL(label_entry))); + ND_PRINT(", [S]"); + ND_PRINT(", ttl %u)", MPLS_TTL(label_entry)); p += sizeof(label_entry); length -= sizeof(label_entry); @@ -189,7 +190,7 @@ mpls_print(netdissect_options *ndo, const u_char *bp, u_int length) ND_DEFAULTPRINT(p, length); return; } - ND_PRINT((ndo, ndo->ndo_vflag ? "\n\t" : " ")); + ND_PRINT(ndo->ndo_vflag ? "\n\t" : " "); switch (pt) { case PT_IPV4: @@ -210,13 +211,5 @@ mpls_print(netdissect_options *ndo, const u_char *bp, u_int length) return; trunc: - ND_PRINT((ndo, "[|MPLS]")); + nd_print_trunc(ndo); } - - -/* - * Local Variables: - * c-style: whitesmith - * c-basic-offset: 8 - * End: - */