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.
13 * Support for the Link Management Protocol as per rfc 4204.
15 * Original code by Hannes Gredler (hannes@juniper.net)
16 * Support for LMP service discovery extensions (defined by UNI 1.0) added
17 * by Manu Pathak (mapathak@cisco.com), May 2005
20 #include <sys/cdefs.h>
22 __RCSID("$NetBSD: print-lmp.c,v 1.7 2015/03/31 21:59:35 christos Exp $");
25 #define NETDISSECT_REWORKED
30 #include <tcpdump-stdinc.h>
32 #include "interface.h"
34 #include "addrtoname.h"
41 * 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
42 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
43 * | Vers | (Reserved) | Flags | Msg Type |
44 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
45 * | LMP Length | (Reserved) |
46 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
49 struct lmp_common_header
{
50 uint8_t version_res
[2];
58 #define LMP_EXTRACT_VERSION(x) (((x)&0xf0)>>4)
60 static const struct tok lmp_header_flag_values
[] = {
61 { 0x01, "Control Channel Down"},
62 { 0x02, "LMP restart"},
66 static const struct tok lmp_obj_te_link_flag_values
[] = {
67 { 0x01, "Fault Management Supported"},
68 { 0x02, "Link Verification Supported"},
72 static const struct tok lmp_obj_data_link_flag_values
[] = {
73 { 0x01, "Data Link Port"},
74 { 0x02, "Allocated for user traffic"},
75 { 0x04, "Failed link"},
79 static const struct tok lmp_obj_channel_status_values
[] = {
81 { 2, "Signal Degraded"},
86 static const struct tok lmp_obj_begin_verify_flag_values
[] = {
87 { 0x0001, "Verify all links"},
88 { 0x0002, "Data link type"},
92 static const struct tok lmp_obj_begin_verify_error_values
[] = {
93 { 0x01, "Link Verification Procedure Not supported"},
94 { 0x02, "Unwilling to verify"},
95 { 0x04, "Unsupported verification transport mechanism"},
96 { 0x08, "Link-Id configuration error"},
97 { 0x10, "Unknown object c-type"},
101 static const struct tok lmp_obj_link_summary_error_values
[] = {
102 { 0x01, "Unacceptable non-negotiable LINK-SUMMARY parameters"},
103 { 0x02, "Renegotiate LINK-SUMMARY parameters"},
104 { 0x04, "Invalid TE-LINK Object"},
105 { 0x08, "Invalid DATA-LINK Object"},
106 { 0x10, "Unknown TE-LINK Object c-type"},
107 { 0x20, "Unknown DATA-LINK Object c-type"},
111 /* Service Config Supported Protocols Flags */
112 static const struct tok lmp_obj_service_config_sp_flag_values
[] = {
113 { 0x01, "RSVP Supported"},
114 { 0x02, "LDP Supported"},
118 /* Service Config Client Port Service Attribute Transparency Flags */
119 static const struct tok lmp_obj_service_config_cpsa_tp_flag_values
[] = {
120 { 0x01, "Path/VC Overhead Transparency Supported"},
121 { 0x02, "Line/MS Overhead Transparency Supported"},
122 { 0x04, "Section/RS Overhead Transparency Supported"},
126 /* Service Config Client Port Service Attribute Contiguous Concatenation Types Flags */
127 static const struct tok lmp_obj_service_config_cpsa_cct_flag_values
[] = {
128 { 0x01, "Contiguous Concatenation Types Supported"},
132 /* Service Config Network Service Attributes Transparency Flags */
133 static const struct tok lmp_obj_service_config_nsa_transparency_flag_values
[] = {
134 { 0x01, "Standard SOH/RSOH Transparency Supported"},
135 { 0x02, "Standard LOH/MSOH Transparency Supported"},
139 /* Service Config Network Service Attributes TCM Monitoring Flags */
140 static const struct tok lmp_obj_service_config_nsa_tcm_flag_values
[] = {
141 { 0x01, "Transparent Tandem Connection Monitoring Supported"},
145 /* Network Service Attributes Network Diversity Flags */
146 static const struct tok lmp_obj_service_config_nsa_network_diversity_flag_values
[] = {
147 { 0x01, "Node Diversity Supported"},
148 { 0x02, "Link Diversity Supported"},
149 { 0x04, "SRLG Diversity Supported"},
153 #define LMP_MSGTYPE_CONFIG 1
154 #define LMP_MSGTYPE_CONFIG_ACK 2
155 #define LMP_MSGTYPE_CONFIG_NACK 3
156 #define LMP_MSGTYPE_HELLO 4
157 #define LMP_MSGTYPE_VERIFY_BEGIN 5
158 #define LMP_MSGTYPE_VERIFY_BEGIN_ACK 6
159 #define LMP_MSGTYPE_VERIFY_BEGIN_NACK 7
160 #define LMP_MSGTYPE_VERIFY_END 8
161 #define LMP_MSGTYPE_VERIFY_END_ACK 9
162 #define LMP_MSGTYPE_TEST 10
163 #define LMP_MSGTYPE_TEST_STATUS_SUCCESS 11
164 #define LMP_MSGTYPE_TEST_STATUS_FAILURE 12
165 #define LMP_MSGTYPE_TEST_STATUS_ACK 13
166 #define LMP_MSGTYPE_LINK_SUMMARY 14
167 #define LMP_MSGTYPE_LINK_SUMMARY_ACK 15
168 #define LMP_MSGTYPE_LINK_SUMMARY_NACK 16
169 #define LMP_MSGTYPE_CHANNEL_STATUS 17
170 #define LMP_MSGTYPE_CHANNEL_STATUS_ACK 18
171 #define LMP_MSGTYPE_CHANNEL_STATUS_REQ 19
172 #define LMP_MSGTYPE_CHANNEL_STATUS_RESP 20
173 /* LMP Service Discovery message types defined by UNI 1.0 */
174 #define LMP_MSGTYPE_SERVICE_CONFIG 50
175 #define LMP_MSGTYPE_SERVICE_CONFIG_ACK 51
176 #define LMP_MSGTYPE_SERVICE_CONFIG_NACK 52
178 static const struct tok lmp_msg_type_values
[] = {
179 { LMP_MSGTYPE_CONFIG
, "Config"},
180 { LMP_MSGTYPE_CONFIG_ACK
, "Config ACK"},
181 { LMP_MSGTYPE_CONFIG_NACK
, "Config NACK"},
182 { LMP_MSGTYPE_HELLO
, "Hello"},
183 { LMP_MSGTYPE_VERIFY_BEGIN
, "Begin Verify"},
184 { LMP_MSGTYPE_VERIFY_BEGIN_ACK
, "Begin Verify ACK"},
185 { LMP_MSGTYPE_VERIFY_BEGIN_NACK
, "Begin Verify NACK"},
186 { LMP_MSGTYPE_VERIFY_END
, "End Verify"},
187 { LMP_MSGTYPE_VERIFY_END_ACK
, "End Verify ACK"},
188 { LMP_MSGTYPE_TEST
, "Test"},
189 { LMP_MSGTYPE_TEST_STATUS_SUCCESS
, "Test Status Success"},
190 { LMP_MSGTYPE_TEST_STATUS_FAILURE
, "Test Status Failure"},
191 { LMP_MSGTYPE_TEST_STATUS_ACK
, "Test Status ACK"},
192 { LMP_MSGTYPE_LINK_SUMMARY
, "Link Summary"},
193 { LMP_MSGTYPE_LINK_SUMMARY_ACK
, "Link Summary ACK"},
194 { LMP_MSGTYPE_LINK_SUMMARY_NACK
, "Link Summary NACK"},
195 { LMP_MSGTYPE_CHANNEL_STATUS
, "Channel Status"},
196 { LMP_MSGTYPE_CHANNEL_STATUS_ACK
, "Channel Status ACK"},
197 { LMP_MSGTYPE_CHANNEL_STATUS_REQ
, "Channel Status Request"},
198 { LMP_MSGTYPE_CHANNEL_STATUS_RESP
, "Channel Status Response"},
199 { LMP_MSGTYPE_SERVICE_CONFIG
, "Service Config"},
200 { LMP_MSGTYPE_SERVICE_CONFIG_ACK
, "Service Config ACK"},
201 { LMP_MSGTYPE_SERVICE_CONFIG_NACK
, "Service Config NACK"},
209 * 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
210 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
211 * |N| C-Type | Class | Length |
212 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
214 * // (object contents) //
216 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
219 struct lmp_object_header
{
225 #define LMP_OBJ_CC_ID 1
226 #define LMP_OBJ_NODE_ID 2
227 #define LMP_OBJ_LINK_ID 3
228 #define LMP_OBJ_INTERFACE_ID 4
229 #define LMP_OBJ_MESSAGE_ID 5
230 #define LMP_OBJ_CONFIG 6
231 #define LMP_OBJ_HELLO 7
232 #define LMP_OBJ_VERIFY_BEGIN 8
233 #define LMP_OBJ_VERIFY_BEGIN_ACK 9
234 #define LMP_OBJ_VERIFY_ID 10
235 #define LMP_OBJ_TE_LINK 11
236 #define LMP_OBJ_DATA_LINK 12
237 #define LMP_OBJ_CHANNEL_STATUS 13
238 #define LMP_OBJ_CHANNEL_STATUS_REQ 14
239 #define LMP_OBJ_ERROR_CODE 20
241 #define LMP_OBJ_SERVICE_CONFIG 51 /* defined in UNI 1.0 */
243 static const struct tok lmp_obj_values
[] = {
244 { LMP_OBJ_CC_ID
, "Control Channel ID" },
245 { LMP_OBJ_NODE_ID
, "Node ID" },
246 { LMP_OBJ_LINK_ID
, "Link ID" },
247 { LMP_OBJ_INTERFACE_ID
, "Interface ID" },
248 { LMP_OBJ_MESSAGE_ID
, "Message ID" },
249 { LMP_OBJ_CONFIG
, "Configuration" },
250 { LMP_OBJ_HELLO
, "Hello" },
251 { LMP_OBJ_VERIFY_BEGIN
, "Verify Begin" },
252 { LMP_OBJ_VERIFY_BEGIN_ACK
, "Verify Begin ACK" },
253 { LMP_OBJ_VERIFY_ID
, "Verify ID" },
254 { LMP_OBJ_TE_LINK
, "TE Link" },
255 { LMP_OBJ_DATA_LINK
, "Data Link" },
256 { LMP_OBJ_CHANNEL_STATUS
, "Channel Status" },
257 { LMP_OBJ_CHANNEL_STATUS_REQ
, "Channel Status Request" },
258 { LMP_OBJ_ERROR_CODE
, "Error Code" },
259 { LMP_OBJ_SERVICE_CONFIG
, "Service Config" },
264 #define INT_SWITCHING_TYPE_SUBOBJ 1
265 #define WAVELENGTH_SUBOBJ 2
267 static const struct tok lmp_data_link_subobj
[] = {
268 { INT_SWITCHING_TYPE_SUBOBJ
, "Interface Switching Type" },
269 { WAVELENGTH_SUBOBJ
, "Wavelength" },
273 #define LMP_CTYPE_IPV4 1
274 #define LMP_CTYPE_IPV6 2
276 #define LMP_CTYPE_LOC 1
277 #define LMP_CTYPE_RMT 2
278 #define LMP_CTYPE_UNMD 3
280 #define LMP_CTYPE_IPV4_LOC 1
281 #define LMP_CTYPE_IPV4_RMT 2
282 #define LMP_CTYPE_IPV6_LOC 3
283 #define LMP_CTYPE_IPV6_RMT 4
284 #define LMP_CTYPE_UNMD_LOC 5
285 #define LMP_CTYPE_UNMD_RMT 6
287 #define LMP_CTYPE_1 1
288 #define LMP_CTYPE_2 2
290 #define LMP_CTYPE_HELLO_CONFIG 1
291 #define LMP_CTYPE_HELLO 1
293 #define LMP_CTYPE_BEGIN_VERIFY_ERROR 1
294 #define LMP_CTYPE_LINK_SUMMARY_ERROR 2
296 /* C-Types for Service Config Object */
297 #define LMP_CTYPE_SERVICE_CONFIG_SP 1
298 #define LMP_CTYPE_SERVICE_CONFIG_CPSA 2
299 #define LMP_CTYPE_SERVICE_CONFIG_TRANSPARENCY_TCM 3
300 #define LMP_CTYPE_SERVICE_CONFIG_NETWORK_DIVERSITY 4
303 * Different link types allowed in the Client Port Service Attributes
304 * subobject defined for LMP Service Discovery in the UNI 1.0 spec
306 #define LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SDH 5 /* UNI 1.0 Sec 9.4.2 */
307 #define LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SONET 6 /* UNI 1.0 Sec 9.4.2 */
310 * the ctypes are not globally unique so for
311 * translating it to strings we build a table based
312 * on objects offsetted by the ctype
315 static const struct tok lmp_ctype_values
[] = {
316 { 256*LMP_OBJ_CC_ID
+LMP_CTYPE_LOC
, "Local" },
317 { 256*LMP_OBJ_CC_ID
+LMP_CTYPE_RMT
, "Remote" },
318 { 256*LMP_OBJ_NODE_ID
+LMP_CTYPE_LOC
, "Local" },
319 { 256*LMP_OBJ_NODE_ID
+LMP_CTYPE_RMT
, "Remote" },
320 { 256*LMP_OBJ_LINK_ID
+LMP_CTYPE_IPV4_LOC
, "IPv4 Local" },
321 { 256*LMP_OBJ_LINK_ID
+LMP_CTYPE_IPV4_RMT
, "IPv4 Remote" },
322 { 256*LMP_OBJ_LINK_ID
+LMP_CTYPE_IPV6_LOC
, "IPv6 Local" },
323 { 256*LMP_OBJ_LINK_ID
+LMP_CTYPE_IPV6_RMT
, "IPv6 Remote" },
324 { 256*LMP_OBJ_LINK_ID
+LMP_CTYPE_UNMD_LOC
, "Unnumbered Local" },
325 { 256*LMP_OBJ_LINK_ID
+LMP_CTYPE_UNMD_RMT
, "Unnumbered Remote" },
326 { 256*LMP_OBJ_INTERFACE_ID
+LMP_CTYPE_IPV4_LOC
, "IPv4 Local" },
327 { 256*LMP_OBJ_INTERFACE_ID
+LMP_CTYPE_IPV4_RMT
, "IPv4 Remote" },
328 { 256*LMP_OBJ_INTERFACE_ID
+LMP_CTYPE_IPV6_LOC
, "IPv6 Local" },
329 { 256*LMP_OBJ_INTERFACE_ID
+LMP_CTYPE_IPV6_RMT
, "IPv6 Remote" },
330 { 256*LMP_OBJ_INTERFACE_ID
+LMP_CTYPE_UNMD_LOC
, "Unnumbered Local" },
331 { 256*LMP_OBJ_INTERFACE_ID
+LMP_CTYPE_UNMD_RMT
, "Unnumbered Remote" },
332 { 256*LMP_OBJ_MESSAGE_ID
+LMP_CTYPE_1
, "1" },
333 { 256*LMP_OBJ_MESSAGE_ID
+LMP_CTYPE_2
, "2" },
334 { 256*LMP_OBJ_CONFIG
+LMP_CTYPE_1
, "1" },
335 { 256*LMP_OBJ_HELLO
+LMP_CTYPE_1
, "1" },
336 { 256*LMP_OBJ_VERIFY_BEGIN
+LMP_CTYPE_1
, "1" },
337 { 256*LMP_OBJ_VERIFY_BEGIN_ACK
+LMP_CTYPE_1
, "1" },
338 { 256*LMP_OBJ_VERIFY_ID
+LMP_CTYPE_1
, "1" },
339 { 256*LMP_OBJ_TE_LINK
+LMP_CTYPE_IPV4
, "IPv4" },
340 { 256*LMP_OBJ_TE_LINK
+LMP_CTYPE_IPV6
, "IPv6" },
341 { 256*LMP_OBJ_TE_LINK
+LMP_CTYPE_UNMD
, "Unnumbered" },
342 { 256*LMP_OBJ_DATA_LINK
+LMP_CTYPE_IPV4
, "IPv4" },
343 { 256*LMP_OBJ_DATA_LINK
+LMP_CTYPE_IPV6
, "IPv6" },
344 { 256*LMP_OBJ_DATA_LINK
+LMP_CTYPE_UNMD
, "Unnumbered" },
345 { 256*LMP_OBJ_CHANNEL_STATUS
+LMP_CTYPE_IPV4
, "IPv4" },
346 { 256*LMP_OBJ_CHANNEL_STATUS
+LMP_CTYPE_IPV6
, "IPv6" },
347 { 256*LMP_OBJ_CHANNEL_STATUS
+LMP_CTYPE_UNMD
, "Unnumbered" },
348 { 256*LMP_OBJ_CHANNEL_STATUS_REQ
+LMP_CTYPE_IPV4
, "IPv4" },
349 { 256*LMP_OBJ_CHANNEL_STATUS_REQ
+LMP_CTYPE_IPV6
, "IPv6" },
350 { 256*LMP_OBJ_CHANNEL_STATUS_REQ
+LMP_CTYPE_UNMD
, "Unnumbered" },
351 { 256*LMP_OBJ_ERROR_CODE
+LMP_CTYPE_1
, "1" },
352 { 256*LMP_OBJ_ERROR_CODE
+LMP_CTYPE_2
, "2" },
353 { 256*LMP_OBJ_SERVICE_CONFIG
+LMP_CTYPE_SERVICE_CONFIG_SP
, "1" },
354 { 256*LMP_OBJ_SERVICE_CONFIG
+LMP_CTYPE_SERVICE_CONFIG_CPSA
, "2" },
355 { 256*LMP_OBJ_SERVICE_CONFIG
+LMP_CTYPE_SERVICE_CONFIG_TRANSPARENCY_TCM
, "3" },
356 { 256*LMP_OBJ_SERVICE_CONFIG
+LMP_CTYPE_SERVICE_CONFIG_NETWORK_DIVERSITY
, "4" },
361 lmp_print(netdissect_options
*ndo
,
362 register const u_char
*pptr
, register u_int len
)
364 const struct lmp_common_header
*lmp_com_header
;
365 const struct lmp_object_header
*lmp_obj_header
;
366 const u_char
*tptr
,*obj_tptr
;
367 int tlen
,lmp_obj_len
,lmp_obj_ctype
,obj_tlen
;
369 int offset
,subobj_type
,subobj_len
,total_subobj_len
;
372 union { /* int to float conversion buffer */
378 lmp_com_header
= (const struct lmp_common_header
*)pptr
;
379 ND_TCHECK(*lmp_com_header
);
382 * Sanity checking of the header.
384 if (LMP_EXTRACT_VERSION(lmp_com_header
->version_res
[0]) != LMP_VERSION
) {
385 ND_PRINT((ndo
, "LMP version %u packet not supported",
386 LMP_EXTRACT_VERSION(lmp_com_header
->version_res
[0])));
390 /* in non-verbose mode just lets print the basic Message Type*/
391 if (ndo
->ndo_vflag
< 1) {
392 ND_PRINT((ndo
, "LMPv%u %s Message, length: %u",
393 LMP_EXTRACT_VERSION(lmp_com_header
->version_res
[0]),
394 tok2str(lmp_msg_type_values
, "unknown (%u)",lmp_com_header
->msg_type
),
399 /* ok they seem to want to know everything - lets fully decode it */
401 tlen
=EXTRACT_16BITS(lmp_com_header
->length
);
403 ND_PRINT((ndo
, "\n\tLMPv%u, msg-type: %s, Flags: [%s], length: %u",
404 LMP_EXTRACT_VERSION(lmp_com_header
->version_res
[0]),
405 tok2str(lmp_msg_type_values
, "unknown, type: %u",lmp_com_header
->msg_type
),
406 bittok2str(lmp_header_flag_values
,"none",lmp_com_header
->flags
),
409 tptr
+=sizeof(const struct lmp_common_header
);
410 tlen
-=sizeof(const struct lmp_common_header
);
413 /* did we capture enough for fully decoding the object header ? */
414 ND_TCHECK2(*tptr
, sizeof(struct lmp_object_header
));
416 lmp_obj_header
= (const struct lmp_object_header
*)tptr
;
417 lmp_obj_len
=EXTRACT_16BITS(lmp_obj_header
->length
);
418 lmp_obj_ctype
=(lmp_obj_header
->ctype
)&0x7f;
420 if(lmp_obj_len
% 4 || lmp_obj_len
< 4)
423 ND_PRINT((ndo
, "\n\t %s Object (%u), Class-Type: %s (%u) Flags: [%snegotiable], length: %u",
424 tok2str(lmp_obj_values
,
426 lmp_obj_header
->class_num
),
427 lmp_obj_header
->class_num
,
428 tok2str(lmp_ctype_values
,
430 ((lmp_obj_header
->class_num
)<<8)+lmp_obj_ctype
),
432 (lmp_obj_header
->ctype
)&0x80 ? "" : "non-",
435 obj_tptr
=tptr
+sizeof(struct lmp_object_header
);
436 obj_tlen
=lmp_obj_len
-sizeof(struct lmp_object_header
);
438 /* did we capture enough for fully decoding the object ? */
439 ND_TCHECK2(*tptr
, lmp_obj_len
);
442 switch(lmp_obj_header
->class_num
) {
445 switch(lmp_obj_ctype
) {
448 ND_PRINT((ndo
, "\n\t Control Channel ID: %u (0x%08x)",
449 EXTRACT_32BITS(obj_tptr
),
450 EXTRACT_32BITS(obj_tptr
)));
458 case LMP_OBJ_LINK_ID
:
459 case LMP_OBJ_INTERFACE_ID
:
460 switch(lmp_obj_ctype
) {
461 case LMP_CTYPE_IPV4_LOC
:
462 case LMP_CTYPE_IPV4_RMT
:
463 ND_PRINT((ndo
, "\n\t IPv4 Link ID: %s (0x%08x)",
464 ipaddr_string(ndo
, obj_tptr
),
465 EXTRACT_32BITS(obj_tptr
)));
468 case LMP_CTYPE_IPV6_LOC
:
469 case LMP_CTYPE_IPV6_RMT
:
470 ND_PRINT((ndo
, "\n\t IPv6 Link ID: %s (0x%08x)",
471 ip6addr_string(ndo
, obj_tptr
),
472 EXTRACT_32BITS(obj_tptr
)));
475 case LMP_CTYPE_UNMD_LOC
:
476 case LMP_CTYPE_UNMD_RMT
:
477 ND_PRINT((ndo
, "\n\t Link ID: %u (0x%08x)",
478 EXTRACT_32BITS(obj_tptr
),
479 EXTRACT_32BITS(obj_tptr
)));
486 case LMP_OBJ_MESSAGE_ID
:
487 switch(lmp_obj_ctype
) {
489 ND_PRINT((ndo
, "\n\t Message ID: %u (0x%08x)",
490 EXTRACT_32BITS(obj_tptr
),
491 EXTRACT_32BITS(obj_tptr
)));
494 ND_PRINT((ndo
, "\n\t Message ID Ack: %u (0x%08x)",
495 EXTRACT_32BITS(obj_tptr
),
496 EXTRACT_32BITS(obj_tptr
)));
503 case LMP_OBJ_NODE_ID
:
504 switch(lmp_obj_ctype
) {
507 ND_PRINT((ndo
, "\n\t Node ID: %s (0x%08x)",
508 ipaddr_string(ndo
, obj_tptr
),
509 EXTRACT_32BITS(obj_tptr
)));
518 switch(lmp_obj_ctype
) {
519 case LMP_CTYPE_HELLO_CONFIG
:
520 ND_PRINT((ndo
, "\n\t Hello Interval: %u\n\t Hello Dead Interval: %u",
521 EXTRACT_16BITS(obj_tptr
),
522 EXTRACT_16BITS(obj_tptr
+2)));
531 switch(lmp_obj_ctype
) {
532 case LMP_CTYPE_HELLO
:
533 ND_PRINT((ndo
, "\n\t Tx Seq: %u, Rx Seq: %u",
534 EXTRACT_32BITS(obj_tptr
),
535 EXTRACT_32BITS(obj_tptr
+4)));
543 case LMP_OBJ_TE_LINK
:
544 ND_PRINT((ndo
, "\n\t Flags: [%s]",
545 bittok2str(lmp_obj_te_link_flag_values
,
547 EXTRACT_16BITS(obj_tptr
)>>8)));
549 switch(lmp_obj_ctype
) {
551 ND_PRINT((ndo
, "\n\t Local Link-ID: %s (0x%08x)"
552 "\n\t Remote Link-ID: %s (0x%08x)",
553 ipaddr_string(ndo
, obj_tptr
+4),
554 EXTRACT_32BITS(obj_tptr
+4),
555 ipaddr_string(ndo
, obj_tptr
+8),
556 EXTRACT_32BITS(obj_tptr
+8)));
568 case LMP_OBJ_DATA_LINK
:
569 ND_PRINT((ndo
, "\n\t Flags: [%s]",
570 bittok2str(lmp_obj_data_link_flag_values
,
572 EXTRACT_16BITS(obj_tptr
)>>8)));
574 switch(lmp_obj_ctype
) {
577 ND_PRINT((ndo
, "\n\t Local Interface ID: %s (0x%08x)"
578 "\n\t Remote Interface ID: %s (0x%08x)",
579 ipaddr_string(ndo
, obj_tptr
+4),
580 EXTRACT_32BITS(obj_tptr
+4),
581 ipaddr_string(ndo
, obj_tptr
+8),
582 EXTRACT_32BITS(obj_tptr
+8)));
584 total_subobj_len
= lmp_obj_len
- 16;
586 while (total_subobj_len
> 0 && hexdump
== FALSE
) {
587 subobj_type
= EXTRACT_16BITS(obj_tptr
+offset
)>>8;
588 subobj_len
= EXTRACT_16BITS(obj_tptr
+offset
)&0x00FF;
589 ND_PRINT((ndo
, "\n\t Subobject, Type: %s (%u), Length: %u",
590 tok2str(lmp_data_link_subobj
,
595 switch(subobj_type
) {
596 case INT_SWITCHING_TYPE_SUBOBJ
:
597 ND_PRINT((ndo
, "\n\t Switching Type: %s (%u)",
598 tok2str(gmpls_switch_cap_values
,
600 EXTRACT_16BITS(obj_tptr
+offset
+2)>>8),
601 EXTRACT_16BITS(obj_tptr
+offset
+2)>>8));
602 ND_PRINT((ndo
, "\n\t Encoding Type: %s (%u)",
603 tok2str(gmpls_encoding_values
,
605 EXTRACT_16BITS(obj_tptr
+offset
+2)&0x00FF),
606 EXTRACT_16BITS(obj_tptr
+offset
+2)&0x00FF));
607 bw
.i
= EXTRACT_32BITS(obj_tptr
+offset
+4);
608 ND_PRINT((ndo
, "\n\t Min Reservable Bandwidth: %.3f Mbps",
610 bw
.i
= EXTRACT_32BITS(obj_tptr
+offset
+8);
611 ND_PRINT((ndo
, "\n\t Max Reservable Bandwidth: %.3f Mbps",
614 case WAVELENGTH_SUBOBJ
:
615 ND_PRINT((ndo
, "\n\t Wavelength: %u",
616 EXTRACT_32BITS(obj_tptr
+offset
+4)));
619 /* Any Unknown Subobject ==> Exit loop */
623 total_subobj_len
-=subobj_len
;
636 case LMP_OBJ_VERIFY_BEGIN
:
637 switch(lmp_obj_ctype
) {
639 ND_PRINT((ndo
, "\n\t Flags: %s",
640 bittok2str(lmp_obj_begin_verify_flag_values
,
642 EXTRACT_16BITS(obj_tptr
))));
643 ND_PRINT((ndo
, "\n\t Verify Interval: %u",
644 EXTRACT_16BITS(obj_tptr
+2)));
645 ND_PRINT((ndo
, "\n\t Data links: %u",
646 EXTRACT_32BITS(obj_tptr
+4)));
647 ND_PRINT((ndo
, "\n\t Encoding type: %s",
648 tok2str(gmpls_encoding_values
, "Unknown", *(obj_tptr
+8))));
649 ND_PRINT((ndo
, "\n\t Verify Transport Mechanism: %u (0x%x)%s",
650 EXTRACT_16BITS(obj_tptr
+10),
651 EXTRACT_16BITS(obj_tptr
+10),
652 EXTRACT_16BITS(obj_tptr
+10)&8000 ? " (Payload test messages capable)" : ""));
653 bw
.i
= EXTRACT_32BITS(obj_tptr
+12);
654 ND_PRINT((ndo
, "\n\t Transmission Rate: %.3f Mbps",bw
.f
*8/1000000));
655 ND_PRINT((ndo
, "\n\t Wavelength: %u",
656 EXTRACT_32BITS(obj_tptr
+16)));
664 case LMP_OBJ_VERIFY_BEGIN_ACK
:
665 switch(lmp_obj_ctype
) {
667 ND_PRINT((ndo
, "\n\t Verify Dead Interval: %u"
668 "\n\t Verify Transport Response: %u",
669 EXTRACT_16BITS(obj_tptr
),
670 EXTRACT_16BITS(obj_tptr
+2)));
678 case LMP_OBJ_VERIFY_ID
:
679 switch(lmp_obj_ctype
) {
681 ND_PRINT((ndo
, "\n\t Verify ID: %u",
682 EXTRACT_32BITS(obj_tptr
)));
690 case LMP_OBJ_CHANNEL_STATUS
:
691 switch(lmp_obj_ctype
) {
695 /* Decode pairs: <Interface_ID (4 bytes), Channel_status (4 bytes)> */
696 while (offset
< (lmp_obj_len
-(int)sizeof(struct lmp_object_header
)) ) {
697 ND_PRINT((ndo
, "\n\t Interface ID: %s (0x%08x)",
698 ipaddr_string(ndo
, obj_tptr
+offset
),
699 EXTRACT_32BITS(obj_tptr
+offset
)));
701 ND_PRINT((ndo
, "\n\t\t Active: %s (%u)", (EXTRACT_32BITS(obj_tptr
+offset
+4)>>31) ?
702 "Allocated" : "Non-allocated",
703 (EXTRACT_32BITS(obj_tptr
+offset
+4)>>31)));
705 ND_PRINT((ndo
, "\n\t\t Direction: %s (%u)", (EXTRACT_32BITS(obj_tptr
+offset
+4)>>30)&0x1 ?
706 "Transmit" : "Receive",
707 (EXTRACT_32BITS(obj_tptr
+offset
+4)>>30)&0x1));
709 ND_PRINT((ndo
, "\n\t\t Channel Status: %s (%u)",
710 tok2str(lmp_obj_channel_status_values
,
712 EXTRACT_32BITS(obj_tptr
+offset
+4)&0x3FFFFFF),
713 EXTRACT_32BITS(obj_tptr
+offset
+4)&0x3FFFFFF));
725 case LMP_OBJ_CHANNEL_STATUS_REQ
:
726 switch(lmp_obj_ctype
) {
730 while (offset
< (lmp_obj_len
-(int)sizeof(struct lmp_object_header
)) ) {
731 ND_PRINT((ndo
, "\n\t Interface ID: %s (0x%08x)",
732 ipaddr_string(ndo
, obj_tptr
+offset
),
733 EXTRACT_32BITS(obj_tptr
+offset
)));
745 case LMP_OBJ_ERROR_CODE
:
746 switch(lmp_obj_ctype
) {
747 case LMP_CTYPE_BEGIN_VERIFY_ERROR
:
748 ND_PRINT((ndo
, "\n\t Error Code: %s",
749 bittok2str(lmp_obj_begin_verify_error_values
,
751 EXTRACT_32BITS(obj_tptr
))));
754 case LMP_CTYPE_LINK_SUMMARY_ERROR
:
755 ND_PRINT((ndo
, "\n\t Error Code: %s",
756 bittok2str(lmp_obj_link_summary_error_values
,
758 EXTRACT_32BITS(obj_tptr
))));
765 case LMP_OBJ_SERVICE_CONFIG
:
766 switch (lmp_obj_ctype
) {
767 case LMP_CTYPE_SERVICE_CONFIG_SP
:
769 ND_PRINT((ndo
, "\n\t Flags: %s",
770 bittok2str(lmp_obj_service_config_sp_flag_values
,
772 EXTRACT_16BITS(obj_tptr
)>>8)));
774 ND_PRINT((ndo
, "\n\t UNI Version: %u",
775 EXTRACT_16BITS(obj_tptr
) & 0x00FF));
779 case LMP_CTYPE_SERVICE_CONFIG_CPSA
:
781 link_type
= EXTRACT_16BITS(obj_tptr
)>>8;
783 ND_PRINT((ndo
, "\n\t Link Type: %s (%u)",
784 tok2str(lmp_sd_service_config_cpsa_link_type_values
,
785 "Unknown", link_type
),
788 if (link_type
== LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SDH
) {
789 ND_PRINT((ndo
, "\n\t Signal Type: %s (%u)",
790 tok2str(lmp_sd_service_config_cpsa_signal_type_sdh_values
,
792 EXTRACT_16BITS(obj_tptr
) & 0x00FF),
793 EXTRACT_16BITS(obj_tptr
) & 0x00FF));
796 if (link_type
== LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SONET
) {
797 ND_PRINT((ndo
, "\n\t Signal Type: %s (%u)",
798 tok2str(lmp_sd_service_config_cpsa_signal_type_sonet_values
,
800 EXTRACT_16BITS(obj_tptr
) & 0x00FF),
801 EXTRACT_16BITS(obj_tptr
) & 0x00FF));
804 ND_PRINT((ndo
, "\n\t Transparency: %s",
805 bittok2str(lmp_obj_service_config_cpsa_tp_flag_values
,
807 EXTRACT_16BITS(obj_tptr
+2)>>8)));
809 ND_PRINT((ndo
, "\n\t Contiguous Concatenation Types: %s",
810 bittok2str(lmp_obj_service_config_cpsa_cct_flag_values
,
812 EXTRACT_16BITS(obj_tptr
+2)>>8 & 0x00FF)));
814 ND_PRINT((ndo
, "\n\t Minimum NCC: %u",
815 EXTRACT_16BITS(obj_tptr
+4)));
817 ND_PRINT((ndo
, "\n\t Maximum NCC: %u",
818 EXTRACT_16BITS(obj_tptr
+6)));
820 ND_PRINT((ndo
, "\n\t Minimum NVC:%u",
821 EXTRACT_16BITS(obj_tptr
+8)));
823 ND_PRINT((ndo
, "\n\t Maximum NVC:%u",
824 EXTRACT_16BITS(obj_tptr
+10)));
826 ND_PRINT((ndo
, "\n\t Local Interface ID: %s (0x%08x)",
827 ipaddr_string(ndo
, obj_tptr
+12),
828 EXTRACT_32BITS(obj_tptr
+12)));
832 case LMP_CTYPE_SERVICE_CONFIG_TRANSPARENCY_TCM
:
834 ND_PRINT((ndo
, "\n\t Transparency Flags: %s",
836 lmp_obj_service_config_nsa_transparency_flag_values
,
838 EXTRACT_32BITS(obj_tptr
))));
840 ND_PRINT((ndo
, "\n\t TCM Monitoring Flags: %s",
842 lmp_obj_service_config_nsa_tcm_flag_values
,
844 EXTRACT_16BITS(obj_tptr
+6) & 0x00FF)));
848 case LMP_CTYPE_SERVICE_CONFIG_NETWORK_DIVERSITY
:
850 ND_PRINT((ndo
, "\n\t Diversity: Flags: %s",
852 lmp_obj_service_config_nsa_network_diversity_flag_values
,
854 EXTRACT_16BITS(obj_tptr
+2) & 0x00FF)));
864 if (ndo
->ndo_vflag
<= 1)
865 print_unknown_data(ndo
,obj_tptr
,"\n\t ",obj_tlen
);
868 /* do we want to see an additionally hexdump ? */
869 if (ndo
->ndo_vflag
> 1 || hexdump
==TRUE
)
870 print_unknown_data(ndo
,tptr
+sizeof(struct lmp_object_header
),"\n\t ",
871 lmp_obj_len
-sizeof(struct lmp_object_header
));
878 ND_PRINT((ndo
, "\n\t\t packet exceeded snapshot"));
882 * c-style: whitesmith