} ip6_ctlun;
nd_ipv6 ip6_src; /* source address */
nd_ipv6 ip6_dst; /* destination address */
-} ND_UNALIGNED;
+};
#define ip6_vfc ip6_ctlun.ip6_un2_vfc
#define IP6_VERSION(ip6_hdr) ((EXTRACT_U_1((ip6_hdr)->ip6_vfc) & 0xf0) >> 4)
struct ip6_ext {
nd_uint8_t ip6e_nxt;
nd_uint8_t ip6e_len;
-} ND_UNALIGNED;
+};
/* Hop-by-Hop options header */
struct ip6_hbh {
nd_uint8_t ip6h_nxt; /* next header */
nd_uint8_t ip6h_len; /* length in units of 8 octets */
/* followed by options */
-} ND_UNALIGNED;
+};
/* Destination options header */
struct ip6_dest {
nd_uint8_t ip6d_nxt; /* next header */
nd_uint8_t ip6d_len; /* length in units of 8 octets */
/* followed by options */
-} ND_UNALIGNED;
+};
/* http://www.iana.org/assignments/ipv6-parameters/ipv6-parameters.xhtml */
nd_uint8_t ip6r_type; /* routing type */
nd_uint8_t ip6r_segleft; /* segments left */
/* followed by routing type specific data */
-} ND_UNALIGNED;
+};
#define IPV6_RTHDR_TYPE_0 0
#define IPV6_RTHDR_TYPE_2 2
nd_uint8_t ip6f_reserved; /* reserved field */
nd_uint16_t ip6f_offlg; /* offset, reserved, and flag */
nd_uint32_t ip6f_ident; /* identification */
-} ND_UNALIGNED;
+};
#define IP6F_OFF_MASK 0xfff8 /* mask out offset from ip6f_offlg */
#define IP6F_RESERVED_MASK 0x0006 /* reserved bits in ip6f_offlg */
#endif
#include <sys/types.h>
-/*
- * Used to declare a structure unaligned, so that the C compiler,
- * if necessary, generates code that doesn't assume alignment.
- * This is required because there is no guarantee that the packet
- * data we get from libpcap/WinPcap is properly aligned.
- *
- * This assumes that, for all compilers that support __attribute__((packed)),
- * for all instruction set architectures requiring strict alignment, declaring
- * a structure with that attribute causes the compiler to generate code that
- * handles misaligned 2-byte, 4-byte, and 8-byte integral quantities.
- *
- * It does not (yet) handle compilers where you can get the compiler
- * to generate code of that sort by some other means.
- *
- * This is required in order to, for example, keep the compiler from
- * generating, for
- *
- * if (bp->bp_htype == 1 && bp->bp_hlen == 6 && bp->bp_op == BOOTPREQUEST) {
- *
- * in print-bootp.c, code that loads the first 4-byte word of a
- * "struct bootp", masking out the bp_hops field, and comparing the result
- * against 0x01010600.
- *
- * Note: this also requires that padding be put into the structure,
- * at least for compilers where it's implemented as __attribute__((packed)).
- *
- * XXX - now that we're using nd_ types that are just arrays of bytes, is
- * this still necessary? Are there any compilers that align structures,
- * none of whose members require more than byte alignment, on more than
- * one-byte boundaries, and assume a structure is aligned on such a
- * boundary? (I have vague memories of either m68k or ARM compilers
- * aligning on at least 2-byte boundaries.)
- */
-#if ND_IS_AT_LEAST_GNUC_VERSION(2,0) || \
- ND_IS_AT_LEAST_XL_C_VERSION(6,0)
- /*
- * GCC 2.0 or later, or a compiler that claims to be GCC 2.0 or later,
- * or IBM XL C 6.0 or later.
- *
- * Use __attribute__((packed)).
- */
- #define ND_UNALIGNED __attribute__((packed))
-#else
- /*
- * Nothing.
- */
- #define ND_UNALIGNED
-#endif
-
/*
* Data types corresponding to multi-byte integral values within data
* structures. These are defined as arrays of octets, so that they're
nd_byte bp_sname[64]; /* server host name */
nd_byte bp_file[128]; /* boot file name */
nd_byte bp_vend[64]; /* vendor-specific area */
-} ND_UNALIGNED;
+};
#define BOOTPREPLY 2
#define BOOTPREQUEST 1
nd_ipv4 v_ins1, v_ins2; /* IEN-116 name servers */
nd_ipv4 v_ts1, v_ts2; /* Time servers */
nd_byte v_unused[24]; /* currently unused */
-} ND_UNALIGNED;
+};
/* v_flags values */
nd_uint16_t dccph_checksum;
nd_uint8_t dccph_xtr;
nd_uint24_t dccph_seq;
-} ND_UNALIGNED;
+};
/**
* struct dccp_hdr_ext - generic part of DCCP packet header, with a 48-bit
nd_uint8_t dccph_xtr;
nd_uint8_t reserved;
nd_uint48_t dccph_seq;
-} ND_UNALIGNED;
+};
#define DCCPH_CCVAL(dh) ((EXTRACT_U_1((dh)->dccph_ccval_cscov) >> 4) & 0xF)
#define DCCPH_CSCOV(dh) (EXTRACT_U_1((dh)->dccph_ccval_cscov) & 0xF)
*/
struct dccp_hdr_request {
nd_uint32_t dccph_req_service;
-} ND_UNALIGNED;
+};
/**
* struct dccp_hdr_response - Conection initiation response header
struct dccp_hdr_response {
nd_uint64_t dccph_resp_ack; /* always 8 bytes, first 2 reserved */
nd_uint32_t dccph_resp_service;
-} ND_UNALIGNED;
+};
/**
* struct dccp_hdr_reset - Unconditionally shut down a connection
nd_uint8_t dccph_reset_data1;
nd_uint8_t dccph_reset_data2;
nd_uint8_t dccph_reset_data3;
-} ND_UNALIGNED;
+};
enum dccp_pkt_type {
DCCP_PKT_REQUEST = 0,
nd_uint16_t th_win; /* window */
nd_uint16_t th_sum; /* checksum */
nd_uint16_t th_urp; /* urgent pointer */
-} ND_UNALIGNED;
+};
#define TH_OFF(th) ((EXTRACT_U_1((th)->th_offx2) & 0xf0) >> 4)