]> The Tcpdump Group git mirrors - tcpdump/commit
fix bug #303 (DLT_IEEE802_11_RADIO ext. bitmaps)
authorDenis Ovsienko <[email protected]>
Sun, 28 Apr 2013 13:20:28 +0000 (17:20 +0400)
committerGuy Harris <[email protected]>
Mon, 6 May 2013 22:00:50 +0000 (15:00 -0700)
commit2f2e35168f0852832afba2b9a045df8d6fbe171a
treec35bda19b378f1b5487de1a365e9b57f44de2d4a
parent842e10954cde63630bd461e2aebddfc3d0453139
fix bug #303 (DLT_IEEE802_11_RADIO ext. bitmaps)

This bug was discovered and pinned down by Wim Torfs.

The code in question handles DLT_IEEE802_11_RADIO datalink type, which
consists of a variable-sized header, a variable number of fields and the
actual 802.11 frame. The integers contained in the fields are aligned,
properly extracting them is exactly the purpose of the existing "cpack"
module. The issue with the current code is that it sets alignment base
for cpack at the end of the variable-sized header, in other words,
64-bit integers would be properly extracted only so long as the header
is 64-bit long, which only happens when the total number of bitmaps in
it is odd (the minimum number of bitmaps is one). Once this condition
isn't met, as is with two bitmaps, decoding becomes incorrect. The
reporter's point that the alignment base must be the beginning of the
variable-sized header is accurate.

This commit adds a new cpack_advance() function to fast-forward the
"c_next" pointer of a cpack_state context by an arbitrary number of
octets. The ieee802_11_radio_print() function now uses it to skip the
header and all its bitmaps, and the alignment base is now the header
start.
cpack.c
cpack.h
print-802_11.c
tests/ieee802.11_exthdr.out [new file with mode: 0644]