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.11 2002-12-12 15:58:33 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
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_TIME_VALUES
+RSVP_CTYPE_1
, "1" },
192 { 256*RSVP_OBJ_FLOWSPEC
+RSVP_CTYPE_1
, "obsolete" },
193 { 256*RSVP_OBJ_FLOWSPEC
+RSVP_CTYPE_2
, "IntServ" },
194 { 256*RSVP_OBJ_SENDER_TSPEC
+RSVP_CTYPE_2
, "IntServ" },
195 { 256*RSVP_OBJ_ADSPEC
+RSVP_CTYPE_2
, "IntServ" },
196 { 256*RSVP_OBJ_FILTERSPEC
+RSVP_CTYPE_IPV4
, "IPv4" },
197 { 256*RSVP_OBJ_FILTERSPEC
+RSVP_CTYPE_IPV6
, "IPv6" },
198 { 256*RSVP_OBJ_FILTERSPEC
+RSVP_CTYPE_3
, "IPv6 Flow-label" },
199 { 256*RSVP_OBJ_FILTERSPEC
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
200 { 256*RSVP_OBJ_SESSION
+RSVP_CTYPE_IPV4
, "IPv4" },
201 { 256*RSVP_OBJ_SESSION
+RSVP_CTYPE_IPV6
, "IPv6" },
202 { 256*RSVP_OBJ_SESSION
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
203 { 256*RSVP_OBJ_SENDER_TEMPLATE
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
204 { 256*RSVP_OBJ_STYLE
+RSVP_CTYPE_1
, "1" },
205 { 256*RSVP_OBJ_HELLO
+RSVP_CTYPE_1
, "Hello Request" },
206 { 256*RSVP_OBJ_HELLO
+RSVP_CTYPE_2
, "Hello Ack" },
207 { 256*RSVP_OBJ_LABEL_REQ
+RSVP_CTYPE_1
, "without label range" },
208 { 256*RSVP_OBJ_LABEL_REQ
+RSVP_CTYPE_2
, "with ATM label range" },
209 { 256*RSVP_OBJ_LABEL_REQ
+RSVP_CTYPE_3
, "with FR label range" },
210 { 256*RSVP_OBJ_LABEL
+RSVP_CTYPE_1
, "1" },
211 { 256*RSVP_OBJ_ERO
+RSVP_CTYPE_IPV4
, "IPv4" },
212 { 256*RSVP_OBJ_RRO
+RSVP_CTYPE_IPV4
, "IPv4" },
213 { 256*RSVP_OBJ_RESTART_CAPABILITY
+RSVP_CTYPE_1
, "IPv4" },
214 { 256*RSVP_OBJ_SESSION_ATTRIBUTE
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
215 { 256*RSVP_OBJ_FASTREROUTE
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
216 { 256*RSVP_OBJ_DETOUR
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
220 #define RSVP_OBJ_XRO_MASK_SUBOBJ(x) ((x)&0x7f)
221 #define RSVP_OBJ_XRO_MASK_LOOSE(x) ((x)&0x80)
223 #define RSVP_OBJ_XRO_RES 0
224 #define RSVP_OBJ_XRO_IPV4 1
225 #define RSVP_OBJ_XRO_IPV6 2
226 #define RSVP_OBJ_XRO_ASN 32
227 #define RSVP_OBJ_XRO_MPLS 64
229 static const struct tok rsvp_obj_xro_values
[] = {
230 { RSVP_OBJ_XRO_RES
, "Reserved" },
231 { RSVP_OBJ_XRO_IPV4
, "IPv4 prefix" },
232 { RSVP_OBJ_XRO_IPV6
, "IPv6 prefix" },
233 { RSVP_OBJ_XRO_ASN
, "Autonomous system number" },
234 { RSVP_OBJ_XRO_MPLS
, "MPLS label switched path termination" },
238 static const struct tok rsvp_resstyle_values
[] = {
239 { 17, "Wildcard Filter" },
240 { 10, "Fixed Filter" },
241 { 18, "Shared Explicit" },
245 #define RSVP_OBJ_INTSERV_GUARANTEED_SERV 2
246 #define RSVP_OBJ_INTSERV_CONTROLLED_LOAD 5
248 static const struct tok rsvp_intserv_service_type_values
[] = {
249 { 1, "Default/Global Information" },
250 { RSVP_OBJ_INTSERV_CONTROLLED_LOAD
, "Controlled Load" },
251 { RSVP_OBJ_INTSERV_GUARANTEED_SERV
, "Guaranteed Service" },
255 static const struct tok rsvp_intserv_parameter_id_values
[] = {
257 { 6, "Path b/w estimate" },
258 { 8, "Minimum path latency" },
259 { 10, "Composed MTU" },
260 { 127, "Token Bucket TSpec" },
261 { 130, "Guaranteed Service RSpec" },
265 static struct tok rsvp_session_attribute_flag_values
[] = {
266 { 1, "Local Protection desired" },
267 { 2, "Label Recording desired" },
268 { 4, "SE Style desired" },
276 int rsvp_intserv_print(const u_char
*);
279 * this is a dissector for all the intserv defined
280 * specs as defined per rfc2215
281 * it is called from various rsvp objects;
282 * returns the amount of bytes being processed
285 rsvp_intserv_print(const u_char
*tptr
) {
287 int parameter_id
,parameter_length
;
293 parameter_id
= *(tptr
);
294 parameter_length
= EXTRACT_16BITS(tptr
+2)<<2; /* convert wordcount to bytecount */
296 printf("\n\t Parameter ID: %s (%u), length: %u, Flags: [0x%02x]",
297 tok2str(rsvp_intserv_parameter_id_values
,"unknown",parameter_id
),
302 switch(parameter_id
) { /* parameter_id */
306 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
307 * | 4 (e) | (f) | 1 (g) |
308 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
309 * | IS hop cnt (32-bit unsigned integer) |
310 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
312 printf("\n\t\tIS hop cnt: %u", EXTRACT_32BITS(tptr
+4));
317 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
318 * | 6 (h) | (i) | 1 (j) |
319 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
320 * | Path b/w estimate (32-bit IEEE floating point number) |
321 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
323 bw
.i
= EXTRACT_32BITS(tptr
+4);
324 printf("\n\t\tPath b/w estimate: %.10g Mbps", bw
.f
/125000);
329 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
330 * | 8 (k) | (l) | 1 (m) |
331 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
332 * | Minimum path latency (32-bit integer) |
333 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
335 printf("\n\t\tMinimum path latency: ");
336 if (EXTRACT_32BITS(tptr
+4) == 0xffffffff)
337 printf("don't care");
339 printf("%u", EXTRACT_32BITS(tptr
+4));
345 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
346 * | 10 (n) | (o) | 1 (p) |
347 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
348 * | Composed MTU (32-bit unsigned integer) |
349 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
351 printf("\n\t\tComposed MTU: %u bytes", EXTRACT_32BITS(tptr
+4));
355 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
356 * | 127 (e) | 0 (f) | 5 (g) |
357 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
358 * | Token Bucket Rate [r] (32-bit IEEE floating point number) |
359 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
360 * | Token Bucket Size [b] (32-bit IEEE floating point number) |
361 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
362 * | Peak Data Rate [p] (32-bit IEEE floating point number) |
363 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
364 * | Minimum Policed Unit [m] (32-bit integer) |
365 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
366 * | Maximum Packet Size [M] (32-bit integer) |
367 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
370 bw
.i
= EXTRACT_32BITS(tptr
+4);
371 printf("\n\t\tToken Bucket Rate: %.10g Mbps", bw
.f
/125000);
372 bw
.i
= EXTRACT_32BITS(tptr
+8);
373 printf("\n\t\tToken Bucket Size: %.10g bytes", bw
.f
);
374 bw
.i
= EXTRACT_32BITS(tptr
+12);
375 printf("\n\t\tPeak Data Rate: %.10g Mbps", bw
.f
/125000);
376 printf("\n\t\tMinimum Policed Unit: %u bytes", EXTRACT_32BITS(tptr
+16));
377 printf("\n\t\tMaximum Packet Size: %u bytes", EXTRACT_32BITS(tptr
+20));
382 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
383 * | 130 (h) | 0 (i) | 2 (j) |
384 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
385 * | Rate [R] (32-bit IEEE floating point number) |
386 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
387 * | Slack Term [S] (32-bit integer) |
388 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
391 bw
.i
= EXTRACT_32BITS(tptr
+4);
392 printf("\n\t\tRate: %.10g Mbps", bw
.f
/125000);
393 printf("\n\t\tSlack Term: %u", EXTRACT_32BITS(tptr
+8));
396 * FIXME those are the defined paramters that lack a decoder
397 * you are welcome to contribute code ;-)
406 print_unknown_data(tptr
+4,"\n\t ",parameter_length
);
408 return (parameter_length
+4); /* header length 4 bytes */
412 rsvp_print(register const u_char
*pptr
, register u_int len
) {
414 const struct rsvp_common_header
*rsvp_com_header
;
415 const struct rsvp_object_header
*rsvp_obj_header
;
416 const u_char
*tptr
,*obj_tptr
;
417 u_short tlen
,rsvp_obj_len
,rsvp_obj_ctype
,obj_tlen
;
418 int hexdump
,processed
;
425 rsvp_com_header
= (const struct rsvp_common_header
*)pptr
;
426 TCHECK(*rsvp_com_header
);
429 * Sanity checking of the header.
431 if (RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
) != RSVP_VERSION
) {
432 printf("RSVP version %u packet not supported",
433 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
));
437 /* in non-verbose mode just lets print the basic Message Type*/
439 printf("RSVP %s Message, length: %u",
440 tok2str(rsvp_msg_type_values
, "unknown (%u)",rsvp_com_header
->msg_type
),
445 /* ok they seem to want to know everything - lets fully decode it */
447 tlen
=EXTRACT_16BITS(rsvp_com_header
->length
);
449 printf("RSVP\n\tv: %u, msg-type: %s, length: %u, ttl: %u, checksum: 0x%04x",
450 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
),
451 tok2str(rsvp_msg_type_values
, "unknown, type: %u",rsvp_com_header
->msg_type
),
453 rsvp_com_header
->ttl
,
454 EXTRACT_16BITS(rsvp_com_header
->checksum
));
456 tptr
+=sizeof(const struct rsvp_common_header
);
457 tlen
-=sizeof(const struct rsvp_common_header
);
460 /* did we capture enough for fully decoding the object header ? */
461 if (!TTEST2(*tptr
, sizeof(struct rsvp_object_header
)))
464 rsvp_obj_header
= (const struct rsvp_object_header
*)tptr
;
465 rsvp_obj_len
=EXTRACT_16BITS(rsvp_obj_header
->length
);
466 rsvp_obj_ctype
=rsvp_obj_header
->ctype
;
468 if(rsvp_obj_len
% 4 || rsvp_obj_len
< 4)
471 printf("\n\t %s Object (%u) Flags: [%s",
472 tok2str(rsvp_obj_values
,
474 rsvp_obj_header
->class_num
),
475 rsvp_obj_header
->class_num
,
476 ((rsvp_obj_header
->class_num
)&0x80) ? "ignore" : "reject");
478 if (rsvp_obj_header
->class_num
> 128)
480 ((rsvp_obj_header
->class_num
)&0x40) ? "and forward" : "silently");
482 printf(" if unknown], Class-Type: %s (%u), length: %u",
483 tok2str(rsvp_ctype_values
,
485 ((rsvp_obj_header
->class_num
)<<8)+rsvp_obj_ctype
),
489 obj_tptr
=tptr
+sizeof(struct rsvp_object_header
);
490 obj_tlen
=rsvp_obj_len
-sizeof(struct rsvp_object_header
);
492 /* did we capture enough for fully decoding the object ? */
493 if (!TTEST2(*tptr
, rsvp_obj_len
))
497 switch(rsvp_obj_header
->class_num
) {
498 case RSVP_OBJ_SESSION
:
499 switch(rsvp_obj_ctype
) {
500 case RSVP_CTYPE_IPV4
:
501 printf("\n\t IPv4 DestAddress: %s, Protocol ID: 0x%02x",
502 ipaddr_string(obj_tptr
),
504 printf("\n\t Flags: [0x%02x], DestPort %u",
506 EXTRACT_16BITS(obj_tptr
+6));
511 case RSVP_CTYPE_IPV6
:
512 printf("\n\t IPv6 DestAddress: %s, Protocol ID: 0x%02x",
513 ip6addr_string(obj_tptr
),
515 printf("\n\t Flags: [0x%02x], DestPort %u",
517 EXTRACT_16BITS(obj_tptr
+18));
522 case RSVP_CTYPE_TUNNEL_IPV6
:
523 printf("\n\t IPv6 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
524 ip6addr_string(obj_tptr
),
525 EXTRACT_16BITS(obj_tptr
+18),
526 ip6addr_string(obj_tptr
+20));
531 case RSVP_CTYPE_TUNNEL_IPV4
:
532 printf("\n\t IPv4 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
533 ipaddr_string(obj_tptr
),
534 EXTRACT_16BITS(obj_tptr
+6),
535 ipaddr_string(obj_tptr
+8));
545 switch(rsvp_obj_ctype
) {
547 while(obj_tlen
>= 4 ) {
548 printf("\n\t Label: %u", EXTRACT_32BITS(obj_tptr
));
559 switch(rsvp_obj_ctype
) {
561 printf("\n\t Reservation Style: %s, Flags: [0x%02x]",
562 tok2str(rsvp_resstyle_values
,
564 EXTRACT_24BITS(obj_tptr
+1)),
574 case RSVP_OBJ_SENDER_TEMPLATE
:
575 switch(rsvp_obj_ctype
) {
576 case RSVP_CTYPE_TUNNEL_IPV4
:
577 printf("\n\t IPv4 Tunnel Sender Address: %s, LSP-ID: 0x%04x",
578 ipaddr_string(obj_tptr
),
579 EXTRACT_16BITS(obj_tptr
+6));
588 case RSVP_OBJ_LABEL_REQ
:
589 switch(rsvp_obj_ctype
) {
591 while(obj_tlen
>= 4 ) {
592 printf("\n\t L3 Protocol ID: %s",
593 tok2str(ethertype_values
,
594 "Unknown Protocol 0x%04x",
595 EXTRACT_16BITS(obj_tptr
+2)));
601 printf("\n\t L3 Protocol ID: %s",
602 tok2str(ethertype_values
,
603 "Unknown Protocol 0x%04x",
604 EXTRACT_16BITS(obj_tptr
+2)));
605 printf(",%s merge capability",((*(obj_tptr
+4))&0x80) ? "no" : "" );
606 printf("\n\t Minimum VPI/VCI %u/%u",
607 (EXTRACT_16BITS(obj_tptr
+4))&0xfff,
608 (EXTRACT_16BITS(obj_tptr
+6))&0xfff);
609 printf("\n\t Maximum VPI/VCI %u/%u",
610 (EXTRACT_16BITS(obj_tptr
+8))&0xfff,
611 (EXTRACT_16BITS(obj_tptr
+10))&0xfff);
616 printf("\n\t L3 Protocol ID: %s",
617 tok2str(ethertype_values
,
618 "Unknown Protocol 0x%04x",
619 EXTRACT_16BITS(obj_tptr
+2)));
620 printf("\n\t Minimum/Maximum DLCI %u/%u, %s%s bit DLCI",
621 (EXTRACT_32BITS(obj_tptr
+4))&0x7fffff,
622 (EXTRACT_32BITS(obj_tptr
+8))&0x7fffff,
623 (((EXTRACT_16BITS(obj_tptr
+4)>>7)&3) == 0 ) ? "10" : "",
624 (((EXTRACT_16BITS(obj_tptr
+4)>>7)&3) == 2 ) ? "23" : "");
635 switch(rsvp_obj_ctype
) {
636 case RSVP_CTYPE_IPV4
:
637 while(obj_tlen
>= 4 ) {
638 printf("\n\t Subobject Type: %s",
639 tok2str(rsvp_obj_xro_values
,
641 RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr
)));
642 switch(RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr
)) {
643 case RSVP_OBJ_XRO_IPV4
:
644 printf(", %s, %s/%u",
645 RSVP_OBJ_XRO_MASK_LOOSE(*obj_tptr
) ? "Loose" : "Strict",
646 ipaddr_string(obj_tptr
+2),
649 obj_tlen
-=*(obj_tptr
+1);
650 obj_tptr
+=*(obj_tptr
+1);
659 switch(rsvp_obj_ctype
) {
662 printf("\n\t Source Instance 0x%08x, Destination Instance 0x%08x",
663 EXTRACT_32BITS(obj_tptr
),
664 EXTRACT_32BITS(obj_tptr
+4));
673 case RSVP_OBJ_RESTART_CAPABILITY
:
674 switch(rsvp_obj_ctype
) {
676 printf("\n\t Restart Time: %ums\n\t Recovery Time: %ums",
677 EXTRACT_16BITS(obj_tptr
),
678 EXTRACT_16BITS(obj_tptr
+4));
685 case RSVP_OBJ_SESSION_ATTRIBUTE
:
686 switch(rsvp_obj_ctype
) {
687 case RSVP_CTYPE_TUNNEL_IPV4
:
688 printf("\n\t Session Name: %s",(obj_tptr
+3));
689 printf("\n\t Setup Priority: %u, Holding Priority: %u, Flags: [%s]",
692 tok2str(rsvp_session_attribute_flag_values
,
696 obj_tlen
-=4+*(obj_tptr
+3);
697 obj_tptr
+=4+*(obj_tptr
+3);
704 case RSVP_OBJ_RSVP_HOP
:
705 switch(rsvp_obj_ctype
) {
706 case RSVP_CTYPE_IPV4
:
707 printf("\n\t Previous/Next Interface: %s, Logical Interface Handle: 0x%08x",
708 ipaddr_string(obj_tptr
),
709 EXTRACT_32BITS(obj_tptr
+4));
714 case RSVP_CTYPE_IPV6
:
715 printf("\n\t Previous/Next Interface: %s, Logical Interface Handle: 0x%08x",
716 ip6addr_string(obj_tptr
),
717 EXTRACT_32BITS(obj_tptr
+16));
727 case RSVP_OBJ_TIME_VALUES
:
728 switch(rsvp_obj_ctype
) {
730 printf("\n\t Refresh Period: %ums",
731 EXTRACT_32BITS(obj_tptr
));
740 /* those three objects do share the same semantics */
741 case RSVP_OBJ_SENDER_TSPEC
:
742 case RSVP_OBJ_ADSPEC
:
743 case RSVP_OBJ_FLOWSPEC
:
744 switch(rsvp_obj_ctype
) {
746 printf("\n\t Msg-Version: %u, length: %u\n\t Service Type: %s (%u), Service length: %u",
747 (*obj_tptr
& 0xf0) >> 4,
748 EXTRACT_16BITS(obj_tptr
+2)<<2,
749 tok2str(rsvp_intserv_service_type_values
,"unknown",*(obj_tptr
+4)),
751 EXTRACT_16BITS(obj_tptr
+6)<<2);
753 obj_tlen
-=8; /* get to the start of the parameter list */
757 processed
= rsvp_intserv_print(obj_tptr
);
769 case RSVP_OBJ_FILTERSPEC
:
770 switch(rsvp_obj_ctype
) {
771 case RSVP_CTYPE_IPV4
:
772 printf("\n\t Source Address: %s, Source Port: %u",
773 ipaddr_string(obj_tptr
),
774 EXTRACT_16BITS(obj_tptr
+6));
779 case RSVP_CTYPE_IPV6
:
780 printf("\n\t Source Address: %s, Source Port: %u",
781 ip6addr_string(obj_tptr
),
782 EXTRACT_16BITS(obj_tptr
+18));
787 printf("\n\t Source Address: %s, Flow Label: %u",
788 ip6addr_string(obj_tptr
),
789 EXTRACT_24BITS(obj_tptr
+17));
793 case RSVP_CTYPE_TUNNEL_IPV6
:
794 printf("\n\t Source Address: %s, LSP-ID: 0x%04x",
795 ipaddr_string(obj_tptr
),
796 EXTRACT_16BITS(obj_tptr
+18));
801 case RSVP_CTYPE_TUNNEL_IPV4
:
802 printf("\n\t Source Address: %s, LSP-ID: 0x%04x",
803 ipaddr_string(obj_tptr
),
804 EXTRACT_16BITS(obj_tptr
+6));
813 case RSVP_OBJ_FASTREROUTE
:
814 switch(rsvp_obj_ctype
) {
815 case RSVP_CTYPE_TUNNEL_IPV4
:
816 bw
.i
= EXTRACT_32BITS(obj_tptr
+4);
817 printf("\n\t Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps",
822 printf("\n\t Include Colors: 0x%08x, Exclude Colors: 0x%08x",
823 EXTRACT_32BITS(obj_tptr
+8),
824 EXTRACT_32BITS(obj_tptr
+12));
833 case RSVP_OBJ_DETOUR
:
834 switch(rsvp_obj_ctype
) {
835 case RSVP_CTYPE_TUNNEL_IPV4
:
836 while(obj_tlen
>= 8) {
837 printf("\n\t PLR-ID: %s, Avoid-Node-ID: %s",
838 ipaddr_string(obj_tptr
),
839 ipaddr_string(obj_tptr
+4));
850 * FIXME those are the defined objects that lack a decoder
851 * you are welcome to contribute code ;-)
854 case RSVP_OBJ_INTEGRITY
:
855 case RSVP_OBJ_ERROR_SPEC
:
857 case RSVP_OBJ_POLICY_DATA
:
858 case RSVP_OBJ_CONFIRM
:
859 case RSVP_OBJ_MESSAGE_ID
:
860 case RSVP_OBJ_MESSAGE_ID_ACK
:
861 case RSVP_OBJ_MESSAGE_ID_LIST
:
862 case RSVP_OBJ_RECOVERY_LABEL
:
863 case RSVP_OBJ_UPSTREAM_LABEL
:
864 case RSVP_OBJ_SUGGESTED_LABEL
:
865 case RSVP_OBJ_PROPERTIES
:
868 print_unknown_data(obj_tptr
,"\n\t ",obj_tlen
);
871 /* do we want to see an additionally hexdump ? */
872 if (vflag
> 1 || hexdump
==TRUE
)
873 print_unknown_data(tptr
+sizeof(sizeof(struct rsvp_object_header
)),"\n\t ",
874 rsvp_obj_len
-sizeof(struct rsvp_object_header
));
881 printf("\n\t\t packet exceeded snapshot");