2 * Routines for the disassembly of the "Nortel Networks / SynOptics Network Management Protocol"
3 * (c) Copyright Giles Scott <giles.scott1 [AT] btinternet.com>
5 * $Id: packet-nt-sonmp.c,v 1.5 2004/02/23 16:33:14 jmayer Exp $
7 * Ethereal - Network traffic analyzer
8 * By Gerald Combs <gerald@ethereal.com>
9 * Copyright 1998 Gerald Combs
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
28 #ifdef HAVE_SYS_TYPES_H
29 #include <sys/types.h>
36 #include <epan/packet.h>
37 /* #include "strutil.h" */
40 /* Although this protocol is propietary it is documented in the SynOptics MIB's
41 * So I'm not giving anything away :-)
42 * The only thing I have not done is decode the segment identifier;
43 * This changes so much depending on whether the chassis supports
44 * multi-segment autotopology. As the 5000 is now EOL don't see much point.
46 * MIB's s5emt104.mib, s5tcs112.mib, synro179.mib these should be available via
47 * http://www.nortelnetworks.com
52 /* From synro193.mib - SnpxChassisType */
53 static value_string sonmp_chassis_val[] =
69 {16, "m1032x Ethercell"},
71 {18, "Alcatel Ethernet workgroup conc"},
79 {27, "BayStack100 hub"},
80 {28, "M3000 Fast ethernet"},
83 {32, "Centillion-sixSlot"},
84 {33, "Centillion-twelveSlot"},
85 {34, "Centillion-singleSlot"},
88 {37, "FVC Multimedia Switch"},
93 {42, "Centillion 50"},
94 {43, "Centillion 50tr"},
95 {44, "BayStack 303-304"},
100 {49, "BayStack 303-24T"},
101 {50, "Accelar 1200 L3 switch"},
102 {51, "Accelar 1250 L3 switch"},
103 {52, "Accelar 1100 L3 switch"},
104 {53, "Accelar 1150 L3 switch"},
105 {54, "Accelar 1050 L3 switch"},
106 {55, "Accelar 1051 L3 switch"},
107 {56, "Accelar 8610 L3 switch"},
108 {57, "Accelar 8006"},
109 {58, "Accelar 8010"},
110 {59, "Accelar 8006"},
111 {60, "BayStack 670"},
115 {64, "Business Policy switch 2000"},
116 {65, "Accelar 8110 L2 switch"},
117 {66, "Accelar 8106 L2 switch"},
118 {67, "BayStack 3580"},
119 {68, "Baystack 10 PSU"},
120 {69, "BayStack 420"},
121 {70, "OPTera Metro 1200ESM"},
122 {71, "OPTera 8010co"},
123 {72, "OPTera 8610co L3 switch"},
124 {73, "OPTera 8110co L2 switch"},
126 {75, "OPTera 8603 L3 switch"},
127 {76, "OPTera 8103 L2 switch"},
128 {77, "Baystack 380 10/100/1000 switch"},
129 {78, "Baystack 470 10/100 switch"},
130 {79, "OPTera Metro 1450ESM"},
131 {80, "OPTera Metro 1400ESM"},
132 {81, "Alteon switch family"},
133 {82, "BayStack 460-24T-PWR"},
134 {83, "OPTera Metro 8010 OPM L2 Switch"},
135 {84, "OPTera Metro 8010co OPM L2 Switch"},
136 {85, "OPTera Metro 8006 OPM L2 Switch"},
137 {86, "OPTera Metro 8003 OPM L2 Switch"},
142 {91, "Passport 1424 L3 switch"},
143 {92, "Passport 1648 L3 switch"},
144 {93, "Passport 1612 L3 switch"},
145 {94, "Passport 1624 L3 switch"},
146 {95, "BayStack 380-24F Fiber 1000 switch"},
147 {96, "BayStack 4700 24T switch"},
148 {97, "BayStack 4700 48T switch"},
149 {98, "BayStack 5510 24-port"},
150 {99, "BayStack 2200 Wireless LAN AP"},
151 {100, "passport RBS 2402 L3 switch"},
152 {101, "Alteon AAS 2424"},
153 {102, "Alteon AAS 2224"},
154 {103, "Alteon AAS 2208"},
155 {104, "Alteon AAS 2216"},
156 {105, "Alteon AAS 3408"},
157 {106, "Alteon AAS 3416"},
161 /* from synro179.mib - SnpxBackplaneType */
162 static value_string sonmp_backplane_val[] =
166 {3, "ethernet and tokenring"},
167 {4, "ethernet and FDDI"},
168 {5, "ethernet, tokenring and FDDI"},
169 {6, "ethernet and tokenring with redundant power"},
170 {7, "ethernet, tokenring, FDDI with redunadant power"},
172 {9, "ethernet, tokenring and fast ethernet"},
173 {10, "ethernet and fast ethernet"},
174 {11, "ethernet, tokenring, fast ethernet with redunant power"},
175 {12, "ethernet, fast ethernet and gigabit ethernet"},
179 static value_string sonmp_nmm_state_val[] =
181 {1, "Topology Change"},
188 /* Offsets in SONMP NMM Hello structure. */
189 #define SONMP_IP_ADDRESS 0
190 #define SONMP_SEGMENT_IDENTIFIER 4
191 #define SONMP_CHASSIS_TYPE 7
192 #define SONMP_BACKPLANE_TYPE 8
193 #define SONMP_NMM_STATE 9
194 #define SONMP_NUMBER_OF_LINKS 10
196 static int proto_sonmp = -1;
197 static int hf_sonmp_ip_address = -1;
198 /* static int hf_sonmp_segment_identifier = -1; */
199 static int hf_sonmp_chassis_type = -1;
200 static int hf_sonmp_backplane_type = -1;
201 static int hf_sonmp_nmm_state = -1;
202 static int hf_sonmp_number_of_links = -1;
204 static gint ett_sonmp = -1;
208 dissect_sonmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
211 guint32 sonmp_ip_address;
212 guint32 sonmp_segment_identifier = 0; /* actually 3 bytes not 4 */
213 guint8 sonmp_chassis_type;
214 guint8 sonmp_backplane_type;
215 guint8 sonmp_nmm_state;
216 guint8 sonmp_number_of_links;
218 proto_tree *sonmp_tree = NULL;
221 if (check_col(pinfo->cinfo, COL_PROTOCOL))
222 col_set_str(pinfo->cinfo, COL_PROTOCOL, "SONMP");
224 if (check_col(pinfo->cinfo, COL_INFO)) {
226 if (pinfo->dl_dst.type == AT_ETHER) {
228 switch (pinfo->dl_dst.data[5]) {
231 hello_type = "Segment ";
235 hello_type = "FlatNet ";
239 col_add_fstr(pinfo->cinfo, COL_INFO, "SONMP - %sHello",
244 ti = proto_tree_add_protocol_format(tree, proto_sonmp, tvb, 0, 11,
245 "Nortel Networks / SynOptics Network Management Protocol");
246 sonmp_tree = proto_item_add_subtree(ti, ett_sonmp);
248 sonmp_ip_address = tvb_get_letohl(tvb, SONMP_IP_ADDRESS);
249 proto_tree_add_ipv4(sonmp_tree, hf_sonmp_ip_address,
250 tvb, SONMP_IP_ADDRESS, 4, sonmp_ip_address);
252 /* there is probably a better way of doing this but i need to get three bytes :-( */
253 sonmp_segment_identifier = tvb_get_guint8(tvb, SONMP_SEGMENT_IDENTIFIER);
254 sonmp_segment_identifier = (sonmp_segment_identifier <<16) + tvb_get_ntohs(tvb, SONMP_SEGMENT_IDENTIFIER +1);
256 proto_tree_add_text(sonmp_tree,
257 tvb, SONMP_SEGMENT_IDENTIFIER, 3, "Segment identifier: %06x", sonmp_segment_identifier);
259 sonmp_chassis_type = tvb_get_guint8(tvb, SONMP_CHASSIS_TYPE);
261 proto_tree_add_uint_format(sonmp_tree, hf_sonmp_chassis_type, tvb, SONMP_CHASSIS_TYPE, 1, sonmp_chassis_type,
263 val_to_str(sonmp_chassis_type, sonmp_chassis_val, "Unknown"), sonmp_chassis_type);
265 sonmp_backplane_type = tvb_get_guint8(tvb, SONMP_BACKPLANE_TYPE);
266 proto_tree_add_uint_format(sonmp_tree, hf_sonmp_backplane_type, tvb, SONMP_BACKPLANE_TYPE, 1,sonmp_backplane_type,
267 "Backplane : %s (%u)",
268 val_to_str(sonmp_backplane_type, sonmp_backplane_val, "Unknown"), sonmp_backplane_type);
271 sonmp_nmm_state = tvb_get_guint8(tvb, SONMP_NMM_STATE);
272 proto_tree_add_uint_format(sonmp_tree, hf_sonmp_nmm_state,
273 tvb, SONMP_NMM_STATE, 1, sonmp_nmm_state,
274 "State: %s", val_to_str(sonmp_nmm_state, sonmp_nmm_state_val, "Unknown"));
276 sonmp_number_of_links = tvb_get_guint8(tvb, SONMP_NUMBER_OF_LINKS);
277 proto_tree_add_item(sonmp_tree, hf_sonmp_number_of_links,
278 tvb, SONMP_NUMBER_OF_LINKS, 1, sonmp_number_of_links);
287 proto_register_sonmp(void)
289 static hf_register_info hf[] = {
290 { &hf_sonmp_ip_address,
291 { "NMM IP address", "sonmp.ipaddress", FT_IPv4, BASE_NONE, NULL, 0x0,
292 "IP address of the agent (NMM)", HFILL }},
294 /* { &hf_sonmp_segment_identifier,
295 { "Segment Identifier", "sonmp.segmentident", FT_UINT24, BASE_HEX, NULL, 0x0,
296 "Segment id of the segment from which the agent is sending the topology message", HFILL }},
298 { &hf_sonmp_chassis_type,
299 { "Chassis type", "sonmp.chassis", FT_UINT8, BASE_DEC, NULL, 0x0,
300 "Chassis type of the agent sending the topology message", HFILL }},
302 { &hf_sonmp_backplane_type,
303 { "Backplane type", "sonmp.backplane", FT_UINT8, BASE_DEC, NULL, 0x0,
304 "Backplane type of the agent sending the topology message", HFILL }},
306 { &hf_sonmp_nmm_state,
307 { "NMM state", "sonmp.nmmstate", FT_UINT8, BASE_DEC, NULL, 0x0,
308 "Current state of this agent", HFILL }},
310 { &hf_sonmp_number_of_links,
311 { "Number of links", "sonmp.numberoflinks", FT_UINT8, BASE_DEC, NULL, 0x0,
312 "Number of interconnect ports", HFILL }},
315 static gint *ett[] = {
318 proto_sonmp = proto_register_protocol("Nortel SONMP", "SONMP", "sonmp");
319 proto_register_field_array(proto_sonmp, hf, array_length(hf));
320 proto_register_subtree_array(ett, array_length(ett));
322 register_dissector("sonmp", dissect_sonmp, proto_sonmp);
326 proto_reg_handoff_sonmp(void)
328 dissector_handle_t sonmp_handle;
330 sonmp_handle = create_dissector_handle(dissect_sonmp, proto_sonmp);
332 dissector_add("llc.nortel_pid", 0x01a1, sonmp_handle); /* flatnet hello */
333 dissector_add("llc.nortel_pid", 0x01a2, sonmp_handle); /* Segment hello */
334 /* not got round to adding this but its really old, so I'm not sure people will see it */
335 /* it uses a different packet format */
336 /* dissector_add("llc.nortel_pid", 0x01a3, sonmp_handle); */ /* Bridge hello */