2 * Redistribution and use in source and binary forms, with or without
3 * modification, are permitted provided that: (1) source code
4 * distributions retain the above copyright notice and this paragraph
5 * in its entirety, and (2) distributions including binary code include
6 * the above copyright notice and this paragraph in its entirety in
7 * the documentation or other materials provided with the distribution.
8 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND
9 * WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
10 * LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
11 * FOR A PARTICULAR PURPOSE.
13 * Original code by Hannes Gredler (hannes@juniper.net)
17 static const char rcsid[] _U_ =
18 "@(#) $Header: /tcpdump/master/tcpdump/print-rsvp.c,v 1.33.2.4 2005/07/11 20:24:35 hannes Exp $";
27 #include <tcpdump-stdinc.h>
33 #include "interface.h"
35 #include "addrtoname.h"
36 #include "ethertype.h"
40 * RFC 2205 common header
43 * +-------------+-------------+-------------+-------------+
44 * | Vers | Flags| Msg Type | RSVP Checksum |
45 * +-------------+-------------+-------------+-------------+
46 * | Send_TTL | (Reserved) | RSVP Length |
47 * +-------------+-------------+-------------+-------------+
51 struct rsvp_common_header {
52 u_int8_t version_flags;
61 * RFC2205 object header
65 * +-------------+-------------+-------------+-------------+
66 * | Length (bytes) | Class-Num | C-Type |
67 * +-------------+-------------+-------------+-------------+
69 * // (Object contents) //
71 * +-------------+-------------+-------------+-------------+
74 struct rsvp_object_header {
80 #define RSVP_VERSION 1
81 #define RSVP_EXTRACT_VERSION(x) (((x)&0xf0)>>4)
82 #define RSVP_EXTRACT_FLAGS(x) ((x)&0x0f)
84 #define RSVP_MSGTYPE_PATH 1
85 #define RSVP_MSGTYPE_RESV 2
86 #define RSVP_MSGTYPE_PATHERR 3
87 #define RSVP_MSGTYPE_RESVERR 4
88 #define RSVP_MSGTYPE_PATHTEAR 5
89 #define RSVP_MSGTYPE_RESVTEAR 6
90 #define RSVP_MSGTYPE_RESVCONF 7
91 #define RSVP_MSGTYPE_AGGREGATE 12
92 #define RSVP_MSGTYPE_ACK 13
93 #define RSVP_MSGTYPE_HELLO_OLD 14 /* ancient Hellos */
94 #define RSVP_MSGTYPE_SREFRESH 15
95 #define RSVP_MSGTYPE_HELLO 20
97 static const struct tok rsvp_msg_type_values[] = {
98 { RSVP_MSGTYPE_PATH, "Path" },
99 { RSVP_MSGTYPE_RESV, "Resv" },
100 { RSVP_MSGTYPE_PATHERR, "PathErr" },
101 { RSVP_MSGTYPE_RESVERR, "ResvErr" },
102 { RSVP_MSGTYPE_PATHTEAR, "PathTear" },
103 { RSVP_MSGTYPE_RESVTEAR, "ResvTear" },
104 { RSVP_MSGTYPE_RESVCONF, "ResvConf" },
105 { RSVP_MSGTYPE_AGGREGATE, "Aggregate" },
106 { RSVP_MSGTYPE_ACK, "Acknowledgement" },
107 { RSVP_MSGTYPE_HELLO_OLD, "Hello (Old)" },
108 { RSVP_MSGTYPE_SREFRESH, "Refresh" },
109 { RSVP_MSGTYPE_HELLO, "Hello" },
113 static const struct tok rsvp_header_flag_values[] = {
114 { 0x01, "Refresh reduction capable" }, /* rfc2961 */
118 #define RSVP_OBJ_SESSION 1 /* rfc2205 */
119 #define RSVP_OBJ_RSVP_HOP 3 /* rfc2205, rfc3473 */
120 #define RSVP_OBJ_INTEGRITY 4
121 #define RSVP_OBJ_TIME_VALUES 5 /* rfc2205 */
122 #define RSVP_OBJ_ERROR_SPEC 6
123 #define RSVP_OBJ_SCOPE 7
124 #define RSVP_OBJ_STYLE 8 /* rfc2205 */
125 #define RSVP_OBJ_FLOWSPEC 9 /* rfc2215 */
126 #define RSVP_OBJ_FILTERSPEC 10 /* rfc2215 */
127 #define RSVP_OBJ_SENDER_TEMPLATE 11
128 #define RSVP_OBJ_SENDER_TSPEC 12 /* rfc2215 */
129 #define RSVP_OBJ_ADSPEC 13 /* rfc2215 */
130 #define RSVP_OBJ_POLICY_DATA 14
131 #define RSVP_OBJ_CONFIRM 15 /* rfc2205 */
132 #define RSVP_OBJ_LABEL 16 /* rfc3209 */
133 #define RSVP_OBJ_LABEL_REQ 19 /* rfc3209 */
134 #define RSVP_OBJ_ERO 20 /* rfc3209 */
135 #define RSVP_OBJ_RRO 21 /* rfc3209 */
136 #define RSVP_OBJ_HELLO 22 /* rfc3209 */
137 #define RSVP_OBJ_MESSAGE_ID 23
138 #define RSVP_OBJ_MESSAGE_ID_ACK 24
139 #define RSVP_OBJ_MESSAGE_ID_LIST 25
140 #define RSVP_OBJ_RECOVERY_LABEL 34 /* rfc3473 */
141 #define RSVP_OBJ_UPSTREAM_LABEL 35 /* rfc3473 */
142 #define RSVP_OBJ_LABEL_SET 36 /* rfc3473 */
143 #define RSVP_OBJ_PROTECTION 37 /* rfc3473 */
144 #define RSVP_OBJ_DETOUR 63 /* draft-ietf-mpls-rsvp-lsp-fastreroute-01 */
145 #define RSVP_OBJ_CLASSTYPE 125 /* draft-ietf-tewg-diff-te-proto-07 */
146 #define RSVP_OBJ_SUGGESTED_LABEL 129 /* rfc3473 */
147 #define RSVP_OBJ_ACCEPT_LABEL_SET 130 /* rfc3473 */
148 #define RSVP_OBJ_RESTART_CAPABILITY 131 /* rfc3473 */
149 #define RSVP_OBJ_NOTIFY_REQ 195 /* rfc3473 */
150 #define RSVP_OBJ_ADMIN_STATUS 196 /* rfc3473 */
151 #define RSVP_OBJ_PROPERTIES 204 /* juniper proprietary */
152 #define RSVP_OBJ_FASTREROUTE 205 /* draft-ietf-mpls-rsvp-lsp-fastreroute-01 */
153 #define RSVP_OBJ_SESSION_ATTRIBUTE 207 /* rfc3209 */
154 #define RSVP_OBJ_CALL_ID 230 /* rfc3474 */
155 #define RSVP_OBJ_CALL_OPS 236 /* rfc3474 */
157 static const struct tok rsvp_obj_values[] = {
158 { RSVP_OBJ_SESSION, "Session" },
159 { RSVP_OBJ_RSVP_HOP, "RSVP Hop" },
160 { RSVP_OBJ_INTEGRITY, "Integrity" },
161 { RSVP_OBJ_TIME_VALUES, "Time Values" },
162 { RSVP_OBJ_ERROR_SPEC, "Error Spec" },
163 { RSVP_OBJ_SCOPE, "Scope" },
164 { RSVP_OBJ_STYLE, "Style" },
165 { RSVP_OBJ_FLOWSPEC, "Flowspec" },
166 { RSVP_OBJ_FILTERSPEC, "FilterSpec" },
167 { RSVP_OBJ_SENDER_TEMPLATE, "Sender Template" },
168 { RSVP_OBJ_SENDER_TSPEC, "Sender TSpec" },
169 { RSVP_OBJ_ADSPEC, "Adspec" },
170 { RSVP_OBJ_POLICY_DATA, "Policy Data" },
171 { RSVP_OBJ_CONFIRM, "Confirm" },
172 { RSVP_OBJ_LABEL, "Label" },
173 { RSVP_OBJ_LABEL_REQ, "Label Request" },
174 { RSVP_OBJ_ERO, "ERO" },
175 { RSVP_OBJ_RRO, "RRO" },
176 { RSVP_OBJ_HELLO, "Hello" },
177 { RSVP_OBJ_MESSAGE_ID, "Message ID" },
178 { RSVP_OBJ_MESSAGE_ID_ACK, "Message ID Ack" },
179 { RSVP_OBJ_MESSAGE_ID_LIST, "Message ID List" },
180 { RSVP_OBJ_RECOVERY_LABEL, "Recovery Label" },
181 { RSVP_OBJ_UPSTREAM_LABEL, "Upstream Label" },
182 { RSVP_OBJ_LABEL_SET, "Label Set" },
183 { RSVP_OBJ_ACCEPT_LABEL_SET, "Acceptable Label Set" },
184 { RSVP_OBJ_DETOUR, "Detour" },
185 { RSVP_OBJ_CLASSTYPE, "Class Type" },
186 { RSVP_OBJ_SUGGESTED_LABEL, "Suggested Label" },
187 { RSVP_OBJ_PROPERTIES, "Properties" },
188 { RSVP_OBJ_FASTREROUTE, "Fast Re-Route" },
189 { RSVP_OBJ_SESSION_ATTRIBUTE, "Session Attribute" },
190 { RSVP_OBJ_CALL_ID, "Call-ID" },
191 { RSVP_OBJ_CALL_OPS, "Call Capability" },
192 { RSVP_OBJ_RESTART_CAPABILITY, "Restart Capability" },
193 { RSVP_OBJ_NOTIFY_REQ, "Notify Request" },
194 { RSVP_OBJ_PROTECTION, "Protection" },
195 { RSVP_OBJ_ADMIN_STATUS, "Administrative Status" },
199 #define RSVP_CTYPE_IPV4 1
200 #define RSVP_CTYPE_IPV6 2
201 #define RSVP_CTYPE_TUNNEL_IPV4 7
202 #define RSVP_CTYPE_TUNNEL_IPV6 8
203 #define RSVP_CTYPE_1 1
204 #define RSVP_CTYPE_2 2
205 #define RSVP_CTYPE_3 3
206 #define RSVP_CTYPE_4 4
209 * the ctypes are not globally unique so for
210 * translating it to strings we build a table based
211 * on objects offsetted by the ctype
214 static const struct tok rsvp_ctype_values[] = {
215 { 256*RSVP_OBJ_RSVP_HOP+RSVP_CTYPE_IPV4, "IPv4" },
216 { 256*RSVP_OBJ_RSVP_HOP+RSVP_CTYPE_IPV6, "IPv6" },
217 { 256*RSVP_OBJ_RSVP_HOP+RSVP_CTYPE_3, "IPv4 plus opt. TLVs" },
218 { 256*RSVP_OBJ_RSVP_HOP+RSVP_CTYPE_4, "IPv6 plus opt. TLVs" },
219 { 256*RSVP_OBJ_NOTIFY_REQ+RSVP_CTYPE_IPV4, "IPv4" },
220 { 256*RSVP_OBJ_NOTIFY_REQ+RSVP_CTYPE_IPV6, "IPv6" },
221 { 256*RSVP_OBJ_CONFIRM+RSVP_CTYPE_IPV4, "IPv4" },
222 { 256*RSVP_OBJ_CONFIRM+RSVP_CTYPE_IPV6, "IPv6" },
223 { 256*RSVP_OBJ_TIME_VALUES+RSVP_CTYPE_1, "1" },
224 { 256*RSVP_OBJ_FLOWSPEC+RSVP_CTYPE_1, "obsolete" },
225 { 256*RSVP_OBJ_FLOWSPEC+RSVP_CTYPE_2, "IntServ" },
226 { 256*RSVP_OBJ_SENDER_TSPEC+RSVP_CTYPE_2, "IntServ" },
227 { 256*RSVP_OBJ_ADSPEC+RSVP_CTYPE_2, "IntServ" },
228 { 256*RSVP_OBJ_FILTERSPEC+RSVP_CTYPE_IPV4, "IPv4" },
229 { 256*RSVP_OBJ_FILTERSPEC+RSVP_CTYPE_IPV6, "IPv6" },
230 { 256*RSVP_OBJ_FILTERSPEC+RSVP_CTYPE_3, "IPv6 Flow-label" },
231 { 256*RSVP_OBJ_FILTERSPEC+RSVP_CTYPE_TUNNEL_IPV4, "Tunnel IPv4" },
232 { 256*RSVP_OBJ_SESSION+RSVP_CTYPE_IPV4, "IPv4" },
233 { 256*RSVP_OBJ_SESSION+RSVP_CTYPE_IPV6, "IPv6" },
234 { 256*RSVP_OBJ_SESSION+RSVP_CTYPE_TUNNEL_IPV4, "Tunnel IPv4" },
235 { 256*RSVP_OBJ_SENDER_TEMPLATE+RSVP_CTYPE_IPV4, "IPv4" },
236 { 256*RSVP_OBJ_SENDER_TEMPLATE+RSVP_CTYPE_IPV6, "IPv6" },
237 { 256*RSVP_OBJ_SENDER_TEMPLATE+RSVP_CTYPE_TUNNEL_IPV4, "Tunnel IPv4" },
238 { 256*RSVP_OBJ_MESSAGE_ID+RSVP_CTYPE_1, "1" },
239 { 256*RSVP_OBJ_MESSAGE_ID_ACK+RSVP_CTYPE_1, "1" },
240 { 256*RSVP_OBJ_MESSAGE_ID_LIST+RSVP_CTYPE_1, "1" },
241 { 256*RSVP_OBJ_STYLE+RSVP_CTYPE_1, "1" },
242 { 256*RSVP_OBJ_HELLO+RSVP_CTYPE_1, "Hello Request" },
243 { 256*RSVP_OBJ_HELLO+RSVP_CTYPE_2, "Hello Ack" },
244 { 256*RSVP_OBJ_LABEL_REQ+RSVP_CTYPE_1, "without label range" },
245 { 256*RSVP_OBJ_LABEL_REQ+RSVP_CTYPE_2, "with ATM label range" },
246 { 256*RSVP_OBJ_LABEL_REQ+RSVP_CTYPE_3, "with FR label range" },
247 { 256*RSVP_OBJ_LABEL_REQ+RSVP_CTYPE_4, "Generalized Label" },
248 { 256*RSVP_OBJ_LABEL+RSVP_CTYPE_1, "Label" },
249 { 256*RSVP_OBJ_LABEL+RSVP_CTYPE_2, "Generalized Label" },
250 { 256*RSVP_OBJ_LABEL+RSVP_CTYPE_3, "Waveband Switching" },
251 { 256*RSVP_OBJ_SUGGESTED_LABEL+RSVP_CTYPE_1, "Label" },
252 { 256*RSVP_OBJ_SUGGESTED_LABEL+RSVP_CTYPE_2, "Generalized Label" },
253 { 256*RSVP_OBJ_SUGGESTED_LABEL+RSVP_CTYPE_3, "Waveband Switching" },
254 { 256*RSVP_OBJ_UPSTREAM_LABEL+RSVP_CTYPE_1, "Label" },
255 { 256*RSVP_OBJ_UPSTREAM_LABEL+RSVP_CTYPE_2, "Generalized Label" },
256 { 256*RSVP_OBJ_UPSTREAM_LABEL+RSVP_CTYPE_3, "Waveband Switching" },
257 { 256*RSVP_OBJ_RECOVERY_LABEL+RSVP_CTYPE_1, "Label" },
258 { 256*RSVP_OBJ_RECOVERY_LABEL+RSVP_CTYPE_2, "Generalized Label" },
259 { 256*RSVP_OBJ_RECOVERY_LABEL+RSVP_CTYPE_3, "Waveband Switching" },
260 { 256*RSVP_OBJ_ERO+RSVP_CTYPE_IPV4, "IPv4" },
261 { 256*RSVP_OBJ_RRO+RSVP_CTYPE_IPV4, "IPv4" },
262 { 256*RSVP_OBJ_ERROR_SPEC+RSVP_CTYPE_IPV4, "IPv4" },
263 { 256*RSVP_OBJ_ERROR_SPEC+RSVP_CTYPE_IPV6, "IPv6" },
264 { 256*RSVP_OBJ_ERROR_SPEC+RSVP_CTYPE_3, "IPv4 plus opt. TLVs" },
265 { 256*RSVP_OBJ_ERROR_SPEC+RSVP_CTYPE_4, "IPv6 plus opt. TLVs" },
266 { 256*RSVP_OBJ_RESTART_CAPABILITY+RSVP_CTYPE_1, "IPv4" },
267 { 256*RSVP_OBJ_SESSION_ATTRIBUTE+RSVP_CTYPE_TUNNEL_IPV4, "Tunnel IPv4" },
268 { 256*RSVP_OBJ_FASTREROUTE+RSVP_CTYPE_TUNNEL_IPV4, "Tunnel IPv4" },
269 { 256*RSVP_OBJ_DETOUR+RSVP_CTYPE_TUNNEL_IPV4, "Tunnel IPv4" },
270 { 256*RSVP_OBJ_PROPERTIES+RSVP_CTYPE_1, "1" },
271 { 256*RSVP_OBJ_CLASSTYPE+RSVP_CTYPE_1, "1" },
275 #define RSVP_OBJ_XRO_MASK_SUBOBJ(x) ((x)&0x7f)
276 #define RSVP_OBJ_XRO_MASK_LOOSE(x) ((x)&0x80)
278 #define RSVP_OBJ_XRO_RES 0
279 #define RSVP_OBJ_XRO_IPV4 1
280 #define RSVP_OBJ_XRO_IPV6 2
281 #define RSVP_OBJ_XRO_ASN 32
282 #define RSVP_OBJ_XRO_MPLS 64
284 static const struct tok rsvp_obj_xro_values[] = {
285 { RSVP_OBJ_XRO_RES, "Reserved" },
286 { RSVP_OBJ_XRO_IPV4, "IPv4 prefix" },
287 { RSVP_OBJ_XRO_IPV6, "IPv6 prefix" },
288 { RSVP_OBJ_XRO_ASN, "Autonomous system number" },
289 { RSVP_OBJ_XRO_MPLS, "MPLS label switched path termination" },
293 /* draft-ietf-mpls-rsvp-lsp-fastreroute-02.txt */
294 static const struct tok rsvp_obj_rro_flag_values[] = {
295 { 0x01, "Local protection available" },
296 { 0x02, "Local protection in use" },
297 { 0x04, "Bandwidth protection" },
298 { 0x08, "Node protection" },
302 static const struct tok rsvp_resstyle_values[] = {
303 { 17, "Wildcard Filter" },
304 { 10, "Fixed Filter" },
305 { 18, "Shared Explicit" },
309 #define RSVP_OBJ_INTSERV_GUARANTEED_SERV 2
310 #define RSVP_OBJ_INTSERV_CONTROLLED_LOAD 5
312 static const struct tok rsvp_intserv_service_type_values[] = {
313 { 1, "Default/Global Information" },
314 { RSVP_OBJ_INTSERV_GUARANTEED_SERV, "Guaranteed Service" },
315 { RSVP_OBJ_INTSERV_CONTROLLED_LOAD, "Controlled Load" },
319 static const struct tok rsvp_intserv_parameter_id_values[] = {
321 { 6, "Path b/w estimate" },
322 { 8, "Minimum path latency" },
323 { 10, "Composed MTU" },
324 { 127, "Token Bucket TSpec" },
325 { 130, "Guaranteed Service RSpec" },
326 { 133, "End-to-end composed value for C" },
327 { 134, "End-to-end composed value for D" },
328 { 135, "Since-last-reshaping point composed C" },
329 { 136, "Since-last-reshaping point composed D" },
333 static struct tok rsvp_session_attribute_flag_values[] = {
334 { 0x01, "Local Protection desired" },
335 { 0x02, "Label Recording desired" },
336 { 0x04, "SE Style desired" },
337 { 0x08, "Bandwidth protection desired" }, /* draft-ietf-mpls-rsvp-lsp-fastreroute-02.txt */
338 { 0x10, "Node protection desired" }, /* draft-ietf-mpls-rsvp-lsp-fastreroute-02.txt */
342 static struct tok rsvp_obj_prop_tlv_values[] = {
344 { 0x02, "Metric 1" },
345 { 0x04, "Metric 2" },
346 { 0x08, "CCC Status" },
347 { 0x10, "Path Type" },
351 #define RSVP_OBJ_ERROR_SPEC_CODE_ROUTING 24
352 #define RSVP_OBJ_ERROR_SPEC_CODE_NOTIFY 25
353 #define RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE 125
355 static struct tok rsvp_obj_error_code_values[] = {
356 { RSVP_OBJ_ERROR_SPEC_CODE_ROUTING, "Routing Problem" },
357 { RSVP_OBJ_ERROR_SPEC_CODE_NOTIFY, "Notify Error" },
358 { RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE, "Diffserv TE Error" },
362 static struct tok rsvp_obj_error_code_routing_values[] = {
363 { 1, "Bad EXPLICIT_ROUTE object" },
364 { 2, "Bad strict node" },
365 { 3, "Bad loose node" },
366 { 4, "Bad initial subobject" },
367 { 5, "No route available toward destination" },
368 { 6, "Unacceptable label value" },
369 { 7, "RRO indicated routing loops" },
370 { 8, "non-RSVP-capable router in the path" },
371 { 9, "MPLS label allocation failure" },
372 { 10, "Unsupported L3PID" },
376 static struct tok rsvp_obj_error_code_diffserv_te_values[] = {
377 { 1, "Unexpected CLASSTYPE object" },
378 { 2, "Unsupported Class-Type" },
379 { 3, "Invalid Class-Type value" },
380 { 4, "Class-Type and setup priority do not form a configured TE-Class" },
381 { 5, "Class-Type and holding priority do not form a configured TE-Class" },
382 { 6, "Inconsistency between signaled PSC and signaled Class-Type" },
383 { 7, "Inconsistency between signaled PHBs and signaled Class-Type" },
391 static int rsvp_intserv_print(const u_char *, u_short);
394 * this is a dissector for all the intserv defined
395 * specs as defined per rfc2215
396 * it is called from various rsvp objects;
397 * returns the amount of bytes being processed
400 rsvp_intserv_print(const u_char *tptr, u_short obj_tlen) {
402 int parameter_id,parameter_length;
410 parameter_id = *(tptr);
411 parameter_length = EXTRACT_16BITS(tptr+2)<<2; /* convert wordcount to bytecount */
413 printf("\n\t Parameter ID: %s (%u), length: %u, Flags: [0x%02x]",
414 tok2str(rsvp_intserv_parameter_id_values,"unknown",parameter_id),
419 if (obj_tlen < parameter_length+4)
421 switch(parameter_id) { /* parameter_id */
425 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
426 * | 4 (e) | (f) | 1 (g) |
427 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
428 * | IS hop cnt (32-bit unsigned integer) |
429 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
431 if (parameter_length == 4)
432 printf("\n\t\tIS hop count: %u", EXTRACT_32BITS(tptr+4));
437 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
438 * | 6 (h) | (i) | 1 (j) |
439 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
440 * | Path b/w estimate (32-bit IEEE floating point number) |
441 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
443 if (parameter_length == 4) {
444 bw.i = EXTRACT_32BITS(tptr+4);
445 printf("\n\t\tPath b/w estimate: %.10g Mbps", bw.f/125000);
451 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
452 * | 8 (k) | (l) | 1 (m) |
453 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
454 * | Minimum path latency (32-bit integer) |
455 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
457 if (parameter_length == 4) {
458 printf("\n\t\tMinimum path latency: ");
459 if (EXTRACT_32BITS(tptr+4) == 0xffffffff)
460 printf("don't care");
462 printf("%u", EXTRACT_32BITS(tptr+4));
469 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
470 * | 10 (n) | (o) | 1 (p) |
471 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
472 * | Composed MTU (32-bit unsigned integer) |
473 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
475 if (parameter_length == 4)
476 printf("\n\t\tComposed MTU: %u bytes", EXTRACT_32BITS(tptr+4));
480 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
481 * | 127 (e) | 0 (f) | 5 (g) |
482 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
483 * | Token Bucket Rate [r] (32-bit IEEE floating point number) |
484 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
485 * | Token Bucket Size [b] (32-bit IEEE floating point number) |
486 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
487 * | Peak Data Rate [p] (32-bit IEEE floating point number) |
488 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
489 * | Minimum Policed Unit [m] (32-bit integer) |
490 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
491 * | Maximum Packet Size [M] (32-bit integer) |
492 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
495 if (parameter_length == 20) {
496 bw.i = EXTRACT_32BITS(tptr+4);
497 printf("\n\t\tToken Bucket Rate: %.10g Mbps", bw.f/125000);
498 bw.i = EXTRACT_32BITS(tptr+8);
499 printf("\n\t\tToken Bucket Size: %.10g bytes", bw.f);
500 bw.i = EXTRACT_32BITS(tptr+12);
501 printf("\n\t\tPeak Data Rate: %.10g Mbps", bw.f/125000);
502 printf("\n\t\tMinimum Policed Unit: %u bytes", EXTRACT_32BITS(tptr+16));
503 printf("\n\t\tMaximum Packet Size: %u bytes", EXTRACT_32BITS(tptr+20));
509 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
510 * | 130 (h) | 0 (i) | 2 (j) |
511 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
512 * | Rate [R] (32-bit IEEE floating point number) |
513 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
514 * | Slack Term [S] (32-bit integer) |
515 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
518 if (parameter_length == 8) {
519 bw.i = EXTRACT_32BITS(tptr+4);
520 printf("\n\t\tRate: %.10g Mbps", bw.f/125000);
521 printf("\n\t\tSlack Term: %u", EXTRACT_32BITS(tptr+8));
529 if (parameter_length == 4)
530 printf("\n\t\tValue: %u", EXTRACT_32BITS(tptr+4));
535 print_unknown_data(tptr+4,"\n\t\t",parameter_length);
537 return (parameter_length+4); /* header length 4 bytes */
541 rsvp_obj_print (const u_char *tptr, const char *ident, u_int tlen) {
543 const struct rsvp_object_header *rsvp_obj_header;
544 const u_char *obj_tptr;
545 u_short rsvp_obj_len,rsvp_obj_ctype,obj_tlen,intserv_serv_tlen;
546 int hexdump,processed,padbytes,error_code,error_value,i;
553 while(tlen>=sizeof(struct rsvp_object_header)) {
554 /* did we capture enough for fully decoding the object header ? */
555 if (!TTEST2(*tptr, sizeof(struct rsvp_object_header)))
558 rsvp_obj_header = (const struct rsvp_object_header *)tptr;
559 rsvp_obj_len=EXTRACT_16BITS(rsvp_obj_header->length);
560 rsvp_obj_ctype=rsvp_obj_header->ctype;
562 if(rsvp_obj_len % 4) {
563 printf("%sERROR: object header size %u not a multiple of 4", ident, rsvp_obj_len);
566 if(rsvp_obj_len < sizeof(struct rsvp_object_header)) {
567 printf("%sERROR: object header too short %u < %lu", ident, rsvp_obj_len,
568 (unsigned long)sizeof(const struct rsvp_object_header));
572 printf("%s%s Object (%u) Flags: [%s",
574 tok2str(rsvp_obj_values,
576 rsvp_obj_header->class_num),
577 rsvp_obj_header->class_num,
578 ((rsvp_obj_header->class_num)&0x80) ? "ignore" : "reject");
580 if (rsvp_obj_header->class_num > 128)
582 ((rsvp_obj_header->class_num)&0x40) ? "and forward" : "silently");
584 printf(" if unknown], Class-Type: %s (%u), length: %u",
585 tok2str(rsvp_ctype_values,
587 ((rsvp_obj_header->class_num)<<8)+rsvp_obj_ctype),
591 if(tlen < rsvp_obj_len) {
592 printf("%sERROR: object goes past end of objects TLV", ident);
596 obj_tptr=tptr+sizeof(struct rsvp_object_header);
597 obj_tlen=rsvp_obj_len-sizeof(struct rsvp_object_header);
599 /* did we capture enough for fully decoding the object ? */
600 if (!TTEST2(*tptr, rsvp_obj_len))
604 switch(rsvp_obj_header->class_num) {
605 case RSVP_OBJ_SESSION:
606 switch(rsvp_obj_ctype) {
607 case RSVP_CTYPE_IPV4:
610 printf("%s IPv4 DestAddress: %s, Protocol ID: 0x%02x",
612 ipaddr_string(obj_tptr),
613 *(obj_tptr+sizeof(struct in_addr)));
614 printf("%s Flags: [0x%02x], DestPort %u",
617 EXTRACT_16BITS(obj_tptr+6));
622 case RSVP_CTYPE_IPV6:
625 printf("%s IPv6 DestAddress: %s, Protocol ID: 0x%02x",
627 ip6addr_string(obj_tptr),
628 *(obj_tptr+sizeof(struct in6_addr)));
629 printf("%s Flags: [0x%02x], DestPort %u",
631 *(obj_tptr+sizeof(struct in6_addr)+1),
632 EXTRACT_16BITS(obj_tptr+sizeof(struct in6_addr)+2));
637 case RSVP_CTYPE_TUNNEL_IPV6:
640 printf("%s IPv6 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
642 ip6addr_string(obj_tptr),
643 EXTRACT_16BITS(obj_tptr+18),
644 ip6addr_string(obj_tptr+20));
649 case RSVP_CTYPE_TUNNEL_IPV4:
652 printf("%s IPv4 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
654 ipaddr_string(obj_tptr),
655 EXTRACT_16BITS(obj_tptr+6),
656 ipaddr_string(obj_tptr+8));
665 case RSVP_OBJ_CONFIRM:
666 switch(rsvp_obj_ctype) {
667 case RSVP_CTYPE_IPV4:
668 if (obj_tlen < sizeof(struct in_addr))
670 printf("%s IPv4 Receiver Address: %s",
672 ipaddr_string(obj_tptr));
673 obj_tlen-=sizeof(struct in_addr);
674 obj_tptr+=sizeof(struct in_addr);
677 case RSVP_CTYPE_IPV6:
678 if (obj_tlen < sizeof(struct in6_addr))
680 printf("%s IPv6 Receiver Address: %s",
682 ip6addr_string(obj_tptr));
683 obj_tlen-=sizeof(struct in6_addr);
684 obj_tptr+=sizeof(struct in6_addr);
692 case RSVP_OBJ_NOTIFY_REQ:
693 switch(rsvp_obj_ctype) {
694 case RSVP_CTYPE_IPV4:
695 if (obj_tlen < sizeof(struct in_addr))
697 printf("%s IPv4 Notify Node Address: %s",
699 ipaddr_string(obj_tptr));
700 obj_tlen-=sizeof(struct in_addr);
701 obj_tptr+=sizeof(struct in_addr);
704 case RSVP_CTYPE_IPV6:
705 if (obj_tlen < sizeof(struct in6_addr))
707 printf("%s IPv6 Notify Node Address: %s",
709 ip6addr_string(obj_tptr));
710 obj_tlen-=sizeof(struct in6_addr);
711 obj_tptr+=sizeof(struct in6_addr);
719 case RSVP_OBJ_SUGGESTED_LABEL: /* fall through */
720 case RSVP_OBJ_UPSTREAM_LABEL: /* fall through */
721 case RSVP_OBJ_RECOVERY_LABEL: /* fall through */
723 switch(rsvp_obj_ctype) {
725 while(obj_tlen >= 4 ) {
726 printf("%s Label: %u", ident, EXTRACT_32BITS(obj_tptr));
734 printf("%s Generalized Label: %u",
736 EXTRACT_32BITS(obj_tptr));
743 printf("%s Waveband ID: %u%s Start Label: %u, Stop Label: %u",
745 EXTRACT_32BITS(obj_tptr),
747 EXTRACT_32BITS(obj_tptr+4),
748 EXTRACT_32BITS(obj_tptr+8));
758 switch(rsvp_obj_ctype) {
762 printf("%s Reservation Style: %s, Flags: [0x%02x]",
764 tok2str(rsvp_resstyle_values,
766 EXTRACT_24BITS(obj_tptr+1)),
776 case RSVP_OBJ_SENDER_TEMPLATE:
777 switch(rsvp_obj_ctype) {
778 case RSVP_CTYPE_IPV4:
781 printf("%s Source Address: %s, Source Port: %u",
783 ipaddr_string(obj_tptr),
784 EXTRACT_16BITS(obj_tptr+6));
789 case RSVP_CTYPE_IPV6:
792 printf("%s Source Address: %s, Source Port: %u",
794 ip6addr_string(obj_tptr),
795 EXTRACT_16BITS(obj_tptr+18));
800 case RSVP_CTYPE_TUNNEL_IPV4:
803 printf("%s IPv4 Tunnel Sender Address: %s, LSP-ID: 0x%04x",
805 ipaddr_string(obj_tptr),
806 EXTRACT_16BITS(obj_tptr+6));
815 case RSVP_OBJ_LABEL_REQ:
816 switch(rsvp_obj_ctype) {
818 while(obj_tlen >= 4 ) {
819 printf("%s L3 Protocol ID: %s",
821 tok2str(ethertype_values,
822 "Unknown Protocol (0x%04x)",
823 EXTRACT_16BITS(obj_tptr+2)));
831 printf("%s L3 Protocol ID: %s",
833 tok2str(ethertype_values,
834 "Unknown Protocol (0x%04x)",
835 EXTRACT_16BITS(obj_tptr+2)));
836 printf(",%s merge capability",((*(obj_tptr+4))&0x80) ? "no" : "" );
837 printf("%s Minimum VPI/VCI: %u/%u",
839 (EXTRACT_16BITS(obj_tptr+4))&0xfff,
840 (EXTRACT_16BITS(obj_tptr+6))&0xfff);
841 printf("%s Maximum VPI/VCI: %u/%u",
843 (EXTRACT_16BITS(obj_tptr+8))&0xfff,
844 (EXTRACT_16BITS(obj_tptr+10))&0xfff);
851 printf("%s L3 Protocol ID: %s",
853 tok2str(ethertype_values,
854 "Unknown Protocol (0x%04x)",
855 EXTRACT_16BITS(obj_tptr+2)));
856 printf("%s Minimum/Maximum DLCI: %u/%u, %s%s bit DLCI",
858 (EXTRACT_32BITS(obj_tptr+4))&0x7fffff,
859 (EXTRACT_32BITS(obj_tptr+8))&0x7fffff,
860 (((EXTRACT_16BITS(obj_tptr+4)>>7)&3) == 0 ) ? "10" : "",
861 (((EXTRACT_16BITS(obj_tptr+4)>>7)&3) == 2 ) ? "23" : "");
868 printf("%s LSP Encoding Type: %s (%u)",
870 tok2str(gmpls_encoding_values,
874 printf("%s Switching Type: %s (%u), Payload ID: %s (0x%04x)",
876 tok2str(gmpls_switch_cap_values,
880 tok2str(gmpls_payload_values,
882 EXTRACT_16BITS(obj_tptr+2)),
883 EXTRACT_16BITS(obj_tptr+2));
894 switch(rsvp_obj_ctype) {
895 case RSVP_CTYPE_IPV4:
896 while(obj_tlen >= 4 ) {
897 printf("%s Subobject Type: %s, length %u",
899 tok2str(rsvp_obj_xro_values,
901 RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr)),
904 if (*(obj_tptr+1) == 0) { /* prevent infinite loops */
905 printf("%s ERROR: zero length ERO subtype",ident);
909 switch(RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr)) {
910 case RSVP_OBJ_XRO_IPV4:
911 printf(", %s, %s/%u, Flags: [%s]",
912 RSVP_OBJ_XRO_MASK_LOOSE(*obj_tptr) ? "Loose" : "Strict",
913 ipaddr_string(obj_tptr+2),
915 bittok2str(rsvp_obj_rro_flag_values,
917 *(obj_tptr+7))); /* rfc3209 says that this field is rsvd. */
919 obj_tlen-=*(obj_tptr+1);
920 obj_tptr+=*(obj_tptr+1);
929 switch(rsvp_obj_ctype) {
934 printf("%s Source Instance: 0x%08x, Destination Instance: 0x%08x",
936 EXTRACT_32BITS(obj_tptr),
937 EXTRACT_32BITS(obj_tptr+4));
946 case RSVP_OBJ_RESTART_CAPABILITY:
947 switch(rsvp_obj_ctype) {
951 printf("%s Restart Time: %ums, Recovery Time: %ums",
953 EXTRACT_32BITS(obj_tptr),
954 EXTRACT_32BITS(obj_tptr+4));
963 case RSVP_OBJ_SESSION_ATTRIBUTE:
964 switch(rsvp_obj_ctype) {
965 case RSVP_CTYPE_TUNNEL_IPV4:
968 namelen = *(obj_tptr+3);
969 if (obj_tlen < 4+namelen)
971 printf("%s Session Name: ", ident);
972 for (i = 0; i < namelen; i++)
973 safeputchar(*(obj_tptr+4+i));
974 printf("%s Setup Priority: %u, Holding Priority: %u, Flags: [%s]",
978 tok2str(rsvp_session_attribute_flag_values,
982 obj_tlen-=4+*(obj_tptr+3);
983 obj_tptr+=4+*(obj_tptr+3);
990 case RSVP_OBJ_RSVP_HOP:
991 switch(rsvp_obj_ctype) {
992 case RSVP_CTYPE_3: /* fall through - FIXME add TLV parser */
993 case RSVP_CTYPE_IPV4:
996 printf("%s Previous/Next Interface: %s, Logical Interface Handle: 0x%08x",
998 ipaddr_string(obj_tptr),
999 EXTRACT_32BITS(obj_tptr+4));
1002 hexdump=TRUE; /* unless we have a TLV parser lets just hexdump */
1005 case RSVP_CTYPE_4: /* fall through - FIXME add TLV parser */
1006 case RSVP_CTYPE_IPV6:
1009 printf("%s Previous/Next Interface: %s, Logical Interface Handle: 0x%08x",
1011 ip6addr_string(obj_tptr),
1012 EXTRACT_32BITS(obj_tptr+16));
1015 hexdump=TRUE; /* unless we have a TLV parser lets just hexdump */
1023 case RSVP_OBJ_TIME_VALUES:
1024 switch(rsvp_obj_ctype) {
1028 printf("%s Refresh Period: %ums",
1030 EXTRACT_32BITS(obj_tptr));
1039 /* those three objects do share the same semantics */
1040 case RSVP_OBJ_SENDER_TSPEC:
1041 case RSVP_OBJ_ADSPEC:
1042 case RSVP_OBJ_FLOWSPEC:
1043 switch(rsvp_obj_ctype) {
1047 printf("%s Msg-Version: %u, length: %u",
1049 (*obj_tptr & 0xf0) >> 4,
1050 EXTRACT_16BITS(obj_tptr+2)<<2);
1051 obj_tptr+=4; /* get to the start of the service header */
1054 while (obj_tlen >= 4) {
1055 intserv_serv_tlen=EXTRACT_16BITS(obj_tptr+2)<<2;
1056 printf("%s Service Type: %s (%u), break bit %s set, Service length: %u",
1058 tok2str(rsvp_intserv_service_type_values,"unknown",*(obj_tptr)),
1060 (*(obj_tptr+1)&0x80) ? "" : "not",
1063 obj_tptr+=4; /* get to the start of the parameter list */
1066 while (intserv_serv_tlen>=4) {
1067 processed = rsvp_intserv_print(obj_tptr, obj_tlen);
1070 obj_tlen-=processed;
1071 intserv_serv_tlen-=processed;
1072 obj_tptr+=processed;
1081 case RSVP_OBJ_FILTERSPEC:
1082 switch(rsvp_obj_ctype) {
1083 case RSVP_CTYPE_IPV4:
1086 printf("%s Source Address: %s, Source Port: %u",
1088 ipaddr_string(obj_tptr),
1089 EXTRACT_16BITS(obj_tptr+6));
1094 case RSVP_CTYPE_IPV6:
1097 printf("%s Source Address: %s, Source Port: %u",
1099 ip6addr_string(obj_tptr),
1100 EXTRACT_16BITS(obj_tptr+18));
1107 printf("%s Source Address: %s, Flow Label: %u",
1109 ip6addr_string(obj_tptr),
1110 EXTRACT_24BITS(obj_tptr+17));
1114 case RSVP_CTYPE_TUNNEL_IPV6:
1117 printf("%s Source Address: %s, LSP-ID: 0x%04x",
1119 ipaddr_string(obj_tptr),
1120 EXTRACT_16BITS(obj_tptr+18));
1125 case RSVP_CTYPE_TUNNEL_IPV4:
1128 printf("%s Source Address: %s, LSP-ID: 0x%04x",
1130 ipaddr_string(obj_tptr),
1131 EXTRACT_16BITS(obj_tptr+6));
1140 case RSVP_OBJ_FASTREROUTE:
1141 switch(rsvp_obj_ctype) {
1142 case RSVP_CTYPE_TUNNEL_IPV4:
1145 bw.i = EXTRACT_32BITS(obj_tptr+4);
1146 printf("%s Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps",
1152 printf("%s Include Colors: 0x%08x, Exclude Colors: 0x%08x",
1154 EXTRACT_32BITS(obj_tptr+8),
1155 EXTRACT_32BITS(obj_tptr+12));
1164 case RSVP_OBJ_DETOUR:
1165 switch(rsvp_obj_ctype) {
1166 case RSVP_CTYPE_TUNNEL_IPV4:
1167 while(obj_tlen >= 8) {
1168 printf("%s PLR-ID: %s, Avoid-Node-ID: %s",
1170 ipaddr_string(obj_tptr),
1171 ipaddr_string(obj_tptr+4));
1181 case RSVP_OBJ_CLASSTYPE:
1182 switch(rsvp_obj_ctype) {
1184 printf("%s Class Type: %u",
1186 EXTRACT_32BITS(obj_tptr)&0x7);
1195 case RSVP_OBJ_ERROR_SPEC:
1196 switch(rsvp_obj_ctype) {
1197 case RSVP_CTYPE_3: /* fall through - FIXME add TLV parser */
1198 case RSVP_CTYPE_IPV4:
1201 error_code=*(obj_tptr+5);
1202 error_value=EXTRACT_16BITS(obj_tptr+6);
1203 printf("%s Error Node Address: %s, Flags: [0x%02x]%s Error Code: %s (%u)",
1205 ipaddr_string(obj_tptr),
1208 tok2str(rsvp_obj_error_code_values,"unknown",error_code),
1210 switch (error_code) {
1211 case RSVP_OBJ_ERROR_SPEC_CODE_ROUTING:
1212 printf(", Error Value: %s (%u)",
1213 tok2str(rsvp_obj_error_code_routing_values,"unknown",error_value),
1216 case RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE:
1217 printf(", Error Value: %s (%u)",
1218 tok2str(rsvp_obj_error_code_diffserv_te_values,"unknown",error_value),
1222 printf(", Unknown Error Value (%u)", error_value);
1229 case RSVP_CTYPE_4: /* fall through - FIXME add TLV parser */
1230 case RSVP_CTYPE_IPV6:
1233 error_code=*(obj_tptr+17);
1234 error_value=EXTRACT_16BITS(obj_tptr+18);
1235 printf("%s Error Node Address: %s, Flags: [0x%02x]%s Error Code: %s (%u)",
1237 ip6addr_string(obj_tptr),
1240 tok2str(rsvp_obj_error_code_values,"unknown",error_code),
1243 switch (error_code) {
1244 case RSVP_OBJ_ERROR_SPEC_CODE_ROUTING:
1245 printf(", Error Value: %s (%u)",
1246 tok2str(rsvp_obj_error_code_routing_values,"unknown",error_value),
1261 case RSVP_OBJ_PROPERTIES:
1262 switch(rsvp_obj_ctype) {
1266 padbytes = EXTRACT_16BITS(obj_tptr+2);
1267 printf("%s TLV count: %u, padding bytes: %u",
1269 EXTRACT_16BITS(obj_tptr),
1273 /* loop through as long there is anything longer than the TLV header (2) */
1274 while(obj_tlen >= 2 + padbytes) {
1275 printf("%s %s TLV (0x%02x), length: %u", /* length includes header */
1277 tok2str(rsvp_obj_prop_tlv_values,"unknown",*obj_tptr),
1280 if (obj_tlen < *(obj_tptr+1))
1282 if (*(obj_tptr+1) < 2)
1284 print_unknown_data(obj_tptr+2,"\n\t\t",*(obj_tptr+1)-2);
1285 obj_tlen-=*(obj_tptr+1);
1286 obj_tptr+=*(obj_tptr+1);
1294 case RSVP_OBJ_MESSAGE_ID: /* fall through */
1295 case RSVP_OBJ_MESSAGE_ID_ACK: /* fall through */
1296 case RSVP_OBJ_MESSAGE_ID_LIST:
1297 switch(rsvp_obj_ctype) {
1301 printf("%s Flags [0x%02x], epoch: %u",
1304 EXTRACT_24BITS(obj_tptr+1));
1307 /* loop through as long there are no messages left */
1308 while(obj_tlen >= 4) {
1309 printf("%s Message-ID 0x%08x (%u)",
1311 EXTRACT_32BITS(obj_tptr),
1312 EXTRACT_32BITS(obj_tptr));
1323 * FIXME those are the defined objects that lack a decoder
1324 * you are welcome to contribute code ;-)
1327 case RSVP_OBJ_INTEGRITY:
1328 case RSVP_OBJ_SCOPE:
1329 case RSVP_OBJ_POLICY_DATA:
1330 case RSVP_OBJ_LABEL_SET:
1331 case RSVP_OBJ_ACCEPT_LABEL_SET:
1332 case RSVP_OBJ_PROTECTION:
1335 print_unknown_data(obj_tptr,"\n\t ",obj_tlen); /* FIXME indentation */
1338 /* do we also want to see a hex dump ? */
1339 if (vflag > 1 || hexdump==TRUE)
1340 print_unknown_data(tptr+sizeof(sizeof(struct rsvp_object_header)),"\n\t ", /* FIXME indentation */
1341 rsvp_obj_len-sizeof(struct rsvp_object_header));
1348 printf("\n\t\t packet exceeded snapshot");
1354 rsvp_print(register const u_char *pptr, register u_int len) {
1356 const struct rsvp_common_header *rsvp_com_header;
1357 const u_char *tptr,*subtptr;
1358 u_short tlen,subtlen;
1362 rsvp_com_header = (const struct rsvp_common_header *)pptr;
1363 TCHECK(*rsvp_com_header);
1366 * Sanity checking of the header.
1368 if (RSVP_EXTRACT_VERSION(rsvp_com_header->version_flags) != RSVP_VERSION) {
1369 printf("ERROR: RSVP version %u packet not supported",
1370 RSVP_EXTRACT_VERSION(rsvp_com_header->version_flags));
1374 /* in non-verbose mode just lets print the basic Message Type*/
1376 printf("RSVPv%u %s Message, length: %u",
1377 RSVP_EXTRACT_VERSION(rsvp_com_header->version_flags),
1378 tok2str(rsvp_msg_type_values, "unknown (%u)",rsvp_com_header->msg_type),
1383 /* ok they seem to want to know everything - lets fully decode it */
1385 tlen=EXTRACT_16BITS(rsvp_com_header->length);
1387 printf("\n\tRSVPv%u %s Message (%u), Flags: [%s], length: %u, ttl: %u, checksum: 0x%04x",
1388 RSVP_EXTRACT_VERSION(rsvp_com_header->version_flags),
1389 tok2str(rsvp_msg_type_values, "unknown, type: %u",rsvp_com_header->msg_type),
1390 rsvp_com_header->msg_type,
1391 bittok2str(rsvp_header_flag_values,"none",RSVP_EXTRACT_FLAGS(rsvp_com_header->version_flags)),
1393 rsvp_com_header->ttl,
1394 EXTRACT_16BITS(rsvp_com_header->checksum));
1396 if (tlen < sizeof(const struct rsvp_common_header)) {
1397 printf("ERROR: common header too short %u < %lu", tlen,
1398 (unsigned long)sizeof(const struct rsvp_common_header));
1402 tptr+=sizeof(const struct rsvp_common_header);
1403 tlen-=sizeof(const struct rsvp_common_header);
1405 switch(rsvp_com_header->msg_type) {
1407 case RSVP_MSGTYPE_AGGREGATE:
1410 rsvp_com_header = (const struct rsvp_common_header *)subtptr;
1411 TCHECK(*rsvp_com_header);
1414 * Sanity checking of the header.
1416 if (RSVP_EXTRACT_VERSION(rsvp_com_header->version_flags) != RSVP_VERSION) {
1417 printf("ERROR: RSVP version %u packet not supported",
1418 RSVP_EXTRACT_VERSION(rsvp_com_header->version_flags));
1421 subtlen=EXTRACT_16BITS(rsvp_com_header->length);
1423 printf("\n\t RSVPv%u %s Message (%u), Flags: [%s], length: %u, ttl: %u, checksum: 0x%04x",
1424 RSVP_EXTRACT_VERSION(rsvp_com_header->version_flags),
1425 tok2str(rsvp_msg_type_values, "unknown, type: %u",rsvp_com_header->msg_type),
1426 rsvp_com_header->msg_type,
1427 bittok2str(rsvp_header_flag_values,"none",RSVP_EXTRACT_FLAGS(rsvp_com_header->version_flags)),
1429 rsvp_com_header->ttl,
1430 EXTRACT_16BITS(rsvp_com_header->checksum));
1432 if (subtlen < sizeof(const struct rsvp_common_header)) {
1433 printf("ERROR: common header too short %u < %lu", subtlen,
1434 (unsigned long)sizeof(const struct rsvp_common_header));
1438 if (tlen < subtlen) {
1439 printf("ERROR: common header too large %u > %u", subtlen,
1444 subtptr+=sizeof(const struct rsvp_common_header);
1445 subtlen-=sizeof(const struct rsvp_common_header);
1447 if (rsvp_obj_print(subtptr,"\n\t ", subtlen) == -1)
1450 tptr+=subtlen+sizeof(const struct rsvp_common_header);
1451 tlen-=subtlen+sizeof(const struct rsvp_common_header);
1456 case RSVP_MSGTYPE_PATH:
1457 case RSVP_MSGTYPE_RESV:
1458 case RSVP_MSGTYPE_PATHERR:
1459 case RSVP_MSGTYPE_RESVERR:
1460 case RSVP_MSGTYPE_PATHTEAR:
1461 case RSVP_MSGTYPE_RESVTEAR:
1462 case RSVP_MSGTYPE_RESVCONF:
1463 case RSVP_MSGTYPE_HELLO_OLD:
1464 case RSVP_MSGTYPE_HELLO:
1465 case RSVP_MSGTYPE_ACK:
1466 case RSVP_MSGTYPE_SREFRESH:
1467 if (rsvp_obj_print(tptr,"\n\t ", tlen) == -1)
1472 print_unknown_data(tptr,"\n\t ",tlen);
1478 printf("\n\t\t packet exceeded snapshot");