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>
This commit is contained in:
Mathy Vanhoef 2020-07-14 05:58:34 +04:00 committed by Anders Broman
parent 79e43ef98d
commit e43e6e6897
2 changed files with 84 additions and 1 deletions

View File

@ -281,7 +281,12 @@ struct ieee80211_radiotap_tlv {
* retries */
#define IEEE80211_RADIOTAP_F_TX_CTS 0x0002 /* used cts 'protection' */
#define IEEE80211_RADIOTAP_F_TX_RTS 0x0004 /* used rts/cts handshake */
#define IEEE80211_RADIOTAP_F_TX_NOACK 0x0008 /* don't expect ACK */
#define IEEE80211_RADIOTAP_F_TX_NOSEQNO 0x0010 /* don't overwrite sequence
* number */
#define IEEE80211_RADIOTAP_F_TX_ORDER 0x0020 /* don't reorder injected
* frames relative to other
* frames with this flag */
/* For IEEE80211_RADIOTAP_MCS */
#define IEEE80211_RADIOTAP_MCS_HAVE_BW 0x01

View File

@ -62,6 +62,13 @@ static int hf_radiotap_channel_flags_half = -1;
static int hf_radiotap_channel_flags_quarter = -1;
static int hf_radiotap_rxflags = -1;
static int hf_radiotap_rxflags_badplcp = -1;
static int hf_radiotap_txflags = -1;
static int hf_radiotap_txflags_fail = -1;
static int hf_radiotap_txflags_cts = -1;
static int hf_radiotap_txflags_rts = -1;
static int hf_radiotap_txflags_noack = -1;
static int hf_radiotap_txflags_noseqno = -1;
static int hf_radiotap_txflags_order = -1;
static int hf_radiotap_xchannel_channel = -1;
static int hf_radiotap_xchannel_frequency = -1;
static int hf_radiotap_xchannel_flags = -1;
@ -180,6 +187,7 @@ static int hf_radiotap_present_db_antsignal = -1;
static int hf_radiotap_present_db_antnoise = -1;
static int hf_radiotap_present_hdrfcs = -1;
static int hf_radiotap_present_rxflags = -1;
static int hf_radiotap_present_txflags = -1;
static int hf_radiotap_present_xchannel = -1;
static int hf_radiotap_present_mcs = -1;
static int hf_radiotap_present_ampdu = -1;
@ -361,6 +369,7 @@ static gint ett_radiotap_present = -1;
static gint ett_radiotap_present_word = -1;
static gint ett_radiotap_flags = -1;
static gint ett_radiotap_rxflags = -1;
static gint ett_radiotap_txflags = -1;
static gint ett_radiotap_channel_flags = -1;
static gint ett_radiotap_xchannel_flags = -1;
static gint ett_radiotap_vendor = -1;
@ -1944,6 +1953,26 @@ dissect_radiotap_rx_flags(tvbuff_t *tvb, packet_info *pinfo _U_,
}
}
static void
dissect_radiotap_tx_flags(tvbuff_t *tvb, packet_info *pinfo _U_,
proto_tree *tree, int offset)
{
static int * const txflags[] = {
&hf_radiotap_txflags_fail,
&hf_radiotap_txflags_cts,
&hf_radiotap_txflags_rts,
&hf_radiotap_txflags_noack,
&hf_radiotap_txflags_noseqno,
&hf_radiotap_txflags_order,
NULL
};
proto_tree_add_bitmask(tree, tvb, offset,
hf_radiotap_txflags, ett_radiotap_txflags,
txflags, ENC_LITTLE_ENDIAN);
}
static void
dissect_radiotap_xchannel(tvbuff_t *tvb, packet_info *pinfo _U_,
proto_tree *tree, int offset, guint8 rflags, gboolean have_rflags,
@ -2346,6 +2375,9 @@ dissect_radiotap(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* u
hf_radiotap_present_rxflags,
tvb, offset + 4, 4, ENC_LITTLE_ENDIAN);
}
proto_tree_add_item(present_word_tree,
hf_radiotap_present_txflags, tvb,
offset + 4, 4, ENC_LITTLE_ENDIAN);
proto_tree_add_item(present_word_tree,
hf_radiotap_present_xchannel, tvb,
offset + 4, 4, ENC_LITTLE_ENDIAN);
@ -2538,6 +2570,11 @@ dissect_radiotap(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* u
&hdr_fcs_offset, &sent_fcs);
break;
case IEEE80211_RADIOTAP_TX_FLAGS:
dissect_radiotap_tx_flags(tvb, pinfo, item_tree,
offset);
break;
case IEEE80211_RADIOTAP_XCHANNEL:
dissect_radiotap_xchannel(tvb, pinfo, item_tree,
offset, rflags, have_rflags,
@ -3197,6 +3234,11 @@ void proto_register_radiotap(void)
FT_BOOLEAN, 32, TFS(&tfs_present_absent), RADIOTAP_MASK(RX_FLAGS),
"Specifies if the RX flags field is present", HFILL}},
{&hf_radiotap_present_txflags,
{"TX flags", "radiotap.present.txflags",
FT_BOOLEAN, 32, TFS(&tfs_present_absent), RADIOTAP_MASK(TX_FLAGS),
"Specifies if the TX flags field is present", HFILL}},
{&hf_radiotap_present_hdrfcs,
{"FCS in header", "radiotap.present.fcs",
FT_BOOLEAN, 32, TFS(&tfs_present_absent), RADIOTAP_MASK(RX_FLAGS),
@ -3414,6 +3456,41 @@ void proto_register_radiotap(void)
FT_BOOLEAN, 24, NULL, IEEE80211_RADIOTAP_F_RX_BADPLCP,
"Frame with bad PLCP", HFILL}},
{&hf_radiotap_txflags,
{"TX flags", "radiotap.txflags",
FT_UINT16, BASE_HEX, NULL, 0x0,
NULL, HFILL}},
{&hf_radiotap_txflags_fail,
{"Fail", "radiotap.rxflags.fail",
FT_BOOLEAN, 24, NULL, IEEE80211_RADIOTAP_F_TX_FAIL,
"Transmission failed due to excessive retries", HFILL}},
{&hf_radiotap_txflags_cts,
{"CTS", "radiotap.rxflags.cts",
FT_BOOLEAN, 24, NULL, IEEE80211_RADIOTAP_F_TX_CTS,
"Transmission used CTS-to-self protection", HFILL}},
{&hf_radiotap_txflags_rts,
{"RTS/CTS", "radiotap.rxflags.rts",
FT_BOOLEAN, 24, NULL, IEEE80211_RADIOTAP_F_TX_RTS,
"Transmission used RTS/CTS handshake", HFILL}},
{&hf_radiotap_txflags_noack,
{"No ACK", "radiotap.rxflags.noack",
FT_BOOLEAN, 24, NULL, IEEE80211_RADIOTAP_F_TX_NOACK,
"Transmission shall not expect an ACK frame", HFILL}},
{&hf_radiotap_txflags_noseqno,
{"Has Seqnum", "radiotap.rxflags.noseqno",
FT_BOOLEAN, 24, NULL, IEEE80211_RADIOTAP_F_TX_NOSEQNO,
"Frame includes a pre-configured sequence number", HFILL}},
{&hf_radiotap_txflags_order,
{"Order", "radiotap.rxflags.order",
FT_BOOLEAN, 24, NULL, IEEE80211_RADIOTAP_F_TX_ORDER,
"Frame must not be reordered relative to others with this flag", HFILL}},
{&hf_radiotap_xchannel_channel,
{"Channel number", "radiotap.xchannel.channel",
FT_UINT32, BASE_DEC, NULL, 0x0,
@ -4716,6 +4793,7 @@ void proto_register_radiotap(void)
&ett_radiotap_present_word,
&ett_radiotap_flags,
&ett_radiotap_rxflags,
&ett_radiotap_txflags,
&ett_radiotap_channel_flags,
&ett_radiotap_xchannel_flags,
&ett_radiotap_vendor,