Commit Graph

15 Commits

Author SHA1 Message Date
Guy Harris
7923f06110 When parsing IEs in a management frame, save the *first* IE of a given
type we see, not the *last*, so the first one gets printed.  If,
however, a rates IE has a zero-length list of rates, don't save that
one; some devices send out frames with two rates IEs, one zero-length
and a later one containing the actual rates.

Have parse_elements() return an indication of whether truncation
occurred - and pass it the frame length, so it doesn't just keep parsing
until an end-of-captured-data test fails, as that would make *every*
frame look truncated.
2009-11-04 14:55:05 -08:00
Guy Harris
aae14f93d9 Merge in stuff from the current top-of-tree FreeBSD tcpdump; this picks
up changes from Sam Leffler for 802.11n and 802.11s.

Clean up ieee802_11_radio.h a bit.
2009-07-14 18:23:06 -07:00
Guy Harris
f2aee3ed6d Handle frames with an FCS (at least with a radiotap header).
Handle (to some degree) 802.11n Control Wrapper, Block Ack Req, and
Block Ack frames.
2009-01-15 02:35:19 -08:00
guy
7bfcc5ebc5 Don't attempt to dissect the payload of a no-data frame. 2007-07-22 19:59:06 +00:00
guy
86f96f8a7b Have parse_elements() flag each item as "present (and not truncated)",
"present but truncated", and "not present", and don't have it return an
indication of whether we ran past the end of a packet - instead, have
the routines that handle particular management frame types use macros
that check what the status of a particular tagged parameter is and:

	print it if present and not truncated;

	skip it if not present;

	return a "packet truncated" indication if present but truncated.

This means we handle tagged parameters that aren't present, and print
parameters that are present and not truncated even if there's a
present-but-truncated field after them.

Add some additional bounds checks.

Make the table of rates bigger - there can be more than 8 rates in a
rates tagged parameter.
2005-11-13 12:07:25 +00:00
guy
c589777d74 Uniformly use IEEE802_11_TSTAMP_LEN as the 802.11 timestamp length and
IEEE802_11_AP_LEN as the length of the previous AP in reassociation
frame.

Before copying variable-length fields from a management frame IE, make
sure the length isn't too large.
2005-10-17 07:58:56 +00:00
guy
91f7cb2f57 From David Young:
[This patch] fixes some bugs and adds a new feature.  Control
	packets were showing as [|802.11] because tcpdump expected for
	there to be an FCS on each one (wrong assumption).  Also, even
	if pieces of a control packet are missing, I have made tcpdump
	print its type when it knows it.  The new features is that if
	you give -v, the 802.11 Duration field (for virtual carrier
	sense) is printed.  This is useful for detecting
	hardware/firmware bugs (!!) and for debugging the new crop of
	802.11 drivers.
2003-07-22 17:36:57 +00:00
guy
d8add7cacc Stylistic cleanups, from David Young. 2003-07-22 17:35:04 +00:00
guy
f72f67a5cf From David Young: print Ack/Poll information for data frames with
contention-free Ack or Poll indications, and print flag bits from the
Frame Control field if "-v" was specified.
2003-02-04 05:53:21 +00:00
guy
fcc82f451d The "__attribute__((packed))" tag on structures causes some files not to
compile with Sun C, as "interface.h" isn't being included before the
structures are being declared.

Furthermore, in the files that Sun C *can* compile, it doesn't cause Sun
C to generate code that's safe with unaligned accesses, as
"__attribute__" is defined as a do-nothing macro with compilers that
don't support it.

Therefore, we get rid of that tag on the structures to which it was
added, and instead use "EXTRACT_16BIT()" and "EXTRACT_32BIT()" to fetch
16-bit and 32-bit big-endian quantities from packets.  We also fix some
other references to multi-byte quantities to get rid of code that tries
to do unaligned loads on platforms that don't support them.

We also throw in a hack that makes those macros use
"__attribute__((packed))" on structures containing only one 16-bit or
32-bit integer to get the compiler to generate unaligned-safe code
rather than doing it by hand.  (GCC on SPARC produces the same code that
doing it by hand does; I don't know if GCC on any other big-endian
strict-alignment processor generates better code for that case.  On
little-endian processors, as "ntohs()" and "ntohl()" might be functions,
that might actually produce worse code.)

Fix some places to use "%u" rather than "%d" to print unsigned
quantities.
2002-12-11 07:13:49 +00:00
itojun
10afb02ac8 put __attribute__((packed)) to packet headers. s/u_short/u_int16_t/ and so
forth while i'm here
2002-11-09 17:19:16 +00:00
itojun
111ff8a61d whitespace cleanup 2002-06-11 17:08:37 +00:00
guy
d2642d64c9 Don't use "sizeof" to compute the sizes of various headers - the
structures for the headers might have padding added by the compiler (I
think at least some versions of GCC for ARM, for example, pad structures
to a multiple of 4 bytes in length), use explicit #define values.

The sequence control field of a management frame header is 16 bits long,
not 8 bits long.
2001-06-14 09:50:01 +00:00
guy
884ae4d8c2 Don't make the FCS field of a control frame structure a "u_int32_t", as
that may force it to be aligned on a 4-byte boundary, and it's not
always aligned on a 4-byte boundary in those structures.

Add a bunch of bounds checking.

"ctrl_body_print()" expects its first argument to point to the beginning
of the link-level frame; pass it a pointer to that, not to the stuff
following the link-level frame.
2001-06-13 07:25:57 +00:00
guy
15b5a0ab52 IEEE 802.11 support, from Charlie Lenahan <clenahan@fortresstech.com>. 2001-06-12 05:17:16 +00:00