2 * Routines for ISMP dissection
3 * Enterasys Networks Home: http://www.enterasys.com/
4 * Copyright 2003, Joshua Craig Douglas <jdouglas@enterasys.com>
6 * $Id: packet-ismp.c,v 1.4 2004/02/18 10:11:51 guy Exp $
8 * Ethereal - Network traffic analyzer
9 * By Gerald Combs <gerald@ethereal.com>
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
37 #ifdef NEED_SNPRINTF_H
38 # include "snprintf.h"
41 #include <epan/packet.h>
42 #include <epan/strutil.h>
46 /* Initialize the protocol and registered fields */
47 static int proto_ismp = -1;
48 static int hf_ismp_version = -1;
49 static int hf_ismp_message_type = -1;
50 static int hf_ismp_seq_num = -1;
51 static int hf_ismp_code_length = -1;
52 static int hf_ismp_auth_data = -1;
54 /* Enterasys/Cabletron Dicovery Protocol fields*/
55 static int hf_ismp_edp_version = -1;
56 static int hf_ismp_edp_module_ip = -1;
57 static int hf_ismp_edp_module_mac = -1;
58 static int hf_ismp_edp_module_port = -1;
59 static int hf_ismp_edp_chassis_mac =-1;
60 static int hf_ismp_edp_chassis_ip = -1;
61 static int hf_ismp_edp_device_type = -1;
62 static int hf_ismp_edp_module_rev = -1;
63 static int hf_ismp_edp_options = -1;
64 static int hf_ismp_edp_sfs_option_unused1 = -1;
65 static int hf_ismp_edp_sfs_option_sfssup = -1;
66 static int hf_ismp_edp_sfs_option_lsp = -1;
67 static int hf_ismp_edp_sfs_option_flood = -1;
68 static int hf_ismp_edp_sfs_option_resolve = -1;
69 static int hf_ismp_edp_sfs_option_unused2 = -1;
70 static int hf_ismp_edp_sfs_option_tagflood = -1;
71 static int hf_ismp_edp_sfs_option_calltap = -1;
72 static int hf_ismp_edp_sfs_option_conmsg = -1;
73 static int hf_ismp_edp_sfs_option_redun = -1;
74 static int hf_ismp_edp_sfs_option_isolated = -1;
75 static int hf_ismp_edp_sfs_option_uplink_switch = -1;
76 static int hf_ismp_edp_sfs_option_uplink_core = -1;
77 static int hf_ismp_edp_sfs_option_uplink_port = -1;
78 static int hf_ismp_edp_sfs_option_uplink_flood = -1;
79 static int hf_ismp_edp_rtr_option_ssr = -1;
80 static int hf_ismp_edp_rtr_option_igmp = -1;
81 static int hf_ismp_edp_rtr_option_rip = -1;
82 static int hf_ismp_edp_rtr_option_bgp = -1;
83 static int hf_ismp_edp_rtr_option_ospf = -1;
84 static int hf_ismp_edp_rtr_option_dvmrp = -1;
85 static int hf_ismp_edp_rtr_option_8021q = -1;
86 static int hf_ismp_edp_rtr_option_gvrp = -1;
87 static int hf_ismp_edp_rtr_option_gmrp = -1;
88 static int hf_ismp_edp_rtr_option_igmp_snoop = -1;
89 static int hf_ismp_edp_rtr_option_route = -1;
90 static int hf_ismp_edp_rtr_option_trans = -1;
91 static int hf_ismp_edp_rtr_option_level1 = -1;
92 static int hf_ismp_edp_switch_option_8021q = -1;
93 static int hf_ismp_edp_switch_option_gvrp = -1;
94 static int hf_ismp_edp_switch_option_gmrp = -1;
95 static int hf_ismp_edp_switch_option_igmp = -1;
96 static int hf_ismp_edp_switch_option_route = -1;
97 static int hf_ismp_edp_switch_option_trans = -1;
98 static int hf_ismp_edp_switch_option_level1 = -1;
99 static int hf_ismp_edp_end_station_option_dhcp = -1;
100 static int hf_ismp_edp_end_station_option_dns = -1;
101 static int hf_ismp_edp_end_station_option_ad = -1;
102 static int hf_ismp_edp_num_neighbors = -1;
103 static int hf_ismp_edp_neighbors = -1;
104 static int hf_ismp_edp_num_tuples = -1;
105 static int hf_ismp_edp_tuples = -1;
108 /* Initialize the subtree pointers */
109 static gint ett_ismp = -1;
110 static gint ett_ismp_edp = -1;
111 static gint ett_ismp_edp_options = -1;
112 static gint ett_ismp_edp_neighbors = -1;
113 static gint ett_ismp_edp_neighbors_leaf = -1;
114 static gint ett_ismp_edp_tuples = -1;
115 static gint ett_ismp_edp_tuples_leaf = -1;
118 #define ISMPTYPE_EDP 2
121 /* EDP DEVICE TYPES */
122 #define EDP_DEVICE_TYPE_SFS17 1
123 #define EDP_DEVICE_TYPE_SFS18 2
124 #define EDP_DEVICE_TYPE_ROUTER 3
125 #define EDP_DEVICE_TYPE_BRIDGE 4
126 #define EDP_DEVICE_TYPE_VLANMAN 5
127 #define EDP_DEVICE_TYPE_NTSERVER 6
128 #define EDP_DEVICE_TYPE_NTCLIENT 7
129 #define EDP_DEVICE_TYPE_WIN95 8
130 #define EDP_DEVICE_TYPE_WIN98 9
131 #define EDP_DEVICE_TYPE_UNIXSERVER 10
132 #define EDP_DEVICE_TYPE_UNIXCLIENT 11
133 #define EDP_DEVICE_TYPE_ACCESSPOINT 12
136 static const value_string edp_device_types[] = {
137 { EDP_DEVICE_TYPE_SFS17, "Network Switch running SecureFast version 1.7 or lower" },
138 { EDP_DEVICE_TYPE_SFS18, "Network Switch running SecureFast version 1.8 or greater" },
139 { EDP_DEVICE_TYPE_ROUTER, "Router" },
140 { EDP_DEVICE_TYPE_BRIDGE, "Bridge" },
141 { EDP_DEVICE_TYPE_VLANMAN, "Cabletron VLAN Manager" },
142 { EDP_DEVICE_TYPE_NTSERVER, "Network Server (NT)" },
143 { EDP_DEVICE_TYPE_NTCLIENT, "Network Workstation (NT)" },
144 { EDP_DEVICE_TYPE_WIN95, "Windows95" },
145 { EDP_DEVICE_TYPE_WIN98, "Windows98" },
146 { EDP_DEVICE_TYPE_UNIXSERVER, "UNIX Server" },
147 { EDP_DEVICE_TYPE_UNIXCLIENT, "UNIX Workstation" },
148 { EDP_DEVICE_TYPE_ACCESSPOINT, "Roamabout wireless access point" },
153 /* EDP SFS Options */
154 #define EDP_SFS_OPTION_UNUSED1 0x1
155 #define EDP_SFS_OPTION_SFSSUP 0x2
156 #define EDP_SFS_OPTION_LSP 0x4
157 #define EDP_SFS_OPTION_FLOOD 0x8
158 #define EDP_SFS_OPTION_RESOLVE 0x10
159 #define EDP_SFS_OPTION_UNUSED2 0x20
160 #define EDP_SFS_OPTION_TAGFLOOD 0x40
161 #define EDP_SFS_OPTION_CALLTAP 0x80
162 #define EDP_SFS_OPTION_CONMSG 0x100
163 #define EDP_SFS_OPTION_REDUN 0x200
164 #define EDP_SFS_OPTION_ISOLATED 0x400
165 #define EDP_SFS_OPTION_UPLINK_SWITCH 0x800
166 #define EDP_SFS_OPTION_UPLINK_CORE 0x1000
167 #define EDP_SFS_OPTION_UPLINK_PORT 0x2000
168 #define EDP_SFS_OPTION_UPLINK_FLOOD 0x4000
170 /* EDP Router Options */
171 #define EDP_RTR_OPTION_SSR 0x1
172 #define EDP_RTR_OPTION_IGMP 0x2
173 #define EDP_RTR_OPTION_RIP 0x4
174 #define EDP_RTR_OPTION_BGP 0x8
175 #define EDP_RTR_OPTION_OSPF 0x10
176 #define EDP_RTR_OPTION_DVMRP 0x20
177 #define EDP_RTR_OPTION_8021Q 0x40
178 #define EDP_RTR_OPTION_GVRP 0x80
179 #define EDP_RTR_OPTION_GMRP 0x100
180 #define EDP_RTR_OPTION_IGMP_SNOOP 0x200
181 #define EDP_RTR_OPTION_ROUTE 0x400
182 #define EDP_RTR_OPTION_TRANS 0x800
183 #define EDP_RTR_OPTION_LEVEL1 0x1000
185 /* EDP Switch Options */
186 #define EDP_SWITCH_OPTION_8021Q 0x1
187 #define EDP_SWITCH_OPTION_GVRP 0x2
188 #define EDP_SWITCH_OPTION_GMRP 0x4
189 #define EDP_SWITCH_OPTION_IGMP 0x8
190 #define EDP_SWITCH_OPTION_ROUTE 0x10
191 #define EDP_SWITCH_OPTION_TRANS 0x20
192 #define EDP_SWITCH_OPTION_LEVEL1 0x40
194 /* EDP End Station and Server Options */
195 #define EDP_END_STATION_OPTION_DHCP 0x1
196 #define EDP_END_STATION_OPTION_DNS 0x2
197 #define EDP_END_STATION_OPTION_AD 0x4
199 /* EDP Tuple Types */
200 #define EDP_TUPLE_UNKNOWN 0
201 #define EDP_TUPLE_HOLD 1
202 #define EDP_TUPLE_INT_NAME 2
203 #define EDP_TUPLE_SYS_DESCRIPT 3
204 #define EDP_TUPLE_IPX_ADDR 4
206 static const value_string edp_tuple_types[] =
208 { EDP_TUPLE_UNKNOWN,"Unknown" },
209 { EDP_TUPLE_HOLD,"Hold Time" },
210 { EDP_TUPLE_INT_NAME,"Interface Name" },
211 { EDP_TUPLE_SYS_DESCRIPT,"System Description" },
212 { EDP_TUPLE_IPX_ADDR,"IPX Address" },
217 static const true_false_string is_set = {
223 /* Function to dissect EDP portion of ISMP message */
225 dissect_ismp_edp(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *ismp_tree)
227 /* local variables used for EDP dissection */
228 int neighbors_count = 0;
229 int tuples_count = 0;
230 guint16 device_type = 0;
232 guint16 num_neighbors = 0;
233 guint16 num_tuples = 0;
234 guint16 tuple_type = 0;
235 guint16 tuple_length = 0;
236 const guint8 *neighbors_ptr;
237 const guint8 *tuples_ptr;
239 /* Set up structures needed to add the protocol subtree and manage it */
241 proto_tree *ismp_edp_tree;
243 proto_item *edp_options_ti;
244 proto_tree *edp_options_tree;
246 proto_item *edp_neighbors_ti;
247 proto_tree *edp_neighbors_tree;
249 proto_item *edp_neighbors_leaf_ti;
250 proto_tree *edp_neighbors_leaf_tree;
252 proto_item *edp_tuples_ti;
253 proto_tree *edp_tuples_tree;
255 proto_item *edp_tuples_leaf_ti;
256 proto_tree *edp_tuples_leaf_tree;
258 /* add column iformation marking this as EDP (Enterasys Discover Protocol */
259 if (check_col(pinfo->cinfo, COL_PROTOCOL))
260 col_set_str(pinfo->cinfo, COL_PROTOCOL, "EDP Message");
261 if (check_col(pinfo->cinfo, COL_INFO))
262 col_clear(pinfo->cinfo, COL_INFO);
264 /* create display subtree for EDP */
266 edp_ti = proto_tree_add_text(ismp_tree, tvb, offset, 0, "Enterasys Discovery Protocol");
267 ismp_edp_tree = proto_item_add_subtree(edp_ti, ett_ismp_edp);
270 proto_tree_add_item(ismp_edp_tree, hf_ismp_edp_version, tvb, offset, 2, FALSE);
272 proto_tree_add_item(ismp_edp_tree, hf_ismp_edp_module_ip, tvb, offset, 4, FALSE);
274 proto_tree_add_item(ismp_edp_tree, hf_ismp_edp_module_mac, tvb, offset, 6, FALSE);
276 proto_tree_add_item(ismp_edp_tree, hf_ismp_edp_module_port, tvb, offset, 4, FALSE);
278 proto_tree_add_item(ismp_edp_tree, hf_ismp_edp_chassis_mac, tvb, offset, 6, FALSE);
280 proto_tree_add_item(ismp_edp_tree, hf_ismp_edp_chassis_ip, tvb, offset, 4, FALSE);
282 device_type = tvb_get_ntohs(tvb, offset);
283 proto_tree_add_item(ismp_edp_tree, hf_ismp_edp_device_type, tvb, offset, 2, FALSE);
285 proto_tree_add_uint_format(ismp_edp_tree, hf_ismp_edp_module_rev, tvb, offset, 4, tvb_get_ntohl(tvb, offset),
286 "Module Firmware Revision: %02x.%02x.%02x.%02x", tvb_get_guint8(tvb, offset),
287 tvb_get_guint8(tvb, offset+1), tvb_get_guint8(tvb, offset+2), tvb_get_guint8(tvb, offset+3));
290 /* create display subtree for EDP options */
291 options = tvb_get_ntohl(tvb, offset);
292 edp_options_ti = proto_tree_add_uint_format(ismp_edp_tree, hf_ismp_edp_options, tvb, offset, 4,
293 options,"Options: 0x%08x",options);
294 edp_options_tree = proto_item_add_subtree(edp_options_ti, ett_ismp_edp_options);
296 /* depending on device_type, show the appropriate options */
297 switch (device_type) {
298 case EDP_DEVICE_TYPE_SFS17:
299 case EDP_DEVICE_TYPE_SFS18:
300 proto_tree_add_item(edp_options_tree, hf_ismp_edp_sfs_option_uplink_flood, tvb, offset, 4, FALSE);
301 proto_tree_add_item(edp_options_tree, hf_ismp_edp_sfs_option_uplink_port, tvb, offset, 4, FALSE);
302 proto_tree_add_item(edp_options_tree, hf_ismp_edp_sfs_option_uplink_core, tvb, offset, 4, FALSE);
303 proto_tree_add_item(edp_options_tree, hf_ismp_edp_sfs_option_uplink_switch, tvb, offset, 4, FALSE);
304 proto_tree_add_item(edp_options_tree, hf_ismp_edp_sfs_option_isolated, tvb, offset, 4, FALSE);
305 proto_tree_add_item(edp_options_tree, hf_ismp_edp_sfs_option_redun, tvb, offset, 4, FALSE);
306 proto_tree_add_item(edp_options_tree, hf_ismp_edp_sfs_option_conmsg, tvb, offset, 4, FALSE);
307 proto_tree_add_item(edp_options_tree, hf_ismp_edp_sfs_option_calltap, tvb, offset, 4, FALSE);
308 proto_tree_add_item(edp_options_tree, hf_ismp_edp_sfs_option_tagflood, tvb, offset, 4, FALSE);
309 proto_tree_add_item(edp_options_tree, hf_ismp_edp_sfs_option_unused2, tvb, offset, 4, FALSE);
310 proto_tree_add_item(edp_options_tree, hf_ismp_edp_sfs_option_resolve, tvb, offset, 4, FALSE);
311 proto_tree_add_item(edp_options_tree, hf_ismp_edp_sfs_option_flood, tvb, offset, 4, FALSE);
312 proto_tree_add_item(edp_options_tree, hf_ismp_edp_sfs_option_lsp, tvb, offset, 4, FALSE);
313 proto_tree_add_item(edp_options_tree, hf_ismp_edp_sfs_option_sfssup, tvb, offset, 4, FALSE);
314 proto_tree_add_item(edp_options_tree, hf_ismp_edp_sfs_option_unused1, tvb, offset, 4, FALSE);
316 case EDP_DEVICE_TYPE_ROUTER:
317 proto_tree_add_item(edp_options_tree, hf_ismp_edp_rtr_option_level1, tvb, offset, 4, FALSE);
318 proto_tree_add_item(edp_options_tree, hf_ismp_edp_rtr_option_trans, tvb, offset, 4, FALSE);
319 proto_tree_add_item(edp_options_tree, hf_ismp_edp_rtr_option_route, tvb, offset, 4, FALSE);
320 proto_tree_add_item(edp_options_tree, hf_ismp_edp_rtr_option_igmp_snoop, tvb, offset, 4, FALSE);
321 proto_tree_add_item(edp_options_tree, hf_ismp_edp_rtr_option_gmrp, tvb, offset, 4, FALSE);
322 proto_tree_add_item(edp_options_tree, hf_ismp_edp_rtr_option_gvrp, tvb, offset, 4, FALSE);
323 proto_tree_add_item(edp_options_tree, hf_ismp_edp_rtr_option_8021q, tvb, offset, 4, FALSE);
324 proto_tree_add_item(edp_options_tree, hf_ismp_edp_rtr_option_dvmrp, tvb, offset, 4, FALSE);
325 proto_tree_add_item(edp_options_tree, hf_ismp_edp_rtr_option_ospf, tvb, offset, 4, FALSE);
326 proto_tree_add_item(edp_options_tree, hf_ismp_edp_rtr_option_bgp, tvb, offset, 4, FALSE);
327 proto_tree_add_item(edp_options_tree, hf_ismp_edp_rtr_option_rip, tvb, offset, 4, FALSE);
328 proto_tree_add_item(edp_options_tree, hf_ismp_edp_rtr_option_igmp, tvb, offset, 4, FALSE);
329 proto_tree_add_item(edp_options_tree, hf_ismp_edp_rtr_option_ssr, tvb, offset, 4, FALSE);
331 case EDP_DEVICE_TYPE_BRIDGE:
332 proto_tree_add_item(edp_options_tree, hf_ismp_edp_switch_option_level1, tvb, offset, 4, FALSE);
333 proto_tree_add_item(edp_options_tree, hf_ismp_edp_switch_option_trans, tvb, offset, 4, FALSE);
334 proto_tree_add_item(edp_options_tree, hf_ismp_edp_switch_option_route, tvb, offset, 4, FALSE);
335 proto_tree_add_item(edp_options_tree, hf_ismp_edp_switch_option_igmp, tvb, offset, 4, FALSE);
336 proto_tree_add_item(edp_options_tree, hf_ismp_edp_switch_option_gmrp, tvb, offset, 4, FALSE);
337 proto_tree_add_item(edp_options_tree, hf_ismp_edp_switch_option_gvrp, tvb, offset, 4, FALSE);
338 proto_tree_add_item(edp_options_tree, hf_ismp_edp_switch_option_8021q, tvb, offset, 4, FALSE);
340 case EDP_DEVICE_TYPE_VLANMAN:
342 case EDP_DEVICE_TYPE_NTSERVER:
343 case EDP_DEVICE_TYPE_NTCLIENT:
344 case EDP_DEVICE_TYPE_WIN95:
345 case EDP_DEVICE_TYPE_WIN98:
346 case EDP_DEVICE_TYPE_UNIXSERVER:
347 case EDP_DEVICE_TYPE_UNIXCLIENT:
348 proto_tree_add_item(edp_options_tree, hf_ismp_edp_end_station_option_ad, tvb, offset, 4, FALSE);
349 proto_tree_add_item(edp_options_tree, hf_ismp_edp_end_station_option_dns, tvb, offset, 4, FALSE);
350 proto_tree_add_item(edp_options_tree, hf_ismp_edp_end_station_option_dhcp, tvb, offset, 4, FALSE);
352 case EDP_DEVICE_TYPE_ACCESSPOINT:
358 /* determine the number of neighbors and create EDP neighbors subtree */
359 num_neighbors = tvb_get_ntohs(tvb, offset);
360 proto_tree_add_item(ismp_edp_tree, hf_ismp_edp_num_neighbors, tvb, offset, 2, FALSE);
362 if (num_neighbors > 0)
364 if (tvb_reported_length_remaining(tvb, offset) >= (num_neighbors *10))
366 neighbors_ptr = tvb_get_ptr( tvb, offset, (num_neighbors*10) );
367 edp_neighbors_ti = proto_tree_add_bytes_format(ismp_edp_tree, hf_ismp_edp_neighbors, tvb,
368 offset, num_neighbors*10, neighbors_ptr, "Neighbors:");
372 neighbors_ptr = tvb_get_ptr( tvb, offset, tvb_reported_length_remaining(tvb, offset) );
373 edp_neighbors_ti = proto_tree_add_bytes_format(ismp_edp_tree, hf_ismp_edp_neighbors, tvb,
374 offset, num_neighbors *10, neighbors_ptr, "Neighbors:");
376 edp_neighbors_tree = proto_item_add_subtree(edp_neighbors_ti, ett_ismp_edp_neighbors);
377 while ( neighbors_count < num_neighbors && tvb_reported_length_remaining(tvb, offset) >= 10)
379 edp_neighbors_leaf_ti = proto_tree_add_text(edp_neighbors_tree, tvb, offset, 10,
380 "Neighbor%d", (neighbors_count+1));
381 edp_neighbors_leaf_tree = proto_item_add_subtree(edp_neighbors_leaf_ti, ett_ismp_edp_neighbors_leaf);
383 proto_tree_add_text(edp_neighbors_leaf_tree, tvb, offset, 6,
384 "MAC Address: %s", ether_to_str(tvb_get_ptr(tvb, offset, 6)));
385 proto_tree_add_text(edp_neighbors_leaf_tree, tvb, offset, 4,
386 "Assigned Neighbor State 0x%04x",tvb_get_ntohl(tvb, offset));
390 if (neighbors_count != num_neighbors)
392 proto_tree_add_text(ismp_edp_tree, tvb, offset, tvb_reported_length_remaining(tvb, offset),
398 /* determine data remains, if so, count tuples
399 and create EDP tuples subtree */
400 if (tvb_reported_length_remaining(tvb, offset) != 0 &&
401 tvb_reported_length_remaining(tvb, offset) >= 2)
403 num_tuples = tvb_get_ntohs(tvb, offset);
404 proto_tree_add_item(ismp_edp_tree, hf_ismp_edp_num_tuples, tvb, offset, 2, FALSE);
407 else if (tvb_reported_length_remaining(tvb, offset) > 0) {
408 proto_tree_add_text(ismp_edp_tree, tvb, offset,
409 tvb_reported_length_remaining(tvb, offset), "MALFORMED PACKET");
417 /* start populating tuple information */
418 if (num_tuples && tvb_reported_length_remaining(tvb, offset) >= 4)
420 tuples_ptr = tvb_get_ptr(tvb, offset, tvb_reported_length_remaining(tvb, offset));
421 edp_tuples_ti = proto_tree_add_bytes_format(ismp_edp_tree, hf_ismp_edp_tuples, tvb,
422 offset, tvb_reported_length_remaining(tvb, offset), tuples_ptr, "Tuples:");
423 edp_tuples_tree = proto_item_add_subtree(edp_tuples_ti, ett_ismp_edp_tuples);
425 while ( (tuples_count < num_tuples) && (tvb_reported_length_remaining(tvb, offset) >= 4) )
428 tuple_length = tvb_get_ntohs(tvb, offset+2);
429 edp_tuples_leaf_ti = proto_tree_add_text(edp_tuples_tree, tvb, offset, tuple_length,
430 "Tuple%d", tuples_count+1);
432 edp_tuples_leaf_tree = proto_item_add_subtree(edp_tuples_leaf_ti, ett_ismp_edp_tuples_leaf);
434 tuple_type = tvb_get_ntohs(tvb, offset);
435 proto_tree_add_text(edp_tuples_leaf_tree, tvb, offset, 2,
436 "Tuple Type: %s(%d)", val_to_str( tuple_type, edp_tuple_types, "Unknown"), tuple_type );
438 proto_tree_add_text(edp_tuples_leaf_tree, tvb, offset, 2,
439 "Tuple Length: %d", tuple_length);
443 if (tvb_reported_length_remaining(tvb, offset) >= tuple_length)
448 proto_tree_add_text(edp_tuples_leaf_tree, tvb, offset, tuple_length,
449 "Hold Time = %d", tvb_get_ntohs(tvb, offset));
451 case EDP_TUPLE_INT_NAME:
452 proto_tree_add_text(edp_tuples_leaf_tree, tvb, offset, tuple_length,
453 "Interface Name = %s", tvb_format_text(tvb, offset, tuple_length));
455 case EDP_TUPLE_SYS_DESCRIPT:
456 proto_tree_add_text(edp_tuples_leaf_tree, tvb, offset, tuple_length,
457 "System Description = %s", tvb_format_text(tvb, offset, tuple_length));
459 case EDP_TUPLE_IPX_ADDR:
460 proto_tree_add_text(edp_tuples_leaf_tree, tvb, offset, tuple_length,
461 "Interface IPX_address = %s",
462 ipx_addr_to_str(tvb_get_ntohl(tvb, offset),
463 tvb_get_ptr(tvb, offset+4, tuple_length-4)));
465 case EDP_TUPLE_UNKNOWN:
467 proto_tree_add_text(edp_tuples_leaf_tree, tvb, offset, tuple_length,
468 "Unknown Tuple Data %s", tvb_format_text(tvb, offset, tuple_length));
472 offset += tuple_length;
478 if (tuples_count != num_tuples)
480 proto_tree_add_text(ismp_edp_tree, tvb, offset,
481 tvb_reported_length_remaining(tvb, offset), "MALFORMED PACKET");
496 /* Code to actually dissect the packets */
498 dissect_ismp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
501 guint16 message_type = 0;
502 guint8 code_length = 0;
503 guint8 weird_stuff[3] = { 0x42, 0x42, 0x03 };
505 /* Set up structures needed to add the protocol subtree and manage it */
507 proto_tree *ismp_tree;
509 /* Make entries in Protocol column and Info column on summary display */
510 if (check_col(pinfo->cinfo, COL_PROTOCOL))
511 col_set_str(pinfo->cinfo, COL_PROTOCOL, "ISMP");
512 if (check_col(pinfo->cinfo, COL_INFO))
513 col_clear(pinfo->cinfo, COL_INFO);
516 * XXX - I've seen captures with packets that have the ISMP
517 * Ethernet frame type, but with the payload being 0x42 0x42 0x03
518 * followed by what appears to be an ISMP frame.
520 * 0x4242 is not a valid ISMP version number.
522 if (tvb_memeql(tvb, offset, weird_stuff, sizeof weird_stuff) == 0)
523 offset += 3; /* skip the weird stuff, for now */
525 /* create display subtree for ismp */
526 ti = proto_tree_add_item(tree, proto_ismp, tvb, offset, -1, FALSE);
528 ismp_tree = proto_item_add_subtree(ti, ett_ismp);
530 /* add an items to the subtree */
531 proto_tree_add_item(ismp_tree, hf_ismp_version, tvb, offset, 2, FALSE);
533 message_type = tvb_get_ntohs(tvb, offset);
534 proto_tree_add_item(ismp_tree, hf_ismp_message_type, tvb, offset, 2, FALSE);
536 proto_tree_add_item(ismp_tree, hf_ismp_seq_num, tvb, offset, 2, FALSE);
538 code_length = tvb_get_guint8(tvb, offset);
539 proto_tree_add_item(ismp_tree, hf_ismp_code_length, tvb, offset, 1, FALSE);
541 proto_tree_add_item(ismp_tree, hf_ismp_auth_data, tvb, offset, code_length, FALSE);
542 offset += code_length;
544 /* if Enterasys Discover Protocol, dissect it */
545 if(message_type == ISMPTYPE_EDP)
546 dissect_ismp_edp(tvb, pinfo, offset, ismp_tree);
552 /* Register this protocol with Ethereal */
554 proto_register_ismp(void)
557 /* Setup list of header fields See Section 1.6.1 for details*/
558 static hf_register_info hf[] = {
560 { "Version", "ismp.version",
561 FT_UINT16, BASE_DEC, NULL, 0x0,
564 { &hf_ismp_message_type,
565 { "Message Type", "ismp.msgtype",
566 FT_UINT16, BASE_DEC, NULL, 0x0,
570 { "Sequence Number", "ismp.seqnum",
571 FT_UINT16, BASE_DEC, NULL, 0x0,
574 { &hf_ismp_code_length,
575 { "Auth Code Length", "ismp.codelen",
576 FT_UINT8, BASE_DEC, NULL, 0x0,
579 { &hf_ismp_auth_data,
580 { "Auth Data", "ismp.authdata",
581 FT_BYTES, BASE_HEX, NULL, 0x0,
584 { &hf_ismp_edp_version,
585 { "Version", "ismp.edp.version",
586 FT_UINT16, BASE_DEC, NULL, 0x0,
589 { &hf_ismp_edp_module_ip,
590 { "Module IP Address", "ismp.edp.modip",
591 FT_IPv4, BASE_NONE, NULL, 0x0,
594 { &hf_ismp_edp_module_mac,
595 { "Module MAC Address", "ismp.edp.modmac",
596 FT_ETHER, BASE_NONE, NULL, 0x0,
599 { &hf_ismp_edp_module_port,
600 { "Module Port (ifIndex num)", "ismp.edp.modport",
601 FT_UINT32, BASE_DEC, NULL, 0x0,
604 { &hf_ismp_edp_chassis_mac,
605 { "Chassis MAC Address", "ismp.edp.chassismac",
606 FT_ETHER, BASE_NONE, NULL, 0x0,
609 { &hf_ismp_edp_chassis_ip,
610 { "Chassis IP Address", "ismp.edp.chassisip",
611 FT_IPv4, BASE_NONE, NULL, 0x0,
614 { &hf_ismp_edp_device_type,
615 { "Device Type", "ismp.edp.devtype",
616 FT_UINT16, BASE_DEC, edp_device_types, 0x0,
619 { &hf_ismp_edp_module_rev,
620 { "Module Firmware Revision", "ismp.edp.rev",
621 FT_UINT32, BASE_DEC, NULL, 0x0,
624 { &hf_ismp_edp_options,
625 { "Device Options", "ismp.edp.opts",
626 FT_UINT32, BASE_DEC, NULL, 0x0,
629 { &hf_ismp_edp_sfs_option_unused1,
630 { "Unused", "ismp.edp.opts",
631 FT_BOOLEAN, 32, TFS(&is_set), EDP_SFS_OPTION_UNUSED1,
634 { &hf_ismp_edp_sfs_option_sfssup,
635 { "SFS Support", "ismp.edp.opts",
636 FT_BOOLEAN, 32, TFS(&is_set), EDP_SFS_OPTION_SFSSUP,
639 { &hf_ismp_edp_sfs_option_lsp,
640 { "LSP Support", "ismp.edp.opts",
641 FT_BOOLEAN, 32, TFS(&is_set), EDP_SFS_OPTION_LSP,
644 { &hf_ismp_edp_sfs_option_flood,
645 { "Flood Path Support", "ismp.edp.opts",
646 FT_BOOLEAN, 32, TFS(&is_set), EDP_SFS_OPTION_FLOOD,
649 { &hf_ismp_edp_sfs_option_resolve,
650 { "Resolve Support", "ismp.edp.opts",
651 FT_BOOLEAN, 32, TFS(&is_set), EDP_SFS_OPTION_RESOLVE,
654 { &hf_ismp_edp_sfs_option_unused2,
655 { "Unused", "ismp.edp.opts",
656 FT_BOOLEAN, 32, TFS(&is_set), EDP_SFS_OPTION_UNUSED2,
659 { &hf_ismp_edp_sfs_option_tagflood,
660 { "Tagged Flood Support", "ismp.edp.opts",
661 FT_BOOLEAN, 32, TFS(&is_set), EDP_SFS_OPTION_TAGFLOOD,
664 { &hf_ismp_edp_sfs_option_calltap,
665 { "Call Tap Support", "ismp.edp.opts",
666 FT_BOOLEAN, 32, TFS(&is_set), EDP_SFS_OPTION_CALLTAP,
669 { &hf_ismp_edp_sfs_option_conmsg,
670 { "Connection Message Support", "ismp.edp.opts",
671 FT_BOOLEAN, 32, TFS(&is_set), EDP_SFS_OPTION_CONMSG,
674 { &hf_ismp_edp_sfs_option_redun,
675 { "Redundant Access Support", "ismp.edp.opts",
676 FT_BOOLEAN, 32, TFS(&is_set), EDP_SFS_OPTION_REDUN,
679 { &hf_ismp_edp_sfs_option_isolated,
680 { "Isolated Switch", "ismp.edp.opts",
681 FT_BOOLEAN, 32, TFS(&is_set), EDP_SFS_OPTION_ISOLATED,
684 { &hf_ismp_edp_sfs_option_uplink_switch,
685 { "Uplink Switch", "ismp.edp.opts",
686 FT_BOOLEAN, 32, TFS(&is_set), EDP_SFS_OPTION_UPLINK_SWITCH,
689 { &hf_ismp_edp_sfs_option_uplink_core,
690 { "Uplink Core", "ismp.edp.opts",
691 FT_BOOLEAN, 32, TFS(&is_set), EDP_SFS_OPTION_UPLINK_CORE,
694 { &hf_ismp_edp_sfs_option_uplink_port,
695 { "Uplink Port", "ismp.edp.opts",
696 FT_BOOLEAN, 32, TFS(&is_set), EDP_SFS_OPTION_UPLINK_PORT,
699 { &hf_ismp_edp_sfs_option_uplink_flood,
700 { "Uplink Flood Support", "ismp.edp.opts",
701 FT_BOOLEAN, 32, TFS(&is_set), EDP_SFS_OPTION_UPLINK_FLOOD,
704 { &hf_ismp_edp_rtr_option_ssr,
705 { "SSR Type Device", "ismp.edp.opts",
706 FT_BOOLEAN, 32, TFS(&is_set), EDP_RTR_OPTION_SSR,
709 { &hf_ismp_edp_rtr_option_igmp,
710 { "IGMP Active", "ismp.edp.opts",
711 FT_BOOLEAN, 32, TFS(&is_set), EDP_RTR_OPTION_IGMP,
714 { &hf_ismp_edp_rtr_option_rip,
715 { "RIP Active", "ismp.edp.opts",
716 FT_BOOLEAN, 32, TFS(&is_set), EDP_RTR_OPTION_RIP,
719 { &hf_ismp_edp_rtr_option_bgp,
720 { "BGP Active", "ismp.edp.opts",
721 FT_BOOLEAN, 32, TFS(&is_set), EDP_RTR_OPTION_BGP,
724 { &hf_ismp_edp_rtr_option_ospf,
725 { "OSPF Active", "ismp.edp.opts",
726 FT_BOOLEAN, 32, TFS(&is_set), EDP_RTR_OPTION_OSPF,
729 { &hf_ismp_edp_rtr_option_dvmrp,
730 { "DVMRP Active", "ismp.edp.opts",
731 FT_BOOLEAN, 32, TFS(&is_set), EDP_RTR_OPTION_DVMRP,
734 { &hf_ismp_edp_rtr_option_8021q,
735 { "802.1Q Support", "ismp.edp.opts",
736 FT_BOOLEAN, 32, TFS(&is_set), EDP_RTR_OPTION_8021Q,
739 { &hf_ismp_edp_rtr_option_gvrp,
740 { "GVRP Support", "ismp.edp.opts",
741 FT_BOOLEAN, 32, TFS(&is_set), EDP_RTR_OPTION_GVRP,
744 { &hf_ismp_edp_rtr_option_gmrp,
745 { "GMRP Support", "ismp.edp.opts",
746 FT_BOOLEAN, 32, TFS(&is_set), EDP_RTR_OPTION_GMRP,
749 { &hf_ismp_edp_rtr_option_igmp_snoop,
750 { "IGMP Snooping Support", "ismp.edp.opts",
751 FT_BOOLEAN, 32, TFS(&is_set), EDP_RTR_OPTION_IGMP_SNOOP,
754 { &hf_ismp_edp_rtr_option_route,
755 { "Route Bridging", "ismp.edp.opts",
756 FT_BOOLEAN, 32, TFS(&is_set), EDP_RTR_OPTION_ROUTE,
759 { &hf_ismp_edp_rtr_option_trans,
760 { "Transparent Bridging", "ismp.edp.opts",
761 FT_BOOLEAN, 32, TFS(&is_set), EDP_RTR_OPTION_TRANS,
764 { &hf_ismp_edp_rtr_option_level1,
765 { "Level 1 Functionality", "ismp.edp.opts",
766 FT_BOOLEAN, 32, TFS(&is_set), EDP_RTR_OPTION_LEVEL1,
769 { &hf_ismp_edp_switch_option_8021q,
770 { "802.1Q Support", "ismp.edp.opts",
771 FT_BOOLEAN, 32, TFS(&is_set), EDP_SWITCH_OPTION_8021Q,
774 { &hf_ismp_edp_switch_option_gvrp,
775 { "GVRP Support", "ismp.edp.opts",
776 FT_BOOLEAN, 32, TFS(&is_set), EDP_SWITCH_OPTION_GVRP,
779 { &hf_ismp_edp_switch_option_gmrp,
780 { "GMRP Support", "ismp.edp.opts",
781 FT_BOOLEAN, 32, TFS(&is_set), EDP_SWITCH_OPTION_GMRP,
784 { &hf_ismp_edp_switch_option_igmp,
785 { "IGMP Snooping Support", "ismp.edp.opts",
786 FT_BOOLEAN, 32, TFS(&is_set), EDP_SWITCH_OPTION_IGMP,
789 { &hf_ismp_edp_switch_option_route,
790 { "Route Bridging", "ismp.edp.opts",
791 FT_BOOLEAN, 32, TFS(&is_set), EDP_SWITCH_OPTION_ROUTE,
794 { &hf_ismp_edp_switch_option_trans,
795 { "Transparent Bridging", "ismp.edp.opts",
796 FT_BOOLEAN, 32, TFS(&is_set), EDP_SWITCH_OPTION_TRANS,
799 { &hf_ismp_edp_switch_option_level1,
800 { "Level 1 Functionality", "ismp.edp.opts",
801 FT_BOOLEAN, 32, TFS(&is_set), EDP_SWITCH_OPTION_LEVEL1,
804 { &hf_ismp_edp_end_station_option_dhcp,
805 { "DHCP Enabled", "ismp.edp.opts",
806 FT_BOOLEAN, 32, TFS(&is_set), EDP_END_STATION_OPTION_DHCP,
809 { &hf_ismp_edp_end_station_option_dns,
810 { "DNS Enabled", "ismp.edp.opts",
811 FT_BOOLEAN, 32, TFS(&is_set), EDP_END_STATION_OPTION_DNS,
814 { &hf_ismp_edp_end_station_option_ad,
815 { "Active Directory Enabled", "ismp.edp.opts",
816 FT_BOOLEAN, 32, TFS(&is_set), EDP_END_STATION_OPTION_AD,
819 { &hf_ismp_edp_num_neighbors,
820 { "Number of Known Neighbors", "ismp.edp.maccount",
821 FT_UINT16, BASE_DEC, NULL, 0x0,
824 { &hf_ismp_edp_neighbors,
825 { "Neighbors", "ismp.edp.nbrs",
826 FT_BYTES, BASE_NONE, NULL, 0x0,
829 { &hf_ismp_edp_num_tuples,
830 { "Number of Tuples", "ismp.edp.numtups",
831 FT_UINT16, BASE_DEC, NULL, 0x0,
834 { &hf_ismp_edp_tuples,
835 { "Number of Tuples", "ismp.edp.tups",
836 FT_BYTES, BASE_NONE, NULL, 0x0,
841 /* Setup protocol subtree array */
842 static gint *ett[] = {
845 &ett_ismp_edp_options,
846 &ett_ismp_edp_neighbors,
847 &ett_ismp_edp_neighbors_leaf,
848 &ett_ismp_edp_tuples,
849 &ett_ismp_edp_tuples_leaf,
852 /* Register the protocol name and description */
853 proto_ismp = proto_register_protocol("InterSwitch Message Protocol",
856 /* Required function calls to register the header fields and subtrees used */
857 proto_register_field_array(proto_ismp, hf, array_length(hf));
858 proto_register_subtree_array(ett, array_length(ett));
862 /* If this dissector uses sub-dissector registration add a registration routine.
863 This format is required because a script is used to find these routines and
864 create the code that calls these routines.
867 proto_reg_handoff_ismp(void)
869 dissector_handle_t ismp_handle;
871 ismp_handle = create_dissector_handle(dissect_ismp,
873 dissector_add("ethertype", ETHERTYPE_ISMP, ismp_handle);