X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/e2982e7f6f0b624a773ec5a58885ee80fab46d34..f34af1aa63da301ae7ee91e2300dff31702001f0:/print-carp.c diff --git a/print-carp.c b/print-carp.c index c7d62ce0..4d46c97a 100644 --- a/print-carp.c +++ b/print-carp.c @@ -37,20 +37,21 @@ /* \summary: Common Address Redundancy Protocol (CARP) printer */ #ifdef HAVE_CONFIG_H -#include "config.h" +#include #endif -#include +#include "netdissect-stdinc.h" #include "netdissect.h" /* for checksum structure and functions */ #include "extract.h" void -carp_print(netdissect_options *ndo, const u_char *bp, u_int len, int ttl) +carp_print(netdissect_options *ndo, const u_char *bp, u_int len, u_int ttl) { - int version, type; + u_int version, type; const char *type_s; + ndo->ndo_protocol = "carp"; ND_TCHECK_1(bp); version = (EXTRACT_U_1(bp) & 0xf0) >> 4; type = EXTRACT_U_1(bp) & 0x0f; @@ -58,14 +59,14 @@ carp_print(netdissect_options *ndo, const u_char *bp, u_int len, int ttl) type_s = "advertise"; else type_s = "unknown"; - ND_PRINT("CARPv%d-%s %d: ", version, type_s, len); + ND_PRINT("CARPv%u-%s %u: ", version, type_s, len); if (ttl != 255) - ND_PRINT("[ttl=%d!] ", ttl); + ND_PRINT("[ttl=%u!] ", ttl); if (version != 2 || type != 1) return; ND_TCHECK_1(bp + 2); ND_TCHECK_1(bp + 5); - ND_PRINT("vhid=%d advbase=%d advskew=%d authlen=%d ", + ND_PRINT("vhid=%u advbase=%u advskew=%u authlen=%u ", EXTRACT_U_1(bp + 1), EXTRACT_U_1(bp + 5), EXTRACT_U_1(bp + 2), EXTRACT_U_1(bp + 3)); if (ndo->ndo_vflag) { struct cksum_vec vec[1]; @@ -79,5 +80,5 @@ carp_print(netdissect_options *ndo, const u_char *bp, u_int len, int ttl) return; trunc: - ND_PRINT("[|carp]"); + nd_print_trunc(ndo); }