]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-carp.c
Compile with '-Wsign-compare' in devel mode if supported
[tcpdump] / print-carp.c
index c7d62ce023b84e1a0a3cf6d3ee03f82f98143d90..4d46c97a1d534e0c7db1a79a1a6aec102c243f0a 100644 (file)
 /* \summary: Common Address Redundancy Protocol (CARP) printer */
 
 #ifdef HAVE_CONFIG_H
-#include "config.h"
+#include <config.h>
 #endif
 
-#include <netdissect-stdinc.h>
+#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);
 }