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.15 2003-03-05 11:13:34 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_ERROR_SPEC
+RSVP_CTYPE_IPV4
, "IPv4" },
218 { 256*RSVP_OBJ_ERROR_SPEC
+RSVP_CTYPE_IPV6
, "IPv6" },
219 { 256*RSVP_OBJ_RESTART_CAPABILITY
+RSVP_CTYPE_1
, "IPv4" },
220 { 256*RSVP_OBJ_SESSION_ATTRIBUTE
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
221 { 256*RSVP_OBJ_FASTREROUTE
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
222 { 256*RSVP_OBJ_DETOUR
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
223 { 256*RSVP_OBJ_PROPERTIES
+RSVP_CTYPE_1
, "1" },
227 #define RSVP_OBJ_XRO_MASK_SUBOBJ(x) ((x)&0x7f)
228 #define RSVP_OBJ_XRO_MASK_LOOSE(x) ((x)&0x80)
230 #define RSVP_OBJ_XRO_RES 0
231 #define RSVP_OBJ_XRO_IPV4 1
232 #define RSVP_OBJ_XRO_IPV6 2
233 #define RSVP_OBJ_XRO_ASN 32
234 #define RSVP_OBJ_XRO_MPLS 64
236 static const struct tok rsvp_obj_xro_values
[] = {
237 { RSVP_OBJ_XRO_RES
, "Reserved" },
238 { RSVP_OBJ_XRO_IPV4
, "IPv4 prefix" },
239 { RSVP_OBJ_XRO_IPV6
, "IPv6 prefix" },
240 { RSVP_OBJ_XRO_ASN
, "Autonomous system number" },
241 { RSVP_OBJ_XRO_MPLS
, "MPLS label switched path termination" },
245 static const struct tok rsvp_resstyle_values
[] = {
246 { 17, "Wildcard Filter" },
247 { 10, "Fixed Filter" },
248 { 18, "Shared Explicit" },
252 #define RSVP_OBJ_INTSERV_GUARANTEED_SERV 2
253 #define RSVP_OBJ_INTSERV_CONTROLLED_LOAD 5
255 static const struct tok rsvp_intserv_service_type_values
[] = {
256 { 1, "Default/Global Information" },
257 { RSVP_OBJ_INTSERV_GUARANTEED_SERV
, "Guaranteed Service" },
258 { RSVP_OBJ_INTSERV_CONTROLLED_LOAD
, "Controlled Load" },
262 static const struct tok rsvp_intserv_parameter_id_values
[] = {
264 { 6, "Path b/w estimate" },
265 { 8, "Minimum path latency" },
266 { 10, "Composed MTU" },
267 { 127, "Token Bucket TSpec" },
268 { 130, "Guaranteed Service RSpec" },
269 { 133, "End-to-end composed value for C" },
270 { 134, "End-to-end composed value for D" },
271 { 135, "Since-last-reshaping point composed C" },
272 { 136, "Since-last-reshaping point composed D" },
276 static struct tok rsvp_session_attribute_flag_values
[] = {
277 { 1, "Local Protection desired" },
278 { 2, "Label Recording desired" },
279 { 4, "SE Style desired" },
283 static struct tok rsvp_obj_prop_tlv_values
[] = {
285 { 0x02, "Metric 1" },
286 { 0x04, "Metric 2" },
287 { 0x08, "CCC Status" },
288 { 0x10, "Path Type" },
292 #define RSVP_OBJ_ERROR_SPEC_CODE_ROUTING 24
293 #define RSVP_OBJ_ERROR_SPEC_CODE_NOTIFY 25
295 static struct tok rsvp_obj_error_code_values
[] = {
296 { RSVP_OBJ_ERROR_SPEC_CODE_ROUTING
, "Routing Problem" },
297 { RSVP_OBJ_ERROR_SPEC_CODE_NOTIFY
, "Notify Error" },
301 static struct tok rsvp_obj_error_code_routing_values
[] = {
302 { 1, "Bad EXPLICIT_ROUTE object" },
303 { 2, "Bad strict node" },
304 { 3, "Bad loose node" },
305 { 4, "Bad initial subobject" },
306 { 5, "No route available toward destination" },
307 { 6, "Unacceptable label value" },
308 { 7, "RRO indicated routing loops" },
309 { 8, "non-RSVP-capable router in the path" },
310 { 9, "MPLS label allocation failure" },
311 { 10, "Unsupported L3PID" },
319 int rsvp_intserv_print(const u_char
*);
322 * this is a dissector for all the intserv defined
323 * specs as defined per rfc2215
324 * it is called from various rsvp objects;
325 * returns the amount of bytes being processed
328 rsvp_intserv_print(const u_char
*tptr
) {
330 int parameter_id
,parameter_length
;
336 parameter_id
= *(tptr
);
337 parameter_length
= EXTRACT_16BITS(tptr
+2)<<2; /* convert wordcount to bytecount */
339 printf("\n\t Parameter ID: %s (%u), length: %u, Flags: [0x%02x]",
340 tok2str(rsvp_intserv_parameter_id_values
,"unknown",parameter_id
),
345 switch(parameter_id
) { /* parameter_id */
349 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
350 * | 4 (e) | (f) | 1 (g) |
351 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
352 * | IS hop cnt (32-bit unsigned integer) |
353 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
355 printf("\n\t\tIS hop cnt: %u", EXTRACT_32BITS(tptr
+4));
360 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
361 * | 6 (h) | (i) | 1 (j) |
362 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
363 * | Path b/w estimate (32-bit IEEE floating point number) |
364 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
366 bw
.i
= EXTRACT_32BITS(tptr
+4);
367 printf("\n\t\tPath b/w estimate: %.10g Mbps", bw
.f
/125000);
372 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
373 * | 8 (k) | (l) | 1 (m) |
374 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
375 * | Minimum path latency (32-bit integer) |
376 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
378 printf("\n\t\tMinimum path latency: ");
379 if (EXTRACT_32BITS(tptr
+4) == 0xffffffff)
380 printf("don't care");
382 printf("%u", EXTRACT_32BITS(tptr
+4));
388 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
389 * | 10 (n) | (o) | 1 (p) |
390 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
391 * | Composed MTU (32-bit unsigned integer) |
392 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
394 printf("\n\t\tComposed MTU: %u bytes", EXTRACT_32BITS(tptr
+4));
398 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
399 * | 127 (e) | 0 (f) | 5 (g) |
400 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
401 * | Token Bucket Rate [r] (32-bit IEEE floating point number) |
402 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
403 * | Token Bucket Size [b] (32-bit IEEE floating point number) |
404 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
405 * | Peak Data Rate [p] (32-bit IEEE floating point number) |
406 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
407 * | Minimum Policed Unit [m] (32-bit integer) |
408 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
409 * | Maximum Packet Size [M] (32-bit integer) |
410 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
413 bw
.i
= EXTRACT_32BITS(tptr
+4);
414 printf("\n\t\tToken Bucket Rate: %.10g Mbps", bw
.f
/125000);
415 bw
.i
= EXTRACT_32BITS(tptr
+8);
416 printf("\n\t\tToken Bucket Size: %.10g bytes", bw
.f
);
417 bw
.i
= EXTRACT_32BITS(tptr
+12);
418 printf("\n\t\tPeak Data Rate: %.10g Mbps", bw
.f
/125000);
419 printf("\n\t\tMinimum Policed Unit: %u bytes", EXTRACT_32BITS(tptr
+16));
420 printf("\n\t\tMaximum Packet Size: %u bytes", EXTRACT_32BITS(tptr
+20));
425 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
426 * | 130 (h) | 0 (i) | 2 (j) |
427 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
428 * | Rate [R] (32-bit IEEE floating point number) |
429 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
430 * | Slack Term [S] (32-bit integer) |
431 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
434 bw
.i
= EXTRACT_32BITS(tptr
+4);
435 printf("\n\t\tRate: %.10g Mbps", bw
.f
/125000);
436 printf("\n\t\tSlack Term: %u", EXTRACT_32BITS(tptr
+8));
443 printf("\n\t\tValue: %u", EXTRACT_32BITS(tptr
+4));
448 print_unknown_data(tptr
+4,"\n\t\t",parameter_length
);
450 return (parameter_length
+4); /* header length 4 bytes */
454 rsvp_print(register const u_char
*pptr
, register u_int len
) {
456 const struct rsvp_common_header
*rsvp_com_header
;
457 const struct rsvp_object_header
*rsvp_obj_header
;
458 const u_char
*tptr
,*obj_tptr
;
459 u_short tlen
,rsvp_obj_len
,rsvp_obj_ctype
,obj_tlen
,intserv_serv_tlen
;
460 int hexdump
,processed
,padbytes
,error_code
,error_value
;
467 rsvp_com_header
= (const struct rsvp_common_header
*)pptr
;
468 TCHECK(*rsvp_com_header
);
471 * Sanity checking of the header.
473 if (RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
) != RSVP_VERSION
) {
474 printf("RSVP version %u packet not supported",
475 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
));
479 /* in non-verbose mode just lets print the basic Message Type*/
481 printf("RSVP %s Message, length: %u",
482 tok2str(rsvp_msg_type_values
, "unknown (%u)",rsvp_com_header
->msg_type
),
487 /* ok they seem to want to know everything - lets fully decode it */
489 tlen
=EXTRACT_16BITS(rsvp_com_header
->length
);
491 printf("RSVP\n\tv: %u, msg-type: %s, length: %u, ttl: %u, checksum: 0x%04x",
492 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
),
493 tok2str(rsvp_msg_type_values
, "unknown, type: %u",rsvp_com_header
->msg_type
),
495 rsvp_com_header
->ttl
,
496 EXTRACT_16BITS(rsvp_com_header
->checksum
));
498 tptr
+=sizeof(const struct rsvp_common_header
);
499 tlen
-=sizeof(const struct rsvp_common_header
);
502 /* did we capture enough for fully decoding the object header ? */
503 if (!TTEST2(*tptr
, sizeof(struct rsvp_object_header
)))
506 rsvp_obj_header
= (const struct rsvp_object_header
*)tptr
;
507 rsvp_obj_len
=EXTRACT_16BITS(rsvp_obj_header
->length
);
508 rsvp_obj_ctype
=rsvp_obj_header
->ctype
;
510 if(rsvp_obj_len
% 4 || rsvp_obj_len
< 4)
513 printf("\n\t %s Object (%u) Flags: [%s",
514 tok2str(rsvp_obj_values
,
516 rsvp_obj_header
->class_num
),
517 rsvp_obj_header
->class_num
,
518 ((rsvp_obj_header
->class_num
)&0x80) ? "ignore" : "reject");
520 if (rsvp_obj_header
->class_num
> 128)
522 ((rsvp_obj_header
->class_num
)&0x40) ? "and forward" : "silently");
524 printf(" if unknown], Class-Type: %s (%u), length: %u",
525 tok2str(rsvp_ctype_values
,
527 ((rsvp_obj_header
->class_num
)<<8)+rsvp_obj_ctype
),
531 obj_tptr
=tptr
+sizeof(struct rsvp_object_header
);
532 obj_tlen
=rsvp_obj_len
-sizeof(struct rsvp_object_header
);
534 /* did we capture enough for fully decoding the object ? */
535 if (!TTEST2(*tptr
, rsvp_obj_len
))
539 switch(rsvp_obj_header
->class_num
) {
540 case RSVP_OBJ_SESSION
:
541 switch(rsvp_obj_ctype
) {
542 case RSVP_CTYPE_IPV4
:
543 printf("\n\t IPv4 DestAddress: %s, Protocol ID: 0x%02x",
544 ipaddr_string(obj_tptr
),
546 printf("\n\t Flags: [0x%02x], DestPort %u",
548 EXTRACT_16BITS(obj_tptr
+6));
553 case RSVP_CTYPE_IPV6
:
554 printf("\n\t IPv6 DestAddress: %s, Protocol ID: 0x%02x",
555 ip6addr_string(obj_tptr
),
557 printf("\n\t Flags: [0x%02x], DestPort %u",
559 EXTRACT_16BITS(obj_tptr
+18));
564 case RSVP_CTYPE_TUNNEL_IPV6
:
565 printf("\n\t IPv6 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
566 ip6addr_string(obj_tptr
),
567 EXTRACT_16BITS(obj_tptr
+18),
568 ip6addr_string(obj_tptr
+20));
573 case RSVP_CTYPE_TUNNEL_IPV4
:
574 printf("\n\t IPv4 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
575 ipaddr_string(obj_tptr
),
576 EXTRACT_16BITS(obj_tptr
+6),
577 ipaddr_string(obj_tptr
+8));
586 case RSVP_OBJ_CONFIRM
:
587 switch(rsvp_obj_ctype
) {
588 case RSVP_CTYPE_IPV4
:
589 printf("\n\t IPv4 ReceiverAddress: %s",
590 ipaddr_string(obj_tptr
));
595 case RSVP_CTYPE_IPV6
:
596 printf("\n\t IPv6 ReceiverAddress: %s",
597 ip6addr_string(obj_tptr
));
608 switch(rsvp_obj_ctype
) {
610 while(obj_tlen
>= 4 ) {
611 printf("\n\t Label: %u", EXTRACT_32BITS(obj_tptr
));
622 switch(rsvp_obj_ctype
) {
624 printf("\n\t Reservation Style: %s, Flags: [0x%02x]",
625 tok2str(rsvp_resstyle_values
,
627 EXTRACT_24BITS(obj_tptr
+1)),
637 case RSVP_OBJ_SENDER_TEMPLATE
:
638 switch(rsvp_obj_ctype
) {
639 case RSVP_CTYPE_IPV4
:
640 printf("\n\t Source Address: %s, Source Port: %u",
641 ipaddr_string(obj_tptr
),
642 EXTRACT_16BITS(obj_tptr
+6));
647 case RSVP_CTYPE_IPV6
:
648 printf("\n\t Source Address: %s, Source Port: %u",
649 ip6addr_string(obj_tptr
),
650 EXTRACT_16BITS(obj_tptr
+18));
655 case RSVP_CTYPE_TUNNEL_IPV4
:
656 printf("\n\t IPv4 Tunnel Sender Address: %s, LSP-ID: 0x%04x",
657 ipaddr_string(obj_tptr
),
658 EXTRACT_16BITS(obj_tptr
+6));
667 case RSVP_OBJ_LABEL_REQ
:
668 switch(rsvp_obj_ctype
) {
670 while(obj_tlen
>= 4 ) {
671 printf("\n\t L3 Protocol ID: %s",
672 tok2str(ethertype_values
,
673 "Unknown Protocol 0x%04x",
674 EXTRACT_16BITS(obj_tptr
+2)));
680 printf("\n\t L3 Protocol ID: %s",
681 tok2str(ethertype_values
,
682 "Unknown Protocol 0x%04x",
683 EXTRACT_16BITS(obj_tptr
+2)));
684 printf(",%s merge capability",((*(obj_tptr
+4))&0x80) ? "no" : "" );
685 printf("\n\t Minimum VPI/VCI %u/%u",
686 (EXTRACT_16BITS(obj_tptr
+4))&0xfff,
687 (EXTRACT_16BITS(obj_tptr
+6))&0xfff);
688 printf("\n\t Maximum VPI/VCI %u/%u",
689 (EXTRACT_16BITS(obj_tptr
+8))&0xfff,
690 (EXTRACT_16BITS(obj_tptr
+10))&0xfff);
695 printf("\n\t L3 Protocol ID: %s",
696 tok2str(ethertype_values
,
697 "Unknown Protocol 0x%04x",
698 EXTRACT_16BITS(obj_tptr
+2)));
699 printf("\n\t Minimum/Maximum DLCI %u/%u, %s%s bit DLCI",
700 (EXTRACT_32BITS(obj_tptr
+4))&0x7fffff,
701 (EXTRACT_32BITS(obj_tptr
+8))&0x7fffff,
702 (((EXTRACT_16BITS(obj_tptr
+4)>>7)&3) == 0 ) ? "10" : "",
703 (((EXTRACT_16BITS(obj_tptr
+4)>>7)&3) == 2 ) ? "23" : "");
714 switch(rsvp_obj_ctype
) {
715 case RSVP_CTYPE_IPV4
:
716 while(obj_tlen
>= 4 ) {
717 printf("\n\t Subobject Type: %s",
718 tok2str(rsvp_obj_xro_values
,
720 RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr
)));
721 switch(RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr
)) {
722 case RSVP_OBJ_XRO_IPV4
:
723 printf(", %s, %s/%u",
724 RSVP_OBJ_XRO_MASK_LOOSE(*obj_tptr
) ? "Loose" : "Strict",
725 ipaddr_string(obj_tptr
+2),
728 obj_tlen
-=*(obj_tptr
+1);
729 obj_tptr
+=*(obj_tptr
+1);
738 switch(rsvp_obj_ctype
) {
741 printf("\n\t Source Instance 0x%08x, Destination Instance 0x%08x",
742 EXTRACT_32BITS(obj_tptr
),
743 EXTRACT_32BITS(obj_tptr
+4));
752 case RSVP_OBJ_RESTART_CAPABILITY
:
753 switch(rsvp_obj_ctype
) {
755 printf("\n\t Restart Time: %ums\n\t Recovery Time: %ums",
756 EXTRACT_16BITS(obj_tptr
),
757 EXTRACT_16BITS(obj_tptr
+4));
764 case RSVP_OBJ_SESSION_ATTRIBUTE
:
765 switch(rsvp_obj_ctype
) {
766 case RSVP_CTYPE_TUNNEL_IPV4
:
767 printf("\n\t Session Name: %s",(obj_tptr
+3));
768 printf("\n\t Setup Priority: %u, Holding Priority: %u, Flags: [%s]",
771 tok2str(rsvp_session_attribute_flag_values
,
775 obj_tlen
-=4+*(obj_tptr
+3);
776 obj_tptr
+=4+*(obj_tptr
+3);
783 case RSVP_OBJ_RSVP_HOP
:
784 switch(rsvp_obj_ctype
) {
785 case RSVP_CTYPE_IPV4
:
786 printf("\n\t Previous/Next Interface: %s, Logical Interface Handle: 0x%08x",
787 ipaddr_string(obj_tptr
),
788 EXTRACT_32BITS(obj_tptr
+4));
793 case RSVP_CTYPE_IPV6
:
794 printf("\n\t Previous/Next Interface: %s, Logical Interface Handle: 0x%08x",
795 ip6addr_string(obj_tptr
),
796 EXTRACT_32BITS(obj_tptr
+16));
806 case RSVP_OBJ_TIME_VALUES
:
807 switch(rsvp_obj_ctype
) {
809 printf("\n\t Refresh Period: %ums",
810 EXTRACT_32BITS(obj_tptr
));
819 /* those three objects do share the same semantics */
820 case RSVP_OBJ_SENDER_TSPEC
:
821 case RSVP_OBJ_ADSPEC
:
822 case RSVP_OBJ_FLOWSPEC
:
823 switch(rsvp_obj_ctype
) {
825 printf("\n\t Msg-Version: %u, length: %u",
826 (*obj_tptr
& 0xf0) >> 4,
827 EXTRACT_16BITS(obj_tptr
+2)<<2);
828 obj_tptr
+=4; /* get to the start of the service header */
831 while (obj_tlen
>= 4) {
832 intserv_serv_tlen
=EXTRACT_16BITS(obj_tptr
+2)<<2;
833 printf("\n\t Service Type: %s (%u), break bit %s set, Service length: %u",
834 tok2str(rsvp_intserv_service_type_values
,"unknown",*(obj_tptr
)),
836 (*(obj_tptr
+1)&0x80) ? "" : "not",
839 obj_tptr
+=4; /* get to the start of the parameter list */
842 while (intserv_serv_tlen
>=4) {
843 processed
= rsvp_intserv_print(obj_tptr
);
847 intserv_serv_tlen
-=processed
;
857 case RSVP_OBJ_FILTERSPEC
:
858 switch(rsvp_obj_ctype
) {
859 case RSVP_CTYPE_IPV4
:
860 printf("\n\t Source Address: %s, Source Port: %u",
861 ipaddr_string(obj_tptr
),
862 EXTRACT_16BITS(obj_tptr
+6));
867 case RSVP_CTYPE_IPV6
:
868 printf("\n\t Source Address: %s, Source Port: %u",
869 ip6addr_string(obj_tptr
),
870 EXTRACT_16BITS(obj_tptr
+18));
875 printf("\n\t Source Address: %s, Flow Label: %u",
876 ip6addr_string(obj_tptr
),
877 EXTRACT_24BITS(obj_tptr
+17));
881 case RSVP_CTYPE_TUNNEL_IPV6
:
882 printf("\n\t Source Address: %s, LSP-ID: 0x%04x",
883 ipaddr_string(obj_tptr
),
884 EXTRACT_16BITS(obj_tptr
+18));
889 case RSVP_CTYPE_TUNNEL_IPV4
:
890 printf("\n\t Source Address: %s, LSP-ID: 0x%04x",
891 ipaddr_string(obj_tptr
),
892 EXTRACT_16BITS(obj_tptr
+6));
901 case RSVP_OBJ_FASTREROUTE
:
902 switch(rsvp_obj_ctype
) {
903 case RSVP_CTYPE_TUNNEL_IPV4
:
904 bw
.i
= EXTRACT_32BITS(obj_tptr
+4);
905 printf("\n\t Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps",
910 printf("\n\t Include Colors: 0x%08x, Exclude Colors: 0x%08x",
911 EXTRACT_32BITS(obj_tptr
+8),
912 EXTRACT_32BITS(obj_tptr
+12));
921 case RSVP_OBJ_DETOUR
:
922 switch(rsvp_obj_ctype
) {
923 case RSVP_CTYPE_TUNNEL_IPV4
:
924 while(obj_tlen
>= 8) {
925 printf("\n\t PLR-ID: %s, Avoid-Node-ID: %s",
926 ipaddr_string(obj_tptr
),
927 ipaddr_string(obj_tptr
+4));
937 case RSVP_OBJ_ERROR_SPEC
:
938 switch(rsvp_obj_ctype
) {
939 case RSVP_CTYPE_IPV4
:
940 error_code
=*(obj_tptr
+5);
941 error_value
=EXTRACT_16BITS(obj_tptr
+6);
942 printf("\n\t Error Node Adress: %s, Flags: [0x%02x]\n\t Error Code: %s (%u)",
943 ipaddr_string(obj_tptr
),
945 tok2str(rsvp_obj_error_code_values
,"unknown",error_code
),
948 switch (error_code
) {
949 case RSVP_OBJ_ERROR_SPEC_CODE_ROUTING
:
950 printf(", Error Value: %s (%u)",
951 tok2str(rsvp_obj_error_code_routing_values
,"unknown",error_value
));
954 printf(", Unknown Error Value (%u)");
958 case RSVP_CTYPE_IPV6
:
959 error_code
=*(obj_tptr
+17);
960 error_value
=EXTRACT_16BITS(obj_tptr
+18);
961 printf("\n\t Error Node Adress: %s, Flags: [0x%02x]\n\t Error Code: %s (%u)",
962 ip6addr_string(obj_tptr
),
964 tok2str(rsvp_obj_error_code_values
,"unknown",error_code
),
968 switch (error_code
) {
969 case RSVP_OBJ_ERROR_SPEC_CODE_ROUTING
:
970 printf(", Error Value: %s (%u)",
971 tok2str(rsvp_obj_error_code_routing_values
,"unknown",error_value
));
974 printf(", Unknown Error Value (%u)");
984 case RSVP_OBJ_PROPERTIES
:
985 switch(rsvp_obj_ctype
) {
987 padbytes
= EXTRACT_16BITS(obj_tptr
+2);
988 printf("\n\t TLV count: %u, padding bytes: %u",
989 EXTRACT_16BITS(obj_tptr
),
993 /* loop through as long there is anything longer than the TLV header (2) */
994 while(obj_tlen
>= 2 + padbytes
) {
995 printf("\n\t %s TLV (0x%02x), length: %u", /* length includes header */
996 tok2str(rsvp_obj_prop_tlv_values
,"unknown",*obj_tptr
),
999 print_unknown_data(obj_tptr
+2,"\n\t\t",*(obj_tptr
+1)-2);
1000 obj_tlen
-=*(obj_tptr
+1);
1001 obj_tptr
+=*(obj_tptr
+1);
1010 * FIXME those are the defined objects that lack a decoder
1011 * you are welcome to contribute code ;-)
1014 case RSVP_OBJ_INTEGRITY
:
1015 case RSVP_OBJ_SCOPE
:
1016 case RSVP_OBJ_POLICY_DATA
:
1017 case RSVP_OBJ_MESSAGE_ID
:
1018 case RSVP_OBJ_MESSAGE_ID_ACK
:
1019 case RSVP_OBJ_MESSAGE_ID_LIST
:
1020 case RSVP_OBJ_RECOVERY_LABEL
:
1021 case RSVP_OBJ_UPSTREAM_LABEL
:
1022 case RSVP_OBJ_SUGGESTED_LABEL
:
1025 print_unknown_data(obj_tptr
,"\n\t ",obj_tlen
);
1028 /* do we want to see an additionally hexdump ? */
1029 if (vflag
> 1 || hexdump
==TRUE
)
1030 print_unknown_data(tptr
+sizeof(sizeof(struct rsvp_object_header
)),"\n\t ",
1031 rsvp_obj_len
-sizeof(struct rsvp_object_header
));
1038 printf("\n\t\t packet exceeded snapshot");