In the case where the "From DS" bit is not set and the "To DS" bit is set
in the Frame Control Bitmask, the comment line in the corresponding if else
block was misleading that the "From DS" bit is set and the "To DS" bit is
not set.
Lose PRINT_MESHLINK_ACTION(), PRINT_MESHPEERING_ACTION() and
PRINT_MESHPATH_ACTION(), which were unused since commit f1c0553. Convert
the remaining 5 macros and hard-coded strings using tok2str() and
uint2tokary().
Gisle Vanem reported in GH #881 that in Windows tcpdump failed to link
with static AirPcap because the latter seems to include its own variant
of cpack code:
airpcap_static.lib(RadiotapDecode.obj) : error LNK2005: _cpack_init
already defined in cpack.obj
airpcap_static.lib(RadiotapDecode.obj) : error LNK2005: _cpack_uint16
already defined in cpack.obj
airpcap_static.lib(RadiotapDecode.obj) : error LNK2005: _cpack_uint32
already defined in cpack.obj
airpcap_static.lib(RadiotapDecode.obj) : error LNK2005: _cpack_uint64
already defined in cpack.obj
airpcap_static.lib(RadiotapDecode.obj) : error LNK2005: _cpack_uint8
already defined in cpack.obj
He confirms this change resolves the issue.
uint32_t for flags, because there are calls with uint16_t and uint32_t.
This change avoids (for presentflags):
print-802_11.c:2795:41: runtime error: implicit conversion from type
'uint32_t' (aka 'unsigned int') of value 2147502191 (32-bit, unsigned)
to type 'int' changed the value to -2147465105 (32-bit, signed)
#0 0x815e130 in print_radiotap_field ./print-802_11.c:2795:41
Replace more calls to ipaddr_string()/ip6addr_string() with calls to
GET_IPADDR_STRING()/GET_IP6ADDR_STRING() macros performing bounds
checking.
Add similar bounds-checking inline functions and macros to wrap
linkaddr_string(), etheraddr_string(), and isonsap_string() and convert
calls to them to use the macros as well.
Shuffle the inline functions in addrtoname.h around a bit, so that the
inline functions, external declarations, and macros are all in the same
order.
The exceptions are currently:
Some EXTRACT_ in print-juniper.c, not used on packet buffer pointer.
An EXTRACT_BE_U_3 in addrtoname.c, not always used on packet buffer
pointer.
Apparently, if you have an interface in monitor mode, capturing on the
"any" device can get packets that have a SLL hatype of 803, which is the
ARPHRD_ value for radiotap, and with the payload containing a radiotap
header, followed by an 802.11 header, followed by the 802.11 payload.
Handle that.
The functions are: nd_print, nd_printztn, nd_printn and nd_printzp.
Trying to make it clearer that they currently have to be used only on part
of the packet buffer.
Update some comments.
For coherency.
We have: DLT_IEEE802_11_RADIO_AVS and ieee802_11_radio_avs_if_print().
Thus rename ieee802_11_avs_radio_print() to ieee802_11_radio_avs_print().
This can prevent bizarre failures if, for example, you've done a
configuration in the top-level source directory, leaving behind one
config.h file, and then do an out-of-tree build in another directory,
with different configuration options. This way, we always pick up the
same config.h, in the build directory.
At one point, I remember a discussion resulting in the official name of
the next-generation replacement for pcap format being changed to
"pcapng", with no hyphen.
Make tcpdump reflect that.
While we're at it, uppdate to use "macOS" as the name of Apple's
UNIX-for-Macs, as appropriate (don't use it for versions that were still
called Mac OS X or OS X).
Have separate cpack_ routines for signed and unsigned numbers, with the
signed ones using _S_ extract macros. That way, we can do more type
checking.
Add EXTRACT_LE_S_ macros.
Use signed variables for IEEE80211_RADIOTAP_TX_ATTENUATION and
IEEE80211_RADIOTAP_DB_TX_ATTENUATION, rather than using unsigned
variables that we cast to int.
Also, use EXTRACT_U_1() in cpack_uint8.
Now all the macros have a name meaning a count in bytes.
With _S_: signed, _U_: unsigned
e.g.:
EXTRACT_BE_32BITS -> EXTRACT_BE_U_4
EXTRACT_LE_32BITS -> EXTRACT_LE_U_4
...
EXTRACT_BE_INT32 -> EXTRACT_BE_S_4
and have:
EXTRACT_8BITS -> EXTRACT_U_1
EXTRACT_INT8 -> EXTRACT_S_1