aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2017-08-13 13:50:58 -0400
committerRichard Sharpe <realrichardsharpe@gmail.com>2017-08-14 04:36:57 +0000
commit329cccfc7b3adabbcd961cc328609f23058e5a12 (patch)
treecd70fc3aab097339fb5e94b6d683f058f527796f
parent35a6a1396fa8b0a6fa094b39bccac7c1e81a7fd3 (diff)
packet-ieee80211.c: Add dissector table for vendor specific actions
Gives a little more flexibility for vendor implementations https://www.wireshark.org/lists/wireshark-dev/201708/msg00053.html https://ask.wireshark.org/questions/56816/ieee-80211-vendor-specific-action Change-Id: I0345e43140a8ac99b26932b72d08a99ca0036389 Reviewed-on: https://code.wireshark.org/review/23065 Petri-Dish: Michael Mann <mmann78@netscape.net> Reviewed-by: Richard Sharpe <realrichardsharpe@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
-rw-r--r--epan/dissectors/packet-ieee80211.c40
-rw-r--r--epan/dissectors/packet-ieee80211.h1
-rw-r--r--epan/dissectors/packet-wifi-p2p.c32
3 files changed, 50 insertions, 23 deletions
diff --git a/epan/dissectors/packet-ieee80211.c b/epan/dissectors/packet-ieee80211.c
index 55d6b30819..91e9803e16 100644
--- a/epan/dissectors/packet-ieee80211.c
+++ b/epan/dissectors/packet-ieee80211.c
@@ -5119,7 +5119,8 @@ static dissector_handle_t eth_withoutfcs_handle;
static capture_dissector_handle_t llc_cap_handle;
static capture_dissector_handle_t ipx_cap_handle;
-dissector_table_t tagged_field_table;
+static dissector_table_t tagged_field_table;
+static dissector_table_t vendor_specific_action_table;
static int wlan_tap = -1;
@@ -5760,9 +5761,10 @@ get_tagged_parameter_tree(proto_tree * tree, tvbuff_t *tvb, int start, int size)
static int
-dissect_vendor_action_marvell(proto_tree *tree, tvbuff_t *tvb, int offset)
+dissect_vendor_action_marvell(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
{
guint8 octet;
+ int offset = 0;
octet = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_ieee80211_ff_marvell_action_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
@@ -8486,29 +8488,26 @@ add_ff_action_vendor_specific(proto_tree *tree, tvbuff_t *tvb, packet_info *pinf
{
guint start = offset;
guint32 oui;
- guint8 subtype;
+ tvbuff_t *vendor_tvb;
+ int dissected;
offset += add_ff_category_code(tree, tvb, pinfo, offset);
oui = tvb_get_ntoh24(tvb, offset);
proto_tree_add_item(tree, hf_ieee80211_tag_oui, tvb, offset, 3, ENC_NA);
offset += 3;
- switch (oui) {
- case OUI_MARVELL:
- offset = dissect_vendor_action_marvell(tree, tvb, offset);
- break;
- case OUI_WFA:
- subtype = tvb_get_guint8(tvb, offset);
- proto_tree_add_item(tree, hf_ieee80211_tag_oui_wfa_subtype, tvb, offset, 1, ENC_NA);
- offset += 1;
- if (subtype == WFA_SUBTYPE_P2P) {
- offset = dissect_wifi_p2p_action(tree, tvb, offset);
- }
- break;
- default:
- /* Don't know how to handle this vendor */
- break;
+
+ vendor_tvb = tvb_new_subset_remaining(tvb, offset);
+ dissected = dissector_try_uint_new(vendor_specific_action_table, oui, vendor_tvb, pinfo, tree, FALSE, NULL);
+ if (dissected <= 0)
+ {
+ call_data_dissector(vendor_tvb, pinfo, tree);
+ /* don't advance the dissector pointer as this will probably cause more malformed packets
+ if vendor is unknown. It also matches previous behavior (before dissection table implementation) */
+ dissected = 0;
}
+ offset += dissected;
+
return offset - start; /* Size of fixed fields */
}
@@ -28131,6 +28130,7 @@ proto_register_ieee80211(void)
set_address(&bssid_broadcast, wlan_bssid_address_type, 6, bssid_broadcast_data);
tagged_field_table = register_dissector_table("wlan.tag.number", "IEEE 802.11 Fields", proto_wlan, FT_UINT8, BASE_DEC);
+ vendor_specific_action_table = register_dissector_table("wlan.action.vendor_specific", "IEEE802.11 Vendor Specific Action", proto_wlan, FT_UINT24, BASE_HEX);
/* Register configuration options */
wlan_module = prefs_register_protocol(proto_wlan, init_wepkeys);
@@ -28510,6 +28510,10 @@ proto_reg_handoff_ieee80211(void)
dissector_add_uint("wlan.tag.number", TAG_DMG_LINK_MARGIN, create_dissector_handle(ieee80211_tag_dmg_link_margin, -1));
dissector_add_uint("wlan.tag.number", TAG_DMG_LINK_ADAPTION_ACK, create_dissector_handle(ieee80211_tag_dmg_link_adaption_ack, -1));
dissector_add_uint("wlan.tag.number", TAG_SWITCHING_STREAM, create_dissector_handle(ieee80211_tag_switching_stream, -1));
+
+ /* Vendor specfic actions */
+ dissector_add_uint("wlan.action.vendor_specific", OUI_MARVELL, create_dissector_handle(dissect_vendor_action_marvell, -1));
+
}
/*
diff --git a/epan/dissectors/packet-ieee80211.h b/epan/dissectors/packet-ieee80211.h
index 3ad2c7e19a..1b77a8a0e7 100644
--- a/epan/dissectors/packet-ieee80211.h
+++ b/epan/dissectors/packet-ieee80211.h
@@ -52,7 +52,6 @@ void dissect_wifi_p2p_ie(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb,
int offset, gint size);
int dissect_wifi_p2p_public_action(packet_info *pinfo, proto_tree *tree,
tvbuff_t *tvb, int offset);
-int dissect_wifi_p2p_action(proto_tree *tree, tvbuff_t *tvb, int offset);
void dissect_wifi_p2p_anqp(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb,
int offset, gboolean request);
diff --git a/epan/dissectors/packet-wifi-p2p.c b/epan/dissectors/packet-wifi-p2p.c
index aeffb3d4dc..ee6cdfb0e6 100644
--- a/epan/dissectors/packet-wifi-p2p.c
+++ b/epan/dissectors/packet-wifi-p2p.c
@@ -24,10 +24,12 @@
#include <epan/packet.h>
#include <epan/to_str.h>
#include <epan/expert.h>
+#include <epan/oui.h>
#include "packet-ieee80211.h"
void proto_register_p2p(void);
+void proto_reg_handoff_p2p(void);
enum {
P2P_ATTR_STATUS = 0,
@@ -419,6 +421,7 @@ static int hf_p2p_anqp_query_data = -1;
static int hf_p2p_anqp_status_code = -1;
static int hf_p2p_anqp_response_data = -1;
+static int hf_p2p_wfa_subtype = -1;
static int hf_p2p_action_subtype = -1;
static int hf_p2p_action_dialog_token = -1;
static int hf_p2p_public_action_subtype = -1;
@@ -1190,12 +1193,23 @@ int dissect_wifi_p2p_public_action(packet_info *pinfo, proto_tree *tree,
return offset;
}
-int dissect_wifi_p2p_action(proto_tree *tree, tvbuff_t *tvb, int offset)
+static int
+dissect_wifi_p2p_action(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
{
- proto_tree_add_item(tree, hf_p2p_action_subtype, tvb, offset, 1, ENC_BIG_ENDIAN);
- offset++;
- proto_tree_add_item(tree, hf_p2p_action_dialog_token, tvb, offset, 1, ENC_BIG_ENDIAN);
+ int offset = 0;
+ guint32 subtype;
+
+ proto_tree_add_item_ret_uint(tree, hf_p2p_wfa_subtype, tvb, offset, 1, ENC_NA, &subtype);
offset++;
+
+ if (subtype == 9 /* WFA_SUBTYPE_P2P */ )
+ {
+ proto_tree_add_item(tree, hf_p2p_action_subtype, tvb, offset, 1, ENC_BIG_ENDIAN);
+ offset++;
+ proto_tree_add_item(tree, hf_p2p_action_dialog_token, tvb, offset, 1, ENC_BIG_ENDIAN);
+ offset++;
+ }
+
/* Followed by variable length IEs dissected by packet-ieee80211.c */
return offset;
}
@@ -1774,6 +1788,10 @@ proto_register_p2p(void)
{ "Response Data", "wifi_p2p.anqp.response_data",
FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
+ {&hf_p2p_wfa_subtype,
+ {"WFA Subtype", "wifi_p2p.wfa_subtype",
+ FT_UINT8, BASE_DEC, NULL, 0,
+ NULL, HFILL }},
{ &hf_p2p_action_subtype,
{ "P2P Action Subtype", "wifi_p2p.action.subtype",
FT_UINT8, BASE_DEC, VALS(p2p_action_subtypes), 0x0, NULL, HFILL }},
@@ -1813,6 +1831,12 @@ proto_register_p2p(void)
expert_register_field_array(expert_p2p, ei, array_length(ei));
}
+void
+proto_reg_handoff_p2p(void)
+{
+ dissector_add_uint("wlan.action.vendor_specific", OUI_WFA, create_dissector_handle(dissect_wifi_p2p_action, proto_p2p));
+}
+
/*
* Editor modelines
*