]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-carp.c
Use nd_ types, add EXTRACT_ calls, clean up signed vs. unsigned.
[tcpdump] / print-carp.c
index 622d308e9fb03eeb6a5e4f6fb4214f62ed9b41a4..807e977f0ee53d7b1d30ebe8e1f5dcb46aee1765 100644 (file)
 #include "extract.h"
 
 void
-carp_print(netdissect_options *ndo, register const u_char *bp, register u_int len, int ttl)
+carp_print(netdissect_options *ndo, const u_char *bp, u_int len, int ttl)
 {
        int version, type;
        const char *type_s;
 
        ND_TCHECK_1(bp);
-       version = (bp[0] & 0xf0) >> 4;
-       type = bp[0] & 0x0f;
+       version = (EXTRACT_U_1(bp) & 0xf0) >> 4;
+       type = EXTRACT_U_1(bp) & 0x0f;
        if (type == 1)
                type_s = "advertise";
        else
@@ -71,7 +71,7 @@ carp_print(netdissect_options *ndo, register const u_char *bp, register u_int le
                struct cksum_vec vec[1];
                vec[0].ptr = (const uint8_t *)bp;
                vec[0].len = len;
-               if (ND_TTEST2(bp[0], len) && in_cksum(vec, 1))
+               if (ND_TTEST_LEN(bp, len) && in_cksum(vec, 1))
                        ND_PRINT((ndo, " (bad carp cksum %x!)",
                                EXTRACT_BE_U_2(bp + 6)));
        }