2 * Routines for the disassembly of HP ProCurve encapsulated remote mirroring frames
3 * (Adapted from packet-cisco-erspan.c and packet-vlan.c)
7 * Copyright 2010 2012 William Meier <wmeier [AT] newsguy.com>,
8 * Zdravko Velinov <z.velinov [AT] vkv5.com>
10 * Wireshark - Network traffic analyzer
11 * By Gerald Combs <gerald@wireshark.org>
12 * Copyright 1998 Gerald Combs
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version 2
17 * of the License, or (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
30 * For some information on HP Procurve encapsulated remote mirroring see
31 * "Traffic Mirroring" in Appendix B of the HP manual
32 * "Management and Configuration Guide for the ProCurve Series
33 * 3500, 3500yl, 5400zl, 6200yl, 6600, and 8200zl Switches (September 2009)"
36 * The above manual indicates that the encapsulatedmirrored frame is transmitted
37 * on the network as a [UDP] packet which has 54 bytes preceding the mirrored frame.
38 * Examining a sample capture shows that this means that the data payload
39 * of the UDP packet consists of a 12 byte "header" followed by the
40 * bytes of the mirrored frame.
42 * After some additional tests, which involved injecting 802.1Q frames with
43 * different priorities and VLAN identifiers. It was determined that the HP
44 * ERM header has a part inside its header that closely resembles the 802.1Q
45 * header. The only difference is the priority numbering.
51 #include <epan/packet.h>
52 #include <epan/prefs.h>
54 #define PROTO_SHORT_NAME "HP_ERM"
55 #define PROTO_LONG_NAME "HP encapsulated remote mirroring"
57 static guint global_hp_erm_udp_port
= 0;
59 static int proto_hp_erm
= -1;
60 static gint ett_hp_erm
= -1;
61 static int hf_hp_erm_unknown1
= -1;
62 static int hf_hp_erm_unknown2
= -1;
63 static int hf_hp_erm_unknown3
= -1;
64 static int hf_hp_erm_priority
= -1;
65 static int hf_hp_erm_cfi
= -1;
66 static int hf_hp_erm_vlan
= -1;
68 static const value_string hp_erm_pri_vals
[] = {
71 { 2, "Best Effort (default)" },
72 { 3, "Excellent Effort" },
73 { 4, "Controlled Load" },
74 { 5, "Video, < 100ms latency and jitter" },
75 { 6, "Voice, < 10ms latency and jitter" },
76 { 7, "Network Control" },
80 static const value_string hp_erm_cfi_vals
[] = {
82 { 1, "Non-canonical" },
86 static dissector_handle_t eth_withoutfcs_handle
;
89 dissect_hp_erm(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
92 proto_tree
*hp_erm_tree
= NULL
;
96 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, PROTO_SHORT_NAME
);
97 col_set_str(pinfo
->cinfo
, COL_INFO
, PROTO_SHORT_NAME
":");
100 ti
= proto_tree_add_item(tree
, proto_hp_erm
, tvb
, 0, -1, ENC_NA
);
101 hp_erm_tree
= proto_item_add_subtree(ti
, ett_hp_erm
);
104 proto_tree_add_item(hp_erm_tree
, hf_hp_erm_unknown1
, tvb
, offset
, 8, ENC_NA
);
107 proto_tree_add_item(hp_erm_tree
, hf_hp_erm_unknown2
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
108 proto_tree_add_item(hp_erm_tree
, hf_hp_erm_priority
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
109 proto_tree_add_item(hp_erm_tree
, hf_hp_erm_cfi
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
110 proto_tree_add_item(hp_erm_tree
, hf_hp_erm_vlan
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
111 proto_tree_add_item(hp_erm_tree
, hf_hp_erm_unknown3
, tvb
, offset
, 4, ENC_BIG_ENDIAN
);
115 eth_tvb
= tvb_new_subset_remaining(tvb
, offset
);
116 call_dissector(eth_withoutfcs_handle
, eth_tvb
, pinfo
, tree
);
120 proto_register_hp_erm(void)
122 void proto_reg_handoff_hp_erm(void);
124 static hf_register_info hf
[] = {
126 { &hf_hp_erm_unknown1
,
127 { "Unknown1", "hp_erm.unknown1", FT_BYTES
, BASE_NONE
, NULL
,
130 { &hf_hp_erm_unknown2
,
131 { "Unknown2", "hp_erm.unknown2", FT_UINT32
, BASE_DEC
, NULL
,
132 0xFF000000, NULL
, HFILL
}},
134 { &hf_hp_erm_priority
,
135 { "Priority", "hp_erm.priority", FT_UINT32
, BASE_DEC
, VALS(hp_erm_pri_vals
),
136 0x00E00000, NULL
, HFILL
}},
139 { "CFI", "hp_erm.cfi", FT_UINT32
, BASE_DEC
, VALS(hp_erm_cfi_vals
),
140 0x00100000, NULL
, HFILL
}},
143 { "Vlan", "hp_erm.vlan", FT_UINT32
, BASE_DEC
, NULL
,
144 0x000FFF00, NULL
, HFILL
}},
146 { &hf_hp_erm_unknown3
,
147 { "Unknown3", "hp_erm.unknown3", FT_UINT32
, BASE_DEC
, NULL
,
148 0x000000FF, NULL
, HFILL
}}
151 static gint
*ett
[] = {
155 module_t
*hp_erm_module
;
157 proto_hp_erm
= proto_register_protocol(PROTO_LONG_NAME
, PROTO_SHORT_NAME
, "hp_erm");
159 hp_erm_module
= prefs_register_protocol(proto_hp_erm
, proto_reg_handoff_hp_erm
);
160 prefs_register_uint_preference(hp_erm_module
, "udp.port", "HP_ERM UDP Port",
161 "Set the UDP port (source or destination) used for HP"
162 " encapsulated remote mirroring frames;\n"
163 "0 (default) means that the HP_ERM dissector is not active",
164 10, &global_hp_erm_udp_port
);
166 proto_register_field_array(proto_hp_erm
, hf
, array_length(hf
));
167 proto_register_subtree_array(ett
, array_length(ett
));
171 proto_reg_handoff_hp_erm(void)
173 static dissector_handle_t hp_erm_handle
;
174 static guint hp_erm_udp_port
;
175 static gboolean initialized
= FALSE
;
178 eth_withoutfcs_handle
= find_dissector("eth_withoutfcs");
179 hp_erm_handle
= create_dissector_handle(dissect_hp_erm
, proto_hp_erm
);
182 if (hp_erm_udp_port
!= 0)
183 dissector_delete_uint("udp.port", hp_erm_udp_port
, hp_erm_handle
);
186 hp_erm_udp_port
= global_hp_erm_udp_port
;
188 if (hp_erm_udp_port
!= 0)
189 dissector_add_uint("udp.port", hp_erm_udp_port
, hp_erm_handle
);
197 * indent-tabs-mode: nil
200 * ex: set shiftwidth=4 tabstop=8 expandtab:
201 * :indentSize=4:tabSize=8:noTabs=true: