2 * Routines for ISMP dissection
3 * Enterasys Networks Home: http://www.enterasys.com/
4 * Copyright 2003, Joshua Craig Douglas <jdouglas@enterasys.com>
8 * Wireshark - Network traffic analyzer
9 * By Gerald Combs <gerald@wireshark.org>
10 * Copyright 1998 Gerald Combs
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
31 #include <epan/packet.h>
32 #include <epan/to_str.h>
33 #include <epan/strutil.h>
34 #include <epan/etypes.h>
36 void proto_register_ismp(void);
37 void proto_reg_handoff_ismp(void);
39 /* Initialize the protocol and registered fields */
40 static int proto_ismp = -1;
41 static int hf_ismp_version = -1;
42 static int hf_ismp_message_type = -1;
43 static int hf_ismp_seq_num = -1;
44 static int hf_ismp_code_length = -1;
45 static int hf_ismp_auth_data = -1;
47 /* Enterasys/Cabletron Dicovery Protocol fields*/
48 static int hf_ismp_edp = -1;
49 static int hf_ismp_edp_version = -1;
50 static int hf_ismp_edp_module_ip = -1;
51 static int hf_ismp_edp_module_mac = -1;
52 static int hf_ismp_edp_module_port = -1;
53 static int hf_ismp_edp_chassis_mac =-1;
54 static int hf_ismp_edp_chassis_ip = -1;
55 static int hf_ismp_edp_device_type = -1;
56 static int hf_ismp_edp_module_rev = -1;
57 static int hf_ismp_edp_options = -1;
58 static int hf_ismp_edp_sfs_option_unused1 = -1;
59 static int hf_ismp_edp_sfs_option_sfssup = -1;
60 static int hf_ismp_edp_sfs_option_lsp = -1;
61 static int hf_ismp_edp_sfs_option_flood = -1;
62 static int hf_ismp_edp_sfs_option_resolve = -1;
63 static int hf_ismp_edp_sfs_option_unused2 = -1;
64 static int hf_ismp_edp_sfs_option_tagflood = -1;
65 static int hf_ismp_edp_sfs_option_calltap = -1;
66 static int hf_ismp_edp_sfs_option_conmsg = -1;
67 static int hf_ismp_edp_sfs_option_redun = -1;
68 static int hf_ismp_edp_sfs_option_isolated = -1;
69 static int hf_ismp_edp_sfs_option_uplink_switch = -1;
70 static int hf_ismp_edp_sfs_option_uplink_core = -1;
71 static int hf_ismp_edp_sfs_option_uplink_port = -1;
72 static int hf_ismp_edp_sfs_option_uplink_flood = -1;
73 static int hf_ismp_edp_rtr_option_ssr = -1;
74 static int hf_ismp_edp_rtr_option_igmp = -1;
75 static int hf_ismp_edp_rtr_option_rip = -1;
76 static int hf_ismp_edp_rtr_option_bgp = -1;
77 static int hf_ismp_edp_rtr_option_ospf = -1;
78 static int hf_ismp_edp_rtr_option_dvmrp = -1;
79 static int hf_ismp_edp_rtr_option_8021q = -1;
80 static int hf_ismp_edp_rtr_option_gvrp = -1;
81 static int hf_ismp_edp_rtr_option_gmrp = -1;
82 static int hf_ismp_edp_rtr_option_igmp_snoop = -1;
83 static int hf_ismp_edp_rtr_option_route = -1;
84 static int hf_ismp_edp_rtr_option_trans = -1;
85 static int hf_ismp_edp_rtr_option_level1 = -1;
86 static int hf_ismp_edp_switch_option_8021q = -1;
87 static int hf_ismp_edp_switch_option_gvrp = -1;
88 static int hf_ismp_edp_switch_option_gmrp = -1;
89 static int hf_ismp_edp_switch_option_igmp = -1;
90 static int hf_ismp_edp_switch_option_route = -1;
91 static int hf_ismp_edp_switch_option_trans = -1;
92 static int hf_ismp_edp_switch_option_level1 = -1;
93 static int hf_ismp_edp_end_station_option_dhcp = -1;
94 static int hf_ismp_edp_end_station_option_dns = -1;
95 static int hf_ismp_edp_end_station_option_ad = -1;
96 static int hf_ismp_edp_num_neighbors = -1;
97 static int hf_ismp_edp_neighbors = -1;
98 static int hf_ismp_edp_num_tuples = -1;
99 static int hf_ismp_edp_tuples = -1;
102 /* Initialize the subtree pointers */
103 static gint ett_ismp = -1;
104 static gint ett_ismp_edp = -1;
105 static gint ett_ismp_edp_options = -1;
106 static gint ett_ismp_edp_neighbors = -1;
107 static gint ett_ismp_edp_neighbors_leaf = -1;
108 static gint ett_ismp_edp_tuples = -1;
109 static gint ett_ismp_edp_tuples_leaf = -1;
112 #define ISMPTYPE_EDP 2
115 /* EDP DEVICE TYPES */
116 #define EDP_DEVICE_TYPE_SFS17 1
117 #define EDP_DEVICE_TYPE_SFS18 2
118 #define EDP_DEVICE_TYPE_ROUTER 3
119 #define EDP_DEVICE_TYPE_BRIDGE 4
120 #define EDP_DEVICE_TYPE_VLANMAN 5
121 #define EDP_DEVICE_TYPE_NTSERVER 6
122 #define EDP_DEVICE_TYPE_NTCLIENT 7
123 #define EDP_DEVICE_TYPE_WIN95 8
124 #define EDP_DEVICE_TYPE_WIN98 9
125 #define EDP_DEVICE_TYPE_UNIXSERVER 10
126 #define EDP_DEVICE_TYPE_UNIXCLIENT 11
127 #define EDP_DEVICE_TYPE_ACCESSPOINT 12
130 static const value_string edp_device_types[] = {
131 { EDP_DEVICE_TYPE_SFS17, "Network Switch running SecureFast version 1.7 or lower" },
132 { EDP_DEVICE_TYPE_SFS18, "Network Switch running SecureFast version 1.8 or greater" },
133 { EDP_DEVICE_TYPE_ROUTER, "Router" },
134 { EDP_DEVICE_TYPE_BRIDGE, "Bridge" },
135 { EDP_DEVICE_TYPE_VLANMAN, "Cabletron VLAN Manager" },
136 { EDP_DEVICE_TYPE_NTSERVER, "Network Server (NT)" },
137 { EDP_DEVICE_TYPE_NTCLIENT, "Network Workstation (NT)" },
138 { EDP_DEVICE_TYPE_WIN95, "Windows95" },
139 { EDP_DEVICE_TYPE_WIN98, "Windows98" },
140 { EDP_DEVICE_TYPE_UNIXSERVER, "UNIX Server" },
141 { EDP_DEVICE_TYPE_UNIXCLIENT, "UNIX Workstation" },
142 { EDP_DEVICE_TYPE_ACCESSPOINT, "Roamabout wireless access point" },
147 /* EDP SFS Options */
148 #define EDP_SFS_OPTION_UNUSED1 0x1
149 #define EDP_SFS_OPTION_SFSSUP 0x2
150 #define EDP_SFS_OPTION_LSP 0x4
151 #define EDP_SFS_OPTION_FLOOD 0x8
152 #define EDP_SFS_OPTION_RESOLVE 0x10
153 #define EDP_SFS_OPTION_UNUSED2 0x20
154 #define EDP_SFS_OPTION_TAGFLOOD 0x40
155 #define EDP_SFS_OPTION_CALLTAP 0x80
156 #define EDP_SFS_OPTION_CONMSG 0x100
157 #define EDP_SFS_OPTION_REDUN 0x200
158 #define EDP_SFS_OPTION_ISOLATED 0x400
159 #define EDP_SFS_OPTION_UPLINK_SWITCH 0x800
160 #define EDP_SFS_OPTION_UPLINK_CORE 0x1000
161 #define EDP_SFS_OPTION_UPLINK_PORT 0x2000
162 #define EDP_SFS_OPTION_UPLINK_FLOOD 0x4000
164 /* EDP Router Options */
165 #define EDP_RTR_OPTION_SSR 0x1
166 #define EDP_RTR_OPTION_IGMP 0x2
167 #define EDP_RTR_OPTION_RIP 0x4
168 #define EDP_RTR_OPTION_BGP 0x8
169 #define EDP_RTR_OPTION_OSPF 0x10
170 #define EDP_RTR_OPTION_DVMRP 0x20
171 #define EDP_RTR_OPTION_8021Q 0x40
172 #define EDP_RTR_OPTION_GVRP 0x80
173 #define EDP_RTR_OPTION_GMRP 0x100
174 #define EDP_RTR_OPTION_IGMP_SNOOP 0x200
175 #define EDP_RTR_OPTION_ROUTE 0x400
176 #define EDP_RTR_OPTION_TRANS 0x800
177 #define EDP_RTR_OPTION_LEVEL1 0x1000
179 /* EDP Switch Options */
180 #define EDP_SWITCH_OPTION_8021Q 0x1
181 #define EDP_SWITCH_OPTION_GVRP 0x2
182 #define EDP_SWITCH_OPTION_GMRP 0x4
183 #define EDP_SWITCH_OPTION_IGMP 0x8
184 #define EDP_SWITCH_OPTION_ROUTE 0x10
185 #define EDP_SWITCH_OPTION_TRANS 0x20
186 #define EDP_SWITCH_OPTION_LEVEL1 0x40
188 /* EDP End Station and Server Options */
189 #define EDP_END_STATION_OPTION_DHCP 0x1
190 #define EDP_END_STATION_OPTION_DNS 0x2
191 #define EDP_END_STATION_OPTION_AD 0x4
193 /* EDP Tuple Types */
194 #define EDP_TUPLE_UNKNOWN 0
195 #define EDP_TUPLE_HOLD 1
196 #define EDP_TUPLE_INT_NAME 2
197 #define EDP_TUPLE_SYS_DESCRIPT 3
198 #define EDP_TUPLE_IPX_ADDR 4
200 static const value_string edp_tuple_types[] =
202 { EDP_TUPLE_UNKNOWN,"Unknown" },
203 { EDP_TUPLE_HOLD,"Hold Time" },
204 { EDP_TUPLE_INT_NAME,"Interface Name" },
205 { EDP_TUPLE_SYS_DESCRIPT,"System Description" },
206 { EDP_TUPLE_IPX_ADDR,"IPX Address" },
211 static const true_false_string is_set = {
217 /* Function to dissect EDP portion of ISMP message */
219 dissect_ismp_edp(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *ismp_tree)
221 /* local variables used for EDP dissection */
222 int neighbors_count = 0;
223 int tuples_count = 0;
224 guint16 device_type = 0;
226 guint16 num_neighbors = 0;
227 guint16 num_tuples = 0;
228 guint16 tuple_type = 0;
229 guint16 tuple_length = 0;
231 /* Set up structures needed to add the protocol subtree and manage it */
233 proto_tree *edp_tree;
235 proto_item *edp_options_ti;
236 proto_tree *edp_options_tree;
238 proto_item *edp_neighbors_ti;
239 proto_tree *edp_neighbors_tree;
241 proto_item *edp_neighbors_leaf_ti;
242 proto_tree *edp_neighbors_leaf_tree;
244 proto_item *edp_tuples_ti;
245 proto_tree *edp_tuples_tree;
247 proto_item *edp_tuples_leaf_ti;
248 proto_tree *edp_tuples_leaf_tree;
250 /* add column iformation marking this as EDP (Enterasys Discover Protocol */
251 col_set_str(pinfo->cinfo, COL_PROTOCOL, "ISMP.EDP");
252 col_clear(pinfo->cinfo, COL_INFO);
254 /* create display subtree for EDP */
256 edp_ti = proto_tree_add_item(ismp_tree, hf_ismp_edp, tvb, offset,
257 tvb_length_remaining(tvb, offset), ENC_NA);
258 edp_tree = proto_item_add_subtree(edp_ti, ett_ismp_edp);
260 col_add_fstr(pinfo->cinfo, COL_INFO, "MIP %s, MMAC %s, ifIdx %d",
261 tvb_ip_to_str(tvb, offset+2),
262 tvb_ether_to_str(tvb, offset+6),
263 tvb_get_ntohl(tvb, offset+12));
265 proto_tree_add_item(edp_tree, hf_ismp_edp_version, tvb, offset, 2, ENC_BIG_ENDIAN);
267 proto_tree_add_item(edp_tree, hf_ismp_edp_module_ip, tvb, offset, 4, ENC_BIG_ENDIAN);
269 proto_tree_add_item(edp_tree, hf_ismp_edp_module_mac, tvb, offset, 6, ENC_NA);
271 proto_tree_add_item(edp_tree, hf_ismp_edp_module_port, tvb, offset, 4, ENC_BIG_ENDIAN);
273 proto_tree_add_item(edp_tree, hf_ismp_edp_chassis_mac, tvb, offset, 6, ENC_NA);
275 proto_tree_add_item(edp_tree, hf_ismp_edp_chassis_ip, tvb, offset, 4, ENC_BIG_ENDIAN);
277 device_type = tvb_get_ntohs(tvb, offset);
278 proto_tree_add_item(edp_tree, hf_ismp_edp_device_type, tvb, offset, 2, ENC_BIG_ENDIAN);
280 proto_tree_add_uint_format_value(edp_tree, hf_ismp_edp_module_rev, tvb, offset, 4, tvb_get_ntohl(tvb, offset),
281 "%02x.%02x.%02x.%02x", tvb_get_guint8(tvb, offset),
282 tvb_get_guint8(tvb, offset+1), tvb_get_guint8(tvb, offset+2), tvb_get_guint8(tvb, offset+3));
285 /* create display subtree for EDP options */
286 options = tvb_get_ntohl(tvb, offset);
287 edp_options_ti = proto_tree_add_uint_format(edp_tree, hf_ismp_edp_options, tvb, offset, 4,
288 options,"Options: 0x%08x",options);
289 edp_options_tree = proto_item_add_subtree(edp_options_ti, ett_ismp_edp_options);
291 /* depending on device_type, show the appropriate options */
292 switch (device_type) {
293 case EDP_DEVICE_TYPE_SFS17:
294 case EDP_DEVICE_TYPE_SFS18:
295 proto_tree_add_item(edp_options_tree, hf_ismp_edp_sfs_option_uplink_flood, tvb, offset, 4, ENC_BIG_ENDIAN);
296 proto_tree_add_item(edp_options_tree, hf_ismp_edp_sfs_option_uplink_port, tvb, offset, 4, ENC_BIG_ENDIAN);
297 proto_tree_add_item(edp_options_tree, hf_ismp_edp_sfs_option_uplink_core, tvb, offset, 4, ENC_BIG_ENDIAN);
298 proto_tree_add_item(edp_options_tree, hf_ismp_edp_sfs_option_uplink_switch, tvb, offset, 4, ENC_BIG_ENDIAN);
299 proto_tree_add_item(edp_options_tree, hf_ismp_edp_sfs_option_isolated, tvb, offset, 4, ENC_BIG_ENDIAN);
300 proto_tree_add_item(edp_options_tree, hf_ismp_edp_sfs_option_redun, tvb, offset, 4, ENC_BIG_ENDIAN);
301 proto_tree_add_item(edp_options_tree, hf_ismp_edp_sfs_option_conmsg, tvb, offset, 4, ENC_BIG_ENDIAN);
302 proto_tree_add_item(edp_options_tree, hf_ismp_edp_sfs_option_calltap, tvb, offset, 4, ENC_BIG_ENDIAN);
303 proto_tree_add_item(edp_options_tree, hf_ismp_edp_sfs_option_tagflood, tvb, offset, 4, ENC_BIG_ENDIAN);
304 proto_tree_add_item(edp_options_tree, hf_ismp_edp_sfs_option_unused2, tvb, offset, 4, ENC_BIG_ENDIAN);
305 proto_tree_add_item(edp_options_tree, hf_ismp_edp_sfs_option_resolve, tvb, offset, 4, ENC_BIG_ENDIAN);
306 proto_tree_add_item(edp_options_tree, hf_ismp_edp_sfs_option_flood, tvb, offset, 4, ENC_BIG_ENDIAN);
307 proto_tree_add_item(edp_options_tree, hf_ismp_edp_sfs_option_lsp, tvb, offset, 4, ENC_BIG_ENDIAN);
308 proto_tree_add_item(edp_options_tree, hf_ismp_edp_sfs_option_sfssup, tvb, offset, 4, ENC_BIG_ENDIAN);
309 proto_tree_add_item(edp_options_tree, hf_ismp_edp_sfs_option_unused1, tvb, offset, 4, ENC_BIG_ENDIAN);
311 case EDP_DEVICE_TYPE_ROUTER:
312 proto_tree_add_item(edp_options_tree, hf_ismp_edp_rtr_option_level1, tvb, offset, 4, ENC_BIG_ENDIAN);
313 proto_tree_add_item(edp_options_tree, hf_ismp_edp_rtr_option_trans, tvb, offset, 4, ENC_BIG_ENDIAN);
314 proto_tree_add_item(edp_options_tree, hf_ismp_edp_rtr_option_route, tvb, offset, 4, ENC_BIG_ENDIAN);
315 proto_tree_add_item(edp_options_tree, hf_ismp_edp_rtr_option_igmp_snoop, tvb, offset, 4, ENC_BIG_ENDIAN);
316 proto_tree_add_item(edp_options_tree, hf_ismp_edp_rtr_option_gmrp, tvb, offset, 4, ENC_BIG_ENDIAN);
317 proto_tree_add_item(edp_options_tree, hf_ismp_edp_rtr_option_gvrp, tvb, offset, 4, ENC_BIG_ENDIAN);
318 proto_tree_add_item(edp_options_tree, hf_ismp_edp_rtr_option_8021q, tvb, offset, 4, ENC_BIG_ENDIAN);
319 proto_tree_add_item(edp_options_tree, hf_ismp_edp_rtr_option_dvmrp, tvb, offset, 4, ENC_BIG_ENDIAN);
320 proto_tree_add_item(edp_options_tree, hf_ismp_edp_rtr_option_ospf, tvb, offset, 4, ENC_BIG_ENDIAN);
321 proto_tree_add_item(edp_options_tree, hf_ismp_edp_rtr_option_bgp, tvb, offset, 4, ENC_BIG_ENDIAN);
322 proto_tree_add_item(edp_options_tree, hf_ismp_edp_rtr_option_rip, tvb, offset, 4, ENC_BIG_ENDIAN);
323 proto_tree_add_item(edp_options_tree, hf_ismp_edp_rtr_option_igmp, tvb, offset, 4, ENC_BIG_ENDIAN);
324 proto_tree_add_item(edp_options_tree, hf_ismp_edp_rtr_option_ssr, tvb, offset, 4, ENC_BIG_ENDIAN);
326 case EDP_DEVICE_TYPE_BRIDGE:
327 proto_tree_add_item(edp_options_tree, hf_ismp_edp_switch_option_level1, tvb, offset, 4, ENC_BIG_ENDIAN);
328 proto_tree_add_item(edp_options_tree, hf_ismp_edp_switch_option_trans, tvb, offset, 4, ENC_BIG_ENDIAN);
329 proto_tree_add_item(edp_options_tree, hf_ismp_edp_switch_option_route, tvb, offset, 4, ENC_BIG_ENDIAN);
330 proto_tree_add_item(edp_options_tree, hf_ismp_edp_switch_option_igmp, tvb, offset, 4, ENC_BIG_ENDIAN);
331 proto_tree_add_item(edp_options_tree, hf_ismp_edp_switch_option_gmrp, tvb, offset, 4, ENC_BIG_ENDIAN);
332 proto_tree_add_item(edp_options_tree, hf_ismp_edp_switch_option_gvrp, tvb, offset, 4, ENC_BIG_ENDIAN);
333 proto_tree_add_item(edp_options_tree, hf_ismp_edp_switch_option_8021q, tvb, offset, 4, ENC_BIG_ENDIAN);
335 case EDP_DEVICE_TYPE_VLANMAN:
337 case EDP_DEVICE_TYPE_NTSERVER:
338 case EDP_DEVICE_TYPE_NTCLIENT:
339 case EDP_DEVICE_TYPE_WIN95:
340 case EDP_DEVICE_TYPE_WIN98:
341 case EDP_DEVICE_TYPE_UNIXSERVER:
342 case EDP_DEVICE_TYPE_UNIXCLIENT:
343 proto_tree_add_item(edp_options_tree, hf_ismp_edp_end_station_option_ad, tvb, offset, 4, ENC_BIG_ENDIAN);
344 proto_tree_add_item(edp_options_tree, hf_ismp_edp_end_station_option_dns, tvb, offset, 4, ENC_BIG_ENDIAN);
345 proto_tree_add_item(edp_options_tree, hf_ismp_edp_end_station_option_dhcp, tvb, offset, 4, ENC_BIG_ENDIAN);
347 case EDP_DEVICE_TYPE_ACCESSPOINT:
353 /* determine the number of neighbors and create EDP neighbors subtree */
354 num_neighbors = tvb_get_ntohs(tvb, offset);
355 proto_tree_add_item(edp_tree, hf_ismp_edp_num_neighbors, tvb, offset, 2, ENC_BIG_ENDIAN);
357 if (num_neighbors > 0)
359 edp_neighbors_ti = proto_tree_add_item(edp_tree, hf_ismp_edp_neighbors, tvb,
360 offset, num_neighbors*10, ENC_NA);
361 edp_neighbors_tree = proto_item_add_subtree(edp_neighbors_ti, ett_ismp_edp_neighbors);
362 while ( neighbors_count < num_neighbors && tvb_reported_length_remaining(tvb, offset) >= 10)
364 edp_neighbors_leaf_ti = proto_tree_add_text(edp_neighbors_tree, tvb, offset, 10,
365 "Neighbor%d", (neighbors_count+1));
366 edp_neighbors_leaf_tree = proto_item_add_subtree(edp_neighbors_leaf_ti, ett_ismp_edp_neighbors_leaf);
368 proto_tree_add_text(edp_neighbors_leaf_tree, tvb, offset, 6,
369 "MAC Address: %s", tvb_ether_to_str(tvb, offset));
370 proto_tree_add_text(edp_neighbors_leaf_tree, tvb, offset, 4,
371 "Assigned Neighbor State 0x%04x", tvb_get_ntohl(tvb, offset));
375 if (neighbors_count != num_neighbors)
377 proto_tree_add_text(edp_tree, tvb, offset, tvb_reported_length_remaining(tvb, offset),
383 /* determine data remains, if so, count tuples
384 and create EDP tuples subtree */
385 if (tvb_reported_length_remaining(tvb, offset) != 0 &&
386 tvb_reported_length_remaining(tvb, offset) >= 2)
388 num_tuples = tvb_get_ntohs(tvb, offset);
389 proto_tree_add_item(edp_tree, hf_ismp_edp_num_tuples, tvb, offset, 2, ENC_BIG_ENDIAN);
392 else if (tvb_reported_length_remaining(tvb, offset) > 0) {
393 proto_tree_add_text(edp_tree, tvb, offset,
394 tvb_reported_length_remaining(tvb, offset), "MALFORMED PACKET");
402 /* start populating tuple information */
403 if (num_tuples && tvb_reported_length_remaining(tvb, offset) >= 4)
405 edp_tuples_ti = proto_tree_add_bytes_format(edp_tree, hf_ismp_edp_tuples, tvb,
406 offset, tvb_reported_length_remaining(tvb, offset), NULL, "Tuples");
407 edp_tuples_tree = proto_item_add_subtree(edp_tuples_ti, ett_ismp_edp_tuples);
409 while ( (tuples_count < num_tuples) && (tvb_reported_length_remaining(tvb, offset) >= 4) )
412 tuple_length = tvb_get_ntohs(tvb, offset+2);
413 edp_tuples_leaf_ti = proto_tree_add_text(edp_tuples_tree, tvb, offset, tuple_length,
414 "Tuple%d", tuples_count+1);
416 edp_tuples_leaf_tree = proto_item_add_subtree(edp_tuples_leaf_ti, ett_ismp_edp_tuples_leaf);
418 tuple_type = tvb_get_ntohs(tvb, offset);
419 proto_tree_add_text(edp_tuples_leaf_tree, tvb, offset, 2,
420 "Tuple Type: %s(%d)", val_to_str_const( tuple_type, edp_tuple_types, "Unknown"), tuple_type );
422 proto_tree_add_text(edp_tuples_leaf_tree, tvb, offset, 2,
423 "Tuple Length: %d", tuple_length);
426 if (tvb_reported_length_remaining(tvb, offset) >= tuple_length)
428 tvb_ensure_bytes_exist(tvb, offset, tuple_length);
432 proto_tree_add_text(edp_tuples_leaf_tree, tvb, offset, tuple_length,
433 "Hold Time = %d", tvb_get_ntohs(tvb, offset));
435 case EDP_TUPLE_INT_NAME:
436 proto_tree_add_text(edp_tuples_leaf_tree, tvb, offset, tuple_length,
437 "Interface Name = %s", tvb_format_text(tvb, offset, tuple_length));
438 col_append_fstr(pinfo->cinfo, COL_INFO, ", ifName %s",
439 tvb_format_text(tvb, offset, tuple_length));
441 case EDP_TUPLE_SYS_DESCRIPT:
442 proto_tree_add_text(edp_tuples_leaf_tree, tvb, offset, tuple_length,
443 "System Description = %s", tvb_format_text(tvb, offset, tuple_length));
445 case EDP_TUPLE_IPX_ADDR:
446 proto_tree_add_text(edp_tuples_leaf_tree, tvb, offset, tuple_length,
447 "Interface IPX_address = %s",
448 ipx_addr_to_str(tvb_get_ntohl(tvb, offset),
449 tvb_get_string(wmem_packet_scope(), tvb, offset+4, tuple_length-4)));
451 case EDP_TUPLE_UNKNOWN:
453 proto_tree_add_text(edp_tuples_leaf_tree, tvb, offset, tuple_length,
454 "Unknown Tuple Data %s", tvb_format_text(tvb, offset, tuple_length));
458 offset += tuple_length;
462 if (tuples_count != num_tuples)
464 proto_tree_add_text(edp_tree, tvb, offset,
465 tvb_reported_length_remaining(tvb, offset), "MALFORMED PACKET");
480 /* Code to actually dissect the packets */
482 dissect_ismp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
485 guint16 message_type = 0;
486 guint8 code_length = 0;
487 guint8 weird_stuff[3] = { 0x42, 0x42, 0x03 };
489 /* Set up structures needed to add the protocol subtree and manage it */
491 proto_tree *ismp_tree;
493 /* Make entries in Protocol column and Info column on summary display */
494 col_set_str(pinfo->cinfo, COL_PROTOCOL, "ISMP");
495 col_clear(pinfo->cinfo, COL_INFO);
498 * XXX - I've seen captures with packets that have the ISMP
499 * Ethernet frame type, but with the payload being 0x42 0x42 0x03
500 * followed by what appears to be an ISMP frame.
502 * 0x4242 is not a valid ISMP version number.
504 if (tvb_memeql(tvb, offset, weird_stuff, sizeof weird_stuff) == 0)
505 offset += 3; /* skip the weird stuff, for now */
507 /* create display subtree for ismp */
508 ti = proto_tree_add_item(tree, proto_ismp, tvb, offset, -1, ENC_NA);
510 ismp_tree = proto_item_add_subtree(ti, ett_ismp);
512 /* add an items to the subtree */
513 proto_tree_add_item(ismp_tree, hf_ismp_version, tvb, offset, 2, ENC_BIG_ENDIAN);
515 message_type = tvb_get_ntohs(tvb, offset);
516 proto_tree_add_item(ismp_tree, hf_ismp_message_type, tvb, offset, 2, ENC_BIG_ENDIAN);
518 proto_tree_add_item(ismp_tree, hf_ismp_seq_num, tvb, offset, 2, ENC_BIG_ENDIAN);
520 code_length = tvb_get_guint8(tvb, offset);
521 proto_tree_add_item(ismp_tree, hf_ismp_code_length, tvb, offset, 1, ENC_BIG_ENDIAN);
523 proto_tree_add_item(ismp_tree, hf_ismp_auth_data, tvb, offset, code_length, ENC_NA);
524 offset += code_length;
526 /* if Enterasys Discover Protocol, dissect it */
527 if(message_type == ISMPTYPE_EDP)
528 dissect_ismp_edp(tvb, pinfo, offset, tree);
534 /* Register this protocol with Wireshark */
536 proto_register_ismp(void)
539 /* Setup list of header fields See Section 1.6.1 for details*/
540 static hf_register_info hf[] = {
544 FT_PROTOCOL, BASE_NONE, NULL, 0x0,
545 "Inter Switch Message Protocol", HFILL }
549 { "Version", "ismp.version",
550 FT_UINT16, BASE_DEC, NULL, 0x0,
553 { &hf_ismp_message_type,
554 { "Message Type", "ismp.msgtype",
555 FT_UINT16, BASE_DEC, NULL, 0x0,
559 { "Sequence Number", "ismp.seqnum",
560 FT_UINT16, BASE_DEC, NULL, 0x0,
563 { &hf_ismp_code_length,
564 { "Auth Code Length", "ismp.codelen",
565 FT_UINT8, BASE_DEC, NULL, 0x0,
568 { &hf_ismp_auth_data,
569 { "Auth Data", "ismp.authdata",
570 FT_BYTES, BASE_NONE, NULL, 0x0,
575 FT_PROTOCOL, BASE_NONE, NULL, 0x0,
576 "Enterasys Discovery Protocol", HFILL }
578 { &hf_ismp_edp_version,
579 { "Version", "ismp.edp.version",
580 FT_UINT16, BASE_DEC, NULL, 0x0,
583 { &hf_ismp_edp_module_ip,
584 { "Module IP Address", "ismp.edp.modip",
585 FT_IPv4, BASE_NONE, NULL, 0x0,
588 { &hf_ismp_edp_module_mac,
589 { "Module MAC Address", "ismp.edp.modmac",
590 FT_ETHER, BASE_NONE, NULL, 0x0,
593 { &hf_ismp_edp_module_port,
594 { "Module Port (ifIndex num)", "ismp.edp.modport",
595 FT_UINT32, BASE_DEC, NULL, 0x0,
598 { &hf_ismp_edp_chassis_mac,
599 { "Chassis MAC Address", "ismp.edp.chassismac",
600 FT_ETHER, BASE_NONE, NULL, 0x0,
603 { &hf_ismp_edp_chassis_ip,
604 { "Chassis IP Address", "ismp.edp.chassisip",
605 FT_IPv4, BASE_NONE, NULL, 0x0,
608 { &hf_ismp_edp_device_type,
609 { "Device Type", "ismp.edp.devtype",
610 FT_UINT16, BASE_DEC, edp_device_types, 0x0,
613 { &hf_ismp_edp_module_rev,
614 { "Module Firmware Revision", "ismp.edp.rev",
615 FT_UINT32, BASE_DEC, NULL, 0x0,
618 { &hf_ismp_edp_options,
619 { "Device Options", "ismp.edp.options",
620 FT_UINT32, BASE_DEC, NULL, 0x0,
623 { &hf_ismp_edp_sfs_option_unused1,
624 { "Unused", "ismp.edp.sfs_option_unused1",
625 FT_BOOLEAN, 32, TFS(&is_set), EDP_SFS_OPTION_UNUSED1,
628 { &hf_ismp_edp_sfs_option_sfssup,
629 { "SFS Support", "ismp.edp.sfs_option_sfssup",
630 FT_BOOLEAN, 32, TFS(&is_set), EDP_SFS_OPTION_SFSSUP,
633 { &hf_ismp_edp_sfs_option_lsp,
634 { "LSP Support", "ismp.edp.sfs_option_lsp",
635 FT_BOOLEAN, 32, TFS(&is_set), EDP_SFS_OPTION_LSP,
638 { &hf_ismp_edp_sfs_option_flood,
639 { "Flood Path Support", "ismp.edp.sfs_option_flood",
640 FT_BOOLEAN, 32, TFS(&is_set), EDP_SFS_OPTION_FLOOD,
643 { &hf_ismp_edp_sfs_option_resolve,
644 { "Resolve Support", "ismp.edp.sfs_option_resolve",
645 FT_BOOLEAN, 32, TFS(&is_set), EDP_SFS_OPTION_RESOLVE,
648 { &hf_ismp_edp_sfs_option_unused2,
649 { "Unused", "ismp.edp.sfs_option_unused2",
650 FT_BOOLEAN, 32, TFS(&is_set), EDP_SFS_OPTION_UNUSED2,
653 { &hf_ismp_edp_sfs_option_tagflood,
654 { "Tagged Flood Support", "ismp.edp.sfs_option_tagflood",
655 FT_BOOLEAN, 32, TFS(&is_set), EDP_SFS_OPTION_TAGFLOOD,
658 { &hf_ismp_edp_sfs_option_calltap,
659 { "Call Tap Support", "ismp.edp.sfs_option_calltap",
660 FT_BOOLEAN, 32, TFS(&is_set), EDP_SFS_OPTION_CALLTAP,
663 { &hf_ismp_edp_sfs_option_conmsg,
664 { "Connection Message Support", "ismp.edp.sfs_option_conmsg",
665 FT_BOOLEAN, 32, TFS(&is_set), EDP_SFS_OPTION_CONMSG,
668 { &hf_ismp_edp_sfs_option_redun,
669 { "Redundant Access Support", "ismp.edp.sfs_option_redun",
670 FT_BOOLEAN, 32, TFS(&is_set), EDP_SFS_OPTION_REDUN,
673 { &hf_ismp_edp_sfs_option_isolated,
674 { "Isolated Switch", "ismp.edp.sfs_option_isolated",
675 FT_BOOLEAN, 32, TFS(&is_set), EDP_SFS_OPTION_ISOLATED,
678 { &hf_ismp_edp_sfs_option_uplink_switch,
679 { "Uplink Switch", "ismp.edp.sfs_option_uplink_switch",
680 FT_BOOLEAN, 32, TFS(&is_set), EDP_SFS_OPTION_UPLINK_SWITCH,
683 { &hf_ismp_edp_sfs_option_uplink_core,
684 { "Uplink Core", "ismp.edp.sfs_option_uplink_core",
685 FT_BOOLEAN, 32, TFS(&is_set), EDP_SFS_OPTION_UPLINK_CORE,
688 { &hf_ismp_edp_sfs_option_uplink_port,
689 { "Uplink Port", "ismp.edp.sfs_option_uplink_port",
690 FT_BOOLEAN, 32, TFS(&is_set), EDP_SFS_OPTION_UPLINK_PORT,
693 { &hf_ismp_edp_sfs_option_uplink_flood,
694 { "Uplink Flood Support", "ismp.edp.sfs_option_uplink_flood",
695 FT_BOOLEAN, 32, TFS(&is_set), EDP_SFS_OPTION_UPLINK_FLOOD,
698 { &hf_ismp_edp_rtr_option_ssr,
699 { "SSR Type Device", "ismp.edp.rtr_option_ssr",
700 FT_BOOLEAN, 32, TFS(&is_set), EDP_RTR_OPTION_SSR,
703 { &hf_ismp_edp_rtr_option_igmp,
704 { "IGMP Active", "ismp.edp.rtr_option_igmp",
705 FT_BOOLEAN, 32, TFS(&is_set), EDP_RTR_OPTION_IGMP,
708 { &hf_ismp_edp_rtr_option_rip,
709 { "RIP Active", "ismp.edp.rtr_option_rip",
710 FT_BOOLEAN, 32, TFS(&is_set), EDP_RTR_OPTION_RIP,
713 { &hf_ismp_edp_rtr_option_bgp,
714 { "BGP Active", "ismp.edp.rtr_option_bgp",
715 FT_BOOLEAN, 32, TFS(&is_set), EDP_RTR_OPTION_BGP,
718 { &hf_ismp_edp_rtr_option_ospf,
719 { "OSPF Active", "ismp.edp.rtr_option_ospf",
720 FT_BOOLEAN, 32, TFS(&is_set), EDP_RTR_OPTION_OSPF,
723 { &hf_ismp_edp_rtr_option_dvmrp,
724 { "DVMRP Active", "ismp.edp.rtr_option_dvmrp",
725 FT_BOOLEAN, 32, TFS(&is_set), EDP_RTR_OPTION_DVMRP,
728 { &hf_ismp_edp_rtr_option_8021q,
729 { "802.1Q Support", "ismp.edp.rtr_option_8021q",
730 FT_BOOLEAN, 32, TFS(&is_set), EDP_RTR_OPTION_8021Q,
733 { &hf_ismp_edp_rtr_option_gvrp,
734 { "GVRP Support", "ismp.edp.rtr_option_gvrp",
735 FT_BOOLEAN, 32, TFS(&is_set), EDP_RTR_OPTION_GVRP,
738 { &hf_ismp_edp_rtr_option_gmrp,
739 { "GMRP Support", "ismp.edp.rtr_option_gmrp",
740 FT_BOOLEAN, 32, TFS(&is_set), EDP_RTR_OPTION_GMRP,
743 { &hf_ismp_edp_rtr_option_igmp_snoop,
744 { "IGMP Snooping Support", "ismp.edp.rtr_option_igmp_snoop",
745 FT_BOOLEAN, 32, TFS(&is_set), EDP_RTR_OPTION_IGMP_SNOOP,
748 { &hf_ismp_edp_rtr_option_route,
749 { "Route Bridging", "ismp.edp.rtr_option_route",
750 FT_BOOLEAN, 32, TFS(&is_set), EDP_RTR_OPTION_ROUTE,
753 { &hf_ismp_edp_rtr_option_trans,
754 { "Transparent Bridging", "ismp.edp.rtr_option_trans",
755 FT_BOOLEAN, 32, TFS(&is_set), EDP_RTR_OPTION_TRANS,
758 { &hf_ismp_edp_rtr_option_level1,
759 { "Level 1 Functionality", "ismp.edp.rtr_option_level1",
760 FT_BOOLEAN, 32, TFS(&is_set), EDP_RTR_OPTION_LEVEL1,
763 { &hf_ismp_edp_switch_option_8021q,
764 { "802.1Q Support", "ismp.edp.switch_option_8021q",
765 FT_BOOLEAN, 32, TFS(&is_set), EDP_SWITCH_OPTION_8021Q,
768 { &hf_ismp_edp_switch_option_gvrp,
769 { "GVRP Support", "ismp.edp.switch_option_gvrp",
770 FT_BOOLEAN, 32, TFS(&is_set), EDP_SWITCH_OPTION_GVRP,
773 { &hf_ismp_edp_switch_option_gmrp,
774 { "GMRP Support", "ismp.edp.switch_option_gmrp",
775 FT_BOOLEAN, 32, TFS(&is_set), EDP_SWITCH_OPTION_GMRP,
778 { &hf_ismp_edp_switch_option_igmp,
779 { "IGMP Snooping Support", "ismp.edp.switch_option_igmp",
780 FT_BOOLEAN, 32, TFS(&is_set), EDP_SWITCH_OPTION_IGMP,
783 { &hf_ismp_edp_switch_option_route,
784 { "Route Bridging", "ismp.edp.switch_option_route",
785 FT_BOOLEAN, 32, TFS(&is_set), EDP_SWITCH_OPTION_ROUTE,
788 { &hf_ismp_edp_switch_option_trans,
789 { "Transparent Bridging", "ismp.edp.switch_option_trans",
790 FT_BOOLEAN, 32, TFS(&is_set), EDP_SWITCH_OPTION_TRANS,
793 { &hf_ismp_edp_switch_option_level1,
794 { "Level 1 Functionality", "ismp.edp.switch_option_level1",
795 FT_BOOLEAN, 32, TFS(&is_set), EDP_SWITCH_OPTION_LEVEL1,
798 { &hf_ismp_edp_end_station_option_dhcp,
799 { "DHCP Enabled", "ismp.edp.end_station_option_dhcp",
800 FT_BOOLEAN, 32, TFS(&is_set), EDP_END_STATION_OPTION_DHCP,
803 { &hf_ismp_edp_end_station_option_dns,
804 { "DNS Enabled", "ismp.edp.end_station_option_dns",
805 FT_BOOLEAN, 32, TFS(&is_set), EDP_END_STATION_OPTION_DNS,
808 { &hf_ismp_edp_end_station_option_ad,
809 { "Active Directory Enabled", "ismp.edp.end_station_option_ad",
810 FT_BOOLEAN, 32, TFS(&is_set), EDP_END_STATION_OPTION_AD,
813 { &hf_ismp_edp_num_neighbors,
814 { "Number of Known Neighbors", "ismp.edp.maccount",
815 FT_UINT16, BASE_DEC, NULL, 0x0,
818 { &hf_ismp_edp_neighbors,
819 { "Neighbors", "ismp.edp.nbrs",
820 FT_BYTES, BASE_NONE, NULL, 0x0,
823 { &hf_ismp_edp_num_tuples,
824 { "Number of Tuples", "ismp.edp.numtups",
825 FT_UINT16, BASE_DEC, NULL, 0x0,
828 { &hf_ismp_edp_tuples,
829 { "Number of Tuples", "ismp.edp.tups",
830 FT_BYTES, BASE_NONE, NULL, 0x0,
835 /* Setup protocol subtree array */
836 static gint *ett[] = {
839 &ett_ismp_edp_options,
840 &ett_ismp_edp_neighbors,
841 &ett_ismp_edp_neighbors_leaf,
842 &ett_ismp_edp_tuples,
843 &ett_ismp_edp_tuples_leaf,
846 /* Register the protocol name and description */
847 proto_ismp = proto_register_protocol("InterSwitch Message Protocol",
850 /* Required function calls to register the header fields and subtrees used */
851 proto_register_field_array(proto_ismp, hf, array_length(hf));
852 proto_register_subtree_array(ett, array_length(ett));
856 /* If this dissector uses sub-dissector registration add a registration routine.
857 This format is required because a script is used to find these routines and
858 create the code that calls these routines.
861 proto_reg_handoff_ismp(void)
863 dissector_handle_t ismp_handle;
865 ismp_handle = create_dissector_handle(dissect_ismp,
867 dissector_add_uint("ethertype", ETHERTYPE_ISMP, ismp_handle);