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.20 2003-06-07 22:41:31 hannes Exp $";
25 #include <tcpdump-stdinc.h>
31 #include "interface.h"
33 #include "addrtoname.h"
34 #include "ethertype.h"
38 * RFC 2205 common header
41 * +-------------+-------------+-------------+-------------+
42 * | Vers | Flags| Msg Type | RSVP Checksum |
43 * +-------------+-------------+-------------+-------------+
44 * | Send_TTL | (Reserved) | RSVP Length |
45 * +-------------+-------------+-------------+-------------+
49 struct rsvp_common_header
{
50 u_int8_t version_flags
;
59 * RFC2205 object header
63 * +-------------+-------------+-------------+-------------+
64 * | Length (bytes) | Class-Num | C-Type |
65 * +-------------+-------------+-------------+-------------+
67 * // (Object contents) //
69 * +-------------+-------------+-------------+-------------+
72 struct rsvp_object_header
{
78 #define RSVP_VERSION 1
79 #define RSVP_EXTRACT_VERSION(x) (((x)&0xf0)>>4)
81 #define RSVP_MSGTYPE_PATH 1
82 #define RSVP_MSGTYPE_RESV 2
83 #define RSVP_MSGTYPE_PATHERR 3
84 #define RSVP_MSGTYPE_RESVERR 4
85 #define RSVP_MSGTYPE_PATHTEAR 5
86 #define RSVP_MSGTYPE_RESVTEAR 6
87 #define RSVP_MSGTYPE_RESVCONF 7
88 #define RSVP_MSGTYPE_AGGREGATE 12
89 #define RSVP_MSGTYPE_ACK 13
90 #define RSVP_MSGTYPE_HELLO_OLD 14 /* ancient Hellos */
91 #define RSVP_MSGTYPE_SREFRESH 15
92 #define RSVP_MSGTYPE_HELLO 20
94 static const struct tok rsvp_msg_type_values
[] = {
95 { RSVP_MSGTYPE_PATH
, "Path" },
96 { RSVP_MSGTYPE_RESV
, "Resv" },
97 { RSVP_MSGTYPE_PATHERR
, "PathErr" },
98 { RSVP_MSGTYPE_RESVERR
, "ResvErr" },
99 { RSVP_MSGTYPE_PATHTEAR
, "PathTear" },
100 { RSVP_MSGTYPE_RESVTEAR
, "ResvTear" },
101 { RSVP_MSGTYPE_RESVCONF
, "ResvConf" },
102 { RSVP_MSGTYPE_AGGREGATE
, "Aggregate" },
103 { RSVP_MSGTYPE_ACK
, "Acknowledgement" },
104 { RSVP_MSGTYPE_HELLO_OLD
, "Hello (Old)" },
105 { RSVP_MSGTYPE_SREFRESH
, "Refresh" },
106 { RSVP_MSGTYPE_HELLO
, "Hello" },
110 #define RSVP_OBJ_SESSION 1 /* rfc2205 */
111 #define RSVP_OBJ_RSVP_HOP 3 /* rfc2205, rfc3473 */
112 #define RSVP_OBJ_INTEGRITY 4
113 #define RSVP_OBJ_TIME_VALUES 5 /* rfc2205 */
114 #define RSVP_OBJ_ERROR_SPEC 6
115 #define RSVP_OBJ_SCOPE 7
116 #define RSVP_OBJ_STYLE 8 /* rfc2205 */
117 #define RSVP_OBJ_FLOWSPEC 9 /* rfc2215 */
118 #define RSVP_OBJ_FILTERSPEC 10 /* rfc2215 */
119 #define RSVP_OBJ_SENDER_TEMPLATE 11
120 #define RSVP_OBJ_SENDER_TSPEC 12 /* rfc2215 */
121 #define RSVP_OBJ_ADSPEC 13 /* rfc2215 */
122 #define RSVP_OBJ_POLICY_DATA 14
123 #define RSVP_OBJ_CONFIRM 15 /* rfc2205 */
124 #define RSVP_OBJ_LABEL 16 /* rfc3209 */
125 #define RSVP_OBJ_LABEL_REQ 19 /* rfc3209 */
126 #define RSVP_OBJ_ERO 20 /* rfc3209 */
127 #define RSVP_OBJ_RRO 21 /* rfc3209 */
128 #define RSVP_OBJ_HELLO 22 /* rfc3209 */
129 #define RSVP_OBJ_MESSAGE_ID 23
130 #define RSVP_OBJ_MESSAGE_ID_ACK 24
131 #define RSVP_OBJ_MESSAGE_ID_LIST 25
132 #define RSVP_OBJ_RECOVERY_LABEL 34 /* rfc3473 */
133 #define RSVP_OBJ_UPSTREAM_LABEL 35 /* rfc3473 */
134 #define RSVP_OBJ_LABEL_SET 36 /* rfc3473 */
135 #define RSVP_OBJ_PROTECTION 37 /* rfc3473 */
136 #define RSVP_OBJ_DETOUR 63 /* draft-ietf-mpls-rsvp-lsp-fastreroute-01 */
137 #define RSVP_OBJ_SUGGESTED_LABEL 129 /* rfc3473 */
138 #define RSVP_OBJ_ACCEPT_LABEL_SET 130 /* rfc3473 */
139 #define RSVP_OBJ_RESTART_CAPABILITY 131 /* rfc3473 */
140 #define RSVP_OBJ_NOTIFY_REQ 195 /* rfc3473 */
141 #define RSVP_OBJ_ADMIN_STATUS 196 /* rfc3473 */
142 #define RSVP_OBJ_PROPERTIES 204 /* juniper proprietary */
143 #define RSVP_OBJ_FASTREROUTE 205 /* draft-ietf-mpls-rsvp-lsp-fastreroute-01 */
144 #define RSVP_OBJ_SESSION_ATTRIBUTE 207 /* rfc3209 */
145 #define RSVP_OBJ_CALL_ID 230 /* rfc3474 */
146 #define RSVP_OBJ_CALL_OPS 236 /* rfc3474 */
148 static const struct tok rsvp_obj_values
[] = {
149 { RSVP_OBJ_SESSION
, "Session" },
150 { RSVP_OBJ_RSVP_HOP
, "RSVP Hop" },
151 { RSVP_OBJ_INTEGRITY
, "Integrity" },
152 { RSVP_OBJ_TIME_VALUES
, "Time Values" },
153 { RSVP_OBJ_ERROR_SPEC
, "Error Spec" },
154 { RSVP_OBJ_SCOPE
, "Scope" },
155 { RSVP_OBJ_STYLE
, "Style" },
156 { RSVP_OBJ_FLOWSPEC
, "Flowspec" },
157 { RSVP_OBJ_FILTERSPEC
, "FilterSpec" },
158 { RSVP_OBJ_SENDER_TEMPLATE
, "Sender Template" },
159 { RSVP_OBJ_SENDER_TSPEC
, "Sender TSpec" },
160 { RSVP_OBJ_ADSPEC
, "Adspec" },
161 { RSVP_OBJ_POLICY_DATA
, "Policy Data" },
162 { RSVP_OBJ_CONFIRM
, "Confirm" },
163 { RSVP_OBJ_LABEL
, "Label" },
164 { RSVP_OBJ_LABEL_REQ
, "Label Request" },
165 { RSVP_OBJ_ERO
, "ERO" },
166 { RSVP_OBJ_RRO
, "RRO" },
167 { RSVP_OBJ_HELLO
, "Hello" },
168 { RSVP_OBJ_MESSAGE_ID
, "Message ID" },
169 { RSVP_OBJ_MESSAGE_ID_ACK
, "Message ID Ack" },
170 { RSVP_OBJ_MESSAGE_ID_LIST
, "Message ID List" },
171 { RSVP_OBJ_RECOVERY_LABEL
, "Recovery Label" },
172 { RSVP_OBJ_UPSTREAM_LABEL
, "Upstream Label" },
173 { RSVP_OBJ_LABEL_SET
, "Label Set" },
174 { RSVP_OBJ_ACCEPT_LABEL_SET
, "Acceptable Label Set" },
175 { RSVP_OBJ_DETOUR
, "Detour" },
176 { RSVP_OBJ_SUGGESTED_LABEL
, "Suggested Label" },
177 { RSVP_OBJ_PROPERTIES
, "Properties" },
178 { RSVP_OBJ_FASTREROUTE
, "Fast Re-Route" },
179 { RSVP_OBJ_SESSION_ATTRIBUTE
, "Session Attribute" },
180 { RSVP_OBJ_CALL_ID
, "Call-ID" },
181 { RSVP_OBJ_CALL_OPS
, "Call Capability" },
182 { RSVP_OBJ_RESTART_CAPABILITY
, "Restart Capability" },
183 { RSVP_OBJ_NOTIFY_REQ
, "Notify Request" },
184 { RSVP_OBJ_PROTECTION
, "Protection" },
185 { RSVP_OBJ_ADMIN_STATUS
, "Administrative Status" },
189 #define RSVP_CTYPE_IPV4 1
190 #define RSVP_CTYPE_IPV6 2
191 #define RSVP_CTYPE_TUNNEL_IPV4 7
192 #define RSVP_CTYPE_TUNNEL_IPV6 8
193 #define RSVP_CTYPE_1 1
194 #define RSVP_CTYPE_2 2
195 #define RSVP_CTYPE_3 3
196 #define RSVP_CTYPE_4 4
199 * the ctypes are not globally unique so for
200 * translating it to strings we build a table based
201 * on objects offsetted by the ctype
204 static const struct tok rsvp_ctype_values
[] = {
205 { 256*RSVP_OBJ_RSVP_HOP
+RSVP_CTYPE_IPV4
, "IPv4" },
206 { 256*RSVP_OBJ_RSVP_HOP
+RSVP_CTYPE_IPV6
, "IPv6" },
207 { 256*RSVP_OBJ_RSVP_HOP
+RSVP_CTYPE_3
, "IPv4 plus opt. TLVs" },
208 { 256*RSVP_OBJ_RSVP_HOP
+RSVP_CTYPE_4
, "IPv6 plus opt. TLVs" },
209 { 256*RSVP_OBJ_NOTIFY_REQ
+RSVP_CTYPE_IPV4
, "IPv4" },
210 { 256*RSVP_OBJ_NOTIFY_REQ
+RSVP_CTYPE_IPV6
, "IPv6" },
211 { 256*RSVP_OBJ_CONFIRM
+RSVP_CTYPE_IPV4
, "IPv4" },
212 { 256*RSVP_OBJ_CONFIRM
+RSVP_CTYPE_IPV6
, "IPv6" },
213 { 256*RSVP_OBJ_TIME_VALUES
+RSVP_CTYPE_1
, "1" },
214 { 256*RSVP_OBJ_FLOWSPEC
+RSVP_CTYPE_1
, "obsolete" },
215 { 256*RSVP_OBJ_FLOWSPEC
+RSVP_CTYPE_2
, "IntServ" },
216 { 256*RSVP_OBJ_SENDER_TSPEC
+RSVP_CTYPE_2
, "IntServ" },
217 { 256*RSVP_OBJ_ADSPEC
+RSVP_CTYPE_2
, "IntServ" },
218 { 256*RSVP_OBJ_FILTERSPEC
+RSVP_CTYPE_IPV4
, "IPv4" },
219 { 256*RSVP_OBJ_FILTERSPEC
+RSVP_CTYPE_IPV6
, "IPv6" },
220 { 256*RSVP_OBJ_FILTERSPEC
+RSVP_CTYPE_3
, "IPv6 Flow-label" },
221 { 256*RSVP_OBJ_FILTERSPEC
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
222 { 256*RSVP_OBJ_SESSION
+RSVP_CTYPE_IPV4
, "IPv4" },
223 { 256*RSVP_OBJ_SESSION
+RSVP_CTYPE_IPV6
, "IPv6" },
224 { 256*RSVP_OBJ_SESSION
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
225 { 256*RSVP_OBJ_SENDER_TEMPLATE
+RSVP_CTYPE_IPV4
, "IPv4" },
226 { 256*RSVP_OBJ_SENDER_TEMPLATE
+RSVP_CTYPE_IPV6
, "IPv6" },
227 { 256*RSVP_OBJ_SENDER_TEMPLATE
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
228 { 256*RSVP_OBJ_STYLE
+RSVP_CTYPE_1
, "1" },
229 { 256*RSVP_OBJ_HELLO
+RSVP_CTYPE_1
, "Hello Request" },
230 { 256*RSVP_OBJ_HELLO
+RSVP_CTYPE_2
, "Hello Ack" },
231 { 256*RSVP_OBJ_LABEL_REQ
+RSVP_CTYPE_1
, "without label range" },
232 { 256*RSVP_OBJ_LABEL_REQ
+RSVP_CTYPE_2
, "with ATM label range" },
233 { 256*RSVP_OBJ_LABEL_REQ
+RSVP_CTYPE_3
, "with FR label range" },
234 { 256*RSVP_OBJ_LABEL_REQ
+RSVP_CTYPE_4
, "generalized" },
235 { 256*RSVP_OBJ_LABEL
+RSVP_CTYPE_1
, "1" },
236 { 256*RSVP_OBJ_LABEL
+RSVP_CTYPE_3
, "Waveband Switching" },
237 { 256*RSVP_OBJ_SUGGESTED_LABEL
+RSVP_CTYPE_1
, "1" },
238 { 256*RSVP_OBJ_SUGGESTED_LABEL
+RSVP_CTYPE_3
, "Waveband Switching" },
239 { 256*RSVP_OBJ_UPSTREAM_LABEL
+RSVP_CTYPE_1
, "1" },
240 { 256*RSVP_OBJ_UPSTREAM_LABEL
+RSVP_CTYPE_3
, "Waveband Switching" },
241 { 256*RSVP_OBJ_ERO
+RSVP_CTYPE_IPV4
, "IPv4" },
242 { 256*RSVP_OBJ_RRO
+RSVP_CTYPE_IPV4
, "IPv4" },
243 { 256*RSVP_OBJ_ERROR_SPEC
+RSVP_CTYPE_IPV4
, "IPv4" },
244 { 256*RSVP_OBJ_ERROR_SPEC
+RSVP_CTYPE_IPV6
, "IPv6" },
245 { 256*RSVP_OBJ_ERROR_SPEC
+RSVP_CTYPE_3
, "IPv4 plus opt. TLVs" },
246 { 256*RSVP_OBJ_ERROR_SPEC
+RSVP_CTYPE_4
, "IPv6 plus opt. TLVs" },
247 { 256*RSVP_OBJ_RESTART_CAPABILITY
+RSVP_CTYPE_1
, "IPv4" },
248 { 256*RSVP_OBJ_SESSION_ATTRIBUTE
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
249 { 256*RSVP_OBJ_FASTREROUTE
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
250 { 256*RSVP_OBJ_DETOUR
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
251 { 256*RSVP_OBJ_PROPERTIES
+RSVP_CTYPE_1
, "1" },
255 #define RSVP_OBJ_XRO_MASK_SUBOBJ(x) ((x)&0x7f)
256 #define RSVP_OBJ_XRO_MASK_LOOSE(x) ((x)&0x80)
258 #define RSVP_OBJ_XRO_RES 0
259 #define RSVP_OBJ_XRO_IPV4 1
260 #define RSVP_OBJ_XRO_IPV6 2
261 #define RSVP_OBJ_XRO_ASN 32
262 #define RSVP_OBJ_XRO_MPLS 64
264 static const struct tok rsvp_obj_xro_values
[] = {
265 { RSVP_OBJ_XRO_RES
, "Reserved" },
266 { RSVP_OBJ_XRO_IPV4
, "IPv4 prefix" },
267 { RSVP_OBJ_XRO_IPV6
, "IPv6 prefix" },
268 { RSVP_OBJ_XRO_ASN
, "Autonomous system number" },
269 { RSVP_OBJ_XRO_MPLS
, "MPLS label switched path termination" },
273 /* draft-ietf-mpls-rsvp-lsp-fastreroute-02.txt */
274 static const struct tok rsvp_obj_rro_flag_values
[] = {
275 { 0x01, "Local protection available" },
276 { 0x02, "Local protection in use" },
277 { 0x04, "Bandwidth protection" },
278 { 0x08, "Node protection" },
282 static const struct tok rsvp_resstyle_values
[] = {
283 { 17, "Wildcard Filter" },
284 { 10, "Fixed Filter" },
285 { 18, "Shared Explicit" },
289 #define RSVP_OBJ_INTSERV_GUARANTEED_SERV 2
290 #define RSVP_OBJ_INTSERV_CONTROLLED_LOAD 5
292 static const struct tok rsvp_intserv_service_type_values
[] = {
293 { 1, "Default/Global Information" },
294 { RSVP_OBJ_INTSERV_GUARANTEED_SERV
, "Guaranteed Service" },
295 { RSVP_OBJ_INTSERV_CONTROLLED_LOAD
, "Controlled Load" },
299 static const struct tok rsvp_intserv_parameter_id_values
[] = {
301 { 6, "Path b/w estimate" },
302 { 8, "Minimum path latency" },
303 { 10, "Composed MTU" },
304 { 127, "Token Bucket TSpec" },
305 { 130, "Guaranteed Service RSpec" },
306 { 133, "End-to-end composed value for C" },
307 { 134, "End-to-end composed value for D" },
308 { 135, "Since-last-reshaping point composed C" },
309 { 136, "Since-last-reshaping point composed D" },
313 static struct tok rsvp_session_attribute_flag_values
[] = {
314 { 0x01, "Local Protection desired" },
315 { 0x02, "Label Recording desired" },
316 { 0x04, "SE Style desired" },
317 { 0x08, "Bandwidth protection desired" }, /* draft-ietf-mpls-rsvp-lsp-fastreroute-02.txt */
318 { 0x10, "Node protection desired" }, /* draft-ietf-mpls-rsvp-lsp-fastreroute-02.txt */
322 static struct tok rsvp_obj_prop_tlv_values
[] = {
324 { 0x02, "Metric 1" },
325 { 0x04, "Metric 2" },
326 { 0x08, "CCC Status" },
327 { 0x10, "Path Type" },
331 #define RSVP_OBJ_ERROR_SPEC_CODE_ROUTING 24
332 #define RSVP_OBJ_ERROR_SPEC_CODE_NOTIFY 25
334 static struct tok rsvp_obj_error_code_values
[] = {
335 { RSVP_OBJ_ERROR_SPEC_CODE_ROUTING
, "Routing Problem" },
336 { RSVP_OBJ_ERROR_SPEC_CODE_NOTIFY
, "Notify Error" },
340 static struct tok rsvp_obj_error_code_routing_values
[] = {
341 { 1, "Bad EXPLICIT_ROUTE object" },
342 { 2, "Bad strict node" },
343 { 3, "Bad loose node" },
344 { 4, "Bad initial subobject" },
345 { 5, "No route available toward destination" },
346 { 6, "Unacceptable label value" },
347 { 7, "RRO indicated routing loops" },
348 { 8, "non-RSVP-capable router in the path" },
349 { 9, "MPLS label allocation failure" },
350 { 10, "Unsupported L3PID" },
358 int rsvp_intserv_print(const u_char
*);
361 * this is a dissector for all the intserv defined
362 * specs as defined per rfc2215
363 * it is called from various rsvp objects;
364 * returns the amount of bytes being processed
367 rsvp_intserv_print(const u_char
*tptr
) {
369 int parameter_id
,parameter_length
;
375 parameter_id
= *(tptr
);
376 parameter_length
= EXTRACT_16BITS(tptr
+2)<<2; /* convert wordcount to bytecount */
378 printf("\n\t Parameter ID: %s (%u), length: %u, Flags: [0x%02x]",
379 tok2str(rsvp_intserv_parameter_id_values
,"unknown",parameter_id
),
384 switch(parameter_id
) { /* parameter_id */
388 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
389 * | 4 (e) | (f) | 1 (g) |
390 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
391 * | IS hop cnt (32-bit unsigned integer) |
392 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
394 printf("\n\t\tIS hop cnt: %u", EXTRACT_32BITS(tptr
+4));
399 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
400 * | 6 (h) | (i) | 1 (j) |
401 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
402 * | Path b/w estimate (32-bit IEEE floating point number) |
403 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
405 bw
.i
= EXTRACT_32BITS(tptr
+4);
406 printf("\n\t\tPath b/w estimate: %.10g Mbps", bw
.f
/125000);
411 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
412 * | 8 (k) | (l) | 1 (m) |
413 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
414 * | Minimum path latency (32-bit integer) |
415 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
417 printf("\n\t\tMinimum path latency: ");
418 if (EXTRACT_32BITS(tptr
+4) == 0xffffffff)
419 printf("don't care");
421 printf("%u", EXTRACT_32BITS(tptr
+4));
427 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
428 * | 10 (n) | (o) | 1 (p) |
429 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
430 * | Composed MTU (32-bit unsigned integer) |
431 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
433 printf("\n\t\tComposed MTU: %u bytes", EXTRACT_32BITS(tptr
+4));
437 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
438 * | 127 (e) | 0 (f) | 5 (g) |
439 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
440 * | Token Bucket Rate [r] (32-bit IEEE floating point number) |
441 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
442 * | Token Bucket Size [b] (32-bit IEEE floating point number) |
443 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
444 * | Peak Data Rate [p] (32-bit IEEE floating point number) |
445 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
446 * | Minimum Policed Unit [m] (32-bit integer) |
447 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
448 * | Maximum Packet Size [M] (32-bit integer) |
449 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
452 bw
.i
= EXTRACT_32BITS(tptr
+4);
453 printf("\n\t\tToken Bucket Rate: %.10g Mbps", bw
.f
/125000);
454 bw
.i
= EXTRACT_32BITS(tptr
+8);
455 printf("\n\t\tToken Bucket Size: %.10g bytes", bw
.f
);
456 bw
.i
= EXTRACT_32BITS(tptr
+12);
457 printf("\n\t\tPeak Data Rate: %.10g Mbps", bw
.f
/125000);
458 printf("\n\t\tMinimum Policed Unit: %u bytes", EXTRACT_32BITS(tptr
+16));
459 printf("\n\t\tMaximum Packet Size: %u bytes", EXTRACT_32BITS(tptr
+20));
464 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
465 * | 130 (h) | 0 (i) | 2 (j) |
466 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
467 * | Rate [R] (32-bit IEEE floating point number) |
468 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
469 * | Slack Term [S] (32-bit integer) |
470 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
473 bw
.i
= EXTRACT_32BITS(tptr
+4);
474 printf("\n\t\tRate: %.10g Mbps", bw
.f
/125000);
475 printf("\n\t\tSlack Term: %u", EXTRACT_32BITS(tptr
+8));
482 printf("\n\t\tValue: %u", EXTRACT_32BITS(tptr
+4));
487 print_unknown_data(tptr
+4,"\n\t\t",parameter_length
);
489 return (parameter_length
+4); /* header length 4 bytes */
493 rsvp_print(register const u_char
*pptr
, register u_int len
) {
495 const struct rsvp_common_header
*rsvp_com_header
;
496 const struct rsvp_object_header
*rsvp_obj_header
;
497 const u_char
*tptr
,*obj_tptr
;
498 u_short tlen
,rsvp_obj_len
,rsvp_obj_ctype
,obj_tlen
,intserv_serv_tlen
;
499 int hexdump
,processed
,padbytes
,error_code
,error_value
;
506 rsvp_com_header
= (const struct rsvp_common_header
*)pptr
;
507 TCHECK(*rsvp_com_header
);
510 * Sanity checking of the header.
512 if (RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
) != RSVP_VERSION
) {
513 printf("RSVP version %u packet not supported",
514 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
));
518 /* in non-verbose mode just lets print the basic Message Type*/
520 printf("RSVP %s Message, length: %u",
521 tok2str(rsvp_msg_type_values
, "unknown (%u)",rsvp_com_header
->msg_type
),
526 /* ok they seem to want to know everything - lets fully decode it */
528 tlen
=EXTRACT_16BITS(rsvp_com_header
->length
);
530 printf("RSVP\n\tv: %u, msg-type: %s, length: %u, ttl: %u, checksum: 0x%04x",
531 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
),
532 tok2str(rsvp_msg_type_values
, "unknown, type: %u",rsvp_com_header
->msg_type
),
534 rsvp_com_header
->ttl
,
535 EXTRACT_16BITS(rsvp_com_header
->checksum
));
537 tptr
+=sizeof(const struct rsvp_common_header
);
538 tlen
-=sizeof(const struct rsvp_common_header
);
541 /* did we capture enough for fully decoding the object header ? */
542 if (!TTEST2(*tptr
, sizeof(struct rsvp_object_header
)))
545 rsvp_obj_header
= (const struct rsvp_object_header
*)tptr
;
546 rsvp_obj_len
=EXTRACT_16BITS(rsvp_obj_header
->length
);
547 rsvp_obj_ctype
=rsvp_obj_header
->ctype
;
549 if(rsvp_obj_len
% 4 || rsvp_obj_len
< 4)
552 printf("\n\t %s Object (%u) Flags: [%s",
553 tok2str(rsvp_obj_values
,
555 rsvp_obj_header
->class_num
),
556 rsvp_obj_header
->class_num
,
557 ((rsvp_obj_header
->class_num
)&0x80) ? "ignore" : "reject");
559 if (rsvp_obj_header
->class_num
> 128)
561 ((rsvp_obj_header
->class_num
)&0x40) ? "and forward" : "silently");
563 printf(" if unknown], Class-Type: %s (%u), length: %u",
564 tok2str(rsvp_ctype_values
,
566 ((rsvp_obj_header
->class_num
)<<8)+rsvp_obj_ctype
),
570 obj_tptr
=tptr
+sizeof(struct rsvp_object_header
);
571 obj_tlen
=rsvp_obj_len
-sizeof(struct rsvp_object_header
);
573 /* did we capture enough for fully decoding the object ? */
574 if (!TTEST2(*tptr
, rsvp_obj_len
))
578 switch(rsvp_obj_header
->class_num
) {
579 case RSVP_OBJ_SESSION
:
580 switch(rsvp_obj_ctype
) {
581 case RSVP_CTYPE_IPV4
:
582 printf("\n\t IPv4 DestAddress: %s, Protocol ID: 0x%02x",
583 ipaddr_string(obj_tptr
),
585 printf("\n\t Flags: [0x%02x], DestPort %u",
587 EXTRACT_16BITS(obj_tptr
+6));
592 case RSVP_CTYPE_IPV6
:
593 printf("\n\t IPv6 DestAddress: %s, Protocol ID: 0x%02x",
594 ip6addr_string(obj_tptr
),
596 printf("\n\t Flags: [0x%02x], DestPort %u",
598 EXTRACT_16BITS(obj_tptr
+18));
603 case RSVP_CTYPE_TUNNEL_IPV6
:
604 printf("\n\t IPv6 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
605 ip6addr_string(obj_tptr
),
606 EXTRACT_16BITS(obj_tptr
+18),
607 ip6addr_string(obj_tptr
+20));
612 case RSVP_CTYPE_TUNNEL_IPV4
:
613 printf("\n\t IPv4 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
614 ipaddr_string(obj_tptr
),
615 EXTRACT_16BITS(obj_tptr
+6),
616 ipaddr_string(obj_tptr
+8));
625 case RSVP_OBJ_CONFIRM
:
626 switch(rsvp_obj_ctype
) {
627 case RSVP_CTYPE_IPV4
:
628 printf("\n\t IPv4 ReceiverAddress: %s",
629 ipaddr_string(obj_tptr
));
634 case RSVP_CTYPE_IPV6
:
635 printf("\n\t IPv6 ReceiverAddress: %s",
636 ip6addr_string(obj_tptr
));
646 case RSVP_OBJ_NOTIFY_REQ
:
647 switch(rsvp_obj_ctype
) {
648 case RSVP_CTYPE_IPV4
:
649 printf("\n\t IPv4 Notify Node Address %s",
650 ipaddr_string(obj_tptr
));
655 case RSVP_CTYPE_IPV6
:
656 printf("\n\t IPv6 Notify Node Address %s",
657 ip6addr_string(obj_tptr
));
667 case RSVP_OBJ_SUGGESTED_LABEL
: /* fall through */
668 case RSVP_OBJ_UPSTREAM_LABEL
: /* fall through */
670 switch(rsvp_obj_ctype
) {
672 while(obj_tlen
>= 4 ) {
673 printf("\n\t Label %u", EXTRACT_32BITS(obj_tptr
));
679 printf("\n\t Waveband ID %u\n\t Start Label %u, Stop Label %u",
680 EXTRACT_32BITS(obj_tptr
),
681 EXTRACT_32BITS(obj_tptr
+4),
682 EXTRACT_32BITS(obj_tptr
+8));
692 switch(rsvp_obj_ctype
) {
694 printf("\n\t Reservation Style: %s, Flags: [0x%02x]",
695 tok2str(rsvp_resstyle_values
,
697 EXTRACT_24BITS(obj_tptr
+1)),
707 case RSVP_OBJ_SENDER_TEMPLATE
:
708 switch(rsvp_obj_ctype
) {
709 case RSVP_CTYPE_IPV4
:
710 printf("\n\t Source Address: %s, Source Port: %u",
711 ipaddr_string(obj_tptr
),
712 EXTRACT_16BITS(obj_tptr
+6));
717 case RSVP_CTYPE_IPV6
:
718 printf("\n\t Source Address: %s, Source Port: %u",
719 ip6addr_string(obj_tptr
),
720 EXTRACT_16BITS(obj_tptr
+18));
725 case RSVP_CTYPE_TUNNEL_IPV4
:
726 printf("\n\t IPv4 Tunnel Sender Address: %s, LSP-ID: 0x%04x",
727 ipaddr_string(obj_tptr
),
728 EXTRACT_16BITS(obj_tptr
+6));
737 case RSVP_OBJ_LABEL_REQ
:
738 switch(rsvp_obj_ctype
) {
740 while(obj_tlen
>= 4 ) {
741 printf("\n\t L3 Protocol ID %s",
742 tok2str(ethertype_values
,
743 "Unknown Protocol (0x%04x)",
744 EXTRACT_16BITS(obj_tptr
+2)));
750 printf("\n\t L3 Protocol ID %s",
751 tok2str(ethertype_values
,
752 "Unknown Protocol (0x%04x)",
753 EXTRACT_16BITS(obj_tptr
+2)));
754 printf(",%s merge capability",((*(obj_tptr
+4))&0x80) ? "no" : "" );
755 printf("\n\t Minimum VPI/VCI %u/%u",
756 (EXTRACT_16BITS(obj_tptr
+4))&0xfff,
757 (EXTRACT_16BITS(obj_tptr
+6))&0xfff);
758 printf("\n\t Maximum VPI/VCI %u/%u",
759 (EXTRACT_16BITS(obj_tptr
+8))&0xfff,
760 (EXTRACT_16BITS(obj_tptr
+10))&0xfff);
765 printf("\n\t L3 Protocol ID %s",
766 tok2str(ethertype_values
,
767 "Unknown Protocol (0x%04x)",
768 EXTRACT_16BITS(obj_tptr
+2)));
769 printf("\n\t Minimum/Maximum DLCI %u/%u, %s%s bit DLCI",
770 (EXTRACT_32BITS(obj_tptr
+4))&0x7fffff,
771 (EXTRACT_32BITS(obj_tptr
+8))&0x7fffff,
772 (((EXTRACT_16BITS(obj_tptr
+4)>>7)&3) == 0 ) ? "10" : "",
773 (((EXTRACT_16BITS(obj_tptr
+4)>>7)&3) == 2 ) ? "23" : "");
778 printf("\n\t LSP Encoding Type %s",
779 tok2str(gmpls_encoding_values
,
782 printf("\n\t Switching Type %s, Payload ID %s",
783 tok2str(gmpls_switch_cap_values
,
786 tok2str(gmpls_payload_values
,
788 EXTRACT_16BITS(obj_tptr
+2)));
799 switch(rsvp_obj_ctype
) {
800 case RSVP_CTYPE_IPV4
:
801 while(obj_tlen
>= 4 ) {
802 printf("\n\t Subobject Type: %s",
803 tok2str(rsvp_obj_xro_values
,
805 RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr
)));
806 switch(RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr
)) {
807 case RSVP_OBJ_XRO_IPV4
:
808 printf(", %s, %s/%u, Flags: [%s]",
809 RSVP_OBJ_XRO_MASK_LOOSE(*obj_tptr
) ? "Loose" : "Strict",
810 ipaddr_string(obj_tptr
+2),
812 bittok2str(rsvp_obj_rro_flag_values
,
814 *(obj_tptr
+7))); /* rfc3209 says that this field is rsvd. */
816 obj_tlen
-=*(obj_tptr
+1);
817 obj_tptr
+=*(obj_tptr
+1);
826 switch(rsvp_obj_ctype
) {
829 printf("\n\t Source Instance 0x%08x, Destination Instance 0x%08x",
830 EXTRACT_32BITS(obj_tptr
),
831 EXTRACT_32BITS(obj_tptr
+4));
840 case RSVP_OBJ_RESTART_CAPABILITY
:
841 switch(rsvp_obj_ctype
) {
843 printf("\n\t Restart Time: %ums\n\t Recovery Time: %ums",
844 EXTRACT_16BITS(obj_tptr
),
845 EXTRACT_16BITS(obj_tptr
+4));
852 case RSVP_OBJ_SESSION_ATTRIBUTE
:
853 switch(rsvp_obj_ctype
) {
854 case RSVP_CTYPE_TUNNEL_IPV4
:
855 printf("\n\t Session Name: %s",(obj_tptr
+4));
856 printf("\n\t Setup Priority: %u, Holding Priority: %u, Flags: [%s]",
859 tok2str(rsvp_session_attribute_flag_values
,
863 obj_tlen
-=4+*(obj_tptr
+3);
864 obj_tptr
+=4+*(obj_tptr
+3);
871 case RSVP_OBJ_RSVP_HOP
:
872 switch(rsvp_obj_ctype
) {
873 case RSVP_CTYPE_3
: /* fall through - FIXME add TLV parser */
874 case RSVP_CTYPE_IPV4
:
875 printf("\n\t Previous/Next Interface: %s, Logical Interface Handle: 0x%08x",
876 ipaddr_string(obj_tptr
),
877 EXTRACT_32BITS(obj_tptr
+4));
882 case RSVP_CTYPE_4
: /* fall through - FIXME add TLV parser */
883 case RSVP_CTYPE_IPV6
:
884 printf("\n\t Previous/Next Interface: %s, Logical Interface Handle: 0x%08x",
885 ip6addr_string(obj_tptr
),
886 EXTRACT_32BITS(obj_tptr
+16));
896 case RSVP_OBJ_TIME_VALUES
:
897 switch(rsvp_obj_ctype
) {
899 printf("\n\t Refresh Period: %ums",
900 EXTRACT_32BITS(obj_tptr
));
909 /* those three objects do share the same semantics */
910 case RSVP_OBJ_SENDER_TSPEC
:
911 case RSVP_OBJ_ADSPEC
:
912 case RSVP_OBJ_FLOWSPEC
:
913 switch(rsvp_obj_ctype
) {
915 printf("\n\t Msg-Version: %u, length: %u",
916 (*obj_tptr
& 0xf0) >> 4,
917 EXTRACT_16BITS(obj_tptr
+2)<<2);
918 obj_tptr
+=4; /* get to the start of the service header */
921 while (obj_tlen
>= 4) {
922 intserv_serv_tlen
=EXTRACT_16BITS(obj_tptr
+2)<<2;
923 printf("\n\t Service Type: %s (%u), break bit %s set, Service length: %u",
924 tok2str(rsvp_intserv_service_type_values
,"unknown",*(obj_tptr
)),
926 (*(obj_tptr
+1)&0x80) ? "" : "not",
929 obj_tptr
+=4; /* get to the start of the parameter list */
932 while (intserv_serv_tlen
>=4) {
933 processed
= rsvp_intserv_print(obj_tptr
);
937 intserv_serv_tlen
-=processed
;
947 case RSVP_OBJ_FILTERSPEC
:
948 switch(rsvp_obj_ctype
) {
949 case RSVP_CTYPE_IPV4
:
950 printf("\n\t Source Address: %s, Source Port: %u",
951 ipaddr_string(obj_tptr
),
952 EXTRACT_16BITS(obj_tptr
+6));
957 case RSVP_CTYPE_IPV6
:
958 printf("\n\t Source Address: %s, Source Port: %u",
959 ip6addr_string(obj_tptr
),
960 EXTRACT_16BITS(obj_tptr
+18));
965 printf("\n\t Source Address: %s, Flow Label: %u",
966 ip6addr_string(obj_tptr
),
967 EXTRACT_24BITS(obj_tptr
+17));
971 case RSVP_CTYPE_TUNNEL_IPV6
:
972 printf("\n\t Source Address: %s, LSP-ID: 0x%04x",
973 ipaddr_string(obj_tptr
),
974 EXTRACT_16BITS(obj_tptr
+18));
979 case RSVP_CTYPE_TUNNEL_IPV4
:
980 printf("\n\t Source Address: %s, LSP-ID: 0x%04x",
981 ipaddr_string(obj_tptr
),
982 EXTRACT_16BITS(obj_tptr
+6));
991 case RSVP_OBJ_FASTREROUTE
:
992 switch(rsvp_obj_ctype
) {
993 case RSVP_CTYPE_TUNNEL_IPV4
:
994 bw
.i
= EXTRACT_32BITS(obj_tptr
+4);
995 printf("\n\t Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps",
1000 printf("\n\t Include Colors: 0x%08x, Exclude Colors: 0x%08x",
1001 EXTRACT_32BITS(obj_tptr
+8),
1002 EXTRACT_32BITS(obj_tptr
+12));
1011 case RSVP_OBJ_DETOUR
:
1012 switch(rsvp_obj_ctype
) {
1013 case RSVP_CTYPE_TUNNEL_IPV4
:
1014 while(obj_tlen
>= 8) {
1015 printf("\n\t PLR-ID: %s, Avoid-Node-ID: %s",
1016 ipaddr_string(obj_tptr
),
1017 ipaddr_string(obj_tptr
+4));
1027 case RSVP_OBJ_ERROR_SPEC
:
1028 switch(rsvp_obj_ctype
) {
1029 case RSVP_CTYPE_3
: /* fall through - FIXME add TLV parser */
1030 case RSVP_CTYPE_IPV4
:
1031 error_code
=*(obj_tptr
+5);
1032 error_value
=EXTRACT_16BITS(obj_tptr
+6);
1033 printf("\n\t Error Node Adress: %s, Flags: [0x%02x]\n\t Error Code: %s (%u)",
1034 ipaddr_string(obj_tptr
),
1036 tok2str(rsvp_obj_error_code_values
,"unknown",error_code
),
1038 switch (error_code
) {
1039 case RSVP_OBJ_ERROR_SPEC_CODE_ROUTING
:
1040 printf(", Error Value: %s (%u)",
1041 tok2str(rsvp_obj_error_code_routing_values
,"unknown",error_value
),
1045 printf(", Unknown Error Value (%u)", error_value
);
1050 case RSVP_CTYPE_4
: /* fall through - FIXME add TLV parser */
1051 case RSVP_CTYPE_IPV6
:
1052 error_code
=*(obj_tptr
+17);
1053 error_value
=EXTRACT_16BITS(obj_tptr
+18);
1054 printf("\n\t Error Node Adress: %s, Flags: [0x%02x]\n\t Error Code: %s (%u)",
1055 ip6addr_string(obj_tptr
),
1057 tok2str(rsvp_obj_error_code_values
,"unknown",error_code
),
1060 switch (error_code
) {
1061 case RSVP_OBJ_ERROR_SPEC_CODE_ROUTING
:
1062 printf(", Error Value: %s (%u)",
1063 tok2str(rsvp_obj_error_code_routing_values
,"unknown",error_value
),
1077 case RSVP_OBJ_PROPERTIES
:
1078 switch(rsvp_obj_ctype
) {
1080 padbytes
= EXTRACT_16BITS(obj_tptr
+2);
1081 printf("\n\t TLV count: %u, padding bytes: %u",
1082 EXTRACT_16BITS(obj_tptr
),
1086 /* loop through as long there is anything longer than the TLV header (2) */
1087 while(obj_tlen
>= 2 + padbytes
) {
1088 printf("\n\t %s TLV (0x%02x), length: %u", /* length includes header */
1089 tok2str(rsvp_obj_prop_tlv_values
,"unknown",*obj_tptr
),
1092 print_unknown_data(obj_tptr
+2,"\n\t\t",*(obj_tptr
+1)-2);
1093 obj_tlen
-=*(obj_tptr
+1);
1094 obj_tptr
+=*(obj_tptr
+1);
1103 * FIXME those are the defined objects that lack a decoder
1104 * you are welcome to contribute code ;-)
1107 case RSVP_OBJ_INTEGRITY
:
1108 case RSVP_OBJ_SCOPE
:
1109 case RSVP_OBJ_POLICY_DATA
:
1110 case RSVP_OBJ_MESSAGE_ID
:
1111 case RSVP_OBJ_MESSAGE_ID_ACK
:
1112 case RSVP_OBJ_MESSAGE_ID_LIST
:
1113 case RSVP_OBJ_RECOVERY_LABEL
:
1114 case RSVP_OBJ_LABEL_SET
:
1115 case RSVP_OBJ_ACCEPT_LABEL_SET
:
1116 case RSVP_OBJ_PROTECTION
:
1119 print_unknown_data(obj_tptr
,"\n\t ",obj_tlen
);
1122 /* do we want to see an additionally hexdump ? */
1123 if (vflag
> 1 || hexdump
==TRUE
)
1124 print_unknown_data(tptr
+sizeof(sizeof(struct rsvp_object_header
)),"\n\t ",
1125 rsvp_obj_len
-sizeof(struct rsvp_object_header
));
1132 printf("\n\t\t packet exceeded snapshot");