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.19 2003-05-08 14:52:20 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 /* draft-ietf-mpls-rsvp-lsp-fastreroute-02.txt */
246 static const struct tok rsvp_obj_rro_flag_values
[] = {
247 { 0x01, "Local protection available" },
248 { 0x02, "Local protection in use" },
249 { 0x04, "Bandwidth protection" },
250 { 0x08, "Node protection" },
254 static const struct tok rsvp_resstyle_values
[] = {
255 { 17, "Wildcard Filter" },
256 { 10, "Fixed Filter" },
257 { 18, "Shared Explicit" },
261 #define RSVP_OBJ_INTSERV_GUARANTEED_SERV 2
262 #define RSVP_OBJ_INTSERV_CONTROLLED_LOAD 5
264 static const struct tok rsvp_intserv_service_type_values
[] = {
265 { 1, "Default/Global Information" },
266 { RSVP_OBJ_INTSERV_GUARANTEED_SERV
, "Guaranteed Service" },
267 { RSVP_OBJ_INTSERV_CONTROLLED_LOAD
, "Controlled Load" },
271 static const struct tok rsvp_intserv_parameter_id_values
[] = {
273 { 6, "Path b/w estimate" },
274 { 8, "Minimum path latency" },
275 { 10, "Composed MTU" },
276 { 127, "Token Bucket TSpec" },
277 { 130, "Guaranteed Service RSpec" },
278 { 133, "End-to-end composed value for C" },
279 { 134, "End-to-end composed value for D" },
280 { 135, "Since-last-reshaping point composed C" },
281 { 136, "Since-last-reshaping point composed D" },
285 static struct tok rsvp_session_attribute_flag_values
[] = {
286 { 0x01, "Local Protection desired" },
287 { 0x02, "Label Recording desired" },
288 { 0x04, "SE Style desired" },
289 { 0x08, "Bandwidth protection desired" }, /* draft-ietf-mpls-rsvp-lsp-fastreroute-02.txt */
290 { 0x10, "Node protection desired" }, /* draft-ietf-mpls-rsvp-lsp-fastreroute-02.txt */
294 static struct tok rsvp_obj_prop_tlv_values
[] = {
296 { 0x02, "Metric 1" },
297 { 0x04, "Metric 2" },
298 { 0x08, "CCC Status" },
299 { 0x10, "Path Type" },
303 #define RSVP_OBJ_ERROR_SPEC_CODE_ROUTING 24
304 #define RSVP_OBJ_ERROR_SPEC_CODE_NOTIFY 25
306 static struct tok rsvp_obj_error_code_values
[] = {
307 { RSVP_OBJ_ERROR_SPEC_CODE_ROUTING
, "Routing Problem" },
308 { RSVP_OBJ_ERROR_SPEC_CODE_NOTIFY
, "Notify Error" },
312 static struct tok rsvp_obj_error_code_routing_values
[] = {
313 { 1, "Bad EXPLICIT_ROUTE object" },
314 { 2, "Bad strict node" },
315 { 3, "Bad loose node" },
316 { 4, "Bad initial subobject" },
317 { 5, "No route available toward destination" },
318 { 6, "Unacceptable label value" },
319 { 7, "RRO indicated routing loops" },
320 { 8, "non-RSVP-capable router in the path" },
321 { 9, "MPLS label allocation failure" },
322 { 10, "Unsupported L3PID" },
330 int rsvp_intserv_print(const u_char
*);
333 * this is a dissector for all the intserv defined
334 * specs as defined per rfc2215
335 * it is called from various rsvp objects;
336 * returns the amount of bytes being processed
339 rsvp_intserv_print(const u_char
*tptr
) {
341 int parameter_id
,parameter_length
;
347 parameter_id
= *(tptr
);
348 parameter_length
= EXTRACT_16BITS(tptr
+2)<<2; /* convert wordcount to bytecount */
350 printf("\n\t Parameter ID: %s (%u), length: %u, Flags: [0x%02x]",
351 tok2str(rsvp_intserv_parameter_id_values
,"unknown",parameter_id
),
356 switch(parameter_id
) { /* parameter_id */
360 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
361 * | 4 (e) | (f) | 1 (g) |
362 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
363 * | IS hop cnt (32-bit unsigned integer) |
364 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
366 printf("\n\t\tIS hop cnt: %u", EXTRACT_32BITS(tptr
+4));
371 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
372 * | 6 (h) | (i) | 1 (j) |
373 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
374 * | Path b/w estimate (32-bit IEEE floating point number) |
375 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
377 bw
.i
= EXTRACT_32BITS(tptr
+4);
378 printf("\n\t\tPath b/w estimate: %.10g Mbps", bw
.f
/125000);
383 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
384 * | 8 (k) | (l) | 1 (m) |
385 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
386 * | Minimum path latency (32-bit integer) |
387 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
389 printf("\n\t\tMinimum path latency: ");
390 if (EXTRACT_32BITS(tptr
+4) == 0xffffffff)
391 printf("don't care");
393 printf("%u", EXTRACT_32BITS(tptr
+4));
399 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
400 * | 10 (n) | (o) | 1 (p) |
401 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
402 * | Composed MTU (32-bit unsigned integer) |
403 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
405 printf("\n\t\tComposed MTU: %u bytes", EXTRACT_32BITS(tptr
+4));
409 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
410 * | 127 (e) | 0 (f) | 5 (g) |
411 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
412 * | Token Bucket Rate [r] (32-bit IEEE floating point number) |
413 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
414 * | Token Bucket Size [b] (32-bit IEEE floating point number) |
415 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
416 * | Peak Data Rate [p] (32-bit IEEE floating point number) |
417 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
418 * | Minimum Policed Unit [m] (32-bit integer) |
419 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
420 * | Maximum Packet Size [M] (32-bit integer) |
421 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
424 bw
.i
= EXTRACT_32BITS(tptr
+4);
425 printf("\n\t\tToken Bucket Rate: %.10g Mbps", bw
.f
/125000);
426 bw
.i
= EXTRACT_32BITS(tptr
+8);
427 printf("\n\t\tToken Bucket Size: %.10g bytes", bw
.f
);
428 bw
.i
= EXTRACT_32BITS(tptr
+12);
429 printf("\n\t\tPeak Data Rate: %.10g Mbps", bw
.f
/125000);
430 printf("\n\t\tMinimum Policed Unit: %u bytes", EXTRACT_32BITS(tptr
+16));
431 printf("\n\t\tMaximum Packet Size: %u bytes", EXTRACT_32BITS(tptr
+20));
436 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
437 * | 130 (h) | 0 (i) | 2 (j) |
438 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
439 * | Rate [R] (32-bit IEEE floating point number) |
440 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
441 * | Slack Term [S] (32-bit integer) |
442 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
445 bw
.i
= EXTRACT_32BITS(tptr
+4);
446 printf("\n\t\tRate: %.10g Mbps", bw
.f
/125000);
447 printf("\n\t\tSlack Term: %u", EXTRACT_32BITS(tptr
+8));
454 printf("\n\t\tValue: %u", EXTRACT_32BITS(tptr
+4));
459 print_unknown_data(tptr
+4,"\n\t\t",parameter_length
);
461 return (parameter_length
+4); /* header length 4 bytes */
465 rsvp_print(register const u_char
*pptr
, register u_int len
) {
467 const struct rsvp_common_header
*rsvp_com_header
;
468 const struct rsvp_object_header
*rsvp_obj_header
;
469 const u_char
*tptr
,*obj_tptr
;
470 u_short tlen
,rsvp_obj_len
,rsvp_obj_ctype
,obj_tlen
,intserv_serv_tlen
;
471 int hexdump
,processed
,padbytes
,error_code
,error_value
;
478 rsvp_com_header
= (const struct rsvp_common_header
*)pptr
;
479 TCHECK(*rsvp_com_header
);
482 * Sanity checking of the header.
484 if (RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
) != RSVP_VERSION
) {
485 printf("RSVP version %u packet not supported",
486 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
));
490 /* in non-verbose mode just lets print the basic Message Type*/
492 printf("RSVP %s Message, length: %u",
493 tok2str(rsvp_msg_type_values
, "unknown (%u)",rsvp_com_header
->msg_type
),
498 /* ok they seem to want to know everything - lets fully decode it */
500 tlen
=EXTRACT_16BITS(rsvp_com_header
->length
);
502 printf("RSVP\n\tv: %u, msg-type: %s, length: %u, ttl: %u, checksum: 0x%04x",
503 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
),
504 tok2str(rsvp_msg_type_values
, "unknown, type: %u",rsvp_com_header
->msg_type
),
506 rsvp_com_header
->ttl
,
507 EXTRACT_16BITS(rsvp_com_header
->checksum
));
509 tptr
+=sizeof(const struct rsvp_common_header
);
510 tlen
-=sizeof(const struct rsvp_common_header
);
513 /* did we capture enough for fully decoding the object header ? */
514 if (!TTEST2(*tptr
, sizeof(struct rsvp_object_header
)))
517 rsvp_obj_header
= (const struct rsvp_object_header
*)tptr
;
518 rsvp_obj_len
=EXTRACT_16BITS(rsvp_obj_header
->length
);
519 rsvp_obj_ctype
=rsvp_obj_header
->ctype
;
521 if(rsvp_obj_len
% 4 || rsvp_obj_len
< 4)
524 printf("\n\t %s Object (%u) Flags: [%s",
525 tok2str(rsvp_obj_values
,
527 rsvp_obj_header
->class_num
),
528 rsvp_obj_header
->class_num
,
529 ((rsvp_obj_header
->class_num
)&0x80) ? "ignore" : "reject");
531 if (rsvp_obj_header
->class_num
> 128)
533 ((rsvp_obj_header
->class_num
)&0x40) ? "and forward" : "silently");
535 printf(" if unknown], Class-Type: %s (%u), length: %u",
536 tok2str(rsvp_ctype_values
,
538 ((rsvp_obj_header
->class_num
)<<8)+rsvp_obj_ctype
),
542 obj_tptr
=tptr
+sizeof(struct rsvp_object_header
);
543 obj_tlen
=rsvp_obj_len
-sizeof(struct rsvp_object_header
);
545 /* did we capture enough for fully decoding the object ? */
546 if (!TTEST2(*tptr
, rsvp_obj_len
))
550 switch(rsvp_obj_header
->class_num
) {
551 case RSVP_OBJ_SESSION
:
552 switch(rsvp_obj_ctype
) {
553 case RSVP_CTYPE_IPV4
:
554 printf("\n\t IPv4 DestAddress: %s, Protocol ID: 0x%02x",
555 ipaddr_string(obj_tptr
),
557 printf("\n\t Flags: [0x%02x], DestPort %u",
559 EXTRACT_16BITS(obj_tptr
+6));
564 case RSVP_CTYPE_IPV6
:
565 printf("\n\t IPv6 DestAddress: %s, Protocol ID: 0x%02x",
566 ip6addr_string(obj_tptr
),
568 printf("\n\t Flags: [0x%02x], DestPort %u",
570 EXTRACT_16BITS(obj_tptr
+18));
575 case RSVP_CTYPE_TUNNEL_IPV6
:
576 printf("\n\t IPv6 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
577 ip6addr_string(obj_tptr
),
578 EXTRACT_16BITS(obj_tptr
+18),
579 ip6addr_string(obj_tptr
+20));
584 case RSVP_CTYPE_TUNNEL_IPV4
:
585 printf("\n\t IPv4 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
586 ipaddr_string(obj_tptr
),
587 EXTRACT_16BITS(obj_tptr
+6),
588 ipaddr_string(obj_tptr
+8));
597 case RSVP_OBJ_CONFIRM
:
598 switch(rsvp_obj_ctype
) {
599 case RSVP_CTYPE_IPV4
:
600 printf("\n\t IPv4 ReceiverAddress: %s",
601 ipaddr_string(obj_tptr
));
606 case RSVP_CTYPE_IPV6
:
607 printf("\n\t IPv6 ReceiverAddress: %s",
608 ip6addr_string(obj_tptr
));
619 switch(rsvp_obj_ctype
) {
621 while(obj_tlen
>= 4 ) {
622 printf("\n\t Label: %u", EXTRACT_32BITS(obj_tptr
));
633 switch(rsvp_obj_ctype
) {
635 printf("\n\t Reservation Style: %s, Flags: [0x%02x]",
636 tok2str(rsvp_resstyle_values
,
638 EXTRACT_24BITS(obj_tptr
+1)),
648 case RSVP_OBJ_SENDER_TEMPLATE
:
649 switch(rsvp_obj_ctype
) {
650 case RSVP_CTYPE_IPV4
:
651 printf("\n\t Source Address: %s, Source Port: %u",
652 ipaddr_string(obj_tptr
),
653 EXTRACT_16BITS(obj_tptr
+6));
658 case RSVP_CTYPE_IPV6
:
659 printf("\n\t Source Address: %s, Source Port: %u",
660 ip6addr_string(obj_tptr
),
661 EXTRACT_16BITS(obj_tptr
+18));
666 case RSVP_CTYPE_TUNNEL_IPV4
:
667 printf("\n\t IPv4 Tunnel Sender Address: %s, LSP-ID: 0x%04x",
668 ipaddr_string(obj_tptr
),
669 EXTRACT_16BITS(obj_tptr
+6));
678 case RSVP_OBJ_LABEL_REQ
:
679 switch(rsvp_obj_ctype
) {
681 while(obj_tlen
>= 4 ) {
682 printf("\n\t L3 Protocol ID: %s",
683 tok2str(ethertype_values
,
684 "Unknown Protocol 0x%04x",
685 EXTRACT_16BITS(obj_tptr
+2)));
691 printf("\n\t L3 Protocol ID: %s",
692 tok2str(ethertype_values
,
693 "Unknown Protocol 0x%04x",
694 EXTRACT_16BITS(obj_tptr
+2)));
695 printf(",%s merge capability",((*(obj_tptr
+4))&0x80) ? "no" : "" );
696 printf("\n\t Minimum VPI/VCI %u/%u",
697 (EXTRACT_16BITS(obj_tptr
+4))&0xfff,
698 (EXTRACT_16BITS(obj_tptr
+6))&0xfff);
699 printf("\n\t Maximum VPI/VCI %u/%u",
700 (EXTRACT_16BITS(obj_tptr
+8))&0xfff,
701 (EXTRACT_16BITS(obj_tptr
+10))&0xfff);
706 printf("\n\t L3 Protocol ID: %s",
707 tok2str(ethertype_values
,
708 "Unknown Protocol 0x%04x",
709 EXTRACT_16BITS(obj_tptr
+2)));
710 printf("\n\t Minimum/Maximum DLCI %u/%u, %s%s bit DLCI",
711 (EXTRACT_32BITS(obj_tptr
+4))&0x7fffff,
712 (EXTRACT_32BITS(obj_tptr
+8))&0x7fffff,
713 (((EXTRACT_16BITS(obj_tptr
+4)>>7)&3) == 0 ) ? "10" : "",
714 (((EXTRACT_16BITS(obj_tptr
+4)>>7)&3) == 2 ) ? "23" : "");
725 switch(rsvp_obj_ctype
) {
726 case RSVP_CTYPE_IPV4
:
727 while(obj_tlen
>= 4 ) {
728 printf("\n\t Subobject Type: %s",
729 tok2str(rsvp_obj_xro_values
,
731 RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr
)));
732 switch(RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr
)) {
733 case RSVP_OBJ_XRO_IPV4
:
734 printf(", %s, %s/%u, Flags: [%s]",
735 RSVP_OBJ_XRO_MASK_LOOSE(*obj_tptr
) ? "Loose" : "Strict",
736 ipaddr_string(obj_tptr
+2),
738 bittok2str(rsvp_obj_rro_flag_values
,
740 *(obj_tptr
+7))); /* rfc3209 says that this field is rsvd. */
742 obj_tlen
-=*(obj_tptr
+1);
743 obj_tptr
+=*(obj_tptr
+1);
752 switch(rsvp_obj_ctype
) {
755 printf("\n\t Source Instance 0x%08x, Destination Instance 0x%08x",
756 EXTRACT_32BITS(obj_tptr
),
757 EXTRACT_32BITS(obj_tptr
+4));
766 case RSVP_OBJ_RESTART_CAPABILITY
:
767 switch(rsvp_obj_ctype
) {
769 printf("\n\t Restart Time: %ums\n\t Recovery Time: %ums",
770 EXTRACT_16BITS(obj_tptr
),
771 EXTRACT_16BITS(obj_tptr
+4));
778 case RSVP_OBJ_SESSION_ATTRIBUTE
:
779 switch(rsvp_obj_ctype
) {
780 case RSVP_CTYPE_TUNNEL_IPV4
:
781 printf("\n\t Session Name: %s",(obj_tptr
+4));
782 printf("\n\t Setup Priority: %u, Holding Priority: %u, Flags: [%s]",
785 tok2str(rsvp_session_attribute_flag_values
,
789 obj_tlen
-=4+*(obj_tptr
+3);
790 obj_tptr
+=4+*(obj_tptr
+3);
797 case RSVP_OBJ_RSVP_HOP
:
798 switch(rsvp_obj_ctype
) {
799 case RSVP_CTYPE_IPV4
:
800 printf("\n\t Previous/Next Interface: %s, Logical Interface Handle: 0x%08x",
801 ipaddr_string(obj_tptr
),
802 EXTRACT_32BITS(obj_tptr
+4));
807 case RSVP_CTYPE_IPV6
:
808 printf("\n\t Previous/Next Interface: %s, Logical Interface Handle: 0x%08x",
809 ip6addr_string(obj_tptr
),
810 EXTRACT_32BITS(obj_tptr
+16));
820 case RSVP_OBJ_TIME_VALUES
:
821 switch(rsvp_obj_ctype
) {
823 printf("\n\t Refresh Period: %ums",
824 EXTRACT_32BITS(obj_tptr
));
833 /* those three objects do share the same semantics */
834 case RSVP_OBJ_SENDER_TSPEC
:
835 case RSVP_OBJ_ADSPEC
:
836 case RSVP_OBJ_FLOWSPEC
:
837 switch(rsvp_obj_ctype
) {
839 printf("\n\t Msg-Version: %u, length: %u",
840 (*obj_tptr
& 0xf0) >> 4,
841 EXTRACT_16BITS(obj_tptr
+2)<<2);
842 obj_tptr
+=4; /* get to the start of the service header */
845 while (obj_tlen
>= 4) {
846 intserv_serv_tlen
=EXTRACT_16BITS(obj_tptr
+2)<<2;
847 printf("\n\t Service Type: %s (%u), break bit %s set, Service length: %u",
848 tok2str(rsvp_intserv_service_type_values
,"unknown",*(obj_tptr
)),
850 (*(obj_tptr
+1)&0x80) ? "" : "not",
853 obj_tptr
+=4; /* get to the start of the parameter list */
856 while (intserv_serv_tlen
>=4) {
857 processed
= rsvp_intserv_print(obj_tptr
);
861 intserv_serv_tlen
-=processed
;
871 case RSVP_OBJ_FILTERSPEC
:
872 switch(rsvp_obj_ctype
) {
873 case RSVP_CTYPE_IPV4
:
874 printf("\n\t Source Address: %s, Source Port: %u",
875 ipaddr_string(obj_tptr
),
876 EXTRACT_16BITS(obj_tptr
+6));
881 case RSVP_CTYPE_IPV6
:
882 printf("\n\t Source Address: %s, Source Port: %u",
883 ip6addr_string(obj_tptr
),
884 EXTRACT_16BITS(obj_tptr
+18));
889 printf("\n\t Source Address: %s, Flow Label: %u",
890 ip6addr_string(obj_tptr
),
891 EXTRACT_24BITS(obj_tptr
+17));
895 case RSVP_CTYPE_TUNNEL_IPV6
:
896 printf("\n\t Source Address: %s, LSP-ID: 0x%04x",
897 ipaddr_string(obj_tptr
),
898 EXTRACT_16BITS(obj_tptr
+18));
903 case RSVP_CTYPE_TUNNEL_IPV4
:
904 printf("\n\t Source Address: %s, LSP-ID: 0x%04x",
905 ipaddr_string(obj_tptr
),
906 EXTRACT_16BITS(obj_tptr
+6));
915 case RSVP_OBJ_FASTREROUTE
:
916 switch(rsvp_obj_ctype
) {
917 case RSVP_CTYPE_TUNNEL_IPV4
:
918 bw
.i
= EXTRACT_32BITS(obj_tptr
+4);
919 printf("\n\t Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps",
924 printf("\n\t Include Colors: 0x%08x, Exclude Colors: 0x%08x",
925 EXTRACT_32BITS(obj_tptr
+8),
926 EXTRACT_32BITS(obj_tptr
+12));
935 case RSVP_OBJ_DETOUR
:
936 switch(rsvp_obj_ctype
) {
937 case RSVP_CTYPE_TUNNEL_IPV4
:
938 while(obj_tlen
>= 8) {
939 printf("\n\t PLR-ID: %s, Avoid-Node-ID: %s",
940 ipaddr_string(obj_tptr
),
941 ipaddr_string(obj_tptr
+4));
951 case RSVP_OBJ_ERROR_SPEC
:
952 switch(rsvp_obj_ctype
) {
953 case RSVP_CTYPE_IPV4
:
954 error_code
=*(obj_tptr
+5);
955 error_value
=EXTRACT_16BITS(obj_tptr
+6);
956 printf("\n\t Error Node Adress: %s, Flags: [0x%02x]\n\t Error Code: %s (%u)",
957 ipaddr_string(obj_tptr
),
959 tok2str(rsvp_obj_error_code_values
,"unknown",error_code
),
961 switch (error_code
) {
962 case RSVP_OBJ_ERROR_SPEC_CODE_ROUTING
:
963 printf(", Error Value: %s (%u)",
964 tok2str(rsvp_obj_error_code_routing_values
,"unknown",error_value
),
968 printf(", Unknown Error Value (%u)", error_value
);
973 case RSVP_CTYPE_IPV6
:
974 error_code
=*(obj_tptr
+17);
975 error_value
=EXTRACT_16BITS(obj_tptr
+18);
976 printf("\n\t Error Node Adress: %s, Flags: [0x%02x]\n\t Error Code: %s (%u)",
977 ip6addr_string(obj_tptr
),
979 tok2str(rsvp_obj_error_code_values
,"unknown",error_code
),
982 switch (error_code
) {
983 case RSVP_OBJ_ERROR_SPEC_CODE_ROUTING
:
984 printf(", Error Value: %s (%u)",
985 tok2str(rsvp_obj_error_code_routing_values
,"unknown",error_value
),
999 case RSVP_OBJ_PROPERTIES
:
1000 switch(rsvp_obj_ctype
) {
1002 padbytes
= EXTRACT_16BITS(obj_tptr
+2);
1003 printf("\n\t TLV count: %u, padding bytes: %u",
1004 EXTRACT_16BITS(obj_tptr
),
1008 /* loop through as long there is anything longer than the TLV header (2) */
1009 while(obj_tlen
>= 2 + padbytes
) {
1010 printf("\n\t %s TLV (0x%02x), length: %u", /* length includes header */
1011 tok2str(rsvp_obj_prop_tlv_values
,"unknown",*obj_tptr
),
1014 print_unknown_data(obj_tptr
+2,"\n\t\t",*(obj_tptr
+1)-2);
1015 obj_tlen
-=*(obj_tptr
+1);
1016 obj_tptr
+=*(obj_tptr
+1);
1025 * FIXME those are the defined objects that lack a decoder
1026 * you are welcome to contribute code ;-)
1029 case RSVP_OBJ_INTEGRITY
:
1030 case RSVP_OBJ_SCOPE
:
1031 case RSVP_OBJ_POLICY_DATA
:
1032 case RSVP_OBJ_MESSAGE_ID
:
1033 case RSVP_OBJ_MESSAGE_ID_ACK
:
1034 case RSVP_OBJ_MESSAGE_ID_LIST
:
1035 case RSVP_OBJ_RECOVERY_LABEL
:
1036 case RSVP_OBJ_UPSTREAM_LABEL
:
1037 case RSVP_OBJ_SUGGESTED_LABEL
:
1040 print_unknown_data(obj_tptr
,"\n\t ",obj_tlen
);
1043 /* do we want to see an additionally hexdump ? */
1044 if (vflag
> 1 || hexdump
==TRUE
)
1045 print_unknown_data(tptr
+sizeof(sizeof(struct rsvp_object_header
)),"\n\t ",
1046 rsvp_obj_len
-sizeof(struct rsvp_object_header
));
1053 printf("\n\t\t packet exceeded snapshot");