ieee80211 : Implement Wi-Fi DPP spec
Including attributes in Public Action frames and those that can appear in GAS frames. Change-Id: I8d2a717984295592952b8fff82879197ace2a4b2 Reviewed-on: https://code.wireshark.org/review/22615 Petri-Dish: Michael Mann <mmann78@netscape.net> Reviewed-by: Richard Sharpe <realrichardsharpe@gmail.com>
This commit is contained in:
parent
3c0ff67a9c
commit
d6eda2a3a3
|
@ -55,6 +55,7 @@ LoRaWAN
|
|||
ISOBUS
|
||||
AMT (Automatic Multicast Tunneling)
|
||||
QUIC (IETF)
|
||||
Wi-Fi Device Provisioning Protocol
|
||||
--sort-and-group--
|
||||
|
||||
=== Updated Protocol Support
|
||||
|
|
|
@ -1364,6 +1364,7 @@ set(DISSECTOR_SRC
|
|||
packet-wfleet-hdlc.c
|
||||
packet-who.c
|
||||
packet-whois.c
|
||||
packet-wifi-dpp.c
|
||||
packet-wifi-display.c
|
||||
packet-wifi-p2p.c
|
||||
packet-windows-common.c
|
||||
|
|
|
@ -1386,6 +1386,7 @@ DISSECTOR_SRC = \
|
|||
packet-wfleet-hdlc.c \
|
||||
packet-who.c \
|
||||
packet-whois.c \
|
||||
packet-wifi-dpp.c \
|
||||
packet-wifi-display.c \
|
||||
packet-wifi-p2p.c \
|
||||
packet-windows-common.c \
|
||||
|
|
|
@ -689,6 +689,14 @@ static const value_string wfa_subtype_vals[] = {
|
|||
{ WFA_SUBTYPE_P2P, "P2P" },
|
||||
{ WFA_SUBTYPE_HS20_INDICATION, "Hotspot 2.0 Indication" },
|
||||
{ WFA_SUBTYPE_HS20_ANQP, "Hotspot 2.0 ANQP" },
|
||||
{ WFA_SUBTYPE_DPP, "Device Provisioning Protocol" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
#define DPP_CONFIGURATION_PROTOCOL 0x01
|
||||
|
||||
static const value_string dpp_subtype_vals[] = {
|
||||
{ DPP_CONFIGURATION_PROTOCOL, "DPP Configuration Protocol" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
|
@ -4164,7 +4172,8 @@ static int hf_ieee80211_tag_qos_map_set_high = -1;
|
|||
static int hf_ieee80211_tag_adv_proto_resp_len_limit = -1;
|
||||
static int hf_ieee80211_tag_adv_proto_pame_bi = -1;
|
||||
static int hf_ieee80211_tag_adv_proto_id = -1;
|
||||
static int hf_ieee80211_tag_adv_proto_vs_info = -1;
|
||||
static int hf_ieee80211_tag_adv_vs_len = -1;
|
||||
/* static int hf_ieee80211_tag_adv_proto_vs_info = -1; */
|
||||
|
||||
/* IEEE Std 802.11u-2011 7.3.2.96 */
|
||||
static int hf_ieee80211_tag_roaming_consortium_num_anqp_oi = -1;
|
||||
|
@ -4506,6 +4515,8 @@ static int hf_ieee80211_data_encap_payload_type = -1;
|
|||
|
||||
static int hf_ieee80211_anqp_wfa_subtype = -1;
|
||||
|
||||
static int hf_ieee80211_dpp_subtype = -1;
|
||||
|
||||
/* Hotspot 2.0 */
|
||||
static int hf_hs20_indication_dgaf_disabled = -1;
|
||||
static int hf_hs20_indication_pps_mo_id_present = -1;
|
||||
|
@ -5876,16 +5887,19 @@ dissect_vendor_action_wifi_alliance(tvbuff_t *tvb, packet_info *pinfo, proto_tre
|
|||
|
||||
static guint
|
||||
dissect_advertisement_protocol_common(packet_info *pinfo, proto_tree *tree,
|
||||
tvbuff_t *tvb, int offset, gboolean *anqp)
|
||||
tvbuff_t *tvb, int offset, guint *type,
|
||||
guint *subtype)
|
||||
{
|
||||
guint8 tag_no, tag_len, left;
|
||||
proto_item *item = NULL, *adv_item;
|
||||
proto_tree *adv_tree, *adv_tuple_tree;
|
||||
|
||||
if (anqp)
|
||||
*anqp = FALSE;
|
||||
if (type)
|
||||
*type = 0xff; // Last reserved value
|
||||
if (subtype)
|
||||
*subtype = 0xff;
|
||||
tag_no = tvb_get_guint8(tvb, offset);
|
||||
if (anqp)
|
||||
if (type)
|
||||
item = proto_tree_add_item(tree, hf_ieee80211_tag_number, tvb, offset, 1, ENC_LITTLE_ENDIAN);
|
||||
|
||||
tag_len = tvb_get_guint8(tvb, offset + 1);
|
||||
|
@ -5895,10 +5909,10 @@ dissect_advertisement_protocol_common(packet_info *pinfo, proto_tree *tree,
|
|||
"Protocol)", tag_no);
|
||||
return 2 + tag_len;
|
||||
}
|
||||
if (anqp)
|
||||
if (type)
|
||||
item = proto_tree_add_uint(tree, hf_ieee80211_tag_length, tvb, offset + 1, 1, tag_len);
|
||||
if (tag_len < 2) {
|
||||
if (!anqp)
|
||||
if (!type)
|
||||
item = proto_tree_add_uint(tree, hf_ieee80211_tag_length, tvb, offset + 1, 1, tag_len);
|
||||
expert_add_info_format(pinfo, item, &ei_ieee80211_tag_length,
|
||||
"Advertisement Protocol: IE must be at least 2 "
|
||||
|
@ -5935,23 +5949,41 @@ dissect_advertisement_protocol_common(packet_info *pinfo, proto_tree *tree,
|
|||
offset += 1;
|
||||
left--;
|
||||
|
||||
if ((id == 0) && anqp)
|
||||
*anqp = TRUE;
|
||||
if ((id == 0) && type)
|
||||
*type = ADV_PROTO_ID_ANQP;
|
||||
|
||||
if (id == 221) {
|
||||
/* Vendor specific */
|
||||
guint8 len = tvb_get_guint8(tvb, offset);
|
||||
guint oui;
|
||||
guint8 wfa_subtype;
|
||||
proto_tree_add_item(adv_tuple_tree, hf_ieee80211_tag_adv_vs_len, tvb, offset, 1, ENC_NA);
|
||||
offset += 1;
|
||||
left -= 1;
|
||||
*type = ADV_PROTO_ID_VS;
|
||||
if (len > left) {
|
||||
expert_add_info_format(pinfo, item, &ei_ieee80211_tag_length,
|
||||
"Vendor specific info length error");
|
||||
return 2 + tag_len;
|
||||
}
|
||||
proto_tree_add_item(adv_tuple_tree, hf_ieee80211_tag_adv_proto_vs_info, tvb,
|
||||
offset, len, ENC_NA);
|
||||
offset += len;
|
||||
left -= len;
|
||||
oui = tvb_get_ntoh24(tvb, offset);
|
||||
proto_tree_add_item(adv_tuple_tree, hf_ieee80211_tag_oui, tvb, offset, 3, ENC_NA);
|
||||
offset += 3;
|
||||
left -= 3;
|
||||
wfa_subtype = tvb_get_guint8(tvb, offset);
|
||||
proto_tree_add_item(adv_tuple_tree, hf_ieee80211_anqp_wfa_subtype, tvb,
|
||||
offset, 1, ENC_NA);
|
||||
offset += 1;
|
||||
left -= 1;
|
||||
if (oui == OUI_WFA) {
|
||||
proto_tree_add_item(adv_tuple_tree, hf_ieee80211_dpp_subtype, tvb, offset, 1, ENC_NA);
|
||||
if (wfa_subtype == WFA_SUBTYPE_DPP) {
|
||||
*subtype = WFA_SUBTYPE_DPP;
|
||||
*subtype |= (tvb_get_guint8(tvb, offset) << 8);
|
||||
}
|
||||
offset++;
|
||||
left--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5966,7 +5998,7 @@ dissect_advertisement_protocol_common(packet_info *pinfo, proto_tree *tree,
|
|||
static int
|
||||
dissect_advertisement_protocol(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
|
||||
{
|
||||
return dissect_advertisement_protocol_common(pinfo, tree, tvb, 0, NULL);
|
||||
return dissect_advertisement_protocol_common(pinfo, tree, tvb, 0, NULL, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -6738,7 +6770,7 @@ dissect_anqp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int offset, gb
|
|||
|
||||
static guint
|
||||
dissect_gas_initial_request(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int offset,
|
||||
gboolean anqp)
|
||||
guint type, guint subtype)
|
||||
{
|
||||
guint16 req_len;
|
||||
int start = offset;
|
||||
|
@ -6761,11 +6793,21 @@ dissect_gas_initial_request(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo,
|
|||
* Query Request (GAS query; formatted per protocol specified in the
|
||||
* Advertisement Protocol IE)
|
||||
*/
|
||||
if (anqp)
|
||||
switch (type) {
|
||||
case ADV_PROTO_ID_ANQP:
|
||||
dissect_anqp(query, tvb, pinfo, offset, TRUE);
|
||||
else
|
||||
break;
|
||||
case ADV_PROTO_ID_VS:
|
||||
if (subtype == ((DPP_CONFIGURATION_PROTOCOL << 8) | WFA_SUBTYPE_DPP)) {
|
||||
col_append_fstr(pinfo->cinfo, COL_INFO, ", DPP - %s",
|
||||
val_to_str(subtype >> 8, dpp_subtype_vals, "Unknown (%u)"));
|
||||
dissect_wifi_dpp_attributes(pinfo, query, tvb, offset);
|
||||
}
|
||||
/* FALL THROUGH */
|
||||
default:
|
||||
proto_tree_add_item(query, hf_ieee80211_ff_query_request,
|
||||
tvb, offset, req_len, ENC_NA);
|
||||
}
|
||||
offset += req_len;
|
||||
|
||||
return offset - start;
|
||||
|
@ -6773,7 +6815,7 @@ dissect_gas_initial_request(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo,
|
|||
|
||||
static guint
|
||||
dissect_gas_initial_response(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int offset,
|
||||
gboolean anqp)
|
||||
guint type, guint subtype)
|
||||
{
|
||||
guint16 resp_len;
|
||||
int start = offset;
|
||||
|
@ -6795,11 +6837,21 @@ dissect_gas_initial_response(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo
|
|||
offset += 2;
|
||||
/* Query Response (optional) */
|
||||
if (resp_len) {
|
||||
if (anqp)
|
||||
switch (type) {
|
||||
case ADV_PROTO_ID_ANQP:
|
||||
dissect_anqp(query, tvb, pinfo, offset, FALSE);
|
||||
else
|
||||
break;
|
||||
case ADV_PROTO_ID_VS:
|
||||
if (subtype == ((DPP_CONFIGURATION_PROTOCOL << 8) | WFA_SUBTYPE_DPP)) {
|
||||
col_append_fstr(pinfo->cinfo, COL_INFO, ", DPP - %s",
|
||||
val_to_str(subtype >> 8, dpp_subtype_vals, "Unknown (%u)"));
|
||||
dissect_wifi_dpp_attributes(pinfo, query, tvb, offset);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
proto_tree_add_item(query, hf_ieee80211_ff_query_response,
|
||||
tvb, offset, resp_len, ENC_NA);
|
||||
}
|
||||
offset += resp_len;
|
||||
}
|
||||
|
||||
|
@ -6842,7 +6894,7 @@ static const fragment_items gas_resp_frag_items = {
|
|||
|
||||
static guint
|
||||
dissect_gas_comeback_response(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int offset,
|
||||
gboolean anqp, guint8 frag, gboolean more,
|
||||
guint type, guint subtype _U_, guint8 frag, gboolean more,
|
||||
guint8 dialog_token)
|
||||
{
|
||||
guint16 resp_len;
|
||||
|
@ -6865,7 +6917,7 @@ dissect_gas_comeback_response(proto_tree *tree, tvbuff_t *tvb, packet_info *pinf
|
|||
offset += 2;
|
||||
/* Query Response (optional) */
|
||||
if (resp_len) {
|
||||
if (anqp && (frag == 0) && !more)
|
||||
if (type == ADV_PROTO_ID_ANQP && (frag == 0) && !more)
|
||||
dissect_anqp(query, tvb, pinfo, offset, FALSE);
|
||||
else {
|
||||
fragment_head *frag_msg;
|
||||
|
@ -6882,7 +6934,7 @@ dissect_gas_comeback_response(proto_tree *tree, tvbuff_t *tvb, packet_info *pinf
|
|||
frag_msg, &gas_resp_frag_items,
|
||||
NULL, tree);
|
||||
if (new_tvb) {
|
||||
if (anqp)
|
||||
if (type == ADV_PROTO_ID_ANQP)
|
||||
dissect_anqp(query, new_tvb, pinfo, 0, FALSE);
|
||||
else
|
||||
proto_tree_add_item(query, hf_ieee80211_ff_query_response,
|
||||
|
@ -8005,16 +8057,18 @@ add_ff_action_public_fields(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo,
|
|||
case PA_GAS_INITIAL_REQUEST:
|
||||
offset += add_ff_dialog_token(tree, tvb, pinfo, offset);
|
||||
offset += dissect_advertisement_protocol_common(pinfo, tree, tvb, offset,
|
||||
&anqp);
|
||||
offset += dissect_gas_initial_request(tree, tvb, pinfo, offset, anqp);
|
||||
&type, &subtype);
|
||||
offset += dissect_gas_initial_request(tree, tvb, pinfo, offset, type,
|
||||
subtype);
|
||||
break;
|
||||
case PA_GAS_INITIAL_RESPONSE:
|
||||
offset += add_ff_dialog_token(tree, tvb, pinfo, offset);
|
||||
offset += add_ff_status_code(tree, tvb, pinfo, offset);
|
||||
offset += add_ff_gas_comeback_delay(tree, tvb, pinfo, offset);
|
||||
offset += dissect_advertisement_protocol_common(pinfo, tree, tvb, offset,
|
||||
&anqp);
|
||||
offset += dissect_gas_initial_response(tree, tvb, pinfo, offset, anqp);
|
||||
&type, &subtype);
|
||||
offset += dissect_gas_initial_response(tree, tvb, pinfo, offset, type,
|
||||
subtype);
|
||||
break;
|
||||
case PA_GAS_COMEBACK_REQUEST:
|
||||
offset += add_ff_dialog_token(tree, tvb, pinfo, offset);
|
||||
|
@ -8028,9 +8082,9 @@ add_ff_action_public_fields(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo,
|
|||
offset += add_ff_gas_fragment_id(tree, tvb, pinfo, offset);
|
||||
offset += add_ff_gas_comeback_delay(tree, tvb, pinfo, offset);
|
||||
offset += dissect_advertisement_protocol_common(pinfo, tree, tvb, offset,
|
||||
&anqp);
|
||||
offset += dissect_gas_comeback_response(tree, tvb, pinfo, offset, anqp, frag,
|
||||
more, dialog_token);
|
||||
&type, &subtype);
|
||||
offset += dissect_gas_comeback_response(tree, tvb, pinfo, offset, type,
|
||||
subtype, frag, more, dialog_token);
|
||||
break;
|
||||
case PA_TDLS_DISCOVERY_RESPONSE:
|
||||
col_set_str(pinfo->cinfo, COL_PROTOCOL, "TDLS");
|
||||
|
@ -23146,9 +23200,13 @@ proto_register_ieee80211(void)
|
|||
NULL, HFILL }},
|
||||
|
||||
{&hf_ieee80211_anqp_wfa_subtype,
|
||||
{"ANQP WFA Subtype", "wlan.anqp.wfa.subtype",
|
||||
{"WFA Subtype", "wlan.anqp.wfa.subtype",
|
||||
FT_UINT8, BASE_DEC, VALS(wfa_subtype_vals), 0, NULL, HFILL }},
|
||||
|
||||
{&hf_ieee80211_dpp_subtype,
|
||||
{"DPP Subtype", "dpp",
|
||||
FT_UINT8, BASE_DEC, VALS(dpp_subtype_vals), 0, NULL, HFILL }},
|
||||
|
||||
{&hf_hs20_indication_dgaf_disabled,
|
||||
{"DGAF Disabled", "wlan.hs20.indication.dgaf_disabled",
|
||||
FT_UINT8, BASE_DEC, NULL, 0x01, NULL, HFILL }},
|
||||
|
@ -27608,10 +27666,16 @@ proto_register_ieee80211(void)
|
|||
FT_UINT8, BASE_DEC, VALS(adv_proto_id_vals), 0,
|
||||
NULL, HFILL }},
|
||||
|
||||
{&hf_ieee80211_tag_adv_vs_len,
|
||||
{"Advertisement Protocol Vendor Specific length", "wlan.adv_proto.vs_len",
|
||||
FT_UINT8, BASE_DEC, NULL, 0,
|
||||
NULL, HFILL}},
|
||||
#if 0
|
||||
{&hf_ieee80211_tag_adv_proto_vs_info,
|
||||
{"Advertisement Protocol Vendor Specific info", "wlan.adv_proto.vs_info",
|
||||
FT_NONE, BASE_NONE, NULL, 0,
|
||||
NULL, HFILL }},
|
||||
#endif
|
||||
|
||||
/* Roaming Consortium */
|
||||
{&hf_ieee80211_tag_roaming_consortium_num_anqp_oi,
|
||||
|
|
|
@ -55,6 +55,8 @@ int add_tagged_field(packet_info *pinfo, proto_tree *tree,
|
|||
guint valid_element_ids_count,
|
||||
association_sanity_check_t *association_sanity_check);
|
||||
|
||||
int dissect_wifi_dpp_attributes(packet_info *pinfo, proto_tree *query,
|
||||
tvbuff_t *tvb, int offset);
|
||||
#define MAX_SSID_LEN 32
|
||||
#define MAX_PROTECT_LEN 10
|
||||
|
||||
|
@ -280,6 +282,8 @@ typedef struct anqp_info_dissector_data {
|
|||
#define WFA_SUBTYPE_WIFI_DISPLAY 10
|
||||
#define WFA_SUBTYPE_HS20_INDICATION 16
|
||||
#define WFA_SUBTYPE_HS20_ANQP 17
|
||||
#define WFA_SUBTYPE_DPP 26
|
||||
|
||||
|
||||
/*
|
||||
* Editor modelines
|
||||
|
|
|
@ -0,0 +1,444 @@
|
|||
/* packet-wifi-dpp.c
|
||||
*
|
||||
* Wi-Fi Device Provisioning Protocol (DPP)
|
||||
*
|
||||
* Copyright 2017 Richard Sharpe <realrichardsharpe@gmail.com>
|
||||
* Copyright 2017 The WiFi Alliance
|
||||
*
|
||||
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Code and constants based on Wi-Fi_DPP_Tech_Spec_v0_1_5
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <epan/packet.h>
|
||||
#include <epan/to_str.h>
|
||||
#include <epan/expert.h>
|
||||
|
||||
#include "packet-ieee80211.h"
|
||||
|
||||
void proto_register_wifi_dpp(void);
|
||||
void proto_reg_handoff_wifi_dpp(void);
|
||||
|
||||
enum {
|
||||
DPP_STATUS_OK = 0,
|
||||
DPP_STATUS_NOT_COMPATIBLE = 1,
|
||||
DPP_STATUS_AUTH_FAILURE = 2,
|
||||
DPP_STATUS_UNWRAP_FAILURE = 3,
|
||||
DPP_STATUS_BAD_GROUP = 4,
|
||||
DPP_STATUS_CONFIGURE_FAILURE = 5,
|
||||
DPP_STATUS_RESPONSE_PENDING = 6
|
||||
};
|
||||
|
||||
static const value_string dpp_status_codes[] = {
|
||||
{ DPP_STATUS_OK, "OK" },
|
||||
{ DPP_STATUS_NOT_COMPATIBLE, "Not Compatible" },
|
||||
{ DPP_STATUS_AUTH_FAILURE, "Auth Failure" },
|
||||
{ DPP_STATUS_UNWRAP_FAILURE, "Unwrap Failure" },
|
||||
{ DPP_STATUS_BAD_GROUP, "Bad Group" },
|
||||
{ DPP_STATUS_CONFIGURE_FAILURE, "Configure Failure" },
|
||||
{ DPP_STATUS_RESPONSE_PENDING, "Response Pending" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
enum {
|
||||
DPP_STATUS = 0x1000,
|
||||
DPP_INITIATOR_BOOTSTRAPPING_KEY_HASH = 0x1001,
|
||||
DPP_RESPONDER_BOOTSTRAPPING_KEY_HASH = 0x1002,
|
||||
DPP_INITIATOR_PROTOCOL_KEY = 0x1003,
|
||||
DPP_WRAPPED_DATA = 0x1004,
|
||||
DPP_INITIATOR_NONCE = 0x1005,
|
||||
DPP_INITIATOR_CAPABILITIES = 0x1006,
|
||||
DPP_RESPONDER_NONCE = 0x1007,
|
||||
DPP_RESPONDER_CAPABILITIES = 0x1008,
|
||||
DPP_RESPONDER_PROTOCOL_KEY = 0x1009,
|
||||
DPP_INITIATOR_AUTHENTICATING_TAG = 0x100A,
|
||||
DPP_RESPONDER_AUTHENTICATING_TAG = 0x100B,
|
||||
DPP_CONFIGURATION_OBJECT = 0x100C,
|
||||
DPP_CONNECTOR = 0x100D,
|
||||
DPP_CONFIGURATION_ATTRIBUTES_OBJECT = 0x100E,
|
||||
DPP_BOOTSTRAPPING_KEY = 0x100F,
|
||||
DPP_FINITE_CYCLIC_GROUP = 0x1012,
|
||||
DPP_ENCRYPTED_KEY = 0x1013,
|
||||
DPP_ENROLLEE_NONCE = 0x1014,
|
||||
DPP_CODE_IDENTIFIER = 0x1015,
|
||||
DPP_TRANSACTION_ID = 0x1016
|
||||
};
|
||||
|
||||
static const value_string dpp_ie_attr_ids[] = {
|
||||
{ DPP_STATUS, "DPP Status" },
|
||||
{ DPP_INITIATOR_BOOTSTRAPPING_KEY_HASH, "DPP Initiator Bootstrapping Key Hash" },
|
||||
{ DPP_RESPONDER_BOOTSTRAPPING_KEY_HASH, "DPP Responder Bootstrapping Key Hash" },
|
||||
{ DPP_INITIATOR_PROTOCOL_KEY, "DPP Initiator Protocol Key" },
|
||||
{ DPP_WRAPPED_DATA, "DPP Primary Wrapped Data" },
|
||||
{ DPP_INITIATOR_NONCE, "DPP Initiator Nonce" },
|
||||
{ DPP_INITIATOR_CAPABILITIES, "DPP Initiator Capabilities" },
|
||||
{ DPP_RESPONDER_NONCE, "DPP Responder Nonce" },
|
||||
{ DPP_RESPONDER_CAPABILITIES, "DPP Responder Capabilities" },
|
||||
{ DPP_RESPONDER_PROTOCOL_KEY, "DPP Responder Protocol Key" },
|
||||
{ DPP_INITIATOR_AUTHENTICATING_TAG, "DPP Initiator Authenticating Tag" },
|
||||
{ DPP_RESPONDER_AUTHENTICATING_TAG, "DPP Responder Authenticating Tag" },
|
||||
{ DPP_CONFIGURATION_OBJECT, "DPP Configuration Object" },
|
||||
{ DPP_CONNECTOR, "DPP Connector" },
|
||||
{ DPP_CONFIGURATION_ATTRIBUTES_OBJECT, "DPP Configuration Attributes Object" },
|
||||
{ DPP_BOOTSTRAPPING_KEY, "DPP Bootstrapping Key" },
|
||||
{ DPP_FINITE_CYCLIC_GROUP, "DPP Finite Cyclic Group" },
|
||||
{ DPP_ENCRYPTED_KEY, "DPP Encrypted Key" },
|
||||
{ DPP_CODE_IDENTIFIER, "DPP Code Identifier" },
|
||||
{ DPP_TRANSACTION_ID, "DPP Transaction ID" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
enum {
|
||||
DPP_AUTHENTICATION_REQUEST = 0,
|
||||
DPP_AUTHENTICATION_RESPONSE = 1,
|
||||
DPP_AUTHENTICATION_CONFIRM = 2,
|
||||
DPP_PEER_DISCOVERY_REQUEST = 5,
|
||||
DPP_PEER_DISCOVERY_RESPONSE = 6,
|
||||
DPP_PKEX_EXCHANGE_REQUEST = 7,
|
||||
DPP_PKEX_EXCHANGE_RESPONSE = 8,
|
||||
DPP_PKEX_COMMIT_REVEAL_REQUEST = 9,
|
||||
DPP_PKEX_COMMIT_REVEAL_RESPONSE = 10
|
||||
};
|
||||
|
||||
static const value_string dpp_public_action_subtypes[] = {
|
||||
{ DPP_AUTHENTICATION_REQUEST, "Authentiation Request" },
|
||||
{ DPP_AUTHENTICATION_RESPONSE, "Authentication Response" },
|
||||
{ DPP_AUTHENTICATION_CONFIRM, "Authentication Confirm" },
|
||||
{ DPP_PEER_DISCOVERY_REQUEST, "Peer Discovery Request" },
|
||||
{ DPP_PEER_DISCOVERY_RESPONSE, "Peer Discovery Response" },
|
||||
{ DPP_PKEX_EXCHANGE_REQUEST, "PKEX Exchange Request" },
|
||||
{ DPP_PKEX_EXCHANGE_RESPONSE, "PKEX Exchange Response" },
|
||||
{ DPP_PKEX_COMMIT_REVEAL_REQUEST, "PKEX Commit-Reveal Request" },
|
||||
{ DPP_PKEX_COMMIT_REVEAL_RESPONSE, "PKEX Commit-Reveal Response" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
/*
|
||||
* This table and the one above share values ... but this one is truncated.
|
||||
*/
|
||||
static const value_string dpp_action_subtypes[] = {
|
||||
{ DPP_AUTHENTICATION_REQUEST, "Authentication Request" },
|
||||
{ DPP_AUTHENTICATION_RESPONSE, "Authentication Response" },
|
||||
{ DPP_AUTHENTICATION_CONFIRM, "Authentication Confirm" },
|
||||
{ DPP_PEER_DISCOVERY_REQUEST, "Peer Discovery Request" },
|
||||
{ DPP_PEER_DISCOVERY_RESPONSE, "Peer Discovery Response" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static int proto_wifi_dpp = -1;
|
||||
|
||||
static gint ett_wifi_dpp_ie_generic = -1;
|
||||
static gint ett_wifi_dpp_attributes = -1;
|
||||
static gint ett_wifi_dpp_pa = -1;
|
||||
static gint ett_wifi_dpp_attribute = -1;
|
||||
static gint ett_wifi_dpp_attr_header = -1;
|
||||
|
||||
static int hf_wifi_dpp_ie_attr_id = -1;
|
||||
static int hf_wifi_dpp_ie_attr_len = -1;
|
||||
static int hf_wifi_dpp_ie_generic = -1; /* Remove eventually */
|
||||
static int hf_wifi_dpp_action_dialog_token = -1;
|
||||
static int hf_wifi_dpp_action_subtype = -1;
|
||||
static int hf_wifi_dpp_public_action_subtype = -1;
|
||||
static int hf_wifi_dpp_status = -1;
|
||||
static int hf_wifi_dpp_init_hash = -1;
|
||||
static int hf_wifi_dpp_resp_hash = -1;
|
||||
static int hf_wifi_dpp_key_x = -1;
|
||||
static int hf_wifi_dpp_key_y = -1;
|
||||
static int hf_wifi_dpp_trans_id = -1;
|
||||
static int hf_wifi_dpp_finite_cyclic_group = -1;
|
||||
static int hf_wifi_dpp_capabilities = -1;
|
||||
static int hf_wifi_dpp_code_identifier = -1;
|
||||
static int hf_wifi_dpp_enc_key_attribute = -1;
|
||||
static int hf_wifi_dpp_primary_wrapped_data = -1;
|
||||
static int hf_wifi_dpp_unknown_anqp_item = -1;
|
||||
|
||||
static int
|
||||
dissect_wifi_dpp(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
|
||||
{
|
||||
int offset = 0;
|
||||
|
||||
proto_tree_add_item(tree, hf_wifi_dpp_unknown_anqp_item, tvb, offset, tvb_reported_length_remaining(tvb, offset), ENC_NA);
|
||||
return tvb_captured_length(tvb);
|
||||
}
|
||||
|
||||
static int
|
||||
dissect_wifi_dpp_ie(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
|
||||
{
|
||||
proto_item *ie;
|
||||
int offset = 0;
|
||||
gint remaining_len = tvb_reported_length(tvb);
|
||||
|
||||
ie = proto_tree_add_subtree(tree, tvb, offset, remaining_len, ett_wifi_dpp_ie_generic, NULL, "Generic DPP IE");
|
||||
proto_tree_add_item(ie, hf_wifi_dpp_ie_generic, tvb, offset, remaining_len, ENC_NA);
|
||||
return tvb_captured_length(tvb);
|
||||
}
|
||||
|
||||
int
|
||||
dissect_wifi_dpp_attributes(packet_info *pinfo _U_, proto_tree *tree,
|
||||
tvbuff_t *tvb, int offset _U_)
|
||||
{
|
||||
proto_item *si = NULL;
|
||||
guint8 status;
|
||||
proto_tree *specific_attr, *attr_hdr;
|
||||
guint16 attribute_id;
|
||||
guint16 attribute_len;
|
||||
guint attributes_len = 0;
|
||||
guint remaining_len = tvb_reported_length_remaining(tvb, offset);
|
||||
|
||||
while (remaining_len) {
|
||||
attribute_id = tvb_get_guint16(tvb, offset, ENC_LITTLE_ENDIAN);
|
||||
attribute_len = tvb_get_guint16(tvb, offset + 2, ENC_LITTLE_ENDIAN);
|
||||
specific_attr = proto_tree_add_subtree_format(tree, tvb, offset,
|
||||
attribute_len + 4, ett_wifi_dpp_attribute,
|
||||
&si, "%s Attribute",
|
||||
val_to_str(attribute_id,
|
||||
dpp_ie_attr_ids,
|
||||
"Unknown (%u)"));
|
||||
attr_hdr = proto_tree_add_subtree_format(specific_attr, tvb, offset, 4,
|
||||
ett_wifi_dpp_attr_header, NULL,
|
||||
"Attribute Header");
|
||||
|
||||
proto_tree_add_item(attr_hdr, hf_wifi_dpp_ie_attr_id, tvb, offset, 2, ENC_LITTLE_ENDIAN);
|
||||
offset += 2;
|
||||
proto_tree_add_item(attr_hdr, hf_wifi_dpp_ie_attr_len, tvb, offset, 2, ENC_LITTLE_ENDIAN);
|
||||
offset += 2;
|
||||
switch (attribute_id) {
|
||||
case DPP_STATUS:
|
||||
status = tvb_get_guint8(tvb, offset);
|
||||
proto_item_append_text(si, ": %s", val_to_str(status,
|
||||
dpp_status_codes,
|
||||
"Unknown (%u)"));
|
||||
proto_tree_add_item(specific_attr, hf_wifi_dpp_status, tvb, offset, attribute_len, ENC_LITTLE_ENDIAN);
|
||||
break;
|
||||
|
||||
case DPP_INITIATOR_BOOTSTRAPPING_KEY_HASH:
|
||||
proto_tree_add_item(specific_attr, hf_wifi_dpp_init_hash, tvb, offset, attribute_len, ENC_NA);
|
||||
break;
|
||||
|
||||
case DPP_RESPONDER_BOOTSTRAPPING_KEY_HASH:
|
||||
proto_tree_add_item(specific_attr, hf_wifi_dpp_resp_hash, tvb, offset, attribute_len, ENC_NA);
|
||||
break;
|
||||
|
||||
case DPP_RESPONDER_PROTOCOL_KEY:
|
||||
case DPP_INITIATOR_PROTOCOL_KEY:
|
||||
// This is two protocol keys of equal length, X then Y.
|
||||
proto_tree_add_item(specific_attr, hf_wifi_dpp_key_x, tvb, offset, attribute_len/2, ENC_NA);
|
||||
proto_tree_add_item(specific_attr, hf_wifi_dpp_key_y, tvb, offset + attribute_len/2, attribute_len/2, ENC_NA);
|
||||
break;
|
||||
|
||||
case DPP_TRANSACTION_ID:
|
||||
proto_tree_add_item(specific_attr, hf_wifi_dpp_trans_id, tvb, offset, 1, ENC_LITTLE_ENDIAN);
|
||||
break;
|
||||
|
||||
case DPP_FINITE_CYCLIC_GROUP:
|
||||
case DPP_RESPONDER_CAPABILITIES:
|
||||
proto_tree_add_item(specific_attr, hf_wifi_dpp_finite_cyclic_group, tvb, offset, 2, ENC_LITTLE_ENDIAN);
|
||||
break;
|
||||
|
||||
case DPP_INITIATOR_CAPABILITIES:
|
||||
proto_tree_add_item(specific_attr, hf_wifi_dpp_capabilities, tvb, offset, 1, ENC_LITTLE_ENDIAN);
|
||||
break;
|
||||
|
||||
case DPP_CODE_IDENTIFIER:
|
||||
proto_tree_add_item(specific_attr, hf_wifi_dpp_code_identifier, tvb, offset, attribute_len, ENC_UTF_8|ENC_NA);
|
||||
break;
|
||||
|
||||
case DPP_ENCRYPTED_KEY:
|
||||
proto_tree_add_item(specific_attr, hf_wifi_dpp_enc_key_attribute, tvb, offset, attribute_len, ENC_NA);
|
||||
break;
|
||||
|
||||
case DPP_WRAPPED_DATA:
|
||||
proto_tree_add_item(specific_attr, hf_wifi_dpp_primary_wrapped_data, tvb, offset, attribute_len, ENC_NA);
|
||||
break;
|
||||
|
||||
case DPP_INITIATOR_NONCE:
|
||||
|
||||
case DPP_INITIATOR_AUTHENTICATING_TAG:
|
||||
|
||||
case DPP_RESPONDER_AUTHENTICATING_TAG:
|
||||
|
||||
case DPP_CONFIGURATION_OBJECT:
|
||||
|
||||
case DPP_CONNECTOR:
|
||||
|
||||
case DPP_CONFIGURATION_ATTRIBUTES_OBJECT:
|
||||
|
||||
case DPP_BOOTSTRAPPING_KEY:
|
||||
|
||||
case DPP_ENROLLEE_NONCE:
|
||||
|
||||
default:
|
||||
proto_tree_add_item(specific_attr, hf_wifi_dpp_ie_generic, tvb, offset, attribute_len, ENC_NA);
|
||||
break;
|
||||
}
|
||||
|
||||
offset += attribute_len;
|
||||
attributes_len += attribute_len + 4;
|
||||
remaining_len -= (attribute_len + 4);
|
||||
|
||||
}
|
||||
|
||||
return attributes_len; // We return the attribute length plus hdr!
|
||||
}
|
||||
|
||||
static int
|
||||
dissect_wifi_dpp_public_action(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
|
||||
{
|
||||
guint8 subtype;
|
||||
guint remaining_len;
|
||||
proto_item *dpp_item;
|
||||
proto_tree *dpp_tree, *attr_tree;
|
||||
guint16 attributes_len;
|
||||
int offset = 0;
|
||||
|
||||
col_set_str(pinfo->cinfo, COL_PROTOCOL, "wifi_dpp");
|
||||
|
||||
subtype = tvb_get_guint8(tvb, offset);
|
||||
col_append_fstr(pinfo->cinfo, COL_INFO, ", DPP - %s",
|
||||
val_to_str(subtype, dpp_public_action_subtypes, "Unknown (%u)"));
|
||||
|
||||
remaining_len = tvb_reported_length_remaining(tvb, offset);
|
||||
|
||||
dpp_item = proto_tree_add_item(tree, proto_wifi_dpp, tvb, offset, -1, ENC_NA);
|
||||
dpp_tree = proto_item_add_subtree(dpp_item, ett_wifi_dpp_pa);
|
||||
proto_item_append_text(dpp_item, ": %s", val_to_str(subtype,
|
||||
dpp_public_action_subtypes,
|
||||
"Unknown (%u)"));
|
||||
proto_tree_add_item(dpp_tree, hf_wifi_dpp_public_action_subtype, tvb, offset, 1, ENC_LITTLE_ENDIAN);
|
||||
offset++; /* Skip the OUI Subtype/DPP Request type */
|
||||
remaining_len--;
|
||||
if (remaining_len) {
|
||||
attr_tree = proto_tree_add_subtree_format(dpp_tree, tvb, offset,
|
||||
remaining_len,
|
||||
ett_wifi_dpp_attributes, NULL,
|
||||
"DPP Attributes");
|
||||
|
||||
attributes_len = dissect_wifi_dpp_attributes(pinfo, attr_tree, tvb, offset);
|
||||
offset += attributes_len;
|
||||
}
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
static int
|
||||
dissect_wifi_dpp_action(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
|
||||
{
|
||||
int offset = 0;
|
||||
|
||||
proto_tree_add_item(tree, hf_wifi_dpp_action_subtype, tvb, offset, 1, ENC_LITTLE_ENDIAN);
|
||||
offset++;
|
||||
proto_tree_add_item(tree, hf_wifi_dpp_action_dialog_token, tvb, offset, 1, ENC_LITTLE_ENDIAN);
|
||||
offset++;
|
||||
return offset;
|
||||
}
|
||||
|
||||
void
|
||||
proto_register_wifi_dpp(void)
|
||||
{
|
||||
static hf_register_info hf[] = {
|
||||
{ &hf_wifi_dpp_status,
|
||||
{ "Wi-Fi DPP Status", "dpp.status",
|
||||
FT_UINT8, BASE_HEX, VALS(dpp_status_codes), 0x0, NULL, HFILL }},
|
||||
{ &hf_wifi_dpp_init_hash,
|
||||
{ "Wi-Fi DPP Initiator Hash", "dppi.init.hash",
|
||||
FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_wifi_dpp_resp_hash,
|
||||
{ "Wi-Fi DPP Responder Hash", "dppi.resp.hash",
|
||||
FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_wifi_dpp_key_x,
|
||||
{ "Wi-Fi DPP Key X value", "dpp.key.x",
|
||||
FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_wifi_dpp_key_y,
|
||||
{ "Wi-Fi DPP Key Y value", "dpp.key.y",
|
||||
FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_wifi_dpp_trans_id,
|
||||
{ "Wi-Fi DPP Transaction ID", "dpp.trans_id",
|
||||
FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_wifi_dpp_finite_cyclic_group,
|
||||
{ "Wi-Fi DPP Finite Cyclic Group", "dpp.finite_cyclic_group",
|
||||
FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_wifi_dpp_capabilities,
|
||||
{ "Wi-Fi DPP Capabilities", "dpp.capabilities",
|
||||
FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_wifi_dpp_code_identifier,
|
||||
{ "Wi-Fi DPP Code Identifier", "dpp.code_identifier",
|
||||
FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_wifi_dpp_enc_key_attribute,
|
||||
{ "Wi-Fi DPP Encrypted Key Attribute", "dpp.pkex.enckey",
|
||||
FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_wifi_dpp_primary_wrapped_data,
|
||||
{ "Wi-Fi DPP Primary Wrapped Data", "dpp.primary.wrapped_data",
|
||||
FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_wifi_dpp_ie_attr_id,
|
||||
{ "Wi-Fi DPP IE Attribute ID", "dpp.ie.attr_id",
|
||||
FT_UINT16, BASE_HEX, VALS(dpp_ie_attr_ids), 0x0, NULL, HFILL }},
|
||||
{ &hf_wifi_dpp_ie_attr_len,
|
||||
{ "Wi-Fi DPP IE Attribute Len", "dpp.ie.attr_len",
|
||||
FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_wifi_dpp_ie_generic,
|
||||
{ "Wi-Fi DPP IE generic", "dpp.ie.generic",
|
||||
FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_wifi_dpp_action_subtype,
|
||||
{ "Wi-Fi DPP Action Subtype", "dpp.action.subtype",
|
||||
FT_UINT8, BASE_DEC, VALS(dpp_action_subtypes), 0x0, NULL, HFILL }},
|
||||
{ &hf_wifi_dpp_action_dialog_token,
|
||||
{ "Wi-Fi DPP Action Dialog Token", "dpp.action.dialog_token",
|
||||
FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_wifi_dpp_public_action_subtype,
|
||||
{ "Wi-Fi DPP Public Action Subtype", "dpp.public_action.subtype",
|
||||
FT_UINT8, BASE_DEC, VALS(dpp_public_action_subtypes), 0x0, NULL, HFILL }},
|
||||
{ &hf_wifi_dpp_unknown_anqp_item,
|
||||
{ "Wi-fi DPP Unknown ANQP Item", "dpp.unknown_anqp_item",
|
||||
FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
||||
};
|
||||
static gint *ett[] = {
|
||||
&ett_wifi_dpp_ie_generic,
|
||||
&ett_wifi_dpp_attributes,
|
||||
&ett_wifi_dpp_pa,
|
||||
&ett_wifi_dpp_attribute,
|
||||
&ett_wifi_dpp_attr_header,
|
||||
};
|
||||
|
||||
proto_wifi_dpp = proto_register_protocol("Wi-Fi Device Provisioning Protocol", "Wi-Fi DPP", "dpp");
|
||||
proto_register_field_array(proto_wifi_dpp, hf, array_length(hf));
|
||||
proto_register_subtree_array(ett, array_length(ett));
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
proto_reg_handoff_wifi_dpp(void)
|
||||
{
|
||||
dissector_add_uint("wlan.action.wifi_alliance.subtype", WFA_SUBTYPE_DPP, create_dissector_handle(dissect_wifi_dpp_action, proto_wifi_dpp));
|
||||
dissector_add_uint("wlan.anqp.wifi_alliance.subtype", WFA_SUBTYPE_DPP, create_dissector_handle(dissect_wifi_dpp, proto_wifi_dpp));
|
||||
dissector_add_uint("wlan.ie.wifi_alliance.subtype", WFA_SUBTYPE_DPP, create_dissector_handle(dissect_wifi_dpp_ie, proto_wifi_dpp));
|
||||
dissector_add_uint("wlan.pa.wifi_alliance.subtype", WFA_SUBTYPE_DPP, create_dissector_handle(dissect_wifi_dpp_public_action, proto_wifi_dpp));
|
||||
}
|
||||
|
||||
/*
|
||||
* Editor modelines
|
||||
*
|
||||
* Local Variables:
|
||||
* c-basic-offset: 2
|
||||
* tab-width: 8
|
||||
* indent-tabs-mode: nil
|
||||
* End:
|
||||
*
|
||||
* ex: set shiftwidth=2 tabstop=8 expandtab:
|
||||
* :indentSize=2:tabSize=8:noTabs=true:
|
||||
*/
|
Loading…
Reference in New Issue