]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-carp.c
Use more the EXTRACT_8BITS() macro to fetch a one-byte value (17/n)
[tcpdump] / print-carp.c
index 3602cdace7baf36ffdce6c877e2020afa5e72cd1..ceed9b0dd850dcfec55ba7f107827e2ad513ae59 100644 (file)
  *
  */
 
+/* \summary: Common Address Redundancy Protocol (CARP) printer */
+
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
-#include <tcpdump-stdinc.h>
-
-#include <stdio.h>
-#include <stdlib.h>
+#include <netdissect-stdinc.h>
 
-#include "interface.h" /* for checksum structure and functions */
-#include "netdissect.h"
+#include "netdissect.h" /* for checksum structure and functions */
 #include "extract.h"
 
 void
@@ -71,13 +69,13 @@ carp_print(netdissect_options *ndo, register const u_char *bp, register u_int le
            bp[1], bp[5], bp[2], bp[3]));
        if (ndo->ndo_vflag) {
                struct cksum_vec vec[1];
-               vec[0].ptr = (const u_int8_t *)bp;
+               vec[0].ptr = (const uint8_t *)bp;
                vec[0].len = len;
                if (ND_TTEST2(bp[0], len) && in_cksum(vec, 1))
                        ND_PRINT((ndo, " (bad carp cksum %x!)",
-                               EXTRACT_16BITS(&bp[6])));
+                               EXTRACT_BE_16BITS(bp + 6)));
        }
-       ND_PRINT((ndo, "counter=%" PRIu64, EXTRACT_64BITS(&bp[8])));
+       ND_PRINT((ndo, "counter=%" PRIu64, EXTRACT_BE_64BITS(bp + 8)));
 
        return;
 trunc: