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