RE: RFFR
"Alfredo Andres Omella" <[email protected]>
| Newsgroups | gmane.comp.security.libnet |
|---|---|
| Message-ID | <[email protected]> |
I agree with both but it seems that i've not explained very well what the problem is, maybe due to may english level. :) The data structure is not mine, is a data structure declared on libnet that describes the Spanning Tree Protocol header so you can't move long/int fields to beginning or things like that because you'll break the protocol. The question is to remove or not to remove the entire structure. The solution of gcc is offered just in case the maintainers go ahead keeping the structure. Cheers, Alfredo > -----Mensaje original----- > De: Lawrence MacIntyre [mailto:[email protected]] > Enviado el: Friday, January 23, 2004 14:04 > Para: spacewalker > CC: [email protected] > Asunto: Re: RFFR > > > 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 > >