]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Use nd_ types for AH headers.
authorGuy Harris <[email protected]>
Thu, 14 Dec 2017 04:43:33 +0000 (20:43 -0800)
committerGuy Harris <[email protected]>
Thu, 14 Dec 2017 04:43:33 +0000 (20:43 -0800)
ah.h
print-ah.c
print-icmp6.c

diff --git a/ah.h b/ah.h
index d87a087e1a891c4391686df24f48d01d376a32cc..90c5601008a2cb383e3e5e43f4c29e776af2ec57 100644 (file)
--- a/ah.h
+++ b/ah.h
 #define _NETINET6_AH_H_
 
 struct ah {
 #define _NETINET6_AH_H_
 
 struct ah {
-       uint8_t         ah_nxt;         /* Next Header */
-       uint8_t         ah_len;         /* Length of data, in 32bit */
-       uint16_t        ah_reserve;     /* Reserved for future use */
-       uint32_t        ah_spi;         /* Security parameter index */
+       nd_uint8_t      ah_nxt;         /* Next Header */
+       nd_uint8_t      ah_len;         /* Length of data, in 32bit */
+       nd_uint16_t     ah_reserve;     /* Reserved for future use */
+       nd_uint32_t     ah_spi;         /* Security parameter index */
        /* variable size, 32bit bound*/ /* Authentication data */
 };
 
 struct newah {
        /* variable size, 32bit bound*/ /* Authentication data */
 };
 
 struct newah {
-       uint8_t         ah_nxt;         /* Next Header */
-       uint8_t         ah_len;         /* Length of data + 1, in 32bit */
-       uint16_t        ah_reserve;     /* Reserved for future use */
-       uint32_t        ah_spi;         /* Security parameter index */
-       uint32_t        ah_seq;         /* Sequence number field */
+       nd_uint8_t      ah_nxt;         /* Next Header */
+       nd_uint8_t      ah_len;         /* Length of data + 1, in 32bit */
+       nd_uint16_t     ah_reserve;     /* Reserved for future use */
+       nd_uint32_t     ah_spi;         /* Security parameter index */
+       nd_uint32_t     ah_seq;         /* Sequence number field */
        /* variable size, 32bit bound*/ /* Authentication data */
 };
 
        /* variable size, 32bit bound*/ /* Authentication data */
 };
 
index d47309bf171ca545f29b8f17532a8ae1907335d0..30fb8d266b4f4ad1fd9d1f78c3a45051bce083be 100644 (file)
 
 #include <netdissect-stdinc.h>
 
 
 #include <netdissect-stdinc.h>
 
-#include "ah.h"
-
 #include "netdissect.h"
 #include "extract.h"
 
 #include "netdissect.h"
 #include "extract.h"
 
+#include "ah.h"
+
 int
 ah_print(netdissect_options *ndo, const u_char *bp)
 {
 int
 ah_print(netdissect_options *ndo, const u_char *bp)
 {
@@ -44,9 +44,9 @@ ah_print(netdissect_options *ndo, const u_char *bp)
 
        ND_TCHECK(*ah);
 
 
        ND_TCHECK(*ah);
 
-       sumlen = ah->ah_len << 2;
+       sumlen = EXTRACT_U_1(ah->ah_len) << 2;
 
 
-       ND_PRINT((ndo, "AH(spi=0x%08x", EXTRACT_BE_U_4(&ah->ah_spi)));
+       ND_PRINT((ndo, "AH(spi=0x%08x", EXTRACT_BE_U_4(ah->ah_spi)));
        if (ndo->ndo_vflag)
                ND_PRINT((ndo, ",sumlen=%d", sumlen));
        ND_TCHECK_4(ah + 1);
        if (ndo->ndo_vflag)
                ND_PRINT((ndo, ",sumlen=%d", sumlen));
        ND_TCHECK_4(ah + 1);
index b2230f60b7aaaa464ef23994bed0891912b997fe..312a72bafc7f6f3e71fb4456cf34e7e8f03f0a29 100644 (file)
@@ -1222,8 +1222,8 @@ get_upperlayer(netdissect_options *ndo, const u_char *bp, u_int *prot)
                        ah = (const struct ah *)bp;
                        if (!ND_TTEST(ah->ah_len))
                                return(NULL);
                        ah = (const struct ah *)bp;
                        if (!ND_TTEST(ah->ah_len))
                                return(NULL);
-                       nh = ah->ah_nxt;
-                       hlen = (ah->ah_len + 2) << 2;
+                       nh = EXTRACT_U_1(ah->ah_nxt);
+                       hlen = (EXTRACT_U_1(ah->ah_len) + 2) << 2;
                        break;
 
                default:        /* unknown or undecodable header */
                        break;
 
                default:        /* unknown or undecodable header */