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.38 2005-08-01 09:10:23 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
138 #define RSVP_OBJ_MESSAGE_ID_ACK 24
139 #define RSVP_OBJ_MESSAGE_ID_LIST 25
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 125 /* draft-ietf-tewg-diff-te-proto-07 */
146 #define RSVP_OBJ_SUGGESTED_LABEL 129 /* rfc3473 */
147 #define RSVP_OBJ_ACCEPT_LABEL_SET 130 /* rfc3473 */
148 #define RSVP_OBJ_RESTART_CAPABILITY 131 /* rfc3473 */
149 #define RSVP_OBJ_NOTIFY_REQ 195 /* rfc3473 */
150 #define RSVP_OBJ_ADMIN_STATUS 196 /* rfc3473 */
151 #define RSVP_OBJ_PROPERTIES 204 /* juniper proprietary */
152 #define RSVP_OBJ_FASTREROUTE 205 /* draft-ietf-mpls-rsvp-lsp-fastreroute-07 */
153 #define RSVP_OBJ_SESSION_ATTRIBUTE 207 /* rfc3209 */
154 #define RSVP_OBJ_CALL_ID 230 /* rfc3474 */
155 #define RSVP_OBJ_CALL_OPS 236 /* rfc3474 */
157 static const struct tok rsvp_obj_values
[] = {
158 { RSVP_OBJ_SESSION
, "Session" },
159 { RSVP_OBJ_RSVP_HOP
, "RSVP Hop" },
160 { RSVP_OBJ_INTEGRITY
, "Integrity" },
161 { RSVP_OBJ_TIME_VALUES
, "Time Values" },
162 { RSVP_OBJ_ERROR_SPEC
, "Error Spec" },
163 { RSVP_OBJ_SCOPE
, "Scope" },
164 { RSVP_OBJ_STYLE
, "Style" },
165 { RSVP_OBJ_FLOWSPEC
, "Flowspec" },
166 { RSVP_OBJ_FILTERSPEC
, "FilterSpec" },
167 { RSVP_OBJ_SENDER_TEMPLATE
, "Sender Template" },
168 { RSVP_OBJ_SENDER_TSPEC
, "Sender TSpec" },
169 { RSVP_OBJ_ADSPEC
, "Adspec" },
170 { RSVP_OBJ_POLICY_DATA
, "Policy Data" },
171 { RSVP_OBJ_CONFIRM
, "Confirm" },
172 { RSVP_OBJ_LABEL
, "Label" },
173 { RSVP_OBJ_LABEL_REQ
, "Label Request" },
174 { RSVP_OBJ_ERO
, "ERO" },
175 { RSVP_OBJ_RRO
, "RRO" },
176 { RSVP_OBJ_HELLO
, "Hello" },
177 { RSVP_OBJ_MESSAGE_ID
, "Message ID" },
178 { RSVP_OBJ_MESSAGE_ID_ACK
, "Message ID Ack" },
179 { RSVP_OBJ_MESSAGE_ID_LIST
, "Message ID List" },
180 { RSVP_OBJ_RECOVERY_LABEL
, "Recovery Label" },
181 { RSVP_OBJ_UPSTREAM_LABEL
, "Upstream Label" },
182 { RSVP_OBJ_LABEL_SET
, "Label Set" },
183 { RSVP_OBJ_ACCEPT_LABEL_SET
, "Acceptable Label Set" },
184 { RSVP_OBJ_DETOUR
, "Detour" },
185 { RSVP_OBJ_CLASSTYPE
, "Class Type" },
186 { RSVP_OBJ_SUGGESTED_LABEL
, "Suggested Label" },
187 { RSVP_OBJ_PROPERTIES
, "Properties" },
188 { RSVP_OBJ_FASTREROUTE
, "Fast Re-Route" },
189 { RSVP_OBJ_SESSION_ATTRIBUTE
, "Session Attribute" },
190 { RSVP_OBJ_CALL_ID
, "Call-ID" },
191 { RSVP_OBJ_CALL_OPS
, "Call Capability" },
192 { RSVP_OBJ_RESTART_CAPABILITY
, "Restart Capability" },
193 { RSVP_OBJ_NOTIFY_REQ
, "Notify Request" },
194 { RSVP_OBJ_PROTECTION
, "Protection" },
195 { RSVP_OBJ_ADMIN_STATUS
, "Administrative Status" },
199 #define RSVP_CTYPE_IPV4 1
200 #define RSVP_CTYPE_IPV6 2
201 #define RSVP_CTYPE_TUNNEL_IPV4 7
202 #define RSVP_CTYPE_TUNNEL_IPV6 8
203 #define RSVP_CTYPE_1 1
204 #define RSVP_CTYPE_2 2
205 #define RSVP_CTYPE_3 3
206 #define RSVP_CTYPE_4 4
209 * the ctypes are not globally unique so for
210 * translating it to strings we build a table based
211 * on objects offsetted by the ctype
214 static const struct tok rsvp_ctype_values
[] = {
215 { 256*RSVP_OBJ_RSVP_HOP
+RSVP_CTYPE_IPV4
, "IPv4" },
216 { 256*RSVP_OBJ_RSVP_HOP
+RSVP_CTYPE_IPV6
, "IPv6" },
217 { 256*RSVP_OBJ_RSVP_HOP
+RSVP_CTYPE_3
, "IPv4 plus opt. TLVs" },
218 { 256*RSVP_OBJ_RSVP_HOP
+RSVP_CTYPE_4
, "IPv6 plus opt. TLVs" },
219 { 256*RSVP_OBJ_NOTIFY_REQ
+RSVP_CTYPE_IPV4
, "IPv4" },
220 { 256*RSVP_OBJ_NOTIFY_REQ
+RSVP_CTYPE_IPV6
, "IPv6" },
221 { 256*RSVP_OBJ_CONFIRM
+RSVP_CTYPE_IPV4
, "IPv4" },
222 { 256*RSVP_OBJ_CONFIRM
+RSVP_CTYPE_IPV6
, "IPv6" },
223 { 256*RSVP_OBJ_TIME_VALUES
+RSVP_CTYPE_1
, "1" },
224 { 256*RSVP_OBJ_FLOWSPEC
+RSVP_CTYPE_1
, "obsolete" },
225 { 256*RSVP_OBJ_FLOWSPEC
+RSVP_CTYPE_2
, "IntServ" },
226 { 256*RSVP_OBJ_SENDER_TSPEC
+RSVP_CTYPE_2
, "IntServ" },
227 { 256*RSVP_OBJ_ADSPEC
+RSVP_CTYPE_2
, "IntServ" },
228 { 256*RSVP_OBJ_FILTERSPEC
+RSVP_CTYPE_IPV4
, "IPv4" },
229 { 256*RSVP_OBJ_FILTERSPEC
+RSVP_CTYPE_IPV6
, "IPv6" },
230 { 256*RSVP_OBJ_FILTERSPEC
+RSVP_CTYPE_3
, "IPv6 Flow-label" },
231 { 256*RSVP_OBJ_FILTERSPEC
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
232 { 256*RSVP_OBJ_SESSION
+RSVP_CTYPE_IPV4
, "IPv4" },
233 { 256*RSVP_OBJ_SESSION
+RSVP_CTYPE_IPV6
, "IPv6" },
234 { 256*RSVP_OBJ_SESSION
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
235 { 256*RSVP_OBJ_SENDER_TEMPLATE
+RSVP_CTYPE_IPV4
, "IPv4" },
236 { 256*RSVP_OBJ_SENDER_TEMPLATE
+RSVP_CTYPE_IPV6
, "IPv6" },
237 { 256*RSVP_OBJ_SENDER_TEMPLATE
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
238 { 256*RSVP_OBJ_MESSAGE_ID
+RSVP_CTYPE_1
, "1" },
239 { 256*RSVP_OBJ_MESSAGE_ID_ACK
+RSVP_CTYPE_1
, "1" },
240 { 256*RSVP_OBJ_MESSAGE_ID_LIST
+RSVP_CTYPE_1
, "1" },
241 { 256*RSVP_OBJ_STYLE
+RSVP_CTYPE_1
, "1" },
242 { 256*RSVP_OBJ_HELLO
+RSVP_CTYPE_1
, "Hello Request" },
243 { 256*RSVP_OBJ_HELLO
+RSVP_CTYPE_2
, "Hello Ack" },
244 { 256*RSVP_OBJ_LABEL_REQ
+RSVP_CTYPE_1
, "without label range" },
245 { 256*RSVP_OBJ_LABEL_REQ
+RSVP_CTYPE_2
, "with ATM label range" },
246 { 256*RSVP_OBJ_LABEL_REQ
+RSVP_CTYPE_3
, "with FR label range" },
247 { 256*RSVP_OBJ_LABEL_REQ
+RSVP_CTYPE_4
, "Generalized Label" },
248 { 256*RSVP_OBJ_LABEL
+RSVP_CTYPE_1
, "Label" },
249 { 256*RSVP_OBJ_LABEL
+RSVP_CTYPE_2
, "Generalized Label" },
250 { 256*RSVP_OBJ_LABEL
+RSVP_CTYPE_3
, "Waveband Switching" },
251 { 256*RSVP_OBJ_SUGGESTED_LABEL
+RSVP_CTYPE_1
, "Label" },
252 { 256*RSVP_OBJ_SUGGESTED_LABEL
+RSVP_CTYPE_2
, "Generalized Label" },
253 { 256*RSVP_OBJ_SUGGESTED_LABEL
+RSVP_CTYPE_3
, "Waveband Switching" },
254 { 256*RSVP_OBJ_UPSTREAM_LABEL
+RSVP_CTYPE_1
, "Label" },
255 { 256*RSVP_OBJ_UPSTREAM_LABEL
+RSVP_CTYPE_2
, "Generalized Label" },
256 { 256*RSVP_OBJ_UPSTREAM_LABEL
+RSVP_CTYPE_3
, "Waveband Switching" },
257 { 256*RSVP_OBJ_RECOVERY_LABEL
+RSVP_CTYPE_1
, "Label" },
258 { 256*RSVP_OBJ_RECOVERY_LABEL
+RSVP_CTYPE_2
, "Generalized Label" },
259 { 256*RSVP_OBJ_RECOVERY_LABEL
+RSVP_CTYPE_3
, "Waveband Switching" },
260 { 256*RSVP_OBJ_ERO
+RSVP_CTYPE_IPV4
, "IPv4" },
261 { 256*RSVP_OBJ_RRO
+RSVP_CTYPE_IPV4
, "IPv4" },
262 { 256*RSVP_OBJ_ERROR_SPEC
+RSVP_CTYPE_IPV4
, "IPv4" },
263 { 256*RSVP_OBJ_ERROR_SPEC
+RSVP_CTYPE_IPV6
, "IPv6" },
264 { 256*RSVP_OBJ_ERROR_SPEC
+RSVP_CTYPE_3
, "IPv4 plus opt. TLVs" },
265 { 256*RSVP_OBJ_ERROR_SPEC
+RSVP_CTYPE_4
, "IPv6 plus opt. TLVs" },
266 { 256*RSVP_OBJ_RESTART_CAPABILITY
+RSVP_CTYPE_1
, "IPv4" },
267 { 256*RSVP_OBJ_SESSION_ATTRIBUTE
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
268 { 256*RSVP_OBJ_FASTREROUTE
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" }, /* old style*/
269 { 256*RSVP_OBJ_FASTREROUTE
+RSVP_CTYPE_1
, "1" }, /* new style */
270 { 256*RSVP_OBJ_DETOUR
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
271 { 256*RSVP_OBJ_PROPERTIES
+RSVP_CTYPE_1
, "1" },
272 { 256*RSVP_OBJ_CLASSTYPE
+RSVP_CTYPE_1
, "1" },
276 struct rsvp_obj_integrity_t
{
280 u_int8_t sequence
[8];
284 static const struct tok rsvp_obj_integrity_flag_values
[] = {
285 { 0x80, "Handshake" },
289 struct rsvp_obj_frr_t
{
294 u_int8_t bandwidth
[4];
295 u_int8_t include_any
[4];
296 u_int8_t exclude_any
[4];
297 u_int8_t include_all
[4];
301 #define RSVP_OBJ_XRO_MASK_SUBOBJ(x) ((x)&0x7f)
302 #define RSVP_OBJ_XRO_MASK_LOOSE(x) ((x)&0x80)
304 #define RSVP_OBJ_XRO_RES 0
305 #define RSVP_OBJ_XRO_IPV4 1
306 #define RSVP_OBJ_XRO_IPV6 2
307 #define RSVP_OBJ_XRO_ASN 32
308 #define RSVP_OBJ_XRO_MPLS 64
310 static const struct tok rsvp_obj_xro_values
[] = {
311 { RSVP_OBJ_XRO_RES
, "Reserved" },
312 { RSVP_OBJ_XRO_IPV4
, "IPv4 prefix" },
313 { RSVP_OBJ_XRO_IPV6
, "IPv6 prefix" },
314 { RSVP_OBJ_XRO_ASN
, "Autonomous system number" },
315 { RSVP_OBJ_XRO_MPLS
, "MPLS label switched path termination" },
319 /* draft-ietf-mpls-rsvp-lsp-fastreroute-07.txt */
320 static const struct tok rsvp_obj_rro_flag_values
[] = {
321 { 0x01, "Local protection available" },
322 { 0x02, "Local protection in use" },
323 { 0x04, "Bandwidth protection" },
324 { 0x08, "Node protection" },
328 static const struct tok rsvp_resstyle_values
[] = {
329 { 17, "Wildcard Filter" },
330 { 10, "Fixed Filter" },
331 { 18, "Shared Explicit" },
335 #define RSVP_OBJ_INTSERV_GUARANTEED_SERV 2
336 #define RSVP_OBJ_INTSERV_CONTROLLED_LOAD 5
338 static const struct tok rsvp_intserv_service_type_values
[] = {
339 { 1, "Default/Global Information" },
340 { RSVP_OBJ_INTSERV_GUARANTEED_SERV
, "Guaranteed Service" },
341 { RSVP_OBJ_INTSERV_CONTROLLED_LOAD
, "Controlled Load" },
345 static const struct tok rsvp_intserv_parameter_id_values
[] = {
347 { 6, "Path b/w estimate" },
348 { 8, "Minimum path latency" },
349 { 10, "Composed MTU" },
350 { 127, "Token Bucket TSpec" },
351 { 130, "Guaranteed Service RSpec" },
352 { 133, "End-to-end composed value for C" },
353 { 134, "End-to-end composed value for D" },
354 { 135, "Since-last-reshaping point composed C" },
355 { 136, "Since-last-reshaping point composed D" },
359 static struct tok rsvp_session_attribute_flag_values
[] = {
360 { 0x01, "Local Protection desired" },
361 { 0x02, "Label Recording desired" },
362 { 0x04, "SE Style desired" },
363 { 0x08, "Bandwidth protection desired" }, /* draft-ietf-mpls-rsvp-lsp-fastreroute-02.txt */
364 { 0x10, "Node protection desired" }, /* draft-ietf-mpls-rsvp-lsp-fastreroute-02.txt */
368 static struct tok rsvp_obj_prop_tlv_values
[] = {
370 { 0x02, "Metric 1" },
371 { 0x04, "Metric 2" },
372 { 0x08, "CCC Status" },
373 { 0x10, "Path Type" },
377 #define RSVP_OBJ_ERROR_SPEC_CODE_ROUTING 24
378 #define RSVP_OBJ_ERROR_SPEC_CODE_NOTIFY 25
379 #define RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE 125
381 static struct tok rsvp_obj_error_code_values
[] = {
382 { RSVP_OBJ_ERROR_SPEC_CODE_ROUTING
, "Routing Problem" },
383 { RSVP_OBJ_ERROR_SPEC_CODE_NOTIFY
, "Notify Error" },
384 { RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE
, "Diffserv TE Error" },
388 static struct tok rsvp_obj_error_code_routing_values
[] = {
389 { 1, "Bad EXPLICIT_ROUTE object" },
390 { 2, "Bad strict node" },
391 { 3, "Bad loose node" },
392 { 4, "Bad initial subobject" },
393 { 5, "No route available toward destination" },
394 { 6, "Unacceptable label value" },
395 { 7, "RRO indicated routing loops" },
396 { 8, "non-RSVP-capable router in the path" },
397 { 9, "MPLS label allocation failure" },
398 { 10, "Unsupported L3PID" },
402 static struct tok rsvp_obj_error_code_diffserv_te_values
[] = {
403 { 1, "Unexpected CLASSTYPE object" },
404 { 2, "Unsupported Class-Type" },
405 { 3, "Invalid Class-Type value" },
406 { 4, "Class-Type and setup priority do not form a configured TE-Class" },
407 { 5, "Class-Type and holding priority do not form a configured TE-Class" },
408 { 6, "Inconsistency between signaled PSC and signaled Class-Type" },
409 { 7, "Inconsistency between signaled PHBs and signaled Class-Type" },
417 static int rsvp_intserv_print(const u_char
*, u_short
);
420 * this is a dissector for all the intserv defined
421 * specs as defined per rfc2215
422 * it is called from various rsvp objects;
423 * returns the amount of bytes being processed
426 rsvp_intserv_print(const u_char
*tptr
, u_short obj_tlen
) {
428 int parameter_id
,parameter_length
;
436 parameter_id
= *(tptr
);
437 parameter_length
= EXTRACT_16BITS(tptr
+2)<<2; /* convert wordcount to bytecount */
439 printf("\n\t Parameter ID: %s (%u), length: %u, Flags: [0x%02x]",
440 tok2str(rsvp_intserv_parameter_id_values
,"unknown",parameter_id
),
445 if (obj_tlen
< parameter_length
+4)
447 switch(parameter_id
) { /* parameter_id */
451 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
452 * | 4 (e) | (f) | 1 (g) |
453 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
454 * | IS hop cnt (32-bit unsigned integer) |
455 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
457 if (parameter_length
== 4)
458 printf("\n\t\tIS hop count: %u", EXTRACT_32BITS(tptr
+4));
463 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
464 * | 6 (h) | (i) | 1 (j) |
465 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
466 * | Path b/w estimate (32-bit IEEE floating point number) |
467 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
469 if (parameter_length
== 4) {
470 bw
.i
= EXTRACT_32BITS(tptr
+4);
471 printf("\n\t\tPath b/w estimate: %.10g Mbps", bw
.f
/125000);
477 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
478 * | 8 (k) | (l) | 1 (m) |
479 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
480 * | Minimum path latency (32-bit integer) |
481 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
483 if (parameter_length
== 4) {
484 printf("\n\t\tMinimum path latency: ");
485 if (EXTRACT_32BITS(tptr
+4) == 0xffffffff)
486 printf("don't care");
488 printf("%u", EXTRACT_32BITS(tptr
+4));
495 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
496 * | 10 (n) | (o) | 1 (p) |
497 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
498 * | Composed MTU (32-bit unsigned integer) |
499 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
501 if (parameter_length
== 4)
502 printf("\n\t\tComposed MTU: %u bytes", EXTRACT_32BITS(tptr
+4));
506 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
507 * | 127 (e) | 0 (f) | 5 (g) |
508 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
509 * | Token Bucket Rate [r] (32-bit IEEE floating point number) |
510 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
511 * | Token Bucket Size [b] (32-bit IEEE floating point number) |
512 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
513 * | Peak Data Rate [p] (32-bit IEEE floating point number) |
514 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
515 * | Minimum Policed Unit [m] (32-bit integer) |
516 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
517 * | Maximum Packet Size [M] (32-bit integer) |
518 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
521 if (parameter_length
== 20) {
522 bw
.i
= EXTRACT_32BITS(tptr
+4);
523 printf("\n\t\tToken Bucket Rate: %.10g Mbps", bw
.f
/125000);
524 bw
.i
= EXTRACT_32BITS(tptr
+8);
525 printf("\n\t\tToken Bucket Size: %.10g bytes", bw
.f
);
526 bw
.i
= EXTRACT_32BITS(tptr
+12);
527 printf("\n\t\tPeak Data Rate: %.10g Mbps", bw
.f
/125000);
528 printf("\n\t\tMinimum Policed Unit: %u bytes", EXTRACT_32BITS(tptr
+16));
529 printf("\n\t\tMaximum Packet Size: %u bytes", EXTRACT_32BITS(tptr
+20));
535 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
536 * | 130 (h) | 0 (i) | 2 (j) |
537 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
538 * | Rate [R] (32-bit IEEE floating point number) |
539 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
540 * | Slack Term [S] (32-bit integer) |
541 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
544 if (parameter_length
== 8) {
545 bw
.i
= EXTRACT_32BITS(tptr
+4);
546 printf("\n\t\tRate: %.10g Mbps", bw
.f
/125000);
547 printf("\n\t\tSlack Term: %u", EXTRACT_32BITS(tptr
+8));
555 if (parameter_length
== 4)
556 printf("\n\t\tValue: %u", EXTRACT_32BITS(tptr
+4));
561 print_unknown_data(tptr
+4,"\n\t\t",parameter_length
);
563 return (parameter_length
+4); /* header length 4 bytes */
567 rsvp_obj_print (const u_char
*tptr
, const char *ident
, u_int tlen
) {
569 const struct rsvp_object_header
*rsvp_obj_header
;
570 const u_char
*obj_tptr
;
572 const struct rsvp_obj_integrity_t
*rsvp_obj_integrity
;
573 const struct rsvp_obj_frr_t
*rsvp_obj_frr
;
576 u_short rsvp_obj_len
,rsvp_obj_ctype
,obj_tlen
,intserv_serv_tlen
;
577 int hexdump
,processed
,padbytes
,error_code
,error_value
,i
;
584 while(tlen
>=sizeof(struct rsvp_object_header
)) {
585 /* did we capture enough for fully decoding the object header ? */
586 if (!TTEST2(*tptr
, sizeof(struct rsvp_object_header
)))
589 rsvp_obj_header
= (const struct rsvp_object_header
*)tptr
;
590 rsvp_obj_len
=EXTRACT_16BITS(rsvp_obj_header
->length
);
591 rsvp_obj_ctype
=rsvp_obj_header
->ctype
;
593 if(rsvp_obj_len
% 4) {
594 printf("%sERROR: object header size %u not a multiple of 4", ident
, rsvp_obj_len
);
597 if(rsvp_obj_len
< sizeof(struct rsvp_object_header
)) {
598 printf("%sERROR: object header too short %u < %lu", ident
, rsvp_obj_len
,
599 (unsigned long)sizeof(const struct rsvp_object_header
));
603 printf("%s%s Object (%u) Flags: [%s",
605 tok2str(rsvp_obj_values
,
607 rsvp_obj_header
->class_num
),
608 rsvp_obj_header
->class_num
,
609 ((rsvp_obj_header
->class_num
)&0x80) ? "ignore" : "reject");
611 if (rsvp_obj_header
->class_num
> 128)
613 ((rsvp_obj_header
->class_num
)&0x40) ? "and forward" : "silently");
615 printf(" if unknown], Class-Type: %s (%u), length: %u",
616 tok2str(rsvp_ctype_values
,
618 ((rsvp_obj_header
->class_num
)<<8)+rsvp_obj_ctype
),
622 if(tlen
< rsvp_obj_len
) {
623 printf("%sERROR: object goes past end of objects TLV", ident
);
627 obj_tptr
=tptr
+sizeof(struct rsvp_object_header
);
628 obj_tlen
=rsvp_obj_len
-sizeof(struct rsvp_object_header
);
630 /* did we capture enough for fully decoding the object ? */
631 if (!TTEST2(*tptr
, rsvp_obj_len
))
635 switch(rsvp_obj_header
->class_num
) {
636 case RSVP_OBJ_SESSION
:
637 switch(rsvp_obj_ctype
) {
638 case RSVP_CTYPE_IPV4
:
641 printf("%s IPv4 DestAddress: %s, Protocol ID: 0x%02x",
643 ipaddr_string(obj_tptr
),
644 *(obj_tptr
+sizeof(struct in_addr
)));
645 printf("%s Flags: [0x%02x], DestPort %u",
648 EXTRACT_16BITS(obj_tptr
+6));
653 case RSVP_CTYPE_IPV6
:
656 printf("%s IPv6 DestAddress: %s, Protocol ID: 0x%02x",
658 ip6addr_string(obj_tptr
),
659 *(obj_tptr
+sizeof(struct in6_addr
)));
660 printf("%s Flags: [0x%02x], DestPort %u",
662 *(obj_tptr
+sizeof(struct in6_addr
)+1),
663 EXTRACT_16BITS(obj_tptr
+sizeof(struct in6_addr
)+2));
668 case RSVP_CTYPE_TUNNEL_IPV6
:
671 printf("%s IPv6 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
673 ip6addr_string(obj_tptr
),
674 EXTRACT_16BITS(obj_tptr
+18),
675 ip6addr_string(obj_tptr
+20));
680 case RSVP_CTYPE_TUNNEL_IPV4
:
683 printf("%s IPv4 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
685 ipaddr_string(obj_tptr
),
686 EXTRACT_16BITS(obj_tptr
+6),
687 ipaddr_string(obj_tptr
+8));
696 case RSVP_OBJ_CONFIRM
:
697 switch(rsvp_obj_ctype
) {
698 case RSVP_CTYPE_IPV4
:
699 if (obj_tlen
< sizeof(struct in_addr
))
701 printf("%s IPv4 Receiver Address: %s",
703 ipaddr_string(obj_tptr
));
704 obj_tlen
-=sizeof(struct in_addr
);
705 obj_tptr
+=sizeof(struct in_addr
);
708 case RSVP_CTYPE_IPV6
:
709 if (obj_tlen
< sizeof(struct in6_addr
))
711 printf("%s IPv6 Receiver Address: %s",
713 ip6addr_string(obj_tptr
));
714 obj_tlen
-=sizeof(struct in6_addr
);
715 obj_tptr
+=sizeof(struct in6_addr
);
723 case RSVP_OBJ_NOTIFY_REQ
:
724 switch(rsvp_obj_ctype
) {
725 case RSVP_CTYPE_IPV4
:
726 if (obj_tlen
< sizeof(struct in_addr
))
728 printf("%s IPv4 Notify Node Address: %s",
730 ipaddr_string(obj_tptr
));
731 obj_tlen
-=sizeof(struct in_addr
);
732 obj_tptr
+=sizeof(struct in_addr
);
735 case RSVP_CTYPE_IPV6
:
736 if (obj_tlen
< sizeof(struct in6_addr
))
738 printf("%s IPv6 Notify Node Address: %s",
740 ip6addr_string(obj_tptr
));
741 obj_tlen
-=sizeof(struct in6_addr
);
742 obj_tptr
+=sizeof(struct in6_addr
);
750 case RSVP_OBJ_SUGGESTED_LABEL
: /* fall through */
751 case RSVP_OBJ_UPSTREAM_LABEL
: /* fall through */
752 case RSVP_OBJ_RECOVERY_LABEL
: /* fall through */
754 switch(rsvp_obj_ctype
) {
756 while(obj_tlen
>= 4 ) {
757 printf("%s Label: %u", ident
, EXTRACT_32BITS(obj_tptr
));
765 printf("%s Generalized Label: %u",
767 EXTRACT_32BITS(obj_tptr
));
774 printf("%s Waveband ID: %u%s Start Label: %u, Stop Label: %u",
776 EXTRACT_32BITS(obj_tptr
),
778 EXTRACT_32BITS(obj_tptr
+4),
779 EXTRACT_32BITS(obj_tptr
+8));
789 switch(rsvp_obj_ctype
) {
793 printf("%s Reservation Style: %s, Flags: [0x%02x]",
795 tok2str(rsvp_resstyle_values
,
797 EXTRACT_24BITS(obj_tptr
+1)),
807 case RSVP_OBJ_SENDER_TEMPLATE
:
808 switch(rsvp_obj_ctype
) {
809 case RSVP_CTYPE_IPV4
:
812 printf("%s Source Address: %s, Source Port: %u",
814 ipaddr_string(obj_tptr
),
815 EXTRACT_16BITS(obj_tptr
+6));
820 case RSVP_CTYPE_IPV6
:
823 printf("%s Source Address: %s, Source Port: %u",
825 ip6addr_string(obj_tptr
),
826 EXTRACT_16BITS(obj_tptr
+18));
831 case RSVP_CTYPE_TUNNEL_IPV4
:
834 printf("%s IPv4 Tunnel Sender Address: %s, LSP-ID: 0x%04x",
836 ipaddr_string(obj_tptr
),
837 EXTRACT_16BITS(obj_tptr
+6));
846 case RSVP_OBJ_LABEL_REQ
:
847 switch(rsvp_obj_ctype
) {
849 while(obj_tlen
>= 4 ) {
850 printf("%s L3 Protocol ID: %s",
852 tok2str(ethertype_values
,
853 "Unknown Protocol (0x%04x)",
854 EXTRACT_16BITS(obj_tptr
+2)));
862 printf("%s L3 Protocol ID: %s",
864 tok2str(ethertype_values
,
865 "Unknown Protocol (0x%04x)",
866 EXTRACT_16BITS(obj_tptr
+2)));
867 printf(",%s merge capability",((*(obj_tptr
+4))&0x80) ? "no" : "" );
868 printf("%s Minimum VPI/VCI: %u/%u",
870 (EXTRACT_16BITS(obj_tptr
+4))&0xfff,
871 (EXTRACT_16BITS(obj_tptr
+6))&0xfff);
872 printf("%s Maximum VPI/VCI: %u/%u",
874 (EXTRACT_16BITS(obj_tptr
+8))&0xfff,
875 (EXTRACT_16BITS(obj_tptr
+10))&0xfff);
882 printf("%s L3 Protocol ID: %s",
884 tok2str(ethertype_values
,
885 "Unknown Protocol (0x%04x)",
886 EXTRACT_16BITS(obj_tptr
+2)));
887 printf("%s Minimum/Maximum DLCI: %u/%u, %s%s bit DLCI",
889 (EXTRACT_32BITS(obj_tptr
+4))&0x7fffff,
890 (EXTRACT_32BITS(obj_tptr
+8))&0x7fffff,
891 (((EXTRACT_16BITS(obj_tptr
+4)>>7)&3) == 0 ) ? "10" : "",
892 (((EXTRACT_16BITS(obj_tptr
+4)>>7)&3) == 2 ) ? "23" : "");
899 printf("%s LSP Encoding Type: %s (%u)",
901 tok2str(gmpls_encoding_values
,
905 printf("%s Switching Type: %s (%u), Payload ID: %s (0x%04x)",
907 tok2str(gmpls_switch_cap_values
,
911 tok2str(gmpls_payload_values
,
913 EXTRACT_16BITS(obj_tptr
+2)),
914 EXTRACT_16BITS(obj_tptr
+2));
925 switch(rsvp_obj_ctype
) {
926 case RSVP_CTYPE_IPV4
:
927 while(obj_tlen
>= 4 ) {
928 printf("%s Subobject Type: %s, length %u",
930 tok2str(rsvp_obj_xro_values
,
932 RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr
)),
935 if (*(obj_tptr
+1) == 0) { /* prevent infinite loops */
936 printf("%s ERROR: zero length ERO subtype",ident
);
940 switch(RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr
)) {
941 case RSVP_OBJ_XRO_IPV4
:
942 printf(", %s, %s/%u, Flags: [%s]",
943 RSVP_OBJ_XRO_MASK_LOOSE(*obj_tptr
) ? "Loose" : "Strict",
944 ipaddr_string(obj_tptr
+2),
946 bittok2str(rsvp_obj_rro_flag_values
,
948 *(obj_tptr
+7))); /* rfc3209 says that this field is rsvd. */
950 obj_tlen
-=*(obj_tptr
+1);
951 obj_tptr
+=*(obj_tptr
+1);
960 switch(rsvp_obj_ctype
) {
965 printf("%s Source Instance: 0x%08x, Destination Instance: 0x%08x",
967 EXTRACT_32BITS(obj_tptr
),
968 EXTRACT_32BITS(obj_tptr
+4));
977 case RSVP_OBJ_RESTART_CAPABILITY
:
978 switch(rsvp_obj_ctype
) {
982 printf("%s Restart Time: %ums, Recovery Time: %ums",
984 EXTRACT_32BITS(obj_tptr
),
985 EXTRACT_32BITS(obj_tptr
+4));
994 case RSVP_OBJ_SESSION_ATTRIBUTE
:
995 switch(rsvp_obj_ctype
) {
996 case RSVP_CTYPE_TUNNEL_IPV4
:
999 namelen
= *(obj_tptr
+3);
1000 if (obj_tlen
< 4+namelen
)
1002 printf("%s Session Name: ", ident
);
1003 for (i
= 0; i
< namelen
; i
++)
1004 safeputchar(*(obj_tptr
+4+i
));
1005 printf("%s Setup Priority: %u, Holding Priority: %u, Flags: [%s]",
1009 tok2str(rsvp_session_attribute_flag_values
,
1013 obj_tlen
-=4+*(obj_tptr
+3);
1014 obj_tptr
+=4+*(obj_tptr
+3);
1021 case RSVP_OBJ_RSVP_HOP
:
1022 switch(rsvp_obj_ctype
) {
1023 case RSVP_CTYPE_3
: /* fall through - FIXME add TLV parser */
1024 case RSVP_CTYPE_IPV4
:
1027 printf("%s Previous/Next Interface: %s, Logical Interface Handle: 0x%08x",
1029 ipaddr_string(obj_tptr
),
1030 EXTRACT_32BITS(obj_tptr
+4));
1034 hexdump
=TRUE
; /* unless we have a TLV parser lets just hexdump */
1037 case RSVP_CTYPE_4
: /* fall through - FIXME add TLV parser */
1038 case RSVP_CTYPE_IPV6
:
1041 printf("%s Previous/Next Interface: %s, Logical Interface Handle: 0x%08x",
1043 ip6addr_string(obj_tptr
),
1044 EXTRACT_32BITS(obj_tptr
+16));
1047 hexdump
=TRUE
; /* unless we have a TLV parser lets just hexdump */
1055 case RSVP_OBJ_TIME_VALUES
:
1056 switch(rsvp_obj_ctype
) {
1060 printf("%s Refresh Period: %ums",
1062 EXTRACT_32BITS(obj_tptr
));
1071 /* those three objects do share the same semantics */
1072 case RSVP_OBJ_SENDER_TSPEC
:
1073 case RSVP_OBJ_ADSPEC
:
1074 case RSVP_OBJ_FLOWSPEC
:
1075 switch(rsvp_obj_ctype
) {
1079 printf("%s Msg-Version: %u, length: %u",
1081 (*obj_tptr
& 0xf0) >> 4,
1082 EXTRACT_16BITS(obj_tptr
+2)<<2);
1083 obj_tptr
+=4; /* get to the start of the service header */
1086 while (obj_tlen
>= 4) {
1087 intserv_serv_tlen
=EXTRACT_16BITS(obj_tptr
+2)<<2;
1088 printf("%s Service Type: %s (%u), break bit %s set, Service length: %u",
1090 tok2str(rsvp_intserv_service_type_values
,"unknown",*(obj_tptr
)),
1092 (*(obj_tptr
+1)&0x80) ? "" : "not",
1095 obj_tptr
+=4; /* get to the start of the parameter list */
1098 while (intserv_serv_tlen
>=4) {
1099 processed
= rsvp_intserv_print(obj_tptr
, obj_tlen
);
1102 obj_tlen
-=processed
;
1103 intserv_serv_tlen
-=processed
;
1104 obj_tptr
+=processed
;
1113 case RSVP_OBJ_FILTERSPEC
:
1114 switch(rsvp_obj_ctype
) {
1115 case RSVP_CTYPE_IPV4
:
1118 printf("%s Source Address: %s, Source Port: %u",
1120 ipaddr_string(obj_tptr
),
1121 EXTRACT_16BITS(obj_tptr
+6));
1126 case RSVP_CTYPE_IPV6
:
1129 printf("%s Source Address: %s, Source Port: %u",
1131 ip6addr_string(obj_tptr
),
1132 EXTRACT_16BITS(obj_tptr
+18));
1139 printf("%s Source Address: %s, Flow Label: %u",
1141 ip6addr_string(obj_tptr
),
1142 EXTRACT_24BITS(obj_tptr
+17));
1146 case RSVP_CTYPE_TUNNEL_IPV6
:
1149 printf("%s Source Address: %s, LSP-ID: 0x%04x",
1151 ipaddr_string(obj_tptr
),
1152 EXTRACT_16BITS(obj_tptr
+18));
1157 case RSVP_CTYPE_TUNNEL_IPV4
:
1160 printf("%s Source Address: %s, LSP-ID: 0x%04x",
1162 ipaddr_string(obj_tptr
),
1163 EXTRACT_16BITS(obj_tptr
+6));
1172 case RSVP_OBJ_FASTREROUTE
:
1173 /* the differences between c-type 1 and 7 are minor */
1174 obj_ptr
.rsvp_obj_frr
= (const struct rsvp_obj_frr_t
*)obj_tptr
;
1175 bw
.i
= EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->bandwidth
);
1177 switch(rsvp_obj_ctype
) {
1178 case RSVP_CTYPE_1
: /* new style */
1179 if (obj_tlen
< sizeof(struct rsvp_obj_frr_t
))
1181 printf("%s Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps",
1183 (int)obj_ptr
.rsvp_obj_frr
->setup_prio
,
1184 (int)obj_ptr
.rsvp_obj_frr
->hold_prio
,
1185 (int)obj_ptr
.rsvp_obj_frr
->hop_limit
,
1187 printf("%s Include-any: 0x%08x, Exclude-any: 0x%08x, Include-all: 0x%08x",
1189 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->include_any
),
1190 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->exclude_any
),
1191 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->include_all
));
1192 obj_tlen
-=sizeof(struct rsvp_obj_frr_t
);
1193 obj_tptr
+=sizeof(struct rsvp_obj_frr_t
);
1196 case RSVP_CTYPE_TUNNEL_IPV4
: /* old style */
1199 printf("%s Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps",
1201 (int)obj_ptr
.rsvp_obj_frr
->setup_prio
,
1202 (int)obj_ptr
.rsvp_obj_frr
->hold_prio
,
1203 (int)obj_ptr
.rsvp_obj_frr
->hop_limit
,
1205 printf("%s Include Colors: 0x%08x, Exclude Colors: 0x%08x",
1207 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->include_any
),
1208 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->exclude_any
));
1218 case RSVP_OBJ_DETOUR
:
1219 switch(rsvp_obj_ctype
) {
1220 case RSVP_CTYPE_TUNNEL_IPV4
:
1221 while(obj_tlen
>= 8) {
1222 printf("%s PLR-ID: %s, Avoid-Node-ID: %s",
1224 ipaddr_string(obj_tptr
),
1225 ipaddr_string(obj_tptr
+4));
1235 case RSVP_OBJ_CLASSTYPE
:
1236 switch(rsvp_obj_ctype
) {
1238 printf("%s Class Type: %u",
1240 EXTRACT_32BITS(obj_tptr
)&0x7);
1249 case RSVP_OBJ_ERROR_SPEC
:
1250 switch(rsvp_obj_ctype
) {
1251 case RSVP_CTYPE_3
: /* fall through - FIXME add TLV parser */
1252 case RSVP_CTYPE_IPV4
:
1255 error_code
=*(obj_tptr
+5);
1256 error_value
=EXTRACT_16BITS(obj_tptr
+6);
1257 printf("%s Error Node Address: %s, Flags: [0x%02x]%s Error Code: %s (%u)",
1259 ipaddr_string(obj_tptr
),
1262 tok2str(rsvp_obj_error_code_values
,"unknown",error_code
),
1264 switch (error_code
) {
1265 case RSVP_OBJ_ERROR_SPEC_CODE_ROUTING
:
1266 printf(", Error Value: %s (%u)",
1267 tok2str(rsvp_obj_error_code_routing_values
,"unknown",error_value
),
1270 case RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE
:
1271 printf(", Error Value: %s (%u)",
1272 tok2str(rsvp_obj_error_code_diffserv_te_values
,"unknown",error_value
),
1276 printf(", Unknown Error Value (%u)", error_value
);
1283 case RSVP_CTYPE_4
: /* fall through - FIXME add TLV parser */
1284 case RSVP_CTYPE_IPV6
:
1287 error_code
=*(obj_tptr
+17);
1288 error_value
=EXTRACT_16BITS(obj_tptr
+18);
1289 printf("%s Error Node Address: %s, Flags: [0x%02x]%s Error Code: %s (%u)",
1291 ip6addr_string(obj_tptr
),
1294 tok2str(rsvp_obj_error_code_values
,"unknown",error_code
),
1297 switch (error_code
) {
1298 case RSVP_OBJ_ERROR_SPEC_CODE_ROUTING
:
1299 printf(", Error Value: %s (%u)",
1300 tok2str(rsvp_obj_error_code_routing_values
,"unknown",error_value
),
1315 case RSVP_OBJ_PROPERTIES
:
1316 switch(rsvp_obj_ctype
) {
1320 padbytes
= EXTRACT_16BITS(obj_tptr
+2);
1321 printf("%s TLV count: %u, padding bytes: %u",
1323 EXTRACT_16BITS(obj_tptr
),
1327 /* loop through as long there is anything longer than the TLV header (2) */
1328 while(obj_tlen
>= 2 + padbytes
) {
1329 printf("%s %s TLV (0x%02x), length: %u", /* length includes header */
1331 tok2str(rsvp_obj_prop_tlv_values
,"unknown",*obj_tptr
),
1334 if (obj_tlen
< *(obj_tptr
+1))
1336 if (*(obj_tptr
+1) < 2)
1338 print_unknown_data(obj_tptr
+2,"\n\t\t",*(obj_tptr
+1)-2);
1339 obj_tlen
-=*(obj_tptr
+1);
1340 obj_tptr
+=*(obj_tptr
+1);
1348 case RSVP_OBJ_MESSAGE_ID
: /* fall through */
1349 case RSVP_OBJ_MESSAGE_ID_ACK
: /* fall through */
1350 case RSVP_OBJ_MESSAGE_ID_LIST
:
1351 switch(rsvp_obj_ctype
) {
1355 printf("%s Flags [0x%02x], epoch: %u",
1358 EXTRACT_24BITS(obj_tptr
+1));
1361 /* loop through as long there are no messages left */
1362 while(obj_tlen
>= 4) {
1363 printf("%s Message-ID 0x%08x (%u)",
1365 EXTRACT_32BITS(obj_tptr
),
1366 EXTRACT_32BITS(obj_tptr
));
1376 case RSVP_OBJ_INTEGRITY
:
1377 switch(rsvp_obj_ctype
) {
1379 if (obj_tlen
< sizeof(struct rsvp_obj_integrity_t
))
1381 obj_ptr
.rsvp_obj_integrity
= (const struct rsvp_obj_integrity_t
*)obj_tptr
;
1382 printf("%s Key-ID 0x%04x%08x, Sequence 0x%08x%08x, Flags [%s]",
1384 EXTRACT_16BITS(obj_ptr
.rsvp_obj_integrity
->key_id
),
1385 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->key_id
+2),
1386 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->sequence
),
1387 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->sequence
+4),
1388 bittok2str(rsvp_obj_integrity_flag_values
,
1390 obj_ptr
.rsvp_obj_integrity
->flags
));
1391 printf("%s MD5-sum 0x%08x%08x%08x%08x (unverified)",
1393 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->digest
),
1394 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->digest
+4),
1395 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->digest
+8),
1396 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->digest
+12));
1397 obj_tlen
+=sizeof(struct rsvp_obj_integrity_t
);
1398 obj_tptr
+=sizeof(struct rsvp_obj_integrity_t
);
1406 * FIXME those are the defined objects that lack a decoder
1407 * you are welcome to contribute code ;-)
1410 case RSVP_OBJ_SCOPE
:
1411 case RSVP_OBJ_POLICY_DATA
:
1412 case RSVP_OBJ_LABEL_SET
:
1413 case RSVP_OBJ_ACCEPT_LABEL_SET
:
1414 case RSVP_OBJ_PROTECTION
:
1417 print_unknown_data(obj_tptr
,"\n\t ",obj_tlen
); /* FIXME indentation */
1420 /* do we also want to see a hex dump ? */
1421 if (vflag
> 1 || hexdump
==TRUE
)
1422 print_unknown_data(tptr
+sizeof(sizeof(struct rsvp_object_header
)),"\n\t ", /* FIXME indentation */
1423 rsvp_obj_len
-sizeof(struct rsvp_object_header
));
1430 printf("\n\t\t packet exceeded snapshot");
1436 rsvp_print(register const u_char
*pptr
, register u_int len
) {
1438 const struct rsvp_common_header
*rsvp_com_header
;
1439 const u_char
*tptr
,*subtptr
;
1440 u_short tlen
,subtlen
;
1444 rsvp_com_header
= (const struct rsvp_common_header
*)pptr
;
1445 TCHECK(*rsvp_com_header
);
1448 * Sanity checking of the header.
1450 if (RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
) != RSVP_VERSION
) {
1451 printf("ERROR: RSVP version %u packet not supported",
1452 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
));
1456 /* in non-verbose mode just lets print the basic Message Type*/
1458 printf("RSVPv%u %s Message, length: %u",
1459 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
),
1460 tok2str(rsvp_msg_type_values
, "unknown (%u)",rsvp_com_header
->msg_type
),
1465 /* ok they seem to want to know everything - lets fully decode it */
1467 tlen
=EXTRACT_16BITS(rsvp_com_header
->length
);
1469 printf("\n\tRSVPv%u %s Message (%u), Flags: [%s], length: %u, ttl: %u, checksum: 0x%04x",
1470 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
),
1471 tok2str(rsvp_msg_type_values
, "unknown, type: %u",rsvp_com_header
->msg_type
),
1472 rsvp_com_header
->msg_type
,
1473 bittok2str(rsvp_header_flag_values
,"none",RSVP_EXTRACT_FLAGS(rsvp_com_header
->version_flags
)),
1475 rsvp_com_header
->ttl
,
1476 EXTRACT_16BITS(rsvp_com_header
->checksum
));
1478 if (tlen
< sizeof(const struct rsvp_common_header
)) {
1479 printf("ERROR: common header too short %u < %lu", tlen
,
1480 (unsigned long)sizeof(const struct rsvp_common_header
));
1484 tptr
+=sizeof(const struct rsvp_common_header
);
1485 tlen
-=sizeof(const struct rsvp_common_header
);
1487 switch(rsvp_com_header
->msg_type
) {
1489 case RSVP_MSGTYPE_AGGREGATE
:
1492 rsvp_com_header
= (const struct rsvp_common_header
*)subtptr
;
1493 TCHECK(*rsvp_com_header
);
1496 * Sanity checking of the header.
1498 if (RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
) != RSVP_VERSION
) {
1499 printf("ERROR: RSVP version %u packet not supported",
1500 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
));
1503 subtlen
=EXTRACT_16BITS(rsvp_com_header
->length
);
1505 printf("\n\t RSVPv%u %s Message (%u), Flags: [%s], length: %u, ttl: %u, checksum: 0x%04x",
1506 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
),
1507 tok2str(rsvp_msg_type_values
, "unknown, type: %u",rsvp_com_header
->msg_type
),
1508 rsvp_com_header
->msg_type
,
1509 bittok2str(rsvp_header_flag_values
,"none",RSVP_EXTRACT_FLAGS(rsvp_com_header
->version_flags
)),
1511 rsvp_com_header
->ttl
,
1512 EXTRACT_16BITS(rsvp_com_header
->checksum
));
1514 if (subtlen
< sizeof(const struct rsvp_common_header
)) {
1515 printf("ERROR: common header too short %u < %lu", subtlen
,
1516 (unsigned long)sizeof(const struct rsvp_common_header
));
1520 if (tlen
< subtlen
) {
1521 printf("ERROR: common header too large %u > %u", subtlen
,
1526 subtptr
+=sizeof(const struct rsvp_common_header
);
1527 subtlen
-=sizeof(const struct rsvp_common_header
);
1529 if (rsvp_obj_print(subtptr
,"\n\t ", subtlen
) == -1)
1532 tptr
+=subtlen
+sizeof(const struct rsvp_common_header
);
1533 tlen
-=subtlen
+sizeof(const struct rsvp_common_header
);
1538 case RSVP_MSGTYPE_PATH
:
1539 case RSVP_MSGTYPE_RESV
:
1540 case RSVP_MSGTYPE_PATHERR
:
1541 case RSVP_MSGTYPE_RESVERR
:
1542 case RSVP_MSGTYPE_PATHTEAR
:
1543 case RSVP_MSGTYPE_RESVTEAR
:
1544 case RSVP_MSGTYPE_RESVCONF
:
1545 case RSVP_MSGTYPE_HELLO_OLD
:
1546 case RSVP_MSGTYPE_HELLO
:
1547 case RSVP_MSGTYPE_ACK
:
1548 case RSVP_MSGTYPE_SREFRESH
:
1549 if (rsvp_obj_print(tptr
,"\n\t ", tlen
) == -1)
1554 print_unknown_data(tptr
,"\n\t ",tlen
);
1560 printf("\n\t\t packet exceeded snapshot");