epan/dissectors/pidl/samr/samr.cnf cnf_dissect_lsa_BinaryString => lsarpc_dissect_str...
[wireshark-sm.git] / epan / dissectors / packet-ndp.c
blobfea47d169f30f5d48a6374318f14696786d187aa
1 /* packet-ndp.c
2 * Routines for the disassembly of the Nortel Discovery Protocol, formerly
3 * the SynOptics Network Management Protocol (SONMP).
4 * (c) Copyright Giles Scott <giles.scott1 [AT] arubanetworks.com>
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * SPDX-License-Identifier: GPL-2.0-or-later
12 * This protocol has gone by many names over the years:
14 * Bay Discovery Protocol (BDP), Bay Topology Protocol, Bay Network Management
15 * Protocol (BNMP), Nortel Management MIB (NMM), Nortel Topology Discovery
16 * Protocol (NTDP), SynOptics Network Management Protocol (SONMP).
17 * (source: Wikipedia article on "Nortel Discovery Protocol")
21 #include "config.h"
23 #include <epan/packet.h>
25 void proto_register_ndp(void);
26 void proto_reg_handoff_ndp(void);
28 /* Although this protocol is proprietary it is documented in the SynOptics MIB's
29 * So I'm not giving anything away :-)
30 * The only thing I have not done is decode the segment identifier;
31 * This changes so much depending on whether the chassis supports
32 * multi-segment autotopology. As the 5000 is now EOL don't see much point.
34 * MIB's s5emt104.mib, s5tcs112.mib, synro199.mib these should be available via
35 * http://www.nortelnetworks.com
39 /* chassis types */
40 /* Last updated from version 229 ("200609010000Z") of SnpxChassisType in SYNOPTICS-ROOT-MIB.mib */
41 static const value_string ndp_chassis_val[] =
43 { 1, "other"},
44 { 2, "3000"},
45 { 3, "3030"},
46 { 4, "2310"},
47 { 5, "2810"},
48 { 6, "2912"},
49 { 7, "2914"},
50 { 8, "271x"},
51 { 9, "2813"},
52 { 10, "2814"},
53 { 11, "2915"},
54 { 12, "5000"},
55 { 13, "2813SA"},
56 { 14, "2814SA"},
57 { 15, "810M"},
58 { 16, "Ethercell"},
59 { 17, "5005"},
60 { 18, "Alcatel Ethernet workgroup conc."},
62 { 20, "2715SA"},
63 { 21, "2486"},
64 { 22, "28000 series"},
65 { 23, "23000 series"},
66 { 24, "5DN00x series"},
67 { 25, "BayStack Ethernet"},
68 { 26, "23100 series"},
69 { 27, "100Base-T Hub"},
70 { 28, "3000 Fast Ethernet"},
71 { 29, "Orion switch"},
72 /* 30 is "not used" */
73 { 31, "DDS"},
74 { 32, "Centillion (6 slot)"},
75 { 33, "Centillion (12 slot)"},
76 { 34, "Centillion (1 slot)"},
77 { 35, "BayStack 301"},
78 { 36, "BayStack TokenRing Hub"},
79 { 37, "FVC Multimedia Switch"},
80 { 38, "Switch Node"},
81 { 39, "BayStack 302 Switch"},
82 { 40, "BayStack 350 Switch"},
83 { 41, "BayStack 150 Ethernet Hub"},
84 { 42, "Centillion 50N switch"},
85 { 43, "Centillion 50T switch"},
86 { 44, "BayStack 303 and 304 Switches"},
87 { 45, "BayStack 200 Ethernet Hub"},
88 { 46, "BayStack 250 10/100 Ethernet Hub"},
89 /*{ 47, "StackProbe"}, XXX - No longer listed */
90 { 48, "BayStack 450 10/100/1000 Switches"},
91 { 49, "BayStack 410 10/100 Switches"},
92 { 50, "Passport 1200 L3 Switch"},
93 { 51, "Passport 1250 L3 Switch"},
94 { 52, "Passport 1100 L3 Switch"},
95 { 53, "Passport 1150 L3 Switch"},
96 { 54, "Passport 1050 L3 Switch"},
97 { 55, "Passport 1051 L3 Switch"},
98 { 56, "Passport 8610 L3 Switch"},
99 { 57, "Passport 8606 L3 Switch"},
100 { 58, "Passport 8010"},
101 { 59, "Passport 8006"},
102 { 60, "BayStack 670 wireless access point"},
103 { 61, "Passport 740"},
104 { 62, "Passport 750"},
105 { 63, "Passport 790"},
106 { 64, "Business Policy Switch 2000 10/100 Switches"},
107 { 65, "Passport 8110 L2 Switch"},
108 { 66, "Passport 8106 L2 Switch"},
109 { 67, "BayStack 3580 Gig Switch"},
110 { 68, "BayStack 10 Power Supply Unit"},
111 { 69, "BayStack 420 10/100 Switch"},
112 { 70, "OPTera Metro 1200 Ethernet Service Module"},
113 { 71, "OPTera 8010co"},
114 { 72, "OPTera 8610co L3 switch"},
115 { 73, "OPTera 8110co L2 switch"},
116 { 74, "OPTera 8003"},
117 { 75, "OPTera 8603 L3 switch"},
118 { 76, "OPTera 8103 L2 switch"},
119 { 77, "BayStack 380 10/100/1000 Switch"},
120 { 78, "Ethernet Switch 470-48T"},
121 { 79, "OPTera Metro 1450 Ethernet Service Module"},
122 { 80, "OPTera Metro 1400 Ethernet Service Module"},
123 { 81, "Alteon Switch Family"},
124 { 82, "Ethernet Switch 460-24T-PWR"},
125 { 83, "OPTera Metro 8010 OPM L2 Switch"},
126 { 84, "OPTera Metro 8010co OPM L2 Switch"},
127 { 85, "OPTera Metro 8006 OPM L2 Switch"},
128 { 86, "OPTera Metro 8003 OPM L2 Switch"},
129 { 87, "Alteon 180e"},
130 { 88, "Alteon AD3"},
131 { 89, "Alteon 184"},
132 { 90, "Alteon AD4"},
133 { 91, "Passport 1424 L3 switch"},
134 { 92, "Passport 1648 L3 switch"},
135 { 93, "Passport 1612 L3 switch"},
136 { 94, "Passport 1624 L3 switch"},
137 { 95, "BayStack 380-24F Fiber 1000 Switch"},
138 { 96, "Ethernet Routing Switch 5510-24T"},
139 { 97, "Ethernet Routing Switch 5510-48T"},
140 { 98, "Ethernet Switch 470-24T"},
141 { 99, "Nortel Networks Wireless LAN Access Point 2220"},
142 {100, "Passport RBS 2402 L3 switch"},
143 {101, "Alteon Application Switch 2424"},
144 {102, "Alteon Application Switch 2224"},
145 {103, "Alteon Application Switch 2208"},
146 {104, "Alteon Application Switch 2216"},
147 {105, "Alteon Application Switch 3408"},
148 {106, "Alteon Application Switch 3416"},
149 {107, "Nortel Networks Wireless LAN SecuritySwitch 2250"},
150 {108, "Ethernet Switch 425-48T"},
151 {109, "Ethernet Switch 425-24T"},
152 {110, "Nortel Networks Wireless LAN Access Point 2221"},
153 {111, "Nortel Metro Ethernet Service Unit 24-T SPF switch"},
154 {112, " Nortel Metro Ethernet Service Unit 24-T LX DC switch"},
155 {113, "Passport 8300 10-slot chassis"},
156 {114, "Passport 8300 6-slot chassis"},
157 {115, "Ethernet Routing Switch 5520-24T-PWR"},
158 {116, "Ethernet Routing Switch 5520-48T-PWR"},
159 {117, "Nortel Networks VPN Gateway 3050"},
160 {118, "Alteon SSL 310 10/100"},
161 {119, "Alteon SSL 310 10/100 Fiber"},
162 {120, "Alteon SSL 310 10/100 FIPS"},
163 {121, "Alteon SSL 410 10/100/1000"},
164 {122, "Alteon SSL 410 10/100/1000 Fiber"},
165 {123, "Alteon Application Switch 2424-SSL"},
166 {124, "Ethernet Switch 325-24T"},
167 {125, "Ethernet Switch 325-24G"},
168 {126, "Nortel Networks Wireless LAN Access Point 2225"},
169 {127, "Nortel Networks Wireless LAN SecuritySwitch 2270"},
170 {128, "24-port Ethernet Switch 470-24T-PWR"},
171 {129, "48-port Ethernet Switch 470-48T-PWR"},
172 {130, "Ethernet Routing Switch 5530-24TFD"},
173 {131, "Ethernet Switch 3510-24T"},
174 {132, "Nortel Metro Ethernet Service Unit 12G AC L3 switch"},
175 {133, "Nortel Metro Ethernet Service Unit 12G DC L3 switch"},
176 {134, "Nortel Secure Access Switch"},
177 {135, "Nortel Networks VPN Gateway 3070"},
178 {136, "OPTera Metro 3500"},
179 {137, "SMB BES 1010 24T"},
180 {138, "SMB BES 1010 48T"},
181 {139, "SMB BES 1020 24T PWR"},
182 {140, "SMB BES 1020 48T PWR"},
183 {141, "SMB BES 2010 24T"},
184 {142, "SMB BES 2010 48T"},
185 {143, "SMB BES 2020 24T PWR"},
186 {144, "SMB BES 2020 48T PWR"},
187 {145, "SMB BES 110 24T"},
188 {146, "SMB BES 110 48T"},
189 {147, "SMB BES 120 24T PWR"},
190 {148, "SMB BES 120 48T PWR"},
191 {149, "SMB BES 210 24T"},
192 {150, "SMB BES 210 48T"},
193 {151, "SMB BES 220 24T PWR"},
194 {152, "SMB BES 220 48T PWR"},
195 {153, "OME 6500"},
196 {154, "Ethernet Routing Switch 4548GT"},
197 {155, "Ethernet Routing Switch 4548GT-PWR"},
198 {156, "Ethernet Routing Switch 4550T"},
199 {157, "Ethernet Routing Switch 4550T-PWR"},
200 {158, "Ethernet Routing Switch 4526FX"},
201 {159, "Ethernet Routing Switch 2500-26T"},
202 {160, "Ethernet Routing Switch 2500-26T-PWR"},
203 {161, "Ethernet Routing Switch 2500-50T"},
204 {162, "Ethernet Routing Switch 2500-50T-PWR"},
205 {213, "Virtual Services Platform 8284XSQ"},
206 {0, NULL}
208 static value_string_ext ndp_chassis_val_ext = VALUE_STRING_EXT_INIT(ndp_chassis_val);
210 /* from synro179.mib - SnpxBackplaneType */
211 static const value_string ndp_backplane_val[] =
213 { 1, "Other"},
214 { 2, "Ethernet"},
215 { 3, "Ethernet and Tokenring"},
216 { 4, "Ethernet and FDDI"},
217 { 5, "Ethernet, Tokenring and FDDI"},
218 { 6, "Ethernet and Tokenring with redundant power"},
219 { 7, "Ethernet, Tokenring, FDDI with redundant power"},
220 { 8, "Token Ring"},
221 { 9, "Ethernet, Tokenring and Fast Ethernet"},
222 {10, "Ethernet and Fast Ethernet"},
223 {11, "Ethernet, Tokenring, Fast Ethernet with redundant power"},
224 {12, "Ethernet, Fast Ethernet and Gigabit Ethernet"},
225 {0, NULL}
227 static value_string_ext ndp_backplane_val_ext = VALUE_STRING_EXT_INIT(ndp_backplane_val);
229 static const value_string ndp_state_val[] =
231 {1, "Topology Change"},
232 {2, "Heartbeat"},
233 {3, "New"},
234 {0, NULL}
238 /* Offsets in NDP Hello structure. */
239 #define NDP_IP_ADDRESS 0
240 #define NDP_SEGMENT_IDENTIFIER 4
241 #define NDP_CHASSIS_TYPE 7
242 #define NDP_BACKPLANE_TYPE 8
243 #define NDP_STATE 9
244 #define NDP_NUMBER_OF_LINKS 10
246 static int proto_ndp;
247 static int hf_ndp_ip_address;
248 static int hf_ndp_segment_identifier;
249 static int hf_ndp_chassis_type;
250 static int hf_ndp_backplane_type;
251 static int hf_ndp_state;
252 static int hf_ndp_number_of_links;
254 static int ett_ndp;
256 static dissector_handle_t ndp_handle;
258 static int
259 dissect_ndp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
261 const char *hello_type;
262 proto_tree *ndp_tree = NULL;
263 proto_item *ti;
265 col_set_str(pinfo->cinfo, COL_PROTOCOL, "NDP");
267 hello_type = "";
268 if (pinfo->dl_dst.type == AT_ETHER) {
269 const uint8_t *dstmac = (const uint8_t *)pinfo->dl_dst.data;
271 switch (dstmac[5]) {
273 case 0:
274 hello_type = "Segment ";
275 break;
277 case 1:
278 hello_type = "FlatNet ";
279 break;
282 col_add_fstr(pinfo->cinfo, COL_INFO, "%sHello", hello_type);
284 if (tree) {
285 ti = proto_tree_add_protocol_format(tree, proto_ndp, tvb, 0, 11,
286 "Nortel Discovery Protocol");
288 ndp_tree = proto_item_add_subtree(ti, ett_ndp);
290 proto_tree_add_item(ndp_tree, hf_ndp_ip_address, tvb,
291 NDP_IP_ADDRESS, 4, ENC_BIG_ENDIAN);
294 proto_tree_add_item(ndp_tree, hf_ndp_segment_identifier, tvb,
295 NDP_SEGMENT_IDENTIFIER, 3, ENC_BIG_ENDIAN);
298 proto_tree_add_item(ndp_tree, hf_ndp_chassis_type, tvb,
299 NDP_CHASSIS_TYPE, 1, ENC_BIG_ENDIAN);
301 proto_tree_add_item(ndp_tree, hf_ndp_backplane_type, tvb,
302 NDP_BACKPLANE_TYPE, 1, ENC_BIG_ENDIAN);
305 proto_tree_add_item(ndp_tree, hf_ndp_state, tvb,
306 NDP_STATE, 1, ENC_BIG_ENDIAN);
308 proto_tree_add_item(ndp_tree, hf_ndp_number_of_links, tvb,
309 NDP_NUMBER_OF_LINKS, 1, ENC_BIG_ENDIAN);
312 return tvb_captured_length(tvb);
317 void
318 proto_register_ndp(void)
320 static hf_register_info hf[] = {
321 { &hf_ndp_ip_address,
322 { "IP address", "ndp.ipaddress", FT_IPv4, BASE_NONE, NULL, 0x0,
323 "IP address of the Network Management Module (NMM)", HFILL }},
325 { &hf_ndp_segment_identifier,
326 { "Segment Identifier", "ndp.segmentident", FT_UINT24, BASE_HEX, NULL, 0x0,
327 "Segment id of the segment from which the agent is sending the topology message", HFILL }},
329 { &hf_ndp_chassis_type,
330 { "Chassis type", "ndp.chassis", FT_UINT8, BASE_DEC|BASE_EXT_STRING,
331 &ndp_chassis_val_ext, 0x0,
332 "Chassis type of the agent sending the topology message", HFILL }},
334 { &hf_ndp_backplane_type,
335 { "Backplane type", "ndp.backplane", FT_UINT8, BASE_DEC|BASE_EXT_STRING,
336 &ndp_backplane_val_ext, 0x0,
337 "Backplane type of the agent sending the topology message", HFILL }},
339 { &hf_ndp_state,
340 { "State", "ndp.state", FT_UINT8, BASE_DEC,
341 VALS(ndp_state_val), 0x0,
342 "Current state of this Network Management Module (NMM)", HFILL }},
344 { &hf_ndp_number_of_links,
345 { "Number of links", "ndp.numberoflinks", FT_UINT8, BASE_DEC, NULL, 0x0,
346 "Number of interconnect ports", HFILL }},
349 static int *ett[] = {
350 &ett_ndp,
352 proto_ndp = proto_register_protocol("Nortel Discovery Protocol", "NDP", "ndp");
353 proto_register_field_array(proto_ndp, hf, array_length(hf));
354 proto_register_subtree_array(ett, array_length(ett));
356 ndp_handle = register_dissector("ndp", dissect_ndp, proto_ndp);
359 void
360 proto_reg_handoff_ndp(void)
362 dissector_add_uint("llc.nortel_pid", 0x01a1, ndp_handle); /* flatnet hello */
363 dissector_add_uint("llc.nortel_pid", 0x01a2, ndp_handle); /* Segment hello */
364 /* not got round to adding this but it's really old, so I'm not sure people will see it */
365 /* it uses a different packet format */
366 /* dissector_add_uint("llc.nortel_pid", 0x01a3, ndp_handle); */ /* Bridge hello */
370 * Editor modelines - https://www.wireshark.org/tools/modelines.html
372 * Local variables:
373 * c-basic-offset: 8
374 * tab-width: 8
375 * indent-tabs-mode: t
376 * End:
378 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
379 * :indentSize=8:tabSize=8:noTabs=false: