aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors
diff options
context:
space:
mode:
authorChris Brandson <cjb@exegin.com>2017-07-17 18:33:35 -0700
committerAnders Broman <a.broman58@gmail.com>2017-08-18 08:15:49 +0000
commitf76e1c8c84eeaee504db9bb7510109247655e372 (patch)
treeddd0e98366fe0783010916a5c2a381e8cb2389be /epan/dissectors
parent6726d9e0cd61634c6bae95857efb2e549ab8f7be (diff)
ZigBee fix Default Response dissection
The ZCL Default Response command can be sent in response to any profile-wide or cluster specific command. The Default Response command is itself a profile-wide command so the Default Response frame control is of no help in deciding whether the original request is profile-wide or cluster-specific. The simplest solution is to not attempt interpretation. A more sophisticated solution would be to cache all ZCL frame counters and match Default Responses based on sequence number, but this is problematic because sequence numbers repeat. At least for now we can always display the information correctly. Change-Id: I827e2d2f9d6e5f7c9dfa572d2ee2ac3c9f170d70 Reviewed-on: https://code.wireshark.org/review/22688 Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors')
-rw-r--r--epan/dissectors/packet-zbee-zcl.c28
1 files changed, 12 insertions, 16 deletions
diff --git a/epan/dissectors/packet-zbee-zcl.c b/epan/dissectors/packet-zbee-zcl.c
index 6a1a9690b5..7b5983dad1 100644
--- a/epan/dissectors/packet-zbee-zcl.c
+++ b/epan/dissectors/packet-zbee-zcl.c
@@ -48,7 +48,7 @@ static void dissect_zcl_config_report (tvbuff_t *tvb, packet_info *pinfo, proto_
static void dissect_zcl_config_report_resp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint *offset, guint16 cluster_id);
static void dissect_zcl_read_report_config (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint *offset, guint16 cluster_id);
static void dissect_zcl_read_report_config_resp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint *offset, guint16 cluster_id);
-static void dissect_zcl_default_resp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint *offset, guint16 cluster_id, guint8 dir);
+static void dissect_zcl_default_resp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint *offset);
static void dissect_zcl_discover_attr (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint *offset);
static void dissect_zcl_discover_attr_resp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint *offset, guint16 cluster_id);
@@ -77,6 +77,7 @@ static int hf_zbee_zcl_tran_seqno = -1;
static int hf_zbee_zcl_cmd_id = -1;
static int hf_zbee_zcl_cs_cmd_id = -1;
+static int hf_zbee_zcl_cmd_id_rsp = -1;
static int hf_zbee_zcl_attr_id = -1;
static int hf_zbee_zcl_attr_data_type = -1;
static int hf_zbee_zcl_attr_boolean = -1;
@@ -936,7 +937,7 @@ static int dissect_zbee_zcl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case ZBEE_ZCL_CMD_DEFAULT_RESP:
- dissect_zcl_default_resp(tvb, pinfo, zcl_tree, &offset, cluster_id, packet.direction);
+ dissect_zcl_default_resp(tvb, pinfo, zcl_tree, &offset);
break;
case ZBEE_ZCL_CMD_DISCOVER_ATTR:
@@ -1298,21 +1299,12 @@ static void dissect_zcl_read_report_config(tvbuff_t *tvb, packet_info *pinfo _U_
*@param cluster_id cluster id.
*@param dir direction.
*/
-static void dissect_zcl_default_resp(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
- guint *offset, guint16 cluster_id, guint8 dir)
+static void dissect_zcl_default_resp(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint *offset)
{
- zbee_zcl_cluster_desc *desc;
- int hf_cmd_id = hf_zbee_zcl_cs_cmd_id;
-
- /* Retrieve the cluster-specific command ID definition, with the direction
- * inverted, since this is a response to the originating command. */
- desc = zbee_zcl_get_cluster_desc(cluster_id);
- if (dir == ZBEE_ZCL_FCF_TO_SERVER) {
- if (desc && (desc->hf_cmd_tx_id >= 0)) hf_cmd_id = desc->hf_cmd_tx_id;
- } else {
- if (desc && (desc->hf_cmd_rx_id >= 0)) hf_cmd_id = desc->hf_cmd_rx_id;
- }
- proto_tree_add_item(tree, hf_cmd_id, tvb, *offset, 1, ENC_NA);
+ /* The only way to tell if this is a profile-wide or cluster specific command */
+ /* is the frame control of the original message to which this is the response. */
+ /* So, display the originating command id and do not attempt to interpret */
+ proto_tree_add_item(tree, hf_zbee_zcl_cmd_id_rsp, tvb, *offset, 1, ENC_NA);
*offset += 1;
/* Dissect the status */
@@ -2051,6 +2043,10 @@ void proto_register_zbee_zcl(void)
{ "Command", "zbee_zcl.cs.cmd.id", FT_UINT8, BASE_HEX, VALS(zbee_zcl_cs_cmd_names) /*"Unknown"*/,
0x0, NULL, HFILL }},
+ { &hf_zbee_zcl_cmd_id_rsp,
+ { "Response to Command", "zbee_zcl.cmd.id.rsp", FT_UINT8, BASE_HEX, NULL,
+ 0x0, NULL, HFILL }},
+
{ &hf_zbee_zcl_attr_id,
{ "Attribute", "zbee_zcl.attr.id", FT_UINT16, BASE_HEX, NULL, 0x0,
NULL, HFILL }},