]> The Tcpdump Group git mirrors - tcpdump/commitdiff
fix alignment issues with GCC on Solaris 10 SPARC
authorDenis Ovsienko <[email protected]>
Sun, 9 Oct 2016 10:42:48 +0000 (11:42 +0100)
committerDenis Ovsienko <[email protected]>
Sun, 9 Oct 2016 10:44:19 +0000 (11:44 +0100)
When compiled with the Solaris Studio 12.3 compiler (as in the OpenCSW
buildbot system at the time), tcpdump passed all the tests. When
compiled with GCC 5.2.0 on the same host, the following tests failed
because tcpdump terminated with SIGILL (Bus Error - core dumped):
icmpv6, icmpv6_opt24-v, dhcpv6-aftr-name, dhcpv6-ia-na, dhcpv6-ia-pd,
dhcpv6-ia-ta, dhcpv6-ntp-server, dhcpv6-sip-server-d,
dhcpv6-domain-list, kday1. This change fixes the issue with the method
suggested in commit 1376682.

print-dhcp6.c
print-forces.c
print-icmp6.c

index aed1f1b9443f733085160c7194c7df2b24be8569..05ca6c4fde00c580b1661a1a0aa9360e2b142ffb 100644 (file)
@@ -105,8 +105,8 @@ static const struct tok dh6_msgtype_str[] = {
 /* DHCP6 base packet format */
 struct dhcp6 {
        union {
-               uint8_t m;
-               uint32_t x;
+               nd_uint8_t m;
+               nd_uint32_t x;
        } dh6_msgtypexid;
        /* options follow */
 };
@@ -116,10 +116,10 @@ struct dhcp6 {
 
 /* DHCPv6 relay messages */
 struct dhcp6_relay {
-       uint8_t dh6relay_msgtype;
-       uint8_t dh6relay_hcnt;
-       uint8_t dh6relay_linkaddr[16];  /* XXX: badly aligned */
-       uint8_t dh6relay_peeraddr[16];
+       nd_uint8_t dh6relay_msgtype;
+       nd_uint8_t dh6relay_hcnt;
+       nd_uint8_t dh6relay_linkaddr[16];       /* XXX: badly aligned */
+       nd_uint8_t dh6relay_peeraddr[16];
        /* options follow */
 };
 
@@ -263,8 +263,8 @@ static const struct tok dh6opt_stcode_str[] = {
 };
 
 struct dhcp6opt {
-       uint16_t dh6opt_type;
-       uint16_t dh6opt_len;
+       nd_uint16_t dh6opt_type;
+       nd_uint16_t dh6opt_len;
        /* type-dependent data follows */
 };
 
index 3cc5ca7c887779266ba41c116a663c129099dc37..de6c8264ddc59184301afbc8db4f653db41e4c21 100644 (file)
@@ -153,17 +153,17 @@ static const struct tok ForCES_TPs[] = {
  * Structure of forces header, naked of TLVs.
  */
 struct forcesh {
-       uint8_t fm_vrsvd;       /* version and reserved */
+       nd_uint8_t fm_vrsvd;    /* version and reserved */
 #define ForCES_V(forcesh)      ((forcesh)->fm_vrsvd >> 4)
-       uint8_t fm_tom; /* type of message */
-       uint16_t fm_len;        /* total length * 4 bytes */
+       nd_uint8_t fm_tom;      /* type of message */
+       nd_uint16_t fm_len;     /* total length * 4 bytes */
 #define ForCES_BLN(forcesh)    ((uint32_t)(EXTRACT_16BITS(&(forcesh)->fm_len) << 2))
-       uint32_t fm_sid;        /* Source ID */
+       nd_uint32_t fm_sid;     /* Source ID */
 #define ForCES_SID(forcesh)    EXTRACT_32BITS(&(forcesh)->fm_sid)
-       uint32_t fm_did;        /* Destination ID */
+       nd_uint32_t fm_did;     /* Destination ID */
 #define ForCES_DID(forcesh)    EXTRACT_32BITS(&(forcesh)->fm_did)
-       uint8_t fm_cor[8];      /* correlator */
-       uint32_t fm_flags;      /* flags */
+       nd_uint8_t fm_cor[8];   /* correlator */
+       nd_uint32_t fm_flags;   /* flags */
 #define ForCES_ACK(forcesh)    ((EXTRACT_32BITS(&(forcesh)->fm_flags)&0xC0000000) >> 30)
 #define ForCES_PRI(forcesh)    ((EXTRACT_32BITS(&(forcesh)->fm_flags)&0x38000000) >> 27)
 #define ForCES_RS1(forcesh)    ((EXTRACT_32BITS(&(forcesh)->fm_flags)&0x07000000) >> 24)
@@ -243,8 +243,8 @@ static int invoptlv_print(netdissect_options *, register const u_char * pptr, re
 
 #define OP_MIN_SIZ 8
 struct pathdata_h {
-       uint16_t pflags;
-       uint16_t pIDcnt;
+       nd_uint16_t pflags;
+       nd_uint16_t pIDcnt;
 };
 
 #define        B_FULLD         0x1
@@ -376,13 +376,13 @@ static inline int ttlv_valid(uint16_t ttlv)
 }
 
 struct forces_ilv {
-       uint32_t type;
-       uint32_t length;
+       nd_uint32_t type;
+       nd_uint32_t length;
 };
 
 struct forces_tlv {
-       uint16_t type;
-       uint16_t length;
+       nd_uint16_t type;
+       nd_uint16_t length;
 };
 
 #define F_ALN_LEN(len) ( ((len)+ForCES_ALNL-1) & ~(ForCES_ALNL-1) )
@@ -452,8 +452,8 @@ static int asttlv_print(netdissect_options *, register const u_char * pptr, regi
                        uint16_t op_msk, int indent);
 
 struct forces_lfbsh {
-       uint32_t class;
-       uint32_t instance;
+       nd_uint32_t class;
+       nd_uint32_t instance;
 };
 
 #define ASSNS_OPS (B_OP_REPORT)
@@ -546,9 +546,9 @@ chk_op_type(netdissect_options *ndo,
 #define F_TABAPPEND 4
 
 struct res_val {
-       uint8_t result;
-       uint8_t resv1;
-       uint16_t resv2;
+       nd_uint8_t result;
+       nd_uint8_t resv1;
+       nd_uint16_t resv2;
 };
 
 static int prestlv_print(netdissect_options *, register const u_char * pptr, register u_int len,
index 63f336b9fe81dfd79bbba56258c219e09d273992..7fe639dc833b461aa9021ac65aa1ac3fb140749f 100644 (file)
@@ -284,13 +284,13 @@ struct nd_opt_hdr {               /* Neighbor discovery option header */
 #define ND_OPT_DNSSL                   31
 
 struct nd_opt_prefix_info {    /* prefix information */
-       uint8_t         nd_opt_pi_type;
-       uint8_t         nd_opt_pi_len;
-       uint8_t         nd_opt_pi_prefix_len;
-       uint8_t         nd_opt_pi_flags_reserved;
-       uint8_t         nd_opt_pi_valid_time[4];
-       uint8_t         nd_opt_pi_preferred_time[4];
-       uint8_t         nd_opt_pi_reserved2[4];
+       nd_uint8_t              nd_opt_pi_type;
+       nd_uint8_t              nd_opt_pi_len;
+       nd_uint8_t              nd_opt_pi_prefix_len;
+       nd_uint8_t              nd_opt_pi_flags_reserved;
+       nd_uint32_t             nd_opt_pi_valid_time;
+       nd_uint32_t             nd_opt_pi_preferred_time;
+       nd_uint32_t             nd_opt_pi_reserved2;
        struct in6_addr nd_opt_pi_prefix;
 };