print-lmp.c revision 1.12 1 1.1 christos /*
2 1.1 christos * Redistribution and use in source and binary forms, with or without
3 1.1 christos * modification, are permitted provided that: (1) source code
4 1.1 christos * distributions retain the above copyright notice and this paragraph
5 1.1 christos * in its entirety, and (2) distributions including binary code include
6 1.1 christos * the above copyright notice and this paragraph in its entirety in
7 1.1 christos * the documentation or other materials provided with the distribution.
8 1.1 christos * THIS SOFTWARE IS PROVIDED ``AS IS'' AND
9 1.1 christos * WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
10 1.1 christos * LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
11 1.1 christos * FOR A PARTICULAR PURPOSE.
12 1.1 christos *
13 1.10 christos * Original code by Hannes Gredler (hannes (at) gredler.at)
14 1.10 christos * Support for LMP service discovery extensions (defined by OIF UNI 1.0)
15 1.10 christos * added by Manu Pathak (mapathak (at) cisco.com), May 2005
16 1.1 christos */
17 1.1 christos
18 1.9 spz /* \summary: Link Management Protocol (LMP) printer */
19 1.9 spz
20 1.9 spz /* specification: RFC 4204 */
21 1.12 christos /* OIF UNI 1.0: https://web.archive.org/web/20160401194747/http://www.oiforum.com/public/documents/OIF-UNI-01.0.pdf */
22 1.9 spz
23 1.2 christos #include <sys/cdefs.h>
24 1.1 christos #ifndef lint
25 1.12 christos __RCSID("$NetBSD: print-lmp.c,v 1.12 2023/08/17 20:19:40 christos Exp $");
26 1.1 christos #endif
27 1.1 christos
28 1.1 christos #ifdef HAVE_CONFIG_H
29 1.12 christos #include <config.h>
30 1.1 christos #endif
31 1.1 christos
32 1.12 christos #include "netdissect-stdinc.h"
33 1.1 christos
34 1.12 christos #define ND_LONGJMP_FROM_TCHECK
35 1.8 christos #include "netdissect.h"
36 1.1 christos #include "extract.h"
37 1.1 christos #include "addrtoname.h"
38 1.1 christos #include "gmpls.h"
39 1.1 christos
40 1.11 christos
41 1.1 christos /*
42 1.1 christos * LMP common header
43 1.1 christos *
44 1.1 christos * 0 1 2 3
45 1.1 christos * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
46 1.1 christos * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
47 1.1 christos * | Vers | (Reserved) | Flags | Msg Type |
48 1.1 christos * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
49 1.1 christos * | LMP Length | (Reserved) |
50 1.1 christos * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
51 1.1 christos */
52 1.1 christos
53 1.1 christos struct lmp_common_header {
54 1.12 christos nd_uint16_t version_res;
55 1.12 christos nd_uint8_t flags;
56 1.12 christos nd_uint8_t msg_type;
57 1.12 christos nd_uint16_t length;
58 1.12 christos nd_byte reserved[2];
59 1.1 christos };
60 1.1 christos
61 1.1 christos #define LMP_VERSION 1
62 1.12 christos #define LMP_EXTRACT_VERSION(x) (((x)&0xf000)>>12)
63 1.1 christos
64 1.1 christos static const struct tok lmp_header_flag_values[] = {
65 1.1 christos { 0x01, "Control Channel Down"},
66 1.1 christos { 0x02, "LMP restart"},
67 1.1 christos { 0, NULL}
68 1.1 christos };
69 1.1 christos
70 1.1 christos static const struct tok lmp_obj_te_link_flag_values[] = {
71 1.1 christos { 0x01, "Fault Management Supported"},
72 1.1 christos { 0x02, "Link Verification Supported"},
73 1.1 christos { 0, NULL}
74 1.1 christos };
75 1.1 christos
76 1.1 christos static const struct tok lmp_obj_data_link_flag_values[] = {
77 1.1 christos { 0x01, "Data Link Port"},
78 1.1 christos { 0x02, "Allocated for user traffic"},
79 1.1 christos { 0x04, "Failed link"},
80 1.1 christos { 0, NULL}
81 1.1 christos };
82 1.1 christos
83 1.1 christos static const struct tok lmp_obj_channel_status_values[] = {
84 1.1 christos { 1, "Signal Okay"},
85 1.1 christos { 2, "Signal Degraded"},
86 1.1 christos { 3, "Signal Fail"},
87 1.1 christos { 0, NULL}
88 1.1 christos };
89 1.1 christos
90 1.1 christos static const struct tok lmp_obj_begin_verify_flag_values[] = {
91 1.1 christos { 0x0001, "Verify all links"},
92 1.1 christos { 0x0002, "Data link type"},
93 1.1 christos { 0, NULL}
94 1.1 christos };
95 1.1 christos
96 1.1 christos static const struct tok lmp_obj_begin_verify_error_values[] = {
97 1.1 christos { 0x01, "Link Verification Procedure Not supported"},
98 1.1 christos { 0x02, "Unwilling to verify"},
99 1.1 christos { 0x04, "Unsupported verification transport mechanism"},
100 1.1 christos { 0x08, "Link-Id configuration error"},
101 1.1 christos { 0x10, "Unknown object c-type"},
102 1.1 christos { 0, NULL}
103 1.1 christos };
104 1.1 christos
105 1.1 christos static const struct tok lmp_obj_link_summary_error_values[] = {
106 1.1 christos { 0x01, "Unacceptable non-negotiable LINK-SUMMARY parameters"},
107 1.1 christos { 0x02, "Renegotiate LINK-SUMMARY parameters"},
108 1.1 christos { 0x04, "Invalid TE-LINK Object"},
109 1.1 christos { 0x08, "Invalid DATA-LINK Object"},
110 1.1 christos { 0x10, "Unknown TE-LINK Object c-type"},
111 1.1 christos { 0x20, "Unknown DATA-LINK Object c-type"},
112 1.1 christos { 0, NULL}
113 1.1 christos };
114 1.1 christos
115 1.1 christos /* Service Config Supported Protocols Flags */
116 1.1 christos static const struct tok lmp_obj_service_config_sp_flag_values[] = {
117 1.1 christos { 0x01, "RSVP Supported"},
118 1.1 christos { 0x02, "LDP Supported"},
119 1.1 christos { 0, NULL}
120 1.1 christos };
121 1.1 christos
122 1.1 christos /* Service Config Client Port Service Attribute Transparency Flags */
123 1.1 christos static const struct tok lmp_obj_service_config_cpsa_tp_flag_values[] = {
124 1.1 christos { 0x01, "Path/VC Overhead Transparency Supported"},
125 1.1 christos { 0x02, "Line/MS Overhead Transparency Supported"},
126 1.1 christos { 0x04, "Section/RS Overhead Transparency Supported"},
127 1.1 christos { 0, NULL}
128 1.1 christos };
129 1.1 christos
130 1.1 christos /* Service Config Client Port Service Attribute Contiguous Concatenation Types Flags */
131 1.1 christos static const struct tok lmp_obj_service_config_cpsa_cct_flag_values[] = {
132 1.1 christos { 0x01, "Contiguous Concatenation Types Supported"},
133 1.1 christos { 0, NULL}
134 1.1 christos };
135 1.1 christos
136 1.1 christos /* Service Config Network Service Attributes Transparency Flags */
137 1.1 christos static const struct tok lmp_obj_service_config_nsa_transparency_flag_values[] = {
138 1.1 christos { 0x01, "Standard SOH/RSOH Transparency Supported"},
139 1.1 christos { 0x02, "Standard LOH/MSOH Transparency Supported"},
140 1.1 christos { 0, NULL}
141 1.1 christos };
142 1.1 christos
143 1.1 christos /* Service Config Network Service Attributes TCM Monitoring Flags */
144 1.1 christos static const struct tok lmp_obj_service_config_nsa_tcm_flag_values[] = {
145 1.1 christos { 0x01, "Transparent Tandem Connection Monitoring Supported"},
146 1.1 christos { 0, NULL}
147 1.1 christos };
148 1.1 christos
149 1.1 christos /* Network Service Attributes Network Diversity Flags */
150 1.1 christos static const struct tok lmp_obj_service_config_nsa_network_diversity_flag_values[] = {
151 1.1 christos { 0x01, "Node Diversity Supported"},
152 1.1 christos { 0x02, "Link Diversity Supported"},
153 1.1 christos { 0x04, "SRLG Diversity Supported"},
154 1.1 christos { 0, NULL}
155 1.1 christos };
156 1.1 christos
157 1.1 christos #define LMP_MSGTYPE_CONFIG 1
158 1.1 christos #define LMP_MSGTYPE_CONFIG_ACK 2
159 1.1 christos #define LMP_MSGTYPE_CONFIG_NACK 3
160 1.1 christos #define LMP_MSGTYPE_HELLO 4
161 1.1 christos #define LMP_MSGTYPE_VERIFY_BEGIN 5
162 1.1 christos #define LMP_MSGTYPE_VERIFY_BEGIN_ACK 6
163 1.1 christos #define LMP_MSGTYPE_VERIFY_BEGIN_NACK 7
164 1.1 christos #define LMP_MSGTYPE_VERIFY_END 8
165 1.1 christos #define LMP_MSGTYPE_VERIFY_END_ACK 9
166 1.1 christos #define LMP_MSGTYPE_TEST 10
167 1.1 christos #define LMP_MSGTYPE_TEST_STATUS_SUCCESS 11
168 1.1 christos #define LMP_MSGTYPE_TEST_STATUS_FAILURE 12
169 1.1 christos #define LMP_MSGTYPE_TEST_STATUS_ACK 13
170 1.1 christos #define LMP_MSGTYPE_LINK_SUMMARY 14
171 1.1 christos #define LMP_MSGTYPE_LINK_SUMMARY_ACK 15
172 1.1 christos #define LMP_MSGTYPE_LINK_SUMMARY_NACK 16
173 1.1 christos #define LMP_MSGTYPE_CHANNEL_STATUS 17
174 1.1 christos #define LMP_MSGTYPE_CHANNEL_STATUS_ACK 18
175 1.1 christos #define LMP_MSGTYPE_CHANNEL_STATUS_REQ 19
176 1.1 christos #define LMP_MSGTYPE_CHANNEL_STATUS_RESP 20
177 1.1 christos /* LMP Service Discovery message types defined by UNI 1.0 */
178 1.1 christos #define LMP_MSGTYPE_SERVICE_CONFIG 50
179 1.1 christos #define LMP_MSGTYPE_SERVICE_CONFIG_ACK 51
180 1.1 christos #define LMP_MSGTYPE_SERVICE_CONFIG_NACK 52
181 1.1 christos
182 1.1 christos static const struct tok lmp_msg_type_values[] = {
183 1.1 christos { LMP_MSGTYPE_CONFIG, "Config"},
184 1.1 christos { LMP_MSGTYPE_CONFIG_ACK, "Config ACK"},
185 1.1 christos { LMP_MSGTYPE_CONFIG_NACK, "Config NACK"},
186 1.1 christos { LMP_MSGTYPE_HELLO, "Hello"},
187 1.1 christos { LMP_MSGTYPE_VERIFY_BEGIN, "Begin Verify"},
188 1.1 christos { LMP_MSGTYPE_VERIFY_BEGIN_ACK, "Begin Verify ACK"},
189 1.1 christos { LMP_MSGTYPE_VERIFY_BEGIN_NACK, "Begin Verify NACK"},
190 1.1 christos { LMP_MSGTYPE_VERIFY_END, "End Verify"},
191 1.1 christos { LMP_MSGTYPE_VERIFY_END_ACK, "End Verify ACK"},
192 1.1 christos { LMP_MSGTYPE_TEST, "Test"},
193 1.1 christos { LMP_MSGTYPE_TEST_STATUS_SUCCESS, "Test Status Success"},
194 1.1 christos { LMP_MSGTYPE_TEST_STATUS_FAILURE, "Test Status Failure"},
195 1.1 christos { LMP_MSGTYPE_TEST_STATUS_ACK, "Test Status ACK"},
196 1.1 christos { LMP_MSGTYPE_LINK_SUMMARY, "Link Summary"},
197 1.1 christos { LMP_MSGTYPE_LINK_SUMMARY_ACK, "Link Summary ACK"},
198 1.1 christos { LMP_MSGTYPE_LINK_SUMMARY_NACK, "Link Summary NACK"},
199 1.1 christos { LMP_MSGTYPE_CHANNEL_STATUS, "Channel Status"},
200 1.1 christos { LMP_MSGTYPE_CHANNEL_STATUS_ACK, "Channel Status ACK"},
201 1.1 christos { LMP_MSGTYPE_CHANNEL_STATUS_REQ, "Channel Status Request"},
202 1.1 christos { LMP_MSGTYPE_CHANNEL_STATUS_RESP, "Channel Status Response"},
203 1.1 christos { LMP_MSGTYPE_SERVICE_CONFIG, "Service Config"},
204 1.1 christos { LMP_MSGTYPE_SERVICE_CONFIG_ACK, "Service Config ACK"},
205 1.1 christos { LMP_MSGTYPE_SERVICE_CONFIG_NACK, "Service Config NACK"},
206 1.1 christos { 0, NULL}
207 1.1 christos };
208 1.1 christos
209 1.6 christos /*
210 1.1 christos * LMP object header
211 1.1 christos *
212 1.1 christos * 0 1 2 3
213 1.1 christos * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
214 1.1 christos * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
215 1.1 christos * |N| C-Type | Class | Length |
216 1.1 christos * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
217 1.1 christos * | |
218 1.1 christos * // (object contents) //
219 1.1 christos * | |
220 1.6 christos * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
221 1.1 christos */
222 1.1 christos
223 1.1 christos struct lmp_object_header {
224 1.12 christos nd_uint8_t ctype;
225 1.12 christos nd_uint8_t class_num;
226 1.12 christos nd_uint16_t length;
227 1.1 christos };
228 1.1 christos
229 1.1 christos #define LMP_OBJ_CC_ID 1
230 1.1 christos #define LMP_OBJ_NODE_ID 2
231 1.1 christos #define LMP_OBJ_LINK_ID 3
232 1.1 christos #define LMP_OBJ_INTERFACE_ID 4
233 1.6 christos #define LMP_OBJ_MESSAGE_ID 5
234 1.1 christos #define LMP_OBJ_CONFIG 6
235 1.1 christos #define LMP_OBJ_HELLO 7
236 1.1 christos #define LMP_OBJ_VERIFY_BEGIN 8
237 1.1 christos #define LMP_OBJ_VERIFY_BEGIN_ACK 9
238 1.1 christos #define LMP_OBJ_VERIFY_ID 10
239 1.1 christos #define LMP_OBJ_TE_LINK 11
240 1.1 christos #define LMP_OBJ_DATA_LINK 12
241 1.1 christos #define LMP_OBJ_CHANNEL_STATUS 13
242 1.1 christos #define LMP_OBJ_CHANNEL_STATUS_REQ 14
243 1.1 christos #define LMP_OBJ_ERROR_CODE 20
244 1.1 christos
245 1.1 christos #define LMP_OBJ_SERVICE_CONFIG 51 /* defined in UNI 1.0 */
246 1.1 christos
247 1.1 christos static const struct tok lmp_obj_values[] = {
248 1.1 christos { LMP_OBJ_CC_ID, "Control Channel ID" },
249 1.1 christos { LMP_OBJ_NODE_ID, "Node ID" },
250 1.1 christos { LMP_OBJ_LINK_ID, "Link ID" },
251 1.1 christos { LMP_OBJ_INTERFACE_ID, "Interface ID" },
252 1.1 christos { LMP_OBJ_MESSAGE_ID, "Message ID" },
253 1.1 christos { LMP_OBJ_CONFIG, "Configuration" },
254 1.1 christos { LMP_OBJ_HELLO, "Hello" },
255 1.1 christos { LMP_OBJ_VERIFY_BEGIN, "Verify Begin" },
256 1.1 christos { LMP_OBJ_VERIFY_BEGIN_ACK, "Verify Begin ACK" },
257 1.1 christos { LMP_OBJ_VERIFY_ID, "Verify ID" },
258 1.1 christos { LMP_OBJ_TE_LINK, "TE Link" },
259 1.1 christos { LMP_OBJ_DATA_LINK, "Data Link" },
260 1.1 christos { LMP_OBJ_CHANNEL_STATUS, "Channel Status" },
261 1.1 christos { LMP_OBJ_CHANNEL_STATUS_REQ, "Channel Status Request" },
262 1.1 christos { LMP_OBJ_ERROR_CODE, "Error Code" },
263 1.1 christos { LMP_OBJ_SERVICE_CONFIG, "Service Config" },
264 1.1 christos
265 1.1 christos { 0, NULL}
266 1.1 christos };
267 1.1 christos
268 1.1 christos #define INT_SWITCHING_TYPE_SUBOBJ 1
269 1.1 christos #define WAVELENGTH_SUBOBJ 2
270 1.1 christos
271 1.1 christos static const struct tok lmp_data_link_subobj[] = {
272 1.1 christos { INT_SWITCHING_TYPE_SUBOBJ, "Interface Switching Type" },
273 1.1 christos { WAVELENGTH_SUBOBJ , "Wavelength" },
274 1.1 christos { 0, NULL}
275 1.1 christos };
276 1.1 christos
277 1.1 christos #define LMP_CTYPE_IPV4 1
278 1.1 christos #define LMP_CTYPE_IPV6 2
279 1.1 christos
280 1.1 christos #define LMP_CTYPE_LOC 1
281 1.1 christos #define LMP_CTYPE_RMT 2
282 1.1 christos #define LMP_CTYPE_UNMD 3
283 1.6 christos
284 1.1 christos #define LMP_CTYPE_IPV4_LOC 1
285 1.1 christos #define LMP_CTYPE_IPV4_RMT 2
286 1.1 christos #define LMP_CTYPE_IPV6_LOC 3
287 1.1 christos #define LMP_CTYPE_IPV6_RMT 4
288 1.6 christos #define LMP_CTYPE_UNMD_LOC 5
289 1.6 christos #define LMP_CTYPE_UNMD_RMT 6
290 1.1 christos
291 1.1 christos #define LMP_CTYPE_1 1
292 1.1 christos #define LMP_CTYPE_2 2
293 1.1 christos
294 1.1 christos #define LMP_CTYPE_HELLO_CONFIG 1
295 1.1 christos #define LMP_CTYPE_HELLO 1
296 1.1 christos
297 1.1 christos #define LMP_CTYPE_BEGIN_VERIFY_ERROR 1
298 1.1 christos #define LMP_CTYPE_LINK_SUMMARY_ERROR 2
299 1.1 christos
300 1.1 christos /* C-Types for Service Config Object */
301 1.1 christos #define LMP_CTYPE_SERVICE_CONFIG_SP 1
302 1.1 christos #define LMP_CTYPE_SERVICE_CONFIG_CPSA 2
303 1.1 christos #define LMP_CTYPE_SERVICE_CONFIG_TRANSPARENCY_TCM 3
304 1.1 christos #define LMP_CTYPE_SERVICE_CONFIG_NETWORK_DIVERSITY 4
305 1.1 christos
306 1.6 christos /*
307 1.1 christos * Different link types allowed in the Client Port Service Attributes
308 1.1 christos * subobject defined for LMP Service Discovery in the UNI 1.0 spec
309 1.1 christos */
310 1.1 christos #define LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SDH 5 /* UNI 1.0 Sec 9.4.2 */
311 1.1 christos #define LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SONET 6 /* UNI 1.0 Sec 9.4.2 */
312 1.1 christos
313 1.1 christos /*
314 1.1 christos * the ctypes are not globally unique so for
315 1.1 christos * translating it to strings we build a table based
316 1.1 christos * on objects offsetted by the ctype
317 1.1 christos */
318 1.1 christos
319 1.1 christos static const struct tok lmp_ctype_values[] = {
320 1.1 christos { 256*LMP_OBJ_CC_ID+LMP_CTYPE_LOC, "Local" },
321 1.1 christos { 256*LMP_OBJ_CC_ID+LMP_CTYPE_RMT, "Remote" },
322 1.1 christos { 256*LMP_OBJ_NODE_ID+LMP_CTYPE_LOC, "Local" },
323 1.1 christos { 256*LMP_OBJ_NODE_ID+LMP_CTYPE_RMT, "Remote" },
324 1.1 christos { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_IPV4_LOC, "IPv4 Local" },
325 1.1 christos { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_IPV4_RMT, "IPv4 Remote" },
326 1.1 christos { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_IPV6_LOC, "IPv6 Local" },
327 1.1 christos { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_IPV6_RMT, "IPv6 Remote" },
328 1.1 christos { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_UNMD_LOC, "Unnumbered Local" },
329 1.1 christos { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_UNMD_RMT, "Unnumbered Remote" },
330 1.1 christos { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_IPV4_LOC, "IPv4 Local" },
331 1.1 christos { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_IPV4_RMT, "IPv4 Remote" },
332 1.1 christos { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_IPV6_LOC, "IPv6 Local" },
333 1.1 christos { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_IPV6_RMT, "IPv6 Remote" },
334 1.1 christos { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_UNMD_LOC, "Unnumbered Local" },
335 1.1 christos { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_UNMD_RMT, "Unnumbered Remote" },
336 1.1 christos { 256*LMP_OBJ_MESSAGE_ID+LMP_CTYPE_1, "1" },
337 1.1 christos { 256*LMP_OBJ_MESSAGE_ID+LMP_CTYPE_2, "2" },
338 1.1 christos { 256*LMP_OBJ_CONFIG+LMP_CTYPE_1, "1" },
339 1.1 christos { 256*LMP_OBJ_HELLO+LMP_CTYPE_1, "1" },
340 1.1 christos { 256*LMP_OBJ_VERIFY_BEGIN+LMP_CTYPE_1, "1" },
341 1.1 christos { 256*LMP_OBJ_VERIFY_BEGIN_ACK+LMP_CTYPE_1, "1" },
342 1.1 christos { 256*LMP_OBJ_VERIFY_ID+LMP_CTYPE_1, "1" },
343 1.1 christos { 256*LMP_OBJ_TE_LINK+LMP_CTYPE_IPV4, "IPv4" },
344 1.1 christos { 256*LMP_OBJ_TE_LINK+LMP_CTYPE_IPV6, "IPv6" },
345 1.1 christos { 256*LMP_OBJ_TE_LINK+LMP_CTYPE_UNMD, "Unnumbered" },
346 1.1 christos { 256*LMP_OBJ_DATA_LINK+LMP_CTYPE_IPV4, "IPv4" },
347 1.1 christos { 256*LMP_OBJ_DATA_LINK+LMP_CTYPE_IPV6, "IPv6" },
348 1.1 christos { 256*LMP_OBJ_DATA_LINK+LMP_CTYPE_UNMD, "Unnumbered" },
349 1.1 christos { 256*LMP_OBJ_CHANNEL_STATUS+LMP_CTYPE_IPV4, "IPv4" },
350 1.1 christos { 256*LMP_OBJ_CHANNEL_STATUS+LMP_CTYPE_IPV6, "IPv6" },
351 1.1 christos { 256*LMP_OBJ_CHANNEL_STATUS+LMP_CTYPE_UNMD, "Unnumbered" },
352 1.1 christos { 256*LMP_OBJ_CHANNEL_STATUS_REQ+LMP_CTYPE_IPV4, "IPv4" },
353 1.1 christos { 256*LMP_OBJ_CHANNEL_STATUS_REQ+LMP_CTYPE_IPV6, "IPv6" },
354 1.1 christos { 256*LMP_OBJ_CHANNEL_STATUS_REQ+LMP_CTYPE_UNMD, "Unnumbered" },
355 1.1 christos { 256*LMP_OBJ_ERROR_CODE+LMP_CTYPE_1, "1" },
356 1.1 christos { 256*LMP_OBJ_ERROR_CODE+LMP_CTYPE_2, "2" },
357 1.1 christos { 256*LMP_OBJ_SERVICE_CONFIG+LMP_CTYPE_SERVICE_CONFIG_SP, "1" },
358 1.1 christos { 256*LMP_OBJ_SERVICE_CONFIG+LMP_CTYPE_SERVICE_CONFIG_CPSA, "2" },
359 1.1 christos { 256*LMP_OBJ_SERVICE_CONFIG+LMP_CTYPE_SERVICE_CONFIG_TRANSPARENCY_TCM, "3" },
360 1.1 christos { 256*LMP_OBJ_SERVICE_CONFIG+LMP_CTYPE_SERVICE_CONFIG_NETWORK_DIVERSITY, "4" },
361 1.1 christos { 0, NULL}
362 1.1 christos };
363 1.1 christos
364 1.10 christos static int
365 1.10 christos lmp_print_data_link_subobjs(netdissect_options *ndo, const u_char *obj_tptr,
366 1.10 christos int total_subobj_len, int offset)
367 1.10 christos {
368 1.10 christos int hexdump = FALSE;
369 1.10 christos int subobj_type, subobj_len;
370 1.10 christos
371 1.10 christos union { /* int to float conversion buffer */
372 1.10 christos float f;
373 1.10 christos uint32_t i;
374 1.10 christos } bw;
375 1.10 christos
376 1.10 christos while (total_subobj_len > 0 && hexdump == FALSE ) {
377 1.12 christos subobj_type = GET_U_1(obj_tptr + offset);
378 1.12 christos subobj_len = GET_U_1(obj_tptr + offset + 1);
379 1.12 christos ND_PRINT("\n\t Subobject, Type: %s (%u), Length: %u",
380 1.10 christos tok2str(lmp_data_link_subobj,
381 1.10 christos "Unknown",
382 1.10 christos subobj_type),
383 1.10 christos subobj_type,
384 1.12 christos subobj_len);
385 1.10 christos if (subobj_len < 4) {
386 1.12 christos ND_PRINT(" (too short)");
387 1.10 christos break;
388 1.10 christos }
389 1.10 christos if ((subobj_len % 4) != 0) {
390 1.12 christos ND_PRINT(" (not a multiple of 4)");
391 1.10 christos break;
392 1.10 christos }
393 1.10 christos if (total_subobj_len < subobj_len) {
394 1.12 christos ND_PRINT(" (goes past the end of the object)");
395 1.10 christos break;
396 1.10 christos }
397 1.10 christos switch(subobj_type) {
398 1.10 christos case INT_SWITCHING_TYPE_SUBOBJ:
399 1.12 christos ND_PRINT("\n\t Switching Type: %s (%u)",
400 1.10 christos tok2str(gmpls_switch_cap_values,
401 1.10 christos "Unknown",
402 1.12 christos GET_U_1(obj_tptr + offset + 2)),
403 1.12 christos GET_U_1(obj_tptr + offset + 2));
404 1.12 christos ND_PRINT("\n\t Encoding Type: %s (%u)",
405 1.10 christos tok2str(gmpls_encoding_values,
406 1.10 christos "Unknown",
407 1.12 christos GET_U_1(obj_tptr + offset + 3)),
408 1.12 christos GET_U_1(obj_tptr + offset + 3));
409 1.12 christos bw.i = GET_BE_U_4(obj_tptr + offset + 4);
410 1.12 christos ND_PRINT("\n\t Min Reservable Bandwidth: %.3f Mbps",
411 1.12 christos bw.f*8/1000000);
412 1.12 christos bw.i = GET_BE_U_4(obj_tptr + offset + 8);
413 1.12 christos ND_PRINT("\n\t Max Reservable Bandwidth: %.3f Mbps",
414 1.12 christos bw.f*8/1000000);
415 1.10 christos break;
416 1.10 christos case WAVELENGTH_SUBOBJ:
417 1.12 christos ND_PRINT("\n\t Wavelength: %u",
418 1.12 christos GET_BE_U_4(obj_tptr + offset + 4));
419 1.10 christos break;
420 1.10 christos default:
421 1.10 christos /* Any Unknown Subobject ==> Exit loop */
422 1.10 christos hexdump=TRUE;
423 1.10 christos break;
424 1.10 christos }
425 1.10 christos total_subobj_len-=subobj_len;
426 1.10 christos offset+=subobj_len;
427 1.10 christos }
428 1.10 christos return (hexdump);
429 1.10 christos }
430 1.10 christos
431 1.1 christos void
432 1.6 christos lmp_print(netdissect_options *ndo,
433 1.12 christos const u_char *pptr, u_int length)
434 1.7 christos {
435 1.1 christos const struct lmp_common_header *lmp_com_header;
436 1.1 christos const u_char *tptr,*obj_tptr;
437 1.12 christos u_int version_res, tlen, lmp_obj_len, lmp_obj_ctype, obj_tlen;
438 1.12 christos int hexdump;
439 1.10 christos u_int offset;
440 1.10 christos u_int link_type;
441 1.1 christos
442 1.1 christos union { /* int to float conversion buffer */
443 1.6 christos float f;
444 1.6 christos uint32_t i;
445 1.1 christos } bw;
446 1.1 christos
447 1.12 christos ndo->ndo_protocol = "lmp";
448 1.1 christos tptr=pptr;
449 1.1 christos lmp_com_header = (const struct lmp_common_header *)pptr;
450 1.12 christos ND_TCHECK_SIZE(lmp_com_header);
451 1.12 christos
452 1.12 christos version_res = GET_BE_U_2(lmp_com_header->version_res);
453 1.1 christos
454 1.1 christos /*
455 1.1 christos * Sanity checking of the header.
456 1.1 christos */
457 1.12 christos if (LMP_EXTRACT_VERSION(version_res) != LMP_VERSION) {
458 1.12 christos ND_PRINT("LMP version %u packet not supported",
459 1.12 christos LMP_EXTRACT_VERSION(version_res));
460 1.1 christos return;
461 1.1 christos }
462 1.1 christos
463 1.1 christos /* in non-verbose mode just lets print the basic Message Type*/
464 1.6 christos if (ndo->ndo_vflag < 1) {
465 1.12 christos ND_PRINT("LMPv%u %s Message, length: %u",
466 1.12 christos LMP_EXTRACT_VERSION(version_res),
467 1.12 christos tok2str(lmp_msg_type_values, "unknown (%u)",GET_U_1(lmp_com_header->msg_type)),
468 1.12 christos length);
469 1.1 christos return;
470 1.1 christos }
471 1.1 christos
472 1.1 christos /* ok they seem to want to know everything - lets fully decode it */
473 1.1 christos
474 1.12 christos tlen=GET_BE_U_2(lmp_com_header->length);
475 1.1 christos
476 1.12 christos ND_PRINT("\n\tLMPv%u, msg-type: %s, Flags: [%s], length: %u",
477 1.12 christos LMP_EXTRACT_VERSION(version_res),
478 1.12 christos tok2str(lmp_msg_type_values, "unknown, type: %u",GET_U_1(lmp_com_header->msg_type)),
479 1.12 christos bittok2str(lmp_header_flag_values,"none",GET_U_1(lmp_com_header->flags)),
480 1.12 christos tlen);
481 1.12 christos if (tlen < sizeof(struct lmp_common_header)) {
482 1.12 christos ND_PRINT(" (too short)");
483 1.10 christos return;
484 1.10 christos }
485 1.12 christos if (tlen > length) {
486 1.12 christos ND_PRINT(" (too long)");
487 1.12 christos tlen = length;
488 1.10 christos }
489 1.1 christos
490 1.12 christos tptr+=sizeof(struct lmp_common_header);
491 1.12 christos tlen-=sizeof(struct lmp_common_header);
492 1.1 christos
493 1.1 christos while(tlen>0) {
494 1.12 christos const struct lmp_object_header *lmp_obj_header =
495 1.12 christos (const struct lmp_object_header *)tptr;
496 1.12 christos lmp_obj_len=GET_BE_U_2(lmp_obj_header->length);
497 1.12 christos lmp_obj_ctype=GET_U_1(lmp_obj_header->ctype)&0x7f;
498 1.1 christos
499 1.12 christos ND_PRINT("\n\t %s Object (%u), Class-Type: %s (%u) Flags: [%snegotiable], length: %u",
500 1.1 christos tok2str(lmp_obj_values,
501 1.1 christos "Unknown",
502 1.12 christos GET_U_1(lmp_obj_header->class_num)),
503 1.12 christos GET_U_1(lmp_obj_header->class_num),
504 1.1 christos tok2str(lmp_ctype_values,
505 1.1 christos "Unknown",
506 1.12 christos (GET_U_1(lmp_obj_header->class_num)<<8)+lmp_obj_ctype),
507 1.1 christos lmp_obj_ctype,
508 1.12 christos GET_U_1(lmp_obj_header->ctype)&0x80 ? "" : "non-",
509 1.12 christos lmp_obj_len);
510 1.1 christos
511 1.10 christos if (lmp_obj_len < 4) {
512 1.12 christos ND_PRINT(" (too short)");
513 1.10 christos return;
514 1.10 christos }
515 1.10 christos if ((lmp_obj_len % 4) != 0) {
516 1.12 christos ND_PRINT(" (not a multiple of 4)");
517 1.10 christos return;
518 1.10 christos }
519 1.10 christos
520 1.1 christos obj_tptr=tptr+sizeof(struct lmp_object_header);
521 1.1 christos obj_tlen=lmp_obj_len-sizeof(struct lmp_object_header);
522 1.1 christos
523 1.1 christos /* did we capture enough for fully decoding the object ? */
524 1.12 christos ND_TCHECK_LEN(tptr, lmp_obj_len);
525 1.1 christos hexdump=FALSE;
526 1.1 christos
527 1.12 christos switch(GET_U_1(lmp_obj_header->class_num)) {
528 1.1 christos
529 1.1 christos case LMP_OBJ_CC_ID:
530 1.1 christos switch(lmp_obj_ctype) {
531 1.1 christos case LMP_CTYPE_LOC:
532 1.1 christos case LMP_CTYPE_RMT:
533 1.10 christos if (obj_tlen != 4) {
534 1.12 christos ND_PRINT(" (not correct for object)");
535 1.10 christos break;
536 1.10 christos }
537 1.12 christos ND_PRINT("\n\t Control Channel ID: %u (0x%08x)",
538 1.12 christos GET_BE_U_4(obj_tptr),
539 1.12 christos GET_BE_U_4(obj_tptr));
540 1.1 christos break;
541 1.1 christos
542 1.1 christos default:
543 1.1 christos hexdump=TRUE;
544 1.1 christos }
545 1.1 christos break;
546 1.1 christos
547 1.1 christos case LMP_OBJ_LINK_ID:
548 1.1 christos case LMP_OBJ_INTERFACE_ID:
549 1.1 christos switch(lmp_obj_ctype) {
550 1.1 christos case LMP_CTYPE_IPV4_LOC:
551 1.1 christos case LMP_CTYPE_IPV4_RMT:
552 1.10 christos if (obj_tlen != 4) {
553 1.12 christos ND_PRINT(" (not correct for object)");
554 1.10 christos break;
555 1.10 christos }
556 1.12 christos ND_PRINT("\n\t IPv4 Link ID: %s (0x%08x)",
557 1.12 christos GET_IPADDR_STRING(obj_tptr),
558 1.12 christos GET_BE_U_4(obj_tptr));
559 1.1 christos break;
560 1.1 christos case LMP_CTYPE_IPV6_LOC:
561 1.1 christos case LMP_CTYPE_IPV6_RMT:
562 1.10 christos if (obj_tlen != 16) {
563 1.12 christos ND_PRINT(" (not correct for object)");
564 1.10 christos break;
565 1.10 christos }
566 1.12 christos ND_PRINT("\n\t IPv6 Link ID: %s (0x%08x)",
567 1.12 christos GET_IP6ADDR_STRING(obj_tptr),
568 1.12 christos GET_BE_U_4(obj_tptr));
569 1.1 christos break;
570 1.1 christos case LMP_CTYPE_UNMD_LOC:
571 1.1 christos case LMP_CTYPE_UNMD_RMT:
572 1.10 christos if (obj_tlen != 4) {
573 1.12 christos ND_PRINT(" (not correct for object)");
574 1.10 christos break;
575 1.10 christos }
576 1.12 christos ND_PRINT("\n\t Link ID: %u (0x%08x)",
577 1.12 christos GET_BE_U_4(obj_tptr),
578 1.12 christos GET_BE_U_4(obj_tptr));
579 1.1 christos break;
580 1.1 christos default:
581 1.1 christos hexdump=TRUE;
582 1.1 christos }
583 1.1 christos break;
584 1.1 christos
585 1.1 christos case LMP_OBJ_MESSAGE_ID:
586 1.1 christos switch(lmp_obj_ctype) {
587 1.1 christos case LMP_CTYPE_1:
588 1.10 christos if (obj_tlen != 4) {
589 1.12 christos ND_PRINT(" (not correct for object)");
590 1.10 christos break;
591 1.10 christos }
592 1.12 christos ND_PRINT("\n\t Message ID: %u (0x%08x)",
593 1.12 christos GET_BE_U_4(obj_tptr),
594 1.12 christos GET_BE_U_4(obj_tptr));
595 1.1 christos break;
596 1.1 christos case LMP_CTYPE_2:
597 1.10 christos if (obj_tlen != 4) {
598 1.12 christos ND_PRINT(" (not correct for object)");
599 1.10 christos break;
600 1.10 christos }
601 1.12 christos ND_PRINT("\n\t Message ID Ack: %u (0x%08x)",
602 1.12 christos GET_BE_U_4(obj_tptr),
603 1.12 christos GET_BE_U_4(obj_tptr));
604 1.1 christos break;
605 1.1 christos default:
606 1.1 christos hexdump=TRUE;
607 1.1 christos }
608 1.1 christos break;
609 1.1 christos
610 1.1 christos case LMP_OBJ_NODE_ID:
611 1.1 christos switch(lmp_obj_ctype) {
612 1.1 christos case LMP_CTYPE_LOC:
613 1.1 christos case LMP_CTYPE_RMT:
614 1.10 christos if (obj_tlen != 4) {
615 1.12 christos ND_PRINT(" (not correct for object)");
616 1.10 christos break;
617 1.10 christos }
618 1.12 christos ND_PRINT("\n\t Node ID: %s (0x%08x)",
619 1.12 christos GET_IPADDR_STRING(obj_tptr),
620 1.12 christos GET_BE_U_4(obj_tptr));
621 1.1 christos break;
622 1.1 christos
623 1.1 christos default:
624 1.1 christos hexdump=TRUE;
625 1.1 christos }
626 1.1 christos break;
627 1.1 christos
628 1.1 christos case LMP_OBJ_CONFIG:
629 1.1 christos switch(lmp_obj_ctype) {
630 1.1 christos case LMP_CTYPE_HELLO_CONFIG:
631 1.10 christos if (obj_tlen != 4) {
632 1.12 christos ND_PRINT(" (not correct for object)");
633 1.10 christos break;
634 1.10 christos }
635 1.12 christos ND_PRINT("\n\t Hello Interval: %u\n\t Hello Dead Interval: %u",
636 1.12 christos GET_BE_U_2(obj_tptr),
637 1.12 christos GET_BE_U_2(obj_tptr + 2));
638 1.1 christos break;
639 1.1 christos
640 1.1 christos default:
641 1.1 christos hexdump=TRUE;
642 1.1 christos }
643 1.1 christos break;
644 1.6 christos
645 1.1 christos case LMP_OBJ_HELLO:
646 1.1 christos switch(lmp_obj_ctype) {
647 1.1 christos case LMP_CTYPE_HELLO:
648 1.10 christos if (obj_tlen != 8) {
649 1.12 christos ND_PRINT(" (not correct for object)");
650 1.10 christos break;
651 1.10 christos }
652 1.12 christos ND_PRINT("\n\t Tx Seq: %u, Rx Seq: %u",
653 1.12 christos GET_BE_U_4(obj_tptr),
654 1.12 christos GET_BE_U_4(obj_tptr + 4));
655 1.1 christos break;
656 1.1 christos
657 1.1 christos default:
658 1.1 christos hexdump=TRUE;
659 1.1 christos }
660 1.6 christos break;
661 1.6 christos
662 1.1 christos case LMP_OBJ_TE_LINK:
663 1.10 christos switch(lmp_obj_ctype) {
664 1.10 christos case LMP_CTYPE_IPV4:
665 1.10 christos if (obj_tlen != 12) {
666 1.12 christos ND_PRINT(" (not correct for object)");
667 1.10 christos break;
668 1.10 christos }
669 1.12 christos ND_PRINT("\n\t Flags: [%s]",
670 1.10 christos bittok2str(lmp_obj_te_link_flag_values,
671 1.1 christos "none",
672 1.12 christos GET_U_1(obj_tptr)));
673 1.6 christos
674 1.12 christos ND_PRINT("\n\t Local Link-ID: %s (0x%08x)"
675 1.5 christos "\n\t Remote Link-ID: %s (0x%08x)",
676 1.12 christos GET_IPADDR_STRING(obj_tptr+4),
677 1.12 christos GET_BE_U_4(obj_tptr + 4),
678 1.12 christos GET_IPADDR_STRING(obj_tptr+8),
679 1.12 christos GET_BE_U_4(obj_tptr + 8));
680 1.1 christos break;
681 1.6 christos
682 1.1 christos case LMP_CTYPE_IPV6:
683 1.10 christos if (obj_tlen != 36) {
684 1.12 christos ND_PRINT(" (not correct for object)");
685 1.10 christos break;
686 1.10 christos }
687 1.12 christos ND_PRINT("\n\t Flags: [%s]",
688 1.10 christos bittok2str(lmp_obj_te_link_flag_values,
689 1.10 christos "none",
690 1.12 christos GET_U_1(obj_tptr)));
691 1.10 christos
692 1.12 christos ND_PRINT("\n\t Local Link-ID: %s (0x%08x)"
693 1.10 christos "\n\t Remote Link-ID: %s (0x%08x)",
694 1.12 christos GET_IP6ADDR_STRING(obj_tptr+4),
695 1.12 christos GET_BE_U_4(obj_tptr + 4),
696 1.12 christos GET_IP6ADDR_STRING(obj_tptr+20),
697 1.12 christos GET_BE_U_4(obj_tptr + 20));
698 1.10 christos break;
699 1.10 christos
700 1.1 christos case LMP_CTYPE_UNMD:
701 1.10 christos if (obj_tlen != 12) {
702 1.12 christos ND_PRINT(" (not correct for object)");
703 1.10 christos break;
704 1.10 christos }
705 1.12 christos ND_PRINT("\n\t Flags: [%s]",
706 1.10 christos bittok2str(lmp_obj_te_link_flag_values,
707 1.10 christos "none",
708 1.12 christos GET_U_1(obj_tptr)));
709 1.10 christos
710 1.12 christos ND_PRINT("\n\t Local Link-ID: %u (0x%08x)"
711 1.10 christos "\n\t Remote Link-ID: %u (0x%08x)",
712 1.12 christos GET_BE_U_4(obj_tptr + 4),
713 1.12 christos GET_BE_U_4(obj_tptr + 4),
714 1.12 christos GET_BE_U_4(obj_tptr + 8),
715 1.12 christos GET_BE_U_4(obj_tptr + 8));
716 1.10 christos break;
717 1.10 christos
718 1.1 christos default:
719 1.1 christos hexdump=TRUE;
720 1.1 christos }
721 1.1 christos break;
722 1.6 christos
723 1.1 christos case LMP_OBJ_DATA_LINK:
724 1.1 christos switch(lmp_obj_ctype) {
725 1.1 christos case LMP_CTYPE_IPV4:
726 1.10 christos if (obj_tlen < 12) {
727 1.12 christos ND_PRINT(" (not correct for object)");
728 1.10 christos break;
729 1.10 christos }
730 1.12 christos ND_PRINT("\n\t Flags: [%s]",
731 1.10 christos bittok2str(lmp_obj_data_link_flag_values,
732 1.10 christos "none",
733 1.12 christos GET_U_1(obj_tptr)));
734 1.12 christos ND_PRINT("\n\t Local Interface ID: %s (0x%08x)"
735 1.5 christos "\n\t Remote Interface ID: %s (0x%08x)",
736 1.12 christos GET_IPADDR_STRING(obj_tptr+4),
737 1.12 christos GET_BE_U_4(obj_tptr + 4),
738 1.12 christos GET_IPADDR_STRING(obj_tptr+8),
739 1.12 christos GET_BE_U_4(obj_tptr + 8));
740 1.12 christos
741 1.12 christos if (lmp_print_data_link_subobjs(ndo, obj_tptr, obj_tlen - 12, 12))
742 1.10 christos hexdump=TRUE;
743 1.10 christos break;
744 1.10 christos
745 1.10 christos case LMP_CTYPE_IPV6:
746 1.10 christos if (obj_tlen < 36) {
747 1.12 christos ND_PRINT(" (not correct for object)");
748 1.10 christos break;
749 1.10 christos }
750 1.12 christos ND_PRINT("\n\t Flags: [%s]",
751 1.10 christos bittok2str(lmp_obj_data_link_flag_values,
752 1.10 christos "none",
753 1.12 christos GET_U_1(obj_tptr)));
754 1.12 christos ND_PRINT("\n\t Local Interface ID: %s (0x%08x)"
755 1.10 christos "\n\t Remote Interface ID: %s (0x%08x)",
756 1.12 christos GET_IP6ADDR_STRING(obj_tptr+4),
757 1.12 christos GET_BE_U_4(obj_tptr + 4),
758 1.12 christos GET_IP6ADDR_STRING(obj_tptr+20),
759 1.12 christos GET_BE_U_4(obj_tptr + 20));
760 1.12 christos
761 1.12 christos if (lmp_print_data_link_subobjs(ndo, obj_tptr, obj_tlen - 36, 36))
762 1.10 christos hexdump=TRUE;
763 1.10 christos break;
764 1.10 christos
765 1.10 christos case LMP_CTYPE_UNMD:
766 1.10 christos if (obj_tlen < 12) {
767 1.12 christos ND_PRINT(" (not correct for object)");
768 1.10 christos break;
769 1.10 christos }
770 1.12 christos ND_PRINT("\n\t Flags: [%s]",
771 1.10 christos bittok2str(lmp_obj_data_link_flag_values,
772 1.10 christos "none",
773 1.12 christos GET_U_1(obj_tptr)));
774 1.12 christos ND_PRINT("\n\t Local Interface ID: %u (0x%08x)"
775 1.10 christos "\n\t Remote Interface ID: %u (0x%08x)",
776 1.12 christos GET_BE_U_4(obj_tptr + 4),
777 1.12 christos GET_BE_U_4(obj_tptr + 4),
778 1.12 christos GET_BE_U_4(obj_tptr + 8),
779 1.12 christos GET_BE_U_4(obj_tptr + 8));
780 1.12 christos
781 1.12 christos if (lmp_print_data_link_subobjs(ndo, obj_tptr, obj_tlen - 12, 12))
782 1.10 christos hexdump=TRUE;
783 1.1 christos break;
784 1.10 christos
785 1.1 christos default:
786 1.1 christos hexdump=TRUE;
787 1.1 christos }
788 1.6 christos break;
789 1.6 christos
790 1.1 christos case LMP_OBJ_VERIFY_BEGIN:
791 1.1 christos switch(lmp_obj_ctype) {
792 1.1 christos case LMP_CTYPE_1:
793 1.10 christos if (obj_tlen != 20) {
794 1.12 christos ND_PRINT(" (not correct for object)");
795 1.10 christos break;
796 1.10 christos }
797 1.12 christos ND_PRINT("\n\t Flags: %s",
798 1.1 christos bittok2str(lmp_obj_begin_verify_flag_values,
799 1.1 christos "none",
800 1.12 christos GET_BE_U_2(obj_tptr)));
801 1.12 christos ND_PRINT("\n\t Verify Interval: %u",
802 1.12 christos GET_BE_U_2(obj_tptr + 2));
803 1.12 christos ND_PRINT("\n\t Data links: %u",
804 1.12 christos GET_BE_U_4(obj_tptr + 4));
805 1.12 christos ND_PRINT("\n\t Encoding type: %s",
806 1.12 christos tok2str(gmpls_encoding_values, "Unknown", GET_U_1((obj_tptr + 8))));
807 1.12 christos ND_PRINT("\n\t Verify Transport Mechanism: %u (0x%x)%s",
808 1.12 christos GET_BE_U_2(obj_tptr + 10),
809 1.12 christos GET_BE_U_2(obj_tptr + 10),
810 1.12 christos GET_BE_U_2(obj_tptr + 10)&8000 ? " (Payload test messages capable)" : "");
811 1.12 christos bw.i = GET_BE_U_4(obj_tptr + 12);
812 1.12 christos ND_PRINT("\n\t Transmission Rate: %.3f Mbps",bw.f*8/1000000);
813 1.12 christos ND_PRINT("\n\t Wavelength: %u",
814 1.12 christos GET_BE_U_4(obj_tptr + 16));
815 1.1 christos break;
816 1.6 christos
817 1.1 christos default:
818 1.1 christos hexdump=TRUE;
819 1.1 christos }
820 1.6 christos break;
821 1.6 christos
822 1.1 christos case LMP_OBJ_VERIFY_BEGIN_ACK:
823 1.1 christos switch(lmp_obj_ctype) {
824 1.1 christos case LMP_CTYPE_1:
825 1.10 christos if (obj_tlen != 4) {
826 1.12 christos ND_PRINT(" (not correct for object)");
827 1.10 christos break;
828 1.10 christos }
829 1.12 christos ND_PRINT("\n\t Verify Dead Interval: %u"
830 1.5 christos "\n\t Verify Transport Response: %u",
831 1.12 christos GET_BE_U_2(obj_tptr),
832 1.12 christos GET_BE_U_2(obj_tptr + 2));
833 1.1 christos break;
834 1.6 christos
835 1.1 christos default:
836 1.1 christos hexdump=TRUE;
837 1.1 christos }
838 1.6 christos break;
839 1.6 christos
840 1.1 christos case LMP_OBJ_VERIFY_ID:
841 1.1 christos switch(lmp_obj_ctype) {
842 1.1 christos case LMP_CTYPE_1:
843 1.10 christos if (obj_tlen != 4) {
844 1.12 christos ND_PRINT(" (not correct for object)");
845 1.10 christos break;
846 1.10 christos }
847 1.12 christos ND_PRINT("\n\t Verify ID: %u",
848 1.12 christos GET_BE_U_4(obj_tptr));
849 1.1 christos break;
850 1.6 christos
851 1.1 christos default:
852 1.1 christos hexdump=TRUE;
853 1.1 christos }
854 1.6 christos break;
855 1.6 christos
856 1.1 christos case LMP_OBJ_CHANNEL_STATUS:
857 1.1 christos switch(lmp_obj_ctype) {
858 1.1 christos case LMP_CTYPE_IPV4:
859 1.1 christos offset = 0;
860 1.1 christos /* Decode pairs: <Interface_ID (4 bytes), Channel_status (4 bytes)> */
861 1.10 christos while (offset+8 <= obj_tlen) {
862 1.12 christos ND_PRINT("\n\t Interface ID: %s (0x%08x)",
863 1.12 christos GET_IPADDR_STRING(obj_tptr+offset),
864 1.12 christos GET_BE_U_4(obj_tptr + offset));
865 1.12 christos
866 1.12 christos ND_PRINT("\n\t\t Active: %s (%u)",
867 1.12 christos (GET_BE_U_4(obj_tptr + offset + 4)>>31) ?
868 1.12 christos "Allocated" : "Non-allocated",
869 1.12 christos (GET_BE_U_4(obj_tptr + offset + 4)>>31));
870 1.12 christos
871 1.12 christos ND_PRINT("\n\t\t Direction: %s (%u)",
872 1.12 christos (GET_BE_U_4(obj_tptr + offset + 4)>>30)&0x1 ?
873 1.12 christos "Transmit" : "Receive",
874 1.12 christos (GET_BE_U_4(obj_tptr + offset + 4)>>30)&0x1);
875 1.6 christos
876 1.12 christos ND_PRINT("\n\t\t Channel Status: %s (%u)",
877 1.1 christos tok2str(lmp_obj_channel_status_values,
878 1.12 christos "Unknown",
879 1.12 christos GET_BE_U_4(obj_tptr + offset + 4)&0x3FFFFFF),
880 1.12 christos GET_BE_U_4(obj_tptr + offset + 4)&0x3FFFFFF);
881 1.1 christos offset+=8;
882 1.1 christos }
883 1.1 christos break;
884 1.10 christos
885 1.1 christos case LMP_CTYPE_IPV6:
886 1.10 christos offset = 0;
887 1.10 christos /* Decode pairs: <Interface_ID (16 bytes), Channel_status (4 bytes)> */
888 1.10 christos while (offset+20 <= obj_tlen) {
889 1.12 christos ND_PRINT("\n\t Interface ID: %s (0x%08x)",
890 1.12 christos GET_IP6ADDR_STRING(obj_tptr+offset),
891 1.12 christos GET_BE_U_4(obj_tptr + offset));
892 1.12 christos
893 1.12 christos ND_PRINT("\n\t\t Active: %s (%u)",
894 1.12 christos (GET_BE_U_4(obj_tptr + offset + 16)>>31) ?
895 1.12 christos "Allocated" : "Non-allocated",
896 1.12 christos (GET_BE_U_4(obj_tptr + offset + 16)>>31));
897 1.12 christos
898 1.12 christos ND_PRINT("\n\t\t Direction: %s (%u)",
899 1.12 christos (GET_BE_U_4(obj_tptr + offset + 16)>>30)&0x1 ?
900 1.12 christos "Transmit" : "Receive",
901 1.12 christos (GET_BE_U_4(obj_tptr + offset + 16)>>30)&0x1);
902 1.10 christos
903 1.12 christos ND_PRINT("\n\t\t Channel Status: %s (%u)",
904 1.10 christos tok2str(lmp_obj_channel_status_values,
905 1.10 christos "Unknown",
906 1.12 christos GET_BE_U_4(obj_tptr + offset + 16)&0x3FFFFFF),
907 1.12 christos GET_BE_U_4(obj_tptr + offset + 16)&0x3FFFFFF);
908 1.10 christos offset+=20;
909 1.10 christos }
910 1.10 christos break;
911 1.10 christos
912 1.10 christos case LMP_CTYPE_UNMD:
913 1.10 christos offset = 0;
914 1.10 christos /* Decode pairs: <Interface_ID (4 bytes), Channel_status (4 bytes)> */
915 1.10 christos while (offset+8 <= obj_tlen) {
916 1.12 christos ND_PRINT("\n\t Interface ID: %u (0x%08x)",
917 1.12 christos GET_BE_U_4(obj_tptr + offset),
918 1.12 christos GET_BE_U_4(obj_tptr + offset));
919 1.12 christos
920 1.12 christos ND_PRINT("\n\t\t Active: %s (%u)",
921 1.12 christos (GET_BE_U_4(obj_tptr + offset + 4)>>31) ?
922 1.12 christos "Allocated" : "Non-allocated",
923 1.12 christos (GET_BE_U_4(obj_tptr + offset + 4)>>31));
924 1.12 christos
925 1.12 christos ND_PRINT("\n\t\t Direction: %s (%u)",
926 1.12 christos (GET_BE_U_4(obj_tptr + offset + 4)>>30)&0x1 ?
927 1.12 christos "Transmit" : "Receive",
928 1.12 christos (GET_BE_U_4(obj_tptr + offset + 4)>>30)&0x1);
929 1.10 christos
930 1.12 christos ND_PRINT("\n\t\t Channel Status: %s (%u)",
931 1.10 christos tok2str(lmp_obj_channel_status_values,
932 1.10 christos "Unknown",
933 1.12 christos GET_BE_U_4(obj_tptr + offset + 4)&0x3FFFFFF),
934 1.12 christos GET_BE_U_4(obj_tptr + offset + 4)&0x3FFFFFF);
935 1.10 christos offset+=8;
936 1.10 christos }
937 1.10 christos break;
938 1.10 christos
939 1.1 christos default:
940 1.1 christos hexdump=TRUE;
941 1.1 christos }
942 1.6 christos break;
943 1.6 christos
944 1.1 christos case LMP_OBJ_CHANNEL_STATUS_REQ:
945 1.1 christos switch(lmp_obj_ctype) {
946 1.1 christos case LMP_CTYPE_IPV4:
947 1.1 christos offset = 0;
948 1.10 christos while (offset+4 <= obj_tlen) {
949 1.12 christos ND_PRINT("\n\t Interface ID: %s (0x%08x)",
950 1.12 christos GET_IPADDR_STRING(obj_tptr+offset),
951 1.12 christos GET_BE_U_4(obj_tptr + offset));
952 1.1 christos offset+=4;
953 1.1 christos }
954 1.1 christos break;
955 1.10 christos
956 1.1 christos case LMP_CTYPE_IPV6:
957 1.10 christos offset = 0;
958 1.10 christos while (offset+16 <= obj_tlen) {
959 1.12 christos ND_PRINT("\n\t Interface ID: %s (0x%08x)",
960 1.12 christos GET_IP6ADDR_STRING(obj_tptr+offset),
961 1.12 christos GET_BE_U_4(obj_tptr + offset));
962 1.10 christos offset+=16;
963 1.10 christos }
964 1.10 christos break;
965 1.10 christos
966 1.10 christos case LMP_CTYPE_UNMD:
967 1.10 christos offset = 0;
968 1.10 christos while (offset+4 <= obj_tlen) {
969 1.12 christos ND_PRINT("\n\t Interface ID: %u (0x%08x)",
970 1.12 christos GET_BE_U_4(obj_tptr + offset),
971 1.12 christos GET_BE_U_4(obj_tptr + offset));
972 1.10 christos offset+=4;
973 1.10 christos }
974 1.10 christos break;
975 1.10 christos
976 1.1 christos default:
977 1.1 christos hexdump=TRUE;
978 1.1 christos }
979 1.6 christos break;
980 1.6 christos
981 1.1 christos case LMP_OBJ_ERROR_CODE:
982 1.1 christos switch(lmp_obj_ctype) {
983 1.1 christos case LMP_CTYPE_BEGIN_VERIFY_ERROR:
984 1.10 christos if (obj_tlen != 4) {
985 1.12 christos ND_PRINT(" (not correct for object)");
986 1.10 christos break;
987 1.10 christos }
988 1.12 christos ND_PRINT("\n\t Error Code: %s",
989 1.1 christos bittok2str(lmp_obj_begin_verify_error_values,
990 1.1 christos "none",
991 1.12 christos GET_BE_U_4(obj_tptr)));
992 1.1 christos break;
993 1.6 christos
994 1.1 christos case LMP_CTYPE_LINK_SUMMARY_ERROR:
995 1.10 christos if (obj_tlen != 4) {
996 1.12 christos ND_PRINT(" (not correct for object)");
997 1.10 christos break;
998 1.10 christos }
999 1.12 christos ND_PRINT("\n\t Error Code: %s",
1000 1.1 christos bittok2str(lmp_obj_link_summary_error_values,
1001 1.1 christos "none",
1002 1.12 christos GET_BE_U_4(obj_tptr)));
1003 1.1 christos break;
1004 1.1 christos default:
1005 1.1 christos hexdump=TRUE;
1006 1.1 christos }
1007 1.6 christos break;
1008 1.1 christos
1009 1.1 christos case LMP_OBJ_SERVICE_CONFIG:
1010 1.1 christos switch (lmp_obj_ctype) {
1011 1.1 christos case LMP_CTYPE_SERVICE_CONFIG_SP:
1012 1.10 christos if (obj_tlen != 4) {
1013 1.12 christos ND_PRINT(" (not correct for object)");
1014 1.10 christos break;
1015 1.10 christos }
1016 1.12 christos ND_PRINT("\n\t Flags: %s",
1017 1.1 christos bittok2str(lmp_obj_service_config_sp_flag_values,
1018 1.6 christos "none",
1019 1.12 christos GET_U_1(obj_tptr)));
1020 1.1 christos
1021 1.12 christos ND_PRINT("\n\t UNI Version: %u",
1022 1.12 christos GET_U_1(obj_tptr + 1));
1023 1.1 christos
1024 1.1 christos break;
1025 1.6 christos
1026 1.1 christos case LMP_CTYPE_SERVICE_CONFIG_CPSA:
1027 1.10 christos if (obj_tlen != 16) {
1028 1.12 christos ND_PRINT(" (not correct for object)");
1029 1.10 christos break;
1030 1.10 christos }
1031 1.6 christos
1032 1.12 christos link_type = GET_U_1(obj_tptr);
1033 1.6 christos
1034 1.12 christos ND_PRINT("\n\t Link Type: %s (%u)",
1035 1.1 christos tok2str(lmp_sd_service_config_cpsa_link_type_values,
1036 1.1 christos "Unknown", link_type),
1037 1.12 christos link_type);
1038 1.6 christos
1039 1.10 christos switch (link_type) {
1040 1.10 christos case LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SDH:
1041 1.12 christos ND_PRINT("\n\t Signal Type: %s (%u)",
1042 1.1 christos tok2str(lmp_sd_service_config_cpsa_signal_type_sdh_values,
1043 1.1 christos "Unknown",
1044 1.12 christos GET_U_1(obj_tptr + 1)),
1045 1.12 christos GET_U_1(obj_tptr + 1));
1046 1.10 christos break;
1047 1.6 christos
1048 1.10 christos case LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SONET:
1049 1.12 christos ND_PRINT("\n\t Signal Type: %s (%u)",
1050 1.1 christos tok2str(lmp_sd_service_config_cpsa_signal_type_sonet_values,
1051 1.1 christos "Unknown",
1052 1.12 christos GET_U_1(obj_tptr + 1)),
1053 1.12 christos GET_U_1(obj_tptr + 1));
1054 1.10 christos break;
1055 1.1 christos }
1056 1.6 christos
1057 1.12 christos ND_PRINT("\n\t Transparency: %s",
1058 1.1 christos bittok2str(lmp_obj_service_config_cpsa_tp_flag_values,
1059 1.1 christos "none",
1060 1.12 christos GET_U_1(obj_tptr + 2)));
1061 1.6 christos
1062 1.12 christos ND_PRINT("\n\t Contiguous Concatenation Types: %s",
1063 1.1 christos bittok2str(lmp_obj_service_config_cpsa_cct_flag_values,
1064 1.1 christos "none",
1065 1.12 christos GET_U_1(obj_tptr + 3)));
1066 1.6 christos
1067 1.12 christos ND_PRINT("\n\t Minimum NCC: %u",
1068 1.12 christos GET_BE_U_2(obj_tptr + 4));
1069 1.6 christos
1070 1.12 christos ND_PRINT("\n\t Maximum NCC: %u",
1071 1.12 christos GET_BE_U_2(obj_tptr + 6));
1072 1.6 christos
1073 1.12 christos ND_PRINT("\n\t Minimum NVC:%u",
1074 1.12 christos GET_BE_U_2(obj_tptr + 8));
1075 1.6 christos
1076 1.12 christos ND_PRINT("\n\t Maximum NVC:%u",
1077 1.12 christos GET_BE_U_2(obj_tptr + 10));
1078 1.6 christos
1079 1.12 christos ND_PRINT("\n\t Local Interface ID: %s (0x%08x)",
1080 1.12 christos GET_IPADDR_STRING(obj_tptr+12),
1081 1.12 christos GET_BE_U_4(obj_tptr + 12));
1082 1.6 christos
1083 1.1 christos break;
1084 1.6 christos
1085 1.1 christos case LMP_CTYPE_SERVICE_CONFIG_TRANSPARENCY_TCM:
1086 1.10 christos if (obj_tlen != 8) {
1087 1.12 christos ND_PRINT(" (not correct for object)");
1088 1.10 christos break;
1089 1.10 christos }
1090 1.6 christos
1091 1.12 christos ND_PRINT("\n\t Transparency Flags: %s",
1092 1.1 christos bittok2str(
1093 1.1 christos lmp_obj_service_config_nsa_transparency_flag_values,
1094 1.1 christos "none",
1095 1.12 christos GET_BE_U_4(obj_tptr)));
1096 1.1 christos
1097 1.12 christos ND_PRINT("\n\t TCM Monitoring Flags: %s",
1098 1.1 christos bittok2str(
1099 1.1 christos lmp_obj_service_config_nsa_tcm_flag_values,
1100 1.1 christos "none",
1101 1.12 christos GET_U_1(obj_tptr + 7)));
1102 1.6 christos
1103 1.1 christos break;
1104 1.6 christos
1105 1.1 christos case LMP_CTYPE_SERVICE_CONFIG_NETWORK_DIVERSITY:
1106 1.10 christos if (obj_tlen != 4) {
1107 1.12 christos ND_PRINT(" (not correct for object)");
1108 1.10 christos break;
1109 1.10 christos }
1110 1.6 christos
1111 1.12 christos ND_PRINT("\n\t Diversity: Flags: %s",
1112 1.1 christos bittok2str(
1113 1.1 christos lmp_obj_service_config_nsa_network_diversity_flag_values,
1114 1.1 christos "none",
1115 1.12 christos GET_U_1(obj_tptr + 3)));
1116 1.1 christos break;
1117 1.1 christos
1118 1.1 christos default:
1119 1.1 christos hexdump = TRUE;
1120 1.9 spz }
1121 1.1 christos
1122 1.1 christos break;
1123 1.1 christos
1124 1.1 christos default:
1125 1.6 christos if (ndo->ndo_vflag <= 1)
1126 1.6 christos print_unknown_data(ndo,obj_tptr,"\n\t ",obj_tlen);
1127 1.1 christos break;
1128 1.1 christos }
1129 1.1 christos /* do we want to see an additionally hexdump ? */
1130 1.6 christos if (ndo->ndo_vflag > 1 || hexdump==TRUE)
1131 1.6 christos print_unknown_data(ndo,tptr+sizeof(struct lmp_object_header),"\n\t ",
1132 1.1 christos lmp_obj_len-sizeof(struct lmp_object_header));
1133 1.1 christos
1134 1.12 christos if (tlen < lmp_obj_len) {
1135 1.12 christos ND_PRINT(" [remaining objects length %u < %u]", tlen, lmp_obj_len);
1136 1.12 christos nd_print_invalid(ndo);
1137 1.12 christos break;
1138 1.12 christos }
1139 1.1 christos tptr+=lmp_obj_len;
1140 1.1 christos tlen-=lmp_obj_len;
1141 1.1 christos }
1142 1.1 christos }
1143