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
[] _U_
=
18 "@(#) $Header: /tcpdump/master/tcpdump/print-rsvp.c,v 1.24.2.2 2003-11-16 08:51:42 guy 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)
80 #define RSVP_EXTRACT_FLAGS(x) ((x)&0x0f)
82 #define RSVP_MSGTYPE_PATH 1
83 #define RSVP_MSGTYPE_RESV 2
84 #define RSVP_MSGTYPE_PATHERR 3
85 #define RSVP_MSGTYPE_RESVERR 4
86 #define RSVP_MSGTYPE_PATHTEAR 5
87 #define RSVP_MSGTYPE_RESVTEAR 6
88 #define RSVP_MSGTYPE_RESVCONF 7
89 #define RSVP_MSGTYPE_AGGREGATE 12
90 #define RSVP_MSGTYPE_ACK 13
91 #define RSVP_MSGTYPE_HELLO_OLD 14 /* ancient Hellos */
92 #define RSVP_MSGTYPE_SREFRESH 15
93 #define RSVP_MSGTYPE_HELLO 20
95 static const struct tok rsvp_msg_type_values
[] = {
96 { RSVP_MSGTYPE_PATH
, "Path" },
97 { RSVP_MSGTYPE_RESV
, "Resv" },
98 { RSVP_MSGTYPE_PATHERR
, "PathErr" },
99 { RSVP_MSGTYPE_RESVERR
, "ResvErr" },
100 { RSVP_MSGTYPE_PATHTEAR
, "PathTear" },
101 { RSVP_MSGTYPE_RESVTEAR
, "ResvTear" },
102 { RSVP_MSGTYPE_RESVCONF
, "ResvConf" },
103 { RSVP_MSGTYPE_AGGREGATE
, "Aggregate" },
104 { RSVP_MSGTYPE_ACK
, "Acknowledgement" },
105 { RSVP_MSGTYPE_HELLO_OLD
, "Hello (Old)" },
106 { RSVP_MSGTYPE_SREFRESH
, "Refresh" },
107 { RSVP_MSGTYPE_HELLO
, "Hello" },
111 static const struct tok rsvp_header_flag_values
[] = {
112 { 0x01, "Refresh reduction capable" }, /* rfc2961 */
116 #define RSVP_OBJ_SESSION 1 /* rfc2205 */
117 #define RSVP_OBJ_RSVP_HOP 3 /* rfc2205, rfc3473 */
118 #define RSVP_OBJ_INTEGRITY 4
119 #define RSVP_OBJ_TIME_VALUES 5 /* rfc2205 */
120 #define RSVP_OBJ_ERROR_SPEC 6
121 #define RSVP_OBJ_SCOPE 7
122 #define RSVP_OBJ_STYLE 8 /* rfc2205 */
123 #define RSVP_OBJ_FLOWSPEC 9 /* rfc2215 */
124 #define RSVP_OBJ_FILTERSPEC 10 /* rfc2215 */
125 #define RSVP_OBJ_SENDER_TEMPLATE 11
126 #define RSVP_OBJ_SENDER_TSPEC 12 /* rfc2215 */
127 #define RSVP_OBJ_ADSPEC 13 /* rfc2215 */
128 #define RSVP_OBJ_POLICY_DATA 14
129 #define RSVP_OBJ_CONFIRM 15 /* rfc2205 */
130 #define RSVP_OBJ_LABEL 16 /* rfc3209 */
131 #define RSVP_OBJ_LABEL_REQ 19 /* rfc3209 */
132 #define RSVP_OBJ_ERO 20 /* rfc3209 */
133 #define RSVP_OBJ_RRO 21 /* rfc3209 */
134 #define RSVP_OBJ_HELLO 22 /* rfc3209 */
135 #define RSVP_OBJ_MESSAGE_ID 23
136 #define RSVP_OBJ_MESSAGE_ID_ACK 24
137 #define RSVP_OBJ_MESSAGE_ID_LIST 25
138 #define RSVP_OBJ_RECOVERY_LABEL 34 /* rfc3473 */
139 #define RSVP_OBJ_UPSTREAM_LABEL 35 /* rfc3473 */
140 #define RSVP_OBJ_LABEL_SET 36 /* rfc3473 */
141 #define RSVP_OBJ_PROTECTION 37 /* rfc3473 */
142 #define RSVP_OBJ_DETOUR 63 /* draft-ietf-mpls-rsvp-lsp-fastreroute-01 */
143 #define RSVP_OBJ_SUGGESTED_LABEL 129 /* rfc3473 */
144 #define RSVP_OBJ_ACCEPT_LABEL_SET 130 /* rfc3473 */
145 #define RSVP_OBJ_RESTART_CAPABILITY 131 /* rfc3473 */
146 #define RSVP_OBJ_NOTIFY_REQ 195 /* rfc3473 */
147 #define RSVP_OBJ_ADMIN_STATUS 196 /* rfc3473 */
148 #define RSVP_OBJ_PROPERTIES 204 /* juniper proprietary */
149 #define RSVP_OBJ_FASTREROUTE 205 /* draft-ietf-mpls-rsvp-lsp-fastreroute-01 */
150 #define RSVP_OBJ_SESSION_ATTRIBUTE 207 /* rfc3209 */
151 #define RSVP_OBJ_CALL_ID 230 /* rfc3474 */
152 #define RSVP_OBJ_CALL_OPS 236 /* rfc3474 */
154 static const struct tok rsvp_obj_values
[] = {
155 { RSVP_OBJ_SESSION
, "Session" },
156 { RSVP_OBJ_RSVP_HOP
, "RSVP Hop" },
157 { RSVP_OBJ_INTEGRITY
, "Integrity" },
158 { RSVP_OBJ_TIME_VALUES
, "Time Values" },
159 { RSVP_OBJ_ERROR_SPEC
, "Error Spec" },
160 { RSVP_OBJ_SCOPE
, "Scope" },
161 { RSVP_OBJ_STYLE
, "Style" },
162 { RSVP_OBJ_FLOWSPEC
, "Flowspec" },
163 { RSVP_OBJ_FILTERSPEC
, "FilterSpec" },
164 { RSVP_OBJ_SENDER_TEMPLATE
, "Sender Template" },
165 { RSVP_OBJ_SENDER_TSPEC
, "Sender TSpec" },
166 { RSVP_OBJ_ADSPEC
, "Adspec" },
167 { RSVP_OBJ_POLICY_DATA
, "Policy Data" },
168 { RSVP_OBJ_CONFIRM
, "Confirm" },
169 { RSVP_OBJ_LABEL
, "Label" },
170 { RSVP_OBJ_LABEL_REQ
, "Label Request" },
171 { RSVP_OBJ_ERO
, "ERO" },
172 { RSVP_OBJ_RRO
, "RRO" },
173 { RSVP_OBJ_HELLO
, "Hello" },
174 { RSVP_OBJ_MESSAGE_ID
, "Message ID" },
175 { RSVP_OBJ_MESSAGE_ID_ACK
, "Message ID Ack" },
176 { RSVP_OBJ_MESSAGE_ID_LIST
, "Message ID List" },
177 { RSVP_OBJ_RECOVERY_LABEL
, "Recovery Label" },
178 { RSVP_OBJ_UPSTREAM_LABEL
, "Upstream Label" },
179 { RSVP_OBJ_LABEL_SET
, "Label Set" },
180 { RSVP_OBJ_ACCEPT_LABEL_SET
, "Acceptable Label Set" },
181 { RSVP_OBJ_DETOUR
, "Detour" },
182 { RSVP_OBJ_SUGGESTED_LABEL
, "Suggested Label" },
183 { RSVP_OBJ_PROPERTIES
, "Properties" },
184 { RSVP_OBJ_FASTREROUTE
, "Fast Re-Route" },
185 { RSVP_OBJ_SESSION_ATTRIBUTE
, "Session Attribute" },
186 { RSVP_OBJ_CALL_ID
, "Call-ID" },
187 { RSVP_OBJ_CALL_OPS
, "Call Capability" },
188 { RSVP_OBJ_RESTART_CAPABILITY
, "Restart Capability" },
189 { RSVP_OBJ_NOTIFY_REQ
, "Notify Request" },
190 { RSVP_OBJ_PROTECTION
, "Protection" },
191 { RSVP_OBJ_ADMIN_STATUS
, "Administrative Status" },
195 #define RSVP_CTYPE_IPV4 1
196 #define RSVP_CTYPE_IPV6 2
197 #define RSVP_CTYPE_TUNNEL_IPV4 7
198 #define RSVP_CTYPE_TUNNEL_IPV6 8
199 #define RSVP_CTYPE_1 1
200 #define RSVP_CTYPE_2 2
201 #define RSVP_CTYPE_3 3
202 #define RSVP_CTYPE_4 4
205 * the ctypes are not globally unique so for
206 * translating it to strings we build a table based
207 * on objects offsetted by the ctype
210 static const struct tok rsvp_ctype_values
[] = {
211 { 256*RSVP_OBJ_RSVP_HOP
+RSVP_CTYPE_IPV4
, "IPv4" },
212 { 256*RSVP_OBJ_RSVP_HOP
+RSVP_CTYPE_IPV6
, "IPv6" },
213 { 256*RSVP_OBJ_RSVP_HOP
+RSVP_CTYPE_3
, "IPv4 plus opt. TLVs" },
214 { 256*RSVP_OBJ_RSVP_HOP
+RSVP_CTYPE_4
, "IPv6 plus opt. TLVs" },
215 { 256*RSVP_OBJ_NOTIFY_REQ
+RSVP_CTYPE_IPV4
, "IPv4" },
216 { 256*RSVP_OBJ_NOTIFY_REQ
+RSVP_CTYPE_IPV6
, "IPv6" },
217 { 256*RSVP_OBJ_CONFIRM
+RSVP_CTYPE_IPV4
, "IPv4" },
218 { 256*RSVP_OBJ_CONFIRM
+RSVP_CTYPE_IPV6
, "IPv6" },
219 { 256*RSVP_OBJ_TIME_VALUES
+RSVP_CTYPE_1
, "1" },
220 { 256*RSVP_OBJ_FLOWSPEC
+RSVP_CTYPE_1
, "obsolete" },
221 { 256*RSVP_OBJ_FLOWSPEC
+RSVP_CTYPE_2
, "IntServ" },
222 { 256*RSVP_OBJ_SENDER_TSPEC
+RSVP_CTYPE_2
, "IntServ" },
223 { 256*RSVP_OBJ_ADSPEC
+RSVP_CTYPE_2
, "IntServ" },
224 { 256*RSVP_OBJ_FILTERSPEC
+RSVP_CTYPE_IPV4
, "IPv4" },
225 { 256*RSVP_OBJ_FILTERSPEC
+RSVP_CTYPE_IPV6
, "IPv6" },
226 { 256*RSVP_OBJ_FILTERSPEC
+RSVP_CTYPE_3
, "IPv6 Flow-label" },
227 { 256*RSVP_OBJ_FILTERSPEC
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
228 { 256*RSVP_OBJ_SESSION
+RSVP_CTYPE_IPV4
, "IPv4" },
229 { 256*RSVP_OBJ_SESSION
+RSVP_CTYPE_IPV6
, "IPv6" },
230 { 256*RSVP_OBJ_SESSION
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
231 { 256*RSVP_OBJ_SENDER_TEMPLATE
+RSVP_CTYPE_IPV4
, "IPv4" },
232 { 256*RSVP_OBJ_SENDER_TEMPLATE
+RSVP_CTYPE_IPV6
, "IPv6" },
233 { 256*RSVP_OBJ_SENDER_TEMPLATE
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
234 { 256*RSVP_OBJ_STYLE
+RSVP_CTYPE_1
, "1" },
235 { 256*RSVP_OBJ_HELLO
+RSVP_CTYPE_1
, "Hello Request" },
236 { 256*RSVP_OBJ_HELLO
+RSVP_CTYPE_2
, "Hello Ack" },
237 { 256*RSVP_OBJ_LABEL_REQ
+RSVP_CTYPE_1
, "without label range" },
238 { 256*RSVP_OBJ_LABEL_REQ
+RSVP_CTYPE_2
, "with ATM label range" },
239 { 256*RSVP_OBJ_LABEL_REQ
+RSVP_CTYPE_3
, "with FR label range" },
240 { 256*RSVP_OBJ_LABEL_REQ
+RSVP_CTYPE_4
, "Generalized Label" },
241 { 256*RSVP_OBJ_LABEL
+RSVP_CTYPE_1
, "Label" },
242 { 256*RSVP_OBJ_LABEL
+RSVP_CTYPE_2
, "Generalized Label" },
243 { 256*RSVP_OBJ_LABEL
+RSVP_CTYPE_3
, "Waveband Switching" },
244 { 256*RSVP_OBJ_SUGGESTED_LABEL
+RSVP_CTYPE_1
, "Label" },
245 { 256*RSVP_OBJ_SUGGESTED_LABEL
+RSVP_CTYPE_2
, "Generalized Label" },
246 { 256*RSVP_OBJ_SUGGESTED_LABEL
+RSVP_CTYPE_3
, "Waveband Switching" },
247 { 256*RSVP_OBJ_UPSTREAM_LABEL
+RSVP_CTYPE_1
, "Label" },
248 { 256*RSVP_OBJ_UPSTREAM_LABEL
+RSVP_CTYPE_2
, "Generalized Label" },
249 { 256*RSVP_OBJ_UPSTREAM_LABEL
+RSVP_CTYPE_3
, "Waveband Switching" },
250 { 256*RSVP_OBJ_RECOVERY_LABEL
+RSVP_CTYPE_1
, "Label" },
251 { 256*RSVP_OBJ_RECOVERY_LABEL
+RSVP_CTYPE_2
, "Generalized Label" },
252 { 256*RSVP_OBJ_RECOVERY_LABEL
+RSVP_CTYPE_3
, "Waveband Switching" },
253 { 256*RSVP_OBJ_ERO
+RSVP_CTYPE_IPV4
, "IPv4" },
254 { 256*RSVP_OBJ_RRO
+RSVP_CTYPE_IPV4
, "IPv4" },
255 { 256*RSVP_OBJ_ERROR_SPEC
+RSVP_CTYPE_IPV4
, "IPv4" },
256 { 256*RSVP_OBJ_ERROR_SPEC
+RSVP_CTYPE_IPV6
, "IPv6" },
257 { 256*RSVP_OBJ_ERROR_SPEC
+RSVP_CTYPE_3
, "IPv4 plus opt. TLVs" },
258 { 256*RSVP_OBJ_ERROR_SPEC
+RSVP_CTYPE_4
, "IPv6 plus opt. TLVs" },
259 { 256*RSVP_OBJ_RESTART_CAPABILITY
+RSVP_CTYPE_1
, "IPv4" },
260 { 256*RSVP_OBJ_SESSION_ATTRIBUTE
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
261 { 256*RSVP_OBJ_FASTREROUTE
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
262 { 256*RSVP_OBJ_DETOUR
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
263 { 256*RSVP_OBJ_PROPERTIES
+RSVP_CTYPE_1
, "1" },
267 #define RSVP_OBJ_XRO_MASK_SUBOBJ(x) ((x)&0x7f)
268 #define RSVP_OBJ_XRO_MASK_LOOSE(x) ((x)&0x80)
270 #define RSVP_OBJ_XRO_RES 0
271 #define RSVP_OBJ_XRO_IPV4 1
272 #define RSVP_OBJ_XRO_IPV6 2
273 #define RSVP_OBJ_XRO_ASN 32
274 #define RSVP_OBJ_XRO_MPLS 64
276 static const struct tok rsvp_obj_xro_values
[] = {
277 { RSVP_OBJ_XRO_RES
, "Reserved" },
278 { RSVP_OBJ_XRO_IPV4
, "IPv4 prefix" },
279 { RSVP_OBJ_XRO_IPV6
, "IPv6 prefix" },
280 { RSVP_OBJ_XRO_ASN
, "Autonomous system number" },
281 { RSVP_OBJ_XRO_MPLS
, "MPLS label switched path termination" },
285 /* draft-ietf-mpls-rsvp-lsp-fastreroute-02.txt */
286 static const struct tok rsvp_obj_rro_flag_values
[] = {
287 { 0x01, "Local protection available" },
288 { 0x02, "Local protection in use" },
289 { 0x04, "Bandwidth protection" },
290 { 0x08, "Node protection" },
294 static const struct tok rsvp_resstyle_values
[] = {
295 { 17, "Wildcard Filter" },
296 { 10, "Fixed Filter" },
297 { 18, "Shared Explicit" },
301 #define RSVP_OBJ_INTSERV_GUARANTEED_SERV 2
302 #define RSVP_OBJ_INTSERV_CONTROLLED_LOAD 5
304 static const struct tok rsvp_intserv_service_type_values
[] = {
305 { 1, "Default/Global Information" },
306 { RSVP_OBJ_INTSERV_GUARANTEED_SERV
, "Guaranteed Service" },
307 { RSVP_OBJ_INTSERV_CONTROLLED_LOAD
, "Controlled Load" },
311 static const struct tok rsvp_intserv_parameter_id_values
[] = {
313 { 6, "Path b/w estimate" },
314 { 8, "Minimum path latency" },
315 { 10, "Composed MTU" },
316 { 127, "Token Bucket TSpec" },
317 { 130, "Guaranteed Service RSpec" },
318 { 133, "End-to-end composed value for C" },
319 { 134, "End-to-end composed value for D" },
320 { 135, "Since-last-reshaping point composed C" },
321 { 136, "Since-last-reshaping point composed D" },
325 static struct tok rsvp_session_attribute_flag_values
[] = {
326 { 0x01, "Local Protection desired" },
327 { 0x02, "Label Recording desired" },
328 { 0x04, "SE Style desired" },
329 { 0x08, "Bandwidth protection desired" }, /* draft-ietf-mpls-rsvp-lsp-fastreroute-02.txt */
330 { 0x10, "Node protection desired" }, /* draft-ietf-mpls-rsvp-lsp-fastreroute-02.txt */
334 static struct tok rsvp_obj_prop_tlv_values
[] = {
336 { 0x02, "Metric 1" },
337 { 0x04, "Metric 2" },
338 { 0x08, "CCC Status" },
339 { 0x10, "Path Type" },
343 #define RSVP_OBJ_ERROR_SPEC_CODE_ROUTING 24
344 #define RSVP_OBJ_ERROR_SPEC_CODE_NOTIFY 25
346 static struct tok rsvp_obj_error_code_values
[] = {
347 { RSVP_OBJ_ERROR_SPEC_CODE_ROUTING
, "Routing Problem" },
348 { RSVP_OBJ_ERROR_SPEC_CODE_NOTIFY
, "Notify Error" },
352 static struct tok rsvp_obj_error_code_routing_values
[] = {
353 { 1, "Bad EXPLICIT_ROUTE object" },
354 { 2, "Bad strict node" },
355 { 3, "Bad loose node" },
356 { 4, "Bad initial subobject" },
357 { 5, "No route available toward destination" },
358 { 6, "Unacceptable label value" },
359 { 7, "RRO indicated routing loops" },
360 { 8, "non-RSVP-capable router in the path" },
361 { 9, "MPLS label allocation failure" },
362 { 10, "Unsupported L3PID" },
370 int rsvp_intserv_print(const u_char
*);
373 * this is a dissector for all the intserv defined
374 * specs as defined per rfc2215
375 * it is called from various rsvp objects;
376 * returns the amount of bytes being processed
379 rsvp_intserv_print(const u_char
*tptr
) {
381 int parameter_id
,parameter_length
;
387 parameter_id
= *(tptr
);
388 parameter_length
= EXTRACT_16BITS(tptr
+2)<<2; /* convert wordcount to bytecount */
390 printf("\n\t Parameter ID: %s (%u), length: %u, Flags: [0x%02x]",
391 tok2str(rsvp_intserv_parameter_id_values
,"unknown",parameter_id
),
396 switch(parameter_id
) { /* parameter_id */
400 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
401 * | 4 (e) | (f) | 1 (g) |
402 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
403 * | IS hop cnt (32-bit unsigned integer) |
404 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
406 printf("\n\t\tIS hop count: %u", EXTRACT_32BITS(tptr
+4));
411 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
412 * | 6 (h) | (i) | 1 (j) |
413 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
414 * | Path b/w estimate (32-bit IEEE floating point number) |
415 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
417 bw
.i
= EXTRACT_32BITS(tptr
+4);
418 printf("\n\t\tPath b/w estimate: %.10g Mbps", bw
.f
/125000);
423 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
424 * | 8 (k) | (l) | 1 (m) |
425 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
426 * | Minimum path latency (32-bit integer) |
427 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
429 printf("\n\t\tMinimum path latency: ");
430 if (EXTRACT_32BITS(tptr
+4) == 0xffffffff)
431 printf("don't care");
433 printf("%u", EXTRACT_32BITS(tptr
+4));
439 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
440 * | 10 (n) | (o) | 1 (p) |
441 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
442 * | Composed MTU (32-bit unsigned integer) |
443 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
445 printf("\n\t\tComposed MTU: %u bytes", EXTRACT_32BITS(tptr
+4));
449 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
450 * | 127 (e) | 0 (f) | 5 (g) |
451 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
452 * | Token Bucket Rate [r] (32-bit IEEE floating point number) |
453 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
454 * | Token Bucket Size [b] (32-bit IEEE floating point number) |
455 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
456 * | Peak Data Rate [p] (32-bit IEEE floating point number) |
457 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
458 * | Minimum Policed Unit [m] (32-bit integer) |
459 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
460 * | Maximum Packet Size [M] (32-bit integer) |
461 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
464 bw
.i
= EXTRACT_32BITS(tptr
+4);
465 printf("\n\t\tToken Bucket Rate: %.10g Mbps", bw
.f
/125000);
466 bw
.i
= EXTRACT_32BITS(tptr
+8);
467 printf("\n\t\tToken Bucket Size: %.10g bytes", bw
.f
);
468 bw
.i
= EXTRACT_32BITS(tptr
+12);
469 printf("\n\t\tPeak Data Rate: %.10g Mbps", bw
.f
/125000);
470 printf("\n\t\tMinimum Policed Unit: %u bytes", EXTRACT_32BITS(tptr
+16));
471 printf("\n\t\tMaximum Packet Size: %u bytes", EXTRACT_32BITS(tptr
+20));
476 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
477 * | 130 (h) | 0 (i) | 2 (j) |
478 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
479 * | Rate [R] (32-bit IEEE floating point number) |
480 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
481 * | Slack Term [S] (32-bit integer) |
482 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
485 bw
.i
= EXTRACT_32BITS(tptr
+4);
486 printf("\n\t\tRate: %.10g Mbps", bw
.f
/125000);
487 printf("\n\t\tSlack Term: %u", EXTRACT_32BITS(tptr
+8));
494 printf("\n\t\tValue: %u", EXTRACT_32BITS(tptr
+4));
499 print_unknown_data(tptr
+4,"\n\t\t",parameter_length
);
501 return (parameter_length
+4); /* header length 4 bytes */
505 rsvp_print(register const u_char
*pptr
, register u_int len
) {
507 const struct rsvp_common_header
*rsvp_com_header
;
508 const struct rsvp_object_header
*rsvp_obj_header
;
509 const u_char
*tptr
,*obj_tptr
;
510 u_short tlen
,rsvp_obj_len
,rsvp_obj_ctype
,obj_tlen
,intserv_serv_tlen
;
511 int hexdump
,processed
,padbytes
,error_code
,error_value
;
518 rsvp_com_header
= (const struct rsvp_common_header
*)pptr
;
519 TCHECK(*rsvp_com_header
);
522 * Sanity checking of the header.
524 if (RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
) != RSVP_VERSION
) {
525 printf("RSVP version %u packet not supported",
526 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
));
530 /* in non-verbose mode just lets print the basic Message Type*/
532 printf("RSVP %s Message, length: %u",
533 tok2str(rsvp_msg_type_values
, "unknown (%u)",rsvp_com_header
->msg_type
),
538 /* ok they seem to want to know everything - lets fully decode it */
540 tlen
=EXTRACT_16BITS(rsvp_com_header
->length
);
542 printf("RSVP\n\tv: %u, msg-type: %s, Flags: [%s], length: %u, ttl: %u, checksum: 0x%04x",
543 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
),
544 tok2str(rsvp_msg_type_values
, "unknown, type: %u",rsvp_com_header
->msg_type
),
545 bittok2str(rsvp_header_flag_values
,"none",RSVP_EXTRACT_FLAGS(rsvp_com_header
->version_flags
)),
547 rsvp_com_header
->ttl
,
548 EXTRACT_16BITS(rsvp_com_header
->checksum
));
550 tptr
+=sizeof(const struct rsvp_common_header
);
551 tlen
-=sizeof(const struct rsvp_common_header
);
554 /* did we capture enough for fully decoding the object header ? */
555 if (!TTEST2(*tptr
, sizeof(struct rsvp_object_header
)))
558 rsvp_obj_header
= (const struct rsvp_object_header
*)tptr
;
559 rsvp_obj_len
=EXTRACT_16BITS(rsvp_obj_header
->length
);
560 rsvp_obj_ctype
=rsvp_obj_header
->ctype
;
562 if(rsvp_obj_len
% 4 || rsvp_obj_len
< 4)
565 printf("\n\t %s Object (%u) Flags: [%s",
566 tok2str(rsvp_obj_values
,
568 rsvp_obj_header
->class_num
),
569 rsvp_obj_header
->class_num
,
570 ((rsvp_obj_header
->class_num
)&0x80) ? "ignore" : "reject");
572 if (rsvp_obj_header
->class_num
> 128)
574 ((rsvp_obj_header
->class_num
)&0x40) ? "and forward" : "silently");
576 printf(" if unknown], Class-Type: %s (%u), length: %u",
577 tok2str(rsvp_ctype_values
,
579 ((rsvp_obj_header
->class_num
)<<8)+rsvp_obj_ctype
),
583 obj_tptr
=tptr
+sizeof(struct rsvp_object_header
);
584 obj_tlen
=rsvp_obj_len
-sizeof(struct rsvp_object_header
);
586 /* did we capture enough for fully decoding the object ? */
587 if (!TTEST2(*tptr
, rsvp_obj_len
))
591 switch(rsvp_obj_header
->class_num
) {
592 case RSVP_OBJ_SESSION
:
593 switch(rsvp_obj_ctype
) {
594 case RSVP_CTYPE_IPV4
:
595 printf("\n\t IPv4 DestAddress: %s, Protocol ID: 0x%02x",
596 ipaddr_string(obj_tptr
),
598 printf("\n\t Flags: [0x%02x], DestPort %u",
600 EXTRACT_16BITS(obj_tptr
+6));
605 case RSVP_CTYPE_IPV6
:
606 printf("\n\t IPv6 DestAddress: %s, Protocol ID: 0x%02x",
607 ip6addr_string(obj_tptr
),
609 printf("\n\t Flags: [0x%02x], DestPort %u",
611 EXTRACT_16BITS(obj_tptr
+18));
616 case RSVP_CTYPE_TUNNEL_IPV6
:
617 printf("\n\t IPv6 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
618 ip6addr_string(obj_tptr
),
619 EXTRACT_16BITS(obj_tptr
+18),
620 ip6addr_string(obj_tptr
+20));
625 case RSVP_CTYPE_TUNNEL_IPV4
:
626 printf("\n\t IPv4 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
627 ipaddr_string(obj_tptr
),
628 EXTRACT_16BITS(obj_tptr
+6),
629 ipaddr_string(obj_tptr
+8));
638 case RSVP_OBJ_CONFIRM
:
639 switch(rsvp_obj_ctype
) {
640 case RSVP_CTYPE_IPV4
:
641 printf("\n\t IPv4 Receiver Address: %s",
642 ipaddr_string(obj_tptr
));
647 case RSVP_CTYPE_IPV6
:
648 printf("\n\t IPv6 Receiver Address: %s",
649 ip6addr_string(obj_tptr
));
659 case RSVP_OBJ_NOTIFY_REQ
:
660 switch(rsvp_obj_ctype
) {
661 case RSVP_CTYPE_IPV4
:
662 printf("\n\t IPv4 Notify Node Address: %s",
663 ipaddr_string(obj_tptr
));
668 case RSVP_CTYPE_IPV6
:
669 printf("\n\t IPv6 Notify Node Address: %s",
670 ip6addr_string(obj_tptr
));
680 case RSVP_OBJ_SUGGESTED_LABEL
: /* fall through */
681 case RSVP_OBJ_UPSTREAM_LABEL
: /* fall through */
682 case RSVP_OBJ_RECOVERY_LABEL
: /* fall through */
684 switch(rsvp_obj_ctype
) {
686 while(obj_tlen
>= 4 ) {
687 printf("\n\t Label: %u", EXTRACT_32BITS(obj_tptr
));
693 printf("\n\t Generalized Label: %u",
694 EXTRACT_32BITS(obj_tptr
));
699 printf("\n\t Waveband ID: %u\n\t Start Label: %u, Stop Label: %u",
700 EXTRACT_32BITS(obj_tptr
),
701 EXTRACT_32BITS(obj_tptr
+4),
702 EXTRACT_32BITS(obj_tptr
+8));
712 switch(rsvp_obj_ctype
) {
714 printf("\n\t Reservation Style: %s, Flags: [0x%02x]",
715 tok2str(rsvp_resstyle_values
,
717 EXTRACT_24BITS(obj_tptr
+1)),
727 case RSVP_OBJ_SENDER_TEMPLATE
:
728 switch(rsvp_obj_ctype
) {
729 case RSVP_CTYPE_IPV4
:
730 printf("\n\t Source Address: %s, Source Port: %u",
731 ipaddr_string(obj_tptr
),
732 EXTRACT_16BITS(obj_tptr
+6));
737 case RSVP_CTYPE_IPV6
:
738 printf("\n\t Source Address: %s, Source Port: %u",
739 ip6addr_string(obj_tptr
),
740 EXTRACT_16BITS(obj_tptr
+18));
745 case RSVP_CTYPE_TUNNEL_IPV4
:
746 printf("\n\t IPv4 Tunnel Sender Address: %s, LSP-ID: 0x%04x",
747 ipaddr_string(obj_tptr
),
748 EXTRACT_16BITS(obj_tptr
+6));
757 case RSVP_OBJ_LABEL_REQ
:
758 switch(rsvp_obj_ctype
) {
760 while(obj_tlen
>= 4 ) {
761 printf("\n\t L3 Protocol ID: %s",
762 tok2str(ethertype_values
,
763 "Unknown Protocol (0x%04x)",
764 EXTRACT_16BITS(obj_tptr
+2)));
770 printf("\n\t L3 Protocol ID: %s",
771 tok2str(ethertype_values
,
772 "Unknown Protocol (0x%04x)",
773 EXTRACT_16BITS(obj_tptr
+2)));
774 printf(",%s merge capability",((*(obj_tptr
+4))&0x80) ? "no" : "" );
775 printf("\n\t Minimum VPI/VCI: %u/%u",
776 (EXTRACT_16BITS(obj_tptr
+4))&0xfff,
777 (EXTRACT_16BITS(obj_tptr
+6))&0xfff);
778 printf("\n\t Maximum VPI/VCI: %u/%u",
779 (EXTRACT_16BITS(obj_tptr
+8))&0xfff,
780 (EXTRACT_16BITS(obj_tptr
+10))&0xfff);
785 printf("\n\t L3 Protocol ID: %s",
786 tok2str(ethertype_values
,
787 "Unknown Protocol (0x%04x)",
788 EXTRACT_16BITS(obj_tptr
+2)));
789 printf("\n\t Minimum/Maximum DLCI: %u/%u, %s%s bit DLCI",
790 (EXTRACT_32BITS(obj_tptr
+4))&0x7fffff,
791 (EXTRACT_32BITS(obj_tptr
+8))&0x7fffff,
792 (((EXTRACT_16BITS(obj_tptr
+4)>>7)&3) == 0 ) ? "10" : "",
793 (((EXTRACT_16BITS(obj_tptr
+4)>>7)&3) == 2 ) ? "23" : "");
798 printf("\n\t LSP Encoding Type: %s (%u)",
799 tok2str(gmpls_encoding_values
,
803 printf("\n\t Switching Type: %s (%u), Payload ID: %s (0x%04x)",
804 tok2str(gmpls_switch_cap_values
,
808 tok2str(gmpls_payload_values
,
810 EXTRACT_16BITS(obj_tptr
+2)),
811 EXTRACT_16BITS(obj_tptr
+2));
822 switch(rsvp_obj_ctype
) {
823 case RSVP_CTYPE_IPV4
:
824 while(obj_tlen
>= 4 ) {
825 printf("\n\t Subobject Type: %s",
826 tok2str(rsvp_obj_xro_values
,
828 RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr
)));
829 switch(RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr
)) {
830 case RSVP_OBJ_XRO_IPV4
:
831 printf(", %s, %s/%u, Flags: [%s]",
832 RSVP_OBJ_XRO_MASK_LOOSE(*obj_tptr
) ? "Loose" : "Strict",
833 ipaddr_string(obj_tptr
+2),
835 bittok2str(rsvp_obj_rro_flag_values
,
837 *(obj_tptr
+7))); /* rfc3209 says that this field is rsvd. */
839 obj_tlen
-=*(obj_tptr
+1);
840 obj_tptr
+=*(obj_tptr
+1);
849 switch(rsvp_obj_ctype
) {
852 printf("\n\t Source Instance: 0x%08x, Destination Instance: 0x%08x",
853 EXTRACT_32BITS(obj_tptr
),
854 EXTRACT_32BITS(obj_tptr
+4));
863 case RSVP_OBJ_RESTART_CAPABILITY
:
864 switch(rsvp_obj_ctype
) {
866 printf("\n\t Restart Time: %ums, Recovery Time: %ums",
867 EXTRACT_16BITS(obj_tptr
),
868 EXTRACT_16BITS(obj_tptr
+4));
875 case RSVP_OBJ_SESSION_ATTRIBUTE
:
876 switch(rsvp_obj_ctype
) {
877 case RSVP_CTYPE_TUNNEL_IPV4
:
878 printf("\n\t Session Name: %s",(obj_tptr
+4));
879 printf("\n\t Setup Priority: %u, Holding Priority: %u, Flags: [%s]",
882 tok2str(rsvp_session_attribute_flag_values
,
886 obj_tlen
-=4+*(obj_tptr
+3);
887 obj_tptr
+=4+*(obj_tptr
+3);
894 case RSVP_OBJ_RSVP_HOP
:
895 switch(rsvp_obj_ctype
) {
896 case RSVP_CTYPE_3
: /* fall through - FIXME add TLV parser */
897 case RSVP_CTYPE_IPV4
:
898 printf("\n\t Previous/Next Interface: %s, Logical Interface Handle: 0x%08x",
899 ipaddr_string(obj_tptr
),
900 EXTRACT_32BITS(obj_tptr
+4));
903 hexdump
=TRUE
; /* unless we have a TLV parser lets just hexdump */
906 case RSVP_CTYPE_4
: /* fall through - FIXME add TLV parser */
907 case RSVP_CTYPE_IPV6
:
908 printf("\n\t Previous/Next Interface: %s, Logical Interface Handle: 0x%08x",
909 ip6addr_string(obj_tptr
),
910 EXTRACT_32BITS(obj_tptr
+16));
913 hexdump
=TRUE
; /* unless we have a TLV parser lets just hexdump */
921 case RSVP_OBJ_TIME_VALUES
:
922 switch(rsvp_obj_ctype
) {
924 printf("\n\t Refresh Period: %ums",
925 EXTRACT_32BITS(obj_tptr
));
934 /* those three objects do share the same semantics */
935 case RSVP_OBJ_SENDER_TSPEC
:
936 case RSVP_OBJ_ADSPEC
:
937 case RSVP_OBJ_FLOWSPEC
:
938 switch(rsvp_obj_ctype
) {
940 printf("\n\t Msg-Version: %u, length: %u",
941 (*obj_tptr
& 0xf0) >> 4,
942 EXTRACT_16BITS(obj_tptr
+2)<<2);
943 obj_tptr
+=4; /* get to the start of the service header */
946 while (obj_tlen
>= 4) {
947 intserv_serv_tlen
=EXTRACT_16BITS(obj_tptr
+2)<<2;
948 printf("\n\t Service Type: %s (%u), break bit %s set, Service length: %u",
949 tok2str(rsvp_intserv_service_type_values
,"unknown",*(obj_tptr
)),
951 (*(obj_tptr
+1)&0x80) ? "" : "not",
954 obj_tptr
+=4; /* get to the start of the parameter list */
957 while (intserv_serv_tlen
>=4) {
958 processed
= rsvp_intserv_print(obj_tptr
);
962 intserv_serv_tlen
-=processed
;
972 case RSVP_OBJ_FILTERSPEC
:
973 switch(rsvp_obj_ctype
) {
974 case RSVP_CTYPE_IPV4
:
975 printf("\n\t Source Address: %s, Source Port: %u",
976 ipaddr_string(obj_tptr
),
977 EXTRACT_16BITS(obj_tptr
+6));
982 case RSVP_CTYPE_IPV6
:
983 printf("\n\t Source Address: %s, Source Port: %u",
984 ip6addr_string(obj_tptr
),
985 EXTRACT_16BITS(obj_tptr
+18));
990 printf("\n\t Source Address: %s, Flow Label: %u",
991 ip6addr_string(obj_tptr
),
992 EXTRACT_24BITS(obj_tptr
+17));
996 case RSVP_CTYPE_TUNNEL_IPV6
:
997 printf("\n\t Source Address: %s, LSP-ID: 0x%04x",
998 ipaddr_string(obj_tptr
),
999 EXTRACT_16BITS(obj_tptr
+18));
1004 case RSVP_CTYPE_TUNNEL_IPV4
:
1005 printf("\n\t Source Address: %s, LSP-ID: 0x%04x",
1006 ipaddr_string(obj_tptr
),
1007 EXTRACT_16BITS(obj_tptr
+6));
1016 case RSVP_OBJ_FASTREROUTE
:
1017 switch(rsvp_obj_ctype
) {
1018 case RSVP_CTYPE_TUNNEL_IPV4
:
1019 bw
.i
= EXTRACT_32BITS(obj_tptr
+4);
1020 printf("\n\t Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps",
1025 printf("\n\t Include Colors: 0x%08x, Exclude Colors: 0x%08x",
1026 EXTRACT_32BITS(obj_tptr
+8),
1027 EXTRACT_32BITS(obj_tptr
+12));
1036 case RSVP_OBJ_DETOUR
:
1037 switch(rsvp_obj_ctype
) {
1038 case RSVP_CTYPE_TUNNEL_IPV4
:
1039 while(obj_tlen
>= 8) {
1040 printf("\n\t PLR-ID: %s, Avoid-Node-ID: %s",
1041 ipaddr_string(obj_tptr
),
1042 ipaddr_string(obj_tptr
+4));
1052 case RSVP_OBJ_ERROR_SPEC
:
1053 switch(rsvp_obj_ctype
) {
1054 case RSVP_CTYPE_3
: /* fall through - FIXME add TLV parser */
1055 case RSVP_CTYPE_IPV4
:
1056 error_code
=*(obj_tptr
+5);
1057 error_value
=EXTRACT_16BITS(obj_tptr
+6);
1058 printf("\n\t Error Node Adress: %s, Flags: [0x%02x]\n\t Error Code: %s (%u)",
1059 ipaddr_string(obj_tptr
),
1061 tok2str(rsvp_obj_error_code_values
,"unknown",error_code
),
1063 switch (error_code
) {
1064 case RSVP_OBJ_ERROR_SPEC_CODE_ROUTING
:
1065 printf(", Error Value: %s (%u)",
1066 tok2str(rsvp_obj_error_code_routing_values
,"unknown",error_value
),
1070 printf(", Unknown Error Value (%u)", error_value
);
1075 case RSVP_CTYPE_4
: /* fall through - FIXME add TLV parser */
1076 case RSVP_CTYPE_IPV6
:
1077 error_code
=*(obj_tptr
+17);
1078 error_value
=EXTRACT_16BITS(obj_tptr
+18);
1079 printf("\n\t Error Node Adress: %s, Flags: [0x%02x]\n\t Error Code: %s (%u)",
1080 ip6addr_string(obj_tptr
),
1082 tok2str(rsvp_obj_error_code_values
,"unknown",error_code
),
1085 switch (error_code
) {
1086 case RSVP_OBJ_ERROR_SPEC_CODE_ROUTING
:
1087 printf(", Error Value: %s (%u)",
1088 tok2str(rsvp_obj_error_code_routing_values
,"unknown",error_value
),
1102 case RSVP_OBJ_PROPERTIES
:
1103 switch(rsvp_obj_ctype
) {
1105 padbytes
= EXTRACT_16BITS(obj_tptr
+2);
1106 printf("\n\t TLV count: %u, padding bytes: %u",
1107 EXTRACT_16BITS(obj_tptr
),
1111 /* loop through as long there is anything longer than the TLV header (2) */
1112 while(obj_tlen
>= 2 + padbytes
) {
1113 printf("\n\t %s TLV (0x%02x), length: %u", /* length includes header */
1114 tok2str(rsvp_obj_prop_tlv_values
,"unknown",*obj_tptr
),
1117 print_unknown_data(obj_tptr
+2,"\n\t\t",*(obj_tptr
+1)-2);
1118 obj_tlen
-=*(obj_tptr
+1);
1119 obj_tptr
+=*(obj_tptr
+1);
1128 * FIXME those are the defined objects that lack a decoder
1129 * you are welcome to contribute code ;-)
1132 case RSVP_OBJ_INTEGRITY
:
1133 case RSVP_OBJ_SCOPE
:
1134 case RSVP_OBJ_POLICY_DATA
:
1135 case RSVP_OBJ_MESSAGE_ID
:
1136 case RSVP_OBJ_MESSAGE_ID_ACK
:
1137 case RSVP_OBJ_MESSAGE_ID_LIST
:
1138 case RSVP_OBJ_LABEL_SET
:
1139 case RSVP_OBJ_ACCEPT_LABEL_SET
:
1140 case RSVP_OBJ_PROTECTION
:
1143 print_unknown_data(obj_tptr
,"\n\t ",obj_tlen
);
1146 /* do we want to see an additionally hexdump ? */
1147 if (vflag
> 1 || hexdump
==TRUE
)
1148 print_unknown_data(tptr
+sizeof(sizeof(struct rsvp_object_header
)),"\n\t ",
1149 rsvp_obj_len
-sizeof(struct rsvp_object_header
));
1156 printf("\n\t\t packet exceeded snapshot");