Re: RFFR

Lawrence MacIntyre <[email protected]>
Newsgroups gmane.comp.security.libnet
Organization High Performance Information Infrastructure Group
Message-ID <1074863041.7336.13.camel@nautique>
When designing data structures, it helps to put the largest ones first,
padding where necessary to keep natural alignment, and assuming that
pointers are 8 bytes.  If you do that, you can greatly reduce the
alignment problems.  This is a problem on Alpha processors also.
On Thu, 2004-01-22 at 12:03, spacewalker wrote:
> Note that on sparc processors, packed structures are a problem. I
> remember a long time ago having a program crashing using pcap or libnet
> code (i don't remember which the problem was from). 
> the problem lied in a "long" nonaligned to 4 bytes, placed in a
> structure, and then deferenced. I believed it to be a compiler problem
> (which should detect nonaligned access).
> 
> hope this will help
> On Thu, 22 Jan 2004 13:18:13 +0100
> "Alfredo Andres Omella" <[email protected]> wrote:
> 
> > 
> > IMHO is very important to fix data structures not aligned in memory.
> > 
> > On Solaris8 SPARC an Linux RedHat 7.2 (2.4.7-10) "sizeof(struct
> > libnet_stp_conf_hdr)" is 40 bytes and must be 35 bytes.
> > 
> > Fortunately libnet_stp_conf_hdr is not used within the libnet code but
> > is susceptible to be used by users (hope nobody do it) :).
> > 
> > Do you think is really necessary (the structure, i mean)? :?
> > 
> > If you prefere to keep up with the structure one solution could be to
> > use"__attribute__((packed))" but this would face 2 problems:
> > a) Any user will be forced to use gcc (some people use the Sun
> > compiler, not compatible with "attribute" extensions.)
> > b) Packing structures will penalize the libnet performance.
> > 
> > 
> > Waiting for answers...
> > 
> > 
> > Alfredo
> > 
> > 
> > 
> > 
-- 
    Lawrence MacIntyre     865.574.8696     [email protected]
               Oak Ridge National Laboratory
High Performance Information Infrastructure Technology Group
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQBAERvBCNjP8rawCW4RAlLsAJ4kmXeslJAKV00gfCepQaOlp+fV5ACeL/FE
CNRXn5EUC0RDj3TZQCau1ug=
=igmV
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.