forked from osmocom/wireshark
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>
This commit is contained in:
parent
940775b948
commit
d4de56c676
|
@ -197,6 +197,8 @@ enum ieee80211_radiotap_type {
|
|||
IEEE80211_RADIOTAP_TIMESTAMP = 22,
|
||||
IEEE80211_RADIOTAP_HE = 23,
|
||||
IEEE80211_RADIOTAP_HE_MU = 24,
|
||||
IEEE80211_RAFIOTAP_HE_MU_USER = 25,
|
||||
IEEE80211_RADIOTAP_0_LENGTH_PSDU = 26,
|
||||
|
||||
/* valid in every it_present bitmap, even vendor namespaces */
|
||||
IEEE80211_RADIOTAP_RADIOTAP_NAMESPACE = 29,
|
||||
|
@ -205,8 +207,8 @@ enum ieee80211_radiotap_type {
|
|||
};
|
||||
|
||||
/* not (yet) defined Radiotap present flag */
|
||||
/* Bit 24 to 28 are not defined (in binary : 0001 1111 0000 0000 0000 0000 0000 0000 */
|
||||
#define IEEE80211_RADIOTAP_NOTDEFINED 0x1E000000
|
||||
/* Bit 25, 27, 28 are not defined (in binary : 0001 1010 0000 0000 0000 0000 0000 0000 */
|
||||
#define IEEE80211_RADIOTAP_NOTDEFINED 0x1A000000
|
||||
|
||||
/* Channel flags. */
|
||||
/* 0x00000001 through 0x00000008 undefined (reserved?) */
|
||||
|
|
|
@ -49,7 +49,8 @@ static const struct radiotap_align_size rtap_namespace_sizes[] = {
|
|||
/* [IEEE80211_RADIOTAP_TIMESTAMP] = 22 */ { 8, 12 },
|
||||
/* [IEEE80211_RADIOTAP_HE] = 23 */ { 2, 12 },
|
||||
/* [IEEE80211_RADIOTAP_HE_MU] = 24 */ { 2, 8 },
|
||||
|
||||
/* [IEEE80211_RADIOTAP_HE_MU_USER = 25 notdef */ { 0, 0 },
|
||||
/* [IEEE80211_RADIOTAP_0_LENGTH_PSDU = 26 */ { 1, 1 },
|
||||
/*
|
||||
* add more here as they are defined in
|
||||
* include/net/ieee80211_radiotap.h
|
||||
|
|
|
@ -179,6 +179,7 @@ static int hf_radiotap_present_vht = -1;
|
|||
static int hf_radiotap_present_timestamp = -1;
|
||||
static int hf_radiotap_present_he = -1;
|
||||
static int hf_radiotap_present_he_mu = -1;
|
||||
static int hf_radiotap_present_0_length_psdu = -1;
|
||||
static int hf_radiotap_present_reserved = -1;
|
||||
static int hf_radiotap_present_rtap_ns = -1;
|
||||
static int hf_radiotap_present_vendor_ns = -1;
|
||||
|
@ -320,6 +321,9 @@ static int hf_radiotap_he_mu_ru_2_unknown = -1;
|
|||
static int hf_radiotap_he_mu_ru_3 = -1;
|
||||
static int hf_radiotap_he_mu_ru_3_unknown = -1;
|
||||
|
||||
/* 0-length-psdu */
|
||||
static int hf_radiotap_0_length_psdu_type = -1;
|
||||
|
||||
static gint ett_radiotap = -1;
|
||||
static gint ett_radiotap_present = -1;
|
||||
static gint ett_radiotap_present_word = -1;
|
||||
|
@ -347,6 +351,7 @@ static gint ett_radiotap_he_info_data_6 = -1;
|
|||
static gint ett_radiotap_he_mu_info = -1;
|
||||
static gint ett_radiotap_he_mu_info_flags_1 = -1;
|
||||
static gint ett_radiotap_he_mu_info_flags_2 = -1;
|
||||
static gint ett_radiotap_0_length_psdu = -1;
|
||||
|
||||
static expert_field ei_radiotap_data_past_header = EI_INIT;
|
||||
static expert_field ei_radiotap_present_reserved = EI_INIT;
|
||||
|
@ -1315,6 +1320,26 @@ dissect_radiotap_he_mu_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *t
|
|||
tvb, offset, 1, ENC_NA);
|
||||
}
|
||||
|
||||
static const range_string zero_length_psdu_rsvals[] = {
|
||||
{ 0, 0, "sounding PPDU" },
|
||||
{ 1, 254, "reserved" },
|
||||
{ 255, 255, "vendor-specific" },
|
||||
{ 0, 0, NULL }
|
||||
};
|
||||
|
||||
static void
|
||||
dissect_radiotap_0_length_psdu(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
|
||||
int offset)
|
||||
{
|
||||
proto_tree *zero_len_tree = NULL;
|
||||
|
||||
zero_len_tree = proto_tree_add_subtree(tree, tvb, offset, 1,
|
||||
ett_radiotap_0_length_psdu, NULL, "0-length PSDU");
|
||||
|
||||
proto_tree_add_item(zero_len_tree, hf_radiotap_0_length_psdu_type,
|
||||
tvb, offset, 1, ENC_NA);
|
||||
}
|
||||
|
||||
static void
|
||||
dissect_radiotap_tsft(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
|
||||
int offset, struct _radiotap_info *radiotap_info,
|
||||
|
@ -1840,6 +1865,7 @@ dissect_radiotap(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* u
|
|||
static struct _radiotap_info rtp_info_arr;
|
||||
struct ieee80211_radiotap_iterator iter;
|
||||
struct ieee_802_11_phdr phdr;
|
||||
gboolean zero_length_psdu = FALSE;
|
||||
|
||||
/* our non-standard overrides */
|
||||
static struct radiotap_override overrides[] = {
|
||||
|
@ -2032,6 +2058,9 @@ dissect_radiotap(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* u
|
|||
proto_tree_add_item(present_word_tree,
|
||||
hf_radiotap_present_he_mu, tvb,
|
||||
offset + 4, 4, ENC_LITTLE_ENDIAN);
|
||||
proto_tree_add_item(present_word_tree,
|
||||
hf_radiotap_present_0_length_psdu,
|
||||
tvb, offset + 4, 4, ENC_LITTLE_ENDIAN);
|
||||
|
||||
ti = proto_tree_add_item(present_word_tree,
|
||||
hf_radiotap_present_reserved, tvb,
|
||||
|
@ -2627,6 +2656,10 @@ dissect_radiotap(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* u
|
|||
case IEEE80211_RADIOTAP_HE_MU:
|
||||
dissect_radiotap_he_mu_info(tvb, pinfo, radiotap_tree, offset);
|
||||
break;
|
||||
case IEEE80211_RADIOTAP_0_LENGTH_PSDU:
|
||||
dissect_radiotap_0_length_psdu(tvb, pinfo, radiotap_tree, offset);
|
||||
zero_length_psdu = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2637,6 +2670,13 @@ dissect_radiotap(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* u
|
|||
proto_item_append_text(ti, " (malformed)");
|
||||
}
|
||||
|
||||
/*
|
||||
* Is there anything there? A 0-length-psdu has no frame data.
|
||||
*/
|
||||
if (zero_length_psdu) {
|
||||
return tvb_captured_length(tvb);
|
||||
}
|
||||
|
||||
hand_off_to_80211:
|
||||
/* Grab the rest of the frame. */
|
||||
next_tvb = tvb_new_subset_remaining(tvb, length);
|
||||
|
@ -2836,6 +2876,11 @@ void proto_register_radiotap(void)
|
|||
FT_BOOLEAN, 32, TFS(&tfs_present_absent), RADIOTAP_MASK(HE_MU),
|
||||
"Specifies if the HE field is present", HFILL}},
|
||||
|
||||
{&hf_radiotap_present_0_length_psdu,
|
||||
{"0 Length PSDU", "radiotap.present.0_length.psdu",
|
||||
FT_BOOLEAN, 32, TFS(&tfs_present_absent), RADIOTAP_MASK(0_LENGTH_PSDU),
|
||||
"Specifies whether or not the 0-Length PSDU field is present", HFILL}},
|
||||
|
||||
{&hf_radiotap_present_reserved,
|
||||
{"Reserved", "radiotap.present.reserved",
|
||||
FT_UINT32, BASE_HEX, NULL, IEEE80211_RADIOTAP_NOTDEFINED,
|
||||
|
@ -4183,6 +4228,10 @@ void proto_register_radiotap(void)
|
|||
"radiotap.he_mu.ru_3_index_unknown",
|
||||
FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL}},
|
||||
|
||||
{&hf_radiotap_0_length_psdu_type,
|
||||
{"Type", "radiotap.0_len_psdu.type",
|
||||
FT_UINT8, BASE_HEX|BASE_RANGE_STRING,
|
||||
RVALS(zero_length_psdu_rsvals), 0x0, NULL, HFILL}},
|
||||
};
|
||||
static gint *ett[] = {
|
||||
&ett_radiotap,
|
||||
|
|
Loading…
Reference in New Issue