diff options
author | dsrsupport <eugene.exarevsky@dsr-company.com> | 2017-09-13 16:18:05 +0300 |
---|---|---|
committer | Alexis La Goutte <alexis.lagoutte@gmail.com> | 2017-09-14 09:45:30 +0000 |
commit | f63fc333625480d241a1265992ab34b389dd9ed6 (patch) | |
tree | 7d44ebce72b067142058a2a2f7308a6f940d07b2 /epan/dissectors/packet-zbee-nwk.c | |
parent | f3cf2ffd3af2b9d6315c19473bc1091bfe71b89c (diff) |
ZigBee: implemented a dissector for ZBOSS key dump
Implemented dissecting of ZBOSS keys dump (debug stuff)
and adding a key into NWK keys ring.
Move adding key to keyring from dissect_zbee_aps_transport_key
into separate function.
Change-Id: If0e414765350ec5131d0f815edf70cc224aef732
Reviewed-on: https://code.wireshark.org/review/23524
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: Alexis La Goutte <alexis.lagoutte@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-zbee-nwk.c')
-rw-r--r-- | epan/dissectors/packet-zbee-nwk.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/epan/dissectors/packet-zbee-nwk.c b/epan/dissectors/packet-zbee-nwk.c index 593f7b8428..c159daf3f0 100644 --- a/epan/dissectors/packet-zbee-nwk.c +++ b/epan/dissectors/packet-zbee-nwk.c @@ -32,9 +32,11 @@ #include <epan/addr_resolv.h> #include <epan/expert.h> #include <epan/proto_data.h> +#include <wsutil/bits_ctz.h> /* for ws_ctz */ #include "packet-ieee802154.h" #include "packet-zbee.h" #include "packet-zbee-nwk.h" +#include "packet-zbee-aps.h" /* for ZBEE_APS_CMD_KEY_LENGTH */ #include "packet-zbee-security.h" #include <wsutil/glib-compat.h> @@ -150,6 +152,7 @@ static int hf_zbee_nwk_cmd_update_type = -1; static int hf_zbee_nwk_cmd_update_count = -1; static int hf_zbee_nwk_cmd_update_id = -1; static int hf_zbee_nwk_panid = -1; +static int hf_zbee_zboss_nwk_cmd_key = -1; static int hf_zbee_nwk_cmd_epid = -1; static int hf_zbee_nwk_cmd_end_device_timeout_request_enum = -1; static int hf_zbee_nwk_cmd_end_device_configuration = -1; @@ -269,6 +272,7 @@ static const value_string zbee_nwk_rejoin_codes[] = { /* Network Report Types */ static const value_string zbee_nwk_report_types[] = { { ZBEE_NWK_CMD_NWK_REPORT_ID_PAN_CONFLICT, "PAN Identifier Conflict" }, + { ZBEE_NWK_CMD_NWK_REPORT_ID_ZBOSS_KEY_TRACE, "ZBOSS key trace" }, { 0, NULL } }; @@ -1369,6 +1373,7 @@ dissect_zbee_nwk_report(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gui proto_tree_add_uint(tree, hf_zbee_nwk_cmd_report_type, tvb, offset, 1, report_type); proto_tree_add_uint(tree, hf_zbee_nwk_cmd_report_count, tvb, offset, 1, report_count); offset += 1; + report_type >>= ws_ctz(ZBEE_NWK_CMD_NWK_REPORT_ID_MASK); /* Get and display the epid. */ proto_tree_add_item(tree, hf_zbee_nwk_cmd_epid, tvb, offset, 8, ENC_LITTLE_ENDIAN); @@ -1382,6 +1387,16 @@ dissect_zbee_nwk_report(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gui offset += 2; } /* for */ } + if (report_type == ZBEE_NWK_CMD_NWK_REPORT_ID_ZBOSS_KEY_TRACE) { + guint8 key[ZBEE_APS_CMD_KEY_LENGTH]; + + for (i=0; i<ZBEE_APS_CMD_KEY_LENGTH ; i++) { + key[i] = tvb_get_guint8(tvb, offset+i); + } /* for */ + proto_tree_add_item(tree, hf_zbee_zboss_nwk_cmd_key, tvb, offset, ZBEE_APS_CMD_KEY_LENGTH, ENC_NA); + offset += ZBEE_APS_CMD_KEY_LENGTH; + zbee_sec_add_key_to_keyring(pinfo, key); + } /* Update the info column. */ col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", val_to_str_const(report_type, zbee_nwk_report_types, "Unknown Report Type")); @@ -2045,6 +2060,10 @@ void proto_register_zbee_nwk(void) { "PAN ID", "zbee_nwk.panid", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, + { &hf_zbee_zboss_nwk_cmd_key, + { "ZBOSS Key", "zbee_nwk.zboss_key", FT_BYTES, BASE_NONE, NULL, 0x0, + NULL, HFILL }}, + { &hf_zbee_nwk_cmd_epid, { "Extended PAN ID", "zbee_nwk.cmd.epid", FT_EUI64, BASE_NONE, NULL, 0x0, NULL, HFILL }}, |