tcpdump mailing list archives

Re: alignment


From: Guy Harris <guy () netapp com>
Date: Sun, 10 Nov 2002 02:26:33 -0800

On Sat, Nov 09, 2002 at 11:50:17AM +0900, Jun-ichiro itojun Hagino wrote:
      i was thinking about something like this:

#if GCC
#define __ATTRIBUTE_PACKED__  __attribute__((packed))
#else
#define __ATTRIBUTE_PACKED__
#endif

struct foo {
      u_int32_t bar;
      u_int32_t baz;
} __ATTRIBUTE_PACKED__;

Note that you'll have to do that to "struct rpc_msg" as well - which
means getting that structure from tcpdump header files rather than from
native OS header files.  (I just tried running, on a SPARC/Solaris
machine, the latest tcpdump, reading a Token Ring capture; it got an
alignment fault on

                        direction = (enum msg_type)ntohl(rp->rm_direction);

in "print-udp.c".)

I don't know if there are any other structures left that we're getting
from the OS; we should be defining most, if not all, of them ourselves
now.
-
This is the TCPDUMP workers list. It is archived at
http://www.tcpdump.org/lists/workers/index.html
To unsubscribe use mailto:tcpdump-workers-request () tcpdump org?body=unsubscribe


Current thread: