Actually hook powernow.4 into the build.
[dragonfly.git] / contrib / tcpdump / print-lspping.c
blobf47a9004859caad180422065148248600b961a46
1 /*
2 * Redistribution and use in source and binary forms, with or without
3 * modification, are permitted provided that: (1) source code
4 * distributions retain the above copyright notice and this paragraph
5 * in its entirety, and (2) distributions including binary code include
6 * the above copyright notice and this paragraph in its entirety in
7 * the documentation or other materials provided with the distribution.
8 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND
9 * WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
10 * LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
11 * FOR A PARTICULAR PURPOSE.
13 * Original code by Hannes Gredler (hannes@juniper.net)
16 #ifndef lint
17 static const char rcsid[] _U_ =
18 "@(#) $Header: /tcpdump/master/tcpdump/print-lspping.c,v 1.18.2.1 2008-01-28 13:48:16 hannes Exp $";
19 #endif
21 #ifdef HAVE_CONFIG_H
22 #include "config.h"
23 #endif
25 #include <tcpdump-stdinc.h>
27 #include <stdio.h>
28 #include <stdlib.h>
29 #include <string.h>
31 #include "interface.h"
32 #include "extract.h"
33 #include "addrtoname.h"
35 #include "bgp.h"
36 #include "l2vpn.h"
39 * LSPPING common header
41 * 0 1 2 3
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 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
48 * | Sender's Handle |
49 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
50 * | Sequence Number |
51 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
52 * | TimeStamp Sent (seconds) |
53 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
54 * | TimeStamp Sent (microseconds) |
55 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
56 * | TimeStamp Received (seconds) |
57 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
58 * | TimeStamp Received (microseconds) |
59 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
60 * | TLVs ... |
61 * . .
62 * . .
63 * . .
66 struct lspping_common_header {
67 u_int8_t version[2];
68 u_int8_t reserved[2];
69 u_int8_t msg_type;
70 u_int8_t reply_mode;
71 u_int8_t return_code;
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
83 static const struct tok lspping_msg_type_values[] = {
84 { 1, "MPLS Echo Request"},
85 { 2, "MPLS Echo Reply"},
86 { 0, NULL}
89 static const struct tok lspping_reply_mode_values[] = {
90 { 1, "Do not reply"},
91 { 2, "Reply via an IPv4/IPv6 UDP packet"},
92 { 3, "Reply via an IPv4/IPv6 UDP packet with Router Alert"},
93 { 4, "Reply via application level control channel"},
94 { 0, NULL}
97 static const struct tok lspping_return_code_values[] = {
98 { 0, "No return code or return code contained in the Error Code TLV"},
99 { 1, "Malformed echo request received"},
100 { 2, "One or more of the TLVs was not understood"},
101 { 3, "Replying router is an egress for the FEC at stack depth"},
102 { 4, "Replying router has no mapping for the FEC at stack depth"},
103 { 5, "Reserved"},
104 { 6, "Reserved"},
105 { 7, "Reserved"},
106 { 8, "Label switched at stack-depth"},
107 { 9, "Label switched but no MPLS forwarding at stack-depth"},
108 { 10, "Mapping for this FEC is not the given label at stack depth"},
109 { 11, "No label entry at stack-depth"},
110 { 12, "Protocol not associated with interface at FEC stack depth"},
115 * LSPPING TLV header
116 * 0 1 2 3
117 * 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
118 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
119 * | Type | Length |
120 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
121 * | Value |
122 * . .
123 * . .
124 * . .
125 * | |
126 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
129 struct lspping_tlv_header {
130 u_int8_t type[2];
131 u_int8_t length[2];
134 #define LSPPING_TLV_TARGET_FEC_STACK 1
135 #define LSPPING_TLV_DOWNSTREAM_MAPPING 2
136 #define LSPPING_TLV_PAD 3
137 #define LSPPING_TLV_ERROR_CODE 4
138 #define LSPPING_TLV_BFD_DISCRIMINATOR 15 /* draft-ietf-bfd-mpls-02 */
139 #define LSPPING_TLV_BFD_DISCRIMINATOR_LEN 4
140 #define LSPPING_TLV_VENDOR_PRIVATE 0xfc00
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_BFD_DISCRIMINATOR, "BFD Discriminator" },
148 { LSPPING_TLV_VENDOR_PRIVATE, "Vendor Enterprise Code" },
149 { 0, NULL}
152 #define LSPPING_TLV_TARGETFEC_SUBTLV_LDP_IPV4 1
153 #define LSPPING_TLV_TARGETFEC_SUBTLV_LDP_IPV6 2
154 #define LSPPING_TLV_TARGETFEC_SUBTLV_RSVP_IPV4 3
155 #define LSPPING_TLV_TARGETFEC_SUBTLV_RSVP_IPV6 4
156 #define LSPPING_TLV_TARGETFEC_SUBTLV_L3VPN_IPV4 6
157 #define LSPPING_TLV_TARGETFEC_SUBTLV_L3VPN_IPV6 7
158 #define LSPPING_TLV_TARGETFEC_SUBTLV_L2VPN_ENDPT 8
159 #define LSPPING_TLV_TARGETFEC_SUBTLV_L2VPN_VCID_OLD 9
160 #define LSPPING_TLV_TARGETFEC_SUBTLV_L2VPN_VCID 10
161 #define LSPPING_TLV_TARGETFEC_SUBTLV_BGP_IPV4 11
162 #define LSPPING_TLV_TARGETFEC_SUBTLV_BGP_IPV6 12
164 static const struct tok lspping_tlvtargetfec_subtlv_values[] = {
165 { LSPPING_TLV_TARGETFEC_SUBTLV_LDP_IPV4, "LDP IPv4 prefix"},
166 { LSPPING_TLV_TARGETFEC_SUBTLV_LDP_IPV6, "LDP IPv6 prefix"},
167 { LSPPING_TLV_TARGETFEC_SUBTLV_RSVP_IPV4, "RSVP IPv4 Session Query"},
168 { LSPPING_TLV_TARGETFEC_SUBTLV_RSVP_IPV6, "RSVP IPv6 Session Query"},
169 { 5, "Reserved"},
170 { LSPPING_TLV_TARGETFEC_SUBTLV_L3VPN_IPV4, "VPN IPv4 prefix"},
171 { LSPPING_TLV_TARGETFEC_SUBTLV_L3VPN_IPV6, "VPN IPv6 prefix"},
172 { LSPPING_TLV_TARGETFEC_SUBTLV_L2VPN_ENDPT, "L2 VPN endpoint"},
173 { LSPPING_TLV_TARGETFEC_SUBTLV_L2VPN_VCID_OLD, "L2 circuit ID (old)"},
174 { LSPPING_TLV_TARGETFEC_SUBTLV_L2VPN_VCID, "L2 circuit ID"},
175 { LSPPING_TLV_TARGETFEC_SUBTLV_BGP_IPV4, "BGP labeled IPv4 prefix"},
176 { LSPPING_TLV_TARGETFEC_SUBTLV_BGP_IPV6, "BGP labeled IPv6 prefix"},
177 { 0, NULL}
181 * 0 1 2 3
182 * 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
183 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
184 * | IPv4 prefix |
185 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
186 * | Prefix Length | Must Be Zero |
187 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
189 struct lspping_tlv_targetfec_subtlv_ldp_ipv4_t {
190 u_int8_t prefix [4];
191 u_int8_t prefix_len;
195 * 0 1 2 3
196 * 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
197 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
198 * | IPv6 prefix |
199 * | (16 octets) |
200 * | |
201 * | |
202 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
203 * | Prefix Length | Must Be Zero |
204 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
206 struct lspping_tlv_targetfec_subtlv_ldp_ipv6_t {
207 u_int8_t prefix [16];
208 u_int8_t prefix_len;
212 * 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
213 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
214 * | Sender identifier |
215 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
216 * | IPv4 prefix |
217 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
218 * | Prefix Length | Must Be Zero |
219 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
221 struct lspping_tlv_targetfec_subtlv_bgp_ipv4_t {
222 u_int8_t sender_id [4];
223 u_int8_t prefix [4];
224 u_int8_t prefix_len;
228 * 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
229 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
230 * | Sender identifier |
231 * | (16 octets) |
232 * | |
233 * | |
234 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
235 * | IPv6 prefix |
236 * | (16 octets) |
237 * | |
238 * | |
239 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
240 * | Prefix Length | Must Be Zero |
241 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
243 struct lspping_tlv_targetfec_subtlv_bgp_ipv6_t {
244 u_int8_t sender_id [16];
245 u_int8_t prefix [16];
246 u_int8_t prefix_len;
250 * 0 1 2 3
251 * 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
252 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
253 * | IPv4 tunnel end point address |
254 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
255 * | Must Be Zero | Tunnel ID |
256 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
257 * | Extended Tunnel ID |
258 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
259 * | IPv4 tunnel sender address |
260 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
261 * | Must Be Zero | LSP ID |
262 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
264 struct lspping_tlv_targetfec_subtlv_rsvp_ipv4_t {
265 u_int8_t tunnel_endpoint [4];
266 u_int8_t res[2];
267 u_int8_t tunnel_id[2];
268 u_int8_t extended_tunnel_id[4];
269 u_int8_t tunnel_sender [4];
270 u_int8_t res2[2];
271 u_int8_t lsp_id [2];
275 * 0 1 2 3
276 * 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
277 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
278 * | IPv6 tunnel end point address |
279 * | |
280 * | |
281 * | |
282 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
283 * | Must Be Zero | Tunnel ID |
284 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
285 * | Extended Tunnel ID |
286 * | |
287 * | |
288 * | |
289 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
290 * | IPv6 tunnel sender address |
291 * | |
292 * | |
293 * | |
294 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
295 * | Must Be Zero | LSP ID |
296 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
298 struct lspping_tlv_targetfec_subtlv_rsvp_ipv6_t {
299 u_int8_t tunnel_endpoint [16];
300 u_int8_t res[2];
301 u_int8_t tunnel_id[2];
302 u_int8_t extended_tunnel_id[16];
303 u_int8_t tunnel_sender [16];
304 u_int8_t res2[2];
305 u_int8_t lsp_id [2];
309 * 0 1 2 3
310 * 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
311 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
312 * | Route Distinguisher |
313 * | (8 octets) |
314 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
315 * | IPv4 prefix |
316 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
317 * | Prefix Length | Must Be Zero |
318 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
320 struct lspping_tlv_targetfec_subtlv_l3vpn_ipv4_t {
321 u_int8_t rd [8];
322 u_int8_t prefix [4];
323 u_int8_t prefix_len;
327 * 0 1 2 3
328 * 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
329 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
330 * | Route Distinguisher |
331 * | (8 octets) |
332 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
333 * | IPv6 prefix |
334 * | (16 octets) |
335 * | |
336 * | |
337 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
338 * | Prefix Length | Must Be Zero |
339 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
341 struct lspping_tlv_targetfec_subtlv_l3vpn_ipv6_t {
342 u_int8_t rd [8];
343 u_int8_t prefix [16];
344 u_int8_t prefix_len;
348 * 0 1 2 3
349 * 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
350 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
351 * | Route Distinguisher |
352 * | (8 octets) |
353 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
354 * | Sender's CE ID | Receiver's CE ID |
355 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
356 * | Encapsulation Type | Must Be Zero |
357 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
358 * 0 1 2 3
360 struct lspping_tlv_targetfec_subtlv_l2vpn_endpt_t {
361 u_int8_t rd [8];
362 u_int8_t sender_ce_id [2];
363 u_int8_t receiver_ce_id [2];
364 u_int8_t encapsulation[2];
368 * 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
369 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
370 * | Remote PE Address |
371 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
372 * | VC ID |
373 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
374 * | Encapsulation Type | Must Be Zero |
375 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
377 struct lspping_tlv_targetfec_subtlv_l2vpn_vcid_old_t {
378 u_int8_t remote_pe_address [4];
379 u_int8_t vc_id [4];
380 u_int8_t encapsulation[2];
384 * 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
385 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
386 * | Sender's PE Address |
387 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
388 * | Remote PE Address |
389 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
390 * | VC ID |
391 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
392 * | Encapsulation Type | Must Be Zero |
393 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
395 struct lspping_tlv_targetfec_subtlv_l2vpn_vcid_t {
396 u_int8_t sender_pe_address [4];
397 u_int8_t remote_pe_address [4];
398 u_int8_t vc_id [4];
399 u_int8_t encapsulation[2];
403 * 0 1 2 3
404 * 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
405 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
406 * | MTU | Address Type | Resvd (SBZ) |
407 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
408 * | Downstream IP Address (4 or 16 octets) |
409 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
410 * | Downstream Interface Address (4 or 16 octets) |
411 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
412 * | Hash Key Type | Depth Limit | Multipath Length |
413 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
414 * . .
415 * . (Multipath Information) .
416 * . .
417 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
418 * | Downstream Label | Protocol |
419 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
420 * . .
421 * . .
422 * . .
423 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
424 * | Downstream Label | Protocol |
425 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
427 struct lspping_tlv_downstream_map_ipv4_t {
428 u_int8_t mtu [2];
429 u_int8_t address_type;
430 u_int8_t res;
431 u_int8_t downstream_ip[4];
432 u_int8_t downstream_interface[4];
435 struct lspping_tlv_downstream_map_ipv6_t {
436 u_int8_t mtu [2];
437 u_int8_t address_type;
438 u_int8_t res;
439 u_int8_t downstream_ip[16];
440 u_int8_t downstream_interface[16];
443 struct lspping_tlv_downstream_map_info_t {
444 u_int8_t hash_key_type;
445 u_int8_t depth_limit;
446 u_int8_t multipath_length [2];
449 #define LSPPING_AFI_IPV4 1
450 #define LSPPING_AFI_UNMB 2
451 #define LSPPING_AFI_IPV6 3
453 static const struct tok lspping_tlv_downstream_addr_values[] = {
454 { LSPPING_AFI_IPV4, "IPv4"},
455 { LSPPING_AFI_IPV6, "IPv6"},
456 { LSPPING_AFI_UNMB, "Unnumbered"},
457 { 0, NULL}
460 void
461 lspping_print(register const u_char *pptr, register u_int len) {
463 const struct lspping_common_header *lspping_com_header;
464 const struct lspping_tlv_header *lspping_tlv_header;
465 const struct lspping_tlv_header *lspping_subtlv_header;
466 const u_char *tptr,*tlv_tptr,*subtlv_tptr;
467 int tlen,lspping_tlv_len,lspping_tlv_type,tlv_tlen;
468 int tlv_hexdump,subtlv_hexdump;
469 int lspping_subtlv_len,lspping_subtlv_type;
470 struct timeval timestamp;
472 union {
473 const struct lspping_tlv_downstream_map_ipv4_t *lspping_tlv_downstream_map_ipv4;
474 const struct lspping_tlv_downstream_map_ipv6_t *lspping_tlv_downstream_map_ipv6;
475 const struct lspping_tlv_downstream_map_info_t *lspping_tlv_downstream_map_info;
476 } tlv_ptr;
478 union {
479 const struct lspping_tlv_targetfec_subtlv_ldp_ipv4_t *lspping_tlv_targetfec_subtlv_ldp_ipv4;
480 const struct lspping_tlv_targetfec_subtlv_ldp_ipv6_t *lspping_tlv_targetfec_subtlv_ldp_ipv6;
481 const struct lspping_tlv_targetfec_subtlv_rsvp_ipv4_t *lspping_tlv_targetfec_subtlv_rsvp_ipv4;
482 const struct lspping_tlv_targetfec_subtlv_rsvp_ipv6_t *lspping_tlv_targetfec_subtlv_rsvp_ipv6;
483 const struct lspping_tlv_targetfec_subtlv_l3vpn_ipv4_t *lspping_tlv_targetfec_subtlv_l3vpn_ipv4;
484 const struct lspping_tlv_targetfec_subtlv_l3vpn_ipv6_t *lspping_tlv_targetfec_subtlv_l3vpn_ipv6;
485 const struct lspping_tlv_targetfec_subtlv_l2vpn_endpt_t *lspping_tlv_targetfec_subtlv_l2vpn_endpt;
486 const struct lspping_tlv_targetfec_subtlv_l2vpn_vcid_old_t *lspping_tlv_targetfec_subtlv_l2vpn_vcid_old;
487 const struct lspping_tlv_targetfec_subtlv_l2vpn_vcid_t *lspping_tlv_targetfec_subtlv_l2vpn_vcid;
488 const struct lspping_tlv_targetfec_subtlv_bgp_ipv4_t *lspping_tlv_targetfec_subtlv_bgp_ipv4;
489 const struct lspping_tlv_targetfec_subtlv_bgp_ipv6_t *lspping_tlv_targetfec_subtlv_bgp_ipv6;
490 } subtlv_ptr;
492 tptr=pptr;
493 lspping_com_header = (const struct lspping_common_header *)pptr;
494 TCHECK(*lspping_com_header);
497 * Sanity checking of the header.
499 if (EXTRACT_16BITS(&lspping_com_header->version[0]) != LSPPING_VERSION) {
500 printf("LSP-PING version %u packet not supported",
501 EXTRACT_16BITS(&lspping_com_header->version[0]));
502 return;
505 /* in non-verbose mode just lets print the basic Message Type*/
506 if (vflag < 1) {
507 printf("LSP-PINGv%u, %s, seq %u, length: %u",
508 EXTRACT_16BITS(&lspping_com_header->version[0]),
509 tok2str(lspping_msg_type_values, "unknown (%u)",lspping_com_header->msg_type),
510 EXTRACT_32BITS(lspping_com_header->seq_number),
511 len);
512 return;
515 /* ok they seem to want to know everything - lets fully decode it */
517 tlen=len;
519 printf("\n\tLSP-PINGv%u, msg-type: %s (%u), length: %u\n\t reply-mode: %s (%u)",
520 EXTRACT_16BITS(&lspping_com_header->version[0]),
521 tok2str(lspping_msg_type_values, "unknown",lspping_com_header->msg_type),
522 lspping_com_header->msg_type,
523 len,
524 tok2str(lspping_reply_mode_values, "unknown",lspping_com_header->reply_mode),
525 lspping_com_header->reply_mode);
528 * the following return codes require that the subcode is attached
529 * at the end of the translated token output
531 if (lspping_com_header->return_code == 3 ||
532 lspping_com_header->return_code == 4 ||
533 lspping_com_header->return_code == 8 ||
534 lspping_com_header->return_code == 10 ||
535 lspping_com_header->return_code == 11 ||
536 lspping_com_header->return_code == 12 )
537 printf("\n\t Return Code: %s %u (%u)\n\t Return Subcode: (%u)",
538 tok2str(lspping_return_code_values, "unknown",lspping_com_header->return_code),
539 lspping_com_header->return_subcode,
540 lspping_com_header->return_code,
541 lspping_com_header->return_subcode);
542 else
543 printf("\n\t Return Code: %s (%u)\n\t Return Subcode: (%u)",
544 tok2str(lspping_return_code_values, "unknown",lspping_com_header->return_code),
545 lspping_com_header->return_code,
546 lspping_com_header->return_subcode);
548 printf("\n\t Sender Handle: 0x%08x, Sequence: %u",
549 EXTRACT_32BITS(lspping_com_header->sender_handle),
550 EXTRACT_32BITS(lspping_com_header->seq_number));
552 timestamp.tv_sec=EXTRACT_32BITS(lspping_com_header->ts_sent_sec);
553 timestamp.tv_usec=EXTRACT_32BITS(lspping_com_header->ts_sent_usec);
554 printf("\n\t Sender Timestamp: ");
555 ts_print(&timestamp);
557 timestamp.tv_sec=EXTRACT_32BITS(lspping_com_header->ts_rcvd_sec);
558 timestamp.tv_usec=EXTRACT_32BITS(lspping_com_header->ts_rcvd_usec);
559 printf("Receiver Timestamp: ");
560 if ((timestamp.tv_sec != 0) && (timestamp.tv_usec != 0))
561 ts_print(&timestamp);
562 else
563 printf("no timestamp");
565 tptr+=sizeof(const struct lspping_common_header);
566 tlen-=sizeof(const struct lspping_common_header);
568 while(tlen>(int)sizeof(struct lspping_tlv_header)) {
569 /* did we capture enough for fully decoding the tlv header ? */
570 if (!TTEST2(*tptr, sizeof(struct lspping_tlv_header)))
571 goto trunc;
573 lspping_tlv_header = (const struct lspping_tlv_header *)tptr;
574 lspping_tlv_type=EXTRACT_16BITS(lspping_tlv_header->type);
575 lspping_tlv_len=EXTRACT_16BITS(lspping_tlv_header->length);
577 /* some little sanity checking */
578 if (lspping_tlv_type == 0 || lspping_tlv_len == 0)
579 return;
581 if(lspping_tlv_len < 4) {
582 printf("\n\t ERROR: TLV %u bogus size %u",lspping_tlv_type,lspping_tlv_len);
583 return;
586 printf("\n\t %s TLV (%u), length: %u",
587 tok2str(lspping_tlv_values,
588 "Unknown",
589 lspping_tlv_type),
590 lspping_tlv_type,
591 lspping_tlv_len);
593 tlv_tptr=tptr+sizeof(struct lspping_tlv_header);
594 tlv_tlen=lspping_tlv_len; /* header not included -> no adjustment */
596 /* did we capture enough for fully decoding the tlv ? */
597 if (!TTEST2(*tptr, lspping_tlv_len))
598 goto trunc;
599 tlv_hexdump=FALSE;
601 switch(lspping_tlv_type) {
602 case LSPPING_TLV_TARGET_FEC_STACK:
603 while(tlv_tlen>(int)sizeof(struct lspping_tlv_header)) {
605 /* did we capture enough for fully decoding the subtlv header ? */
606 if (!TTEST2(*tptr, sizeof(struct lspping_tlv_header)))
607 goto trunc;
608 subtlv_hexdump=FALSE;
610 lspping_subtlv_header = (const struct lspping_tlv_header *)tlv_tptr;
611 lspping_subtlv_type=EXTRACT_16BITS(lspping_subtlv_header->type);
612 lspping_subtlv_len=EXTRACT_16BITS(lspping_subtlv_header->length);
613 subtlv_tptr=tlv_tptr+sizeof(struct lspping_tlv_header);
615 if (lspping_subtlv_len == 0)
616 break;
618 printf("\n\t %s subTLV (%u), length: %u",
619 tok2str(lspping_tlvtargetfec_subtlv_values,
620 "Unknown",
621 lspping_subtlv_type),
622 lspping_subtlv_type,
623 lspping_subtlv_len);
625 switch(lspping_subtlv_type) {
627 case LSPPING_TLV_TARGETFEC_SUBTLV_LDP_IPV4:
628 subtlv_ptr.lspping_tlv_targetfec_subtlv_ldp_ipv4 = \
629 (const struct lspping_tlv_targetfec_subtlv_ldp_ipv4_t *)subtlv_tptr;
630 printf("\n\t %s/%u",
631 ipaddr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_ldp_ipv4->prefix),
632 subtlv_ptr.lspping_tlv_targetfec_subtlv_ldp_ipv4->prefix_len);
633 break;
635 #ifdef INET6
636 case LSPPING_TLV_TARGETFEC_SUBTLV_LDP_IPV6:
637 subtlv_ptr.lspping_tlv_targetfec_subtlv_ldp_ipv6 = \
638 (const struct lspping_tlv_targetfec_subtlv_ldp_ipv6_t *)subtlv_tptr;
639 printf("\n\t %s/%u",
640 ip6addr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_ldp_ipv6->prefix),
641 subtlv_ptr.lspping_tlv_targetfec_subtlv_ldp_ipv6->prefix_len);
642 break;
643 #endif
645 case LSPPING_TLV_TARGETFEC_SUBTLV_BGP_IPV4:
646 subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv4 = \
647 (const struct lspping_tlv_targetfec_subtlv_bgp_ipv4_t *)subtlv_tptr;
648 printf("\n\t %s/%u, sender-id %s",
649 ipaddr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv4->prefix),
650 subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv4->prefix_len,
651 ipaddr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv4->sender_id));
652 break;
654 #ifdef INET6
655 case LSPPING_TLV_TARGETFEC_SUBTLV_BGP_IPV6:
656 subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv6 = \
657 (const struct lspping_tlv_targetfec_subtlv_bgp_ipv6_t *)subtlv_tptr;
658 printf("\n\t %s/%u, sender-id %s",
659 ip6addr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv6->prefix),
660 subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv6->prefix_len,
661 ip6addr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv6->sender_id));
662 break;
663 #endif
665 case LSPPING_TLV_TARGETFEC_SUBTLV_RSVP_IPV4:
666 subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4 = \
667 (const struct lspping_tlv_targetfec_subtlv_rsvp_ipv4_t *)subtlv_tptr;
668 printf("\n\t tunnel end-point %s, tunnel sender %s, lsp-id 0x%04x" \
669 "\n\t tunnel-id 0x%04x, extended tunnel-id %s",
670 ipaddr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->tunnel_endpoint),
671 ipaddr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->tunnel_sender),
672 EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->lsp_id),
673 EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->tunnel_id),
674 ipaddr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->extended_tunnel_id));
675 break;
677 #ifdef INET6
678 case LSPPING_TLV_TARGETFEC_SUBTLV_RSVP_IPV6:
679 subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6 = \
680 (const struct lspping_tlv_targetfec_subtlv_rsvp_ipv6_t *)subtlv_tptr;
681 printf("\n\t tunnel end-point %s, tunnel sender %s, lsp-id 0x%04x" \
682 "\n\t tunnel-id 0x%04x, extended tunnel-id %s",
683 ip6addr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->tunnel_endpoint),
684 ip6addr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->tunnel_sender),
685 EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->lsp_id),
686 EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->tunnel_id),
687 ip6addr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->extended_tunnel_id));
688 break;
689 #endif
691 case LSPPING_TLV_TARGETFEC_SUBTLV_L3VPN_IPV4:
692 subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv4 = \
693 (const struct lspping_tlv_targetfec_subtlv_l3vpn_ipv4_t *)subtlv_tptr;
694 printf("\n\t RD: %s, %s/%u",
695 bgp_vpn_rd_print(subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv4->rd),
696 ipaddr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv4->prefix),
697 subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv4->prefix_len);
698 break;
700 #ifdef INET6
701 case LSPPING_TLV_TARGETFEC_SUBTLV_L3VPN_IPV6:
702 subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv6 = \
703 (const struct lspping_tlv_targetfec_subtlv_l3vpn_ipv6_t *)subtlv_tptr;
704 printf("\n\t RD: %s, %s/%u",
705 bgp_vpn_rd_print(subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv6->rd),
706 ip6addr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv6->prefix),
707 subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv6->prefix_len);
708 break;
709 #endif
711 case LSPPING_TLV_TARGETFEC_SUBTLV_L2VPN_ENDPT:
712 subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt = \
713 (const struct lspping_tlv_targetfec_subtlv_l2vpn_endpt_t *)subtlv_tptr;
714 printf("\n\t RD: %s, Sender CE-ID: %u, Receiver CE-ID: %u" \
715 "\n\t Encapsulation Type: %s (%u)",
716 bgp_vpn_rd_print(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->rd),
717 EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->sender_ce_id),
718 EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->receiver_ce_id),
719 tok2str(l2vpn_encaps_values,
720 "unknown",
721 EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->encapsulation)),
722 EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->encapsulation));
724 break;
726 /* the old L2VPN VCID subTLV does not have support for the sender field */
727 case LSPPING_TLV_TARGETFEC_SUBTLV_L2VPN_VCID_OLD:
728 subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old = \
729 (const struct lspping_tlv_targetfec_subtlv_l2vpn_vcid_old_t *)subtlv_tptr;
730 printf("\n\t Remote PE: %s" \
731 "\n\t VC-ID: 0x%08x, Encapsulation Type: %s (%u)",
732 ipaddr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old->remote_pe_address),
733 EXTRACT_32BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old->vc_id),
734 tok2str(l2vpn_encaps_values,
735 "unknown",
736 EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old->encapsulation)),
737 EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old->encapsulation));
739 break;
741 case LSPPING_TLV_TARGETFEC_SUBTLV_L2VPN_VCID:
742 subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid = \
743 (const struct lspping_tlv_targetfec_subtlv_l2vpn_vcid_t *)subtlv_tptr;
744 printf("\n\t Sender PE: %s, Remote PE: %s" \
745 "\n\t VC-ID: 0x%08x, Encapsulation Type: %s (%u)",
746 ipaddr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->sender_pe_address),
747 ipaddr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->remote_pe_address),
748 EXTRACT_32BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->vc_id),
749 tok2str(l2vpn_encaps_values,
750 "unknown",
751 EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->encapsulation)),
752 EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->encapsulation));
754 break;
756 default:
757 subtlv_hexdump=TRUE; /* unknown subTLV just hexdump it */
758 break;
760 /* do we want to see an additionally subtlv hexdump ? */
761 if (vflag > 1 || subtlv_hexdump==TRUE)
762 print_unknown_data(tlv_tptr+sizeof(struct lspping_tlv_header), \
763 "\n\t ",
764 lspping_subtlv_len);
766 tlv_tptr+=lspping_subtlv_len;
767 tlv_tlen-=lspping_subtlv_len+sizeof(struct lspping_tlv_header);
769 break;
771 case LSPPING_TLV_DOWNSTREAM_MAPPING:
772 /* that strange thing with the downstream map TLV is that until now
773 * we do not know if its IPv4 or IPv6 , after we found the adress-type
774 * lets recast the tlv_tptr and move on */
776 tlv_ptr.lspping_tlv_downstream_map_ipv4= \
777 (const struct lspping_tlv_downstream_map_ipv4_t *)tlv_tptr;
778 tlv_ptr.lspping_tlv_downstream_map_ipv6= \
779 (const struct lspping_tlv_downstream_map_ipv6_t *)tlv_tptr;
780 printf("\n\t MTU: %u, Address-Type: %s (%u)",
781 EXTRACT_16BITS(tlv_ptr.lspping_tlv_downstream_map_ipv4->mtu),
782 tok2str(lspping_tlv_downstream_addr_values,
783 "unknown",
784 tlv_ptr.lspping_tlv_downstream_map_ipv4->address_type),
785 tlv_ptr.lspping_tlv_downstream_map_ipv4->address_type);
787 switch(tlv_ptr.lspping_tlv_downstream_map_ipv4->address_type) {
789 case LSPPING_AFI_IPV4:
790 printf("\n\t Downstream IP: %s" \
791 "\n\t Downstream Interface IP: %s",
792 ipaddr_string(tlv_ptr.lspping_tlv_downstream_map_ipv4->downstream_ip),
793 ipaddr_string(tlv_ptr.lspping_tlv_downstream_map_ipv4->downstream_interface));
794 tlv_tptr+=sizeof(struct lspping_tlv_downstream_map_ipv4_t);
795 tlv_tlen-=sizeof(struct lspping_tlv_downstream_map_ipv4_t);
796 break;
797 #ifdef INET6
798 case LSPPING_AFI_IPV6:
799 printf("\n\t Downstream IP: %s" \
800 "\n\t Downstream Interface IP: %s",
801 ip6addr_string(tlv_ptr.lspping_tlv_downstream_map_ipv6->downstream_ip),
802 ip6addr_string(tlv_ptr.lspping_tlv_downstream_map_ipv6->downstream_interface));
803 tlv_tptr+=sizeof(struct lspping_tlv_downstream_map_ipv6_t);
804 tlv_tlen-=sizeof(struct lspping_tlv_downstream_map_ipv6_t);
805 break;
806 #endif
807 case LSPPING_AFI_UNMB:
808 printf("\n\t Downstream IP: %s" \
809 "\n\t Downstream Interface Index: 0x%08x",
810 ipaddr_string(tlv_ptr.lspping_tlv_downstream_map_ipv4->downstream_ip),
811 EXTRACT_32BITS(tlv_ptr.lspping_tlv_downstream_map_ipv4->downstream_interface));
812 tlv_tptr+=sizeof(struct lspping_tlv_downstream_map_ipv4_t);
813 tlv_tlen-=sizeof(struct lspping_tlv_downstream_map_ipv4_t);
814 break;
816 default:
817 /* should not happen ! - no error message - tok2str() has barked already */
818 break;
821 tlv_ptr.lspping_tlv_downstream_map_info= \
822 (const struct lspping_tlv_downstream_map_info_t *)tlv_tptr;
824 /* FIXME add hash-key type, depth limit, multipath processing */
827 tlv_tptr+=sizeof(struct lspping_tlv_downstream_map_info_t);
828 tlv_tlen-=sizeof(struct lspping_tlv_downstream_map_info_t);
830 /* FIXME print downstream labels */
833 tlv_hexdump=TRUE; /* dump the TLV until code complete */
835 break;
837 case LSPPING_TLV_BFD_DISCRIMINATOR:
838 tptr += sizeof(struct lspping_tlv_header);
839 if (!TTEST2(*tptr, LSPPING_TLV_BFD_DISCRIMINATOR_LEN))
840 goto trunc;
841 printf("\n\t BFD Discriminator 0x%08x", EXTRACT_32BITS(tptr));
842 break;
844 * FIXME those are the defined TLVs that lack a decoder
845 * you are welcome to contribute code ;-)
848 case LSPPING_TLV_PAD:
849 case LSPPING_TLV_ERROR_CODE:
850 case LSPPING_TLV_VENDOR_PRIVATE:
852 default:
853 if (vflag <= 1)
854 print_unknown_data(tlv_tptr,"\n\t ",tlv_tlen);
855 break;
857 /* do we want to see an additionally tlv hexdump ? */
858 if (vflag > 1 || tlv_hexdump==TRUE)
859 print_unknown_data(tptr+sizeof(sizeof(struct lspping_tlv_header)),"\n\t ",
860 lspping_tlv_len);
863 /* All TLVs are aligned to four octet boundary */
864 if (lspping_tlv_len % 4) {
865 lspping_tlv_len += (4 - lspping_tlv_len % 4);
868 tptr+=lspping_tlv_len+sizeof(struct lspping_tlv_header);
869 tlen-=lspping_tlv_len+sizeof(struct lspping_tlv_header);
871 return;
872 trunc:
873 printf("\n\t\t packet exceeded snapshot");