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.14 2002-12-14 02:03:10 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_IPV4
, "IPv4" },
206 { 256*RSVP_OBJ_SENDER_TEMPLATE
+RSVP_CTYPE_IPV6
, "IPv6" },
207 { 256*RSVP_OBJ_SENDER_TEMPLATE
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
208 { 256*RSVP_OBJ_STYLE
+RSVP_CTYPE_1
, "1" },
209 { 256*RSVP_OBJ_HELLO
+RSVP_CTYPE_1
, "Hello Request" },
210 { 256*RSVP_OBJ_HELLO
+RSVP_CTYPE_2
, "Hello Ack" },
211 { 256*RSVP_OBJ_LABEL_REQ
+RSVP_CTYPE_1
, "without label range" },
212 { 256*RSVP_OBJ_LABEL_REQ
+RSVP_CTYPE_2
, "with ATM label range" },
213 { 256*RSVP_OBJ_LABEL_REQ
+RSVP_CTYPE_3
, "with FR label range" },
214 { 256*RSVP_OBJ_LABEL
+RSVP_CTYPE_1
, "1" },
215 { 256*RSVP_OBJ_ERO
+RSVP_CTYPE_IPV4
, "IPv4" },
216 { 256*RSVP_OBJ_RRO
+RSVP_CTYPE_IPV4
, "IPv4" },
217 { 256*RSVP_OBJ_RESTART_CAPABILITY
+RSVP_CTYPE_1
, "IPv4" },
218 { 256*RSVP_OBJ_SESSION_ATTRIBUTE
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
219 { 256*RSVP_OBJ_FASTREROUTE
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
220 { 256*RSVP_OBJ_DETOUR
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
224 #define RSVP_OBJ_XRO_MASK_SUBOBJ(x) ((x)&0x7f)
225 #define RSVP_OBJ_XRO_MASK_LOOSE(x) ((x)&0x80)
227 #define RSVP_OBJ_XRO_RES 0
228 #define RSVP_OBJ_XRO_IPV4 1
229 #define RSVP_OBJ_XRO_IPV6 2
230 #define RSVP_OBJ_XRO_ASN 32
231 #define RSVP_OBJ_XRO_MPLS 64
233 static const struct tok rsvp_obj_xro_values
[] = {
234 { RSVP_OBJ_XRO_RES
, "Reserved" },
235 { RSVP_OBJ_XRO_IPV4
, "IPv4 prefix" },
236 { RSVP_OBJ_XRO_IPV6
, "IPv6 prefix" },
237 { RSVP_OBJ_XRO_ASN
, "Autonomous system number" },
238 { RSVP_OBJ_XRO_MPLS
, "MPLS label switched path termination" },
242 static const struct tok rsvp_resstyle_values
[] = {
243 { 17, "Wildcard Filter" },
244 { 10, "Fixed Filter" },
245 { 18, "Shared Explicit" },
249 #define RSVP_OBJ_INTSERV_GUARANTEED_SERV 2
250 #define RSVP_OBJ_INTSERV_CONTROLLED_LOAD 5
252 static const struct tok rsvp_intserv_service_type_values
[] = {
253 { 1, "Default/Global Information" },
254 { RSVP_OBJ_INTSERV_GUARANTEED_SERV
, "Guaranteed Service" },
255 { RSVP_OBJ_INTSERV_CONTROLLED_LOAD
, "Controlled Load" },
259 static const struct tok rsvp_intserv_parameter_id_values
[] = {
261 { 6, "Path b/w estimate" },
262 { 8, "Minimum path latency" },
263 { 10, "Composed MTU" },
264 { 127, "Token Bucket TSpec" },
265 { 130, "Guaranteed Service RSpec" },
266 { 133, "End-to-end composed value for C" },
267 { 134, "End-to-end composed value for D" },
268 { 135, "Since-last-reshaping point composed C" },
269 { 136, "Since-last-reshaping point composed D" },
273 static struct tok rsvp_session_attribute_flag_values
[] = {
274 { 1, "Local Protection desired" },
275 { 2, "Label Recording desired" },
276 { 4, "SE Style desired" },
284 int rsvp_intserv_print(const u_char
*);
287 * this is a dissector for all the intserv defined
288 * specs as defined per rfc2215
289 * it is called from various rsvp objects;
290 * returns the amount of bytes being processed
293 rsvp_intserv_print(const u_char
*tptr
) {
295 int parameter_id
,parameter_length
;
301 parameter_id
= *(tptr
);
302 parameter_length
= EXTRACT_16BITS(tptr
+2)<<2; /* convert wordcount to bytecount */
304 printf("\n\t Parameter ID: %s (%u), length: %u, Flags: [0x%02x]",
305 tok2str(rsvp_intserv_parameter_id_values
,"unknown",parameter_id
),
310 switch(parameter_id
) { /* parameter_id */
314 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
315 * | 4 (e) | (f) | 1 (g) |
316 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
317 * | IS hop cnt (32-bit unsigned integer) |
318 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
320 printf("\n\t\tIS hop cnt: %u", EXTRACT_32BITS(tptr
+4));
325 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
326 * | 6 (h) | (i) | 1 (j) |
327 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
328 * | Path b/w estimate (32-bit IEEE floating point number) |
329 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
331 bw
.i
= EXTRACT_32BITS(tptr
+4);
332 printf("\n\t\tPath b/w estimate: %.10g Mbps", bw
.f
/125000);
337 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
338 * | 8 (k) | (l) | 1 (m) |
339 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
340 * | Minimum path latency (32-bit integer) |
341 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
343 printf("\n\t\tMinimum path latency: ");
344 if (EXTRACT_32BITS(tptr
+4) == 0xffffffff)
345 printf("don't care");
347 printf("%u", EXTRACT_32BITS(tptr
+4));
353 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
354 * | 10 (n) | (o) | 1 (p) |
355 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
356 * | Composed MTU (32-bit unsigned integer) |
357 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
359 printf("\n\t\tComposed MTU: %u bytes", EXTRACT_32BITS(tptr
+4));
363 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
364 * | 127 (e) | 0 (f) | 5 (g) |
365 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
366 * | Token Bucket Rate [r] (32-bit IEEE floating point number) |
367 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
368 * | Token Bucket Size [b] (32-bit IEEE floating point number) |
369 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
370 * | Peak Data Rate [p] (32-bit IEEE floating point number) |
371 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
372 * | Minimum Policed Unit [m] (32-bit integer) |
373 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
374 * | Maximum Packet Size [M] (32-bit integer) |
375 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
378 bw
.i
= EXTRACT_32BITS(tptr
+4);
379 printf("\n\t\tToken Bucket Rate: %.10g Mbps", bw
.f
/125000);
380 bw
.i
= EXTRACT_32BITS(tptr
+8);
381 printf("\n\t\tToken Bucket Size: %.10g bytes", bw
.f
);
382 bw
.i
= EXTRACT_32BITS(tptr
+12);
383 printf("\n\t\tPeak Data Rate: %.10g Mbps", bw
.f
/125000);
384 printf("\n\t\tMinimum Policed Unit: %u bytes", EXTRACT_32BITS(tptr
+16));
385 printf("\n\t\tMaximum Packet Size: %u bytes", EXTRACT_32BITS(tptr
+20));
390 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
391 * | 130 (h) | 0 (i) | 2 (j) |
392 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
393 * | Rate [R] (32-bit IEEE floating point number) |
394 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
395 * | Slack Term [S] (32-bit integer) |
396 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
399 bw
.i
= EXTRACT_32BITS(tptr
+4);
400 printf("\n\t\tRate: %.10g Mbps", bw
.f
/125000);
401 printf("\n\t\tSlack Term: %u", EXTRACT_32BITS(tptr
+8));
408 printf("\n\t\tValue: %u", EXTRACT_32BITS(tptr
+4));
413 print_unknown_data(tptr
+4,"\n\t\t",parameter_length
);
415 return (parameter_length
+4); /* header length 4 bytes */
419 rsvp_print(register const u_char
*pptr
, register u_int len
) {
421 const struct rsvp_common_header
*rsvp_com_header
;
422 const struct rsvp_object_header
*rsvp_obj_header
;
423 const u_char
*tptr
,*obj_tptr
;
424 u_short tlen
,rsvp_obj_len
,rsvp_obj_ctype
,obj_tlen
,intserv_serv_tlen
;
425 int hexdump
,processed
;
432 rsvp_com_header
= (const struct rsvp_common_header
*)pptr
;
433 TCHECK(*rsvp_com_header
);
436 * Sanity checking of the header.
438 if (RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
) != RSVP_VERSION
) {
439 printf("RSVP version %u packet not supported",
440 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
));
444 /* in non-verbose mode just lets print the basic Message Type*/
446 printf("RSVP %s Message, length: %u",
447 tok2str(rsvp_msg_type_values
, "unknown (%u)",rsvp_com_header
->msg_type
),
452 /* ok they seem to want to know everything - lets fully decode it */
454 tlen
=EXTRACT_16BITS(rsvp_com_header
->length
);
456 printf("RSVP\n\tv: %u, msg-type: %s, length: %u, ttl: %u, checksum: 0x%04x",
457 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
),
458 tok2str(rsvp_msg_type_values
, "unknown, type: %u",rsvp_com_header
->msg_type
),
460 rsvp_com_header
->ttl
,
461 EXTRACT_16BITS(rsvp_com_header
->checksum
));
463 tptr
+=sizeof(const struct rsvp_common_header
);
464 tlen
-=sizeof(const struct rsvp_common_header
);
467 /* did we capture enough for fully decoding the object header ? */
468 if (!TTEST2(*tptr
, sizeof(struct rsvp_object_header
)))
471 rsvp_obj_header
= (const struct rsvp_object_header
*)tptr
;
472 rsvp_obj_len
=EXTRACT_16BITS(rsvp_obj_header
->length
);
473 rsvp_obj_ctype
=rsvp_obj_header
->ctype
;
475 if(rsvp_obj_len
% 4 || rsvp_obj_len
< 4)
478 printf("\n\t %s Object (%u) Flags: [%s",
479 tok2str(rsvp_obj_values
,
481 rsvp_obj_header
->class_num
),
482 rsvp_obj_header
->class_num
,
483 ((rsvp_obj_header
->class_num
)&0x80) ? "ignore" : "reject");
485 if (rsvp_obj_header
->class_num
> 128)
487 ((rsvp_obj_header
->class_num
)&0x40) ? "and forward" : "silently");
489 printf(" if unknown], Class-Type: %s (%u), length: %u",
490 tok2str(rsvp_ctype_values
,
492 ((rsvp_obj_header
->class_num
)<<8)+rsvp_obj_ctype
),
496 obj_tptr
=tptr
+sizeof(struct rsvp_object_header
);
497 obj_tlen
=rsvp_obj_len
-sizeof(struct rsvp_object_header
);
499 /* did we capture enough for fully decoding the object ? */
500 if (!TTEST2(*tptr
, rsvp_obj_len
))
504 switch(rsvp_obj_header
->class_num
) {
505 case RSVP_OBJ_SESSION
:
506 switch(rsvp_obj_ctype
) {
507 case RSVP_CTYPE_IPV4
:
508 printf("\n\t IPv4 DestAddress: %s, Protocol ID: 0x%02x",
509 ipaddr_string(obj_tptr
),
511 printf("\n\t Flags: [0x%02x], DestPort %u",
513 EXTRACT_16BITS(obj_tptr
+6));
518 case RSVP_CTYPE_IPV6
:
519 printf("\n\t IPv6 DestAddress: %s, Protocol ID: 0x%02x",
520 ip6addr_string(obj_tptr
),
522 printf("\n\t Flags: [0x%02x], DestPort %u",
524 EXTRACT_16BITS(obj_tptr
+18));
529 case RSVP_CTYPE_TUNNEL_IPV6
:
530 printf("\n\t IPv6 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
531 ip6addr_string(obj_tptr
),
532 EXTRACT_16BITS(obj_tptr
+18),
533 ip6addr_string(obj_tptr
+20));
538 case RSVP_CTYPE_TUNNEL_IPV4
:
539 printf("\n\t IPv4 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
540 ipaddr_string(obj_tptr
),
541 EXTRACT_16BITS(obj_tptr
+6),
542 ipaddr_string(obj_tptr
+8));
551 case RSVP_OBJ_CONFIRM
:
552 switch(rsvp_obj_ctype
) {
553 case RSVP_CTYPE_IPV4
:
554 printf("\n\t IPv4 ReceiverAddress: %s",
555 ipaddr_string(obj_tptr
));
560 case RSVP_CTYPE_IPV6
:
561 printf("\n\t IPv6 ReceiverAddress: %s",
562 ip6addr_string(obj_tptr
));
573 switch(rsvp_obj_ctype
) {
575 while(obj_tlen
>= 4 ) {
576 printf("\n\t Label: %u", EXTRACT_32BITS(obj_tptr
));
587 switch(rsvp_obj_ctype
) {
589 printf("\n\t Reservation Style: %s, Flags: [0x%02x]",
590 tok2str(rsvp_resstyle_values
,
592 EXTRACT_24BITS(obj_tptr
+1)),
602 case RSVP_OBJ_SENDER_TEMPLATE
:
603 switch(rsvp_obj_ctype
) {
604 case RSVP_CTYPE_IPV4
:
605 printf("\n\t Source Address: %s, Source Port: %u",
606 ipaddr_string(obj_tptr
),
607 EXTRACT_16BITS(obj_tptr
+6));
612 case RSVP_CTYPE_IPV6
:
613 printf("\n\t Source Address: %s, Source Port: %u",
614 ip6addr_string(obj_tptr
),
615 EXTRACT_16BITS(obj_tptr
+18));
620 case RSVP_CTYPE_TUNNEL_IPV4
:
621 printf("\n\t IPv4 Tunnel Sender Address: %s, LSP-ID: 0x%04x",
622 ipaddr_string(obj_tptr
),
623 EXTRACT_16BITS(obj_tptr
+6));
632 case RSVP_OBJ_LABEL_REQ
:
633 switch(rsvp_obj_ctype
) {
635 while(obj_tlen
>= 4 ) {
636 printf("\n\t L3 Protocol ID: %s",
637 tok2str(ethertype_values
,
638 "Unknown Protocol 0x%04x",
639 EXTRACT_16BITS(obj_tptr
+2)));
645 printf("\n\t L3 Protocol ID: %s",
646 tok2str(ethertype_values
,
647 "Unknown Protocol 0x%04x",
648 EXTRACT_16BITS(obj_tptr
+2)));
649 printf(",%s merge capability",((*(obj_tptr
+4))&0x80) ? "no" : "" );
650 printf("\n\t Minimum VPI/VCI %u/%u",
651 (EXTRACT_16BITS(obj_tptr
+4))&0xfff,
652 (EXTRACT_16BITS(obj_tptr
+6))&0xfff);
653 printf("\n\t Maximum VPI/VCI %u/%u",
654 (EXTRACT_16BITS(obj_tptr
+8))&0xfff,
655 (EXTRACT_16BITS(obj_tptr
+10))&0xfff);
660 printf("\n\t L3 Protocol ID: %s",
661 tok2str(ethertype_values
,
662 "Unknown Protocol 0x%04x",
663 EXTRACT_16BITS(obj_tptr
+2)));
664 printf("\n\t Minimum/Maximum DLCI %u/%u, %s%s bit DLCI",
665 (EXTRACT_32BITS(obj_tptr
+4))&0x7fffff,
666 (EXTRACT_32BITS(obj_tptr
+8))&0x7fffff,
667 (((EXTRACT_16BITS(obj_tptr
+4)>>7)&3) == 0 ) ? "10" : "",
668 (((EXTRACT_16BITS(obj_tptr
+4)>>7)&3) == 2 ) ? "23" : "");
679 switch(rsvp_obj_ctype
) {
680 case RSVP_CTYPE_IPV4
:
681 while(obj_tlen
>= 4 ) {
682 printf("\n\t Subobject Type: %s",
683 tok2str(rsvp_obj_xro_values
,
685 RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr
)));
686 switch(RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr
)) {
687 case RSVP_OBJ_XRO_IPV4
:
688 printf(", %s, %s/%u",
689 RSVP_OBJ_XRO_MASK_LOOSE(*obj_tptr
) ? "Loose" : "Strict",
690 ipaddr_string(obj_tptr
+2),
693 obj_tlen
-=*(obj_tptr
+1);
694 obj_tptr
+=*(obj_tptr
+1);
703 switch(rsvp_obj_ctype
) {
706 printf("\n\t Source Instance 0x%08x, Destination Instance 0x%08x",
707 EXTRACT_32BITS(obj_tptr
),
708 EXTRACT_32BITS(obj_tptr
+4));
717 case RSVP_OBJ_RESTART_CAPABILITY
:
718 switch(rsvp_obj_ctype
) {
720 printf("\n\t Restart Time: %ums\n\t Recovery Time: %ums",
721 EXTRACT_16BITS(obj_tptr
),
722 EXTRACT_16BITS(obj_tptr
+4));
729 case RSVP_OBJ_SESSION_ATTRIBUTE
:
730 switch(rsvp_obj_ctype
) {
731 case RSVP_CTYPE_TUNNEL_IPV4
:
732 printf("\n\t Session Name: %s",(obj_tptr
+3));
733 printf("\n\t Setup Priority: %u, Holding Priority: %u, Flags: [%s]",
736 tok2str(rsvp_session_attribute_flag_values
,
740 obj_tlen
-=4+*(obj_tptr
+3);
741 obj_tptr
+=4+*(obj_tptr
+3);
748 case RSVP_OBJ_RSVP_HOP
:
749 switch(rsvp_obj_ctype
) {
750 case RSVP_CTYPE_IPV4
:
751 printf("\n\t Previous/Next Interface: %s, Logical Interface Handle: 0x%08x",
752 ipaddr_string(obj_tptr
),
753 EXTRACT_32BITS(obj_tptr
+4));
758 case RSVP_CTYPE_IPV6
:
759 printf("\n\t Previous/Next Interface: %s, Logical Interface Handle: 0x%08x",
760 ip6addr_string(obj_tptr
),
761 EXTRACT_32BITS(obj_tptr
+16));
771 case RSVP_OBJ_TIME_VALUES
:
772 switch(rsvp_obj_ctype
) {
774 printf("\n\t Refresh Period: %ums",
775 EXTRACT_32BITS(obj_tptr
));
784 /* those three objects do share the same semantics */
785 case RSVP_OBJ_SENDER_TSPEC
:
786 case RSVP_OBJ_ADSPEC
:
787 case RSVP_OBJ_FLOWSPEC
:
788 switch(rsvp_obj_ctype
) {
790 printf("\n\t Msg-Version: %u, length: %u",
791 (*obj_tptr
& 0xf0) >> 4,
792 EXTRACT_16BITS(obj_tptr
+2)<<2);
793 obj_tptr
+=4; /* get to the start of the service header */
796 while (obj_tlen
>= 4) {
797 intserv_serv_tlen
=EXTRACT_16BITS(obj_tptr
+2)<<2;
798 printf("\n\t Service Type: %s (%u), break bit %s set, Service length: %u",
799 tok2str(rsvp_intserv_service_type_values
,"unknown",*(obj_tptr
)),
801 (*(obj_tptr
+1)&0x80) ? "" : "not",
804 obj_tptr
+=4; /* get to the start of the parameter list */
807 while (intserv_serv_tlen
>=4) {
808 processed
= rsvp_intserv_print(obj_tptr
);
812 intserv_serv_tlen
-=processed
;
822 case RSVP_OBJ_FILTERSPEC
:
823 switch(rsvp_obj_ctype
) {
824 case RSVP_CTYPE_IPV4
:
825 printf("\n\t Source Address: %s, Source Port: %u",
826 ipaddr_string(obj_tptr
),
827 EXTRACT_16BITS(obj_tptr
+6));
832 case RSVP_CTYPE_IPV6
:
833 printf("\n\t Source Address: %s, Source Port: %u",
834 ip6addr_string(obj_tptr
),
835 EXTRACT_16BITS(obj_tptr
+18));
840 printf("\n\t Source Address: %s, Flow Label: %u",
841 ip6addr_string(obj_tptr
),
842 EXTRACT_24BITS(obj_tptr
+17));
846 case RSVP_CTYPE_TUNNEL_IPV6
:
847 printf("\n\t Source Address: %s, LSP-ID: 0x%04x",
848 ipaddr_string(obj_tptr
),
849 EXTRACT_16BITS(obj_tptr
+18));
854 case RSVP_CTYPE_TUNNEL_IPV4
:
855 printf("\n\t Source Address: %s, LSP-ID: 0x%04x",
856 ipaddr_string(obj_tptr
),
857 EXTRACT_16BITS(obj_tptr
+6));
866 case RSVP_OBJ_FASTREROUTE
:
867 switch(rsvp_obj_ctype
) {
868 case RSVP_CTYPE_TUNNEL_IPV4
:
869 bw
.i
= EXTRACT_32BITS(obj_tptr
+4);
870 printf("\n\t Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps",
875 printf("\n\t Include Colors: 0x%08x, Exclude Colors: 0x%08x",
876 EXTRACT_32BITS(obj_tptr
+8),
877 EXTRACT_32BITS(obj_tptr
+12));
886 case RSVP_OBJ_DETOUR
:
887 switch(rsvp_obj_ctype
) {
888 case RSVP_CTYPE_TUNNEL_IPV4
:
889 while(obj_tlen
>= 8) {
890 printf("\n\t PLR-ID: %s, Avoid-Node-ID: %s",
891 ipaddr_string(obj_tptr
),
892 ipaddr_string(obj_tptr
+4));
903 * FIXME those are the defined objects that lack a decoder
904 * you are welcome to contribute code ;-)
907 case RSVP_OBJ_INTEGRITY
:
908 case RSVP_OBJ_ERROR_SPEC
:
910 case RSVP_OBJ_POLICY_DATA
:
911 case RSVP_OBJ_MESSAGE_ID
:
912 case RSVP_OBJ_MESSAGE_ID_ACK
:
913 case RSVP_OBJ_MESSAGE_ID_LIST
:
914 case RSVP_OBJ_RECOVERY_LABEL
:
915 case RSVP_OBJ_UPSTREAM_LABEL
:
916 case RSVP_OBJ_SUGGESTED_LABEL
:
917 case RSVP_OBJ_PROPERTIES
:
920 print_unknown_data(obj_tptr
,"\n\t ",obj_tlen
);
923 /* do we want to see an additionally hexdump ? */
924 if (vflag
> 1 || hexdump
==TRUE
)
925 print_unknown_data(tptr
+sizeof(sizeof(struct rsvp_object_header
)),"\n\t ",
926 rsvp_obj_len
-sizeof(struct rsvp_object_header
));
933 printf("\n\t\t packet exceeded snapshot");