From Jouni Malinen: preliminary version of Wi-Fi P2P (Wi-Fi Direct) dissector.

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5196

From me: Add packet-wifi-p2p.h to Makefile.common DISSECTOR_INCLUDES
         Add dissectors/packet-wifi-p2p.c to epan/CMakelists.txt

svn path=/trunk/; revision=34642
This commit is contained in:
Bill Meier 2010-10-25 16:40:45 +00:00
parent 36390c306f
commit a8de0b1f76
7 changed files with 1597 additions and 1 deletions

View File

@ -1256,6 +1256,8 @@ Jouni Malinen <jkmaline[AT]cc.hut.fi> {
EAP-MD5, EAP-SIM, EAP-PEAP, and EAP-MSCHAPv2 support
802.11g element support
802.11i enhancements
New WSC 2.0 attributes and values support
Wi-Fi Alliance P2P dissector
}
Paul E. Erkkila <pee[AT]erkkila.org> {

View File

@ -1042,6 +1042,7 @@ set(DISSECTOR_SRC
dissectors/packet-wcp.c
dissectors/packet-wfleet-hdlc.c
dissectors/packet-who.c
dissectors/packet-wifi-p2p.c
dissectors/packet-windows-common.c
dissectors/packet-winsrepl.c
dissectors/packet-wlccp.c

View File

@ -952,6 +952,7 @@ DISSECTOR_SRC = \
packet-wcp.c \
packet-wfleet-hdlc.c \
packet-who.c \
packet-wifi-p2p.c \
packet-windows-common.c \
packet-winsrepl.c \
packet-wlccp.c \
@ -1295,6 +1296,7 @@ DISSECTOR_INCLUDES = \
packet-vlan.h \
packet-wap.h \
packet-wccp.h \
packet-wifi-p2p.h \
packet-windows-common.h \
packet-wlancertextn.h \
packet-wps.h \

View File

@ -88,6 +88,7 @@
#include "isprint.h"
#include "packet-wps.h"
#include "packet-wifi-p2p.h"
#ifndef roundup2
#define roundup2(x, y) (((x)+((y)-1))&(~((y)-1))) /* if y is powers of two */
@ -648,6 +649,10 @@ static const value_string tag_num_vals[] = {
#define RSN_OUI (const guint8 *) "\x00\x0F\xAC"
#define WME_OUI (const guint8 *) "\x00\x50\xF2"
#define PRE_11N_OUI (const guint8 *) "\x00\x90\x4c" /* 802.11n pre 1 oui */
#define WFA_OUI (const guint8 *) "\x50\x6f\x9a"
/* WFA vendor specific subtypes */
#define WFA_SUBTYPE_P2P 9
#define PMKID_LEN 16
@ -2668,13 +2673,14 @@ dissect_advertisement_protocol(packet_info *pinfo, proto_tree *tree,
static void
dissect_anqp(proto_tree *tree, tvbuff_t *tvb, int offset, gboolean request)
{
guint16 len;
guint16 id, len;
proto_tree_add_text(tree, tvb, offset, 4,
request ? "Access Network Query Protocol Request" :
"Access Network Query Protocol Response");
proto_tree_add_item(tree, hf_ieee80211_ff_anqp_info_id,
tvb, offset, 2, TRUE);
id = tvb_get_letohs(tvb, offset);
offset += 2;
proto_tree_add_item(tree, hf_ieee80211_ff_anqp_info_length,
tvb, offset, 2, TRUE);
@ -2682,6 +2688,31 @@ dissect_anqp(proto_tree *tree, tvbuff_t *tvb, int offset, gboolean request)
offset += 2;
proto_tree_add_item(tree, hf_ieee80211_ff_anqp_info,
tvb, offset, len, FALSE);
if (id == 56797) {
/* ANQP vendor-specific list */
guint32 oui;
guint8 subtype;
const guint8 *tag_data_ptr;
oui = tvb_get_ntoh24(tvb, offset);
tag_data_ptr = tvb_get_ptr(tvb, offset, 3);
proto_tree_add_bytes_format(tree, tag_oui, tvb, offset, 3,
tag_data_ptr, "Vendor: %s",
get_manuf_name(tag_data_ptr));
offset += 3;
switch (oui) {
case OUI_WFA:
subtype = tvb_get_guint8(tvb, offset);
if (subtype == WFA_SUBTYPE_P2P) {
proto_tree_add_text(tree, tvb, offset, 1, "Subtype %u: P2P ANQP",
subtype);
dissect_wifi_p2p_anqp(g_pinfo, tree, tvb, offset + 1, request);
} else {
proto_tree_add_text(tree, tvb, offset, 1, "Subtype %u", subtype);
}
}
}
}
static guint
@ -3557,6 +3588,7 @@ add_fixed_field(proto_tree * tree, tvbuff_t * tvb, int offset, int lfcode)
guint32 oui;
const guint8 *tag_data_ptr;
guint8 code;
guint8 subtype;
offset += add_fixed_field(action_tree, tvb, offset, FIELD_CATEGORY_CODE);
code = tvb_get_guint8(tvb, offset);
@ -3572,6 +3604,15 @@ add_fixed_field(proto_tree * tree, tvbuff_t * tvb, int offset, int lfcode)
offset += 3;
switch (oui)
{
case OUI_WFA:
subtype = tvb_get_guint8(tvb, offset);
proto_tree_add_text(action_tree, tvb, offset, 1,
"Subtype %u", subtype);
offset++;
if (subtype == WFA_SUBTYPE_P2P)
offset = dissect_wifi_p2p_public_action(action_tree,
tvb, offset);
break;
default:
/* Don't know how to handle this vendor */
break;
@ -3789,6 +3830,7 @@ add_fixed_field(proto_tree * tree, tvbuff_t * tvb, int offset, int lfcode)
guint start = offset;
guint32 oui;
const guint8 *tag_data_ptr;
guint8 subtype;
offset += add_fixed_field(action_tree, tvb, offset, FIELD_CATEGORY_CODE);
oui = tvb_get_ntoh24(tvb, offset);
@ -3801,6 +3843,15 @@ add_fixed_field(proto_tree * tree, tvbuff_t * tvb, int offset, int lfcode)
case OUI_MARVELL:
offset = dissect_vendor_action_marvell (action_tree, tvb, offset);
break;
case OUI_WFA:
subtype = tvb_get_guint8(tvb, offset);
proto_tree_add_text(action_tree, tvb, offset, 1,
"Subtype %u", subtype);
offset++;
if (subtype == WFA_SUBTYPE_P2P)
offset = dissect_wifi_p2p_action(action_tree, tvb,
offset);
break;
default:
/* Don't know how to handle this vendor */
break;
@ -4175,6 +4226,22 @@ dissect_vendor_ie_wpawme(proto_item * item, proto_tree * tree, tvbuff_t * tag_tv
}
}
static void
dissect_vendor_ie_wfa(packet_info *pinfo, proto_item *item, tvbuff_t *tag_tvb)
{
gint tag_len = tvb_length(tag_tvb);
if (tag_len < 4)
return;
switch (tvb_get_guint8(tag_tvb, 3)) {
case WFA_SUBTYPE_P2P:
dissect_wifi_p2p_ie(pinfo, item, tag_tvb, 4, tag_len - 4);
proto_item_append_text(item, ": P2P");
break;
}
}
static void
dissect_vendor_ie_rsn(proto_item * item, proto_tree * tree, tvbuff_t * tag_tvb)
{
@ -5855,6 +5922,9 @@ add_tagged_field (packet_info * pinfo, proto_tree * tree, tvbuff_t * tvb, int of
case OUI_MARVELL:
dissect_vendor_ie_marvell(ti, tree, tvb, offset + 5, tag_len - 3);
break;
case OUI_WFA:
dissect_vendor_ie_wfa(pinfo, ti, tag_tvb);
break;
default:
proto_tree_add_string (tree, tag_interpretation, tvb, offset + 5,
tag_len - 3, "Not interpreted");

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,36 @@
/* packet-wifi-p2p.h
*
* Wi-Fi P2P
*
* Copyright 2009-2010 Atheros Communications
*
* $Id$
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#ifndef _packet_wifi_p2p_h_
#define _packet_wifi_p2p_h_
void dissect_wifi_p2p_ie(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb,
int offset, gint size);
int dissect_wifi_p2p_public_action(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);
#endif

View File

@ -71,6 +71,7 @@
#define OUI_APPLE_ATALK 0x080007 /* Appletalk */
#define OUI_HP 0x080009 /* Hewlett-Packard */
#define OUI_HP_2 0x00805F /* Hewlett-Packard */
#define OUI_WFA 0x506F9A /* Wi-Fi Alliance */
#define OUI_3GPP2 0xCF0002 /* 3GPP2 */
/*