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