802.11: Correctly handle Wi-Fi Alliance Multi-AP subtype decoding.
authorRichard Sharpe <realrichardsharpe@gmail.com>
Thu, 9 Nov 2017 10:44:36 +0000 (02:44 -0800)
committerAnders Broman <a.broman58@gmail.com>
Thu, 9 Nov 2017 12:06:35 +0000 (12:06 +0000)
Introduce a dissector table and fix a bug so that it now works
by calling through a dissector table.

Change-Id: Ifa3f01b3f306101b3144604a51806eaccc436373
Reviewed-on: https://code.wireshark.org/review/24319
Petri-Dish: Richard Sharpe <realrichardsharpe@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
epan/dissectors/packet-ieee80211.c
epan/dissectors/packet-ieee80211.h
epan/dissectors/packet-wps.c

index a5ad41aa5a78466c6413920d92b973f9a5ac7ff2..1ac7162008f7d22a350b39e2a3608d14799bc34d 100644 (file)
@@ -721,6 +721,7 @@ static const value_string wfa_subtype_vals[] = {
   { WFA_SUBTYPE_HS20_INDICATION, "Hotspot 2.0 Indication" },
   { WFA_SUBTYPE_HS20_ANQP, "Hotspot 2.0 ANQP" },
   { WFA_SUBTYPE_DPP, "Device Provisioning Protocol" },
+  { WFA_SUBTYPE_IEEE1905_MULTI_AP, "IEEE1905 Multi-AP" },
   { 0, NULL }
 };
 
@@ -10610,7 +10611,7 @@ dissect_vendor_ie_wfa(packet_info *pinfo, proto_item *item, tvbuff_t *tag_tvb)
 
   subtype = tvb_get_guint8(tag_tvb, 3);
   proto_item_append_text(item, ": %s", val_to_str_const(subtype, wfa_subtype_vals, "Unknown"));
-  vendor_tvb = tvb_new_subset_length(tag_tvb, offset, tag_len - 4);
+  vendor_tvb = tvb_new_subset_length(tag_tvb, offset + 4, tag_len - 4);
   dissector_try_uint_new(wifi_alliance_ie_table, subtype, vendor_tvb, pinfo, item, FALSE, NULL);
 }
 
@@ -28830,7 +28831,6 @@ proto_reg_handoff_ieee80211(void)
   dissector_add_uint("wlan.anqp.vendor_specific", OUI_WFA, create_dissector_handle(dissect_vendor_wifi_alliance_anqp, -1));
   dissector_add_uint("wlan.anqp.wifi_alliance.subtype", WFA_SUBTYPE_HS20_ANQP, create_dissector_handle(dissect_hs20_anqp, -1));
   dissector_add_uint("wlan.ie.wifi_alliance.subtype", WFA_SUBTYPE_HS20_INDICATION, create_dissector_handle(dissect_hs20_indication, -1));
-
 }
 
 /*
index 9eae85442c1f24601599b2083aee79c601cb9961..e899e82c5f8253201874337e2587dea57f819831 100644 (file)
@@ -278,12 +278,12 @@ typedef struct anqp_info_dissector_data {
 } anqp_info_dissector_data_t;
 
 /* WFA vendor specific subtypes */
-#define WFA_SUBTYPE_P2P 9
-#define WFA_SUBTYPE_WIFI_DISPLAY 10
-#define WFA_SUBTYPE_HS20_INDICATION 16
-#define WFA_SUBTYPE_HS20_ANQP 17
-#define WFA_SUBTYPE_DPP 26
-
+#define WFA_SUBTYPE_P2P                9
+#define WFA_SUBTYPE_WIFI_DISPLAY      10
+#define WFA_SUBTYPE_HS20_INDICATION   16
+#define WFA_SUBTYPE_HS20_ANQP         17
+#define WFA_SUBTYPE_DPP               26
+#define WFA_SUBTYPE_IEEE1905_MULTI_AP 27 /* ox1B */
 
 /*
  * Editor modelines
index 107473d7980ca4f35aa0be0dd419d77e872dab5c..d4c6bdc96b31f622d1f300da765c46a4cc236813 100644 (file)
@@ -39,6 +39,7 @@
 #include <epan/sminmpec.h>
 
 #include "packet-wps.h"
+#include "packet-ieee80211.h"
 
 void proto_register_wps(void);
 
@@ -880,6 +881,17 @@ dissect_wps_wfa_ext(proto_tree *tree, tvbuff_t *tvb,
   }
 }
 
+static int
+dissect_wps_wfa_ext_via_dt(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
+        void *data _U_)
+{
+  gint size = tvb_reported_length(tvb);
+
+  dissect_wps_wfa_ext(tree, tvb, 0, size);
+
+  return size;
+}
+
 static void
 dissect_wps_vendor_ext(proto_tree *tree, tvbuff_t *tvb,
                        int offset, gint size)
@@ -2540,6 +2552,12 @@ proto_register_wps(void)
   expert_register_field_array(expert_wps, ei, array_length(ei));
 }
 
+void
+proto_reg_handoff_wps(void)
+{
+  dissector_add_uint("wlan.ie.wifi_alliance.subtype", WFA_SUBTYPE_IEEE1905_MULTI_AP, create_dissector_handle(dissect_wps_wfa_ext_via_dt, -1));
+}
+
 /*
  * Editor modelines
  *