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
[] =
18 "@(#) $Header: /tcpdump/master/tcpdump/print-rsvp.c,v 1.13 2002-12-14 01:38:32 hannes Exp $";
25 #include <tcpdump-stdinc.h>
31 #include "interface.h"
33 #include "addrtoname.h"
34 #include "ethertype.h"
37 * RFC 2205 common header
40 * +-------------+-------------+-------------+-------------+
41 * | Vers | Flags| Msg Type | RSVP Checksum |
42 * +-------------+-------------+-------------+-------------+
43 * | Send_TTL | (Reserved) | RSVP Length |
44 * +-------------+-------------+-------------+-------------+
48 struct rsvp_common_header
{
49 u_int8_t version_flags
;
58 * RFC2205 object header
62 * +-------------+-------------+-------------+-------------+
63 * | Length (bytes) | Class-Num | C-Type |
64 * +-------------+-------------+-------------+-------------+
66 * // (Object contents) //
68 * +-------------+-------------+-------------+-------------+
71 struct rsvp_object_header
{
77 #define RSVP_VERSION 1
78 #define RSVP_EXTRACT_VERSION(x) (((x)&0xf0)>>4)
80 #define RSVP_MSGTYPE_PATH 1
81 #define RSVP_MSGTYPE_RESV 2
82 #define RSVP_MSGTYPE_PATHERR 3
83 #define RSVP_MSGTYPE_RESVERR 4
84 #define RSVP_MSGTYPE_PATHTEAR 5
85 #define RSVP_MSGTYPE_RESVTEAR 6
86 #define RSVP_MSGTYPE_RESVCONF 7
87 #define RSVP_MSGTYPE_AGGREGATE 12
88 #define RSVP_MSGTYPE_ACK 13
89 #define RSVP_MSGTYPE_HELLO_OLD 14 /* ancient Hellos */
90 #define RSVP_MSGTYPE_SREFRESH 15
91 #define RSVP_MSGTYPE_HELLO 20
93 static const struct tok rsvp_msg_type_values
[] = {
94 { RSVP_MSGTYPE_PATH
, "Path" },
95 { RSVP_MSGTYPE_RESV
, "Resv" },
96 { RSVP_MSGTYPE_PATHERR
, "PathErr" },
97 { RSVP_MSGTYPE_RESVERR
, "ResvErr" },
98 { RSVP_MSGTYPE_PATHTEAR
, "PathTear" },
99 { RSVP_MSGTYPE_RESVTEAR
, "ResvTear" },
100 { RSVP_MSGTYPE_RESVCONF
, "ResvConf" },
101 { RSVP_MSGTYPE_AGGREGATE
, "Aggregate" },
102 { RSVP_MSGTYPE_ACK
, "Acknowledgement" },
103 { RSVP_MSGTYPE_HELLO_OLD
, "Hello (Old)" },
104 { RSVP_MSGTYPE_SREFRESH
, "Refresh" },
105 { RSVP_MSGTYPE_HELLO
, "Hello" },
109 #define RSVP_OBJ_SESSION 1 /* rfc2205 */
110 #define RSVP_OBJ_RSVP_HOP 3 /* rfc2205 */
111 #define RSVP_OBJ_INTEGRITY 4
112 #define RSVP_OBJ_TIME_VALUES 5 /* rfc2205 */
113 #define RSVP_OBJ_ERROR_SPEC 6
114 #define RSVP_OBJ_SCOPE 7
115 #define RSVP_OBJ_STYLE 8 /* rfc2205 */
116 #define RSVP_OBJ_FLOWSPEC 9 /* rfc2215 */
117 #define RSVP_OBJ_FILTERSPEC 10 /* rfc2215 */
118 #define RSVP_OBJ_SENDER_TEMPLATE 11
119 #define RSVP_OBJ_SENDER_TSPEC 12 /* rfc2215 */
120 #define RSVP_OBJ_ADSPEC 13 /* rfc2215 */
121 #define RSVP_OBJ_POLICY_DATA 14
122 #define RSVP_OBJ_CONFIRM 15 /* rfc2205 */
123 #define RSVP_OBJ_LABEL 16 /* rfc3209 */
124 #define RSVP_OBJ_LABEL_REQ 19 /* rfc3209 */
125 #define RSVP_OBJ_ERO 20 /* rfc3209 */
126 #define RSVP_OBJ_RRO 21 /* rfc3209 */
127 #define RSVP_OBJ_HELLO 22 /* rfc3209 */
128 #define RSVP_OBJ_MESSAGE_ID 23
129 #define RSVP_OBJ_MESSAGE_ID_ACK 24
130 #define RSVP_OBJ_MESSAGE_ID_LIST 25
131 #define RSVP_OBJ_RECOVERY_LABEL 34
132 #define RSVP_OBJ_UPSTREAM_LABEL 35
133 #define RSVP_OBJ_DETOUR 63 /* draft-ietf-mpls-rsvp-lsp-fastreroute-01 */
134 #define RSVP_OBJ_SUGGESTED_LABEL 129
135 #define RSVP_OBJ_PROPERTIES 204
136 #define RSVP_OBJ_FASTREROUTE 205 /* draft-ietf-mpls-rsvp-lsp-fastreroute-01 */
137 #define RSVP_OBJ_SESSION_ATTRIBUTE 207 /* rfc3209 */
138 #define RSVP_OBJ_RESTART_CAPABILITY 131 /* draft-pan-rsvp-te-restart */
140 static const struct tok rsvp_obj_values
[] = {
141 { RSVP_OBJ_SESSION
, "Session" },
142 { RSVP_OBJ_RSVP_HOP
, "RSVP Hop" },
143 { RSVP_OBJ_INTEGRITY
, "Integrity" },
144 { RSVP_OBJ_TIME_VALUES
, "Time Values" },
145 { RSVP_OBJ_ERROR_SPEC
, "Error Spec" },
146 { RSVP_OBJ_SCOPE
, "Scope" },
147 { RSVP_OBJ_STYLE
, "Style" },
148 { RSVP_OBJ_FLOWSPEC
, "Flowspec" },
149 { RSVP_OBJ_FILTERSPEC
, "FilterSpec" },
150 { RSVP_OBJ_SENDER_TEMPLATE
, "Sender Template" },
151 { RSVP_OBJ_SENDER_TSPEC
, "Sender TSpec" },
152 { RSVP_OBJ_ADSPEC
, "Adspec" },
153 { RSVP_OBJ_POLICY_DATA
, "Policy Data" },
154 { RSVP_OBJ_CONFIRM
, "Confirm" },
155 { RSVP_OBJ_LABEL
, "Label" },
156 { RSVP_OBJ_LABEL_REQ
, "Label Request" },
157 { RSVP_OBJ_ERO
, "ERO" },
158 { RSVP_OBJ_RRO
, "RRO" },
159 { RSVP_OBJ_HELLO
, "Hello" },
160 { RSVP_OBJ_MESSAGE_ID
, "Message ID" },
161 { RSVP_OBJ_MESSAGE_ID_ACK
, "Message ID Ack" },
162 { RSVP_OBJ_MESSAGE_ID_LIST
, "Message ID List" },
163 { RSVP_OBJ_RECOVERY_LABEL
, "Recovery Label" },
164 { RSVP_OBJ_UPSTREAM_LABEL
, "Upstream Label" },
165 { RSVP_OBJ_DETOUR
, "Detour" },
166 { RSVP_OBJ_SUGGESTED_LABEL
, "Suggested Label" },
167 { RSVP_OBJ_PROPERTIES
, "Properties" },
168 { RSVP_OBJ_FASTREROUTE
, "Fast Re-Route" },
169 { RSVP_OBJ_SESSION_ATTRIBUTE
, "Session Attribute" },
170 { RSVP_OBJ_RESTART_CAPABILITY
, "Restart Capability" },
174 #define RSVP_CTYPE_IPV4 1
175 #define RSVP_CTYPE_IPV6 2
176 #define RSVP_CTYPE_TUNNEL_IPV4 7
177 #define RSVP_CTYPE_TUNNEL_IPV6 8
178 #define RSVP_CTYPE_1 1
179 #define RSVP_CTYPE_2 2
180 #define RSVP_CTYPE_3 3
183 * the ctypes are not globally unique so for
184 * translating it to strings we build a table based
185 * on objects offsetted by the ctype
188 static const struct tok rsvp_ctype_values
[] = {
189 { 256*RSVP_OBJ_RSVP_HOP
+RSVP_CTYPE_IPV4
, "IPv4" },
190 { 256*RSVP_OBJ_RSVP_HOP
+RSVP_CTYPE_IPV6
, "IPv6" },
191 { 256*RSVP_OBJ_CONFIRM
+RSVP_CTYPE_IPV4
, "IPv4" },
192 { 256*RSVP_OBJ_CONFIRM
+RSVP_CTYPE_IPV6
, "IPv6" },
193 { 256*RSVP_OBJ_TIME_VALUES
+RSVP_CTYPE_1
, "1" },
194 { 256*RSVP_OBJ_FLOWSPEC
+RSVP_CTYPE_1
, "obsolete" },
195 { 256*RSVP_OBJ_FLOWSPEC
+RSVP_CTYPE_2
, "IntServ" },
196 { 256*RSVP_OBJ_SENDER_TSPEC
+RSVP_CTYPE_2
, "IntServ" },
197 { 256*RSVP_OBJ_ADSPEC
+RSVP_CTYPE_2
, "IntServ" },
198 { 256*RSVP_OBJ_FILTERSPEC
+RSVP_CTYPE_IPV4
, "IPv4" },
199 { 256*RSVP_OBJ_FILTERSPEC
+RSVP_CTYPE_IPV6
, "IPv6" },
200 { 256*RSVP_OBJ_FILTERSPEC
+RSVP_CTYPE_3
, "IPv6 Flow-label" },
201 { 256*RSVP_OBJ_FILTERSPEC
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
202 { 256*RSVP_OBJ_SESSION
+RSVP_CTYPE_IPV4
, "IPv4" },
203 { 256*RSVP_OBJ_SESSION
+RSVP_CTYPE_IPV6
, "IPv6" },
204 { 256*RSVP_OBJ_SESSION
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
205 { 256*RSVP_OBJ_SENDER_TEMPLATE
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
206 { 256*RSVP_OBJ_STYLE
+RSVP_CTYPE_1
, "1" },
207 { 256*RSVP_OBJ_HELLO
+RSVP_CTYPE_1
, "Hello Request" },
208 { 256*RSVP_OBJ_HELLO
+RSVP_CTYPE_2
, "Hello Ack" },
209 { 256*RSVP_OBJ_LABEL_REQ
+RSVP_CTYPE_1
, "without label range" },
210 { 256*RSVP_OBJ_LABEL_REQ
+RSVP_CTYPE_2
, "with ATM label range" },
211 { 256*RSVP_OBJ_LABEL_REQ
+RSVP_CTYPE_3
, "with FR label range" },
212 { 256*RSVP_OBJ_LABEL
+RSVP_CTYPE_1
, "1" },
213 { 256*RSVP_OBJ_ERO
+RSVP_CTYPE_IPV4
, "IPv4" },
214 { 256*RSVP_OBJ_RRO
+RSVP_CTYPE_IPV4
, "IPv4" },
215 { 256*RSVP_OBJ_RESTART_CAPABILITY
+RSVP_CTYPE_1
, "IPv4" },
216 { 256*RSVP_OBJ_SESSION_ATTRIBUTE
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
217 { 256*RSVP_OBJ_FASTREROUTE
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
218 { 256*RSVP_OBJ_DETOUR
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
222 #define RSVP_OBJ_XRO_MASK_SUBOBJ(x) ((x)&0x7f)
223 #define RSVP_OBJ_XRO_MASK_LOOSE(x) ((x)&0x80)
225 #define RSVP_OBJ_XRO_RES 0
226 #define RSVP_OBJ_XRO_IPV4 1
227 #define RSVP_OBJ_XRO_IPV6 2
228 #define RSVP_OBJ_XRO_ASN 32
229 #define RSVP_OBJ_XRO_MPLS 64
231 static const struct tok rsvp_obj_xro_values
[] = {
232 { RSVP_OBJ_XRO_RES
, "Reserved" },
233 { RSVP_OBJ_XRO_IPV4
, "IPv4 prefix" },
234 { RSVP_OBJ_XRO_IPV6
, "IPv6 prefix" },
235 { RSVP_OBJ_XRO_ASN
, "Autonomous system number" },
236 { RSVP_OBJ_XRO_MPLS
, "MPLS label switched path termination" },
240 static const struct tok rsvp_resstyle_values
[] = {
241 { 17, "Wildcard Filter" },
242 { 10, "Fixed Filter" },
243 { 18, "Shared Explicit" },
247 #define RSVP_OBJ_INTSERV_GUARANTEED_SERV 2
248 #define RSVP_OBJ_INTSERV_CONTROLLED_LOAD 5
250 static const struct tok rsvp_intserv_service_type_values
[] = {
251 { 1, "Default/Global Information" },
252 { RSVP_OBJ_INTSERV_GUARANTEED_SERV
, "Guaranteed Service" },
253 { RSVP_OBJ_INTSERV_CONTROLLED_LOAD
, "Controlled Load" },
257 static const struct tok rsvp_intserv_parameter_id_values
[] = {
259 { 6, "Path b/w estimate" },
260 { 8, "Minimum path latency" },
261 { 10, "Composed MTU" },
262 { 127, "Token Bucket TSpec" },
263 { 130, "Guaranteed Service RSpec" },
267 static struct tok rsvp_session_attribute_flag_values
[] = {
268 { 1, "Local Protection desired" },
269 { 2, "Label Recording desired" },
270 { 4, "SE Style desired" },
278 int rsvp_intserv_print(const u_char
*);
281 * this is a dissector for all the intserv defined
282 * specs as defined per rfc2215
283 * it is called from various rsvp objects;
284 * returns the amount of bytes being processed
287 rsvp_intserv_print(const u_char
*tptr
) {
289 int parameter_id
,parameter_length
;
295 parameter_id
= *(tptr
);
296 parameter_length
= EXTRACT_16BITS(tptr
+2)<<2; /* convert wordcount to bytecount */
298 printf("\n\t Parameter ID: %s (%u), length: %u, Flags: [0x%02x]",
299 tok2str(rsvp_intserv_parameter_id_values
,"unknown",parameter_id
),
304 switch(parameter_id
) { /* parameter_id */
308 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
309 * | 4 (e) | (f) | 1 (g) |
310 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
311 * | IS hop cnt (32-bit unsigned integer) |
312 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
314 printf("\n\t\tIS hop cnt: %u", EXTRACT_32BITS(tptr
+4));
319 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
320 * | 6 (h) | (i) | 1 (j) |
321 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
322 * | Path b/w estimate (32-bit IEEE floating point number) |
323 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
325 bw
.i
= EXTRACT_32BITS(tptr
+4);
326 printf("\n\t\tPath b/w estimate: %.10g Mbps", bw
.f
/125000);
331 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
332 * | 8 (k) | (l) | 1 (m) |
333 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
334 * | Minimum path latency (32-bit integer) |
335 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
337 printf("\n\t\tMinimum path latency: ");
338 if (EXTRACT_32BITS(tptr
+4) == 0xffffffff)
339 printf("don't care");
341 printf("%u", EXTRACT_32BITS(tptr
+4));
347 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
348 * | 10 (n) | (o) | 1 (p) |
349 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
350 * | Composed MTU (32-bit unsigned integer) |
351 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
353 printf("\n\t\tComposed MTU: %u bytes", EXTRACT_32BITS(tptr
+4));
357 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
358 * | 127 (e) | 0 (f) | 5 (g) |
359 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
360 * | Token Bucket Rate [r] (32-bit IEEE floating point number) |
361 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
362 * | Token Bucket Size [b] (32-bit IEEE floating point number) |
363 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
364 * | Peak Data Rate [p] (32-bit IEEE floating point number) |
365 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
366 * | Minimum Policed Unit [m] (32-bit integer) |
367 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
368 * | Maximum Packet Size [M] (32-bit integer) |
369 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
372 bw
.i
= EXTRACT_32BITS(tptr
+4);
373 printf("\n\t\tToken Bucket Rate: %.10g Mbps", bw
.f
/125000);
374 bw
.i
= EXTRACT_32BITS(tptr
+8);
375 printf("\n\t\tToken Bucket Size: %.10g bytes", bw
.f
);
376 bw
.i
= EXTRACT_32BITS(tptr
+12);
377 printf("\n\t\tPeak Data Rate: %.10g Mbps", bw
.f
/125000);
378 printf("\n\t\tMinimum Policed Unit: %u bytes", EXTRACT_32BITS(tptr
+16));
379 printf("\n\t\tMaximum Packet Size: %u bytes", EXTRACT_32BITS(tptr
+20));
384 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
385 * | 130 (h) | 0 (i) | 2 (j) |
386 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
387 * | Rate [R] (32-bit IEEE floating point number) |
388 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
389 * | Slack Term [S] (32-bit integer) |
390 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
393 bw
.i
= EXTRACT_32BITS(tptr
+4);
394 printf("\n\t\tRate: %.10g Mbps", bw
.f
/125000);
395 printf("\n\t\tSlack Term: %u", EXTRACT_32BITS(tptr
+8));
398 * FIXME those are the defined paramters that lack a decoder
399 * you are welcome to contribute code ;-)
408 print_unknown_data(tptr
+4,"\n\t\t",parameter_length
);
410 return (parameter_length
+4); /* header length 4 bytes */
414 rsvp_print(register const u_char
*pptr
, register u_int len
) {
416 const struct rsvp_common_header
*rsvp_com_header
;
417 const struct rsvp_object_header
*rsvp_obj_header
;
418 const u_char
*tptr
,*obj_tptr
;
419 u_short tlen
,rsvp_obj_len
,rsvp_obj_ctype
,obj_tlen
,intserv_serv_tlen
;
420 int hexdump
,processed
;
427 rsvp_com_header
= (const struct rsvp_common_header
*)pptr
;
428 TCHECK(*rsvp_com_header
);
431 * Sanity checking of the header.
433 if (RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
) != RSVP_VERSION
) {
434 printf("RSVP version %u packet not supported",
435 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
));
439 /* in non-verbose mode just lets print the basic Message Type*/
441 printf("RSVP %s Message, length: %u",
442 tok2str(rsvp_msg_type_values
, "unknown (%u)",rsvp_com_header
->msg_type
),
447 /* ok they seem to want to know everything - lets fully decode it */
449 tlen
=EXTRACT_16BITS(rsvp_com_header
->length
);
451 printf("RSVP\n\tv: %u, msg-type: %s, length: %u, ttl: %u, checksum: 0x%04x",
452 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
),
453 tok2str(rsvp_msg_type_values
, "unknown, type: %u",rsvp_com_header
->msg_type
),
455 rsvp_com_header
->ttl
,
456 EXTRACT_16BITS(rsvp_com_header
->checksum
));
458 tptr
+=sizeof(const struct rsvp_common_header
);
459 tlen
-=sizeof(const struct rsvp_common_header
);
462 /* did we capture enough for fully decoding the object header ? */
463 if (!TTEST2(*tptr
, sizeof(struct rsvp_object_header
)))
466 rsvp_obj_header
= (const struct rsvp_object_header
*)tptr
;
467 rsvp_obj_len
=EXTRACT_16BITS(rsvp_obj_header
->length
);
468 rsvp_obj_ctype
=rsvp_obj_header
->ctype
;
470 if(rsvp_obj_len
% 4 || rsvp_obj_len
< 4)
473 printf("\n\t %s Object (%u) Flags: [%s",
474 tok2str(rsvp_obj_values
,
476 rsvp_obj_header
->class_num
),
477 rsvp_obj_header
->class_num
,
478 ((rsvp_obj_header
->class_num
)&0x80) ? "ignore" : "reject");
480 if (rsvp_obj_header
->class_num
> 128)
482 ((rsvp_obj_header
->class_num
)&0x40) ? "and forward" : "silently");
484 printf(" if unknown], Class-Type: %s (%u), length: %u",
485 tok2str(rsvp_ctype_values
,
487 ((rsvp_obj_header
->class_num
)<<8)+rsvp_obj_ctype
),
491 obj_tptr
=tptr
+sizeof(struct rsvp_object_header
);
492 obj_tlen
=rsvp_obj_len
-sizeof(struct rsvp_object_header
);
494 /* did we capture enough for fully decoding the object ? */
495 if (!TTEST2(*tptr
, rsvp_obj_len
))
499 switch(rsvp_obj_header
->class_num
) {
500 case RSVP_OBJ_SESSION
:
501 switch(rsvp_obj_ctype
) {
502 case RSVP_CTYPE_IPV4
:
503 printf("\n\t IPv4 DestAddress: %s, Protocol ID: 0x%02x",
504 ipaddr_string(obj_tptr
),
506 printf("\n\t Flags: [0x%02x], DestPort %u",
508 EXTRACT_16BITS(obj_tptr
+6));
513 case RSVP_CTYPE_IPV6
:
514 printf("\n\t IPv6 DestAddress: %s, Protocol ID: 0x%02x",
515 ip6addr_string(obj_tptr
),
517 printf("\n\t Flags: [0x%02x], DestPort %u",
519 EXTRACT_16BITS(obj_tptr
+18));
524 case RSVP_CTYPE_TUNNEL_IPV6
:
525 printf("\n\t IPv6 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
526 ip6addr_string(obj_tptr
),
527 EXTRACT_16BITS(obj_tptr
+18),
528 ip6addr_string(obj_tptr
+20));
533 case RSVP_CTYPE_TUNNEL_IPV4
:
534 printf("\n\t IPv4 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
535 ipaddr_string(obj_tptr
),
536 EXTRACT_16BITS(obj_tptr
+6),
537 ipaddr_string(obj_tptr
+8));
546 case RSVP_OBJ_CONFIRM
:
547 switch(rsvp_obj_ctype
) {
548 case RSVP_CTYPE_IPV4
:
549 printf("\n\t IPv4 ReceiverAddress: %s",
550 ipaddr_string(obj_tptr
));
555 case RSVP_CTYPE_IPV6
:
556 printf("\n\t IPv6 ReceiverAddress: %s",
557 ip6addr_string(obj_tptr
));
568 switch(rsvp_obj_ctype
) {
570 while(obj_tlen
>= 4 ) {
571 printf("\n\t Label: %u", EXTRACT_32BITS(obj_tptr
));
582 switch(rsvp_obj_ctype
) {
584 printf("\n\t Reservation Style: %s, Flags: [0x%02x]",
585 tok2str(rsvp_resstyle_values
,
587 EXTRACT_24BITS(obj_tptr
+1)),
597 case RSVP_OBJ_SENDER_TEMPLATE
:
598 switch(rsvp_obj_ctype
) {
599 case RSVP_CTYPE_TUNNEL_IPV4
:
600 printf("\n\t IPv4 Tunnel Sender Address: %s, LSP-ID: 0x%04x",
601 ipaddr_string(obj_tptr
),
602 EXTRACT_16BITS(obj_tptr
+6));
611 case RSVP_OBJ_LABEL_REQ
:
612 switch(rsvp_obj_ctype
) {
614 while(obj_tlen
>= 4 ) {
615 printf("\n\t L3 Protocol ID: %s",
616 tok2str(ethertype_values
,
617 "Unknown Protocol 0x%04x",
618 EXTRACT_16BITS(obj_tptr
+2)));
624 printf("\n\t L3 Protocol ID: %s",
625 tok2str(ethertype_values
,
626 "Unknown Protocol 0x%04x",
627 EXTRACT_16BITS(obj_tptr
+2)));
628 printf(",%s merge capability",((*(obj_tptr
+4))&0x80) ? "no" : "" );
629 printf("\n\t Minimum VPI/VCI %u/%u",
630 (EXTRACT_16BITS(obj_tptr
+4))&0xfff,
631 (EXTRACT_16BITS(obj_tptr
+6))&0xfff);
632 printf("\n\t Maximum VPI/VCI %u/%u",
633 (EXTRACT_16BITS(obj_tptr
+8))&0xfff,
634 (EXTRACT_16BITS(obj_tptr
+10))&0xfff);
639 printf("\n\t L3 Protocol ID: %s",
640 tok2str(ethertype_values
,
641 "Unknown Protocol 0x%04x",
642 EXTRACT_16BITS(obj_tptr
+2)));
643 printf("\n\t Minimum/Maximum DLCI %u/%u, %s%s bit DLCI",
644 (EXTRACT_32BITS(obj_tptr
+4))&0x7fffff,
645 (EXTRACT_32BITS(obj_tptr
+8))&0x7fffff,
646 (((EXTRACT_16BITS(obj_tptr
+4)>>7)&3) == 0 ) ? "10" : "",
647 (((EXTRACT_16BITS(obj_tptr
+4)>>7)&3) == 2 ) ? "23" : "");
658 switch(rsvp_obj_ctype
) {
659 case RSVP_CTYPE_IPV4
:
660 while(obj_tlen
>= 4 ) {
661 printf("\n\t Subobject Type: %s",
662 tok2str(rsvp_obj_xro_values
,
664 RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr
)));
665 switch(RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr
)) {
666 case RSVP_OBJ_XRO_IPV4
:
667 printf(", %s, %s/%u",
668 RSVP_OBJ_XRO_MASK_LOOSE(*obj_tptr
) ? "Loose" : "Strict",
669 ipaddr_string(obj_tptr
+2),
672 obj_tlen
-=*(obj_tptr
+1);
673 obj_tptr
+=*(obj_tptr
+1);
682 switch(rsvp_obj_ctype
) {
685 printf("\n\t Source Instance 0x%08x, Destination Instance 0x%08x",
686 EXTRACT_32BITS(obj_tptr
),
687 EXTRACT_32BITS(obj_tptr
+4));
696 case RSVP_OBJ_RESTART_CAPABILITY
:
697 switch(rsvp_obj_ctype
) {
699 printf("\n\t Restart Time: %ums\n\t Recovery Time: %ums",
700 EXTRACT_16BITS(obj_tptr
),
701 EXTRACT_16BITS(obj_tptr
+4));
708 case RSVP_OBJ_SESSION_ATTRIBUTE
:
709 switch(rsvp_obj_ctype
) {
710 case RSVP_CTYPE_TUNNEL_IPV4
:
711 printf("\n\t Session Name: %s",(obj_tptr
+3));
712 printf("\n\t Setup Priority: %u, Holding Priority: %u, Flags: [%s]",
715 tok2str(rsvp_session_attribute_flag_values
,
719 obj_tlen
-=4+*(obj_tptr
+3);
720 obj_tptr
+=4+*(obj_tptr
+3);
727 case RSVP_OBJ_RSVP_HOP
:
728 switch(rsvp_obj_ctype
) {
729 case RSVP_CTYPE_IPV4
:
730 printf("\n\t Previous/Next Interface: %s, Logical Interface Handle: 0x%08x",
731 ipaddr_string(obj_tptr
),
732 EXTRACT_32BITS(obj_tptr
+4));
737 case RSVP_CTYPE_IPV6
:
738 printf("\n\t Previous/Next Interface: %s, Logical Interface Handle: 0x%08x",
739 ip6addr_string(obj_tptr
),
740 EXTRACT_32BITS(obj_tptr
+16));
750 case RSVP_OBJ_TIME_VALUES
:
751 switch(rsvp_obj_ctype
) {
753 printf("\n\t Refresh Period: %ums",
754 EXTRACT_32BITS(obj_tptr
));
763 /* those three objects do share the same semantics */
764 case RSVP_OBJ_SENDER_TSPEC
:
765 case RSVP_OBJ_ADSPEC
:
766 case RSVP_OBJ_FLOWSPEC
:
767 switch(rsvp_obj_ctype
) {
769 printf("\n\t Msg-Version: %u, length: %u",
770 (*obj_tptr
& 0xf0) >> 4,
771 EXTRACT_16BITS(obj_tptr
+2)<<2);
772 obj_tptr
+=4; /* get to the start of the service header */
775 while (obj_tlen
>= 8) {
776 intserv_serv_tlen
=EXTRACT_16BITS(obj_tptr
+2)<<2;
777 printf("\n\t Service Type: %s (%u), Service length: %u",
778 tok2str(rsvp_intserv_service_type_values
,"unknown",*(obj_tptr
)),
782 obj_tptr
+=4; /* get to the start of the parameter list */
785 while (intserv_serv_tlen
>=4) {
786 processed
= rsvp_intserv_print(obj_tptr
);
790 intserv_serv_tlen
-=processed
;
800 case RSVP_OBJ_FILTERSPEC
:
801 switch(rsvp_obj_ctype
) {
802 case RSVP_CTYPE_IPV4
:
803 printf("\n\t Source Address: %s, Source Port: %u",
804 ipaddr_string(obj_tptr
),
805 EXTRACT_16BITS(obj_tptr
+6));
810 case RSVP_CTYPE_IPV6
:
811 printf("\n\t Source Address: %s, Source Port: %u",
812 ip6addr_string(obj_tptr
),
813 EXTRACT_16BITS(obj_tptr
+18));
818 printf("\n\t Source Address: %s, Flow Label: %u",
819 ip6addr_string(obj_tptr
),
820 EXTRACT_24BITS(obj_tptr
+17));
824 case RSVP_CTYPE_TUNNEL_IPV6
:
825 printf("\n\t Source Address: %s, LSP-ID: 0x%04x",
826 ipaddr_string(obj_tptr
),
827 EXTRACT_16BITS(obj_tptr
+18));
832 case RSVP_CTYPE_TUNNEL_IPV4
:
833 printf("\n\t Source Address: %s, LSP-ID: 0x%04x",
834 ipaddr_string(obj_tptr
),
835 EXTRACT_16BITS(obj_tptr
+6));
844 case RSVP_OBJ_FASTREROUTE
:
845 switch(rsvp_obj_ctype
) {
846 case RSVP_CTYPE_TUNNEL_IPV4
:
847 bw
.i
= EXTRACT_32BITS(obj_tptr
+4);
848 printf("\n\t Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps",
853 printf("\n\t Include Colors: 0x%08x, Exclude Colors: 0x%08x",
854 EXTRACT_32BITS(obj_tptr
+8),
855 EXTRACT_32BITS(obj_tptr
+12));
864 case RSVP_OBJ_DETOUR
:
865 switch(rsvp_obj_ctype
) {
866 case RSVP_CTYPE_TUNNEL_IPV4
:
867 while(obj_tlen
>= 8) {
868 printf("\n\t PLR-ID: %s, Avoid-Node-ID: %s",
869 ipaddr_string(obj_tptr
),
870 ipaddr_string(obj_tptr
+4));
881 * FIXME those are the defined objects that lack a decoder
882 * you are welcome to contribute code ;-)
885 case RSVP_OBJ_INTEGRITY
:
886 case RSVP_OBJ_ERROR_SPEC
:
888 case RSVP_OBJ_POLICY_DATA
:
889 case RSVP_OBJ_MESSAGE_ID
:
890 case RSVP_OBJ_MESSAGE_ID_ACK
:
891 case RSVP_OBJ_MESSAGE_ID_LIST
:
892 case RSVP_OBJ_RECOVERY_LABEL
:
893 case RSVP_OBJ_UPSTREAM_LABEL
:
894 case RSVP_OBJ_SUGGESTED_LABEL
:
895 case RSVP_OBJ_PROPERTIES
:
898 print_unknown_data(obj_tptr
,"\n\t ",obj_tlen
);
901 /* do we want to see an additionally hexdump ? */
902 if (vflag
> 1 || hexdump
==TRUE
)
903 print_unknown_data(tptr
+sizeof(sizeof(struct rsvp_object_header
)),"\n\t ",
904 rsvp_obj_len
-sizeof(struct rsvp_object_header
));
911 printf("\n\t\t packet exceeded snapshot");