2 * Copyright (c) 1998-2005 The TCPDUMP project
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that: (1) source code
6 * distributions retain the above copyright notice and this paragraph
7 * in its entirety, and (2) distributions including binary code include
8 * the above copyright notice and this paragraph in its entirety in
9 * the documentation or other materials provided with the distribution.
10 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND
11 * WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
12 * LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
13 * FOR A PARTICULAR PURPOSE.
15 * Original code by Hannes Gredler (hannes@juniper.net)
19 static const char rcsid
[] _U_
=
20 "@(#) $Header: /tcpdump/master/tcpdump/print-rsvp.c,v 1.43 2007-02-23 10:40:10 hannes Exp $";
27 #include <tcpdump-stdinc.h>
33 #include "interface.h"
35 #include "addrtoname.h"
36 #include "ethertype.h"
40 * RFC 2205 common header
43 * +-------------+-------------+-------------+-------------+
44 * | Vers | Flags| Msg Type | RSVP Checksum |
45 * +-------------+-------------+-------------+-------------+
46 * | Send_TTL | (Reserved) | RSVP Length |
47 * +-------------+-------------+-------------+-------------+
51 struct rsvp_common_header
{
52 u_int8_t version_flags
;
61 * RFC2205 object header
65 * +-------------+-------------+-------------+-------------+
66 * | Length (bytes) | Class-Num | C-Type |
67 * +-------------+-------------+-------------+-------------+
69 * // (Object contents) //
71 * +-------------+-------------+-------------+-------------+
74 struct rsvp_object_header
{
80 #define RSVP_VERSION 1
81 #define RSVP_EXTRACT_VERSION(x) (((x)&0xf0)>>4)
82 #define RSVP_EXTRACT_FLAGS(x) ((x)&0x0f)
84 #define RSVP_MSGTYPE_PATH 1
85 #define RSVP_MSGTYPE_RESV 2
86 #define RSVP_MSGTYPE_PATHERR 3
87 #define RSVP_MSGTYPE_RESVERR 4
88 #define RSVP_MSGTYPE_PATHTEAR 5
89 #define RSVP_MSGTYPE_RESVTEAR 6
90 #define RSVP_MSGTYPE_RESVCONF 7
91 #define RSVP_MSGTYPE_AGGREGATE 12
92 #define RSVP_MSGTYPE_ACK 13
93 #define RSVP_MSGTYPE_HELLO_OLD 14 /* ancient Hellos */
94 #define RSVP_MSGTYPE_SREFRESH 15
95 #define RSVP_MSGTYPE_HELLO 20
97 static const struct tok rsvp_msg_type_values
[] = {
98 { RSVP_MSGTYPE_PATH
, "Path" },
99 { RSVP_MSGTYPE_RESV
, "Resv" },
100 { RSVP_MSGTYPE_PATHERR
, "PathErr" },
101 { RSVP_MSGTYPE_RESVERR
, "ResvErr" },
102 { RSVP_MSGTYPE_PATHTEAR
, "PathTear" },
103 { RSVP_MSGTYPE_RESVTEAR
, "ResvTear" },
104 { RSVP_MSGTYPE_RESVCONF
, "ResvConf" },
105 { RSVP_MSGTYPE_AGGREGATE
, "Aggregate" },
106 { RSVP_MSGTYPE_ACK
, "Acknowledgement" },
107 { RSVP_MSGTYPE_HELLO_OLD
, "Hello (Old)" },
108 { RSVP_MSGTYPE_SREFRESH
, "Refresh" },
109 { RSVP_MSGTYPE_HELLO
, "Hello" },
113 static const struct tok rsvp_header_flag_values
[] = {
114 { 0x01, "Refresh reduction capable" }, /* rfc2961 */
118 #define RSVP_OBJ_SESSION 1 /* rfc2205 */
119 #define RSVP_OBJ_RSVP_HOP 3 /* rfc2205, rfc3473 */
120 #define RSVP_OBJ_INTEGRITY 4 /* rfc2747 */
121 #define RSVP_OBJ_TIME_VALUES 5 /* rfc2205 */
122 #define RSVP_OBJ_ERROR_SPEC 6
123 #define RSVP_OBJ_SCOPE 7
124 #define RSVP_OBJ_STYLE 8 /* rfc2205 */
125 #define RSVP_OBJ_FLOWSPEC 9 /* rfc2215 */
126 #define RSVP_OBJ_FILTERSPEC 10 /* rfc2215 */
127 #define RSVP_OBJ_SENDER_TEMPLATE 11
128 #define RSVP_OBJ_SENDER_TSPEC 12 /* rfc2215 */
129 #define RSVP_OBJ_ADSPEC 13 /* rfc2215 */
130 #define RSVP_OBJ_POLICY_DATA 14
131 #define RSVP_OBJ_CONFIRM 15 /* rfc2205 */
132 #define RSVP_OBJ_LABEL 16 /* rfc3209 */
133 #define RSVP_OBJ_LABEL_REQ 19 /* rfc3209 */
134 #define RSVP_OBJ_ERO 20 /* rfc3209 */
135 #define RSVP_OBJ_RRO 21 /* rfc3209 */
136 #define RSVP_OBJ_HELLO 22 /* rfc3209 */
137 #define RSVP_OBJ_MESSAGE_ID 23 /* rfc2961 */
138 #define RSVP_OBJ_MESSAGE_ID_ACK 24 /* rfc2961 */
139 #define RSVP_OBJ_MESSAGE_ID_LIST 25 /* rfc2961 */
140 #define RSVP_OBJ_RECOVERY_LABEL 34 /* rfc3473 */
141 #define RSVP_OBJ_UPSTREAM_LABEL 35 /* rfc3473 */
142 #define RSVP_OBJ_LABEL_SET 36 /* rfc3473 */
143 #define RSVP_OBJ_PROTECTION 37 /* rfc3473 */
144 #define RSVP_OBJ_DETOUR 63 /* draft-ietf-mpls-rsvp-lsp-fastreroute-07 */
145 #define RSVP_OBJ_CLASSTYPE 66 /* rfc4124 */
146 #define RSVP_OBJ_CLASSTYPE_OLD 125 /* draft-ietf-tewg-diff-te-proto-07 */
147 #define RSVP_OBJ_SUGGESTED_LABEL 129 /* rfc3473 */
148 #define RSVP_OBJ_ACCEPT_LABEL_SET 130 /* rfc3473 */
149 #define RSVP_OBJ_RESTART_CAPABILITY 131 /* rfc3473 */
150 #define RSVP_OBJ_NOTIFY_REQ 195 /* rfc3473 */
151 #define RSVP_OBJ_ADMIN_STATUS 196 /* rfc3473 */
152 #define RSVP_OBJ_PROPERTIES 204 /* juniper proprietary */
153 #define RSVP_OBJ_FASTREROUTE 205 /* draft-ietf-mpls-rsvp-lsp-fastreroute-07 */
154 #define RSVP_OBJ_SESSION_ATTRIBUTE 207 /* rfc3209 */
155 #define RSVP_OBJ_CALL_ID 230 /* rfc3474 */
156 #define RSVP_OBJ_CALL_OPS 236 /* rfc3474 */
158 static const struct tok rsvp_obj_values
[] = {
159 { RSVP_OBJ_SESSION
, "Session" },
160 { RSVP_OBJ_RSVP_HOP
, "RSVP Hop" },
161 { RSVP_OBJ_INTEGRITY
, "Integrity" },
162 { RSVP_OBJ_TIME_VALUES
, "Time Values" },
163 { RSVP_OBJ_ERROR_SPEC
, "Error Spec" },
164 { RSVP_OBJ_SCOPE
, "Scope" },
165 { RSVP_OBJ_STYLE
, "Style" },
166 { RSVP_OBJ_FLOWSPEC
, "Flowspec" },
167 { RSVP_OBJ_FILTERSPEC
, "FilterSpec" },
168 { RSVP_OBJ_SENDER_TEMPLATE
, "Sender Template" },
169 { RSVP_OBJ_SENDER_TSPEC
, "Sender TSpec" },
170 { RSVP_OBJ_ADSPEC
, "Adspec" },
171 { RSVP_OBJ_POLICY_DATA
, "Policy Data" },
172 { RSVP_OBJ_CONFIRM
, "Confirm" },
173 { RSVP_OBJ_LABEL
, "Label" },
174 { RSVP_OBJ_LABEL_REQ
, "Label Request" },
175 { RSVP_OBJ_ERO
, "ERO" },
176 { RSVP_OBJ_RRO
, "RRO" },
177 { RSVP_OBJ_HELLO
, "Hello" },
178 { RSVP_OBJ_MESSAGE_ID
, "Message ID" },
179 { RSVP_OBJ_MESSAGE_ID_ACK
, "Message ID Ack" },
180 { RSVP_OBJ_MESSAGE_ID_LIST
, "Message ID List" },
181 { RSVP_OBJ_RECOVERY_LABEL
, "Recovery Label" },
182 { RSVP_OBJ_UPSTREAM_LABEL
, "Upstream Label" },
183 { RSVP_OBJ_LABEL_SET
, "Label Set" },
184 { RSVP_OBJ_ACCEPT_LABEL_SET
, "Acceptable Label Set" },
185 { RSVP_OBJ_DETOUR
, "Detour" },
186 { RSVP_OBJ_CLASSTYPE
, "Class Type" },
187 { RSVP_OBJ_CLASSTYPE_OLD
, "Class Type (old)" },
188 { RSVP_OBJ_SUGGESTED_LABEL
, "Suggested Label" },
189 { RSVP_OBJ_PROPERTIES
, "Properties" },
190 { RSVP_OBJ_FASTREROUTE
, "Fast Re-Route" },
191 { RSVP_OBJ_SESSION_ATTRIBUTE
, "Session Attribute" },
192 { RSVP_OBJ_CALL_ID
, "Call-ID" },
193 { RSVP_OBJ_CALL_OPS
, "Call Capability" },
194 { RSVP_OBJ_RESTART_CAPABILITY
, "Restart Capability" },
195 { RSVP_OBJ_NOTIFY_REQ
, "Notify Request" },
196 { RSVP_OBJ_PROTECTION
, "Protection" },
197 { RSVP_OBJ_ADMIN_STATUS
, "Administrative Status" },
201 #define RSVP_CTYPE_IPV4 1
202 #define RSVP_CTYPE_IPV6 2
203 #define RSVP_CTYPE_TUNNEL_IPV4 7
204 #define RSVP_CTYPE_TUNNEL_IPV6 8
205 #define RSVP_CTYPE_1 1
206 #define RSVP_CTYPE_2 2
207 #define RSVP_CTYPE_3 3
208 #define RSVP_CTYPE_4 4
211 * the ctypes are not globally unique so for
212 * translating it to strings we build a table based
213 * on objects offsetted by the ctype
216 static const struct tok rsvp_ctype_values
[] = {
217 { 256*RSVP_OBJ_RSVP_HOP
+RSVP_CTYPE_IPV4
, "IPv4" },
218 { 256*RSVP_OBJ_RSVP_HOP
+RSVP_CTYPE_IPV6
, "IPv6" },
219 { 256*RSVP_OBJ_RSVP_HOP
+RSVP_CTYPE_3
, "IPv4 plus opt. TLVs" },
220 { 256*RSVP_OBJ_RSVP_HOP
+RSVP_CTYPE_4
, "IPv6 plus opt. TLVs" },
221 { 256*RSVP_OBJ_NOTIFY_REQ
+RSVP_CTYPE_IPV4
, "IPv4" },
222 { 256*RSVP_OBJ_NOTIFY_REQ
+RSVP_CTYPE_IPV6
, "IPv6" },
223 { 256*RSVP_OBJ_CONFIRM
+RSVP_CTYPE_IPV4
, "IPv4" },
224 { 256*RSVP_OBJ_CONFIRM
+RSVP_CTYPE_IPV6
, "IPv6" },
225 { 256*RSVP_OBJ_TIME_VALUES
+RSVP_CTYPE_1
, "1" },
226 { 256*RSVP_OBJ_FLOWSPEC
+RSVP_CTYPE_1
, "obsolete" },
227 { 256*RSVP_OBJ_FLOWSPEC
+RSVP_CTYPE_2
, "IntServ" },
228 { 256*RSVP_OBJ_SENDER_TSPEC
+RSVP_CTYPE_2
, "IntServ" },
229 { 256*RSVP_OBJ_ADSPEC
+RSVP_CTYPE_2
, "IntServ" },
230 { 256*RSVP_OBJ_FILTERSPEC
+RSVP_CTYPE_IPV4
, "IPv4" },
231 { 256*RSVP_OBJ_FILTERSPEC
+RSVP_CTYPE_IPV6
, "IPv6" },
232 { 256*RSVP_OBJ_FILTERSPEC
+RSVP_CTYPE_3
, "IPv6 Flow-label" },
233 { 256*RSVP_OBJ_FILTERSPEC
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
234 { 256*RSVP_OBJ_SESSION
+RSVP_CTYPE_IPV4
, "IPv4" },
235 { 256*RSVP_OBJ_SESSION
+RSVP_CTYPE_IPV6
, "IPv6" },
236 { 256*RSVP_OBJ_SESSION
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
237 { 256*RSVP_OBJ_SENDER_TEMPLATE
+RSVP_CTYPE_IPV4
, "IPv4" },
238 { 256*RSVP_OBJ_SENDER_TEMPLATE
+RSVP_CTYPE_IPV6
, "IPv6" },
239 { 256*RSVP_OBJ_SENDER_TEMPLATE
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
240 { 256*RSVP_OBJ_MESSAGE_ID
+RSVP_CTYPE_1
, "1" },
241 { 256*RSVP_OBJ_MESSAGE_ID_ACK
+RSVP_CTYPE_1
, "Message id ack" },
242 { 256*RSVP_OBJ_MESSAGE_ID_ACK
+RSVP_CTYPE_2
, "Message id nack" },
243 { 256*RSVP_OBJ_MESSAGE_ID_LIST
+RSVP_CTYPE_1
, "1" },
244 { 256*RSVP_OBJ_STYLE
+RSVP_CTYPE_1
, "1" },
245 { 256*RSVP_OBJ_HELLO
+RSVP_CTYPE_1
, "Hello Request" },
246 { 256*RSVP_OBJ_HELLO
+RSVP_CTYPE_2
, "Hello Ack" },
247 { 256*RSVP_OBJ_LABEL_REQ
+RSVP_CTYPE_1
, "without label range" },
248 { 256*RSVP_OBJ_LABEL_REQ
+RSVP_CTYPE_2
, "with ATM label range" },
249 { 256*RSVP_OBJ_LABEL_REQ
+RSVP_CTYPE_3
, "with FR label range" },
250 { 256*RSVP_OBJ_LABEL_REQ
+RSVP_CTYPE_4
, "Generalized Label" },
251 { 256*RSVP_OBJ_LABEL
+RSVP_CTYPE_1
, "Label" },
252 { 256*RSVP_OBJ_LABEL
+RSVP_CTYPE_2
, "Generalized Label" },
253 { 256*RSVP_OBJ_LABEL
+RSVP_CTYPE_3
, "Waveband Switching" },
254 { 256*RSVP_OBJ_SUGGESTED_LABEL
+RSVP_CTYPE_1
, "Label" },
255 { 256*RSVP_OBJ_SUGGESTED_LABEL
+RSVP_CTYPE_2
, "Generalized Label" },
256 { 256*RSVP_OBJ_SUGGESTED_LABEL
+RSVP_CTYPE_3
, "Waveband Switching" },
257 { 256*RSVP_OBJ_UPSTREAM_LABEL
+RSVP_CTYPE_1
, "Label" },
258 { 256*RSVP_OBJ_UPSTREAM_LABEL
+RSVP_CTYPE_2
, "Generalized Label" },
259 { 256*RSVP_OBJ_UPSTREAM_LABEL
+RSVP_CTYPE_3
, "Waveband Switching" },
260 { 256*RSVP_OBJ_RECOVERY_LABEL
+RSVP_CTYPE_1
, "Label" },
261 { 256*RSVP_OBJ_RECOVERY_LABEL
+RSVP_CTYPE_2
, "Generalized Label" },
262 { 256*RSVP_OBJ_RECOVERY_LABEL
+RSVP_CTYPE_3
, "Waveband Switching" },
263 { 256*RSVP_OBJ_ERO
+RSVP_CTYPE_IPV4
, "IPv4" },
264 { 256*RSVP_OBJ_RRO
+RSVP_CTYPE_IPV4
, "IPv4" },
265 { 256*RSVP_OBJ_ERROR_SPEC
+RSVP_CTYPE_IPV4
, "IPv4" },
266 { 256*RSVP_OBJ_ERROR_SPEC
+RSVP_CTYPE_IPV6
, "IPv6" },
267 { 256*RSVP_OBJ_ERROR_SPEC
+RSVP_CTYPE_3
, "IPv4 plus opt. TLVs" },
268 { 256*RSVP_OBJ_ERROR_SPEC
+RSVP_CTYPE_4
, "IPv6 plus opt. TLVs" },
269 { 256*RSVP_OBJ_RESTART_CAPABILITY
+RSVP_CTYPE_1
, "IPv4" },
270 { 256*RSVP_OBJ_SESSION_ATTRIBUTE
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
271 { 256*RSVP_OBJ_FASTREROUTE
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" }, /* old style*/
272 { 256*RSVP_OBJ_FASTREROUTE
+RSVP_CTYPE_1
, "1" }, /* new style */
273 { 256*RSVP_OBJ_DETOUR
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
274 { 256*RSVP_OBJ_PROPERTIES
+RSVP_CTYPE_1
, "1" },
275 { 256*RSVP_OBJ_CLASSTYPE
+RSVP_CTYPE_1
, "1" },
276 { 256*RSVP_OBJ_CLASSTYPE_OLD
+RSVP_CTYPE_1
, "1" },
280 struct rsvp_obj_integrity_t
{
284 u_int8_t sequence
[8];
288 static const struct tok rsvp_obj_integrity_flag_values
[] = {
289 { 0x80, "Handshake" },
293 struct rsvp_obj_frr_t
{
298 u_int8_t bandwidth
[4];
299 u_int8_t include_any
[4];
300 u_int8_t exclude_any
[4];
301 u_int8_t include_all
[4];
305 #define RSVP_OBJ_XRO_MASK_SUBOBJ(x) ((x)&0x7f)
306 #define RSVP_OBJ_XRO_MASK_LOOSE(x) ((x)&0x80)
308 #define RSVP_OBJ_XRO_RES 0
309 #define RSVP_OBJ_XRO_IPV4 1
310 #define RSVP_OBJ_XRO_IPV6 2
311 #define RSVP_OBJ_XRO_ASN 32
312 #define RSVP_OBJ_XRO_MPLS 64
314 static const struct tok rsvp_obj_xro_values
[] = {
315 { RSVP_OBJ_XRO_RES
, "Reserved" },
316 { RSVP_OBJ_XRO_IPV4
, "IPv4 prefix" },
317 { RSVP_OBJ_XRO_IPV6
, "IPv6 prefix" },
318 { RSVP_OBJ_XRO_ASN
, "Autonomous system number" },
319 { RSVP_OBJ_XRO_MPLS
, "MPLS label switched path termination" },
323 /* draft-ietf-mpls-rsvp-lsp-fastreroute-07.txt */
324 static const struct tok rsvp_obj_rro_flag_values
[] = {
325 { 0x01, "Local protection available" },
326 { 0x02, "Local protection in use" },
327 { 0x04, "Bandwidth protection" },
328 { 0x08, "Node protection" },
332 static const struct tok rsvp_resstyle_values
[] = {
333 { 17, "Wildcard Filter" },
334 { 10, "Fixed Filter" },
335 { 18, "Shared Explicit" },
339 #define RSVP_OBJ_INTSERV_GUARANTEED_SERV 2
340 #define RSVP_OBJ_INTSERV_CONTROLLED_LOAD 5
342 static const struct tok rsvp_intserv_service_type_values
[] = {
343 { 1, "Default/Global Information" },
344 { RSVP_OBJ_INTSERV_GUARANTEED_SERV
, "Guaranteed Service" },
345 { RSVP_OBJ_INTSERV_CONTROLLED_LOAD
, "Controlled Load" },
349 static const struct tok rsvp_intserv_parameter_id_values
[] = {
351 { 6, "Path b/w estimate" },
352 { 8, "Minimum path latency" },
353 { 10, "Composed MTU" },
354 { 127, "Token Bucket TSpec" },
355 { 130, "Guaranteed Service RSpec" },
356 { 133, "End-to-end composed value for C" },
357 { 134, "End-to-end composed value for D" },
358 { 135, "Since-last-reshaping point composed C" },
359 { 136, "Since-last-reshaping point composed D" },
363 static struct tok rsvp_session_attribute_flag_values
[] = {
364 { 0x01, "Local Protection desired" },
365 { 0x02, "Label Recording desired" },
366 { 0x04, "SE Style desired" },
367 { 0x08, "Bandwidth protection desired" }, /* draft-ietf-mpls-rsvp-lsp-fastreroute-02.txt */
368 { 0x10, "Node protection desired" }, /* draft-ietf-mpls-rsvp-lsp-fastreroute-02.txt */
372 static struct tok rsvp_obj_prop_tlv_values
[] = {
374 { 0x02, "Metric 1" },
375 { 0x04, "Metric 2" },
376 { 0x08, "CCC Status" },
377 { 0x10, "Path Type" },
381 #define RSVP_OBJ_ERROR_SPEC_CODE_ROUTING 24
382 #define RSVP_OBJ_ERROR_SPEC_CODE_NOTIFY 25
383 #define RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE 28
384 #define RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE_OLD 125
386 static struct tok rsvp_obj_error_code_values
[] = {
387 { RSVP_OBJ_ERROR_SPEC_CODE_ROUTING
, "Routing Problem" },
388 { RSVP_OBJ_ERROR_SPEC_CODE_NOTIFY
, "Notify Error" },
389 { RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE
, "Diffserv TE Error" },
390 { RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE_OLD
, "Diffserv TE Error (Old)" },
394 static struct tok rsvp_obj_error_code_routing_values
[] = {
395 { 1, "Bad EXPLICIT_ROUTE object" },
396 { 2, "Bad strict node" },
397 { 3, "Bad loose node" },
398 { 4, "Bad initial subobject" },
399 { 5, "No route available toward destination" },
400 { 6, "Unacceptable label value" },
401 { 7, "RRO indicated routing loops" },
402 { 8, "non-RSVP-capable router in the path" },
403 { 9, "MPLS label allocation failure" },
404 { 10, "Unsupported L3PID" },
408 static struct tok rsvp_obj_error_code_diffserv_te_values
[] = {
409 { 1, "Unexpected CT object" },
410 { 2, "Unsupported CT" },
411 { 3, "Invalid CT value" },
412 { 4, "CT/setup priority do not form a configured TE-Class" },
413 { 5, "CT/holding priority do not form a configured TE-Class" },
414 { 6, "CT/setup priority and CT/holding priority do not form a configured TE-Class" },
415 { 7, "Inconsistency between signaled PSC and signaled CT" },
416 { 8, "Inconsistency between signaled PHBs and signaled CT" },
420 static int rsvp_intserv_print(const u_char
*, u_short
);
423 * this is a dissector for all the intserv defined
424 * specs as defined per rfc2215
425 * it is called from various rsvp objects;
426 * returns the amount of bytes being processed
429 rsvp_intserv_print(const u_char
*tptr
, u_short obj_tlen
) {
431 int parameter_id
,parameter_length
;
439 parameter_id
= *(tptr
);
440 parameter_length
= EXTRACT_16BITS(tptr
+2)<<2; /* convert wordcount to bytecount */
442 printf("\n\t Parameter ID: %s (%u), length: %u, Flags: [0x%02x]",
443 tok2str(rsvp_intserv_parameter_id_values
,"unknown",parameter_id
),
448 if (obj_tlen
< parameter_length
+4)
450 switch(parameter_id
) { /* parameter_id */
454 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
455 * | 4 (e) | (f) | 1 (g) |
456 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
457 * | IS hop cnt (32-bit unsigned integer) |
458 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
460 if (parameter_length
== 4)
461 printf("\n\t\tIS hop count: %u", EXTRACT_32BITS(tptr
+4));
466 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
467 * | 6 (h) | (i) | 1 (j) |
468 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
469 * | Path b/w estimate (32-bit IEEE floating point number) |
470 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
472 if (parameter_length
== 4) {
473 bw
.i
= EXTRACT_32BITS(tptr
+4);
474 printf("\n\t\tPath b/w estimate: %.10g Mbps", bw
.f
/125000);
480 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
481 * | 8 (k) | (l) | 1 (m) |
482 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
483 * | Minimum path latency (32-bit integer) |
484 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
486 if (parameter_length
== 4) {
487 printf("\n\t\tMinimum path latency: ");
488 if (EXTRACT_32BITS(tptr
+4) == 0xffffffff)
489 printf("don't care");
491 printf("%u", EXTRACT_32BITS(tptr
+4));
498 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
499 * | 10 (n) | (o) | 1 (p) |
500 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
501 * | Composed MTU (32-bit unsigned integer) |
502 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
504 if (parameter_length
== 4)
505 printf("\n\t\tComposed MTU: %u bytes", EXTRACT_32BITS(tptr
+4));
509 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
510 * | 127 (e) | 0 (f) | 5 (g) |
511 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
512 * | Token Bucket Rate [r] (32-bit IEEE floating point number) |
513 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
514 * | Token Bucket Size [b] (32-bit IEEE floating point number) |
515 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
516 * | Peak Data Rate [p] (32-bit IEEE floating point number) |
517 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
518 * | Minimum Policed Unit [m] (32-bit integer) |
519 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
520 * | Maximum Packet Size [M] (32-bit integer) |
521 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
524 if (parameter_length
== 20) {
525 bw
.i
= EXTRACT_32BITS(tptr
+4);
526 printf("\n\t\tToken Bucket Rate: %.10g Mbps", bw
.f
/125000);
527 bw
.i
= EXTRACT_32BITS(tptr
+8);
528 printf("\n\t\tToken Bucket Size: %.10g bytes", bw
.f
);
529 bw
.i
= EXTRACT_32BITS(tptr
+12);
530 printf("\n\t\tPeak Data Rate: %.10g Mbps", bw
.f
/125000);
531 printf("\n\t\tMinimum Policed Unit: %u bytes", EXTRACT_32BITS(tptr
+16));
532 printf("\n\t\tMaximum Packet Size: %u bytes", EXTRACT_32BITS(tptr
+20));
538 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
539 * | 130 (h) | 0 (i) | 2 (j) |
540 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
541 * | Rate [R] (32-bit IEEE floating point number) |
542 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
543 * | Slack Term [S] (32-bit integer) |
544 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
547 if (parameter_length
== 8) {
548 bw
.i
= EXTRACT_32BITS(tptr
+4);
549 printf("\n\t\tRate: %.10g Mbps", bw
.f
/125000);
550 printf("\n\t\tSlack Term: %u", EXTRACT_32BITS(tptr
+8));
558 if (parameter_length
== 4)
559 printf("\n\t\tValue: %u", EXTRACT_32BITS(tptr
+4));
564 print_unknown_data(tptr
+4,"\n\t\t",parameter_length
);
566 return (parameter_length
+4); /* header length 4 bytes */
570 rsvp_obj_print (const u_char
*tptr
, const char *ident
, u_int tlen
) {
572 const struct rsvp_object_header
*rsvp_obj_header
;
573 const u_char
*obj_tptr
;
575 const struct rsvp_obj_integrity_t
*rsvp_obj_integrity
;
576 const struct rsvp_obj_frr_t
*rsvp_obj_frr
;
579 u_short rsvp_obj_len
,rsvp_obj_ctype
,obj_tlen
,intserv_serv_tlen
;
580 int hexdump
,processed
,padbytes
,error_code
,error_value
,i
;
587 while(tlen
>=sizeof(struct rsvp_object_header
)) {
588 /* did we capture enough for fully decoding the object header ? */
589 if (!TTEST2(*tptr
, sizeof(struct rsvp_object_header
)))
592 rsvp_obj_header
= (const struct rsvp_object_header
*)tptr
;
593 rsvp_obj_len
=EXTRACT_16BITS(rsvp_obj_header
->length
);
594 rsvp_obj_ctype
=rsvp_obj_header
->ctype
;
596 if(rsvp_obj_len
% 4) {
597 printf("%sERROR: object header size %u not a multiple of 4", ident
, rsvp_obj_len
);
600 if(rsvp_obj_len
< sizeof(struct rsvp_object_header
)) {
601 printf("%sERROR: object header too short %u < %lu", ident
, rsvp_obj_len
,
602 (unsigned long)sizeof(const struct rsvp_object_header
));
606 printf("%s%s Object (%u) Flags: [%s",
608 tok2str(rsvp_obj_values
,
610 rsvp_obj_header
->class_num
),
611 rsvp_obj_header
->class_num
,
612 ((rsvp_obj_header
->class_num
)&0x80) ? "ignore" : "reject");
614 if (rsvp_obj_header
->class_num
> 128)
616 ((rsvp_obj_header
->class_num
)&0x40) ? "and forward" : "silently");
618 printf(" if unknown], Class-Type: %s (%u), length: %u",
619 tok2str(rsvp_ctype_values
,
621 ((rsvp_obj_header
->class_num
)<<8)+rsvp_obj_ctype
),
625 if(tlen
< rsvp_obj_len
) {
626 printf("%sERROR: object goes past end of objects TLV", ident
);
630 obj_tptr
=tptr
+sizeof(struct rsvp_object_header
);
631 obj_tlen
=rsvp_obj_len
-sizeof(struct rsvp_object_header
);
633 /* did we capture enough for fully decoding the object ? */
634 if (!TTEST2(*tptr
, rsvp_obj_len
))
638 switch(rsvp_obj_header
->class_num
) {
639 case RSVP_OBJ_SESSION
:
640 switch(rsvp_obj_ctype
) {
641 case RSVP_CTYPE_IPV4
:
644 printf("%s IPv4 DestAddress: %s, Protocol ID: 0x%02x",
646 ipaddr_string(obj_tptr
),
647 *(obj_tptr
+sizeof(struct in_addr
)));
648 printf("%s Flags: [0x%02x], DestPort %u",
651 EXTRACT_16BITS(obj_tptr
+6));
656 case RSVP_CTYPE_IPV6
:
659 printf("%s IPv6 DestAddress: %s, Protocol ID: 0x%02x",
661 ip6addr_string(obj_tptr
),
662 *(obj_tptr
+sizeof(struct in6_addr
)));
663 printf("%s Flags: [0x%02x], DestPort %u",
665 *(obj_tptr
+sizeof(struct in6_addr
)+1),
666 EXTRACT_16BITS(obj_tptr
+sizeof(struct in6_addr
)+2));
671 case RSVP_CTYPE_TUNNEL_IPV6
:
674 printf("%s IPv6 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
676 ip6addr_string(obj_tptr
),
677 EXTRACT_16BITS(obj_tptr
+18),
678 ip6addr_string(obj_tptr
+20));
683 case RSVP_CTYPE_TUNNEL_IPV4
:
686 printf("%s IPv4 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
688 ipaddr_string(obj_tptr
),
689 EXTRACT_16BITS(obj_tptr
+6),
690 ipaddr_string(obj_tptr
+8));
699 case RSVP_OBJ_CONFIRM
:
700 switch(rsvp_obj_ctype
) {
701 case RSVP_CTYPE_IPV4
:
702 if (obj_tlen
< sizeof(struct in_addr
))
704 printf("%s IPv4 Receiver Address: %s",
706 ipaddr_string(obj_tptr
));
707 obj_tlen
-=sizeof(struct in_addr
);
708 obj_tptr
+=sizeof(struct in_addr
);
711 case RSVP_CTYPE_IPV6
:
712 if (obj_tlen
< sizeof(struct in6_addr
))
714 printf("%s IPv6 Receiver Address: %s",
716 ip6addr_string(obj_tptr
));
717 obj_tlen
-=sizeof(struct in6_addr
);
718 obj_tptr
+=sizeof(struct in6_addr
);
726 case RSVP_OBJ_NOTIFY_REQ
:
727 switch(rsvp_obj_ctype
) {
728 case RSVP_CTYPE_IPV4
:
729 if (obj_tlen
< sizeof(struct in_addr
))
731 printf("%s IPv4 Notify Node Address: %s",
733 ipaddr_string(obj_tptr
));
734 obj_tlen
-=sizeof(struct in_addr
);
735 obj_tptr
+=sizeof(struct in_addr
);
738 case RSVP_CTYPE_IPV6
:
739 if (obj_tlen
< sizeof(struct in6_addr
))
741 printf("%s IPv6 Notify Node Address: %s",
743 ip6addr_string(obj_tptr
));
744 obj_tlen
-=sizeof(struct in6_addr
);
745 obj_tptr
+=sizeof(struct in6_addr
);
753 case RSVP_OBJ_SUGGESTED_LABEL
: /* fall through */
754 case RSVP_OBJ_UPSTREAM_LABEL
: /* fall through */
755 case RSVP_OBJ_RECOVERY_LABEL
: /* fall through */
757 switch(rsvp_obj_ctype
) {
759 while(obj_tlen
>= 4 ) {
760 printf("%s Label: %u", ident
, EXTRACT_32BITS(obj_tptr
));
768 printf("%s Generalized Label: %u",
770 EXTRACT_32BITS(obj_tptr
));
777 printf("%s Waveband ID: %u%s Start Label: %u, Stop Label: %u",
779 EXTRACT_32BITS(obj_tptr
),
781 EXTRACT_32BITS(obj_tptr
+4),
782 EXTRACT_32BITS(obj_tptr
+8));
792 switch(rsvp_obj_ctype
) {
796 printf("%s Reservation Style: %s, Flags: [0x%02x]",
798 tok2str(rsvp_resstyle_values
,
800 EXTRACT_24BITS(obj_tptr
+1)),
810 case RSVP_OBJ_SENDER_TEMPLATE
:
811 switch(rsvp_obj_ctype
) {
812 case RSVP_CTYPE_IPV4
:
815 printf("%s Source Address: %s, Source Port: %u",
817 ipaddr_string(obj_tptr
),
818 EXTRACT_16BITS(obj_tptr
+6));
823 case RSVP_CTYPE_IPV6
:
826 printf("%s Source Address: %s, Source Port: %u",
828 ip6addr_string(obj_tptr
),
829 EXTRACT_16BITS(obj_tptr
+18));
834 case RSVP_CTYPE_TUNNEL_IPV4
:
837 printf("%s IPv4 Tunnel Sender Address: %s, LSP-ID: 0x%04x",
839 ipaddr_string(obj_tptr
),
840 EXTRACT_16BITS(obj_tptr
+6));
849 case RSVP_OBJ_LABEL_REQ
:
850 switch(rsvp_obj_ctype
) {
852 while(obj_tlen
>= 4 ) {
853 printf("%s L3 Protocol ID: %s",
855 tok2str(ethertype_values
,
856 "Unknown Protocol (0x%04x)",
857 EXTRACT_16BITS(obj_tptr
+2)));
865 printf("%s L3 Protocol ID: %s",
867 tok2str(ethertype_values
,
868 "Unknown Protocol (0x%04x)",
869 EXTRACT_16BITS(obj_tptr
+2)));
870 printf(",%s merge capability",((*(obj_tptr
+4))&0x80) ? "no" : "" );
871 printf("%s Minimum VPI/VCI: %u/%u",
873 (EXTRACT_16BITS(obj_tptr
+4))&0xfff,
874 (EXTRACT_16BITS(obj_tptr
+6))&0xfff);
875 printf("%s Maximum VPI/VCI: %u/%u",
877 (EXTRACT_16BITS(obj_tptr
+8))&0xfff,
878 (EXTRACT_16BITS(obj_tptr
+10))&0xfff);
885 printf("%s L3 Protocol ID: %s",
887 tok2str(ethertype_values
,
888 "Unknown Protocol (0x%04x)",
889 EXTRACT_16BITS(obj_tptr
+2)));
890 printf("%s Minimum/Maximum DLCI: %u/%u, %s%s bit DLCI",
892 (EXTRACT_32BITS(obj_tptr
+4))&0x7fffff,
893 (EXTRACT_32BITS(obj_tptr
+8))&0x7fffff,
894 (((EXTRACT_16BITS(obj_tptr
+4)>>7)&3) == 0 ) ? "10" : "",
895 (((EXTRACT_16BITS(obj_tptr
+4)>>7)&3) == 2 ) ? "23" : "");
902 printf("%s LSP Encoding Type: %s (%u)",
904 tok2str(gmpls_encoding_values
,
908 printf("%s Switching Type: %s (%u), Payload ID: %s (0x%04x)",
910 tok2str(gmpls_switch_cap_values
,
914 tok2str(gmpls_payload_values
,
916 EXTRACT_16BITS(obj_tptr
+2)),
917 EXTRACT_16BITS(obj_tptr
+2));
928 switch(rsvp_obj_ctype
) {
929 case RSVP_CTYPE_IPV4
:
930 while(obj_tlen
>= 4 ) {
931 printf("%s Subobject Type: %s, length %u",
933 tok2str(rsvp_obj_xro_values
,
935 RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr
)),
938 if (*(obj_tptr
+1) == 0) { /* prevent infinite loops */
939 printf("%s ERROR: zero length ERO subtype",ident
);
943 switch(RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr
)) {
944 case RSVP_OBJ_XRO_IPV4
:
945 printf(", %s, %s/%u, Flags: [%s]",
946 RSVP_OBJ_XRO_MASK_LOOSE(*obj_tptr
) ? "Loose" : "Strict",
947 ipaddr_string(obj_tptr
+2),
949 bittok2str(rsvp_obj_rro_flag_values
,
951 *(obj_tptr
+7))); /* rfc3209 says that this field is rsvd. */
953 obj_tlen
-=*(obj_tptr
+1);
954 obj_tptr
+=*(obj_tptr
+1);
963 switch(rsvp_obj_ctype
) {
968 printf("%s Source Instance: 0x%08x, Destination Instance: 0x%08x",
970 EXTRACT_32BITS(obj_tptr
),
971 EXTRACT_32BITS(obj_tptr
+4));
980 case RSVP_OBJ_RESTART_CAPABILITY
:
981 switch(rsvp_obj_ctype
) {
985 printf("%s Restart Time: %ums, Recovery Time: %ums",
987 EXTRACT_32BITS(obj_tptr
),
988 EXTRACT_32BITS(obj_tptr
+4));
997 case RSVP_OBJ_SESSION_ATTRIBUTE
:
998 switch(rsvp_obj_ctype
) {
999 case RSVP_CTYPE_TUNNEL_IPV4
:
1002 namelen
= *(obj_tptr
+3);
1003 if (obj_tlen
< 4+namelen
)
1005 printf("%s Session Name: ", ident
);
1006 for (i
= 0; i
< namelen
; i
++)
1007 safeputchar(*(obj_tptr
+4+i
));
1008 printf("%s Setup Priority: %u, Holding Priority: %u, Flags: [%s]",
1012 tok2str(rsvp_session_attribute_flag_values
,
1016 obj_tlen
-=4+*(obj_tptr
+3);
1017 obj_tptr
+=4+*(obj_tptr
+3);
1024 case RSVP_OBJ_RSVP_HOP
:
1025 switch(rsvp_obj_ctype
) {
1026 case RSVP_CTYPE_3
: /* fall through - FIXME add TLV parser */
1027 case RSVP_CTYPE_IPV4
:
1030 printf("%s Previous/Next Interface: %s, Logical Interface Handle: 0x%08x",
1032 ipaddr_string(obj_tptr
),
1033 EXTRACT_32BITS(obj_tptr
+4));
1037 hexdump
=TRUE
; /* unless we have a TLV parser lets just hexdump */
1040 case RSVP_CTYPE_4
: /* fall through - FIXME add TLV parser */
1041 case RSVP_CTYPE_IPV6
:
1044 printf("%s Previous/Next Interface: %s, Logical Interface Handle: 0x%08x",
1046 ip6addr_string(obj_tptr
),
1047 EXTRACT_32BITS(obj_tptr
+16));
1050 hexdump
=TRUE
; /* unless we have a TLV parser lets just hexdump */
1058 case RSVP_OBJ_TIME_VALUES
:
1059 switch(rsvp_obj_ctype
) {
1063 printf("%s Refresh Period: %ums",
1065 EXTRACT_32BITS(obj_tptr
));
1074 /* those three objects do share the same semantics */
1075 case RSVP_OBJ_SENDER_TSPEC
:
1076 case RSVP_OBJ_ADSPEC
:
1077 case RSVP_OBJ_FLOWSPEC
:
1078 switch(rsvp_obj_ctype
) {
1082 printf("%s Msg-Version: %u, length: %u",
1084 (*obj_tptr
& 0xf0) >> 4,
1085 EXTRACT_16BITS(obj_tptr
+2)<<2);
1086 obj_tptr
+=4; /* get to the start of the service header */
1089 while (obj_tlen
>= 4) {
1090 intserv_serv_tlen
=EXTRACT_16BITS(obj_tptr
+2)<<2;
1091 printf("%s Service Type: %s (%u), break bit %s set, Service length: %u",
1093 tok2str(rsvp_intserv_service_type_values
,"unknown",*(obj_tptr
)),
1095 (*(obj_tptr
+1)&0x80) ? "" : "not",
1098 obj_tptr
+=4; /* get to the start of the parameter list */
1101 while (intserv_serv_tlen
>=4) {
1102 processed
= rsvp_intserv_print(obj_tptr
, obj_tlen
);
1105 obj_tlen
-=processed
;
1106 intserv_serv_tlen
-=processed
;
1107 obj_tptr
+=processed
;
1116 case RSVP_OBJ_FILTERSPEC
:
1117 switch(rsvp_obj_ctype
) {
1118 case RSVP_CTYPE_IPV4
:
1121 printf("%s Source Address: %s, Source Port: %u",
1123 ipaddr_string(obj_tptr
),
1124 EXTRACT_16BITS(obj_tptr
+6));
1129 case RSVP_CTYPE_IPV6
:
1132 printf("%s Source Address: %s, Source Port: %u",
1134 ip6addr_string(obj_tptr
),
1135 EXTRACT_16BITS(obj_tptr
+18));
1142 printf("%s Source Address: %s, Flow Label: %u",
1144 ip6addr_string(obj_tptr
),
1145 EXTRACT_24BITS(obj_tptr
+17));
1149 case RSVP_CTYPE_TUNNEL_IPV6
:
1152 printf("%s Source Address: %s, LSP-ID: 0x%04x",
1154 ipaddr_string(obj_tptr
),
1155 EXTRACT_16BITS(obj_tptr
+18));
1160 case RSVP_CTYPE_TUNNEL_IPV4
:
1163 printf("%s Source Address: %s, LSP-ID: 0x%04x",
1165 ipaddr_string(obj_tptr
),
1166 EXTRACT_16BITS(obj_tptr
+6));
1175 case RSVP_OBJ_FASTREROUTE
:
1176 /* the differences between c-type 1 and 7 are minor */
1177 obj_ptr
.rsvp_obj_frr
= (const struct rsvp_obj_frr_t
*)obj_tptr
;
1178 bw
.i
= EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->bandwidth
);
1180 switch(rsvp_obj_ctype
) {
1181 case RSVP_CTYPE_1
: /* new style */
1182 if (obj_tlen
< sizeof(struct rsvp_obj_frr_t
))
1184 printf("%s Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps",
1186 (int)obj_ptr
.rsvp_obj_frr
->setup_prio
,
1187 (int)obj_ptr
.rsvp_obj_frr
->hold_prio
,
1188 (int)obj_ptr
.rsvp_obj_frr
->hop_limit
,
1190 printf("%s Include-any: 0x%08x, Exclude-any: 0x%08x, Include-all: 0x%08x",
1192 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->include_any
),
1193 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->exclude_any
),
1194 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->include_all
));
1195 obj_tlen
-=sizeof(struct rsvp_obj_frr_t
);
1196 obj_tptr
+=sizeof(struct rsvp_obj_frr_t
);
1199 case RSVP_CTYPE_TUNNEL_IPV4
: /* old style */
1202 printf("%s Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps",
1204 (int)obj_ptr
.rsvp_obj_frr
->setup_prio
,
1205 (int)obj_ptr
.rsvp_obj_frr
->hold_prio
,
1206 (int)obj_ptr
.rsvp_obj_frr
->hop_limit
,
1208 printf("%s Include Colors: 0x%08x, Exclude Colors: 0x%08x",
1210 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->include_any
),
1211 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->exclude_any
));
1221 case RSVP_OBJ_DETOUR
:
1222 switch(rsvp_obj_ctype
) {
1223 case RSVP_CTYPE_TUNNEL_IPV4
:
1224 while(obj_tlen
>= 8) {
1225 printf("%s PLR-ID: %s, Avoid-Node-ID: %s",
1227 ipaddr_string(obj_tptr
),
1228 ipaddr_string(obj_tptr
+4));
1238 case RSVP_OBJ_CLASSTYPE
:
1239 case RSVP_OBJ_CLASSTYPE_OLD
: /* fall through */
1240 switch(rsvp_obj_ctype
) {
1244 EXTRACT_32BITS(obj_tptr
)&0x7);
1253 case RSVP_OBJ_ERROR_SPEC
:
1254 switch(rsvp_obj_ctype
) {
1255 case RSVP_CTYPE_3
: /* fall through - FIXME add TLV parser */
1256 case RSVP_CTYPE_IPV4
:
1259 error_code
=*(obj_tptr
+5);
1260 error_value
=EXTRACT_16BITS(obj_tptr
+6);
1261 printf("%s Error Node Address: %s, Flags: [0x%02x]%s Error Code: %s (%u)",
1263 ipaddr_string(obj_tptr
),
1266 tok2str(rsvp_obj_error_code_values
,"unknown",error_code
),
1268 switch (error_code
) {
1269 case RSVP_OBJ_ERROR_SPEC_CODE_ROUTING
:
1270 printf(", Error Value: %s (%u)",
1271 tok2str(rsvp_obj_error_code_routing_values
,"unknown",error_value
),
1274 case RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE
: /* fall through */
1275 case RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE_OLD
:
1276 printf(", Error Value: %s (%u)",
1277 tok2str(rsvp_obj_error_code_diffserv_te_values
,"unknown",error_value
),
1281 printf(", Unknown Error Value (%u)", error_value
);
1288 case RSVP_CTYPE_4
: /* fall through - FIXME add TLV parser */
1289 case RSVP_CTYPE_IPV6
:
1292 error_code
=*(obj_tptr
+17);
1293 error_value
=EXTRACT_16BITS(obj_tptr
+18);
1294 printf("%s Error Node Address: %s, Flags: [0x%02x]%s Error Code: %s (%u)",
1296 ip6addr_string(obj_tptr
),
1299 tok2str(rsvp_obj_error_code_values
,"unknown",error_code
),
1302 switch (error_code
) {
1303 case RSVP_OBJ_ERROR_SPEC_CODE_ROUTING
:
1304 printf(", Error Value: %s (%u)",
1305 tok2str(rsvp_obj_error_code_routing_values
,"unknown",error_value
),
1320 case RSVP_OBJ_PROPERTIES
:
1321 switch(rsvp_obj_ctype
) {
1325 padbytes
= EXTRACT_16BITS(obj_tptr
+2);
1326 printf("%s TLV count: %u, padding bytes: %u",
1328 EXTRACT_16BITS(obj_tptr
),
1332 /* loop through as long there is anything longer than the TLV header (2) */
1333 while(obj_tlen
>= 2 + padbytes
) {
1334 printf("%s %s TLV (0x%02x), length: %u", /* length includes header */
1336 tok2str(rsvp_obj_prop_tlv_values
,"unknown",*obj_tptr
),
1339 if (obj_tlen
< *(obj_tptr
+1))
1341 if (*(obj_tptr
+1) < 2)
1343 print_unknown_data(obj_tptr
+2,"\n\t\t",*(obj_tptr
+1)-2);
1344 obj_tlen
-=*(obj_tptr
+1);
1345 obj_tptr
+=*(obj_tptr
+1);
1353 case RSVP_OBJ_MESSAGE_ID
: /* fall through */
1354 case RSVP_OBJ_MESSAGE_ID_ACK
: /* fall through */
1355 case RSVP_OBJ_MESSAGE_ID_LIST
:
1356 switch(rsvp_obj_ctype
) {
1361 printf("%s Flags [0x%02x], epoch: %u",
1364 EXTRACT_24BITS(obj_tptr
+1));
1367 /* loop through as long there are no messages left */
1368 while(obj_tlen
>= 4) {
1369 printf("%s Message-ID 0x%08x (%u)",
1371 EXTRACT_32BITS(obj_tptr
),
1372 EXTRACT_32BITS(obj_tptr
));
1382 case RSVP_OBJ_INTEGRITY
:
1383 switch(rsvp_obj_ctype
) {
1385 if (obj_tlen
< sizeof(struct rsvp_obj_integrity_t
))
1387 obj_ptr
.rsvp_obj_integrity
= (const struct rsvp_obj_integrity_t
*)obj_tptr
;
1388 printf("%s Key-ID 0x%04x%08x, Sequence 0x%08x%08x, Flags [%s]",
1390 EXTRACT_16BITS(obj_ptr
.rsvp_obj_integrity
->key_id
),
1391 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->key_id
+2),
1392 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->sequence
),
1393 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->sequence
+4),
1394 bittok2str(rsvp_obj_integrity_flag_values
,
1396 obj_ptr
.rsvp_obj_integrity
->flags
));
1397 printf("%s MD5-sum 0x%08x%08x%08x%08x (unverified)",
1399 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->digest
),
1400 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->digest
+4),
1401 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->digest
+8),
1402 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->digest
+12));
1403 obj_tlen
+=sizeof(struct rsvp_obj_integrity_t
);
1404 obj_tptr
+=sizeof(struct rsvp_obj_integrity_t
);
1412 * FIXME those are the defined objects that lack a decoder
1413 * you are welcome to contribute code ;-)
1416 case RSVP_OBJ_SCOPE
:
1417 case RSVP_OBJ_POLICY_DATA
:
1418 case RSVP_OBJ_LABEL_SET
:
1419 case RSVP_OBJ_ACCEPT_LABEL_SET
:
1420 case RSVP_OBJ_PROTECTION
:
1423 print_unknown_data(obj_tptr
,"\n\t ",obj_tlen
); /* FIXME indentation */
1426 /* do we also want to see a hex dump ? */
1427 if (vflag
> 1 || hexdump
==TRUE
)
1428 print_unknown_data(tptr
+sizeof(sizeof(struct rsvp_object_header
)),"\n\t ", /* FIXME indentation */
1429 rsvp_obj_len
-sizeof(struct rsvp_object_header
));
1436 printf("\n\t\t packet exceeded snapshot");
1442 rsvp_print(register const u_char
*pptr
, register u_int len
) {
1444 const struct rsvp_common_header
*rsvp_com_header
;
1445 const u_char
*tptr
,*subtptr
;
1446 u_short tlen
,subtlen
;
1450 rsvp_com_header
= (const struct rsvp_common_header
*)pptr
;
1451 TCHECK(*rsvp_com_header
);
1454 * Sanity checking of the header.
1456 if (RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
) != RSVP_VERSION
) {
1457 printf("ERROR: RSVP version %u packet not supported",
1458 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
));
1462 /* in non-verbose mode just lets print the basic Message Type*/
1464 printf("RSVPv%u %s Message, length: %u",
1465 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
),
1466 tok2str(rsvp_msg_type_values
, "unknown (%u)",rsvp_com_header
->msg_type
),
1471 /* ok they seem to want to know everything - lets fully decode it */
1473 tlen
=EXTRACT_16BITS(rsvp_com_header
->length
);
1475 printf("\n\tRSVPv%u %s Message (%u), Flags: [%s], length: %u, ttl: %u, checksum: 0x%04x",
1476 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
),
1477 tok2str(rsvp_msg_type_values
, "unknown, type: %u",rsvp_com_header
->msg_type
),
1478 rsvp_com_header
->msg_type
,
1479 bittok2str(rsvp_header_flag_values
,"none",RSVP_EXTRACT_FLAGS(rsvp_com_header
->version_flags
)),
1481 rsvp_com_header
->ttl
,
1482 EXTRACT_16BITS(rsvp_com_header
->checksum
));
1484 if (tlen
< sizeof(const struct rsvp_common_header
)) {
1485 printf("ERROR: common header too short %u < %lu", tlen
,
1486 (unsigned long)sizeof(const struct rsvp_common_header
));
1490 tptr
+=sizeof(const struct rsvp_common_header
);
1491 tlen
-=sizeof(const struct rsvp_common_header
);
1493 switch(rsvp_com_header
->msg_type
) {
1495 case RSVP_MSGTYPE_AGGREGATE
:
1498 rsvp_com_header
= (const struct rsvp_common_header
*)subtptr
;
1499 TCHECK(*rsvp_com_header
);
1502 * Sanity checking of the header.
1504 if (RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
) != RSVP_VERSION
) {
1505 printf("ERROR: RSVP version %u packet not supported",
1506 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
));
1509 subtlen
=EXTRACT_16BITS(rsvp_com_header
->length
);
1511 printf("\n\t RSVPv%u %s Message (%u), Flags: [%s], length: %u, ttl: %u, checksum: 0x%04x",
1512 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
),
1513 tok2str(rsvp_msg_type_values
, "unknown, type: %u",rsvp_com_header
->msg_type
),
1514 rsvp_com_header
->msg_type
,
1515 bittok2str(rsvp_header_flag_values
,"none",RSVP_EXTRACT_FLAGS(rsvp_com_header
->version_flags
)),
1517 rsvp_com_header
->ttl
,
1518 EXTRACT_16BITS(rsvp_com_header
->checksum
));
1520 if (subtlen
< sizeof(const struct rsvp_common_header
)) {
1521 printf("ERROR: common header too short %u < %lu", subtlen
,
1522 (unsigned long)sizeof(const struct rsvp_common_header
));
1526 if (tlen
< subtlen
) {
1527 printf("ERROR: common header too large %u > %u", subtlen
,
1532 subtptr
+=sizeof(const struct rsvp_common_header
);
1533 subtlen
-=sizeof(const struct rsvp_common_header
);
1535 if (rsvp_obj_print(subtptr
,"\n\t ", subtlen
) == -1)
1538 tptr
+=subtlen
+sizeof(const struct rsvp_common_header
);
1539 tlen
-=subtlen
+sizeof(const struct rsvp_common_header
);
1544 case RSVP_MSGTYPE_PATH
:
1545 case RSVP_MSGTYPE_RESV
:
1546 case RSVP_MSGTYPE_PATHERR
:
1547 case RSVP_MSGTYPE_RESVERR
:
1548 case RSVP_MSGTYPE_PATHTEAR
:
1549 case RSVP_MSGTYPE_RESVTEAR
:
1550 case RSVP_MSGTYPE_RESVCONF
:
1551 case RSVP_MSGTYPE_HELLO_OLD
:
1552 case RSVP_MSGTYPE_HELLO
:
1553 case RSVP_MSGTYPE_ACK
:
1554 case RSVP_MSGTYPE_SREFRESH
:
1555 if (rsvp_obj_print(tptr
,"\n\t ", tlen
) == -1)
1560 print_unknown_data(tptr
,"\n\t ",tlen
);
1566 printf("\n\t\t packet exceeded snapshot");