xref: /dflybsd-src/contrib/tcpdump/print-lspping.c (revision 59c07fbdf8168fa08c76c515186d561b5a92690c)
141c99275SPeter Avalos /*
241c99275SPeter Avalos  * Redistribution and use in source and binary forms, with or without
341c99275SPeter Avalos  * modification, are permitted provided that: (1) source code
441c99275SPeter Avalos  * distributions retain the above copyright notice and this paragraph
541c99275SPeter Avalos  * in its entirety, and (2) distributions including binary code include
641c99275SPeter Avalos  * the above copyright notice and this paragraph in its entirety in
741c99275SPeter Avalos  * the documentation or other materials provided with the distribution.
841c99275SPeter Avalos  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND
941c99275SPeter Avalos  * WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
1041c99275SPeter Avalos  * LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
1141c99275SPeter Avalos  * FOR A PARTICULAR PURPOSE.
1241c99275SPeter Avalos  *
13411677aeSAaron LI  * Original code by Hannes Gredler (hannes@gredler.at)
1441c99275SPeter Avalos  */
1541c99275SPeter Avalos 
16411677aeSAaron LI /* \summary: MPLS LSP PING printer */
1741c99275SPeter Avalos 
18*ed775ee7SAntonio Huete Jimenez /* specification: RFC 4379 */
19*ed775ee7SAntonio Huete Jimenez 
2041c99275SPeter Avalos #ifdef HAVE_CONFIG_H
21*ed775ee7SAntonio Huete Jimenez #include <config.h>
2241c99275SPeter Avalos #endif
2341c99275SPeter Avalos 
24*ed775ee7SAntonio Huete Jimenez #include "netdissect-stdinc.h"
2541c99275SPeter Avalos 
26*ed775ee7SAntonio Huete Jimenez #define ND_LONGJMP_FROM_TCHECK
27411677aeSAaron LI #include "netdissect.h"
2841c99275SPeter Avalos #include "extract.h"
2941c99275SPeter Avalos #include "addrtoname.h"
30*ed775ee7SAntonio Huete Jimenez #include "ntp.h"
3141c99275SPeter Avalos 
3241c99275SPeter Avalos #include "l2vpn.h"
3327bfbee1SPeter Avalos #include "oui.h"
3441c99275SPeter Avalos 
35411677aeSAaron LI 
3641c99275SPeter Avalos /*
3741c99275SPeter Avalos  * LSPPING common header
3841c99275SPeter Avalos  *
3941c99275SPeter Avalos  *  0                   1                   2                   3
4041c99275SPeter Avalos  *  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
4141c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
4241c99275SPeter Avalos  * |         Version Number        |         Must Be Zero          |
4341c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
4441c99275SPeter Avalos  * |  Message Type |   Reply mode  |  Return Code  | Return Subcode|
4541c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
4641c99275SPeter Avalos  * |                        Sender's Handle                        |
4741c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
4841c99275SPeter Avalos  * |                        Sequence Number                        |
4941c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
5041c99275SPeter Avalos  * |                    TimeStamp Sent (seconds)                   |
5141c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
5241c99275SPeter Avalos  * |                  TimeStamp Sent (microseconds)                |
5341c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
5441c99275SPeter Avalos  * |                  TimeStamp Received (seconds)                 |
5541c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
5641c99275SPeter Avalos  * |                TimeStamp Received (microseconds)              |
5741c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
5841c99275SPeter Avalos  * |                            TLVs ...                           |
5941c99275SPeter Avalos  * .                                                               .
6041c99275SPeter Avalos  * .                                                               .
6141c99275SPeter Avalos  * .                                                               .
6241c99275SPeter Avalos  */
6341c99275SPeter Avalos 
6441c99275SPeter Avalos struct lspping_common_header {
65*ed775ee7SAntonio Huete Jimenez     nd_uint16_t version;
66*ed775ee7SAntonio Huete Jimenez     nd_uint16_t global_flags;
67*ed775ee7SAntonio Huete Jimenez     nd_uint8_t  msg_type;
68*ed775ee7SAntonio Huete Jimenez     nd_uint8_t  reply_mode;
69*ed775ee7SAntonio Huete Jimenez     nd_uint8_t  return_code;
70*ed775ee7SAntonio Huete Jimenez     nd_uint8_t  return_subcode;
71*ed775ee7SAntonio Huete Jimenez     nd_uint32_t sender_handle;
72*ed775ee7SAntonio Huete Jimenez     nd_uint32_t seq_number;
73*ed775ee7SAntonio Huete Jimenez     struct l_fixedpt ts_sent;
74*ed775ee7SAntonio Huete Jimenez     struct l_fixedpt ts_rcvd;
7541c99275SPeter Avalos };
7641c99275SPeter Avalos 
7741c99275SPeter Avalos #define LSPPING_VERSION            1
7841c99275SPeter Avalos 
7941c99275SPeter Avalos static const struct tok lspping_msg_type_values[] = {
8041c99275SPeter Avalos     { 1, "MPLS Echo Request"},
8141c99275SPeter Avalos     { 2, "MPLS Echo Reply"},
8241c99275SPeter Avalos     { 0, NULL}
8341c99275SPeter Avalos };
8441c99275SPeter Avalos 
8541c99275SPeter Avalos static const struct tok lspping_reply_mode_values[] = {
8641c99275SPeter Avalos     { 1, "Do not reply"},
8741c99275SPeter Avalos     { 2, "Reply via an IPv4/IPv6 UDP packet"},
8841c99275SPeter Avalos     { 3, "Reply via an IPv4/IPv6 UDP packet with Router Alert"},
8941c99275SPeter Avalos     { 4, "Reply via application level control channel"},
9041c99275SPeter Avalos     { 0, NULL}
9141c99275SPeter Avalos };
9241c99275SPeter Avalos 
9341c99275SPeter Avalos static const struct tok lspping_return_code_values[] = {
9441c99275SPeter Avalos     {  0, "No return code or return code contained in the Error Code TLV"},
9541c99275SPeter Avalos     {  1, "Malformed echo request received"},
9641c99275SPeter Avalos     {  2, "One or more of the TLVs was not understood"},
9741c99275SPeter Avalos     {  3, "Replying router is an egress for the FEC at stack depth"},
9841c99275SPeter Avalos     {  4, "Replying router has no mapping for the FEC at stack depth"},
9941c99275SPeter Avalos     {  5, "Reserved"},
10041c99275SPeter Avalos     {  6, "Reserved"},
10141c99275SPeter Avalos     {  7, "Reserved"},
10241c99275SPeter Avalos     {  8, "Label switched at stack-depth"},
10341c99275SPeter Avalos     {  9, "Label switched but no MPLS forwarding at stack-depth"},
10441c99275SPeter Avalos     { 10, "Mapping for this FEC is not the given label at stack depth"},
10541c99275SPeter Avalos     { 11, "No label entry at stack-depth"},
10641c99275SPeter Avalos     { 12, "Protocol not associated with interface at FEC stack depth"},
107411677aeSAaron LI     { 13, "Premature termination of ping due to label stack shrinking to a single label"},
108411677aeSAaron LI     { 0,  NULL},
10941c99275SPeter Avalos };
11041c99275SPeter Avalos 
11141c99275SPeter Avalos 
11241c99275SPeter Avalos /*
11341c99275SPeter Avalos  * LSPPING TLV header
11441c99275SPeter Avalos  *  0                   1                   2                   3
11541c99275SPeter Avalos  *  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
11641c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
11741c99275SPeter Avalos  * |             Type              |            Length             |
11841c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
11941c99275SPeter Avalos  * |                             Value                             |
12041c99275SPeter Avalos  * .                                                               .
12141c99275SPeter Avalos  * .                                                               .
12241c99275SPeter Avalos  * .                                                               .
12341c99275SPeter Avalos  * |                                                               |
12441c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
12541c99275SPeter Avalos  */
12641c99275SPeter Avalos 
12741c99275SPeter Avalos struct lspping_tlv_header {
128*ed775ee7SAntonio Huete Jimenez     nd_uint16_t type;
129*ed775ee7SAntonio Huete Jimenez     nd_uint16_t length;
13041c99275SPeter Avalos };
13141c99275SPeter Avalos 
13241c99275SPeter Avalos #define	LSPPING_TLV_TARGET_FEC_STACK      1
13341c99275SPeter Avalos #define	LSPPING_TLV_DOWNSTREAM_MAPPING    2
13441c99275SPeter Avalos #define	LSPPING_TLV_PAD                   3
135411677aeSAaron LI /* not assigned                           4 */
13627bfbee1SPeter Avalos #define LSPPING_TLV_VENDOR_ENTERPRISE     5
13727bfbee1SPeter Avalos #define LSPPING_TLV_VENDOR_ENTERPRISE_LEN 4
138411677aeSAaron LI /* not assigned                           6 */
13927bfbee1SPeter Avalos #define LSPPING_TLV_INTERFACE_LABEL_STACK 7
140411677aeSAaron LI /* not assigned                           8 */
14127bfbee1SPeter Avalos #define	LSPPING_TLV_ERROR_CODE            9
14227bfbee1SPeter Avalos #define LSPPING_TLV_REPLY_TOS_BYTE        10
14341c99275SPeter Avalos #define	LSPPING_TLV_BFD_DISCRIMINATOR     15 /* draft-ietf-bfd-mpls-02 */
14441c99275SPeter Avalos #define LSPPING_TLV_BFD_DISCRIMINATOR_LEN 4
14541c99275SPeter Avalos #define	LSPPING_TLV_VENDOR_PRIVATE        0xfc00
14641c99275SPeter Avalos 
14741c99275SPeter Avalos static const struct tok lspping_tlv_values[] = {
14841c99275SPeter Avalos     { LSPPING_TLV_TARGET_FEC_STACK, "Target FEC Stack" },
14941c99275SPeter Avalos     { LSPPING_TLV_DOWNSTREAM_MAPPING, "Downstream Mapping" },
15041c99275SPeter Avalos     { LSPPING_TLV_PAD, "Pad" },
15141c99275SPeter Avalos     { LSPPING_TLV_ERROR_CODE, "Error Code" },
15227bfbee1SPeter Avalos     { LSPPING_TLV_VENDOR_ENTERPRISE, "Vendor Enterprise Code" },
15327bfbee1SPeter Avalos     { LSPPING_TLV_INTERFACE_LABEL_STACK, "Interface Label Stack" },
15427bfbee1SPeter Avalos     { LSPPING_TLV_REPLY_TOS_BYTE, "Reply TOS Byte" },
15541c99275SPeter Avalos     { LSPPING_TLV_BFD_DISCRIMINATOR, "BFD Discriminator" },
15627bfbee1SPeter Avalos     { LSPPING_TLV_VENDOR_PRIVATE, "Vendor Private Code" },
15741c99275SPeter Avalos     { 0, NULL}
15841c99275SPeter Avalos };
15941c99275SPeter Avalos 
16041c99275SPeter Avalos #define	LSPPING_TLV_TARGETFEC_SUBTLV_LDP_IPV4       1
16141c99275SPeter Avalos #define	LSPPING_TLV_TARGETFEC_SUBTLV_LDP_IPV6       2
16241c99275SPeter Avalos #define	LSPPING_TLV_TARGETFEC_SUBTLV_RSVP_IPV4      3
16341c99275SPeter Avalos #define	LSPPING_TLV_TARGETFEC_SUBTLV_RSVP_IPV6      4
164411677aeSAaron LI /* not assigned                                     5 */
16541c99275SPeter Avalos #define	LSPPING_TLV_TARGETFEC_SUBTLV_L3VPN_IPV4     6
16641c99275SPeter Avalos #define	LSPPING_TLV_TARGETFEC_SUBTLV_L3VPN_IPV6     7
16741c99275SPeter Avalos #define	LSPPING_TLV_TARGETFEC_SUBTLV_L2VPN_ENDPT    8
168411677aeSAaron LI #define	LSPPING_TLV_TARGETFEC_SUBTLV_FEC_128_PW_OLD 9
169411677aeSAaron LI #define	LSPPING_TLV_TARGETFEC_SUBTLV_FEC_128_PW     10
170411677aeSAaron LI #define	LSPPING_TLV_TARGETFEC_SUBTLV_FEC_129_PW     11
171411677aeSAaron LI #define	LSPPING_TLV_TARGETFEC_SUBTLV_BGP_IPV4       12
172411677aeSAaron LI #define	LSPPING_TLV_TARGETFEC_SUBTLV_BGP_IPV6       13
173411677aeSAaron LI #define	LSPPING_TLV_TARGETFEC_SUBTLV_GENERIC_IPV4   14
174411677aeSAaron LI #define	LSPPING_TLV_TARGETFEC_SUBTLV_GENERIC_IPV6   15
175411677aeSAaron LI #define	LSPPING_TLV_TARGETFEC_SUBTLV_NIL_FEC        16
17641c99275SPeter Avalos 
17741c99275SPeter Avalos static const struct tok lspping_tlvtargetfec_subtlv_values[] = {
17841c99275SPeter Avalos     { LSPPING_TLV_TARGETFEC_SUBTLV_LDP_IPV4, "LDP IPv4 prefix"},
17941c99275SPeter Avalos     { LSPPING_TLV_TARGETFEC_SUBTLV_LDP_IPV6, "LDP IPv6 prefix"},
18041c99275SPeter Avalos     { LSPPING_TLV_TARGETFEC_SUBTLV_RSVP_IPV4, "RSVP IPv4 Session Query"},
18141c99275SPeter Avalos     { LSPPING_TLV_TARGETFEC_SUBTLV_RSVP_IPV6, "RSVP IPv6 Session Query"},
18241c99275SPeter Avalos     { 5, "Reserved"},
18341c99275SPeter Avalos     { LSPPING_TLV_TARGETFEC_SUBTLV_L3VPN_IPV4, "VPN IPv4 prefix"},
18441c99275SPeter Avalos     { LSPPING_TLV_TARGETFEC_SUBTLV_L3VPN_IPV6, "VPN IPv6 prefix"},
18541c99275SPeter Avalos     { LSPPING_TLV_TARGETFEC_SUBTLV_L2VPN_ENDPT, "L2 VPN endpoint"},
186411677aeSAaron LI     { LSPPING_TLV_TARGETFEC_SUBTLV_FEC_128_PW_OLD, "FEC 128 pseudowire (old)"},
187411677aeSAaron LI     { LSPPING_TLV_TARGETFEC_SUBTLV_FEC_128_PW, "FEC 128 pseudowire"},
18841c99275SPeter Avalos     { LSPPING_TLV_TARGETFEC_SUBTLV_BGP_IPV4, "BGP labeled IPv4 prefix"},
18941c99275SPeter Avalos     { LSPPING_TLV_TARGETFEC_SUBTLV_BGP_IPV6, "BGP labeled IPv6 prefix"},
19041c99275SPeter Avalos     { 0, NULL}
19141c99275SPeter Avalos };
19241c99275SPeter Avalos 
19341c99275SPeter Avalos /*
19441c99275SPeter Avalos  *  0                   1                   2                   3
19541c99275SPeter Avalos  *  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
19641c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
19741c99275SPeter Avalos  * |                          IPv4 prefix                          |
19841c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
19941c99275SPeter Avalos  * | Prefix Length |         Must Be Zero                          |
20041c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
20141c99275SPeter Avalos  */
20241c99275SPeter Avalos struct lspping_tlv_targetfec_subtlv_ldp_ipv4_t {
203*ed775ee7SAntonio Huete Jimenez     nd_ipv4    prefix;
204*ed775ee7SAntonio Huete Jimenez     nd_uint8_t prefix_len;
20541c99275SPeter Avalos };
20641c99275SPeter Avalos 
20741c99275SPeter Avalos /*
20841c99275SPeter Avalos  *  0                   1                   2                   3
20941c99275SPeter Avalos  *  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
21041c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
21141c99275SPeter Avalos  * |                          IPv6 prefix                          |
21241c99275SPeter Avalos  * |                          (16 octets)                          |
21341c99275SPeter Avalos  * |                                                               |
21441c99275SPeter Avalos  * |                                                               |
21541c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
21641c99275SPeter Avalos  * | Prefix Length |         Must Be Zero                          |
21741c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
21841c99275SPeter Avalos  */
21941c99275SPeter Avalos struct lspping_tlv_targetfec_subtlv_ldp_ipv6_t {
220*ed775ee7SAntonio Huete Jimenez     nd_ipv6    prefix;
221*ed775ee7SAntonio Huete Jimenez     nd_uint8_t prefix_len;
22241c99275SPeter Avalos };
22341c99275SPeter Avalos 
22441c99275SPeter Avalos /*
22541c99275SPeter Avalos  *  0                   1                   2                   3
22641c99275SPeter Avalos  *  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
22741c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
22841c99275SPeter Avalos  * |                 IPv4 tunnel end point address                 |
22941c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
23041c99275SPeter Avalos  * |          Must Be Zero         |     Tunnel ID                 |
23141c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
23241c99275SPeter Avalos  * |                       Extended Tunnel ID                      |
23341c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
23441c99275SPeter Avalos  * |                   IPv4 tunnel sender address                  |
23541c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
23641c99275SPeter Avalos  * |          Must Be Zero         |            LSP ID             |
23741c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
23841c99275SPeter Avalos  */
23941c99275SPeter Avalos struct lspping_tlv_targetfec_subtlv_rsvp_ipv4_t {
240*ed775ee7SAntonio Huete Jimenez     nd_ipv4     tunnel_endpoint;
241*ed775ee7SAntonio Huete Jimenez     nd_byte     res[2];
242*ed775ee7SAntonio Huete Jimenez     nd_uint16_t tunnel_id;
243*ed775ee7SAntonio Huete Jimenez     nd_ipv4     extended_tunnel_id;
244*ed775ee7SAntonio Huete Jimenez     nd_ipv4     tunnel_sender;
245*ed775ee7SAntonio Huete Jimenez     nd_byte     res2[2];
246*ed775ee7SAntonio Huete Jimenez     nd_uint16_t lsp_id;
24741c99275SPeter Avalos };
24841c99275SPeter Avalos 
24941c99275SPeter Avalos /*
25041c99275SPeter Avalos  *  0                   1                   2                   3
25141c99275SPeter Avalos  *  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
25241c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
25341c99275SPeter Avalos  * |                 IPv6 tunnel end point address                 |
25441c99275SPeter Avalos  * |                                                               |
25541c99275SPeter Avalos  * |                                                               |
25641c99275SPeter Avalos  * |                                                               |
25741c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
25841c99275SPeter Avalos  * |          Must Be Zero         |          Tunnel ID            |
25941c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
26041c99275SPeter Avalos  * |                       Extended Tunnel ID                      |
26141c99275SPeter Avalos  * |                                                               |
26241c99275SPeter Avalos  * |                                                               |
26341c99275SPeter Avalos  * |                                                               |
26441c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
26541c99275SPeter Avalos  * |                   IPv6 tunnel sender address                  |
26641c99275SPeter Avalos  * |                                                               |
26741c99275SPeter Avalos  * |                                                               |
26841c99275SPeter Avalos  * |                                                               |
26941c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
27041c99275SPeter Avalos  * |          Must Be Zero         |            LSP ID             |
27141c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
27241c99275SPeter Avalos  */
27341c99275SPeter Avalos struct lspping_tlv_targetfec_subtlv_rsvp_ipv6_t {
274*ed775ee7SAntonio Huete Jimenez     nd_ipv6     tunnel_endpoint;
275*ed775ee7SAntonio Huete Jimenez     nd_byte     res[2];
276*ed775ee7SAntonio Huete Jimenez     nd_uint16_t tunnel_id;
277*ed775ee7SAntonio Huete Jimenez     nd_ipv6     extended_tunnel_id;
278*ed775ee7SAntonio Huete Jimenez     nd_ipv6     tunnel_sender;
279*ed775ee7SAntonio Huete Jimenez     nd_byte     res2[2];
280*ed775ee7SAntonio Huete Jimenez     nd_uint16_t lsp_id;
28141c99275SPeter Avalos };
28241c99275SPeter Avalos 
28341c99275SPeter Avalos /*
28441c99275SPeter Avalos  *  0                   1                   2                   3
28541c99275SPeter Avalos  *  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
28641c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
28741c99275SPeter Avalos  * |                      Route Distinguisher                      |
28841c99275SPeter Avalos  * |                          (8 octets)                           |
28941c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
29041c99275SPeter Avalos  * |                         IPv4 prefix                           |
29141c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
29241c99275SPeter Avalos  * | Prefix Length |                 Must Be Zero                  |
29341c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
29441c99275SPeter Avalos  */
29541c99275SPeter Avalos struct lspping_tlv_targetfec_subtlv_l3vpn_ipv4_t {
296*ed775ee7SAntonio Huete Jimenez     nd_byte    rd[8];
297*ed775ee7SAntonio Huete Jimenez     nd_ipv4    prefix;
298*ed775ee7SAntonio Huete Jimenez     nd_uint8_t prefix_len;
29941c99275SPeter Avalos };
30041c99275SPeter Avalos 
30141c99275SPeter Avalos /*
30241c99275SPeter Avalos  *  0                   1                   2                   3
30341c99275SPeter Avalos  *  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
30441c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
30541c99275SPeter Avalos  * |                      Route Distinguisher                      |
30641c99275SPeter Avalos  * |                          (8 octets)                           |
30741c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
30841c99275SPeter Avalos  * |                          IPv6 prefix                          |
30941c99275SPeter Avalos  * |                          (16 octets)                          |
31041c99275SPeter Avalos  * |                                                               |
31141c99275SPeter Avalos  * |                                                               |
31241c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
31341c99275SPeter Avalos  * | Prefix Length |                 Must Be Zero                  |
31441c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
31541c99275SPeter Avalos  */
31641c99275SPeter Avalos struct lspping_tlv_targetfec_subtlv_l3vpn_ipv6_t {
317*ed775ee7SAntonio Huete Jimenez     nd_byte    rd[8];
318*ed775ee7SAntonio Huete Jimenez     nd_ipv6    prefix;
319*ed775ee7SAntonio Huete Jimenez     nd_uint8_t prefix_len;
32041c99275SPeter Avalos };
32141c99275SPeter Avalos 
32241c99275SPeter Avalos /*
32341c99275SPeter Avalos  *  0                   1                   2                   3
32441c99275SPeter Avalos  *  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
32541c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
32641c99275SPeter Avalos  * |                      Route Distinguisher                      |
32741c99275SPeter Avalos  * |                          (8 octets)                           |
32841c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
329411677aeSAaron LI  * |         Sender's VE ID        |       Receiver's VE ID        |
33041c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
33141c99275SPeter Avalos  * |      Encapsulation Type       |         Must Be Zero          |
33241c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
33341c99275SPeter Avalos  *  0                   1                   2                   3
33441c99275SPeter Avalos  */
33541c99275SPeter Avalos struct lspping_tlv_targetfec_subtlv_l2vpn_endpt_t {
336*ed775ee7SAntonio Huete Jimenez     nd_byte     rd[8];
337*ed775ee7SAntonio Huete Jimenez     nd_uint16_t sender_ve_id;
338*ed775ee7SAntonio Huete Jimenez     nd_uint16_t receiver_ve_id;
339*ed775ee7SAntonio Huete Jimenez     nd_uint16_t encapsulation;
34041c99275SPeter Avalos };
34141c99275SPeter Avalos 
34241c99275SPeter Avalos /*
34341c99275SPeter Avalos  *  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
34441c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
34541c99275SPeter Avalos  * |                      Remote PE Address                        |
34641c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
347411677aeSAaron LI  * |                             PW ID                             |
34841c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
349411677aeSAaron LI  * |            PW Type            |          Must Be Zero         |
35041c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
35141c99275SPeter Avalos  */
352411677aeSAaron LI struct lspping_tlv_targetfec_subtlv_fec_128_pw_old {
353*ed775ee7SAntonio Huete Jimenez     nd_ipv4     remote_pe_address;
354*ed775ee7SAntonio Huete Jimenez     nd_uint32_t pw_id;
355*ed775ee7SAntonio Huete Jimenez     nd_uint16_t pw_type;
35641c99275SPeter Avalos };
35741c99275SPeter Avalos 
35841c99275SPeter Avalos /*
35941c99275SPeter Avalos  *  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
36041c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
36141c99275SPeter Avalos  * |                     Sender's PE Address                       |
36241c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
36341c99275SPeter Avalos  * |                      Remote PE Address                        |
36441c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
365411677aeSAaron LI  * |                             PW ID                             |
36641c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
367411677aeSAaron LI  * |            PW Type            |          Must Be Zero         |
36841c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
36941c99275SPeter Avalos  */
370411677aeSAaron LI struct lspping_tlv_targetfec_subtlv_fec_128_pw {
371*ed775ee7SAntonio Huete Jimenez     nd_ipv4     sender_pe_address;
372*ed775ee7SAntonio Huete Jimenez     nd_ipv4     remote_pe_address;
373*ed775ee7SAntonio Huete Jimenez     nd_uint32_t pw_id;
374*ed775ee7SAntonio Huete Jimenez     nd_uint16_t pw_type;
375411677aeSAaron LI };
376411677aeSAaron LI 
377411677aeSAaron LI /*
378411677aeSAaron LI  * 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
379411677aeSAaron LI  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
380411677aeSAaron LI  * |                         IPv4 prefix                           |
381411677aeSAaron LI  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
382411677aeSAaron LI  * | Prefix Length |                 Must Be Zero                  |
383411677aeSAaron LI  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
384411677aeSAaron LI  */
385411677aeSAaron LI struct lspping_tlv_targetfec_subtlv_bgp_ipv4_t {
386*ed775ee7SAntonio Huete Jimenez     nd_ipv4    prefix;
387*ed775ee7SAntonio Huete Jimenez     nd_uint8_t prefix_len;
388411677aeSAaron LI };
389411677aeSAaron LI 
390411677aeSAaron LI /*
391411677aeSAaron LI  * 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
392411677aeSAaron LI  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
393411677aeSAaron LI  * |                          IPv6 prefix                          |
394411677aeSAaron LI  * |                          (16 octets)                          |
395411677aeSAaron LI  * |                                                               |
396411677aeSAaron LI  * |                                                               |
397411677aeSAaron LI  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
398411677aeSAaron LI  * | Prefix Length |                 Must Be Zero                  |
399411677aeSAaron LI  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
400411677aeSAaron LI  */
401411677aeSAaron LI struct lspping_tlv_targetfec_subtlv_bgp_ipv6_t {
402*ed775ee7SAntonio Huete Jimenez     nd_ipv6    prefix;
403*ed775ee7SAntonio Huete Jimenez     nd_uint8_t prefix_len;
40441c99275SPeter Avalos };
40541c99275SPeter Avalos 
40641c99275SPeter Avalos /*
40741c99275SPeter Avalos  *  0                   1                   2                   3
40841c99275SPeter Avalos  *  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
40941c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
41041c99275SPeter Avalos  * |               MTU             | Address Type  |  Resvd (SBZ)  |
41141c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
41241c99275SPeter Avalos  * |             Downstream IP Address (4 or 16 octets)            |
41341c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
41441c99275SPeter Avalos  * |         Downstream Interface Address (4 or 16 octets)         |
41541c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
416411677aeSAaron LI  * | Multipath Type| Depth Limit   |        Multipath Length       |
41741c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
41841c99275SPeter Avalos  * .                                                               .
41941c99275SPeter Avalos  * .                     (Multipath Information)                   .
42041c99275SPeter Avalos  * .                                                               .
42141c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
42241c99275SPeter Avalos  * |               Downstream Label                |    Protocol   |
42341c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
42441c99275SPeter Avalos  * .                                                               .
42541c99275SPeter Avalos  * .                                                               .
42641c99275SPeter Avalos  * .                                                               .
42741c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
42841c99275SPeter Avalos  * |               Downstream Label                |    Protocol   |
42941c99275SPeter Avalos  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
43041c99275SPeter Avalos  */
431411677aeSAaron LI /* Enough to get the address type */
432411677aeSAaron LI struct lspping_tlv_downstream_map_t {
433*ed775ee7SAntonio Huete Jimenez     nd_uint16_t mtu;
434*ed775ee7SAntonio Huete Jimenez     nd_uint8_t  address_type;
435*ed775ee7SAntonio Huete Jimenez     nd_uint8_t  ds_flags;
436411677aeSAaron LI };
437411677aeSAaron LI 
43841c99275SPeter Avalos struct lspping_tlv_downstream_map_ipv4_t {
439*ed775ee7SAntonio Huete Jimenez     nd_uint16_t mtu;
440*ed775ee7SAntonio Huete Jimenez     nd_uint8_t  address_type;
441*ed775ee7SAntonio Huete Jimenez     nd_uint8_t  ds_flags;
442*ed775ee7SAntonio Huete Jimenez     nd_ipv4     downstream_ip;
443*ed775ee7SAntonio Huete Jimenez     nd_ipv4     downstream_interface;
444411677aeSAaron LI };
445411677aeSAaron LI 
446411677aeSAaron LI struct lspping_tlv_downstream_map_ipv4_unmb_t {
447*ed775ee7SAntonio Huete Jimenez     nd_uint16_t mtu;
448*ed775ee7SAntonio Huete Jimenez     nd_uint8_t  address_type;
449*ed775ee7SAntonio Huete Jimenez     nd_uint8_t  ds_flags;
450*ed775ee7SAntonio Huete Jimenez     nd_ipv4     downstream_ip;
451*ed775ee7SAntonio Huete Jimenez     nd_uint32_t downstream_interface;
45241c99275SPeter Avalos };
45341c99275SPeter Avalos 
45441c99275SPeter Avalos struct lspping_tlv_downstream_map_ipv6_t {
455*ed775ee7SAntonio Huete Jimenez     nd_uint16_t mtu;
456*ed775ee7SAntonio Huete Jimenez     nd_uint8_t  address_type;
457*ed775ee7SAntonio Huete Jimenez     nd_uint8_t  ds_flags;
458*ed775ee7SAntonio Huete Jimenez     nd_ipv6     downstream_ip;
459*ed775ee7SAntonio Huete Jimenez     nd_ipv6     downstream_interface;
460411677aeSAaron LI };
461411677aeSAaron LI 
462411677aeSAaron LI struct lspping_tlv_downstream_map_ipv6_unmb_t {
463*ed775ee7SAntonio Huete Jimenez     nd_uint16_t mtu;
464*ed775ee7SAntonio Huete Jimenez     nd_uint8_t  address_type;
465*ed775ee7SAntonio Huete Jimenez     nd_uint8_t  ds_flags;
466*ed775ee7SAntonio Huete Jimenez     nd_ipv6     downstream_ip;
467*ed775ee7SAntonio Huete Jimenez     nd_uint32_t downstream_interface;
46841c99275SPeter Avalos };
46941c99275SPeter Avalos 
47041c99275SPeter Avalos struct lspping_tlv_downstream_map_info_t {
471*ed775ee7SAntonio Huete Jimenez     nd_uint8_t  multipath_type;
472*ed775ee7SAntonio Huete Jimenez     nd_uint8_t  depth_limit;
473*ed775ee7SAntonio Huete Jimenez     nd_uint16_t multipath_length;
47441c99275SPeter Avalos };
47541c99275SPeter Avalos 
47641c99275SPeter Avalos #define LSPPING_AFI_IPV4      1
477411677aeSAaron LI #define LSPPING_AFI_IPV4_UNMB 2
47841c99275SPeter Avalos #define LSPPING_AFI_IPV6      3
479411677aeSAaron LI #define LSPPING_AFI_IPV6_UNMB 4
48041c99275SPeter Avalos 
48141c99275SPeter Avalos static const struct tok lspping_tlv_downstream_addr_values[] = {
48241c99275SPeter Avalos     { LSPPING_AFI_IPV4,      "IPv4"},
483411677aeSAaron LI     { LSPPING_AFI_IPV4_UNMB, "Unnumbered IPv4"},
48441c99275SPeter Avalos     { LSPPING_AFI_IPV6,      "IPv6"},
485411677aeSAaron LI     { LSPPING_AFI_IPV6_UNMB, "IPv6"},
48641c99275SPeter Avalos     { 0, NULL}
48741c99275SPeter Avalos };
48841c99275SPeter Avalos 
48941c99275SPeter Avalos void
lspping_print(netdissect_options * ndo,const u_char * pptr,u_int len)490411677aeSAaron LI lspping_print(netdissect_options *ndo,
491*ed775ee7SAntonio Huete Jimenez               const u_char *pptr, u_int len)
492411677aeSAaron LI {
49341c99275SPeter Avalos     const struct lspping_common_header *lspping_com_header;
49441c99275SPeter Avalos     const struct lspping_tlv_header *lspping_tlv_header;
49541c99275SPeter Avalos     const struct lspping_tlv_header *lspping_subtlv_header;
49641c99275SPeter Avalos     const u_char *tptr,*tlv_tptr,*subtlv_tptr;
497*ed775ee7SAntonio Huete Jimenez     u_int return_code, return_subcode;
498411677aeSAaron LI     u_int tlen,lspping_tlv_len,lspping_tlv_type,tlv_tlen;
49941c99275SPeter Avalos     int tlv_hexdump,subtlv_hexdump;
500411677aeSAaron LI     u_int lspping_subtlv_len,lspping_subtlv_type;
501*ed775ee7SAntonio Huete Jimenez     uint32_t int_part, fraction;
502*ed775ee7SAntonio Huete Jimenez     u_int address_type;
50341c99275SPeter Avalos 
50441c99275SPeter Avalos     union {
505411677aeSAaron LI         const struct lspping_tlv_downstream_map_t *lspping_tlv_downstream_map;
50641c99275SPeter Avalos         const struct lspping_tlv_downstream_map_ipv4_t *lspping_tlv_downstream_map_ipv4;
507411677aeSAaron LI         const struct lspping_tlv_downstream_map_ipv4_unmb_t *lspping_tlv_downstream_map_ipv4_unmb;
50841c99275SPeter Avalos         const struct lspping_tlv_downstream_map_ipv6_t *lspping_tlv_downstream_map_ipv6;
509411677aeSAaron LI         const struct lspping_tlv_downstream_map_ipv6_unmb_t *lspping_tlv_downstream_map_ipv6_unmb;
51041c99275SPeter Avalos         const struct lspping_tlv_downstream_map_info_t  *lspping_tlv_downstream_map_info;
51141c99275SPeter Avalos     } tlv_ptr;
51241c99275SPeter Avalos 
51341c99275SPeter Avalos     union {
51441c99275SPeter Avalos         const struct lspping_tlv_targetfec_subtlv_ldp_ipv4_t *lspping_tlv_targetfec_subtlv_ldp_ipv4;
51541c99275SPeter Avalos         const struct lspping_tlv_targetfec_subtlv_ldp_ipv6_t *lspping_tlv_targetfec_subtlv_ldp_ipv6;
51641c99275SPeter Avalos         const struct lspping_tlv_targetfec_subtlv_rsvp_ipv4_t *lspping_tlv_targetfec_subtlv_rsvp_ipv4;
51741c99275SPeter Avalos         const struct lspping_tlv_targetfec_subtlv_rsvp_ipv6_t *lspping_tlv_targetfec_subtlv_rsvp_ipv6;
51841c99275SPeter Avalos         const struct lspping_tlv_targetfec_subtlv_l3vpn_ipv4_t *lspping_tlv_targetfec_subtlv_l3vpn_ipv4;
51941c99275SPeter Avalos         const struct lspping_tlv_targetfec_subtlv_l3vpn_ipv6_t *lspping_tlv_targetfec_subtlv_l3vpn_ipv6;
52041c99275SPeter Avalos         const struct lspping_tlv_targetfec_subtlv_l2vpn_endpt_t *lspping_tlv_targetfec_subtlv_l2vpn_endpt;
521411677aeSAaron LI         const struct lspping_tlv_targetfec_subtlv_fec_128_pw_old *lspping_tlv_targetfec_subtlv_l2vpn_vcid_old;
522411677aeSAaron LI         const struct lspping_tlv_targetfec_subtlv_fec_128_pw *lspping_tlv_targetfec_subtlv_l2vpn_vcid;
52341c99275SPeter Avalos         const struct lspping_tlv_targetfec_subtlv_bgp_ipv4_t *lspping_tlv_targetfec_subtlv_bgp_ipv4;
52441c99275SPeter Avalos         const struct lspping_tlv_targetfec_subtlv_bgp_ipv6_t *lspping_tlv_targetfec_subtlv_bgp_ipv6;
52541c99275SPeter Avalos     } subtlv_ptr;
52641c99275SPeter Avalos 
527*ed775ee7SAntonio Huete Jimenez     ndo->ndo_protocol = "lspping";
52841c99275SPeter Avalos     tptr=pptr;
52941c99275SPeter Avalos     lspping_com_header = (const struct lspping_common_header *)pptr;
530*ed775ee7SAntonio Huete Jimenez     if (len < sizeof(struct lspping_common_header))
531411677aeSAaron LI         goto tooshort;
532*ed775ee7SAntonio Huete Jimenez     ND_TCHECK_SIZE(lspping_com_header);
53341c99275SPeter Avalos 
53441c99275SPeter Avalos     /*
53541c99275SPeter Avalos      * Sanity checking of the header.
53641c99275SPeter Avalos      */
537*ed775ee7SAntonio Huete Jimenez     if (GET_BE_U_2(lspping_com_header->version) != LSPPING_VERSION) {
538*ed775ee7SAntonio Huete Jimenez 	ND_PRINT("LSP-PING version %u packet not supported",
539*ed775ee7SAntonio Huete Jimenez                GET_BE_U_2(lspping_com_header->version));
54041c99275SPeter Avalos 	return;
54141c99275SPeter Avalos     }
54241c99275SPeter Avalos 
54341c99275SPeter Avalos     /* in non-verbose mode just lets print the basic Message Type*/
544411677aeSAaron LI     if (ndo->ndo_vflag < 1) {
545*ed775ee7SAntonio Huete Jimenez         ND_PRINT("LSP-PINGv%u, %s, seq %u, length: %u",
546*ed775ee7SAntonio Huete Jimenez                GET_BE_U_2(lspping_com_header->version),
547*ed775ee7SAntonio Huete Jimenez                tok2str(lspping_msg_type_values, "unknown (%u)",GET_U_1(lspping_com_header->msg_type)),
548*ed775ee7SAntonio Huete Jimenez                GET_BE_U_4(lspping_com_header->seq_number),
549*ed775ee7SAntonio Huete Jimenez                len);
55041c99275SPeter Avalos         return;
55141c99275SPeter Avalos     }
55241c99275SPeter Avalos 
55341c99275SPeter Avalos     /* ok they seem to want to know everything - lets fully decode it */
55441c99275SPeter Avalos 
55541c99275SPeter Avalos     tlen=len;
55641c99275SPeter Avalos 
557*ed775ee7SAntonio Huete Jimenez     ND_PRINT("\n\tLSP-PINGv%u, msg-type: %s (%u), length: %u\n\t  reply-mode: %s (%u)",
558*ed775ee7SAntonio Huete Jimenez            GET_BE_U_2(lspping_com_header->version),
559*ed775ee7SAntonio Huete Jimenez            tok2str(lspping_msg_type_values, "unknown",GET_U_1(lspping_com_header->msg_type)),
560*ed775ee7SAntonio Huete Jimenez            GET_U_1(lspping_com_header->msg_type),
56141c99275SPeter Avalos            len,
562*ed775ee7SAntonio Huete Jimenez            tok2str(lspping_reply_mode_values, "unknown",GET_U_1(lspping_com_header->reply_mode)),
563*ed775ee7SAntonio Huete Jimenez            GET_U_1(lspping_com_header->reply_mode));
56441c99275SPeter Avalos 
56541c99275SPeter Avalos     /*
56641c99275SPeter Avalos      *  the following return codes require that the subcode is attached
56741c99275SPeter Avalos      *  at the end of the translated token output
56841c99275SPeter Avalos      */
569*ed775ee7SAntonio Huete Jimenez     return_code = GET_U_1(lspping_com_header->return_code);
570*ed775ee7SAntonio Huete Jimenez     return_subcode = GET_U_1(lspping_com_header->return_subcode);
571*ed775ee7SAntonio Huete Jimenez     if (return_code == 3 ||
572*ed775ee7SAntonio Huete Jimenez         return_code == 4 ||
573*ed775ee7SAntonio Huete Jimenez         return_code == 8 ||
574*ed775ee7SAntonio Huete Jimenez         return_code == 10 ||
575*ed775ee7SAntonio Huete Jimenez         return_code == 11 ||
576*ed775ee7SAntonio Huete Jimenez         return_code == 12 )
577*ed775ee7SAntonio Huete Jimenez         ND_PRINT("\n\t  Return Code: %s %u (%u)\n\t  Return Subcode: (%u)",
578*ed775ee7SAntonio Huete Jimenez                tok2str(lspping_return_code_values, "unknown",return_code),
579*ed775ee7SAntonio Huete Jimenez                return_subcode,
580*ed775ee7SAntonio Huete Jimenez                return_code,
581*ed775ee7SAntonio Huete Jimenez                return_subcode);
58241c99275SPeter Avalos     else
583*ed775ee7SAntonio Huete Jimenez         ND_PRINT("\n\t  Return Code: %s (%u)\n\t  Return Subcode: (%u)",
584*ed775ee7SAntonio Huete Jimenez                tok2str(lspping_return_code_values, "unknown",return_code),
585*ed775ee7SAntonio Huete Jimenez                return_code,
586*ed775ee7SAntonio Huete Jimenez                return_subcode);
58741c99275SPeter Avalos 
588*ed775ee7SAntonio Huete Jimenez     ND_PRINT("\n\t  Sender Handle: 0x%08x, Sequence: %u",
589*ed775ee7SAntonio Huete Jimenez            GET_BE_U_4(lspping_com_header->sender_handle),
590*ed775ee7SAntonio Huete Jimenez            GET_BE_U_4(lspping_com_header->seq_number));
59141c99275SPeter Avalos 
592*ed775ee7SAntonio Huete Jimenez     ND_PRINT("\n\t  Sender Timestamp: ");
593*ed775ee7SAntonio Huete Jimenez     p_ntp_time(ndo, &lspping_com_header->ts_sent);
594*ed775ee7SAntonio Huete Jimenez     ND_PRINT(" ");
59541c99275SPeter Avalos 
596*ed775ee7SAntonio Huete Jimenez     int_part=GET_BE_U_4(lspping_com_header->ts_rcvd.int_part);
597*ed775ee7SAntonio Huete Jimenez     fraction=GET_BE_U_4(lspping_com_header->ts_rcvd.fraction);
598*ed775ee7SAntonio Huete Jimenez     ND_PRINT("Receiver Timestamp: ");
599*ed775ee7SAntonio Huete Jimenez     if (! (int_part == 0 && fraction == 0))
600*ed775ee7SAntonio Huete Jimenez         p_ntp_time(ndo, &lspping_com_header->ts_rcvd);
60141c99275SPeter Avalos     else
602*ed775ee7SAntonio Huete Jimenez         ND_PRINT("no timestamp");
60341c99275SPeter Avalos 
604*ed775ee7SAntonio Huete Jimenez     tptr+=sizeof(struct lspping_common_header);
605*ed775ee7SAntonio Huete Jimenez     tlen-=sizeof(struct lspping_common_header);
60641c99275SPeter Avalos 
607411677aeSAaron LI     while (tlen != 0) {
608411677aeSAaron LI         /* Does the TLV go past the end of the packet? */
609411677aeSAaron LI         if (tlen < sizeof(struct lspping_tlv_header))
610411677aeSAaron LI             goto tooshort;
61127bfbee1SPeter Avalos 
61241c99275SPeter Avalos         lspping_tlv_header = (const struct lspping_tlv_header *)tptr;
613*ed775ee7SAntonio Huete Jimenez         lspping_tlv_type=GET_BE_U_2(lspping_tlv_header->type);
614*ed775ee7SAntonio Huete Jimenez         lspping_tlv_len=GET_BE_U_2(lspping_tlv_header->length);
61541c99275SPeter Avalos 
616*ed775ee7SAntonio Huete Jimenez         ND_PRINT("\n\t  %s TLV (%u), length: %u",
61741c99275SPeter Avalos                tok2str(lspping_tlv_values,
61841c99275SPeter Avalos                        "Unknown",
61941c99275SPeter Avalos                        lspping_tlv_type),
62041c99275SPeter Avalos                lspping_tlv_type,
621*ed775ee7SAntonio Huete Jimenez                lspping_tlv_len);
622411677aeSAaron LI 
623411677aeSAaron LI         /* some little sanity checking */
624411677aeSAaron LI         if (lspping_tlv_len == 0) {
625411677aeSAaron LI             tptr+=sizeof(struct lspping_tlv_header);
626411677aeSAaron LI             tlen-=sizeof(struct lspping_tlv_header);
627411677aeSAaron LI             continue;    /* no value to dissect */
628411677aeSAaron LI         }
62941c99275SPeter Avalos 
63041c99275SPeter Avalos         tlv_tptr=tptr+sizeof(struct lspping_tlv_header);
63141c99275SPeter Avalos         tlv_tlen=lspping_tlv_len; /* header not included -> no adjustment */
63241c99275SPeter Avalos 
633411677aeSAaron LI         /* Does the TLV go past the end of the packet? */
634411677aeSAaron LI         if (tlen < lspping_tlv_len+sizeof(struct lspping_tlv_header))
635411677aeSAaron LI             goto tooshort;
63641c99275SPeter Avalos         /* did we capture enough for fully decoding the tlv ? */
637*ed775ee7SAntonio Huete Jimenez         ND_TCHECK_LEN(tlv_tptr, lspping_tlv_len);
63841c99275SPeter Avalos         tlv_hexdump=FALSE;
63941c99275SPeter Avalos 
64041c99275SPeter Avalos         switch(lspping_tlv_type) {
64141c99275SPeter Avalos         case LSPPING_TLV_TARGET_FEC_STACK:
642411677aeSAaron LI             while (tlv_tlen != 0) {
643411677aeSAaron LI                 /* Does the subTLV header go past the end of the TLV? */
644411677aeSAaron LI                 if (tlv_tlen < sizeof(struct lspping_tlv_header)) {
645*ed775ee7SAntonio Huete Jimenez                     ND_PRINT("\n\t      TLV is too short");
646411677aeSAaron LI                     tlv_hexdump = TRUE;
647411677aeSAaron LI                     goto tlv_tooshort;
648411677aeSAaron LI                 }
64941c99275SPeter Avalos                 subtlv_hexdump=FALSE;
65041c99275SPeter Avalos 
65141c99275SPeter Avalos                 lspping_subtlv_header = (const struct lspping_tlv_header *)tlv_tptr;
652*ed775ee7SAntonio Huete Jimenez                 lspping_subtlv_type=GET_BE_U_2(lspping_subtlv_header->type);
653*ed775ee7SAntonio Huete Jimenez                 lspping_subtlv_len=GET_BE_U_2(lspping_subtlv_header->length);
65441c99275SPeter Avalos                 subtlv_tptr=tlv_tptr+sizeof(struct lspping_tlv_header);
65541c99275SPeter Avalos 
656411677aeSAaron LI                 /* Does the subTLV go past the end of the TLV? */
657411677aeSAaron LI                 if (tlv_tlen < lspping_subtlv_len+sizeof(struct lspping_tlv_header)) {
658*ed775ee7SAntonio Huete Jimenez                     ND_PRINT("\n\t      TLV is too short");
659411677aeSAaron LI                     tlv_hexdump = TRUE;
660411677aeSAaron LI                     goto tlv_tooshort;
661411677aeSAaron LI                 }
66241c99275SPeter Avalos 
663411677aeSAaron LI                 /* Did we capture enough for fully decoding the subTLV? */
664*ed775ee7SAntonio Huete Jimenez                 ND_TCHECK_LEN(subtlv_tptr, lspping_subtlv_len);
665411677aeSAaron LI 
666*ed775ee7SAntonio Huete Jimenez                 ND_PRINT("\n\t    %s subTLV (%u), length: %u",
66741c99275SPeter Avalos                        tok2str(lspping_tlvtargetfec_subtlv_values,
66841c99275SPeter Avalos                                "Unknown",
66941c99275SPeter Avalos                                lspping_subtlv_type),
67041c99275SPeter Avalos                        lspping_subtlv_type,
671*ed775ee7SAntonio Huete Jimenez                        lspping_subtlv_len);
67241c99275SPeter Avalos 
67341c99275SPeter Avalos                 switch(lspping_subtlv_type) {
67441c99275SPeter Avalos 
67541c99275SPeter Avalos                 case LSPPING_TLV_TARGETFEC_SUBTLV_LDP_IPV4:
676411677aeSAaron LI                     /* Is the subTLV length correct? */
677411677aeSAaron LI                     if (lspping_subtlv_len != 5) {
678*ed775ee7SAntonio Huete Jimenez                         ND_PRINT("\n\t      invalid subTLV length, should be 5");
679411677aeSAaron LI                         subtlv_hexdump=TRUE; /* unknown subTLV just hexdump it */
680411677aeSAaron LI                     } else {
681*ed775ee7SAntonio Huete Jimenez                         subtlv_ptr.lspping_tlv_targetfec_subtlv_ldp_ipv4 =
68241c99275SPeter Avalos                             (const struct lspping_tlv_targetfec_subtlv_ldp_ipv4_t *)subtlv_tptr;
683*ed775ee7SAntonio Huete Jimenez                         ND_PRINT("\n\t      %s/%u",
684*ed775ee7SAntonio Huete Jimenez                                GET_IPADDR_STRING(subtlv_ptr.lspping_tlv_targetfec_subtlv_ldp_ipv4->prefix),
685*ed775ee7SAntonio Huete Jimenez                                GET_U_1(subtlv_ptr.lspping_tlv_targetfec_subtlv_ldp_ipv4->prefix_len));
686411677aeSAaron LI                     }
68741c99275SPeter Avalos                     break;
68841c99275SPeter Avalos 
68941c99275SPeter Avalos                 case LSPPING_TLV_TARGETFEC_SUBTLV_LDP_IPV6:
690411677aeSAaron LI                     /* Is the subTLV length correct? */
691411677aeSAaron LI                     if (lspping_subtlv_len != 17) {
692*ed775ee7SAntonio Huete Jimenez                         ND_PRINT("\n\t      invalid subTLV length, should be 17");
693411677aeSAaron LI                         subtlv_hexdump=TRUE; /* unknown subTLV just hexdump it */
694411677aeSAaron LI                     } else {
695*ed775ee7SAntonio Huete Jimenez                         subtlv_ptr.lspping_tlv_targetfec_subtlv_ldp_ipv6 =
69641c99275SPeter Avalos                             (const struct lspping_tlv_targetfec_subtlv_ldp_ipv6_t *)subtlv_tptr;
697*ed775ee7SAntonio Huete Jimenez                         ND_PRINT("\n\t      %s/%u",
698*ed775ee7SAntonio Huete Jimenez                                GET_IP6ADDR_STRING(subtlv_ptr.lspping_tlv_targetfec_subtlv_ldp_ipv6->prefix),
699*ed775ee7SAntonio Huete Jimenez                                GET_U_1(subtlv_ptr.lspping_tlv_targetfec_subtlv_ldp_ipv6->prefix_len));
700411677aeSAaron LI                     }
70141c99275SPeter Avalos                     break;
70241c99275SPeter Avalos 
70341c99275SPeter Avalos                 case LSPPING_TLV_TARGETFEC_SUBTLV_BGP_IPV4:
704411677aeSAaron LI                     /* Is the subTLV length correct? */
705411677aeSAaron LI                     if (lspping_subtlv_len != 5) {
706*ed775ee7SAntonio Huete Jimenez                         ND_PRINT("\n\t      invalid subTLV length, should be 5");
707411677aeSAaron LI                         subtlv_hexdump=TRUE; /* unknown subTLV just hexdump it */
708411677aeSAaron LI                     } else {
709*ed775ee7SAntonio Huete Jimenez                         subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv4 =
71041c99275SPeter Avalos                             (const struct lspping_tlv_targetfec_subtlv_bgp_ipv4_t *)subtlv_tptr;
711*ed775ee7SAntonio Huete Jimenez                         ND_PRINT("\n\t      %s/%u",
712*ed775ee7SAntonio Huete Jimenez                                GET_IPADDR_STRING(subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv4->prefix),
713*ed775ee7SAntonio Huete Jimenez                                GET_U_1(subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv4->prefix_len));
714411677aeSAaron LI                     }
71541c99275SPeter Avalos                     break;
71641c99275SPeter Avalos 
71741c99275SPeter Avalos                 case LSPPING_TLV_TARGETFEC_SUBTLV_BGP_IPV6:
718411677aeSAaron LI                     /* Is the subTLV length correct? */
719411677aeSAaron LI                     if (lspping_subtlv_len != 17) {
720*ed775ee7SAntonio Huete Jimenez                         ND_PRINT("\n\t      invalid subTLV length, should be 17");
721411677aeSAaron LI                         subtlv_hexdump=TRUE; /* unknown subTLV just hexdump it */
722411677aeSAaron LI                     } else {
723*ed775ee7SAntonio Huete Jimenez                         subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv6 =
72441c99275SPeter Avalos                             (const struct lspping_tlv_targetfec_subtlv_bgp_ipv6_t *)subtlv_tptr;
725*ed775ee7SAntonio Huete Jimenez                         ND_PRINT("\n\t      %s/%u",
726*ed775ee7SAntonio Huete Jimenez                                GET_IP6ADDR_STRING(subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv6->prefix),
727*ed775ee7SAntonio Huete Jimenez                                GET_U_1(subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv6->prefix_len));
728411677aeSAaron LI                     }
72941c99275SPeter Avalos                     break;
73041c99275SPeter Avalos 
73141c99275SPeter Avalos                 case LSPPING_TLV_TARGETFEC_SUBTLV_RSVP_IPV4:
732411677aeSAaron LI                     /* Is the subTLV length correct? */
733411677aeSAaron LI                     if (lspping_subtlv_len != 20) {
734*ed775ee7SAntonio Huete Jimenez                         ND_PRINT("\n\t      invalid subTLV length, should be 20");
735411677aeSAaron LI                         subtlv_hexdump=TRUE; /* unknown subTLV just hexdump it */
736411677aeSAaron LI                     } else {
737*ed775ee7SAntonio Huete Jimenez                         subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4 =
73841c99275SPeter Avalos                             (const struct lspping_tlv_targetfec_subtlv_rsvp_ipv4_t *)subtlv_tptr;
739*ed775ee7SAntonio Huete Jimenez                         ND_PRINT("\n\t      tunnel end-point %s, tunnel sender %s, lsp-id 0x%04x"
74041c99275SPeter Avalos                                "\n\t      tunnel-id 0x%04x, extended tunnel-id %s",
741*ed775ee7SAntonio Huete Jimenez                                GET_IPADDR_STRING(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->tunnel_endpoint),
742*ed775ee7SAntonio Huete Jimenez                                GET_IPADDR_STRING(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->tunnel_sender),
743*ed775ee7SAntonio Huete Jimenez                                GET_BE_U_2(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->lsp_id),
744*ed775ee7SAntonio Huete Jimenez                                GET_BE_U_2(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->tunnel_id),
745*ed775ee7SAntonio Huete Jimenez                                GET_IPADDR_STRING(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->extended_tunnel_id));
746411677aeSAaron LI                     }
74741c99275SPeter Avalos                     break;
74841c99275SPeter Avalos 
74941c99275SPeter Avalos                 case LSPPING_TLV_TARGETFEC_SUBTLV_RSVP_IPV6:
750411677aeSAaron LI                     /* Is the subTLV length correct? */
751411677aeSAaron LI                     if (lspping_subtlv_len != 56) {
752*ed775ee7SAntonio Huete Jimenez                         ND_PRINT("\n\t      invalid subTLV length, should be 56");
753411677aeSAaron LI                         subtlv_hexdump=TRUE; /* unknown subTLV just hexdump it */
754411677aeSAaron LI                     } else {
755*ed775ee7SAntonio Huete Jimenez                         subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6 =
75641c99275SPeter Avalos                             (const struct lspping_tlv_targetfec_subtlv_rsvp_ipv6_t *)subtlv_tptr;
757*ed775ee7SAntonio Huete Jimenez                         ND_PRINT("\n\t      tunnel end-point %s, tunnel sender %s, lsp-id 0x%04x"
75841c99275SPeter Avalos                                "\n\t      tunnel-id 0x%04x, extended tunnel-id %s",
759*ed775ee7SAntonio Huete Jimenez                                GET_IP6ADDR_STRING(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->tunnel_endpoint),
760*ed775ee7SAntonio Huete Jimenez                                GET_IP6ADDR_STRING(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->tunnel_sender),
761*ed775ee7SAntonio Huete Jimenez                                GET_BE_U_2(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->lsp_id),
762*ed775ee7SAntonio Huete Jimenez                                GET_BE_U_2(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->tunnel_id),
763*ed775ee7SAntonio Huete Jimenez                                GET_IP6ADDR_STRING(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->extended_tunnel_id));
764411677aeSAaron LI                     }
76541c99275SPeter Avalos                     break;
76641c99275SPeter Avalos 
76741c99275SPeter Avalos                 case LSPPING_TLV_TARGETFEC_SUBTLV_L3VPN_IPV4:
768411677aeSAaron LI                     /* Is the subTLV length correct? */
769411677aeSAaron LI                     if (lspping_subtlv_len != 13) {
770*ed775ee7SAntonio Huete Jimenez                         ND_PRINT("\n\t      invalid subTLV length, should be 13");
771411677aeSAaron LI                         subtlv_hexdump=TRUE; /* unknown subTLV just hexdump it */
772411677aeSAaron LI                     } else {
773*ed775ee7SAntonio Huete Jimenez                         subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv4 =
77441c99275SPeter Avalos                             (const struct lspping_tlv_targetfec_subtlv_l3vpn_ipv4_t *)subtlv_tptr;
775*ed775ee7SAntonio Huete Jimenez                         ND_PRINT("\n\t      RD: %s, %s/%u",
776411677aeSAaron LI                                bgp_vpn_rd_print(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv4->rd),
777*ed775ee7SAntonio Huete Jimenez                                GET_IPADDR_STRING(subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv4->prefix),
778*ed775ee7SAntonio Huete Jimenez                                GET_U_1(subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv4->prefix_len));
779411677aeSAaron LI                     }
78041c99275SPeter Avalos                     break;
78141c99275SPeter Avalos 
78241c99275SPeter Avalos                 case LSPPING_TLV_TARGETFEC_SUBTLV_L3VPN_IPV6:
783411677aeSAaron LI                     /* Is the subTLV length correct? */
784411677aeSAaron LI                     if (lspping_subtlv_len != 25) {
785*ed775ee7SAntonio Huete Jimenez                         ND_PRINT("\n\t      invalid subTLV length, should be 25");
786411677aeSAaron LI                         subtlv_hexdump=TRUE; /* unknown subTLV just hexdump it */
787411677aeSAaron LI                     } else {
788*ed775ee7SAntonio Huete Jimenez                         subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv6 =
78941c99275SPeter Avalos                             (const struct lspping_tlv_targetfec_subtlv_l3vpn_ipv6_t *)subtlv_tptr;
790*ed775ee7SAntonio Huete Jimenez                         ND_PRINT("\n\t      RD: %s, %s/%u",
791411677aeSAaron LI                                bgp_vpn_rd_print(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv6->rd),
792*ed775ee7SAntonio Huete Jimenez                                GET_IP6ADDR_STRING(subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv6->prefix),
793*ed775ee7SAntonio Huete Jimenez                                GET_U_1(subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv6->prefix_len));
794411677aeSAaron LI                     }
79541c99275SPeter Avalos                     break;
79641c99275SPeter Avalos 
79741c99275SPeter Avalos                 case LSPPING_TLV_TARGETFEC_SUBTLV_L2VPN_ENDPT:
798411677aeSAaron LI                     /* Is the subTLV length correct? */
799411677aeSAaron LI                     if (lspping_subtlv_len != 14) {
800*ed775ee7SAntonio Huete Jimenez                         ND_PRINT("\n\t      invalid subTLV length, should be 14");
801411677aeSAaron LI                         subtlv_hexdump=TRUE; /* unknown subTLV just hexdump it */
802411677aeSAaron LI                     } else {
803*ed775ee7SAntonio Huete Jimenez                         subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt =
80441c99275SPeter Avalos                             (const struct lspping_tlv_targetfec_subtlv_l2vpn_endpt_t *)subtlv_tptr;
805*ed775ee7SAntonio Huete Jimenez                         ND_PRINT("\n\t      RD: %s, Sender VE ID: %u, Receiver VE ID: %u"
80641c99275SPeter Avalos                                "\n\t      Encapsulation Type: %s (%u)",
807411677aeSAaron LI                                bgp_vpn_rd_print(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->rd),
808*ed775ee7SAntonio Huete Jimenez                                GET_BE_U_2(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->sender_ve_id),
809*ed775ee7SAntonio Huete Jimenez                                GET_BE_U_2(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->receiver_ve_id),
810411677aeSAaron LI                                tok2str(mpls_pw_types_values,
81141c99275SPeter Avalos                                        "unknown",
812*ed775ee7SAntonio Huete Jimenez                                        GET_BE_U_2(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->encapsulation)),
813*ed775ee7SAntonio Huete Jimenez                                GET_BE_U_2(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->encapsulation));
814411677aeSAaron LI                     }
81541c99275SPeter Avalos                     break;
81641c99275SPeter Avalos 
81741c99275SPeter Avalos                     /* the old L2VPN VCID subTLV does not have support for the sender field */
818411677aeSAaron LI                 case LSPPING_TLV_TARGETFEC_SUBTLV_FEC_128_PW_OLD:
819411677aeSAaron LI                     /* Is the subTLV length correct? */
820411677aeSAaron LI                     if (lspping_subtlv_len != 10) {
821*ed775ee7SAntonio Huete Jimenez                         ND_PRINT("\n\t      invalid subTLV length, should be 10");
822411677aeSAaron LI                         subtlv_hexdump=TRUE; /* unknown subTLV just hexdump it */
823411677aeSAaron LI                     } else {
824*ed775ee7SAntonio Huete Jimenez                         subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old =
825411677aeSAaron LI                             (const struct lspping_tlv_targetfec_subtlv_fec_128_pw_old *)subtlv_tptr;
826*ed775ee7SAntonio Huete Jimenez                         ND_PRINT("\n\t      Remote PE: %s"
827411677aeSAaron LI                                "\n\t      PW ID: 0x%08x, PW Type: %s (%u)",
828*ed775ee7SAntonio Huete Jimenez                                GET_IPADDR_STRING(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old->remote_pe_address),
829*ed775ee7SAntonio Huete Jimenez                                GET_BE_U_4(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old->pw_id),
830411677aeSAaron LI                                tok2str(mpls_pw_types_values,
83141c99275SPeter Avalos                                        "unknown",
832*ed775ee7SAntonio Huete Jimenez                                        GET_BE_U_2(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old->pw_type)),
833*ed775ee7SAntonio Huete Jimenez                                GET_BE_U_2(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old->pw_type));
834411677aeSAaron LI                     }
83541c99275SPeter Avalos                     break;
83641c99275SPeter Avalos 
837411677aeSAaron LI                 case LSPPING_TLV_TARGETFEC_SUBTLV_FEC_128_PW:
838411677aeSAaron LI                     /* Is the subTLV length correct? */
839411677aeSAaron LI                     if (lspping_subtlv_len != 14) {
840*ed775ee7SAntonio Huete Jimenez                         ND_PRINT("\n\t      invalid subTLV length, should be 14");
841411677aeSAaron LI                         subtlv_hexdump=TRUE; /* unknown subTLV just hexdump it */
842411677aeSAaron LI                     } else {
843*ed775ee7SAntonio Huete Jimenez                         subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid =
844411677aeSAaron LI                             (const struct lspping_tlv_targetfec_subtlv_fec_128_pw *)subtlv_tptr;
845*ed775ee7SAntonio Huete Jimenez                         ND_PRINT("\n\t      Sender PE: %s, Remote PE: %s"
846411677aeSAaron LI                                "\n\t      PW ID: 0x%08x, PW Type: %s (%u)",
847*ed775ee7SAntonio Huete Jimenez                                GET_IPADDR_STRING(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->sender_pe_address),
848*ed775ee7SAntonio Huete Jimenez                                GET_IPADDR_STRING(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->remote_pe_address),
849*ed775ee7SAntonio Huete Jimenez                                GET_BE_U_4(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->pw_id),
850411677aeSAaron LI                                tok2str(mpls_pw_types_values,
85141c99275SPeter Avalos                                        "unknown",
852*ed775ee7SAntonio Huete Jimenez                                        GET_BE_U_2(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->pw_type)),
853*ed775ee7SAntonio Huete Jimenez                                GET_BE_U_2(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->pw_type));
854411677aeSAaron LI                     }
85541c99275SPeter Avalos                     break;
85641c99275SPeter Avalos 
85741c99275SPeter Avalos                 default:
85841c99275SPeter Avalos                     subtlv_hexdump=TRUE; /* unknown subTLV just hexdump it */
85941c99275SPeter Avalos                     break;
86041c99275SPeter Avalos                 }
86141c99275SPeter Avalos                 /* do we want to see an additionally subtlv hexdump ? */
862411677aeSAaron LI                 if (ndo->ndo_vflag > 1 || subtlv_hexdump==TRUE)
863*ed775ee7SAntonio Huete Jimenez                     print_unknown_data(ndo, tlv_tptr+sizeof(struct lspping_tlv_header),
86441c99275SPeter Avalos                                        "\n\t      ",
86541c99275SPeter Avalos                                        lspping_subtlv_len);
86641c99275SPeter Avalos 
867411677aeSAaron LI                 /* All subTLVs are aligned to four octet boundary */
868411677aeSAaron LI                 if (lspping_subtlv_len % 4) {
869411677aeSAaron LI                     lspping_subtlv_len += 4 - (lspping_subtlv_len % 4);
870411677aeSAaron LI                     /* Does the subTLV, including padding, go past the end of the TLV? */
871411677aeSAaron LI                     if (tlv_tlen < lspping_subtlv_len+sizeof(struct lspping_tlv_header)) {
872*ed775ee7SAntonio Huete Jimenez                         ND_PRINT("\n\t\t TLV is too short");
873411677aeSAaron LI                         return;
874411677aeSAaron LI                     }
875411677aeSAaron LI                 }
87641c99275SPeter Avalos                 tlv_tptr+=lspping_subtlv_len;
87741c99275SPeter Avalos                 tlv_tlen-=lspping_subtlv_len+sizeof(struct lspping_tlv_header);
87841c99275SPeter Avalos             }
87941c99275SPeter Avalos             break;
88041c99275SPeter Avalos 
88141c99275SPeter Avalos         case LSPPING_TLV_DOWNSTREAM_MAPPING:
882411677aeSAaron LI             /* Does the header go past the end of the TLV? */
883411677aeSAaron LI             if (tlv_tlen < sizeof(struct lspping_tlv_downstream_map_t)) {
884*ed775ee7SAntonio Huete Jimenez                 ND_PRINT("\n\t      TLV is too short");
885411677aeSAaron LI                 tlv_hexdump = TRUE;
886411677aeSAaron LI                 goto tlv_tooshort;
887411677aeSAaron LI             }
888411677aeSAaron LI             /* Did we capture enough to get the address family? */
889*ed775ee7SAntonio Huete Jimenez             ND_TCHECK_LEN(tlv_tptr,
890*ed775ee7SAntonio Huete Jimenez                           sizeof(struct lspping_tlv_downstream_map_t));
891411677aeSAaron LI 
892*ed775ee7SAntonio Huete Jimenez             tlv_ptr.lspping_tlv_downstream_map=
893411677aeSAaron LI                 (const struct lspping_tlv_downstream_map_t *)tlv_tptr;
894411677aeSAaron LI 
89541c99275SPeter Avalos             /* that strange thing with the downstream map TLV is that until now
896411677aeSAaron LI              * we do not know if its IPv4 or IPv6 or is unnumbered; after
897411677aeSAaron LI              * we find the address-type, we recast the tlv_tptr and move on. */
898411677aeSAaron LI 
899*ed775ee7SAntonio Huete Jimenez             address_type = GET_U_1(tlv_ptr.lspping_tlv_downstream_map->address_type);
900*ed775ee7SAntonio Huete Jimenez             ND_PRINT("\n\t    MTU: %u, Address-Type: %s (%u)",
901*ed775ee7SAntonio Huete Jimenez                    GET_BE_U_2(tlv_ptr.lspping_tlv_downstream_map->mtu),
902411677aeSAaron LI                    tok2str(lspping_tlv_downstream_addr_values,
903411677aeSAaron LI                            "unknown",
904*ed775ee7SAntonio Huete Jimenez                            address_type),
905*ed775ee7SAntonio Huete Jimenez                    address_type);
906411677aeSAaron LI 
907*ed775ee7SAntonio Huete Jimenez             switch(address_type) {
908411677aeSAaron LI 
909411677aeSAaron LI             case LSPPING_AFI_IPV4:
910411677aeSAaron LI                 /* Does the data go past the end of the TLV? */
911411677aeSAaron LI                 if (tlv_tlen < sizeof(struct lspping_tlv_downstream_map_ipv4_t)) {
912*ed775ee7SAntonio Huete Jimenez                     ND_PRINT("\n\t      TLV is too short");
913411677aeSAaron LI                     tlv_hexdump = TRUE;
914411677aeSAaron LI                     goto tlv_tooshort;
915411677aeSAaron LI                 }
916411677aeSAaron LI                 /* Did we capture enough for this part of the TLV? */
917*ed775ee7SAntonio Huete Jimenez                 ND_TCHECK_LEN(tlv_tptr,
918*ed775ee7SAntonio Huete Jimenez                               sizeof(struct lspping_tlv_downstream_map_ipv4_t));
91941c99275SPeter Avalos 
920*ed775ee7SAntonio Huete Jimenez                 tlv_ptr.lspping_tlv_downstream_map_ipv4=
92141c99275SPeter Avalos                     (const struct lspping_tlv_downstream_map_ipv4_t *)tlv_tptr;
922*ed775ee7SAntonio Huete Jimenez                 ND_PRINT("\n\t    Downstream IP: %s"
92341c99275SPeter Avalos                        "\n\t    Downstream Interface IP: %s",
924*ed775ee7SAntonio Huete Jimenez                        GET_IPADDR_STRING(tlv_ptr.lspping_tlv_downstream_map_ipv4->downstream_ip),
925*ed775ee7SAntonio Huete Jimenez                        GET_IPADDR_STRING(tlv_ptr.lspping_tlv_downstream_map_ipv4->downstream_interface));
92641c99275SPeter Avalos                 tlv_tptr+=sizeof(struct lspping_tlv_downstream_map_ipv4_t);
92741c99275SPeter Avalos                 tlv_tlen-=sizeof(struct lspping_tlv_downstream_map_ipv4_t);
92841c99275SPeter Avalos                 break;
929411677aeSAaron LI             case LSPPING_AFI_IPV4_UNMB:
930411677aeSAaron LI                 /* Does the data go past the end of the TLV? */
931411677aeSAaron LI                 if (tlv_tlen < sizeof(struct lspping_tlv_downstream_map_ipv4_unmb_t)) {
932*ed775ee7SAntonio Huete Jimenez                     ND_PRINT("\n\t      TLV is too short");
933411677aeSAaron LI                     tlv_hexdump = TRUE;
934411677aeSAaron LI                     goto tlv_tooshort;
935411677aeSAaron LI                 }
936411677aeSAaron LI                 /* Did we capture enough for this part of the TLV? */
937*ed775ee7SAntonio Huete Jimenez                 ND_TCHECK_LEN(tlv_tptr,
938*ed775ee7SAntonio Huete Jimenez                               sizeof(struct lspping_tlv_downstream_map_ipv4_unmb_t));
939411677aeSAaron LI 
940*ed775ee7SAntonio Huete Jimenez                 tlv_ptr.lspping_tlv_downstream_map_ipv4_unmb=
941411677aeSAaron LI                     (const struct lspping_tlv_downstream_map_ipv4_unmb_t *)tlv_tptr;
942*ed775ee7SAntonio Huete Jimenez                 ND_PRINT("\n\t    Downstream IP: %s"
943411677aeSAaron LI                        "\n\t    Downstream Interface Index: 0x%08x",
944*ed775ee7SAntonio Huete Jimenez                        GET_IPADDR_STRING(tlv_ptr.lspping_tlv_downstream_map_ipv4_unmb->downstream_ip),
945*ed775ee7SAntonio Huete Jimenez                        GET_BE_U_4(tlv_ptr.lspping_tlv_downstream_map_ipv4_unmb->downstream_interface));
946411677aeSAaron LI                 tlv_tptr+=sizeof(struct lspping_tlv_downstream_map_ipv4_unmb_t);
947411677aeSAaron LI                 tlv_tlen-=sizeof(struct lspping_tlv_downstream_map_ipv4_unmb_t);
948411677aeSAaron LI                 break;
94941c99275SPeter Avalos             case LSPPING_AFI_IPV6:
950411677aeSAaron LI                 /* Does the data go past the end of the TLV? */
951411677aeSAaron LI                 if (tlv_tlen < sizeof(struct lspping_tlv_downstream_map_ipv6_t)) {
952*ed775ee7SAntonio Huete Jimenez                     ND_PRINT("\n\t      TLV is too short");
953411677aeSAaron LI                     tlv_hexdump = TRUE;
954411677aeSAaron LI                     goto tlv_tooshort;
955411677aeSAaron LI                 }
956411677aeSAaron LI                 /* Did we capture enough for this part of the TLV? */
957*ed775ee7SAntonio Huete Jimenez                 ND_TCHECK_LEN(tlv_tptr,
958*ed775ee7SAntonio Huete Jimenez                               sizeof(struct lspping_tlv_downstream_map_ipv6_t));
959411677aeSAaron LI 
960*ed775ee7SAntonio Huete Jimenez                 tlv_ptr.lspping_tlv_downstream_map_ipv6=
961411677aeSAaron LI                     (const struct lspping_tlv_downstream_map_ipv6_t *)tlv_tptr;
962*ed775ee7SAntonio Huete Jimenez                 ND_PRINT("\n\t    Downstream IP: %s"
96341c99275SPeter Avalos                        "\n\t    Downstream Interface IP: %s",
964*ed775ee7SAntonio Huete Jimenez                        GET_IP6ADDR_STRING(tlv_ptr.lspping_tlv_downstream_map_ipv6->downstream_ip),
965*ed775ee7SAntonio Huete Jimenez                        GET_IP6ADDR_STRING(tlv_ptr.lspping_tlv_downstream_map_ipv6->downstream_interface));
96641c99275SPeter Avalos                 tlv_tptr+=sizeof(struct lspping_tlv_downstream_map_ipv6_t);
96741c99275SPeter Avalos                 tlv_tlen-=sizeof(struct lspping_tlv_downstream_map_ipv6_t);
96841c99275SPeter Avalos                 break;
969411677aeSAaron LI              case LSPPING_AFI_IPV6_UNMB:
970411677aeSAaron LI                 /* Does the data go past the end of the TLV? */
971411677aeSAaron LI                 if (tlv_tlen < sizeof(struct lspping_tlv_downstream_map_ipv6_unmb_t)) {
972*ed775ee7SAntonio Huete Jimenez                     ND_PRINT("\n\t      TLV is too short");
973411677aeSAaron LI                     tlv_hexdump = TRUE;
974411677aeSAaron LI                     goto tlv_tooshort;
975411677aeSAaron LI                 }
976411677aeSAaron LI                 /* Did we capture enough for this part of the TLV? */
977*ed775ee7SAntonio Huete Jimenez                 ND_TCHECK_LEN(tlv_tptr,
978*ed775ee7SAntonio Huete Jimenez                               sizeof(struct lspping_tlv_downstream_map_ipv6_unmb_t));
979411677aeSAaron LI 
980*ed775ee7SAntonio Huete Jimenez                 tlv_ptr.lspping_tlv_downstream_map_ipv6_unmb=
981411677aeSAaron LI                    (const struct lspping_tlv_downstream_map_ipv6_unmb_t *)tlv_tptr;
982*ed775ee7SAntonio Huete Jimenez                 ND_PRINT("\n\t    Downstream IP: %s"
98341c99275SPeter Avalos                        "\n\t    Downstream Interface Index: 0x%08x",
984*ed775ee7SAntonio Huete Jimenez                        GET_IP6ADDR_STRING(tlv_ptr.lspping_tlv_downstream_map_ipv6_unmb->downstream_ip),
985*ed775ee7SAntonio Huete Jimenez                        GET_BE_U_4(tlv_ptr.lspping_tlv_downstream_map_ipv6_unmb->downstream_interface));
986411677aeSAaron LI                 tlv_tptr+=sizeof(struct lspping_tlv_downstream_map_ipv6_unmb_t);
987411677aeSAaron LI                 tlv_tlen-=sizeof(struct lspping_tlv_downstream_map_ipv6_unmb_t);
98841c99275SPeter Avalos                 break;
98941c99275SPeter Avalos 
99041c99275SPeter Avalos             default:
99141c99275SPeter Avalos                 /* should not happen ! - no error message - tok2str() has barked already */
99241c99275SPeter Avalos                 break;
99341c99275SPeter Avalos             }
99441c99275SPeter Avalos 
995411677aeSAaron LI             /* Does the data go past the end of the TLV? */
996411677aeSAaron LI             if (tlv_tlen < sizeof(struct lspping_tlv_downstream_map_info_t)) {
997*ed775ee7SAntonio Huete Jimenez                 ND_PRINT("\n\t      TLV is too short");
998411677aeSAaron LI                 tlv_hexdump = TRUE;
999411677aeSAaron LI                 goto tlv_tooshort;
1000411677aeSAaron LI             }
1001411677aeSAaron LI             /* Did we capture enough for this part of the TLV? */
1002*ed775ee7SAntonio Huete Jimenez             ND_TCHECK_LEN(tlv_tptr,
1003*ed775ee7SAntonio Huete Jimenez                           sizeof(struct lspping_tlv_downstream_map_info_t));
1004411677aeSAaron LI 
1005*ed775ee7SAntonio Huete Jimenez             tlv_ptr.lspping_tlv_downstream_map_info=
100641c99275SPeter Avalos                 (const struct lspping_tlv_downstream_map_info_t *)tlv_tptr;
100741c99275SPeter Avalos 
100841c99275SPeter Avalos             /* FIXME add hash-key type, depth limit, multipath processing */
100941c99275SPeter Avalos 
101041c99275SPeter Avalos             tlv_tptr+=sizeof(struct lspping_tlv_downstream_map_info_t);
101141c99275SPeter Avalos             tlv_tlen-=sizeof(struct lspping_tlv_downstream_map_info_t);
101241c99275SPeter Avalos 
101341c99275SPeter Avalos             /* FIXME print downstream labels */
101441c99275SPeter Avalos 
101541c99275SPeter Avalos             tlv_hexdump=TRUE; /* dump the TLV until code complete */
101641c99275SPeter Avalos 
101741c99275SPeter Avalos             break;
101841c99275SPeter Avalos 
101941c99275SPeter Avalos         case LSPPING_TLV_BFD_DISCRIMINATOR:
1020411677aeSAaron LI             if (tlv_tlen < LSPPING_TLV_BFD_DISCRIMINATOR_LEN) {
1021*ed775ee7SAntonio Huete Jimenez                 ND_PRINT("\n\t      TLV is too short");
1022411677aeSAaron LI                 tlv_hexdump = TRUE;
1023411677aeSAaron LI                 goto tlv_tooshort;
1024411677aeSAaron LI             } else {
1025*ed775ee7SAntonio Huete Jimenez                 ND_PRINT("\n\t    BFD Discriminator 0x%08x", GET_BE_U_4(tlv_tptr));
1026411677aeSAaron LI             }
102741c99275SPeter Avalos             break;
102827bfbee1SPeter Avalos 
102927bfbee1SPeter Avalos         case  LSPPING_TLV_VENDOR_ENTERPRISE:
103027bfbee1SPeter Avalos         {
1031411677aeSAaron LI             uint32_t vendor_id;
103227bfbee1SPeter Avalos 
1033411677aeSAaron LI             if (tlv_tlen < LSPPING_TLV_VENDOR_ENTERPRISE_LEN) {
1034*ed775ee7SAntonio Huete Jimenez                 ND_PRINT("\n\t      TLV is too short");
1035411677aeSAaron LI                 tlv_hexdump = TRUE;
1036411677aeSAaron LI                 goto tlv_tooshort;
1037411677aeSAaron LI             } else {
1038*ed775ee7SAntonio Huete Jimenez                 vendor_id = GET_BE_U_4(tlv_tptr);
1039*ed775ee7SAntonio Huete Jimenez                 ND_PRINT("\n\t    Vendor: %s (0x%04x)",
104027bfbee1SPeter Avalos                        tok2str(smi_values, "Unknown", vendor_id),
1041*ed775ee7SAntonio Huete Jimenez                        vendor_id);
1042411677aeSAaron LI             }
104327bfbee1SPeter Avalos         }
104427bfbee1SPeter Avalos             break;
104527bfbee1SPeter Avalos 
104641c99275SPeter Avalos             /*
104741c99275SPeter Avalos              *  FIXME those are the defined TLVs that lack a decoder
104841c99275SPeter Avalos              *  you are welcome to contribute code ;-)
104941c99275SPeter Avalos              */
105041c99275SPeter Avalos         case LSPPING_TLV_PAD:
105141c99275SPeter Avalos         case LSPPING_TLV_ERROR_CODE:
105241c99275SPeter Avalos         case LSPPING_TLV_VENDOR_PRIVATE:
105341c99275SPeter Avalos 
105441c99275SPeter Avalos         default:
1055411677aeSAaron LI             if (ndo->ndo_vflag <= 1)
1056411677aeSAaron LI                 print_unknown_data(ndo, tlv_tptr, "\n\t    ", tlv_tlen);
105741c99275SPeter Avalos             break;
105841c99275SPeter Avalos         }
105941c99275SPeter Avalos         /* do we want to see an additionally tlv hexdump ? */
1060411677aeSAaron LI     tlv_tooshort:
1061411677aeSAaron LI         if (ndo->ndo_vflag > 1 || tlv_hexdump==TRUE)
1062411677aeSAaron LI             print_unknown_data(ndo, tptr+sizeof(struct lspping_tlv_header), "\n\t    ",
106341c99275SPeter Avalos                                lspping_tlv_len);
106441c99275SPeter Avalos 
1065ea7b4bf5SPeter Avalos 
1066ea7b4bf5SPeter Avalos         /* All TLVs are aligned to four octet boundary */
1067ea7b4bf5SPeter Avalos         if (lspping_tlv_len % 4) {
1068ea7b4bf5SPeter Avalos             lspping_tlv_len += (4 - lspping_tlv_len % 4);
1069411677aeSAaron LI             /* Does the TLV, including padding, go past the end of the packet? */
1070411677aeSAaron LI             if (tlen < lspping_tlv_len+sizeof(struct lspping_tlv_header))
1071411677aeSAaron LI                 goto tooshort;
1072ea7b4bf5SPeter Avalos         }
1073ea7b4bf5SPeter Avalos 
107441c99275SPeter Avalos         tptr+=lspping_tlv_len+sizeof(struct lspping_tlv_header);
107541c99275SPeter Avalos         tlen-=lspping_tlv_len+sizeof(struct lspping_tlv_header);
107641c99275SPeter Avalos     }
107741c99275SPeter Avalos     return;
1078411677aeSAaron LI tooshort:
1079*ed775ee7SAntonio Huete Jimenez     ND_PRINT("\n\t\t packet is too short");
108041c99275SPeter Avalos }
1081