ZigBee: add support for inter-pan transmissions.

Added dissection of inter-pan nwk and aps stub to be used to decode ZLL commissioning cluster.

Change-Id: I871016a93854f1caf2f14f2f84e5397de5f1e2ff
Reviewed-on: https://code.wireshark.org/review/15918
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
This commit is contained in:
dsrsupport 2016-06-15 18:48:01 +03:00 committed by Pascal Quantin
parent 6baa1b544c
commit 64169e3a76
6 changed files with 234 additions and 213 deletions

View File

@ -205,6 +205,7 @@ static const value_string zbee_aps_frame_types[] = {
{ ZBEE_APS_FCF_DATA, "Data" },
{ ZBEE_APS_FCF_CMD, "Command" },
{ ZBEE_APS_FCF_ACK, "Ack" },
{ ZBEE_APS_FCF_INTERPAN, "Interpan" },
{ 0, NULL }
};
@ -379,6 +380,7 @@ const range_string zbee_aps_apid_names[] = {
{ ZBEE_PROFILE_BM_MIN, ZBEE_PROFILE_BM_MAX, ZBEE_MFG_BM },
{ ZBEE_PROFILE_AWAREPOINT_MIN, ZBEE_PROFILE_AWAREPOINT_MAX, ZBEE_MFG_AWAREPOINT },
{ ZBEE_PROFILE_SAN_JUAN_1_MIN, ZBEE_PROFILE_SAN_JUAN_1_MAX, ZBEE_MFG_SAN_JUAN },
{ ZBEE_PROFILE_ZLL, ZBEE_PROFILE_ZLL, "ZLL" },
{ ZBEE_PROFILE_PHILIPS_MIN, ZBEE_PROFILE_PHILIPS_MAX, ZBEE_MFG_PHILIPS },
{ ZBEE_PROFILE_LUXOFT_MIN, ZBEE_PROFILE_LUXOFT_MAX, ZBEE_MFG_LUXOFT },
{ ZBEE_PROFILE_KORWIN_MIN, ZBEE_PROFILE_KORWIN_MAX, ZBEE_MFG_KORWIN },
@ -652,6 +654,7 @@ const value_string zbee_aps_cid_names[] = {
{ZBEE_ZCL_CID_APPLIANCE_EVENTS_AND_ALERT, "Appliance Events And Alerts"},
{ZBEE_ZCL_CID_APPLIANCE_STATISTICS, "Appliance Statistics"},
{ZBEE_ZCL_CID_ZLL, "ZLL Commissioning"},
{ 0, NULL }
};
@ -808,12 +811,18 @@ dissect_zbee_aps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
}
break;
case ZBEE_APS_FCF_INTERPAN:
packet.dst_present = FALSE;
packet.src_present = FALSE;
break;
default:
case ZBEE_APS_FCF_CMD:
/* Endpoint addressing does not exist for these frames. */
goto dissect_zbee_aps_no_endpt;
} /* switch */
if (packet.type != ZBEE_APS_FCF_INTERPAN) {
/* Determine whether the source and/or destination endpoints are present.
* We should only get here for endpoint-addressed data or ack frames.
*/
@ -859,6 +868,7 @@ dissect_zbee_aps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
/* Update the info column. */
col_append_fstr(pinfo->cinfo, COL_INFO, ", Dst Endpt: %d", packet.dst);
}
} /* if !interpan */
/* If the group address is present, display it. */
if (packet.delivery == ZBEE_APS_FCF_GROUP) {
@ -909,7 +919,8 @@ dissect_zbee_aps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
offset +=2;
/* The source endpoint is present for all cases except indirect /w indirect_mode == FALSE */
if ((packet.delivery != ZBEE_APS_FCF_INDIRECT) || (!packet.indirect_mode)) {
if (packet.type != ZBEE_APS_FCF_INTERPAN &&
((packet.delivery != ZBEE_APS_FCF_INDIRECT) || (!packet.indirect_mode))) {
packet.src = tvb_get_guint8(tvb, offset);
proto_tree_add_uint(aps_tree, hf_zbee_aps_src, tvb, offset, 1, packet.src);
proto_item_append_text(proto_root, ", Src Endpt: %d", packet.src);
@ -929,7 +940,7 @@ dissect_zbee_aps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
dissect_zbee_aps_no_endpt:
/* Get and display the APS counter. Only present on ZigBee 2007 and later. */
if (nwk->version >= ZBEE_VERSION_2007) {
if (nwk->version >= ZBEE_VERSION_2007 && packet.type != ZBEE_APS_FCF_INTERPAN) {
packet.counter = tvb_get_guint8(tvb, offset);
proto_tree_add_uint(aps_tree, hf_zbee_aps_counter, tvb, offset, 1, packet.counter);
offset += 1;
@ -1035,6 +1046,7 @@ dissect_zbee_aps_no_endpt:
/* Handle the packet type. */
switch (packet.type) {
case ZBEE_APS_FCF_DATA:
case ZBEE_APS_FCF_INTERPAN:
if (!payload_tvb) {
break;
}

View File

@ -37,6 +37,7 @@
#define ZBEE_APS_FCF_DATA 0x00
#define ZBEE_APS_FCF_CMD 0x01
#define ZBEE_APS_FCF_ACK 0x02
#define ZBEE_APS_FCF_INTERPAN 0x03
#define ZBEE_APS_FCF_UNICAST 0x00
#define ZBEE_APS_FCF_INDIRECT 0x01
@ -228,6 +229,8 @@
#define ZBEE_ZCL_CID_APPLIANCE_EVENTS_AND_ALERT 0x0b02
#define ZBEE_ZCL_CID_APPLIANCE_STATISTICS 0x0b03
#define ZBEE_ZCL_CID_ZLL 0x1000
/* ZCL Test Profile #2 Clusters */
#define ZBEE_APS_T2_CID_TCP 0x0001
#define ZBEE_APS_T2_CID_RESPC 0x0002

View File

@ -218,6 +218,7 @@ static dissector_handle_t zbee_gp_handle;
static const value_string zbee_nwk_frame_types[] = {
{ ZBEE_NWK_FCF_DATA, "Data" },
{ ZBEE_NWK_FCF_CMD, "Command" },
{ ZBEE_NWK_FCF_INTERPAN,"Interpan" },
{ 0, NULL }
};
@ -514,6 +515,7 @@ dissect_zbee_nwk_full(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
proto_item_append_text(proto_root, " %s", val_to_str_const(packet.type, zbee_nwk_frame_types, "Unknown Type"));
col_set_str(pinfo->cinfo, COL_INFO, val_to_str_const(packet.type, zbee_nwk_frame_types, "Reserved Frame Type"));
if (packet.type != ZBEE_NWK_FCF_INTERPAN) {
/* Get the destination address. */
packet.dst = tvb_get_letohs(tvb, offset);
proto_tree_add_uint(nwk_tree, hf_zbee_nwk_dst, tvb, offset, 2, packet.dst);
@ -700,6 +702,7 @@ dissect_zbee_nwk_full(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
offset += 2;
} /* for */
}
} /* if not interpan */
/*
* Ensure that the payload exists. There are no valid ZigBee network
@ -727,7 +730,7 @@ dissect_zbee_nwk_full(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
/* Dissect the Network Command. */
dissect_zbee_nwk_cmd(payload_tvb, pinfo, nwk_tree, &packet);
}
else if (packet.type == ZBEE_NWK_FCF_DATA) {
else if (packet.type == ZBEE_NWK_FCF_DATA || packet.type == ZBEE_NWK_FCF_INTERPAN) {
/* Dissect the Network Payload (APS layer). */
call_dissector_with_data(aps_handle, payload_tvb, pinfo, tree, &packet);
}

View File

@ -38,6 +38,7 @@
/* ZigBee NWK FCF Frame Types */
#define ZBEE_NWK_FCF_DATA 0x0000
#define ZBEE_NWK_FCF_CMD 0x0001
#define ZBEE_NWK_FCF_INTERPAN 0x0003
/* ZigBee NWK Discovery Modes. */
#define ZBEE_NWK_FCF_DISCOVERY_SUPPRESS 0x0000

View File

@ -2290,6 +2290,7 @@ void proto_reg_handoff_zbee_zcl(void)
dissector_add_uint("zbee.profile", ZBEE_PROFILE_SE, zbee_zcl_handle);
dissector_add_uint("zbee.profile", ZBEE_PROFILE_RS, zbee_zcl_handle);
dissector_add_uint("zbee.profile", ZBEE_PROFILE_GP, zbee_zcl_handle);
dissector_add_uint("zbee.profile", ZBEE_PROFILE_ZLL, zbee_zcl_handle);
dissector_add_uint("zbee.profile", ZBEE_PROFILE_C4_CL, zbee_zcl_handle);
} /* proto_reg_handoff_zbee_zcl */

View File

@ -113,7 +113,8 @@
#define ZBEE_PROFILE_AWAREPOINT_MAX 0xc057
#define ZBEE_PROFILE_SAN_JUAN_1_MIN 0xc058
#define ZBEE_PROFILE_SAN_JUAN_1_MAX 0xc05d
#define ZBEE_PROFILE_PHILIPS_MIN 0xc05e
#define ZBEE_PROFILE_ZLL 0xc05e
#define ZBEE_PROFILE_PHILIPS_MIN 0xc05f
#define ZBEE_PROFILE_PHILIPS_MAX 0xc067
#define ZBEE_PROFILE_LUXOFT_MIN 0xc068
#define ZBEE_PROFILE_LUXOFT_MAX 0xc071