2002-08-14 18:48:16 +00:00
|
|
|
/* packet-cpha.c
|
|
|
|
* Routines for the Check Point High-Availability Protocol (CPHAP)
|
2011-04-27 06:02:16 +00:00
|
|
|
* Copyright 2002, Yaniv Kaul <mykaul -at- gmail.com>
|
2002-08-14 18:48:16 +00:00
|
|
|
*
|
2006-05-21 04:49:01 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
2002-08-14 18:48:16 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
2002-08-14 18:48:16 +00:00
|
|
|
* 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.
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
2002-08-14 18:48:16 +00:00
|
|
|
* 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.
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
2002-08-14 18:48:16 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2012-06-28 22:56:06 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2002-08-14 18:48:16 +00:00
|
|
|
*/
|
|
|
|
|
2012-09-20 02:03:38 +00:00
|
|
|
#include "config.h"
|
2002-08-14 18:48:16 +00:00
|
|
|
|
|
|
|
#include <epan/packet.h>
|
|
|
|
|
2013-03-15 22:40:15 +00:00
|
|
|
void proto_register_cpha(void);
|
|
|
|
void proto_reg_handoff_cpha(void);
|
2013-03-15 16:39:30 +00:00
|
|
|
|
2002-08-14 18:48:16 +00:00
|
|
|
static int proto_cphap = -1;
|
|
|
|
|
|
|
|
static int hf_magic_number = -1;
|
|
|
|
static int hf_cpha_protocol_ver = -1;
|
|
|
|
static int hf_cluster_number = -1;
|
|
|
|
static int hf_opcode = -1;
|
2011-11-15 07:56:06 +00:00
|
|
|
static int hf_payload = -1;
|
2002-08-14 18:48:16 +00:00
|
|
|
static int hf_src_if_num = -1;
|
|
|
|
static int hf_random_id = -1;
|
|
|
|
static int hf_src_machine_id = -1;
|
|
|
|
static int hf_dst_machine_id = -1;
|
|
|
|
static int hf_policy_id = -1;
|
|
|
|
static int hf_filler = -1;
|
|
|
|
static int hf_id_num = -1;
|
|
|
|
static int hf_report_code = -1;
|
|
|
|
static int hf_ha_mode = -1;
|
|
|
|
static int hf_ha_time_unit = -1;
|
2011-11-15 07:56:06 +00:00
|
|
|
static int hf_machine_states = -1;
|
|
|
|
static int hf_state_node = -1;
|
|
|
|
static int hf_interface_states = -1;
|
2002-08-14 18:48:16 +00:00
|
|
|
static int hf_num_reported_ifs = -1;
|
|
|
|
static int hf_ethernet_add = -1;
|
|
|
|
static int hf_is_if_trusted = -1;
|
|
|
|
static int hf_ip = -1;
|
|
|
|
static int hf_slot_num = -1;
|
|
|
|
static int hf_machine_num = -1;
|
|
|
|
static int hf_seed = -1;
|
|
|
|
static int hf_hash_len = -1;
|
|
|
|
static int hf_status = -1;
|
|
|
|
static int hf_in_up_num = -1;
|
|
|
|
static int hf_in_assumed_up_num = -1;
|
|
|
|
static int hf_out_up_num = -1;
|
|
|
|
static int hf_out_assumed_up_num = -1;
|
2011-11-15 07:56:06 +00:00
|
|
|
static int hf_cluster_last_packet = -1;
|
2002-08-14 18:48:16 +00:00
|
|
|
static int hf_ifn = -1;
|
|
|
|
|
|
|
|
static gint ett_cphap = -1;
|
|
|
|
|
2011-11-15 07:56:06 +00:00
|
|
|
#define UDP_PORT_CPHA 8116
|
2002-08-14 18:48:16 +00:00
|
|
|
#define CPHA_MAGIC 0x1A90
|
|
|
|
|
2013-10-23 06:29:11 +00:00
|
|
|
#if 0
|
2011-11-15 07:56:06 +00:00
|
|
|
static const value_string opcode_type_short_vals[] = {
|
|
|
|
{ 0, "Unknown" },
|
|
|
|
{ 1, "FWHA_MY_STATE" },
|
|
|
|
{ 2, "FWHA_QUERY_STATE" },
|
|
|
|
{ 3, "FWHA_IF_PROBE_REQ" },
|
|
|
|
{ 4, "FWHA_IF_PROBE_REPLY" },
|
|
|
|
{ 5, "FWHA_IFCONF_REQ" },
|
|
|
|
{ 6, "FWHA_IFCONF_REPLY" },
|
|
|
|
{ 7, "FWHA_LB_CONF" },
|
|
|
|
{ 8, "FWHA_LB_CONFIRM" },
|
|
|
|
{ 9, "FWHA_POLICY_CHANGE" },
|
|
|
|
{ 10, "FWHAP_SYNC" },
|
|
|
|
{ 0, NULL }
|
2002-08-14 18:48:16 +00:00
|
|
|
};
|
2013-10-23 06:29:11 +00:00
|
|
|
#endif
|
2002-08-14 18:48:16 +00:00
|
|
|
|
2011-11-15 07:56:06 +00:00
|
|
|
static const value_string opcode_type_vals[] = {
|
|
|
|
{ 0, "Unknown OpCode" },
|
|
|
|
{ 1, "FWHA_MY_STATE - Report source machine's state" },
|
|
|
|
{ 2, "FWHA_QUERY_STATE - Query other machine's state" },
|
|
|
|
{ 3, "FWHA_IF_PROBE_REQ - Interface active check request" },
|
|
|
|
{ 4, "FWHA_IF_PROBE_REPLY - Interface active check reply" },
|
|
|
|
{ 5, "FWHA_IFCONF_REQ - Interface configuration request" },
|
|
|
|
{ 6, "FWHA_IFCONF_REPLY - Interface configuration reply" },
|
|
|
|
{ 7, "FWHA_LB_CONF - LB configuration report request" },
|
|
|
|
{ 8, "FWHA_LB_CONFIRM - LB configuration report reply" },
|
|
|
|
{ 9, "FWHA_POLICY_CHANGE - Policy ID change request/notification" },
|
|
|
|
{ 10, "FWHAP_SYNC - New Sync packet" },
|
|
|
|
{ 0, NULL }
|
2002-08-14 18:48:16 +00:00
|
|
|
};
|
|
|
|
|
2011-11-15 07:56:06 +00:00
|
|
|
static const value_string state_vals[] = {
|
|
|
|
{ 0, "Down/Dead" },
|
|
|
|
{ 1, "Initializing" },
|
|
|
|
{ 2, "Standby" },
|
|
|
|
{ 3, "Ready" },
|
|
|
|
{ 4, "Active/Active-Attention" },
|
|
|
|
{ 0, NULL }
|
2002-08-14 18:48:16 +00:00
|
|
|
};
|
|
|
|
|
2003-12-18 00:25:24 +00:00
|
|
|
static const value_string status_vals[] = {
|
|
|
|
{ 1, "New policy arrived - no need to modify HA configuration" },
|
|
|
|
{ 2, "New policy arrived - need to modify HA configuration" },
|
|
|
|
{ 3, "Ready to change configuration" },
|
|
|
|
{ 0, NULL }
|
2002-08-14 18:48:16 +00:00
|
|
|
};
|
|
|
|
|
2011-11-15 07:56:06 +00:00
|
|
|
static const value_string ha_mode_vals[] = {
|
|
|
|
{ 0, "FWHA_UNDEF_MODE" },
|
|
|
|
{ 1, "FWHA_NOT_ACTIVE_MODE - CPHA is not active" },
|
|
|
|
{ 2, "FWHA_BALANCE_MODE - More than one machine active" },
|
|
|
|
{ 3, "FWHA_PRIMARY_UP_MODE" },
|
|
|
|
{ 4, "FWHA_ONE_UP_MODE" },
|
|
|
|
{ 0, NULL }
|
2002-08-14 18:48:16 +00:00
|
|
|
};
|
|
|
|
|
2011-11-15 07:56:06 +00:00
|
|
|
static const value_string ha_version_vals[] = {
|
|
|
|
{ 1, "4.1" },
|
2014-11-24 16:16:52 +00:00
|
|
|
{ 2, "NG (FP0)" },
|
|
|
|
{ 3, "NG FP1" },
|
|
|
|
{ 6, "NG FP2" },
|
|
|
|
{ 530, "NG FP3" },
|
|
|
|
{ 534, "VSX NG AIR2" },
|
|
|
|
{ 537, "VSX NGX EA" },
|
|
|
|
{ 538, "VSX NGX GA" },
|
|
|
|
{ 540, "NG AIR54 EA" },
|
|
|
|
{ 541, "NG AIR54 GA" },
|
|
|
|
{ 550, "NG AIR55 (up to HFA_16)" },
|
|
|
|
{ 551, "NG AIR55 HFA_17" },
|
|
|
|
{ 552, "NG AIR55W" },
|
|
|
|
{ 553, "NG AIR55 HFA_18" },
|
|
|
|
{ 591, "NG AIR55 LSV" },
|
|
|
|
{ 593, "NGXR60 EA" },
|
|
|
|
{ 601, "NGXR60 GA / NGXR60 HFA_01" },
|
|
|
|
{ 602, "NGXR60 HFA_02" },
|
|
|
|
{ 646, "NGXR60 Multicast acceleration" },
|
|
|
|
{ 650, "NGXR60 with Anti-Virus" },
|
|
|
|
{ 665, "NGXR61 EA2" },
|
|
|
|
{ 667, "NGXR61 GA" },
|
|
|
|
{ 690, "NGXR62 EA" },
|
|
|
|
{ 691, "NGXR62 GA" },
|
|
|
|
{ 700, "Connectra NGXR61 EA" },
|
|
|
|
{ 705, "Connectra NGXR61 GA" },
|
|
|
|
{ 710, "Connectra NGXR66 GA" },
|
|
|
|
{ 800, "NGXR65 EA" },
|
|
|
|
{ 801, "NGXR65 GA" },
|
|
|
|
{ 802, "NGXR65 HFA_01" },
|
|
|
|
{ 803, "NGXR65 HFA_02" },
|
|
|
|
{ 804, "NGXR65 HFA_02 / Connectra NGXR66.1" },
|
|
|
|
{ 805, "NGXR65 HFA_03" },
|
|
|
|
{ 810, "NGXR65 HFA_03 GA" },
|
|
|
|
{ 811, "NGXR65 HFA_40" },
|
|
|
|
{ 813, "NGXR65 HFA_50" },
|
|
|
|
{ 814, "NGXR65 HFA_50" },
|
|
|
|
{ 815, "NGXR65 HFA_60" },
|
|
|
|
{ 816, "NGXR65 HFA_70" },
|
|
|
|
{ 850, "VSX NGX Scalability Pack" },
|
|
|
|
{ 900, "VSX NGXR65 GA" },
|
|
|
|
{ 901, "VSX NGXR65 HFA_10" },
|
|
|
|
{ 902, "VSX NGXR65 HFA_20" },
|
|
|
|
{ 1000, "NGXR65 with CoreXL LE" },
|
|
|
|
{ 1001, "VSX NGXR67 GA" },
|
|
|
|
{ 1010, "VSX NGXR67 EA" },
|
|
|
|
{ 1100, "VSX NGXR68 GA" },
|
|
|
|
{ 1500, "R70 EA" },
|
|
|
|
{ 1501, "R70 GA" },
|
|
|
|
{ 1502, "R70.1 EA /R70.1 IPv6Pack HCC" },
|
|
|
|
{ 1505, "R70.1 GA" },
|
|
|
|
{ 1506, "2R70.1 IPv6Pack" },
|
|
|
|
{ 1508, "R70.12" },
|
|
|
|
{ 1516, "R70.20" },
|
|
|
|
{ 1518, "R70.30" },
|
|
|
|
{ 1520, "R70.40 / GX 5.0 HCC" },
|
|
|
|
{ 1523, "R70.50" },
|
|
|
|
{ 1555, "R71.10 /R71 VE" },
|
|
|
|
{ 1557, "R71.20" },
|
|
|
|
{ 1559, "R71.30" },
|
|
|
|
{ 1561, "R71.40" },
|
|
|
|
{ 1562, "R71.45" },
|
|
|
|
{ 1563, "R71.50" },
|
|
|
|
{ 2000, "R75 GA / R75.050 for 61000 /R75.051 for 61000 /R75.052 for 61000" },
|
|
|
|
{ 2005, "R75.10" },
|
|
|
|
{ 2010, "R75.20" },
|
|
|
|
{ 2020, "R75.30" },
|
|
|
|
{ 2210, "R75.40 32-bit" },
|
|
|
|
{ 2211, "R75.40 64-bit" },
|
|
|
|
{ 2220, "R75.45 32-bit" },
|
|
|
|
{ 2221, "R75.45 64-bit" },
|
|
|
|
{ 2225, "R75.46 32-bit" },
|
|
|
|
{ 2226, "R75.46 64-bit" },
|
|
|
|
{ 2230, "R75.47 32-bit" },
|
|
|
|
{ 2231, "R75.47 64-bit" },
|
|
|
|
{ 2500, "R75.40VS 32-bit" },
|
|
|
|
{ 2501, "R75.40VS 64-bit" },
|
|
|
|
{ 2502, "R75.40VS in VSX mode" },
|
|
|
|
{ 2700, "R76 32-bit" },
|
|
|
|
{ 2701, "DR76 64-bit" },
|
|
|
|
{ 2702, "R76 in VSX mode" },
|
|
|
|
{ 2720, "R76.10 32-bit" },
|
|
|
|
{ 2721, "R76.10 64-bit" },
|
|
|
|
{ 2722, "R76.10 in VSX mode" },
|
|
|
|
{ 2900, "R77 32-bit" },
|
|
|
|
{ 2901, "R77 64-bit" },
|
|
|
|
{ 2902, "R77 in VSX mode" },
|
|
|
|
{ 2905, "R77.10 32-bit" },
|
|
|
|
{ 2906, "R77.10 64-bit" },
|
|
|
|
{ 2907, "R77.10 in VSX mode" },
|
|
|
|
{ 2910, "R77.20 32-bit" },
|
|
|
|
{ 2911, "R77.20 64-bit" },
|
|
|
|
{ 2912, "R77.20 in VSX mode" },
|
|
|
|
{ 2920, "R77.30 32-bit" },
|
|
|
|
{ 2921, "R77.30 64-bit" },
|
|
|
|
{ 2922, "R77.30 in VSX mode" },
|
|
|
|
{ 62700, "R76SP for 61000 32-bit" },
|
|
|
|
{ 62701, "R76SP for 61000 64-bit" },
|
|
|
|
{ 62702, "R76SP for 61000 in VSX mode" },
|
|
|
|
{ 62710, "R76SP.10 for 61000 32-bit" },
|
|
|
|
{ 62711, "R76SP.10 for 61000 64-bit" },
|
|
|
|
{ 62712, "R76SP.10 for 61000 in VSX mode" },
|
2011-11-15 07:56:06 +00:00
|
|
|
{ 0, NULL },
|
|
|
|
};
|
2014-11-24 16:16:52 +00:00
|
|
|
|
|
|
|
static value_string_ext ha_version_vals_ext = VALUE_STRING_EXT_INIT(ha_version_vals);
|
|
|
|
|
|
|
|
|
2011-11-15 07:56:06 +00:00
|
|
|
static const value_string report_code_vals[] = {
|
|
|
|
{ 1, "Machine information included" },
|
|
|
|
{ 2, "Interface information included" },
|
|
|
|
{ 3, "Machine & Interface information included" },
|
|
|
|
{ 0, NULL },
|
|
|
|
};
|
2011-10-26 18:02:01 +00:00
|
|
|
static int dissect_my_state(tvbuff_t *, int, proto_tree *);
|
|
|
|
static int dissect_lb_conf(tvbuff_t *, int, proto_tree *);
|
|
|
|
static int dissect_policy_change(tvbuff_t *, int, proto_tree *);
|
|
|
|
static int dissect_probe(tvbuff_t *, int, proto_tree *);
|
|
|
|
static int dissect_conf_reply(tvbuff_t *, int, proto_tree *);
|
2002-08-14 18:48:16 +00:00
|
|
|
|
2002-08-20 22:56:29 +00:00
|
|
|
static int
|
2012-09-10 21:40:21 +00:00
|
|
|
dissect_cpha(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
|
2002-08-14 18:48:16 +00:00
|
|
|
{
|
2011-11-15 07:56:06 +00:00
|
|
|
int offset = 0;
|
|
|
|
proto_item * ti;
|
|
|
|
proto_item * nti;
|
|
|
|
proto_tree * cpha_tree = NULL;
|
|
|
|
proto_tree * ntree = NULL;
|
|
|
|
guint16 opcode;
|
|
|
|
guint16 magic_number;
|
|
|
|
guint16 ha_version;
|
2002-08-20 22:56:29 +00:00
|
|
|
/*
|
|
|
|
* If the magic number or protocol version is unknown, don't treat this
|
|
|
|
* frame as a CPHA frame.
|
|
|
|
*/
|
2014-11-24 17:18:00 +00:00
|
|
|
if (tvb_reported_length(tvb) < 4) {
|
2002-08-20 22:56:29 +00:00
|
|
|
/* Not enough data for the magic number or protocol version */
|
|
|
|
return 0;
|
|
|
|
}
|
2011-11-15 07:56:06 +00:00
|
|
|
magic_number = tvb_get_ntohs(tvb, 0);
|
|
|
|
ha_version = tvb_get_ntohs(tvb, 2);
|
|
|
|
if (magic_number != CPHA_MAGIC) {
|
2002-08-20 22:56:29 +00:00
|
|
|
/* Bad magic number */
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-08-09 06:26:46 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "CPHA");
|
2009-08-09 07:36:13 +00:00
|
|
|
col_clear(pinfo->cinfo, COL_INFO);
|
2002-08-28 21:04:11 +00:00
|
|
|
|
2011-11-15 07:56:06 +00:00
|
|
|
opcode = tvb_get_ntohs(tvb, 6);
|
2002-08-14 18:48:16 +00:00
|
|
|
|
2011-09-26 09:01:17 +00:00
|
|
|
col_add_fstr(pinfo->cinfo, COL_INFO, "CPHAv%d: %s",
|
2011-11-15 07:56:06 +00:00
|
|
|
ha_version, val_to_str(opcode, opcode_type_vals, "Unknown %d"));
|
2002-08-28 21:04:11 +00:00
|
|
|
|
2002-08-14 18:48:16 +00:00
|
|
|
if (tree) {
|
2011-10-21 02:10:19 +00:00
|
|
|
ti = proto_tree_add_item(tree, proto_cphap, tvb, offset, -1, ENC_NA);
|
2002-08-14 18:48:16 +00:00
|
|
|
cpha_tree = proto_item_add_subtree(ti, ett_cphap);
|
|
|
|
}
|
|
|
|
if (tree) {
|
2011-11-15 07:56:06 +00:00
|
|
|
proto_tree_add_item(cpha_tree, hf_magic_number, tvb, offset, 2, ENC_BIG_ENDIAN);
|
|
|
|
offset += 2;
|
2002-08-14 18:48:16 +00:00
|
|
|
|
2011-11-15 07:56:06 +00:00
|
|
|
proto_tree_add_item(cpha_tree, hf_cpha_protocol_ver, tvb, offset, 2, ENC_BIG_ENDIAN);
|
|
|
|
offset += 2;
|
2002-08-14 18:48:16 +00:00
|
|
|
|
2011-11-15 07:56:06 +00:00
|
|
|
proto_tree_add_item(cpha_tree, hf_cluster_number, tvb, offset, 2, ENC_BIG_ENDIAN);
|
|
|
|
offset += 2;
|
2002-08-14 18:48:16 +00:00
|
|
|
|
2011-11-15 07:56:06 +00:00
|
|
|
proto_tree_add_item(cpha_tree, hf_opcode, tvb, offset, 2, ENC_BIG_ENDIAN);
|
|
|
|
offset += 2;
|
2002-08-14 18:48:16 +00:00
|
|
|
|
2011-11-15 07:56:06 +00:00
|
|
|
proto_tree_add_item(cpha_tree, hf_src_if_num, tvb, offset, 2, ENC_BIG_ENDIAN);
|
|
|
|
offset += 2;
|
2002-08-14 18:48:16 +00:00
|
|
|
|
2011-11-15 07:56:06 +00:00
|
|
|
proto_tree_add_item(cpha_tree, hf_random_id, tvb, offset, 2, ENC_BIG_ENDIAN);
|
|
|
|
offset += 2;
|
2002-08-14 18:48:16 +00:00
|
|
|
|
2011-11-15 07:56:06 +00:00
|
|
|
proto_tree_add_item(cpha_tree, hf_src_machine_id, tvb, offset, 2, ENC_BIG_ENDIAN);
|
|
|
|
offset += 2;
|
2002-08-14 18:48:16 +00:00
|
|
|
|
2011-11-15 07:56:06 +00:00
|
|
|
proto_tree_add_item(cpha_tree, hf_dst_machine_id, tvb, offset, 2, ENC_BIG_ENDIAN);
|
|
|
|
offset += 2;
|
|
|
|
if(ha_version != 1) {/* 4.1 - no policy_id and filler*/
|
|
|
|
proto_tree_add_item(cpha_tree, hf_policy_id, tvb, offset, 2, ENC_BIG_ENDIAN);
|
|
|
|
offset += 2;
|
2002-08-28 21:04:11 +00:00
|
|
|
|
2011-11-15 07:56:06 +00:00
|
|
|
proto_tree_add_item(cpha_tree, hf_filler, tvb, offset, 2, ENC_BIG_ENDIAN);
|
|
|
|
offset += 2;
|
2002-08-14 18:48:16 +00:00
|
|
|
}
|
2011-11-15 07:56:06 +00:00
|
|
|
nti = proto_tree_add_item(cpha_tree, hf_payload, tvb, offset, -1, ENC_NA);
|
|
|
|
proto_item_append_text(nti, " - %s", val_to_str(opcode, opcode_type_vals, "Unknown %d"));
|
2002-08-14 18:48:16 +00:00
|
|
|
ntree = proto_item_add_subtree(nti, ett_cphap);
|
2002-08-28 21:04:11 +00:00
|
|
|
|
2002-08-14 18:48:16 +00:00
|
|
|
switch(opcode) {
|
2011-11-15 07:56:06 +00:00
|
|
|
case 1: dissect_my_state(tvb, offset, ntree); /* FWHAP_MY_STATE */
|
|
|
|
break;
|
|
|
|
case 2: break;
|
|
|
|
case 3: /* FWHAP_IF_PROBE_REQ */
|
|
|
|
case 4: dissect_probe(tvb, offset, ntree); /* FWHAP_IF_PROBE_RPLY */
|
|
|
|
break;
|
|
|
|
case 5: break;
|
|
|
|
case 6: dissect_conf_reply(tvb, offset, ntree); /* FWHAP_IFCONF_RPLY */
|
|
|
|
break;
|
|
|
|
case 7: dissect_lb_conf(tvb, offset, ntree); /* FWHAP_LB_CONF */
|
|
|
|
break;
|
|
|
|
case 9: dissect_policy_change(tvb, offset, ntree); /* FWHAP_POLICY_CHANGE */
|
|
|
|
break;
|
|
|
|
default: break;
|
2002-08-14 18:48:16 +00:00
|
|
|
}
|
|
|
|
}
|
2002-08-20 22:56:29 +00:00
|
|
|
|
2014-11-24 17:18:00 +00:00
|
|
|
return tvb_reported_length(tvb);
|
2002-08-14 18:48:16 +00:00
|
|
|
}
|
|
|
|
|
2011-10-26 18:02:01 +00:00
|
|
|
static int dissect_my_state(tvbuff_t * tvb, int offset, proto_tree * tree) {
|
2011-04-27 06:02:16 +00:00
|
|
|
int i;
|
2011-11-15 07:56:06 +00:00
|
|
|
proto_item * nti = NULL;
|
2002-08-14 18:48:16 +00:00
|
|
|
proto_tree * ntree = NULL;
|
2011-11-15 07:56:06 +00:00
|
|
|
guint16 report_code, id_num;
|
|
|
|
|
|
|
|
proto_tree_add_item(tree, hf_id_num, tvb, offset, 2, ENC_BIG_ENDIAN);
|
|
|
|
id_num = tvb_get_ntohs(tvb, offset);
|
|
|
|
offset += 2;
|
|
|
|
|
|
|
|
proto_tree_add_item(tree, hf_report_code, tvb, offset, 2, ENC_BIG_ENDIAN);
|
|
|
|
report_code = tvb_get_ntohs(tvb, offset);
|
|
|
|
offset += 2;
|
|
|
|
|
|
|
|
proto_tree_add_item(tree, hf_ha_mode, tvb, offset, 2, ENC_BIG_ENDIAN);
|
|
|
|
offset += 2;
|
|
|
|
|
|
|
|
proto_tree_add_item(tree, hf_ha_time_unit, tvb, offset, 2, ENC_BIG_ENDIAN);
|
|
|
|
offset += 2;
|
|
|
|
|
|
|
|
if (report_code & 1) {
|
|
|
|
/* states */
|
|
|
|
nti = proto_tree_add_item(tree, hf_machine_states, tvb, offset, id_num, ENC_NA);
|
|
|
|
ntree = proto_item_add_subtree(nti, ett_cphap);
|
|
|
|
for(i=0; i < id_num; i++) {
|
|
|
|
nti = proto_tree_add_item(ntree, hf_state_node, tvb, offset, 1, ENC_BIG_ENDIAN);
|
|
|
|
proto_item_append_text(nti, " (Nodes %d)", i);
|
|
|
|
offset += 1;
|
|
|
|
}
|
2002-08-14 18:48:16 +00:00
|
|
|
}
|
2011-11-15 07:56:06 +00:00
|
|
|
if (report_code & 2) {
|
|
|
|
/* interface information */
|
|
|
|
nti = proto_tree_add_item(tree, hf_interface_states, tvb, offset, 4, ENC_NA);
|
|
|
|
ntree = proto_item_add_subtree(nti, ett_cphap);
|
|
|
|
proto_tree_add_item(ntree, hf_in_up_num, tvb, offset, 1, ENC_BIG_ENDIAN);
|
|
|
|
offset += 1;
|
|
|
|
proto_tree_add_item(ntree, hf_in_assumed_up_num, tvb, offset, 1, ENC_BIG_ENDIAN);
|
|
|
|
offset += 1;
|
|
|
|
proto_tree_add_item(ntree, hf_out_up_num, tvb, offset, 1, ENC_BIG_ENDIAN);
|
|
|
|
offset += 1;
|
|
|
|
proto_tree_add_item(ntree, hf_out_assumed_up_num, tvb, offset, 1, ENC_BIG_ENDIAN);
|
|
|
|
offset += 1;
|
|
|
|
|
|
|
|
for(i=0; i < id_num; i++) {
|
|
|
|
proto_tree_add_item(tree, hf_cluster_last_packet, tvb, offset, 1, ENC_BIG_ENDIAN);
|
|
|
|
proto_item_append_text(nti, " (Cluster %d)", i);
|
|
|
|
offset += 1;
|
|
|
|
}
|
2002-08-14 18:48:16 +00:00
|
|
|
}
|
2011-11-15 07:56:06 +00:00
|
|
|
return offset;
|
2002-08-14 18:48:16 +00:00
|
|
|
}
|
|
|
|
|
2011-10-26 18:02:01 +00:00
|
|
|
static int dissect_lb_conf(tvbuff_t * tvb, int offset, proto_tree * tree) {
|
2002-08-14 18:48:16 +00:00
|
|
|
|
2011-11-15 07:56:06 +00:00
|
|
|
proto_tree_add_item(tree, hf_slot_num, tvb, offset, 2, ENC_BIG_ENDIAN);
|
|
|
|
offset += 2;
|
2002-08-14 18:48:16 +00:00
|
|
|
|
2011-11-15 07:56:06 +00:00
|
|
|
proto_tree_add_item(tree, hf_machine_num, tvb, offset, 2, ENC_BIG_ENDIAN);
|
|
|
|
offset += 2;
|
2002-08-14 18:48:16 +00:00
|
|
|
|
2011-11-15 07:56:06 +00:00
|
|
|
proto_tree_add_item(tree, hf_seed, tvb, offset, 4, ENC_BIG_ENDIAN);
|
|
|
|
offset += 4;
|
2002-08-14 18:48:16 +00:00
|
|
|
|
2011-11-15 07:56:06 +00:00
|
|
|
proto_tree_add_item(tree, hf_hash_len, tvb, offset, 4, ENC_BIG_ENDIAN);
|
|
|
|
offset += 4;
|
2002-08-14 18:48:16 +00:00
|
|
|
|
2011-10-26 18:02:01 +00:00
|
|
|
return offset;
|
2002-08-14 18:48:16 +00:00
|
|
|
}
|
|
|
|
|
2011-10-26 18:02:01 +00:00
|
|
|
static int dissect_policy_change(tvbuff_t * tvb, int offset, proto_tree * tree) {
|
2002-08-14 18:48:16 +00:00
|
|
|
|
2011-11-15 07:56:06 +00:00
|
|
|
proto_tree_add_item(tree, hf_status, tvb, offset, 4, ENC_BIG_ENDIAN);
|
|
|
|
offset += 4;
|
2011-10-26 18:02:01 +00:00
|
|
|
|
|
|
|
return offset;
|
2002-08-14 18:48:16 +00:00
|
|
|
}
|
|
|
|
|
2011-10-26 18:02:01 +00:00
|
|
|
static int dissect_probe(tvbuff_t * tvb, int offset, proto_tree * tree) {
|
2002-08-14 18:48:16 +00:00
|
|
|
|
2011-11-15 07:56:06 +00:00
|
|
|
proto_tree_add_item(tree, hf_ifn, tvb, offset, 4, ENC_BIG_ENDIAN);
|
|
|
|
offset += 4;
|
2002-08-14 18:48:16 +00:00
|
|
|
|
2011-11-15 07:56:06 +00:00
|
|
|
return offset;
|
2002-08-14 18:48:16 +00:00
|
|
|
}
|
|
|
|
|
2011-10-26 18:02:01 +00:00
|
|
|
static int dissect_conf_reply(tvbuff_t * tvb, int offset, proto_tree * tree) {
|
2002-08-28 21:04:11 +00:00
|
|
|
|
2011-11-15 07:56:06 +00:00
|
|
|
proto_tree_add_item(tree, hf_num_reported_ifs, tvb, offset, 4, ENC_BIG_ENDIAN);
|
|
|
|
offset += 4;
|
2002-08-28 21:04:11 +00:00
|
|
|
|
2011-11-15 07:56:06 +00:00
|
|
|
proto_tree_add_item(tree, hf_ethernet_add, tvb, offset, 6, ENC_NA);
|
2002-08-14 18:48:16 +00:00
|
|
|
offset += 6;
|
|
|
|
|
2011-11-15 07:56:06 +00:00
|
|
|
proto_tree_add_item(tree, hf_is_if_trusted, tvb, offset, 2, ENC_BIG_ENDIAN);
|
|
|
|
offset += 2;
|
2002-08-14 18:48:16 +00:00
|
|
|
|
2011-11-15 07:56:06 +00:00
|
|
|
proto_tree_add_item(tree, hf_ip, tvb, offset, 4, ENC_NA);
|
2002-08-14 18:48:16 +00:00
|
|
|
offset += 4;
|
2011-10-26 18:02:01 +00:00
|
|
|
|
|
|
|
return offset;
|
2002-08-14 18:48:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_register_cpha(void)
|
|
|
|
{
|
|
|
|
static hf_register_info hf[] = {
|
|
|
|
{ &hf_magic_number,
|
2011-11-15 07:56:06 +00:00
|
|
|
{ "Magic Number", "cpha.magic_number", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL}},
|
2002-08-14 18:48:16 +00:00
|
|
|
{ &hf_cpha_protocol_ver,
|
2014-11-24 16:16:52 +00:00
|
|
|
{ "Protocol Version", "cpha.version", FT_UINT16, BASE_DEC|BASE_EXT_STRING, &ha_version_vals_ext, 0x0, "CPHAP Version", HFILL}},
|
2002-08-14 18:48:16 +00:00
|
|
|
{ &hf_cluster_number,
|
2009-03-29 22:16:26 +00:00
|
|
|
{ "Cluster Number", "cpha.cluster_number", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}},
|
2002-08-14 18:48:16 +00:00
|
|
|
{ &hf_opcode,
|
2011-11-15 07:56:06 +00:00
|
|
|
{ "HA OpCode", "cpha.opcode", FT_UINT16, BASE_DEC, VALS(opcode_type_vals), 0x0, NULL, HFILL}},
|
|
|
|
{ &hf_payload,
|
|
|
|
{ "Payload", "cpha.payload", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL}},
|
2002-08-14 18:48:16 +00:00
|
|
|
{ &hf_src_if_num,
|
2009-03-29 22:16:26 +00:00
|
|
|
{ "Source Interface", "cpha.src_if", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}},
|
2002-08-14 18:48:16 +00:00
|
|
|
{ &hf_random_id,
|
2009-03-29 22:16:26 +00:00
|
|
|
{ "Random ID", "cpha.random_id", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}},
|
2002-08-14 18:48:16 +00:00
|
|
|
{ &hf_src_machine_id,
|
2009-03-29 22:16:26 +00:00
|
|
|
{ "Source Machine ID", "cpha.src_id", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}},
|
2002-08-14 18:48:16 +00:00
|
|
|
{ &hf_dst_machine_id,
|
2009-03-29 22:16:26 +00:00
|
|
|
{ "Destination Machine ID", "cpha.dst_id", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}},
|
2002-08-14 18:48:16 +00:00
|
|
|
{ &hf_policy_id,
|
2009-03-29 22:16:26 +00:00
|
|
|
{ "Policy ID", "cpha.policy_id", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}},
|
2002-08-14 18:48:16 +00:00
|
|
|
{ &hf_filler,
|
2009-03-29 22:16:26 +00:00
|
|
|
{ "Filler", "cpha.filler", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}},
|
2002-08-14 18:48:16 +00:00
|
|
|
{ &hf_id_num,
|
2009-03-29 22:16:26 +00:00
|
|
|
{ "Number of IDs reported", "cpha.id_num", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL}},
|
2002-08-14 18:48:16 +00:00
|
|
|
{ &hf_report_code,
|
2012-01-19 20:19:28 +00:00
|
|
|
{ "Report code", "cpha.report_code", FT_UINT16, BASE_DEC, VALS(report_code_vals), 0x0, NULL, HFILL}},
|
2002-08-14 18:48:16 +00:00
|
|
|
{ &hf_ha_mode,
|
2011-11-15 07:56:06 +00:00
|
|
|
{ "HA mode", "cpha.ha_mode", FT_UINT16, BASE_DEC, VALS(ha_mode_vals), 0x0, NULL, HFILL}},
|
2002-08-14 18:48:16 +00:00
|
|
|
{ &hf_ha_time_unit,
|
2007-08-23 23:58:59 +00:00
|
|
|
{ "HA Time unit", "cpha.ha_time_unit", FT_UINT16, BASE_DEC, NULL, 0x0, "HA Time unit (ms)", HFILL}},
|
2011-11-15 07:56:06 +00:00
|
|
|
{ &hf_machine_states,
|
|
|
|
{ "Machines States", "cpha.machine_states", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL}},
|
|
|
|
{ &hf_state_node,
|
|
|
|
{ "State node", "cpha.state_node", FT_UINT8, BASE_DEC, VALS(state_vals), 0x0, NULL, HFILL}},
|
|
|
|
{ &hf_interface_states,
|
|
|
|
{ "Interface States", "cpha.interface_states", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL}},
|
2002-08-14 18:48:16 +00:00
|
|
|
{ &hf_num_reported_ifs,
|
2009-03-29 22:16:26 +00:00
|
|
|
{ "Reported Interfaces", "cpha.reported_ifs", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}},
|
2002-08-14 18:48:16 +00:00
|
|
|
{ &hf_ethernet_add,
|
2009-07-07 09:02:59 +00:00
|
|
|
{ "Ethernet Address", "cpha.ethernet_addr", FT_ETHER, BASE_NONE, NULL, 0x0, NULL, HFILL}},
|
2002-08-14 18:48:16 +00:00
|
|
|
{ &hf_is_if_trusted,
|
2009-05-08 20:35:57 +00:00
|
|
|
{ "Interface Trusted", "cpha.if_trusted", FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL}},
|
2002-08-14 18:48:16 +00:00
|
|
|
{ &hf_ip,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
{ "IP Address", "cpha.ip", FT_IPv4, BASE_NONE, NULL, 0x0, NULL, HFILL}},
|
2002-08-14 18:48:16 +00:00
|
|
|
{ &hf_slot_num,
|
2009-03-29 22:16:26 +00:00
|
|
|
{ "Slot Number", "cpha.slot_num", FT_INT16, BASE_DEC, NULL, 0x0, NULL, HFILL}},
|
2002-08-28 21:04:11 +00:00
|
|
|
{ &hf_machine_num,
|
2009-03-29 22:16:26 +00:00
|
|
|
{ "Machine Number", "cpha.machine_num", FT_INT16, BASE_DEC, NULL, 0x0, NULL, HFILL}},
|
2002-08-14 18:48:16 +00:00
|
|
|
{ &hf_seed,
|
2009-03-29 22:16:26 +00:00
|
|
|
{ "Seed", "cpha.seed", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}},
|
2002-08-14 18:48:16 +00:00
|
|
|
{ &hf_hash_len,
|
2009-03-29 22:16:26 +00:00
|
|
|
{ "Hash list length", "cpha.hash_len", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL}},
|
2002-08-14 18:48:16 +00:00
|
|
|
{ &hf_in_up_num,
|
2009-03-29 22:16:26 +00:00
|
|
|
{ "Interfaces up in the Inbound", "cpha.in_up", FT_INT8, BASE_DEC, NULL, 0x0, NULL, HFILL}},
|
2002-08-14 18:48:16 +00:00
|
|
|
{ &hf_in_assumed_up_num,
|
2009-03-29 22:16:26 +00:00
|
|
|
{ "Interfaces assumed up in the Inbound", "cpha.in_assume_up", FT_INT8, BASE_DEC, NULL, 0x0, NULL, HFILL}},
|
2002-08-14 18:48:16 +00:00
|
|
|
{ &hf_out_up_num,
|
2009-03-29 22:16:26 +00:00
|
|
|
{ "Interfaces up in the Outbound", "cpha.out_up", FT_INT8, BASE_DEC, NULL, 0x0, NULL, HFILL}},
|
2002-08-28 21:04:11 +00:00
|
|
|
{ &hf_out_assumed_up_num,
|
2009-03-29 22:16:26 +00:00
|
|
|
{ "Interfaces assumed up in the Outbound", "cpha.out_assume_up", FT_INT8, BASE_DEC, NULL, 0x0, NULL, HFILL}},
|
2011-11-15 07:56:06 +00:00
|
|
|
{ &hf_cluster_last_packet,
|
|
|
|
{ "Last packet seen", "cpha.cluster_last_packet", FT_INT8, BASE_DEC, NULL, 0x0, "Time units ago", HFILL}},
|
2002-08-14 18:48:16 +00:00
|
|
|
{ &hf_status,
|
2009-03-29 22:16:26 +00:00
|
|
|
{ "Status", "cpha.status", FT_UINT32, BASE_DEC, VALS(status_vals), 0x0, NULL, HFILL}},
|
2002-08-28 21:04:11 +00:00
|
|
|
{ &hf_ifn,
|
2009-03-29 22:16:26 +00:00
|
|
|
{ "Interface Number", "cpha.ifn", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL}},
|
2002-08-14 18:48:16 +00:00
|
|
|
};
|
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_cphap,
|
|
|
|
};
|
2002-08-28 21:04:11 +00:00
|
|
|
|
2002-08-14 18:48:16 +00:00
|
|
|
proto_cphap = proto_register_protocol("Check Point High Availability Protocol",
|
2011-11-15 07:56:06 +00:00
|
|
|
"CPHA", "cpha");
|
2002-08-14 18:48:16 +00:00
|
|
|
proto_register_field_array(proto_cphap, hf, array_length(hf));
|
2002-08-28 21:04:11 +00:00
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
2002-08-14 18:48:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_reg_handoff_cpha(void)
|
|
|
|
{
|
|
|
|
dissector_handle_t cpha_handle;
|
|
|
|
|
2002-08-20 22:56:29 +00:00
|
|
|
cpha_handle = new_create_dissector_handle(dissect_cpha, proto_cphap);
|
2010-12-20 05:35:29 +00:00
|
|
|
dissector_add_uint("udp.port", UDP_PORT_CPHA, cpha_handle);
|
2002-08-14 18:48:16 +00:00
|
|
|
}
|
2011-11-15 07:56:06 +00:00
|
|
|
/*
|
|
|
|
* 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:
|
|
|
|
*/
|