etc/services - sync with NetBSD-8
[minix.git] / external / bsd / tcpdump / dist / print-lspping.c
blob60e8fbf44aeb3df1a6972d520ec41eedf4a77ea4
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 #include <sys/cdefs.h>
17 #ifndef lint
18 __RCSID("$NetBSD: print-lspping.c,v 1.6 2015/03/31 21:59:35 christos Exp $");
19 #endif
21 #define NETDISSECT_REWORKED
22 #ifdef HAVE_CONFIG_H
23 #include "config.h"
24 #endif
26 #include <tcpdump-stdinc.h>
28 #include "interface.h"
29 #include "extract.h"
30 #include "addrtoname.h"
32 #include "l2vpn.h"
33 #include "oui.h"
36 * LSPPING common header
38 * 0 1 2 3
39 * 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
40 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
41 * | Version Number | Must Be Zero |
42 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
43 * | Message Type | Reply mode | Return Code | Return Subcode|
44 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
45 * | Sender's Handle |
46 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
47 * | Sequence Number |
48 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
49 * | TimeStamp Sent (seconds) |
50 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
51 * | TimeStamp Sent (microseconds) |
52 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
53 * | TimeStamp Received (seconds) |
54 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
55 * | TimeStamp Received (microseconds) |
56 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
57 * | TLVs ... |
58 * . .
59 * . .
60 * . .
63 struct lspping_common_header {
64 uint8_t version[2];
65 uint8_t reserved[2];
66 uint8_t msg_type;
67 uint8_t reply_mode;
68 uint8_t return_code;
69 uint8_t return_subcode;
70 uint8_t sender_handle[4];
71 uint8_t seq_number[4];
72 uint8_t ts_sent_sec[4];
73 uint8_t ts_sent_usec[4];
74 uint8_t ts_rcvd_sec[4];
75 uint8_t ts_rcvd_usec[4];
78 #define LSPPING_VERSION 1
80 static const struct tok lspping_msg_type_values[] = {
81 { 1, "MPLS Echo Request"},
82 { 2, "MPLS Echo Reply"},
83 { 0, NULL}
86 static const struct tok lspping_reply_mode_values[] = {
87 { 1, "Do not reply"},
88 { 2, "Reply via an IPv4/IPv6 UDP packet"},
89 { 3, "Reply via an IPv4/IPv6 UDP packet with Router Alert"},
90 { 4, "Reply via application level control channel"},
91 { 0, NULL}
94 static const struct tok lspping_return_code_values[] = {
95 { 0, "No return code or return code contained in the Error Code TLV"},
96 { 1, "Malformed echo request received"},
97 { 2, "One or more of the TLVs was not understood"},
98 { 3, "Replying router is an egress for the FEC at stack depth"},
99 { 4, "Replying router has no mapping for the FEC at stack depth"},
100 { 5, "Reserved"},
101 { 6, "Reserved"},
102 { 7, "Reserved"},
103 { 8, "Label switched at stack-depth"},
104 { 9, "Label switched but no MPLS forwarding at stack-depth"},
105 { 10, "Mapping for this FEC is not the given label at stack depth"},
106 { 11, "No label entry at stack-depth"},
107 { 12, "Protocol not associated with interface at FEC stack depth"},
112 * LSPPING TLV header
113 * 0 1 2 3
114 * 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
115 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
116 * | Type | Length |
117 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
118 * | Value |
119 * . .
120 * . .
121 * . .
122 * | |
123 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
126 struct lspping_tlv_header {
127 uint8_t type[2];
128 uint8_t length[2];
131 #define LSPPING_TLV_TARGET_FEC_STACK 1
132 #define LSPPING_TLV_DOWNSTREAM_MAPPING 2
133 #define LSPPING_TLV_PAD 3
134 #define LSPPING_TLV_VENDOR_ENTERPRISE 5
135 #define LSPPING_TLV_VENDOR_ENTERPRISE_LEN 4
136 #define LSPPING_TLV_INTERFACE_LABEL_STACK 7
137 #define LSPPING_TLV_ERROR_CODE 9
138 #define LSPPING_TLV_REPLY_TOS_BYTE 10
139 #define LSPPING_TLV_BFD_DISCRIMINATOR 15 /* draft-ietf-bfd-mpls-02 */
140 #define LSPPING_TLV_BFD_DISCRIMINATOR_LEN 4
141 #define LSPPING_TLV_VENDOR_PRIVATE 0xfc00
143 static const struct tok lspping_tlv_values[] = {
144 { LSPPING_TLV_TARGET_FEC_STACK, "Target FEC Stack" },
145 { LSPPING_TLV_DOWNSTREAM_MAPPING, "Downstream Mapping" },
146 { LSPPING_TLV_PAD, "Pad" },
147 { LSPPING_TLV_ERROR_CODE, "Error Code" },
148 { LSPPING_TLV_VENDOR_ENTERPRISE, "Vendor Enterprise Code" },
149 { LSPPING_TLV_INTERFACE_LABEL_STACK, "Interface Label Stack" },
150 { LSPPING_TLV_REPLY_TOS_BYTE, "Reply TOS Byte" },
151 { LSPPING_TLV_BFD_DISCRIMINATOR, "BFD Discriminator" },
152 { LSPPING_TLV_VENDOR_PRIVATE, "Vendor Private Code" },
153 { 0, NULL}
156 #define LSPPING_TLV_TARGETFEC_SUBTLV_LDP_IPV4 1
157 #define LSPPING_TLV_TARGETFEC_SUBTLV_LDP_IPV6 2
158 #define LSPPING_TLV_TARGETFEC_SUBTLV_RSVP_IPV4 3
159 #define LSPPING_TLV_TARGETFEC_SUBTLV_RSVP_IPV6 4
160 #define LSPPING_TLV_TARGETFEC_SUBTLV_L3VPN_IPV4 6
161 #define LSPPING_TLV_TARGETFEC_SUBTLV_L3VPN_IPV6 7
162 #define LSPPING_TLV_TARGETFEC_SUBTLV_L2VPN_ENDPT 8
163 #define LSPPING_TLV_TARGETFEC_SUBTLV_L2VPN_VCID_OLD 9
164 #define LSPPING_TLV_TARGETFEC_SUBTLV_L2VPN_VCID 10
165 #define LSPPING_TLV_TARGETFEC_SUBTLV_BGP_IPV4 11
166 #define LSPPING_TLV_TARGETFEC_SUBTLV_BGP_IPV6 12
168 static const struct tok lspping_tlvtargetfec_subtlv_values[] = {
169 { LSPPING_TLV_TARGETFEC_SUBTLV_LDP_IPV4, "LDP IPv4 prefix"},
170 { LSPPING_TLV_TARGETFEC_SUBTLV_LDP_IPV6, "LDP IPv6 prefix"},
171 { LSPPING_TLV_TARGETFEC_SUBTLV_RSVP_IPV4, "RSVP IPv4 Session Query"},
172 { LSPPING_TLV_TARGETFEC_SUBTLV_RSVP_IPV6, "RSVP IPv6 Session Query"},
173 { 5, "Reserved"},
174 { LSPPING_TLV_TARGETFEC_SUBTLV_L3VPN_IPV4, "VPN IPv4 prefix"},
175 { LSPPING_TLV_TARGETFEC_SUBTLV_L3VPN_IPV6, "VPN IPv6 prefix"},
176 { LSPPING_TLV_TARGETFEC_SUBTLV_L2VPN_ENDPT, "L2 VPN endpoint"},
177 { LSPPING_TLV_TARGETFEC_SUBTLV_L2VPN_VCID_OLD, "L2 circuit ID (old)"},
178 { LSPPING_TLV_TARGETFEC_SUBTLV_L2VPN_VCID, "L2 circuit ID"},
179 { LSPPING_TLV_TARGETFEC_SUBTLV_BGP_IPV4, "BGP labeled IPv4 prefix"},
180 { LSPPING_TLV_TARGETFEC_SUBTLV_BGP_IPV6, "BGP labeled IPv6 prefix"},
181 { 0, NULL}
185 * 0 1 2 3
186 * 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
187 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
188 * | IPv4 prefix |
189 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
190 * | Prefix Length | Must Be Zero |
191 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
193 struct lspping_tlv_targetfec_subtlv_ldp_ipv4_t {
194 uint8_t prefix [4];
195 uint8_t prefix_len;
199 * 0 1 2 3
200 * 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
201 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
202 * | IPv6 prefix |
203 * | (16 octets) |
204 * | |
205 * | |
206 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
207 * | Prefix Length | Must Be Zero |
208 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
210 struct lspping_tlv_targetfec_subtlv_ldp_ipv6_t {
211 uint8_t prefix [16];
212 uint8_t prefix_len;
216 * 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
217 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
218 * | Sender identifier |
219 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
220 * | IPv4 prefix |
221 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
222 * | Prefix Length | Must Be Zero |
223 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
225 struct lspping_tlv_targetfec_subtlv_bgp_ipv4_t {
226 uint8_t sender_id [4];
227 uint8_t prefix [4];
228 uint8_t prefix_len;
232 * 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
233 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
234 * | Sender identifier |
235 * | (16 octets) |
236 * | |
237 * | |
238 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
239 * | IPv6 prefix |
240 * | (16 octets) |
241 * | |
242 * | |
243 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
244 * | Prefix Length | Must Be Zero |
245 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
247 struct lspping_tlv_targetfec_subtlv_bgp_ipv6_t {
248 uint8_t sender_id [16];
249 uint8_t prefix [16];
250 uint8_t prefix_len;
254 * 0 1 2 3
255 * 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
256 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
257 * | IPv4 tunnel end point address |
258 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
259 * | Must Be Zero | Tunnel ID |
260 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
261 * | Extended Tunnel ID |
262 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
263 * | IPv4 tunnel sender address |
264 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
265 * | Must Be Zero | LSP ID |
266 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
268 struct lspping_tlv_targetfec_subtlv_rsvp_ipv4_t {
269 uint8_t tunnel_endpoint [4];
270 uint8_t res[2];
271 uint8_t tunnel_id[2];
272 uint8_t extended_tunnel_id[4];
273 uint8_t tunnel_sender [4];
274 uint8_t res2[2];
275 uint8_t lsp_id [2];
279 * 0 1 2 3
280 * 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
281 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
282 * | IPv6 tunnel end point address |
283 * | |
284 * | |
285 * | |
286 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
287 * | Must Be Zero | Tunnel ID |
288 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
289 * | Extended Tunnel ID |
290 * | |
291 * | |
292 * | |
293 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
294 * | IPv6 tunnel sender address |
295 * | |
296 * | |
297 * | |
298 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
299 * | Must Be Zero | LSP ID |
300 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
302 struct lspping_tlv_targetfec_subtlv_rsvp_ipv6_t {
303 uint8_t tunnel_endpoint [16];
304 uint8_t res[2];
305 uint8_t tunnel_id[2];
306 uint8_t extended_tunnel_id[16];
307 uint8_t tunnel_sender [16];
308 uint8_t res2[2];
309 uint8_t lsp_id [2];
313 * 0 1 2 3
314 * 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
315 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
316 * | Route Distinguisher |
317 * | (8 octets) |
318 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
319 * | IPv4 prefix |
320 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
321 * | Prefix Length | Must Be Zero |
322 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
324 struct lspping_tlv_targetfec_subtlv_l3vpn_ipv4_t {
325 uint8_t rd [8];
326 uint8_t prefix [4];
327 uint8_t prefix_len;
331 * 0 1 2 3
332 * 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
333 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
334 * | Route Distinguisher |
335 * | (8 octets) |
336 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
337 * | IPv6 prefix |
338 * | (16 octets) |
339 * | |
340 * | |
341 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
342 * | Prefix Length | Must Be Zero |
343 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
345 struct lspping_tlv_targetfec_subtlv_l3vpn_ipv6_t {
346 uint8_t rd [8];
347 uint8_t prefix [16];
348 uint8_t prefix_len;
352 * 0 1 2 3
353 * 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
354 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
355 * | Route Distinguisher |
356 * | (8 octets) |
357 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
358 * | Sender's CE ID | Receiver's CE ID |
359 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
360 * | Encapsulation Type | Must Be Zero |
361 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
362 * 0 1 2 3
364 struct lspping_tlv_targetfec_subtlv_l2vpn_endpt_t {
365 uint8_t rd [8];
366 uint8_t sender_ce_id [2];
367 uint8_t receiver_ce_id [2];
368 uint8_t encapsulation[2];
372 * 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
373 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
374 * | Remote PE Address |
375 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
376 * | VC ID |
377 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
378 * | Encapsulation Type | Must Be Zero |
379 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
381 struct lspping_tlv_targetfec_subtlv_l2vpn_vcid_old_t {
382 uint8_t remote_pe_address [4];
383 uint8_t vc_id [4];
384 uint8_t encapsulation[2];
388 * 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
389 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
390 * | Sender's PE Address |
391 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
392 * | Remote PE Address |
393 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
394 * | VC ID |
395 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
396 * | Encapsulation Type | Must Be Zero |
397 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
399 struct lspping_tlv_targetfec_subtlv_l2vpn_vcid_t {
400 uint8_t sender_pe_address [4];
401 uint8_t remote_pe_address [4];
402 uint8_t vc_id [4];
403 uint8_t encapsulation[2];
407 * 0 1 2 3
408 * 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
409 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
410 * | MTU | Address Type | Resvd (SBZ) |
411 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
412 * | Downstream IP Address (4 or 16 octets) |
413 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
414 * | Downstream Interface Address (4 or 16 octets) |
415 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
416 * | Hash Key Type | Depth Limit | Multipath Length |
417 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
418 * . .
419 * . (Multipath Information) .
420 * . .
421 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
422 * | Downstream Label | Protocol |
423 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
424 * . .
425 * . .
426 * . .
427 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
428 * | Downstream Label | Protocol |
429 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
431 struct lspping_tlv_downstream_map_ipv4_t {
432 uint8_t mtu [2];
433 uint8_t address_type;
434 uint8_t res;
435 uint8_t downstream_ip[4];
436 uint8_t downstream_interface[4];
439 struct lspping_tlv_downstream_map_ipv6_t {
440 uint8_t mtu [2];
441 uint8_t address_type;
442 uint8_t res;
443 uint8_t downstream_ip[16];
444 uint8_t downstream_interface[16];
447 struct lspping_tlv_downstream_map_info_t {
448 uint8_t hash_key_type;
449 uint8_t depth_limit;
450 uint8_t multipath_length [2];
453 #define LSPPING_AFI_IPV4 1
454 #define LSPPING_AFI_UNMB 2
455 #define LSPPING_AFI_IPV6 3
457 static const struct tok lspping_tlv_downstream_addr_values[] = {
458 { LSPPING_AFI_IPV4, "IPv4"},
459 { LSPPING_AFI_IPV6, "IPv6"},
460 { LSPPING_AFI_UNMB, "Unnumbered"},
461 { 0, NULL}
464 void
465 lspping_print(netdissect_options *ndo,
466 register const u_char *pptr, register u_int len)
468 const struct lspping_common_header *lspping_com_header;
469 const struct lspping_tlv_header *lspping_tlv_header;
470 const struct lspping_tlv_header *lspping_subtlv_header;
471 const u_char *tptr,*tlv_tptr,*subtlv_tptr;
472 int tlen,lspping_tlv_len,lspping_tlv_type,tlv_tlen;
473 int tlv_hexdump,subtlv_hexdump;
474 int lspping_subtlv_len,lspping_subtlv_type;
475 struct timeval timestamp;
477 union {
478 const struct lspping_tlv_downstream_map_ipv4_t *lspping_tlv_downstream_map_ipv4;
479 const struct lspping_tlv_downstream_map_ipv6_t *lspping_tlv_downstream_map_ipv6;
480 const struct lspping_tlv_downstream_map_info_t *lspping_tlv_downstream_map_info;
481 } tlv_ptr;
483 union {
484 const struct lspping_tlv_targetfec_subtlv_ldp_ipv4_t *lspping_tlv_targetfec_subtlv_ldp_ipv4;
485 const struct lspping_tlv_targetfec_subtlv_ldp_ipv6_t *lspping_tlv_targetfec_subtlv_ldp_ipv6;
486 const struct lspping_tlv_targetfec_subtlv_rsvp_ipv4_t *lspping_tlv_targetfec_subtlv_rsvp_ipv4;
487 const struct lspping_tlv_targetfec_subtlv_rsvp_ipv6_t *lspping_tlv_targetfec_subtlv_rsvp_ipv6;
488 const struct lspping_tlv_targetfec_subtlv_l3vpn_ipv4_t *lspping_tlv_targetfec_subtlv_l3vpn_ipv4;
489 const struct lspping_tlv_targetfec_subtlv_l3vpn_ipv6_t *lspping_tlv_targetfec_subtlv_l3vpn_ipv6;
490 const struct lspping_tlv_targetfec_subtlv_l2vpn_endpt_t *lspping_tlv_targetfec_subtlv_l2vpn_endpt;
491 const struct lspping_tlv_targetfec_subtlv_l2vpn_vcid_old_t *lspping_tlv_targetfec_subtlv_l2vpn_vcid_old;
492 const struct lspping_tlv_targetfec_subtlv_l2vpn_vcid_t *lspping_tlv_targetfec_subtlv_l2vpn_vcid;
493 const struct lspping_tlv_targetfec_subtlv_bgp_ipv4_t *lspping_tlv_targetfec_subtlv_bgp_ipv4;
494 const struct lspping_tlv_targetfec_subtlv_bgp_ipv6_t *lspping_tlv_targetfec_subtlv_bgp_ipv6;
495 } subtlv_ptr;
497 tptr=pptr;
498 lspping_com_header = (const struct lspping_common_header *)pptr;
499 ND_TCHECK(*lspping_com_header);
502 * Sanity checking of the header.
504 if (EXTRACT_16BITS(&lspping_com_header->version[0]) != LSPPING_VERSION) {
505 ND_PRINT((ndo, "LSP-PING version %u packet not supported",
506 EXTRACT_16BITS(&lspping_com_header->version[0])));
507 return;
510 /* in non-verbose mode just lets print the basic Message Type*/
511 if (ndo->ndo_vflag < 1) {
512 ND_PRINT((ndo, "LSP-PINGv%u, %s, seq %u, length: %u",
513 EXTRACT_16BITS(&lspping_com_header->version[0]),
514 tok2str(lspping_msg_type_values, "unknown (%u)",lspping_com_header->msg_type),
515 EXTRACT_32BITS(lspping_com_header->seq_number),
516 len));
517 return;
520 /* ok they seem to want to know everything - lets fully decode it */
522 tlen=len;
524 ND_PRINT((ndo, "\n\tLSP-PINGv%u, msg-type: %s (%u), length: %u\n\t reply-mode: %s (%u)",
525 EXTRACT_16BITS(&lspping_com_header->version[0]),
526 tok2str(lspping_msg_type_values, "unknown",lspping_com_header->msg_type),
527 lspping_com_header->msg_type,
528 len,
529 tok2str(lspping_reply_mode_values, "unknown",lspping_com_header->reply_mode),
530 lspping_com_header->reply_mode));
533 * the following return codes require that the subcode is attached
534 * at the end of the translated token output
536 if (lspping_com_header->return_code == 3 ||
537 lspping_com_header->return_code == 4 ||
538 lspping_com_header->return_code == 8 ||
539 lspping_com_header->return_code == 10 ||
540 lspping_com_header->return_code == 11 ||
541 lspping_com_header->return_code == 12 )
542 ND_PRINT((ndo, "\n\t Return Code: %s %u (%u)\n\t Return Subcode: (%u)",
543 tok2str(lspping_return_code_values, "unknown",lspping_com_header->return_code),
544 lspping_com_header->return_subcode,
545 lspping_com_header->return_code,
546 lspping_com_header->return_subcode));
547 else
548 ND_PRINT((ndo, "\n\t Return Code: %s (%u)\n\t Return Subcode: (%u)",
549 tok2str(lspping_return_code_values, "unknown",lspping_com_header->return_code),
550 lspping_com_header->return_code,
551 lspping_com_header->return_subcode));
553 ND_PRINT((ndo, "\n\t Sender Handle: 0x%08x, Sequence: %u",
554 EXTRACT_32BITS(lspping_com_header->sender_handle),
555 EXTRACT_32BITS(lspping_com_header->seq_number)));
557 timestamp.tv_sec=EXTRACT_32BITS(lspping_com_header->ts_sent_sec);
558 timestamp.tv_usec=EXTRACT_32BITS(lspping_com_header->ts_sent_usec);
559 ND_PRINT((ndo, "\n\t Sender Timestamp: "));
560 ts_print(ndo, &timestamp);
562 timestamp.tv_sec=EXTRACT_32BITS(lspping_com_header->ts_rcvd_sec);
563 timestamp.tv_usec=EXTRACT_32BITS(lspping_com_header->ts_rcvd_usec);
564 ND_PRINT((ndo, "Receiver Timestamp: "));
565 if ((timestamp.tv_sec != 0) && (timestamp.tv_usec != 0))
566 ts_print(ndo, &timestamp);
567 else
568 ND_PRINT((ndo, "no timestamp"));
570 tptr+=sizeof(const struct lspping_common_header);
571 tlen-=sizeof(const struct lspping_common_header);
573 while(tlen>(int)sizeof(struct lspping_tlv_header)) {
575 /* did we capture enough for fully decoding the tlv header ? */
576 ND_TCHECK2(*tptr, sizeof(struct lspping_tlv_header));
578 lspping_tlv_header = (const struct lspping_tlv_header *)tptr;
579 lspping_tlv_type=EXTRACT_16BITS(lspping_tlv_header->type);
580 lspping_tlv_len=EXTRACT_16BITS(lspping_tlv_header->length);
582 /* some little sanity checking */
583 if (lspping_tlv_type == 0 || lspping_tlv_len == 0)
584 return;
586 if(lspping_tlv_len < 4) {
587 ND_PRINT((ndo, "\n\t ERROR: TLV %u bogus size %u",lspping_tlv_type,lspping_tlv_len));
588 return;
591 ND_PRINT((ndo, "\n\t %s TLV (%u), length: %u",
592 tok2str(lspping_tlv_values,
593 "Unknown",
594 lspping_tlv_type),
595 lspping_tlv_type,
596 lspping_tlv_len));
598 tlv_tptr=tptr+sizeof(struct lspping_tlv_header);
599 tlv_tlen=lspping_tlv_len; /* header not included -> no adjustment */
601 /* did we capture enough for fully decoding the tlv ? */
602 ND_TCHECK2(*tptr, lspping_tlv_len);
603 tlv_hexdump=FALSE;
605 switch(lspping_tlv_type) {
606 case LSPPING_TLV_TARGET_FEC_STACK:
607 while(tlv_tlen>(int)sizeof(struct lspping_tlv_header)) {
609 /* did we capture enough for fully decoding the subtlv header ? */
610 ND_TCHECK2(*tptr, sizeof(struct lspping_tlv_header));
611 subtlv_hexdump=FALSE;
613 lspping_subtlv_header = (const struct lspping_tlv_header *)tlv_tptr;
614 lspping_subtlv_type=EXTRACT_16BITS(lspping_subtlv_header->type);
615 lspping_subtlv_len=EXTRACT_16BITS(lspping_subtlv_header->length);
616 subtlv_tptr=tlv_tptr+sizeof(struct lspping_tlv_header);
618 if (lspping_subtlv_len == 0)
619 break;
621 ND_PRINT((ndo, "\n\t %s subTLV (%u), length: %u",
622 tok2str(lspping_tlvtargetfec_subtlv_values,
623 "Unknown",
624 lspping_subtlv_type),
625 lspping_subtlv_type,
626 lspping_subtlv_len));
628 switch(lspping_subtlv_type) {
630 case LSPPING_TLV_TARGETFEC_SUBTLV_LDP_IPV4:
631 subtlv_ptr.lspping_tlv_targetfec_subtlv_ldp_ipv4 = \
632 (const struct lspping_tlv_targetfec_subtlv_ldp_ipv4_t *)subtlv_tptr;
633 ND_PRINT((ndo, "\n\t %s/%u",
634 ipaddr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_ldp_ipv4->prefix),
635 subtlv_ptr.lspping_tlv_targetfec_subtlv_ldp_ipv4->prefix_len));
636 break;
638 #ifdef INET6
639 case LSPPING_TLV_TARGETFEC_SUBTLV_LDP_IPV6:
640 subtlv_ptr.lspping_tlv_targetfec_subtlv_ldp_ipv6 = \
641 (const struct lspping_tlv_targetfec_subtlv_ldp_ipv6_t *)subtlv_tptr;
642 ND_PRINT((ndo, "\n\t %s/%u",
643 ip6addr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_ldp_ipv6->prefix),
644 subtlv_ptr.lspping_tlv_targetfec_subtlv_ldp_ipv6->prefix_len));
645 break;
646 #endif
648 case LSPPING_TLV_TARGETFEC_SUBTLV_BGP_IPV4:
649 subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv4 = \
650 (const struct lspping_tlv_targetfec_subtlv_bgp_ipv4_t *)subtlv_tptr;
651 ND_PRINT((ndo, "\n\t %s/%u, sender-id %s",
652 ipaddr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv4->prefix),
653 subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv4->prefix_len,
654 ipaddr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv4->sender_id)));
655 break;
657 #ifdef INET6
658 case LSPPING_TLV_TARGETFEC_SUBTLV_BGP_IPV6:
659 subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv6 = \
660 (const struct lspping_tlv_targetfec_subtlv_bgp_ipv6_t *)subtlv_tptr;
661 ND_PRINT((ndo, "\n\t %s/%u, sender-id %s",
662 ip6addr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv6->prefix),
663 subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv6->prefix_len,
664 ip6addr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv6->sender_id)));
665 break;
666 #endif
668 case LSPPING_TLV_TARGETFEC_SUBTLV_RSVP_IPV4:
669 subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4 = \
670 (const struct lspping_tlv_targetfec_subtlv_rsvp_ipv4_t *)subtlv_tptr;
671 ND_PRINT((ndo, "\n\t tunnel end-point %s, tunnel sender %s, lsp-id 0x%04x" \
672 "\n\t tunnel-id 0x%04x, extended tunnel-id %s",
673 ipaddr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->tunnel_endpoint),
674 ipaddr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->tunnel_sender),
675 EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->lsp_id),
676 EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->tunnel_id),
677 ipaddr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->extended_tunnel_id)));
678 break;
680 #ifdef INET6
681 case LSPPING_TLV_TARGETFEC_SUBTLV_RSVP_IPV6:
682 subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6 = \
683 (const struct lspping_tlv_targetfec_subtlv_rsvp_ipv6_t *)subtlv_tptr;
684 ND_PRINT((ndo, "\n\t tunnel end-point %s, tunnel sender %s, lsp-id 0x%04x" \
685 "\n\t tunnel-id 0x%04x, extended tunnel-id %s",
686 ip6addr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->tunnel_endpoint),
687 ip6addr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->tunnel_sender),
688 EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->lsp_id),
689 EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->tunnel_id),
690 ip6addr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->extended_tunnel_id)));
691 break;
692 #endif
694 case LSPPING_TLV_TARGETFEC_SUBTLV_L3VPN_IPV4:
695 subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv4 = \
696 (const struct lspping_tlv_targetfec_subtlv_l3vpn_ipv4_t *)subtlv_tptr;
697 ND_PRINT((ndo, "\n\t RD: %s, %s/%u",
698 bgp_vpn_rd_print(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv4->rd),
699 ipaddr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv4->prefix),
700 subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv4->prefix_len));
701 break;
703 #ifdef INET6
704 case LSPPING_TLV_TARGETFEC_SUBTLV_L3VPN_IPV6:
705 subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv6 = \
706 (const struct lspping_tlv_targetfec_subtlv_l3vpn_ipv6_t *)subtlv_tptr;
707 ND_PRINT((ndo, "\n\t RD: %s, %s/%u",
708 bgp_vpn_rd_print(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv6->rd),
709 ip6addr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv6->prefix),
710 subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv6->prefix_len));
711 break;
712 #endif
714 case LSPPING_TLV_TARGETFEC_SUBTLV_L2VPN_ENDPT:
715 subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt = \
716 (const struct lspping_tlv_targetfec_subtlv_l2vpn_endpt_t *)subtlv_tptr;
717 ND_PRINT((ndo, "\n\t RD: %s, Sender CE-ID: %u, Receiver CE-ID: %u" \
718 "\n\t Encapsulation Type: %s (%u)",
719 bgp_vpn_rd_print(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->rd),
720 EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->sender_ce_id),
721 EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->receiver_ce_id),
722 tok2str(l2vpn_encaps_values,
723 "unknown",
724 EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->encapsulation)),
725 EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_endpt->encapsulation)));
727 break;
729 /* the old L2VPN VCID subTLV does not have support for the sender field */
730 case LSPPING_TLV_TARGETFEC_SUBTLV_L2VPN_VCID_OLD:
731 subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old = \
732 (const struct lspping_tlv_targetfec_subtlv_l2vpn_vcid_old_t *)subtlv_tptr;
733 ND_PRINT((ndo, "\n\t Remote PE: %s" \
734 "\n\t VC-ID: 0x%08x, Encapsulation Type: %s (%u)",
735 ipaddr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old->remote_pe_address),
736 EXTRACT_32BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old->vc_id),
737 tok2str(l2vpn_encaps_values,
738 "unknown",
739 EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old->encapsulation)),
740 EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old->encapsulation)));
742 break;
744 case LSPPING_TLV_TARGETFEC_SUBTLV_L2VPN_VCID:
745 subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid = \
746 (const struct lspping_tlv_targetfec_subtlv_l2vpn_vcid_t *)subtlv_tptr;
747 ND_PRINT((ndo, "\n\t Sender PE: %s, Remote PE: %s" \
748 "\n\t VC-ID: 0x%08x, Encapsulation Type: %s (%u)",
749 ipaddr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->sender_pe_address),
750 ipaddr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->remote_pe_address),
751 EXTRACT_32BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->vc_id),
752 tok2str(l2vpn_encaps_values,
753 "unknown",
754 EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->encapsulation)),
755 EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->encapsulation)));
757 break;
759 default:
760 subtlv_hexdump=TRUE; /* unknown subTLV just hexdump it */
761 break;
763 /* do we want to see an additionally subtlv hexdump ? */
764 if (ndo->ndo_vflag > 1 || subtlv_hexdump==TRUE)
765 print_unknown_data(ndo, tlv_tptr+sizeof(struct lspping_tlv_header), \
766 "\n\t ",
767 lspping_subtlv_len);
769 tlv_tptr+=lspping_subtlv_len;
770 tlv_tlen-=lspping_subtlv_len+sizeof(struct lspping_tlv_header);
772 break;
774 case LSPPING_TLV_DOWNSTREAM_MAPPING:
775 /* that strange thing with the downstream map TLV is that until now
776 * we do not know if its IPv4 or IPv6 , after we found the address-type
777 * lets recast the tlv_tptr and move on */
779 tlv_ptr.lspping_tlv_downstream_map_ipv4= \
780 (const struct lspping_tlv_downstream_map_ipv4_t *)tlv_tptr;
781 tlv_ptr.lspping_tlv_downstream_map_ipv6= \
782 (const struct lspping_tlv_downstream_map_ipv6_t *)tlv_tptr;
783 ND_PRINT((ndo, "\n\t MTU: %u, Address-Type: %s (%u)",
784 EXTRACT_16BITS(tlv_ptr.lspping_tlv_downstream_map_ipv4->mtu),
785 tok2str(lspping_tlv_downstream_addr_values,
786 "unknown",
787 tlv_ptr.lspping_tlv_downstream_map_ipv4->address_type),
788 tlv_ptr.lspping_tlv_downstream_map_ipv4->address_type));
790 switch(tlv_ptr.lspping_tlv_downstream_map_ipv4->address_type) {
792 case LSPPING_AFI_IPV4:
793 ND_PRINT((ndo, "\n\t Downstream IP: %s" \
794 "\n\t Downstream Interface IP: %s",
795 ipaddr_string(ndo, tlv_ptr.lspping_tlv_downstream_map_ipv4->downstream_ip),
796 ipaddr_string(ndo, tlv_ptr.lspping_tlv_downstream_map_ipv4->downstream_interface)));
797 tlv_tptr+=sizeof(struct lspping_tlv_downstream_map_ipv4_t);
798 tlv_tlen-=sizeof(struct lspping_tlv_downstream_map_ipv4_t);
799 break;
800 #ifdef INET6
801 case LSPPING_AFI_IPV6:
802 ND_PRINT((ndo, "\n\t Downstream IP: %s" \
803 "\n\t Downstream Interface IP: %s",
804 ip6addr_string(ndo, tlv_ptr.lspping_tlv_downstream_map_ipv6->downstream_ip),
805 ip6addr_string(ndo, tlv_ptr.lspping_tlv_downstream_map_ipv6->downstream_interface)));
806 tlv_tptr+=sizeof(struct lspping_tlv_downstream_map_ipv6_t);
807 tlv_tlen-=sizeof(struct lspping_tlv_downstream_map_ipv6_t);
808 break;
809 #endif
810 case LSPPING_AFI_UNMB:
811 ND_PRINT((ndo, "\n\t Downstream IP: %s" \
812 "\n\t Downstream Interface Index: 0x%08x",
813 ipaddr_string(ndo, tlv_ptr.lspping_tlv_downstream_map_ipv4->downstream_ip),
814 EXTRACT_32BITS(tlv_ptr.lspping_tlv_downstream_map_ipv4->downstream_interface)));
815 tlv_tptr+=sizeof(struct lspping_tlv_downstream_map_ipv4_t);
816 tlv_tlen-=sizeof(struct lspping_tlv_downstream_map_ipv4_t);
817 break;
819 default:
820 /* should not happen ! - no error message - tok2str() has barked already */
821 break;
824 tlv_ptr.lspping_tlv_downstream_map_info= \
825 (const struct lspping_tlv_downstream_map_info_t *)tlv_tptr;
827 /* FIXME add hash-key type, depth limit, multipath processing */
830 tlv_tptr+=sizeof(struct lspping_tlv_downstream_map_info_t);
831 tlv_tlen-=sizeof(struct lspping_tlv_downstream_map_info_t);
833 /* FIXME print downstream labels */
836 tlv_hexdump=TRUE; /* dump the TLV until code complete */
838 break;
840 case LSPPING_TLV_BFD_DISCRIMINATOR:
841 tptr += sizeof(struct lspping_tlv_header);
842 ND_TCHECK2(*tptr, LSPPING_TLV_BFD_DISCRIMINATOR_LEN);
843 ND_PRINT((ndo, "\n\t BFD Discriminator 0x%08x", EXTRACT_32BITS(tptr)));
844 break;
846 case LSPPING_TLV_VENDOR_ENTERPRISE:
848 uint32_t vendor_id;
850 ND_TCHECK2(*tptr, LSPPING_TLV_VENDOR_ENTERPRISE_LEN);
851 vendor_id = EXTRACT_32BITS(tlv_tptr);
852 ND_PRINT((ndo, "\n\t Vendor: %s (0x%04x)",
853 tok2str(smi_values, "Unknown", vendor_id),
854 vendor_id));
856 break;
859 * FIXME those are the defined TLVs that lack a decoder
860 * you are welcome to contribute code ;-)
862 case LSPPING_TLV_PAD:
863 case LSPPING_TLV_ERROR_CODE:
864 case LSPPING_TLV_VENDOR_PRIVATE:
866 default:
867 if (ndo->ndo_vflag <= 1)
868 print_unknown_data(ndo, tlv_tptr, "\n\t ", tlv_tlen);
869 break;
871 /* do we want to see an additionally tlv hexdump ? */
872 if (ndo->ndo_vflag > 1 || tlv_hexdump==TRUE)
873 print_unknown_data(ndo, tptr+sizeof(struct lspping_tlv_header), "\n\t ",
874 lspping_tlv_len);
877 /* All TLVs are aligned to four octet boundary */
878 if (lspping_tlv_len % 4) {
879 lspping_tlv_len += (4 - lspping_tlv_len % 4);
882 tptr+=lspping_tlv_len+sizeof(struct lspping_tlv_header);
883 tlen-=lspping_tlv_len+sizeof(struct lspping_tlv_header);
885 return;
886 trunc:
887 ND_PRINT((ndo, "\n\t\t packet exceeded snapshot"));
890 * Local Variables:
891 * c-style: whitesmith
892 * c-basic-offset: 8
893 * End: