Commit Graph

159 Commits

Author SHA1 Message Date
Richard Sharpe e61fe552d0 ieee80211-radiotap: Add support for headers to be bit-based as well as TLVs.
Johannes Berg pointed out this was the intent of the TLV definitions and
supplied some code for implementing that. I simply made it work.
2022-03-17 22:26:12 +00:00
Dario Lombardo 8e805674e0 ieee80211: fix wrong proto_tree_add_item call.
Data from packet has been used as encoding instead of an actual
encoding. Fix by using ENC_NA, since the field is FT_UINT8.

Fix: #17878.
2022-01-15 12:15:31 +00:00
Bahadir Ozgun 308add2f3a Fixed a typo 2022-01-14 12:19:25 +00:00
Bahadir Ozgun 5560f3f85b Fixed non-existent ness value because of wrong number 2022-01-14 07:18:04 +00:00
João Valverde 22ee2764a7 Replace g_snprintf() with snprintf() (dissectors)
Use macros from inttypes.h with format strings.
2021-12-19 20:25:11 +00:00
Richard Sharpe 2b2c81a551 ieee80211-radiotap: Fix a problem with S1G 0-length PPDUS.
The code was not advancing the offset correctly and mis-dissecting NDP
frames.
2021-12-15 07:06:33 +00:00
Richard Sharpe 4916bc024e ieee802-radiotap: Fix a silly issue with the S1G radiotap dissector.
The dissector was not correctly handling the Tag and Length.
2021-12-13 09:33:14 +00:00
Martin Mathieson d34d1a1e13 More fussing with masks.
Mostly longer masks with odd numbers of digits.
2021-07-29 10:15:58 +00:00
Evan Huus 8ee8808876 First pass pinfo->pool conversion, part 2
Automated find/replace of wmem_packet_scope() with pinfo->pool in all
files where it didn't cause a build failure.
2021-07-21 09:54:57 -04:00
Tomas Kukosa 5ba8139852 Radiotap: add 'data retries' field (bit number 17) 2021-07-01 08:23:11 +00:00
Guy Harris 71905c6597 radiotap: fix a comment.
Radiotap doesn't supply a channel number, just a center frequency, so
the latter is what we use to guess the modulation.
2021-03-09 18:25:26 -08:00
Guy Harris 31dc280d25 radiotap, wlancap, wiretap: make the "phy" reflect the packet modulation.
Do more fixups of the "phy" based on the data rate, so that it reflects
the modulation used for the packet.

Note, in comments, why we're doing this, and that there's no reiable
way, in radiotap, to determine the type of channel on which capturing is
being done, as some packet providers use the channel field to indicate
the channel type and others use it to indicate the modulation.

Only provide the "short preamble" for "11b", as that's now being used to
mean "DSSS modulation" - packets on an 11g channel will be marked as
"11g" if they're OFDM or "11b" if they're DSSS.

Make some other cleanups while we're at it.
2021-03-08 18:40:32 -08:00
Martin Mathieson d617f197e8 IEEE80211-Radiotap: Fix a typo 2021-03-05 09:10:21 +00:00
Guy Harris 25d44cde11 wsutil: rename frequency-utils.[ch] to 802_11-utils.[ch].
It's 802.11-specific, and may include non-frequency/channel-related
items in the future.
2021-03-04 15:41:00 -08:00
Alexis La Goutte d9c71861a3 radiotap: Fix Dead Store found by Clang Analyzer
packet-ieee80211-radiotap.c:2190:3: warning: Value stored to 'offset' is never read
2021-02-07 07:32:00 +00:00
Richard Sharpe fb2a0b4a71 ieee80211: Add support for S1G including PV1.
S1G adapters should be shipping soon since Silex America has a dev-kit
available, so it is about time to add support for this.

Change-Id: I0225d87f78efbcbe88476921d4fce3d56a3ce0cd
2021-02-01 19:34:55 +00:00
Martin Mathieson 607831d870 Fix more filter field strings.
These appear to be copy/paste errors detected by running
./tools/check_typed_item_calls.py --consecutive

Quite a few issues still remain after this batch.
2020-10-03 22:11:32 +00:00
Martin Mathieson 4c9f59ee56 Fix more spelling errors in dissector strings.
A second batch of spelling errors, detected using a script
that uses pyspellcheck and a Wireshark-specific dictionary file.

I will take at least one more pass through the dissectors, as
further improvements are made to the script.
2020-08-29 21:32:39 +00:00
Mathy Vanhoef e43e6e6897 ieee80211: add radiotap TX flags
This patches adds support to parse the TX flags of the radiotap header,
including a new DONT_ORDER Tx flag.

Bug: 16732
Change-Id: Ia57c079e020a32219a3e3fcfb7da5ef260360b7e
Reviewed-on: https://code.wireshark.org/review/37944
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-08-10 08:28:33 +00:00
Guy Harris e1d9a226a2 Fix the type of arrays of pointers to hf_ values for bitfield routines.
The static arrays are supposed to be arrays of const pointers to int,
not arrays of non-const pointers to const int.

Fixing that means some bugs (scribbling on what's *supposed* to be a
const array) will be caught (see packet-ieee80211-radiotap.c for
examples, the first of which inspired this change and the second of
which was discovered while testing compiles with this change), and
removes the need for some annoying casts.

Also make some of those arrays static while we're at it.

Update documentation and dissector-generator tools.

Change-Id: I789da5fc60aadc15797cefecfd9a9fbe9a130ccc
Reviewed-on: https://code.wireshark.org/review/37517
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-06-19 11:32:26 +00:00
Guy Harris fdf9610b84 radiotap: make tables that we modify automatic rather than static.
Another instance of this problem that showed up when working on the fix
to the data types of those tables (fixing the data types mean that these
errors cause the conpile to fail; as indicated, that's one reason to fix
them).

Change-Id: Ia1953b95968101f27fedd98a5fc2854101779deb
Reviewed-on: https://code.wireshark.org/review/37509
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-06-18 18:44:43 +00:00
Guy Harris 7a526325e9 radiotap: make tables that we modify automatic rather than static.
The arrays of pointers to header field hf_ values were getting
overwritten if the fields in question are unknown; that meant that, in
all future dissections, they would be dissected as unknown *even for
packets where they are known*.

Make them auto arrays, instead, so that each call to the dissector has
its own copy, properly initialized at run time, that it can scribble
over as it chooses without damaging the array for the next call.

This involves a cast to work around the type of the array argument being
"const int **", which means "pointer to pointer to const int",
not "pointer to const pointer to (non-const) int".  That meant that the
scribbling on the static array was *not* detected at compile time.

Fixing the type is a *lot* of work, but may catch other instances of
this problem, and may prevent future instances of it.  That's a project
for a separate commit, however.

Bug: 16636
Change-Id: I985157063488739bb59f87780c017e94e2380343
Reviewed-on: https://code.wireshark.org/review/37502
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-06-18 08:04:32 +00:00
Guy Harris 8b168e998f radiotap: fix typo.
Prof. Doppler's name is spelled with two "p"s.

Change-Id: Ia25d45b0a890be8c954a67b1ce5860753c1de25d
Reviewed-on: https://code.wireshark.org/review/37498
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-06-18 04:23:43 +00:00
Glenden Lee a584fd9fb6 ieee80211: Add datarate for 802.11AX packets
Bug: 16255 - support HE MCS to rate conversion
Change-Id: I4a4a6c3d62c167b654d150c397047a55f287e6c8
Reviewed-on: https://code.wireshark.org/review/37255
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-05-27 21:45:43 +00:00
Tomas Kukosa 84e0f45640 Add radiotap.vendor dissector table for vendor namespace
Change-Id: I49f1bd88b887635b2404e15dac60a44963ff9fd7
Reviewed-on: https://code.wireshark.org/review/37188
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2020-05-14 06:00:31 +00:00
Dario Lombardo f072494611 radiotap: remove unused increment.
Change-Id: I7f94e0d8ccb6650d6ace0a119e7f92045a26b338
Reviewed-on: https://code.wireshark.org/review/36070
Reviewed-by: Dario Lombardo <lomato@gmail.com>
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2020-02-10 14:42:19 +00:00
Dario Lombardo 20c8215fd5 radiotap: remove unused increment (CID: 1458175).
Change-Id: I684b3e59c97f45afaf1d4bdfd160a03e4e87b0f1
Reviewed-on: https://code.wireshark.org/review/36064
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Richard Sharpe <realrichardsharpe@gmail.com>
2020-02-10 07:45:14 +00:00
Richard Sharpe 38d54660f2 ieee80211-radiotap: Add support for radiotap TLVs.
From Johannes Berg with changes by Richard Sharpe to make it easier for
people to add support for RADIOTAP Header TLVs in the future.

Change-Id: I66d69cbe16740abce1e75ca1e789a2034283306b
Reviewed-on: https://code.wireshark.org/review/36057
Reviewed-by: Richard Sharpe <realrichardsharpe@gmail.com>
Petri-Dish: Richard Sharpe <realrichardsharpe@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2020-02-08 19:41:47 +00:00
Guy Harris e2fc0e4806 There's a macro to test for 802.11ad frequencies; use it.
The range doesn't start at 60 GHz, it starts at 57 GHz; this fixes that,
and leaves it open to future fixes.

Change-Id: I51d7188f50479bf542babe0f6677638e8a683314
Reviewed-on: https://code.wireshark.org/review/35524
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-12-20 20:04:41 +00:00
Guy Harris 2db8ca2671 radiotap: Detect 11ad based on the frequency.
This works around the lack of a defined radiotap field for 11ad.

Bug: 16272
Change-Id: Ia851c644aee52ff9a138a36b16015d4112b5bf92
Reviewed-on: https://code.wireshark.org/review/35401
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-12-11 02:03:11 +00:00
Guy Harris 473900d102 Add more support for the 802.11ax PHY.
Set it as the PHY type if we see the HE field in a radiotap header, and
report that PHY type as "802.11ax" in the generic radio metadata
dissector.

Change-Id: I181d2717d82bdca73e04b6111b2483ca099d48bb
Ping-Bug: 13207
Reviewed-on: https://code.wireshark.org/review/35227
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-11-27 00:00:03 +00:00
Sébastien Deronne 841c27c5a0 802.11 radiotap: Fix wrong data structure in the dissector for HE TRIGGER frames
(patch from Getachew Redieteab)

Change-Id: I180b20b513e901c2c157da9a2318a90c91fd040b
Reviewed-on: https://code.wireshark.org/review/34505
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2019-09-14 15:19:21 +00:00
Guy Harris 20800366dd HTTPS (almost) everywhere.
Change all wireshark.org URLs to use https.

Fix some broken links while we're at it.

Change-Id: I161bf8eeca43b8027605acea666032da86f5ea1c
Reviewed-on: https://code.wireshark.org/review/34089
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-07-26 18:44:40 +00:00
Gerald Combs 8d3ac3af86 epan: Convert our PROTO_ITEM_ macros to inline functions.
Convert our various PROTO_ITEM_ macros to inline functions and document
them.

Change-Id: I070b15d4f70d2189217a177ee8ba2740be36327c
Reviewed-on: https://code.wireshark.org/review/32706
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-04-04 04:03:38 +00:00
Richard Sharpe 4e07033c38 ieee80211-radiotap: Bring up to date with the actual spec.
The spec is now accepted, so bringing these up to date.

Change-Id: I9489cd8c0b9255446c829f8202410d2d94272607
Reviewed-on: https://code.wireshark.org/review/31723
Petri-Dish: Richard Sharpe <realrichardsharpe@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Richard Sharpe <realrichardsharpe@gmail.com>
2019-03-03 22:04:52 +00:00
Guy Harris 88e98d876e Move the Linux ARPHRD_ types to epan/arptypes.h.
Change-Id: I6fa9593af64e8af1ade4f049ea949989adfd00c7
Reviewed-on: https://code.wireshark.org/review/30595
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-11-13 06:18:22 +00:00
Guy Harris c348dd4b10 Fix dissection of 802.11+radiotap frames in Linux "cooked" captures.
Those frames *don't* have their link-layer headers stripped, even on
PF_PACKET/SOCK_DGRAM captures (hopefully, nobody will consider that a
bug and "fix" it).

The "hatype" field is the ARPHRD_ value for the adapter, as returned by
SIOCGIFHWADDR; in monitor mode, those frames will have an hatype of
ARPHRD_IEEE80211_RADIOTAP.  Add an "sll.hatype" dissector table, which
we check before checking the "sll.ltype" dissector table, and have the
radiotap dissector register in that table.

We still use the special hack for an hatype of ARPHRD_NETLINK, because,
for *those* frames, the "protocol" field of the nominal SLL header is
the netlink family, not an Ethertype or anything else that the SLL
dissector would handle.

Change-Id: If503a7daa9133adf1b8c330ec28c4c824d4f551d
Reviewed-on: https://code.wireshark.org/review/30592
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-11-13 03:38:58 +00:00
Guy Harris 2c09e87c71 Get rid of the radiotap tap.
1) it doesn't supply any information not supplied by the new
"wlan_radio" tap and, in fact, supplies less information (including not
supplying any presence flags);

2) it only works for radiotap headers, not for any other forms of radio
metadata;

3) its data structure wasn't declared in a header available to any
listeners, it was defined internally to the radiotap dissector.

Change-Id: Ie84a48bbf204b8b3bb40370c17ca82d39e5df3fb
Reviewed-on: https://code.wireshark.org/review/30415
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-10-30 06:54:29 +00:00
Guy Harris 6177f0eb42 The signal strength and noise in dB from an arbitrary reference are unsigned.
The radiotap spec says "dB antenna signal" and "dB antenna noise" are
unsigned.  Make it universally so.

Change-Id: Iea2c5360d7352ca5e84862ea338d1fc689272191
Reviewed-on: https://code.wireshark.org/review/30410
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-10-29 22:23:12 +00:00
Guy Harris 9867591633 Handle signal/noise in dB from an arbitrary point in the 802.11 radio dissector.
While we're at it, only set the RSSI column once - no need to do it at
the beginning and later when we're setting fields.

Change-Id: Ia729019e5e6dfbe1cdad61f1f8397b0a3a171996
Reviewed-on: https://code.wireshark.org/review/30405
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-10-29 18:49:15 +00:00
Richard Sharpe 7573f7dab4 radiotap: Correct support for 0-length PSDUs.
When there is no data, which is indicated by the 0-length PDSU radiotap header,
there is no more data to dissect, so don't dissect any more as that causes an
exception.

Change-Id: I284b8128ec309ba26f24a012380d311eb3e48697
Reviewed-on: https://code.wireshark.org/review/29529
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-09-10 07:33:57 +00:00
Jeff Morriss 98207eb612 Register some unregistered etts.
... Use of an unregistered ett leads to an abort.

Inspired by I3ee2f557ace1643dfba5a978add66c3c7ba7d895.  Some day I should get
the ett_ registration checking code in checkAPIs ready for prime time...

Change-Id: I69162d4bcec571e6a517a107ac365aa78bfe8d25
Reviewed-on: https://code.wireshark.org/review/29474
Petri-Dish: Jeff Morriss <jeff.morriss.ws@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-09-08 07:07:45 +00:00
Richard Sharpe 5633195550 radiotap: Implement L-SIG support based on the RFC.
The RFC was posted in the Radiotap mailing list.

Change-Id: I8ddb1cd474d05c94d1b5a51eb5e16d548a313a86
Reviewed-on: https://code.wireshark.org/review/28923
Petri-Dish: Richard Sharpe <realrichardsharpe@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Richard Sharpe <realrichardsharpe@gmail.com>
2018-08-13 14:19:56 +00:00
Guy Harris 5e2e9de930 Pass zero-length PSDU type information to the radio dissector.
We call that dissector even for zero-length PSDUs, so the radio
information is shown.  We also show the zero-length PSDU type.

We don't call the 802.11 dissector for zero-length PSDU frames.

That way, you don't have to open up the radiotap information to find out
about zero-length PSDU frames, we can support zero-length PSDU
information for other pseudo-headers and file types if they support it,
and taps using the radio information can get zero-length PSDU frame
information.

Change-Id: I7d5da4ea978d8ca4889fc76160f11e3416b4d036
Reviewed-on: https://code.wireshark.org/review/29034
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-08-09 02:26:17 +00:00
Guy Harris 63126e284b Always process the "present flags" bitmaps.
The loop doesn't just add them to the protocol tree, it also does sanity
checking; we want to do the sanity checking regardless of whether we're
building the protocol tree or not, so that if we skip processing the
radiotap header because it's malformed, we do so regardless of whether
we're building a protocol tree.

This prevents a crash I saw where, on the first pass, we weren't
building a protocol tree, so we didn't check the bitmaps and proceeded
to process the bad radiotap header in a fuzzed file and set the
"zero-length PSDU" flag, and didn't call the 802.11 radio dissector, and
didn't allocate a "wlan radio information" structure and attach it to
the packet, but, when I went to the packet, and thus *did* build a
protocol tree, we *did* check the bitmaps in the process of adding them
to the protocol tree, skipped the part where we processed the rest of
the radiotap header, *didn't* set the "zero-length PSDU" flag, and
*did* call the 802.11 radio dissector, which crashed becaus the "wlan
radio information" pointer was null.

(No, checking the "wlan radio information" pointer isn't the correct
fix; the correct fix is to make sure we do the same processing, other
than adding items to the protocol tree, *regardless* of whether we're
building the protocol tree.)

Change-Id: If3c16f76981448e4f396a4a9730f1d5dce8f8eba
Reviewed-on: https://code.wireshark.org/review/29033
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-08-09 01:17:28 +00:00
Guy Harris f4bc40bc3b The radiotap header length must be >= 8.
Report an error and quit dissecting if it's less than 8.

Change-Id: I297fcb0ca754641a9e197037df1140361000fd25
Reviewed-on: https://code.wireshark.org/review/29022
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-08-08 20:07:52 +00:00
Pascal Quantin d4de509cb8 802.11 Radiotap: add a missing subtree initialization
Change-Id: I3481098f81ec6445c777e126fd8a7ff1b0ad1a80
Ping-Bug: 15022
Reviewed-on: https://code.wireshark.org/review/29015
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2018-08-08 15:06:01 +00:00
Richard Sharpe d4de56c676 radiotap: Add support for 0-length PSDUs.
Change-Id: I386c6cd84a74eda5dff32fb93b0a35eb54bc6b4b
Reviewed-on: https://code.wireshark.org/review/28884
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-08-01 05:46:22 +00:00
Alexis La Goutte 013ab2a5ff radiotap: fix indent (use tab)
Change-Id: I9fc2320ecd760f2be92b53d57fe1e12152edf198
Reviewed-on: https://code.wireshark.org/review/28890
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Richard Sharpe <realrichardsharpe@gmail.com>
Tested-by: Petri Dish Buildbot
2018-07-31 15:47:18 +00:00
Guy Harris 8a0cbd49ad Add a preference to override the radiotap FCS bit.
This is separate from the 802.11 preference, which only affects packets
where no file or packet metadata indicates whether there is an FCS (yes,
that is intentional behavior).  This is specifically for radiotap, in
case some driver fails to set the FCS bit correctly (this is currently
an issue with Npcap, which currently assumes that the packet has an FCS
iff NDIS indicated the packet with the DOT11_RECV_FLAG_RAW_PACKET flag;
that doesn't appear to be a reliable indicator, and it's not clear there
*is* a reliable indicator, so Npcap might have to fall back on something
really gross like a quirks database for particular adapters).

Change-Id: Ia3b134d89004307442d42cfa5ed3cf8fb938235f
Ping-Bug: 15010
Reviewed-on: https://code.wireshark.org/review/28855
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-07-26 01:09:57 +00:00