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 * Original code by Hannes Gredler (hannes@juniper.net)
17 static const char rcsid
[] _U_
=
18 "@(#) $Header: /tcpdump/master/tcpdump/print-lspping.c,v 1.8 2004-06-15 09:42:42 hannes Exp $";
25 #include <tcpdump-stdinc.h>
31 #include "interface.h"
33 #include "addrtoname.h"
39 * LSPPING common header
42 * 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
43 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
44 * | Version Number | Must Be Zero |
45 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
46 * | Message Type | Reply mode | Return Code | Return Subcode|
47 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
49 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
51 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
52 * | TimeStamp Sent (seconds) |
53 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
54 * | TimeStamp Sent (microseconds) |
55 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
56 * | TimeStamp Received (seconds) |
57 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
58 * | TimeStamp Received (microseconds) |
59 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
66 struct lspping_common_header
{
72 u_int8_t return_subcode
;
73 u_int8_t sender_handle
[4];
74 u_int8_t seq_number
[4];
75 u_int8_t ts_sent_sec
[4];
76 u_int8_t ts_sent_usec
[4];
77 u_int8_t ts_rcvd_sec
[4];
78 u_int8_t ts_rcvd_usec
[4];
81 #define LSPPING_VERSION 1
85 static const struct tok lspping_msg_type_values
[] = {
86 { 1, "MPLS Echo Request"},
87 { 2, "MPLS Echo Reply"},
91 static const struct tok lspping_reply_mode_values
[] = {
93 { 2, "Reply via an IPv4/IPv6 UDP packet"},
94 { 3, "Reply via an IPv4/IPv6 UDP packet with Router Alert"},
95 { 4, "Reply via application level control channel"},
99 static const struct tok lspping_return_code_values
[] = {
100 { 0, "No return code or return code contained in the Error Code TLV"},
101 { 1, "Malformed echo request received"},
102 { 2, "One or more of the TLVs was not understood"},
103 { 3, "Replying router is an egress for the FEC at stack depth"},
104 { 4, "Replying router has no mapping for the FEC at stack depth"},
108 { 8, "Label switched at stack-depth"},
109 { 9, "Label switched but no MPLS forwarding at stack-depth"},
110 { 10, "Mapping for this FEC is not the given label at stack depth"},
111 { 11, "No label entry at stack-depth"},
112 { 12, "Protocol not associated with interface at FEC stack depth"},
119 * 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
120 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
122 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
128 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
131 struct lspping_tlv_header
{
136 #define LSPPING_TLV_TARGET_FEC_STACK 1
137 #define LSPPING_TLV_DOWNSTREAM_MAPPING 2
138 #define LSPPING_TLV_PAD 3
139 #define LSPPING_TLV_ERROR_CODE 4
140 #define LSPPING_TLV_VENDOR_PRIVATE 5
142 static const struct tok lspping_tlv_values
[] = {
143 { LSPPING_TLV_TARGET_FEC_STACK
, "Target FEC Stack" },
144 { LSPPING_TLV_DOWNSTREAM_MAPPING
, "Downstream Mapping" },
145 { LSPPING_TLV_PAD
, "Pad" },
146 { LSPPING_TLV_ERROR_CODE
, "Error Code" },
147 { LSPPING_TLV_VENDOR_PRIVATE
, "Vendor Enterprise Code" },
151 #define LSPPING_TLV_TARGETFEC_SUBTLV_LDP_IPV4 1
152 #define LSPPING_TLV_TARGETFEC_SUBTLV_LDP_IPV6 2
153 #define LSPPING_TLV_TARGETFEC_SUBTLV_RSVP_IPV4 3
154 #define LSPPING_TLV_TARGETFEC_SUBTLV_RSVP_IPV6 4
155 #define LSPPING_TLV_TARGETFEC_SUBTLV_L3VPN_IPV4 6
156 #define LSPPING_TLV_TARGETFEC_SUBTLV_L3VPN_IPV6 7
157 #define LSPPING_TLV_TARGETFEC_SUBTLV_L2VPN_ENDPT 8
158 #define LSPPING_TLV_TARGETFEC_SUBTLV_L2VPN_VCID 9
159 #define LSPPING_TLV_TARGETFEC_SUBTLV_BGP_IPV4 10
160 #define LSPPING_TLV_TARGETFEC_SUBTLV_BGP_IPV6 11
162 static const struct tok lspping_tlvtargetfec_subtlv_values
[] = {
163 { LSPPING_TLV_TARGETFEC_SUBTLV_LDP_IPV4
, "LDP IPv4 prefix"},
164 { LSPPING_TLV_TARGETFEC_SUBTLV_LDP_IPV6
, "LDP IPv6 prefix"},
165 { LSPPING_TLV_TARGETFEC_SUBTLV_RSVP_IPV4
, "RSVP IPv4 Session Query"},
166 { LSPPING_TLV_TARGETFEC_SUBTLV_RSVP_IPV6
, "RSVP IPv6 Session Query"},
168 { LSPPING_TLV_TARGETFEC_SUBTLV_L3VPN_IPV4
, "VPN IPv4 prefix"},
169 { LSPPING_TLV_TARGETFEC_SUBTLV_L3VPN_IPV6
, "VPN IPv6 prefix"},
170 { LSPPING_TLV_TARGETFEC_SUBTLV_L2VPN_ENDPT
, "L2 VPN endpoint"},
171 { LSPPING_TLV_TARGETFEC_SUBTLV_L2VPN_VCID
, "L2 circuit ID"},
172 { LSPPING_TLV_TARGETFEC_SUBTLV_BGP_IPV4
, "BGP labeled IPv4 prefix"},
173 { LSPPING_TLV_TARGETFEC_SUBTLV_BGP_IPV6
, "BGP labeled IPv6 prefix"},
179 * 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
180 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
182 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
183 * | Prefix Length | Must Be Zero |
184 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
186 struct lspping_tlv_targetfec_subtlv_ldp_ipv4_t
{
193 * 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
194 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
199 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
200 * | Prefix Length | Must Be Zero |
201 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
203 struct lspping_tlv_targetfec_subtlv_ldp_ipv6_t
{
204 u_int8_t prefix
[16];
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 * | Sender identifier |
212 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
214 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
215 * | Prefix Length | Must Be Zero |
216 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
218 struct lspping_tlv_targetfec_subtlv_bgp_ipv4_t
{
219 u_int8_t sender_id
[4];
225 * 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
226 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
227 * | Sender identifier |
231 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
236 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
237 * | Prefix Length | Must Be Zero |
238 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
240 struct lspping_tlv_targetfec_subtlv_bgp_ipv6_t
{
241 u_int8_t sender_id
[16];
242 u_int8_t prefix
[16];
248 * 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
249 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
250 * | IPv4 tunnel end point address |
251 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
252 * | Must Be Zero | Tunnel ID |
253 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
254 * | Extended Tunnel ID |
255 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
256 * | IPv4 tunnel sender address |
257 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
258 * | Must Be Zero | LSP ID |
259 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
261 struct lspping_tlv_targetfec_subtlv_rsvp_ipv4_t
{
262 u_int8_t tunnel_endpoint
[4];
264 u_int8_t tunnel_id
[2];
265 u_int8_t extended_tunnel_id
[4];
266 u_int8_t tunnel_sender
[4];
273 * 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
274 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
275 * | IPv6 tunnel end point address |
279 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
280 * | Must Be Zero | Tunnel ID |
281 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
282 * | Extended Tunnel ID |
286 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
287 * | IPv6 tunnel sender address |
291 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
292 * | Must Be Zero | LSP ID |
293 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
295 struct lspping_tlv_targetfec_subtlv_rsvp_ipv6_t
{
296 u_int8_t tunnel_endpoint
[16];
298 u_int8_t tunnel_id
[2];
299 u_int8_t extended_tunnel_id
[16];
300 u_int8_t tunnel_sender
[16];
307 * 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
308 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
309 * | Route Distinguisher |
311 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
313 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
314 * | Prefix Length | Must Be Zero |
315 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
317 struct lspping_tlv_targetfec_subtlv_l3vpn_ipv4_t
{
325 * 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
326 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
327 * | Route Distinguisher |
329 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
334 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
335 * | Prefix Length | Must Be Zero |
336 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
338 struct lspping_tlv_targetfec_subtlv_l3vpn_ipv6_t
{
340 u_int8_t prefix
[16];
346 * 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
347 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
348 * | Route Distinguisher |
350 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
351 * | Sender's CE ID | Receiver's CE ID |
352 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
353 * | Encapsulation Type | Must Be Zero |
354 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
357 struct lspping_tlv_targetfec_subtlv_l2vpn_endpt_t
{
359 u_int8_t sender_ce_id
[2];
360 u_int8_t receiver_ce_id
[2];
361 u_int8_t encapsulation
[2];
365 * 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
366 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
367 * | Sender's PE Address |
368 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
369 * | Remote PE Address |
370 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
372 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
373 * | Encapsulation Type | Must Be Zero |
374 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
376 struct lspping_tlv_targetfec_subtlv_l2vpn_vcid_t
{
377 u_int8_t sender_pe_address
[4];
378 u_int8_t remote_pe_address
[4];
380 u_int8_t encapsulation
[2];
384 lspping_print(register const u_char
*pptr
, register u_int len
) {
386 const struct lspping_common_header
*lspping_com_header
;
387 const struct lspping_tlv_header
*lspping_tlv_header
;
388 const struct lspping_tlv_header
*lspping_subtlv_header
;
389 const u_char
*tptr
,*tlv_tptr
,*subtlv_tptr
;
390 int tlen
,lspping_tlv_len
,lspping_tlv_type
,tlv_tlen
;
391 int tlv_hexdump
,subtlv_hexdump
;
392 int lspping_subtlv_len
,lspping_subtlv_type
;
395 const struct lspping_tlv_targetfec_subtlv_ldp_ipv4_t
*lspping_tlv_targetfec_subtlv_ldp_ipv4
;
396 const struct lspping_tlv_targetfec_subtlv_ldp_ipv6_t
*lspping_tlv_targetfec_subtlv_ldp_ipv6
;
397 const struct lspping_tlv_targetfec_subtlv_rsvp_ipv4_t
*lspping_tlv_targetfec_subtlv_rsvp_ipv4
;
398 const struct lspping_tlv_targetfec_subtlv_rsvp_ipv6_t
*lspping_tlv_targetfec_subtlv_rsvp_ipv6
;
399 const struct lspping_tlv_targetfec_subtlv_l3vpn_ipv4_t
*lspping_tlv_targetfec_subtlv_l3vpn_ipv4
;
400 const struct lspping_tlv_targetfec_subtlv_l3vpn_ipv6_t
*lspping_tlv_targetfec_subtlv_l3vpn_ipv6
;
401 const struct lspping_tlv_targetfec_subtlv_l2vpn_endpt_t
*lspping_tlv_targetfec_subtlv_l2vpn_endpt
;
402 const struct lspping_tlv_targetfec_subtlv_l2vpn_vcid_t
*lspping_tlv_targetfec_subtlv_l2vpn_vcid
;
403 const struct lspping_tlv_targetfec_subtlv_bgp_ipv4_t
*lspping_tlv_targetfec_subtlv_bgp_ipv4
;
404 const struct lspping_tlv_targetfec_subtlv_bgp_ipv6_t
*lspping_tlv_targetfec_subtlv_bgp_ipv6
;
408 lspping_com_header
= (const struct lspping_common_header
*)pptr
;
409 TCHECK(*lspping_com_header
);
412 * Sanity checking of the header.
414 if (EXTRACT_16BITS(&lspping_com_header
->version
[0]) != LSPPING_VERSION
) {
415 printf("LSP-PING version %u packet not supported",
416 EXTRACT_16BITS(&lspping_com_header
->version
[0]));
420 /* in non-verbose mode just lets print the basic Message Type*/
422 printf("LSP-PINGv%u, %s, seq %u, length: %u",
423 EXTRACT_16BITS(&lspping_com_header
->version
[0]),
424 tok2str(lspping_msg_type_values
, "unknown (%u)",lspping_com_header
->msg_type
),
425 EXTRACT_32BITS(lspping_com_header
->seq_number
),
430 /* ok they seem to want to know everything - lets fully decode it */
434 printf("\n\tLSP-PINGv%u, msg-type: %s (%u), reply-mode: %s (%u)",
435 EXTRACT_16BITS(&lspping_com_header
->version
[0]),
436 tok2str(lspping_msg_type_values
, "unknown",lspping_com_header
->msg_type
),
437 lspping_com_header
->msg_type
,
438 tok2str(lspping_reply_mode_values
, "unknown",lspping_com_header
->reply_mode
),
439 lspping_com_header
->reply_mode
);
442 * the following return codes require that the subcode is attached
443 * at the end of the translated token output
445 if (lspping_com_header
->return_code
== 3 ||
446 lspping_com_header
->return_code
== 4 ||
447 lspping_com_header
->return_code
== 8 ||
448 lspping_com_header
->return_code
== 10 ||
449 lspping_com_header
->return_code
== 11 ||
450 lspping_com_header
->return_code
== 12 )
451 printf("\n\t Return Code: %s %u (%u), Return Subcode: (%u)",
452 tok2str(lspping_return_code_values
, "unknown",lspping_com_header
->return_code
),
453 lspping_com_header
->return_subcode
,
454 lspping_com_header
->return_code
,
455 lspping_com_header
->return_subcode
);
457 printf("\n\t Return Code: %s (%u), Return Subcode: (%u)",
458 tok2str(lspping_return_code_values
, "unknown",lspping_com_header
->return_code
),
459 lspping_com_header
->return_code
,
460 lspping_com_header
->return_subcode
);
462 printf("\n\t Sender Handle: 0x%08x, Sequence: %u" \
463 "\n\t Sender Timestamp %u.%us, Receiver Timestamp %u.%us",
464 EXTRACT_32BITS(lspping_com_header
->sender_handle
),
465 EXTRACT_32BITS(lspping_com_header
->seq_number
),
466 EXTRACT_32BITS(lspping_com_header
->ts_sent_sec
), /* FIXME: replace with ts_print() */
467 EXTRACT_32BITS(lspping_com_header
->ts_sent_usec
),
468 EXTRACT_32BITS(lspping_com_header
->ts_rcvd_sec
), /* FIXME: replace with ts_print() */
469 EXTRACT_32BITS(lspping_com_header
->ts_rcvd_usec
));
471 tptr
+=sizeof(const struct lspping_common_header
);
472 tlen
-=sizeof(const struct lspping_common_header
);
474 while(tlen
>(int)sizeof(struct lspping_tlv_header
)) {
475 /* did we capture enough for fully decoding the tlv header ? */
476 if (!TTEST2(*tptr
, sizeof(struct lspping_tlv_header
)))
479 lspping_tlv_header
= (const struct lspping_tlv_header
*)tptr
;
480 lspping_tlv_type
=EXTRACT_16BITS(lspping_tlv_header
->type
);
481 lspping_tlv_len
=EXTRACT_16BITS(lspping_tlv_header
->length
);
483 if (lspping_tlv_len
== 0)
486 if(lspping_tlv_len
% 4 || lspping_tlv_len
< 4) { /* aligned to four octet boundary */
487 printf("\n\t ERROR: TLV %u bogus size %u",lspping_tlv_type
,lspping_tlv_len
);
491 printf("\n\t %s TLV (%u), length: %u",
492 tok2str(lspping_tlv_values
,
498 tlv_tptr
=tptr
+sizeof(struct lspping_tlv_header
);
499 tlv_tlen
=lspping_tlv_len
; /* header not included -> no adjustment */
501 /* did we capture enough for fully decoding the tlv ? */
502 if (!TTEST2(*tptr
, lspping_tlv_len
))
506 switch(lspping_tlv_type
) {
507 case LSPPING_TLV_TARGET_FEC_STACK
:
508 while(tlv_tlen
>(int)sizeof(struct lspping_tlv_header
)) {
510 /* did we capture enough for fully decoding the subtlv header ? */
511 if (!TTEST2(*tptr
, sizeof(struct lspping_tlv_header
)))
513 subtlv_hexdump
=FALSE
;
515 lspping_subtlv_header
= (const struct lspping_tlv_header
*)tlv_tptr
;
516 lspping_subtlv_type
=EXTRACT_16BITS(lspping_subtlv_header
->type
);
517 lspping_subtlv_len
=EXTRACT_16BITS(lspping_subtlv_header
->length
);
518 subtlv_tptr
=tlv_tptr
+sizeof(struct lspping_tlv_header
);
520 if (lspping_subtlv_len
== 0)
523 printf("\n\t %s subTLV (%u), length: %u",
524 tok2str(lspping_tlvtargetfec_subtlv_values
,
526 lspping_subtlv_type
),
530 switch(lspping_subtlv_type
) {
532 case LSPPING_TLV_TARGETFEC_SUBTLV_LDP_IPV4
:
533 subtlv_ptr
.lspping_tlv_targetfec_subtlv_ldp_ipv4
= \
534 (const struct lspping_tlv_targetfec_subtlv_ldp_ipv4_t
*)subtlv_tptr
;
536 ipaddr_string(subtlv_ptr
.lspping_tlv_targetfec_subtlv_ldp_ipv4
->prefix
),
537 subtlv_ptr
.lspping_tlv_targetfec_subtlv_ldp_ipv4
->prefix_len
);
541 case LSPPING_TLV_TARGETFEC_SUBTLV_LDP_IPV6
:
542 subtlv_ptr
.lspping_tlv_targetfec_subtlv_ldp_ipv6
= \
543 (const struct lspping_tlv_targetfec_subtlv_ldp_ipv6_t
*)subtlv_tptr
;
545 ip6addr_string(subtlv_ptr
.lspping_tlv_targetfec_subtlv_ldp_ipv6
->prefix
),
546 subtlv_ptr
.lspping_tlv_targetfec_subtlv_ldp_ipv6
->prefix_len
);
550 case LSPPING_TLV_TARGETFEC_SUBTLV_BGP_IPV4
:
551 subtlv_ptr
.lspping_tlv_targetfec_subtlv_bgp_ipv4
= \
552 (const struct lspping_tlv_targetfec_subtlv_bgp_ipv4_t
*)subtlv_tptr
;
553 printf("\n\t %s/%u, sender-id %s",
554 ipaddr_string(subtlv_ptr
.lspping_tlv_targetfec_subtlv_bgp_ipv4
->prefix
),
555 subtlv_ptr
.lspping_tlv_targetfec_subtlv_bgp_ipv4
->prefix_len
,
556 ipaddr_string(subtlv_ptr
.lspping_tlv_targetfec_subtlv_bgp_ipv4
->sender_id
));
560 case LSPPING_TLV_TARGETFEC_SUBTLV_BGP_IPV6
:
561 subtlv_ptr
.lspping_tlv_targetfec_subtlv_bgp_ipv6
= \
562 (const struct lspping_tlv_targetfec_subtlv_bgp_ipv6_t
*)subtlv_tptr
;
563 printf("\n\t %s/%u, sender-id %s",
564 ip6addr_string(subtlv_ptr
.lspping_tlv_targetfec_subtlv_bgp_ipv6
->prefix
),
565 subtlv_ptr
.lspping_tlv_targetfec_subtlv_bgp_ipv6
->prefix_len
,
566 ip6addr_string(subtlv_ptr
.lspping_tlv_targetfec_subtlv_bgp_ipv6
->sender_id
));
570 case LSPPING_TLV_TARGETFEC_SUBTLV_RSVP_IPV4
:
571 subtlv_ptr
.lspping_tlv_targetfec_subtlv_rsvp_ipv4
= \
572 (const struct lspping_tlv_targetfec_subtlv_rsvp_ipv4_t
*)subtlv_tptr
;
573 printf("\n\t tunnel end-point %s, tunnel sender %s, lsp-id 0x%04x" \
574 "\n\t tunnel-id 0x%04x, extended tunnel-id %s",
575 ipaddr_string(subtlv_ptr
.lspping_tlv_targetfec_subtlv_rsvp_ipv4
->tunnel_endpoint
),
576 ipaddr_string(subtlv_ptr
.lspping_tlv_targetfec_subtlv_rsvp_ipv4
->tunnel_sender
),
577 EXTRACT_16BITS(subtlv_ptr
.lspping_tlv_targetfec_subtlv_rsvp_ipv4
->lsp_id
),
578 EXTRACT_16BITS(subtlv_ptr
.lspping_tlv_targetfec_subtlv_rsvp_ipv4
->tunnel_id
),
579 ipaddr_string(subtlv_ptr
.lspping_tlv_targetfec_subtlv_rsvp_ipv4
->extended_tunnel_id
));
583 case LSPPING_TLV_TARGETFEC_SUBTLV_RSVP_IPV6
:
584 subtlv_ptr
.lspping_tlv_targetfec_subtlv_rsvp_ipv6
= \
585 (const struct lspping_tlv_targetfec_subtlv_rsvp_ipv6_t
*)subtlv_tptr
;
586 printf("\n\t tunnel end-point %s, tunnel sender %s, lsp-id 0x%04x" \
587 "\n\t tunnel-id 0x%04x, extended tunnel-id %s",
588 ip6addr_string(subtlv_ptr
.lspping_tlv_targetfec_subtlv_rsvp_ipv6
->tunnel_endpoint
),
589 ip6addr_string(subtlv_ptr
.lspping_tlv_targetfec_subtlv_rsvp_ipv6
->tunnel_sender
),
590 EXTRACT_16BITS(subtlv_ptr
.lspping_tlv_targetfec_subtlv_rsvp_ipv6
->lsp_id
),
591 EXTRACT_16BITS(subtlv_ptr
.lspping_tlv_targetfec_subtlv_rsvp_ipv6
->tunnel_id
),
592 ip6addr_string(subtlv_ptr
.lspping_tlv_targetfec_subtlv_rsvp_ipv6
->extended_tunnel_id
));
596 case LSPPING_TLV_TARGETFEC_SUBTLV_L3VPN_IPV4
:
597 subtlv_ptr
.lspping_tlv_targetfec_subtlv_l3vpn_ipv4
= \
598 (const struct lspping_tlv_targetfec_subtlv_l3vpn_ipv4_t
*)subtlv_tptr
;
599 printf("\n\t RD: %s, %s/%u",
600 bgp_vpn_rd_print(subtlv_ptr
.lspping_tlv_targetfec_subtlv_l3vpn_ipv4
->rd
),
601 ipaddr_string(subtlv_ptr
.lspping_tlv_targetfec_subtlv_l3vpn_ipv4
->prefix
),
602 subtlv_ptr
.lspping_tlv_targetfec_subtlv_l3vpn_ipv4
->prefix_len
);
606 case LSPPING_TLV_TARGETFEC_SUBTLV_L3VPN_IPV6
:
607 subtlv_ptr
.lspping_tlv_targetfec_subtlv_l3vpn_ipv6
= \
608 (const struct lspping_tlv_targetfec_subtlv_l3vpn_ipv6_t
*)subtlv_tptr
;
609 printf("\n\t RD: %s, %s/%u",
610 bgp_vpn_rd_print(subtlv_ptr
.lspping_tlv_targetfec_subtlv_l3vpn_ipv6
->rd
),
611 ip6addr_string(subtlv_ptr
.lspping_tlv_targetfec_subtlv_l3vpn_ipv6
->prefix
),
612 subtlv_ptr
.lspping_tlv_targetfec_subtlv_l3vpn_ipv6
->prefix_len
);
616 case LSPPING_TLV_TARGETFEC_SUBTLV_L2VPN_ENDPT
:
617 subtlv_ptr
.lspping_tlv_targetfec_subtlv_l2vpn_endpt
= \
618 (const struct lspping_tlv_targetfec_subtlv_l2vpn_endpt_t
*)subtlv_tptr
;
619 printf("\n\t RD: %s, Sender CE-ID: %u, Receiver CE-ID: %u" \
620 "\n\t Encapsulation Type: %s (%u)",
621 bgp_vpn_rd_print(subtlv_ptr
.lspping_tlv_targetfec_subtlv_l2vpn_endpt
->rd
),
622 EXTRACT_16BITS(subtlv_ptr
.lspping_tlv_targetfec_subtlv_l2vpn_endpt
->sender_ce_id
),
623 EXTRACT_16BITS(subtlv_ptr
.lspping_tlv_targetfec_subtlv_l2vpn_endpt
->receiver_ce_id
),
624 tok2str(l2vpn_encaps_values
,
626 EXTRACT_16BITS(subtlv_ptr
.lspping_tlv_targetfec_subtlv_l2vpn_endpt
->encapsulation
)),
627 EXTRACT_16BITS(subtlv_ptr
.lspping_tlv_targetfec_subtlv_l2vpn_endpt
->encapsulation
));
631 case LSPPING_TLV_TARGETFEC_SUBTLV_L2VPN_VCID
:
632 subtlv_ptr
.lspping_tlv_targetfec_subtlv_l2vpn_vcid
= \
633 (const struct lspping_tlv_targetfec_subtlv_l2vpn_vcid_t
*)subtlv_tptr
;
634 printf("\n\t Sender PE: %s, Remote PE: %s" \
635 "\n\t VC-ID: 0x%08x, Encapsulation Type: %s (%u)",
636 ipaddr_string(subtlv_ptr
.lspping_tlv_targetfec_subtlv_l2vpn_vcid
->sender_pe_address
),
637 ipaddr_string(subtlv_ptr
.lspping_tlv_targetfec_subtlv_l2vpn_vcid
->remote_pe_address
),
638 EXTRACT_32BITS(subtlv_ptr
.lspping_tlv_targetfec_subtlv_l2vpn_vcid
->vc_id
),
639 tok2str(l2vpn_encaps_values
,
641 EXTRACT_16BITS(subtlv_ptr
.lspping_tlv_targetfec_subtlv_l2vpn_endpt
->encapsulation
)),
642 EXTRACT_16BITS(subtlv_ptr
.lspping_tlv_targetfec_subtlv_l2vpn_endpt
->encapsulation
));
647 subtlv_hexdump
=TRUE
; /* unknown subTLV just hexdump it */
650 /* do we want to see an additionally subtlv hexdump ? */
651 if (vflag
> 1 || subtlv_hexdump
==TRUE
)
652 print_unknown_data(tlv_tptr
+sizeof(struct lspping_tlv_header
), \
656 tlv_tptr
+=lspping_subtlv_len
;
657 tlv_tlen
-=lspping_subtlv_len
+sizeof(struct lspping_tlv_header
);
662 * FIXME those are the defined TLVs that lack a decoder
663 * you are welcome to contribute code ;-)
666 case LSPPING_TLV_DOWNSTREAM_MAPPING
:
667 case LSPPING_TLV_PAD
:
668 case LSPPING_TLV_ERROR_CODE
:
669 case LSPPING_TLV_VENDOR_PRIVATE
:
673 print_unknown_data(tlv_tptr
,"\n\t ",tlv_tlen
);
676 /* do we want to see an additionally tlv hexdump ? */
677 if (vflag
> 1 || tlv_hexdump
==TRUE
)
678 print_unknown_data(tptr
+sizeof(sizeof(struct lspping_tlv_header
)),"\n\t ",
681 tptr
+=lspping_tlv_len
;
682 tlen
-=lspping_tlv_len
+sizeof(struct lspping_tlv_header
);
686 printf("\n\t\t packet exceeded snapshot");