[ I'm Cc'ing this message to the ethereal-dev list because I think
everyone might be able to benefit from the alignment issues discussed
below. I hope Laurent doesn't mind. :) ]
On Mon, 31 Aug 1998, Laurent Deniel wrote:
> The attached file contains a diff to ethereal 0.3.13 files that
> fixes/adds the following stuff:
> - in order to compile with the standard <net/bpf.h> on Digital UNIX,
> I have added a #define in packet.h
> - to run on Digital UNIX, I have added two options that allow the user
> to specify the fonts (medium and bold). Added also a test to avoid
> a SIGSEGV if a font is not known on the system,
> - added a -h option to display the process arguments.
Great! The font issue doesn't suprise me. GTK+ doesn't define a
standard monospace font. Lucida Typewriter was present on each of the
platforms we run here, but I wasn't sure it would be present on all
systems. It would probably be a good idea to add a font test to the
configure script, so that this could be handled at compile time.
> More will follow (such as unaligned access fixes on Digital UNIX).
I was expecting this. I used Digital Unix (OSF/1 1.x) at my old job,
and I spent some time fixing alignment problems there. I particularly
remember having to port xtacacs code - ugh. Here are a couple of things
that might help you with alignment problems on the Alpha:
In several of the modules that I wrote (IP, UDP, TCP, etc), I overlay
a struct onto a pointer in the packet data byte array. For instance,
in dissect_udp() I do the following:
e_udphdr *uh;
uh = (e_udphdr *) &pd[offset];
Where pd is a byte array containing the packet data.
There are two things very wrong with this approach:
- The e_udphdr struct may have holes in it. It works fine on Intel,
SPARC, and PowerPC systems, but Alpha systems may have problems.
- Arbitrarily overlaying data this way may have alignment problems.
For instance SPARCs require that 32-bit integers be aligned on
4-byte boundaries. This is why dissect_ip() uses memcpy() to copy
the IP header data into the e_ip struct.
A while ago, Gilbert added pntohs() and pntohl() macros to packet.h.
You pass them a byte pointer, and they return the short and long ints at
that pointer. I expanded them this weekend to fix some Solaris alignment
issues. They may be able to help you with your Alpha effort as long as I
didn't break them.
I have a feeling that much of the packet dissection code will have to be
rewritten for the Alpha. If this is the case, let me know and I'll help.
I may be able to get an account on an Alpha machine around here, as well.
---------------------------------------------------------------------------
***** ***** Gerald Combs gerald@xxxxxxxxxx
*** *** Mouse cleaning czar http://www.unicom.net
* * Unicom Communications, Inc. (913)327-5309
***** 7223 W. 95th St., Ste 325 (913)327-5376 Fax
*** Overland Park, KS 66212 (913)327-5375 Client Support
*
---------------------------------------------------------------------------