Subject: Re: Goofyness w/ llc & netatalk
To: None <is@beverly.rhein.de>
From: Bill Studenmund <wrstuden@loki.stanford.edu>
List: tech-net
Date: 02/09/1997 16:10:15
> 
> Bill Studenmund (wrstuden@loki.stanford.edu) wrote:
> 
> : On port-i386, sizeof(struct llc) == 8, while on port-mac68k
> : sizeof(struct llc) == 10 !!!!!
> [...]
> : The weird thing was that the code always generated a correct
> : snap header, just adding two extra bytes onto the end.
> : 
> : How can we fix this?
> 
> Basically, the compiler is free to add to structs whatever padding it
> things will help, or hinder, performance. Code that depends on a certain
> layout, other than to assume it will be the same for one execution of
> the program, is in error.
> 
> All we can legally do is to access bytes from a byte array, by byte offset.

Hmm. Well, it strikes me that we assume in many places in net/if_ethersub.c
that the structures we are inserting are packed versions of the structure
we use; that the compiler hasn't added extra spaces for padding within
the structure.

Is there some way to force the layout, and thus to tell the compiler
to just put things where we say?

Also, what do I need to do to get netatalk into the kernel? More testing
will probably be good, but it works for me in an i386, two mac68k's,
and one of the mac68k beta testers has gotten it to work.

I'll try to package things up again this week, to make a cleaner test
kit. Is there someone w/ an Alpha who's interested in testing? That
should find lots of un-aligned word errors. :-)

Take care,

Bill