diff options
author | Joerg Mayer <jmayer@loplof.de> | 2020-01-08 18:11:54 +0100 |
---|---|---|
committer | Jörg Mayer <jmayer@loplof.de> | 2020-01-10 07:43:29 +0000 |
commit | 507bec0f361def9a3224f7e6e664d40342174204 (patch) | |
tree | 3025cf15bd3bc23064a4cdc672cd3c1ea652bc86 /epan | |
parent | 1fa51cfc0c30d02ade9adcaebbc5f4a90955f423 (diff) |
Add initial version of a dissector for the Paloalto heartbeat backup protocol.
Change-Id: I79b6c42df983c6dae6cce866f3cfdd673a6a7f0b
Reviewed-on: https://code.wireshark.org/review/35721
Petri-Dish: Jörg Mayer <jmayer@loplof.de>
Tested-by: Petri Dish Buildbot
Reviewed-by: Jörg Mayer <jmayer@loplof.de>
Diffstat (limited to 'epan')
-rw-r--r-- | epan/dissectors/CMakeLists.txt | 1 | ||||
-rw-r--r-- | epan/dissectors/packet-pa-hbbackup.c | 122 |
2 files changed, 123 insertions, 0 deletions
diff --git a/epan/dissectors/CMakeLists.txt b/epan/dissectors/CMakeLists.txt index 3a8d8049a7..27039f81b9 100644 --- a/epan/dissectors/CMakeLists.txt +++ b/epan/dissectors/CMakeLists.txt @@ -1531,6 +1531,7 @@ set(DISSECTOR_SRC ${CMAKE_CURRENT_SOURCE_DIR}/packet-ossp.c ${CMAKE_CURRENT_SOURCE_DIR}/packet-ouch.c ${CMAKE_CURRENT_SOURCE_DIR}/packet-p_mul.c + ${CMAKE_CURRENT_SOURCE_DIR}/packet-pa-hbbackup.c ${CMAKE_CURRENT_SOURCE_DIR}/packet-pathport.c ${CMAKE_CURRENT_SOURCE_DIR}/packet-packetbb.c ${CMAKE_CURRENT_SOURCE_DIR}/packet-packetlogger.c diff --git a/epan/dissectors/packet-pa-hbbackup.c b/epan/dissectors/packet-pa-hbbackup.c new file mode 100644 index 0000000000..7fa92f81aa --- /dev/null +++ b/epan/dissectors/packet-pa-hbbackup.c @@ -0,0 +1,122 @@ +/* packet-hbbak.c + * Routines for ethertype 0x8988 Paloalto heartbeat backup traffic via mgmt + * + * Copyright 2020 Joerg Mayer (see AUTHORS file) + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1998 Gerald Combs + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +/* 2do: + * - Find out the meaning of the 6 bytes header: timestamp? + * - Handle trailer bytes correctly + */ + +#include "config.h" + +#include <epan/packet.h> +#include <epan/etypes.h> + +void proto_reg_handoff_hbbak(void); +void proto_register_hbbak(void); + +#define PROTO_SHORT_NAME "PA-HB-Bak" +#define PROTO_LONG_NAME "Paloalto Heartbeat Backup" + +#define HBBAK_SIZE 8 + +static int proto_hbbak = -1; +static int hf_hbbak_unknown1 = -1; +static int hf_hbbak_etype_outer = -1; +static int hf_hbbak_trailer = -1; + +static gint ett_hbbak = -1; + +static dissector_handle_t ethertype_handle; + +static int +dissect_hbbak(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) +{ + proto_tree *ti, *hbbak_tree; + int offset = 0; + guint16 eth_type_outer; + ethertype_data_t ethertype_data; + + col_set_str(pinfo->cinfo, COL_PROTOCOL, PROTO_SHORT_NAME); + col_clear(pinfo->cinfo, COL_INFO); + col_add_fstr(pinfo->cinfo, COL_INFO, PROTO_LONG_NAME); + + hbbak_tree = NULL; + ti = proto_tree_add_item(tree, proto_hbbak, tvb, offset, HBBAK_SIZE, ENC_NA); + hbbak_tree = proto_item_add_subtree(ti, ett_hbbak); + + proto_tree_add_item(hbbak_tree, hf_hbbak_unknown1, tvb, offset, 6, ENC_NA); + offset += 6; + eth_type_outer = tvb_get_ntohs(tvb, offset); + // offset += 2; + + ethertype_data.etype = eth_type_outer; + ethertype_data.offset_after_ethertype = HBBAK_SIZE; + ethertype_data.fh_tree = hbbak_tree; + ethertype_data.etype_id = hf_hbbak_etype_outer; + ethertype_data.trailer_id = hf_hbbak_trailer; + ethertype_data.fcs_len = 0; + + call_dissector_with_data(ethertype_handle, tvb, pinfo, tree, ðertype_data); + + return tvb_captured_length(tvb); +} + +void +proto_register_hbbak(void) +{ + static hf_register_info hf[] = { + { &hf_hbbak_unknown1, + { "Unknown1", "hbbak.unknown1", FT_BYTES, BASE_NONE, NULL, + 0x0, NULL, HFILL }}, + + { &hf_hbbak_etype_outer, + { "Type", "hbbak.etype", FT_UINT16, BASE_HEX, VALS(etype_vals), + 0x0, NULL, HFILL }}, + + { &hf_hbbak_trailer, + { "Trailer", "hbbak.trailer", FT_BYTES, BASE_NONE, NULL, + 0x0, NULL, HFILL }}, + + }; + + static gint *ett[] = { + &ett_hbbak, + }; + + proto_hbbak = proto_register_protocol(PROTO_LONG_NAME, PROTO_LONG_NAME, "hbbak"); + proto_register_field_array(proto_hbbak, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); +} + +void +proto_reg_handoff_hbbak(void) +{ + dissector_handle_t hbbak_handle; + + ethertype_handle = find_dissector_add_dependency("ethertype", proto_hbbak); + + hbbak_handle = create_dissector_handle(dissect_hbbak, proto_hbbak); + dissector_add_uint("ethertype", ETHERTYPE_PA_HBBACKUP, hbbak_handle); +} + +/* + * Editor modelines - https://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + * + * vi: set shiftwidth=8 tabstop=8 noexpandtab: + * :indentSize=8:tabSize=8:noTabs=false: + */ |