]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-enc.c
Use nd_ types, add EXTRACT_ calls.
[tcpdump] / print-enc.c
index d8f0a9e62426db26c4b4a02fc6c1a7c3617ac85f..db965efb2e0b9c0369739899893ab7ed9f108f8c 100644 (file)
@@ -75,9 +75,9 @@
 #define M_AUTH         0x0800  /* packet was authenticated (AH) */
 
 struct enchdr {
-       uint32_t af;
-       uint32_t spi;
-       uint32_t flags;
+       nd_uint32_t af;
+       nd_uint32_t spi;
+       nd_uint32_t flags;
 };
 
 #define ENC_PRINT_TYPE(wh, xf, nam) \
@@ -127,11 +127,11 @@ enc_if_print(netdissect_options *ndo,
         * The SPI field is always in network byte order, i.e. big-
         * endian.
         */
-       UNALIGNED_MEMCPY(&af, &hdr->af, sizeof af);
-       UNALIGNED_MEMCPY(&flags, &hdr->flags, sizeof flags);
+       UNALIGNED_MEMCPY(&af, &hdr->af, sizeof (af));
+       UNALIGNED_MEMCPY(&flags, &hdr->flags, sizeof (flags));
        if ((af & 0xFFFF0000) != 0) {
                af = SWAPLONG(af);
-               flags = SWAPLONG(hdr->flags);
+               flags = SWAPLONG(flags);
        }
 
        if (flags == 0)
@@ -141,7 +141,7 @@ enc_if_print(netdissect_options *ndo,
        ENC_PRINT_TYPE(flags, M_AUTH, "authentic");
        ENC_PRINT_TYPE(flags, M_CONF, "confidential");
        /* ENC_PRINT_TYPE(flags, M_TUNNEL, "tunnel"); */
-       ND_PRINT((ndo, "SPI 0x%08x: ", EXTRACT_BE_U_4(&hdr->spi)));
+       ND_PRINT((ndo, "SPI 0x%08x: ", EXTRACT_BE_U_4(hdr->spi)));
 
        length -= ENC_HDRLEN;
        caplen -= ENC_HDRLEN;