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.21 2003-06-07 23:05:19 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
, "Label" },
236 { 256*RSVP_OBJ_LABEL
+RSVP_CTYPE_2
, "Generalized Label" },
237 { 256*RSVP_OBJ_LABEL
+RSVP_CTYPE_3
, "Waveband Switching" },
238 { 256*RSVP_OBJ_SUGGESTED_LABEL
+RSVP_CTYPE_1
, "Label" },
239 { 256*RSVP_OBJ_SUGGESTED_LABEL
+RSVP_CTYPE_2
, "Generalized Label" },
240 { 256*RSVP_OBJ_SUGGESTED_LABEL
+RSVP_CTYPE_3
, "Waveband Switching" },
241 { 256*RSVP_OBJ_UPSTREAM_LABEL
+RSVP_CTYPE_1
, "Label" },
242 { 256*RSVP_OBJ_UPSTREAM_LABEL
+RSVP_CTYPE_2
, "Generalized Label" },
243 { 256*RSVP_OBJ_UPSTREAM_LABEL
+RSVP_CTYPE_3
, "Waveband Switching" },
244 { 256*RSVP_OBJ_RECOVERY_LABEL
+RSVP_CTYPE_1
, "Label" },
245 { 256*RSVP_OBJ_RECOVERY_LABEL
+RSVP_CTYPE_2
, "Generalized Label" },
246 { 256*RSVP_OBJ_RECOVERY_LABEL
+RSVP_CTYPE_3
, "Waveband Switching" },
247 { 256*RSVP_OBJ_ERO
+RSVP_CTYPE_IPV4
, "IPv4" },
248 { 256*RSVP_OBJ_RRO
+RSVP_CTYPE_IPV4
, "IPv4" },
249 { 256*RSVP_OBJ_ERROR_SPEC
+RSVP_CTYPE_IPV4
, "IPv4" },
250 { 256*RSVP_OBJ_ERROR_SPEC
+RSVP_CTYPE_IPV6
, "IPv6" },
251 { 256*RSVP_OBJ_ERROR_SPEC
+RSVP_CTYPE_3
, "IPv4 plus opt. TLVs" },
252 { 256*RSVP_OBJ_ERROR_SPEC
+RSVP_CTYPE_4
, "IPv6 plus opt. TLVs" },
253 { 256*RSVP_OBJ_RESTART_CAPABILITY
+RSVP_CTYPE_1
, "IPv4" },
254 { 256*RSVP_OBJ_SESSION_ATTRIBUTE
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
255 { 256*RSVP_OBJ_FASTREROUTE
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
256 { 256*RSVP_OBJ_DETOUR
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
257 { 256*RSVP_OBJ_PROPERTIES
+RSVP_CTYPE_1
, "1" },
261 #define RSVP_OBJ_XRO_MASK_SUBOBJ(x) ((x)&0x7f)
262 #define RSVP_OBJ_XRO_MASK_LOOSE(x) ((x)&0x80)
264 #define RSVP_OBJ_XRO_RES 0
265 #define RSVP_OBJ_XRO_IPV4 1
266 #define RSVP_OBJ_XRO_IPV6 2
267 #define RSVP_OBJ_XRO_ASN 32
268 #define RSVP_OBJ_XRO_MPLS 64
270 static const struct tok rsvp_obj_xro_values
[] = {
271 { RSVP_OBJ_XRO_RES
, "Reserved" },
272 { RSVP_OBJ_XRO_IPV4
, "IPv4 prefix" },
273 { RSVP_OBJ_XRO_IPV6
, "IPv6 prefix" },
274 { RSVP_OBJ_XRO_ASN
, "Autonomous system number" },
275 { RSVP_OBJ_XRO_MPLS
, "MPLS label switched path termination" },
279 /* draft-ietf-mpls-rsvp-lsp-fastreroute-02.txt */
280 static const struct tok rsvp_obj_rro_flag_values
[] = {
281 { 0x01, "Local protection available" },
282 { 0x02, "Local protection in use" },
283 { 0x04, "Bandwidth protection" },
284 { 0x08, "Node protection" },
288 static const struct tok rsvp_resstyle_values
[] = {
289 { 17, "Wildcard Filter" },
290 { 10, "Fixed Filter" },
291 { 18, "Shared Explicit" },
295 #define RSVP_OBJ_INTSERV_GUARANTEED_SERV 2
296 #define RSVP_OBJ_INTSERV_CONTROLLED_LOAD 5
298 static const struct tok rsvp_intserv_service_type_values
[] = {
299 { 1, "Default/Global Information" },
300 { RSVP_OBJ_INTSERV_GUARANTEED_SERV
, "Guaranteed Service" },
301 { RSVP_OBJ_INTSERV_CONTROLLED_LOAD
, "Controlled Load" },
305 static const struct tok rsvp_intserv_parameter_id_values
[] = {
307 { 6, "Path b/w estimate" },
308 { 8, "Minimum path latency" },
309 { 10, "Composed MTU" },
310 { 127, "Token Bucket TSpec" },
311 { 130, "Guaranteed Service RSpec" },
312 { 133, "End-to-end composed value for C" },
313 { 134, "End-to-end composed value for D" },
314 { 135, "Since-last-reshaping point composed C" },
315 { 136, "Since-last-reshaping point composed D" },
319 static struct tok rsvp_session_attribute_flag_values
[] = {
320 { 0x01, "Local Protection desired" },
321 { 0x02, "Label Recording desired" },
322 { 0x04, "SE Style desired" },
323 { 0x08, "Bandwidth protection desired" }, /* draft-ietf-mpls-rsvp-lsp-fastreroute-02.txt */
324 { 0x10, "Node protection desired" }, /* draft-ietf-mpls-rsvp-lsp-fastreroute-02.txt */
328 static struct tok rsvp_obj_prop_tlv_values
[] = {
330 { 0x02, "Metric 1" },
331 { 0x04, "Metric 2" },
332 { 0x08, "CCC Status" },
333 { 0x10, "Path Type" },
337 #define RSVP_OBJ_ERROR_SPEC_CODE_ROUTING 24
338 #define RSVP_OBJ_ERROR_SPEC_CODE_NOTIFY 25
340 static struct tok rsvp_obj_error_code_values
[] = {
341 { RSVP_OBJ_ERROR_SPEC_CODE_ROUTING
, "Routing Problem" },
342 { RSVP_OBJ_ERROR_SPEC_CODE_NOTIFY
, "Notify Error" },
346 static struct tok rsvp_obj_error_code_routing_values
[] = {
347 { 1, "Bad EXPLICIT_ROUTE object" },
348 { 2, "Bad strict node" },
349 { 3, "Bad loose node" },
350 { 4, "Bad initial subobject" },
351 { 5, "No route available toward destination" },
352 { 6, "Unacceptable label value" },
353 { 7, "RRO indicated routing loops" },
354 { 8, "non-RSVP-capable router in the path" },
355 { 9, "MPLS label allocation failure" },
356 { 10, "Unsupported L3PID" },
364 int rsvp_intserv_print(const u_char
*);
367 * this is a dissector for all the intserv defined
368 * specs as defined per rfc2215
369 * it is called from various rsvp objects;
370 * returns the amount of bytes being processed
373 rsvp_intserv_print(const u_char
*tptr
) {
375 int parameter_id
,parameter_length
;
381 parameter_id
= *(tptr
);
382 parameter_length
= EXTRACT_16BITS(tptr
+2)<<2; /* convert wordcount to bytecount */
384 printf("\n\t Parameter ID: %s (%u), length: %u, Flags: [0x%02x]",
385 tok2str(rsvp_intserv_parameter_id_values
,"unknown",parameter_id
),
390 switch(parameter_id
) { /* parameter_id */
394 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
395 * | 4 (e) | (f) | 1 (g) |
396 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
397 * | IS hop cnt (32-bit unsigned integer) |
398 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
400 printf("\n\t\tIS hop cnt: %u", EXTRACT_32BITS(tptr
+4));
405 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
406 * | 6 (h) | (i) | 1 (j) |
407 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
408 * | Path b/w estimate (32-bit IEEE floating point number) |
409 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
411 bw
.i
= EXTRACT_32BITS(tptr
+4);
412 printf("\n\t\tPath b/w estimate: %.10g Mbps", bw
.f
/125000);
417 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
418 * | 8 (k) | (l) | 1 (m) |
419 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
420 * | Minimum path latency (32-bit integer) |
421 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
423 printf("\n\t\tMinimum path latency: ");
424 if (EXTRACT_32BITS(tptr
+4) == 0xffffffff)
425 printf("don't care");
427 printf("%u", EXTRACT_32BITS(tptr
+4));
433 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
434 * | 10 (n) | (o) | 1 (p) |
435 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
436 * | Composed MTU (32-bit unsigned integer) |
437 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
439 printf("\n\t\tComposed MTU: %u bytes", EXTRACT_32BITS(tptr
+4));
443 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
444 * | 127 (e) | 0 (f) | 5 (g) |
445 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
446 * | Token Bucket Rate [r] (32-bit IEEE floating point number) |
447 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
448 * | Token Bucket Size [b] (32-bit IEEE floating point number) |
449 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
450 * | Peak Data Rate [p] (32-bit IEEE floating point number) |
451 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
452 * | Minimum Policed Unit [m] (32-bit integer) |
453 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
454 * | Maximum Packet Size [M] (32-bit integer) |
455 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
458 bw
.i
= EXTRACT_32BITS(tptr
+4);
459 printf("\n\t\tToken Bucket Rate: %.10g Mbps", bw
.f
/125000);
460 bw
.i
= EXTRACT_32BITS(tptr
+8);
461 printf("\n\t\tToken Bucket Size: %.10g bytes", bw
.f
);
462 bw
.i
= EXTRACT_32BITS(tptr
+12);
463 printf("\n\t\tPeak Data Rate: %.10g Mbps", bw
.f
/125000);
464 printf("\n\t\tMinimum Policed Unit: %u bytes", EXTRACT_32BITS(tptr
+16));
465 printf("\n\t\tMaximum Packet Size: %u bytes", EXTRACT_32BITS(tptr
+20));
470 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
471 * | 130 (h) | 0 (i) | 2 (j) |
472 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
473 * | Rate [R] (32-bit IEEE floating point number) |
474 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
475 * | Slack Term [S] (32-bit integer) |
476 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
479 bw
.i
= EXTRACT_32BITS(tptr
+4);
480 printf("\n\t\tRate: %.10g Mbps", bw
.f
/125000);
481 printf("\n\t\tSlack Term: %u", EXTRACT_32BITS(tptr
+8));
488 printf("\n\t\tValue: %u", EXTRACT_32BITS(tptr
+4));
493 print_unknown_data(tptr
+4,"\n\t\t",parameter_length
);
495 return (parameter_length
+4); /* header length 4 bytes */
499 rsvp_print(register const u_char
*pptr
, register u_int len
) {
501 const struct rsvp_common_header
*rsvp_com_header
;
502 const struct rsvp_object_header
*rsvp_obj_header
;
503 const u_char
*tptr
,*obj_tptr
;
504 u_short tlen
,rsvp_obj_len
,rsvp_obj_ctype
,obj_tlen
,intserv_serv_tlen
;
505 int hexdump
,processed
,padbytes
,error_code
,error_value
;
512 rsvp_com_header
= (const struct rsvp_common_header
*)pptr
;
513 TCHECK(*rsvp_com_header
);
516 * Sanity checking of the header.
518 if (RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
) != RSVP_VERSION
) {
519 printf("RSVP version %u packet not supported",
520 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
));
524 /* in non-verbose mode just lets print the basic Message Type*/
526 printf("RSVP %s Message, length: %u",
527 tok2str(rsvp_msg_type_values
, "unknown (%u)",rsvp_com_header
->msg_type
),
532 /* ok they seem to want to know everything - lets fully decode it */
534 tlen
=EXTRACT_16BITS(rsvp_com_header
->length
);
536 printf("RSVP\n\tv: %u, msg-type: %s, length: %u, ttl: %u, checksum: 0x%04x",
537 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
),
538 tok2str(rsvp_msg_type_values
, "unknown, type: %u",rsvp_com_header
->msg_type
),
540 rsvp_com_header
->ttl
,
541 EXTRACT_16BITS(rsvp_com_header
->checksum
));
543 tptr
+=sizeof(const struct rsvp_common_header
);
544 tlen
-=sizeof(const struct rsvp_common_header
);
547 /* did we capture enough for fully decoding the object header ? */
548 if (!TTEST2(*tptr
, sizeof(struct rsvp_object_header
)))
551 rsvp_obj_header
= (const struct rsvp_object_header
*)tptr
;
552 rsvp_obj_len
=EXTRACT_16BITS(rsvp_obj_header
->length
);
553 rsvp_obj_ctype
=rsvp_obj_header
->ctype
;
555 if(rsvp_obj_len
% 4 || rsvp_obj_len
< 4)
558 printf("\n\t %s Object (%u) Flags: [%s",
559 tok2str(rsvp_obj_values
,
561 rsvp_obj_header
->class_num
),
562 rsvp_obj_header
->class_num
,
563 ((rsvp_obj_header
->class_num
)&0x80) ? "ignore" : "reject");
565 if (rsvp_obj_header
->class_num
> 128)
567 ((rsvp_obj_header
->class_num
)&0x40) ? "and forward" : "silently");
569 printf(" if unknown], Class-Type: %s (%u), length: %u",
570 tok2str(rsvp_ctype_values
,
572 ((rsvp_obj_header
->class_num
)<<8)+rsvp_obj_ctype
),
576 obj_tptr
=tptr
+sizeof(struct rsvp_object_header
);
577 obj_tlen
=rsvp_obj_len
-sizeof(struct rsvp_object_header
);
579 /* did we capture enough for fully decoding the object ? */
580 if (!TTEST2(*tptr
, rsvp_obj_len
))
584 switch(rsvp_obj_header
->class_num
) {
585 case RSVP_OBJ_SESSION
:
586 switch(rsvp_obj_ctype
) {
587 case RSVP_CTYPE_IPV4
:
588 printf("\n\t IPv4 DestAddress: %s, Protocol ID: 0x%02x",
589 ipaddr_string(obj_tptr
),
591 printf("\n\t Flags: [0x%02x], DestPort %u",
593 EXTRACT_16BITS(obj_tptr
+6));
598 case RSVP_CTYPE_IPV6
:
599 printf("\n\t IPv6 DestAddress: %s, Protocol ID: 0x%02x",
600 ip6addr_string(obj_tptr
),
602 printf("\n\t Flags: [0x%02x], DestPort %u",
604 EXTRACT_16BITS(obj_tptr
+18));
609 case RSVP_CTYPE_TUNNEL_IPV6
:
610 printf("\n\t IPv6 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
611 ip6addr_string(obj_tptr
),
612 EXTRACT_16BITS(obj_tptr
+18),
613 ip6addr_string(obj_tptr
+20));
618 case RSVP_CTYPE_TUNNEL_IPV4
:
619 printf("\n\t IPv4 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
620 ipaddr_string(obj_tptr
),
621 EXTRACT_16BITS(obj_tptr
+6),
622 ipaddr_string(obj_tptr
+8));
631 case RSVP_OBJ_CONFIRM
:
632 switch(rsvp_obj_ctype
) {
633 case RSVP_CTYPE_IPV4
:
634 printf("\n\t IPv4 Receiver Address %s",
635 ipaddr_string(obj_tptr
));
640 case RSVP_CTYPE_IPV6
:
641 printf("\n\t IPv6 Receiver Address %s",
642 ip6addr_string(obj_tptr
));
652 case RSVP_OBJ_NOTIFY_REQ
:
653 switch(rsvp_obj_ctype
) {
654 case RSVP_CTYPE_IPV4
:
655 printf("\n\t IPv4 Notify Node Address %s",
656 ipaddr_string(obj_tptr
));
661 case RSVP_CTYPE_IPV6
:
662 printf("\n\t IPv6 Notify Node Address %s",
663 ip6addr_string(obj_tptr
));
673 case RSVP_OBJ_SUGGESTED_LABEL
: /* fall through */
674 case RSVP_OBJ_UPSTREAM_LABEL
: /* fall through */
675 case RSVP_OBJ_RECOVERY_LABEL
: /* fall through */
677 switch(rsvp_obj_ctype
) {
679 while(obj_tlen
>= 4 ) {
680 printf("\n\t Label %u", EXTRACT_32BITS(obj_tptr
));
686 printf("\n\t Generalized Label %u",
687 EXTRACT_32BITS(obj_tptr
));
692 printf("\n\t Waveband ID %u\n\t Start Label %u, Stop Label %u",
693 EXTRACT_32BITS(obj_tptr
),
694 EXTRACT_32BITS(obj_tptr
+4),
695 EXTRACT_32BITS(obj_tptr
+8));
705 switch(rsvp_obj_ctype
) {
707 printf("\n\t Reservation Style: %s, Flags: [0x%02x]",
708 tok2str(rsvp_resstyle_values
,
710 EXTRACT_24BITS(obj_tptr
+1)),
720 case RSVP_OBJ_SENDER_TEMPLATE
:
721 switch(rsvp_obj_ctype
) {
722 case RSVP_CTYPE_IPV4
:
723 printf("\n\t Source Address: %s, Source Port: %u",
724 ipaddr_string(obj_tptr
),
725 EXTRACT_16BITS(obj_tptr
+6));
730 case RSVP_CTYPE_IPV6
:
731 printf("\n\t Source Address: %s, Source Port: %u",
732 ip6addr_string(obj_tptr
),
733 EXTRACT_16BITS(obj_tptr
+18));
738 case RSVP_CTYPE_TUNNEL_IPV4
:
739 printf("\n\t IPv4 Tunnel Sender Address: %s, LSP-ID: 0x%04x",
740 ipaddr_string(obj_tptr
),
741 EXTRACT_16BITS(obj_tptr
+6));
750 case RSVP_OBJ_LABEL_REQ
:
751 switch(rsvp_obj_ctype
) {
753 while(obj_tlen
>= 4 ) {
754 printf("\n\t L3 Protocol ID %s",
755 tok2str(ethertype_values
,
756 "Unknown Protocol (0x%04x)",
757 EXTRACT_16BITS(obj_tptr
+2)));
763 printf("\n\t L3 Protocol ID %s",
764 tok2str(ethertype_values
,
765 "Unknown Protocol (0x%04x)",
766 EXTRACT_16BITS(obj_tptr
+2)));
767 printf(",%s merge capability",((*(obj_tptr
+4))&0x80) ? "no" : "" );
768 printf("\n\t Minimum VPI/VCI %u/%u",
769 (EXTRACT_16BITS(obj_tptr
+4))&0xfff,
770 (EXTRACT_16BITS(obj_tptr
+6))&0xfff);
771 printf("\n\t Maximum VPI/VCI %u/%u",
772 (EXTRACT_16BITS(obj_tptr
+8))&0xfff,
773 (EXTRACT_16BITS(obj_tptr
+10))&0xfff);
778 printf("\n\t L3 Protocol ID %s",
779 tok2str(ethertype_values
,
780 "Unknown Protocol (0x%04x)",
781 EXTRACT_16BITS(obj_tptr
+2)));
782 printf("\n\t Minimum/Maximum DLCI %u/%u, %s%s bit DLCI",
783 (EXTRACT_32BITS(obj_tptr
+4))&0x7fffff,
784 (EXTRACT_32BITS(obj_tptr
+8))&0x7fffff,
785 (((EXTRACT_16BITS(obj_tptr
+4)>>7)&3) == 0 ) ? "10" : "",
786 (((EXTRACT_16BITS(obj_tptr
+4)>>7)&3) == 2 ) ? "23" : "");
791 printf("\n\t LSP Encoding Type %s",
792 tok2str(gmpls_encoding_values
,
795 printf("\n\t Switching Type %s, Payload ID %s",
796 tok2str(gmpls_switch_cap_values
,
799 tok2str(gmpls_payload_values
,
801 EXTRACT_16BITS(obj_tptr
+2)));
812 switch(rsvp_obj_ctype
) {
813 case RSVP_CTYPE_IPV4
:
814 while(obj_tlen
>= 4 ) {
815 printf("\n\t Subobject Type: %s",
816 tok2str(rsvp_obj_xro_values
,
818 RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr
)));
819 switch(RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr
)) {
820 case RSVP_OBJ_XRO_IPV4
:
821 printf(", %s, %s/%u, Flags: [%s]",
822 RSVP_OBJ_XRO_MASK_LOOSE(*obj_tptr
) ? "Loose" : "Strict",
823 ipaddr_string(obj_tptr
+2),
825 bittok2str(rsvp_obj_rro_flag_values
,
827 *(obj_tptr
+7))); /* rfc3209 says that this field is rsvd. */
829 obj_tlen
-=*(obj_tptr
+1);
830 obj_tptr
+=*(obj_tptr
+1);
839 switch(rsvp_obj_ctype
) {
842 printf("\n\t Source Instance 0x%08x, Destination Instance 0x%08x",
843 EXTRACT_32BITS(obj_tptr
),
844 EXTRACT_32BITS(obj_tptr
+4));
853 case RSVP_OBJ_RESTART_CAPABILITY
:
854 switch(rsvp_obj_ctype
) {
856 printf("\n\t Restart Time: %ums\n\t Recovery Time: %ums",
857 EXTRACT_16BITS(obj_tptr
),
858 EXTRACT_16BITS(obj_tptr
+4));
865 case RSVP_OBJ_SESSION_ATTRIBUTE
:
866 switch(rsvp_obj_ctype
) {
867 case RSVP_CTYPE_TUNNEL_IPV4
:
868 printf("\n\t Session Name: %s",(obj_tptr
+4));
869 printf("\n\t Setup Priority: %u, Holding Priority: %u, Flags: [%s]",
872 tok2str(rsvp_session_attribute_flag_values
,
876 obj_tlen
-=4+*(obj_tptr
+3);
877 obj_tptr
+=4+*(obj_tptr
+3);
884 case RSVP_OBJ_RSVP_HOP
:
885 switch(rsvp_obj_ctype
) {
886 case RSVP_CTYPE_3
: /* fall through - FIXME add TLV parser */
887 case RSVP_CTYPE_IPV4
:
888 printf("\n\t Previous/Next Interface: %s, Logical Interface Handle: 0x%08x",
889 ipaddr_string(obj_tptr
),
890 EXTRACT_32BITS(obj_tptr
+4));
895 case RSVP_CTYPE_4
: /* fall through - FIXME add TLV parser */
896 case RSVP_CTYPE_IPV6
:
897 printf("\n\t Previous/Next Interface: %s, Logical Interface Handle: 0x%08x",
898 ip6addr_string(obj_tptr
),
899 EXTRACT_32BITS(obj_tptr
+16));
909 case RSVP_OBJ_TIME_VALUES
:
910 switch(rsvp_obj_ctype
) {
912 printf("\n\t Refresh Period: %ums",
913 EXTRACT_32BITS(obj_tptr
));
922 /* those three objects do share the same semantics */
923 case RSVP_OBJ_SENDER_TSPEC
:
924 case RSVP_OBJ_ADSPEC
:
925 case RSVP_OBJ_FLOWSPEC
:
926 switch(rsvp_obj_ctype
) {
928 printf("\n\t Msg-Version: %u, length: %u",
929 (*obj_tptr
& 0xf0) >> 4,
930 EXTRACT_16BITS(obj_tptr
+2)<<2);
931 obj_tptr
+=4; /* get to the start of the service header */
934 while (obj_tlen
>= 4) {
935 intserv_serv_tlen
=EXTRACT_16BITS(obj_tptr
+2)<<2;
936 printf("\n\t Service Type: %s (%u), break bit %s set, Service length: %u",
937 tok2str(rsvp_intserv_service_type_values
,"unknown",*(obj_tptr
)),
939 (*(obj_tptr
+1)&0x80) ? "" : "not",
942 obj_tptr
+=4; /* get to the start of the parameter list */
945 while (intserv_serv_tlen
>=4) {
946 processed
= rsvp_intserv_print(obj_tptr
);
950 intserv_serv_tlen
-=processed
;
960 case RSVP_OBJ_FILTERSPEC
:
961 switch(rsvp_obj_ctype
) {
962 case RSVP_CTYPE_IPV4
:
963 printf("\n\t Source Address: %s, Source Port: %u",
964 ipaddr_string(obj_tptr
),
965 EXTRACT_16BITS(obj_tptr
+6));
970 case RSVP_CTYPE_IPV6
:
971 printf("\n\t Source Address: %s, Source Port: %u",
972 ip6addr_string(obj_tptr
),
973 EXTRACT_16BITS(obj_tptr
+18));
978 printf("\n\t Source Address: %s, Flow Label: %u",
979 ip6addr_string(obj_tptr
),
980 EXTRACT_24BITS(obj_tptr
+17));
984 case RSVP_CTYPE_TUNNEL_IPV6
:
985 printf("\n\t Source Address: %s, LSP-ID: 0x%04x",
986 ipaddr_string(obj_tptr
),
987 EXTRACT_16BITS(obj_tptr
+18));
992 case RSVP_CTYPE_TUNNEL_IPV4
:
993 printf("\n\t Source Address: %s, LSP-ID: 0x%04x",
994 ipaddr_string(obj_tptr
),
995 EXTRACT_16BITS(obj_tptr
+6));
1004 case RSVP_OBJ_FASTREROUTE
:
1005 switch(rsvp_obj_ctype
) {
1006 case RSVP_CTYPE_TUNNEL_IPV4
:
1007 bw
.i
= EXTRACT_32BITS(obj_tptr
+4);
1008 printf("\n\t Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps",
1013 printf("\n\t Include Colors: 0x%08x, Exclude Colors: 0x%08x",
1014 EXTRACT_32BITS(obj_tptr
+8),
1015 EXTRACT_32BITS(obj_tptr
+12));
1024 case RSVP_OBJ_DETOUR
:
1025 switch(rsvp_obj_ctype
) {
1026 case RSVP_CTYPE_TUNNEL_IPV4
:
1027 while(obj_tlen
>= 8) {
1028 printf("\n\t PLR-ID: %s, Avoid-Node-ID: %s",
1029 ipaddr_string(obj_tptr
),
1030 ipaddr_string(obj_tptr
+4));
1040 case RSVP_OBJ_ERROR_SPEC
:
1041 switch(rsvp_obj_ctype
) {
1042 case RSVP_CTYPE_3
: /* fall through - FIXME add TLV parser */
1043 case RSVP_CTYPE_IPV4
:
1044 error_code
=*(obj_tptr
+5);
1045 error_value
=EXTRACT_16BITS(obj_tptr
+6);
1046 printf("\n\t Error Node Adress: %s, Flags: [0x%02x]\n\t Error Code: %s (%u)",
1047 ipaddr_string(obj_tptr
),
1049 tok2str(rsvp_obj_error_code_values
,"unknown",error_code
),
1051 switch (error_code
) {
1052 case RSVP_OBJ_ERROR_SPEC_CODE_ROUTING
:
1053 printf(", Error Value: %s (%u)",
1054 tok2str(rsvp_obj_error_code_routing_values
,"unknown",error_value
),
1058 printf(", Unknown Error Value (%u)", error_value
);
1063 case RSVP_CTYPE_4
: /* fall through - FIXME add TLV parser */
1064 case RSVP_CTYPE_IPV6
:
1065 error_code
=*(obj_tptr
+17);
1066 error_value
=EXTRACT_16BITS(obj_tptr
+18);
1067 printf("\n\t Error Node Adress: %s, Flags: [0x%02x]\n\t Error Code: %s (%u)",
1068 ip6addr_string(obj_tptr
),
1070 tok2str(rsvp_obj_error_code_values
,"unknown",error_code
),
1073 switch (error_code
) {
1074 case RSVP_OBJ_ERROR_SPEC_CODE_ROUTING
:
1075 printf(", Error Value: %s (%u)",
1076 tok2str(rsvp_obj_error_code_routing_values
,"unknown",error_value
),
1090 case RSVP_OBJ_PROPERTIES
:
1091 switch(rsvp_obj_ctype
) {
1093 padbytes
= EXTRACT_16BITS(obj_tptr
+2);
1094 printf("\n\t TLV count: %u, padding bytes: %u",
1095 EXTRACT_16BITS(obj_tptr
),
1099 /* loop through as long there is anything longer than the TLV header (2) */
1100 while(obj_tlen
>= 2 + padbytes
) {
1101 printf("\n\t %s TLV (0x%02x), length: %u", /* length includes header */
1102 tok2str(rsvp_obj_prop_tlv_values
,"unknown",*obj_tptr
),
1105 print_unknown_data(obj_tptr
+2,"\n\t\t",*(obj_tptr
+1)-2);
1106 obj_tlen
-=*(obj_tptr
+1);
1107 obj_tptr
+=*(obj_tptr
+1);
1116 * FIXME those are the defined objects that lack a decoder
1117 * you are welcome to contribute code ;-)
1120 case RSVP_OBJ_INTEGRITY
:
1121 case RSVP_OBJ_SCOPE
:
1122 case RSVP_OBJ_POLICY_DATA
:
1123 case RSVP_OBJ_MESSAGE_ID
:
1124 case RSVP_OBJ_MESSAGE_ID_ACK
:
1125 case RSVP_OBJ_MESSAGE_ID_LIST
:
1126 case RSVP_OBJ_LABEL_SET
:
1127 case RSVP_OBJ_ACCEPT_LABEL_SET
:
1128 case RSVP_OBJ_PROTECTION
:
1131 print_unknown_data(obj_tptr
,"\n\t ",obj_tlen
);
1134 /* do we want to see an additionally hexdump ? */
1135 if (vflag
> 1 || hexdump
==TRUE
)
1136 print_unknown_data(tptr
+sizeof(sizeof(struct rsvp_object_header
)),"\n\t ",
1137 rsvp_obj_len
-sizeof(struct rsvp_object_header
));
1144 printf("\n\t\t packet exceeded snapshot");