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.23 2003-10-20 10:50:09 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 Label" },
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 count: %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 (%u)",
792 tok2str(gmpls_encoding_values
,
796 printf("\n\t Switching Type: %s (%u), Payload ID: %s (0x%04x)",
797 tok2str(gmpls_switch_cap_values
,
801 tok2str(gmpls_payload_values
,
803 EXTRACT_16BITS(obj_tptr
+2)),
804 EXTRACT_16BITS(obj_tptr
+2));
815 switch(rsvp_obj_ctype
) {
816 case RSVP_CTYPE_IPV4
:
817 while(obj_tlen
>= 4 ) {
818 printf("\n\t Subobject Type: %s",
819 tok2str(rsvp_obj_xro_values
,
821 RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr
)));
822 switch(RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr
)) {
823 case RSVP_OBJ_XRO_IPV4
:
824 printf(", %s, %s/%u, Flags: [%s]",
825 RSVP_OBJ_XRO_MASK_LOOSE(*obj_tptr
) ? "Loose" : "Strict",
826 ipaddr_string(obj_tptr
+2),
828 bittok2str(rsvp_obj_rro_flag_values
,
830 *(obj_tptr
+7))); /* rfc3209 says that this field is rsvd. */
832 obj_tlen
-=*(obj_tptr
+1);
833 obj_tptr
+=*(obj_tptr
+1);
842 switch(rsvp_obj_ctype
) {
845 printf("\n\t Source Instance: 0x%08x, Destination Instance: 0x%08x",
846 EXTRACT_32BITS(obj_tptr
),
847 EXTRACT_32BITS(obj_tptr
+4));
856 case RSVP_OBJ_RESTART_CAPABILITY
:
857 switch(rsvp_obj_ctype
) {
859 printf("\n\t Restart Time: %ums, Recovery Time: %ums",
860 EXTRACT_16BITS(obj_tptr
),
861 EXTRACT_16BITS(obj_tptr
+4));
868 case RSVP_OBJ_SESSION_ATTRIBUTE
:
869 switch(rsvp_obj_ctype
) {
870 case RSVP_CTYPE_TUNNEL_IPV4
:
871 printf("\n\t Session Name: %s",(obj_tptr
+4));
872 printf("\n\t Setup Priority: %u, Holding Priority: %u, Flags: [%s]",
875 tok2str(rsvp_session_attribute_flag_values
,
879 obj_tlen
-=4+*(obj_tptr
+3);
880 obj_tptr
+=4+*(obj_tptr
+3);
887 case RSVP_OBJ_RSVP_HOP
:
888 switch(rsvp_obj_ctype
) {
889 case RSVP_CTYPE_3
: /* fall through - FIXME add TLV parser */
890 case RSVP_CTYPE_IPV4
:
891 printf("\n\t Previous/Next Interface: %s, Logical Interface Handle: 0x%08x",
892 ipaddr_string(obj_tptr
),
893 EXTRACT_32BITS(obj_tptr
+4));
896 hexdump
=TRUE
; /* unless we have a TLV parser lets just hexdump */
899 case RSVP_CTYPE_4
: /* fall through - FIXME add TLV parser */
900 case RSVP_CTYPE_IPV6
:
901 printf("\n\t Previous/Next Interface: %s, Logical Interface Handle: 0x%08x",
902 ip6addr_string(obj_tptr
),
903 EXTRACT_32BITS(obj_tptr
+16));
906 hexdump
=TRUE
; /* unless we have a TLV parser lets just hexdump */
914 case RSVP_OBJ_TIME_VALUES
:
915 switch(rsvp_obj_ctype
) {
917 printf("\n\t Refresh Period: %ums",
918 EXTRACT_32BITS(obj_tptr
));
927 /* those three objects do share the same semantics */
928 case RSVP_OBJ_SENDER_TSPEC
:
929 case RSVP_OBJ_ADSPEC
:
930 case RSVP_OBJ_FLOWSPEC
:
931 switch(rsvp_obj_ctype
) {
933 printf("\n\t Msg-Version: %u, length: %u",
934 (*obj_tptr
& 0xf0) >> 4,
935 EXTRACT_16BITS(obj_tptr
+2)<<2);
936 obj_tptr
+=4; /* get to the start of the service header */
939 while (obj_tlen
>= 4) {
940 intserv_serv_tlen
=EXTRACT_16BITS(obj_tptr
+2)<<2;
941 printf("\n\t Service Type: %s (%u), break bit %s set, Service length: %u",
942 tok2str(rsvp_intserv_service_type_values
,"unknown",*(obj_tptr
)),
944 (*(obj_tptr
+1)&0x80) ? "" : "not",
947 obj_tptr
+=4; /* get to the start of the parameter list */
950 while (intserv_serv_tlen
>=4) {
951 processed
= rsvp_intserv_print(obj_tptr
);
955 intserv_serv_tlen
-=processed
;
965 case RSVP_OBJ_FILTERSPEC
:
966 switch(rsvp_obj_ctype
) {
967 case RSVP_CTYPE_IPV4
:
968 printf("\n\t Source Address: %s, Source Port: %u",
969 ipaddr_string(obj_tptr
),
970 EXTRACT_16BITS(obj_tptr
+6));
975 case RSVP_CTYPE_IPV6
:
976 printf("\n\t Source Address: %s, Source Port: %u",
977 ip6addr_string(obj_tptr
),
978 EXTRACT_16BITS(obj_tptr
+18));
983 printf("\n\t Source Address: %s, Flow Label: %u",
984 ip6addr_string(obj_tptr
),
985 EXTRACT_24BITS(obj_tptr
+17));
989 case RSVP_CTYPE_TUNNEL_IPV6
:
990 printf("\n\t Source Address: %s, LSP-ID: 0x%04x",
991 ipaddr_string(obj_tptr
),
992 EXTRACT_16BITS(obj_tptr
+18));
997 case RSVP_CTYPE_TUNNEL_IPV4
:
998 printf("\n\t Source Address: %s, LSP-ID: 0x%04x",
999 ipaddr_string(obj_tptr
),
1000 EXTRACT_16BITS(obj_tptr
+6));
1009 case RSVP_OBJ_FASTREROUTE
:
1010 switch(rsvp_obj_ctype
) {
1011 case RSVP_CTYPE_TUNNEL_IPV4
:
1012 bw
.i
= EXTRACT_32BITS(obj_tptr
+4);
1013 printf("\n\t Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps",
1018 printf("\n\t Include Colors: 0x%08x, Exclude Colors: 0x%08x",
1019 EXTRACT_32BITS(obj_tptr
+8),
1020 EXTRACT_32BITS(obj_tptr
+12));
1029 case RSVP_OBJ_DETOUR
:
1030 switch(rsvp_obj_ctype
) {
1031 case RSVP_CTYPE_TUNNEL_IPV4
:
1032 while(obj_tlen
>= 8) {
1033 printf("\n\t PLR-ID: %s, Avoid-Node-ID: %s",
1034 ipaddr_string(obj_tptr
),
1035 ipaddr_string(obj_tptr
+4));
1045 case RSVP_OBJ_ERROR_SPEC
:
1046 switch(rsvp_obj_ctype
) {
1047 case RSVP_CTYPE_3
: /* fall through - FIXME add TLV parser */
1048 case RSVP_CTYPE_IPV4
:
1049 error_code
=*(obj_tptr
+5);
1050 error_value
=EXTRACT_16BITS(obj_tptr
+6);
1051 printf("\n\t Error Node Adress: %s, Flags: [0x%02x]\n\t Error Code: %s (%u)",
1052 ipaddr_string(obj_tptr
),
1054 tok2str(rsvp_obj_error_code_values
,"unknown",error_code
),
1056 switch (error_code
) {
1057 case RSVP_OBJ_ERROR_SPEC_CODE_ROUTING
:
1058 printf(", Error Value: %s (%u)",
1059 tok2str(rsvp_obj_error_code_routing_values
,"unknown",error_value
),
1063 printf(", Unknown Error Value (%u)", error_value
);
1068 case RSVP_CTYPE_4
: /* fall through - FIXME add TLV parser */
1069 case RSVP_CTYPE_IPV6
:
1070 error_code
=*(obj_tptr
+17);
1071 error_value
=EXTRACT_16BITS(obj_tptr
+18);
1072 printf("\n\t Error Node Adress: %s, Flags: [0x%02x]\n\t Error Code: %s (%u)",
1073 ip6addr_string(obj_tptr
),
1075 tok2str(rsvp_obj_error_code_values
,"unknown",error_code
),
1078 switch (error_code
) {
1079 case RSVP_OBJ_ERROR_SPEC_CODE_ROUTING
:
1080 printf(", Error Value: %s (%u)",
1081 tok2str(rsvp_obj_error_code_routing_values
,"unknown",error_value
),
1095 case RSVP_OBJ_PROPERTIES
:
1096 switch(rsvp_obj_ctype
) {
1098 padbytes
= EXTRACT_16BITS(obj_tptr
+2);
1099 printf("\n\t TLV count: %u, padding bytes: %u",
1100 EXTRACT_16BITS(obj_tptr
),
1104 /* loop through as long there is anything longer than the TLV header (2) */
1105 while(obj_tlen
>= 2 + padbytes
) {
1106 printf("\n\t %s TLV (0x%02x), length: %u", /* length includes header */
1107 tok2str(rsvp_obj_prop_tlv_values
,"unknown",*obj_tptr
),
1110 print_unknown_data(obj_tptr
+2,"\n\t\t",*(obj_tptr
+1)-2);
1111 obj_tlen
-=*(obj_tptr
+1);
1112 obj_tptr
+=*(obj_tptr
+1);
1121 * FIXME those are the defined objects that lack a decoder
1122 * you are welcome to contribute code ;-)
1125 case RSVP_OBJ_INTEGRITY
:
1126 case RSVP_OBJ_SCOPE
:
1127 case RSVP_OBJ_POLICY_DATA
:
1128 case RSVP_OBJ_MESSAGE_ID
:
1129 case RSVP_OBJ_MESSAGE_ID_ACK
:
1130 case RSVP_OBJ_MESSAGE_ID_LIST
:
1131 case RSVP_OBJ_LABEL_SET
:
1132 case RSVP_OBJ_ACCEPT_LABEL_SET
:
1133 case RSVP_OBJ_PROTECTION
:
1136 print_unknown_data(obj_tptr
,"\n\t ",obj_tlen
);
1139 /* do we want to see an additionally hexdump ? */
1140 if (vflag
> 1 || hexdump
==TRUE
)
1141 print_unknown_data(tptr
+sizeof(sizeof(struct rsvp_object_header
)),"\n\t ",
1142 rsvp_obj_len
-sizeof(struct rsvp_object_header
));
1149 printf("\n\t\t packet exceeded snapshot");