Ethereal-dev: Re: [ethereal-dev] Code for ISAKMP, GRE, and PPTP

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Gilbert Ramirez <gram@xxxxxxxxxx>
Date: Thu, 10 Jun 1999 13:24:36 -0500
Here's a new diff of the new protocol dissectors against the current CVS
image. I made a few changes. The usage of ntohs and ntohl in
packet-isakmp.c, packet-gre.c, and packet-pptp.c needed to be replaced
with ethereal's macros pntohs and pntol. ntohs and ntohl were causing
bus errors on my sparc running Solaris 2.6; they were making shorts and
longs directly from the packet data, which in some cases was on
unaligned data.

As I learned from Guy Harris, sparcs, and other RISC CPUs, require the
following alignment:

accesses to 2-byte variables need to be aligned on 2-byte memory
boundaries

accesses to 4-byte variables need to be aligned on 4-byte memory
boundaries

and probably,

accesses to 8-byte variables need to be aligned on 8-byte memory
boundaries, although I don't have a 64-bit machine to test this on.

The ethereal pntohs and pntohl macros avoid the boundary problems by
building values byte-by-byte, instead of having the CPU create 2-byte or
4-byte variables from the data.


Could you re-do the traces and make the snap length in tcpdump 1500 or
so? It's at 64 or 68, so the entire packet is not captured in the trace.

thanks,

--gilbert

Attachment: eth-new.diff.gz
Description: application/gunzip