bus error in argus_dlpi 2.0.6

Carter Bullard carter at qosient.com
Wed Dec 10 13:47:19 EST 2003


Hey William,
   Because we're parsing a buffer from the network,
some data may not lay on a particular word boundary.
The compiler doesn't align the data, the compiler will
force data types in defined structures to the correct
alignment, but if you cast a (char *), which can be
on any boundary, to say an (int *), then there could
be some problems.  We're doing that, but we have/had
code that would put the data into explicit alignment
so that this type of casting would work.

   Its probably something I did, as it has worked
well in the past.

Carter



-----Original Message-----
From: owner-argus-info at lists.andrew.cmu.edu
[mailto:owner-argus-info at lists.andrew.cmu.edu] On Behalf Of William Setzer
Sent: Wednesday, December 10, 2003 12:59 PM
To: argus at lists.andrew.cmu.edu
Subject: Re: bus error in argus_dlpi 2.0.6


"Carter Bullard" <carter at qosient.com> writes:
:
: Hey William,
:    There is code to align the packets, if its
: needed.

I don't think I explained the problem well.

The problem is that the `oic' pointer (and `icmp') is sometimes (as an
example) at the memory location 0x389f2 or 0x395e6 (that is, were you
to do math on the pointer location, "oic & 0x2" == 1), so doing a 4
byte access of that pointer causes a bus error.  It's not in the
packets themselves, it's the variable's memory location.

I don't really understand why the compiler isn't aligning the data
properly to begin with; I thought it was supposed to.

: Is this the release candidate code?

Yep.


William






More information about the argus mailing list