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.33.2.6 2005-08-23 11:16:30 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 66 /* rfc4124 */
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 CT object" },
404 { 2, "Unsupported CT" },
405 { 3, "Invalid CT value" },
406 { 4, "CT/setup priority do not form a configured TE-Class" },
407 { 5, "CT/holding priority do not form a configured TE-Class" },
408 { 6, "CT/setup priority and CT/holding priority do not form a configured TE-Class" },
409 { 7, "Inconsistency between signaled PSC and signaled CT" },
410 { 8, "Inconsistency between signaled PHBs and signaled CT" },
418 static int rsvp_intserv_print(const u_char
*, u_short
);
421 * this is a dissector for all the intserv defined
422 * specs as defined per rfc2215
423 * it is called from various rsvp objects;
424 * returns the amount of bytes being processed
427 rsvp_intserv_print(const u_char
*tptr
, u_short obj_tlen
) {
429 int parameter_id
,parameter_length
;
437 parameter_id
= *(tptr
);
438 parameter_length
= EXTRACT_16BITS(tptr
+2)<<2; /* convert wordcount to bytecount */
440 printf("\n\t Parameter ID: %s (%u), length: %u, Flags: [0x%02x]",
441 tok2str(rsvp_intserv_parameter_id_values
,"unknown",parameter_id
),
446 if (obj_tlen
< parameter_length
+4)
448 switch(parameter_id
) { /* parameter_id */
452 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
453 * | 4 (e) | (f) | 1 (g) |
454 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
455 * | IS hop cnt (32-bit unsigned integer) |
456 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
458 if (parameter_length
== 4)
459 printf("\n\t\tIS hop count: %u", EXTRACT_32BITS(tptr
+4));
464 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
465 * | 6 (h) | (i) | 1 (j) |
466 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
467 * | Path b/w estimate (32-bit IEEE floating point number) |
468 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
470 if (parameter_length
== 4) {
471 bw
.i
= EXTRACT_32BITS(tptr
+4);
472 printf("\n\t\tPath b/w estimate: %.10g Mbps", bw
.f
/125000);
478 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
479 * | 8 (k) | (l) | 1 (m) |
480 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
481 * | Minimum path latency (32-bit integer) |
482 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
484 if (parameter_length
== 4) {
485 printf("\n\t\tMinimum path latency: ");
486 if (EXTRACT_32BITS(tptr
+4) == 0xffffffff)
487 printf("don't care");
489 printf("%u", EXTRACT_32BITS(tptr
+4));
496 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
497 * | 10 (n) | (o) | 1 (p) |
498 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
499 * | Composed MTU (32-bit unsigned integer) |
500 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
502 if (parameter_length
== 4)
503 printf("\n\t\tComposed MTU: %u bytes", EXTRACT_32BITS(tptr
+4));
507 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
508 * | 127 (e) | 0 (f) | 5 (g) |
509 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
510 * | Token Bucket Rate [r] (32-bit IEEE floating point number) |
511 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
512 * | Token Bucket Size [b] (32-bit IEEE floating point number) |
513 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
514 * | Peak Data Rate [p] (32-bit IEEE floating point number) |
515 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
516 * | Minimum Policed Unit [m] (32-bit integer) |
517 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
518 * | Maximum Packet Size [M] (32-bit integer) |
519 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
522 if (parameter_length
== 20) {
523 bw
.i
= EXTRACT_32BITS(tptr
+4);
524 printf("\n\t\tToken Bucket Rate: %.10g Mbps", bw
.f
/125000);
525 bw
.i
= EXTRACT_32BITS(tptr
+8);
526 printf("\n\t\tToken Bucket Size: %.10g bytes", bw
.f
);
527 bw
.i
= EXTRACT_32BITS(tptr
+12);
528 printf("\n\t\tPeak Data Rate: %.10g Mbps", bw
.f
/125000);
529 printf("\n\t\tMinimum Policed Unit: %u bytes", EXTRACT_32BITS(tptr
+16));
530 printf("\n\t\tMaximum Packet Size: %u bytes", EXTRACT_32BITS(tptr
+20));
536 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
537 * | 130 (h) | 0 (i) | 2 (j) |
538 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
539 * | Rate [R] (32-bit IEEE floating point number) |
540 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
541 * | Slack Term [S] (32-bit integer) |
542 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
545 if (parameter_length
== 8) {
546 bw
.i
= EXTRACT_32BITS(tptr
+4);
547 printf("\n\t\tRate: %.10g Mbps", bw
.f
/125000);
548 printf("\n\t\tSlack Term: %u", EXTRACT_32BITS(tptr
+8));
556 if (parameter_length
== 4)
557 printf("\n\t\tValue: %u", EXTRACT_32BITS(tptr
+4));
562 print_unknown_data(tptr
+4,"\n\t\t",parameter_length
);
564 return (parameter_length
+4); /* header length 4 bytes */
568 rsvp_obj_print (const u_char
*tptr
, const char *ident
, u_int tlen
) {
570 const struct rsvp_object_header
*rsvp_obj_header
;
571 const u_char
*obj_tptr
;
573 const struct rsvp_obj_integrity_t
*rsvp_obj_integrity
;
574 const struct rsvp_obj_frr_t
*rsvp_obj_frr
;
577 u_short rsvp_obj_len
,rsvp_obj_ctype
,obj_tlen
,intserv_serv_tlen
;
578 int hexdump
,processed
,padbytes
,error_code
,error_value
,i
;
585 while(tlen
>=sizeof(struct rsvp_object_header
)) {
586 /* did we capture enough for fully decoding the object header ? */
587 if (!TTEST2(*tptr
, sizeof(struct rsvp_object_header
)))
590 rsvp_obj_header
= (const struct rsvp_object_header
*)tptr
;
591 rsvp_obj_len
=EXTRACT_16BITS(rsvp_obj_header
->length
);
592 rsvp_obj_ctype
=rsvp_obj_header
->ctype
;
594 if(rsvp_obj_len
% 4) {
595 printf("%sERROR: object header size %u not a multiple of 4", ident
, rsvp_obj_len
);
598 if(rsvp_obj_len
< sizeof(struct rsvp_object_header
)) {
599 printf("%sERROR: object header too short %u < %lu", ident
, rsvp_obj_len
,
600 (unsigned long)sizeof(const struct rsvp_object_header
));
604 printf("%s%s Object (%u) Flags: [%s",
606 tok2str(rsvp_obj_values
,
608 rsvp_obj_header
->class_num
),
609 rsvp_obj_header
->class_num
,
610 ((rsvp_obj_header
->class_num
)&0x80) ? "ignore" : "reject");
612 if (rsvp_obj_header
->class_num
> 128)
614 ((rsvp_obj_header
->class_num
)&0x40) ? "and forward" : "silently");
616 printf(" if unknown], Class-Type: %s (%u), length: %u",
617 tok2str(rsvp_ctype_values
,
619 ((rsvp_obj_header
->class_num
)<<8)+rsvp_obj_ctype
),
623 if(tlen
< rsvp_obj_len
) {
624 printf("%sERROR: object goes past end of objects TLV", ident
);
628 obj_tptr
=tptr
+sizeof(struct rsvp_object_header
);
629 obj_tlen
=rsvp_obj_len
-sizeof(struct rsvp_object_header
);
631 /* did we capture enough for fully decoding the object ? */
632 if (!TTEST2(*tptr
, rsvp_obj_len
))
636 switch(rsvp_obj_header
->class_num
) {
637 case RSVP_OBJ_SESSION
:
638 switch(rsvp_obj_ctype
) {
639 case RSVP_CTYPE_IPV4
:
642 printf("%s IPv4 DestAddress: %s, Protocol ID: 0x%02x",
644 ipaddr_string(obj_tptr
),
645 *(obj_tptr
+sizeof(struct in_addr
)));
646 printf("%s Flags: [0x%02x], DestPort %u",
649 EXTRACT_16BITS(obj_tptr
+6));
654 case RSVP_CTYPE_IPV6
:
657 printf("%s IPv6 DestAddress: %s, Protocol ID: 0x%02x",
659 ip6addr_string(obj_tptr
),
660 *(obj_tptr
+sizeof(struct in6_addr
)));
661 printf("%s Flags: [0x%02x], DestPort %u",
663 *(obj_tptr
+sizeof(struct in6_addr
)+1),
664 EXTRACT_16BITS(obj_tptr
+sizeof(struct in6_addr
)+2));
669 case RSVP_CTYPE_TUNNEL_IPV6
:
672 printf("%s IPv6 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
674 ip6addr_string(obj_tptr
),
675 EXTRACT_16BITS(obj_tptr
+18),
676 ip6addr_string(obj_tptr
+20));
681 case RSVP_CTYPE_TUNNEL_IPV4
:
684 printf("%s IPv4 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
686 ipaddr_string(obj_tptr
),
687 EXTRACT_16BITS(obj_tptr
+6),
688 ipaddr_string(obj_tptr
+8));
697 case RSVP_OBJ_CONFIRM
:
698 switch(rsvp_obj_ctype
) {
699 case RSVP_CTYPE_IPV4
:
700 if (obj_tlen
< sizeof(struct in_addr
))
702 printf("%s IPv4 Receiver Address: %s",
704 ipaddr_string(obj_tptr
));
705 obj_tlen
-=sizeof(struct in_addr
);
706 obj_tptr
+=sizeof(struct in_addr
);
709 case RSVP_CTYPE_IPV6
:
710 if (obj_tlen
< sizeof(struct in6_addr
))
712 printf("%s IPv6 Receiver Address: %s",
714 ip6addr_string(obj_tptr
));
715 obj_tlen
-=sizeof(struct in6_addr
);
716 obj_tptr
+=sizeof(struct in6_addr
);
724 case RSVP_OBJ_NOTIFY_REQ
:
725 switch(rsvp_obj_ctype
) {
726 case RSVP_CTYPE_IPV4
:
727 if (obj_tlen
< sizeof(struct in_addr
))
729 printf("%s IPv4 Notify Node Address: %s",
731 ipaddr_string(obj_tptr
));
732 obj_tlen
-=sizeof(struct in_addr
);
733 obj_tptr
+=sizeof(struct in_addr
);
736 case RSVP_CTYPE_IPV6
:
737 if (obj_tlen
< sizeof(struct in6_addr
))
739 printf("%s IPv6 Notify Node Address: %s",
741 ip6addr_string(obj_tptr
));
742 obj_tlen
-=sizeof(struct in6_addr
);
743 obj_tptr
+=sizeof(struct in6_addr
);
751 case RSVP_OBJ_SUGGESTED_LABEL
: /* fall through */
752 case RSVP_OBJ_UPSTREAM_LABEL
: /* fall through */
753 case RSVP_OBJ_RECOVERY_LABEL
: /* fall through */
755 switch(rsvp_obj_ctype
) {
757 while(obj_tlen
>= 4 ) {
758 printf("%s Label: %u", ident
, EXTRACT_32BITS(obj_tptr
));
766 printf("%s Generalized Label: %u",
768 EXTRACT_32BITS(obj_tptr
));
775 printf("%s Waveband ID: %u%s Start Label: %u, Stop Label: %u",
777 EXTRACT_32BITS(obj_tptr
),
779 EXTRACT_32BITS(obj_tptr
+4),
780 EXTRACT_32BITS(obj_tptr
+8));
790 switch(rsvp_obj_ctype
) {
794 printf("%s Reservation Style: %s, Flags: [0x%02x]",
796 tok2str(rsvp_resstyle_values
,
798 EXTRACT_24BITS(obj_tptr
+1)),
808 case RSVP_OBJ_SENDER_TEMPLATE
:
809 switch(rsvp_obj_ctype
) {
810 case RSVP_CTYPE_IPV4
:
813 printf("%s Source Address: %s, Source Port: %u",
815 ipaddr_string(obj_tptr
),
816 EXTRACT_16BITS(obj_tptr
+6));
821 case RSVP_CTYPE_IPV6
:
824 printf("%s Source Address: %s, Source Port: %u",
826 ip6addr_string(obj_tptr
),
827 EXTRACT_16BITS(obj_tptr
+18));
832 case RSVP_CTYPE_TUNNEL_IPV4
:
835 printf("%s IPv4 Tunnel Sender Address: %s, LSP-ID: 0x%04x",
837 ipaddr_string(obj_tptr
),
838 EXTRACT_16BITS(obj_tptr
+6));
847 case RSVP_OBJ_LABEL_REQ
:
848 switch(rsvp_obj_ctype
) {
850 while(obj_tlen
>= 4 ) {
851 printf("%s L3 Protocol ID: %s",
853 tok2str(ethertype_values
,
854 "Unknown Protocol (0x%04x)",
855 EXTRACT_16BITS(obj_tptr
+2)));
863 printf("%s L3 Protocol ID: %s",
865 tok2str(ethertype_values
,
866 "Unknown Protocol (0x%04x)",
867 EXTRACT_16BITS(obj_tptr
+2)));
868 printf(",%s merge capability",((*(obj_tptr
+4))&0x80) ? "no" : "" );
869 printf("%s Minimum VPI/VCI: %u/%u",
871 (EXTRACT_16BITS(obj_tptr
+4))&0xfff,
872 (EXTRACT_16BITS(obj_tptr
+6))&0xfff);
873 printf("%s Maximum VPI/VCI: %u/%u",
875 (EXTRACT_16BITS(obj_tptr
+8))&0xfff,
876 (EXTRACT_16BITS(obj_tptr
+10))&0xfff);
883 printf("%s L3 Protocol ID: %s",
885 tok2str(ethertype_values
,
886 "Unknown Protocol (0x%04x)",
887 EXTRACT_16BITS(obj_tptr
+2)));
888 printf("%s Minimum/Maximum DLCI: %u/%u, %s%s bit DLCI",
890 (EXTRACT_32BITS(obj_tptr
+4))&0x7fffff,
891 (EXTRACT_32BITS(obj_tptr
+8))&0x7fffff,
892 (((EXTRACT_16BITS(obj_tptr
+4)>>7)&3) == 0 ) ? "10" : "",
893 (((EXTRACT_16BITS(obj_tptr
+4)>>7)&3) == 2 ) ? "23" : "");
900 printf("%s LSP Encoding Type: %s (%u)",
902 tok2str(gmpls_encoding_values
,
906 printf("%s Switching Type: %s (%u), Payload ID: %s (0x%04x)",
908 tok2str(gmpls_switch_cap_values
,
912 tok2str(gmpls_payload_values
,
914 EXTRACT_16BITS(obj_tptr
+2)),
915 EXTRACT_16BITS(obj_tptr
+2));
926 switch(rsvp_obj_ctype
) {
927 case RSVP_CTYPE_IPV4
:
928 while(obj_tlen
>= 4 ) {
929 printf("%s Subobject Type: %s, length %u",
931 tok2str(rsvp_obj_xro_values
,
933 RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr
)),
936 if (*(obj_tptr
+1) == 0) { /* prevent infinite loops */
937 printf("%s ERROR: zero length ERO subtype",ident
);
941 switch(RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr
)) {
942 case RSVP_OBJ_XRO_IPV4
:
943 printf(", %s, %s/%u, Flags: [%s]",
944 RSVP_OBJ_XRO_MASK_LOOSE(*obj_tptr
) ? "Loose" : "Strict",
945 ipaddr_string(obj_tptr
+2),
947 bittok2str(rsvp_obj_rro_flag_values
,
949 *(obj_tptr
+7))); /* rfc3209 says that this field is rsvd. */
951 obj_tlen
-=*(obj_tptr
+1);
952 obj_tptr
+=*(obj_tptr
+1);
961 switch(rsvp_obj_ctype
) {
966 printf("%s Source Instance: 0x%08x, Destination Instance: 0x%08x",
968 EXTRACT_32BITS(obj_tptr
),
969 EXTRACT_32BITS(obj_tptr
+4));
978 case RSVP_OBJ_RESTART_CAPABILITY
:
979 switch(rsvp_obj_ctype
) {
983 printf("%s Restart Time: %ums, Recovery Time: %ums",
985 EXTRACT_32BITS(obj_tptr
),
986 EXTRACT_32BITS(obj_tptr
+4));
995 case RSVP_OBJ_SESSION_ATTRIBUTE
:
996 switch(rsvp_obj_ctype
) {
997 case RSVP_CTYPE_TUNNEL_IPV4
:
1000 namelen
= *(obj_tptr
+3);
1001 if (obj_tlen
< 4+namelen
)
1003 printf("%s Session Name: ", ident
);
1004 for (i
= 0; i
< namelen
; i
++)
1005 safeputchar(*(obj_tptr
+4+i
));
1006 printf("%s Setup Priority: %u, Holding Priority: %u, Flags: [%s]",
1010 tok2str(rsvp_session_attribute_flag_values
,
1014 obj_tlen
-=4+*(obj_tptr
+3);
1015 obj_tptr
+=4+*(obj_tptr
+3);
1022 case RSVP_OBJ_RSVP_HOP
:
1023 switch(rsvp_obj_ctype
) {
1024 case RSVP_CTYPE_3
: /* fall through - FIXME add TLV parser */
1025 case RSVP_CTYPE_IPV4
:
1028 printf("%s Previous/Next Interface: %s, Logical Interface Handle: 0x%08x",
1030 ipaddr_string(obj_tptr
),
1031 EXTRACT_32BITS(obj_tptr
+4));
1035 hexdump
=TRUE
; /* unless we have a TLV parser lets just hexdump */
1038 case RSVP_CTYPE_4
: /* fall through - FIXME add TLV parser */
1039 case RSVP_CTYPE_IPV6
:
1042 printf("%s Previous/Next Interface: %s, Logical Interface Handle: 0x%08x",
1044 ip6addr_string(obj_tptr
),
1045 EXTRACT_32BITS(obj_tptr
+16));
1048 hexdump
=TRUE
; /* unless we have a TLV parser lets just hexdump */
1056 case RSVP_OBJ_TIME_VALUES
:
1057 switch(rsvp_obj_ctype
) {
1061 printf("%s Refresh Period: %ums",
1063 EXTRACT_32BITS(obj_tptr
));
1072 /* those three objects do share the same semantics */
1073 case RSVP_OBJ_SENDER_TSPEC
:
1074 case RSVP_OBJ_ADSPEC
:
1075 case RSVP_OBJ_FLOWSPEC
:
1076 switch(rsvp_obj_ctype
) {
1080 printf("%s Msg-Version: %u, length: %u",
1082 (*obj_tptr
& 0xf0) >> 4,
1083 EXTRACT_16BITS(obj_tptr
+2)<<2);
1084 obj_tptr
+=4; /* get to the start of the service header */
1087 while (obj_tlen
>= 4) {
1088 intserv_serv_tlen
=EXTRACT_16BITS(obj_tptr
+2)<<2;
1089 printf("%s Service Type: %s (%u), break bit %s set, Service length: %u",
1091 tok2str(rsvp_intserv_service_type_values
,"unknown",*(obj_tptr
)),
1093 (*(obj_tptr
+1)&0x80) ? "" : "not",
1096 obj_tptr
+=4; /* get to the start of the parameter list */
1099 while (intserv_serv_tlen
>=4) {
1100 processed
= rsvp_intserv_print(obj_tptr
, obj_tlen
);
1103 obj_tlen
-=processed
;
1104 intserv_serv_tlen
-=processed
;
1105 obj_tptr
+=processed
;
1114 case RSVP_OBJ_FILTERSPEC
:
1115 switch(rsvp_obj_ctype
) {
1116 case RSVP_CTYPE_IPV4
:
1119 printf("%s Source Address: %s, Source Port: %u",
1121 ipaddr_string(obj_tptr
),
1122 EXTRACT_16BITS(obj_tptr
+6));
1127 case RSVP_CTYPE_IPV6
:
1130 printf("%s Source Address: %s, Source Port: %u",
1132 ip6addr_string(obj_tptr
),
1133 EXTRACT_16BITS(obj_tptr
+18));
1140 printf("%s Source Address: %s, Flow Label: %u",
1142 ip6addr_string(obj_tptr
),
1143 EXTRACT_24BITS(obj_tptr
+17));
1147 case RSVP_CTYPE_TUNNEL_IPV6
:
1150 printf("%s Source Address: %s, LSP-ID: 0x%04x",
1152 ipaddr_string(obj_tptr
),
1153 EXTRACT_16BITS(obj_tptr
+18));
1158 case RSVP_CTYPE_TUNNEL_IPV4
:
1161 printf("%s Source Address: %s, LSP-ID: 0x%04x",
1163 ipaddr_string(obj_tptr
),
1164 EXTRACT_16BITS(obj_tptr
+6));
1173 case RSVP_OBJ_FASTREROUTE
:
1174 /* the differences between c-type 1 and 7 are minor */
1175 obj_ptr
.rsvp_obj_frr
= (const struct rsvp_obj_frr_t
*)obj_tptr
;
1176 bw
.i
= EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->bandwidth
);
1178 switch(rsvp_obj_ctype
) {
1179 case RSVP_CTYPE_1
: /* new style */
1180 if (obj_tlen
< sizeof(struct rsvp_obj_frr_t
))
1182 printf("%s Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps",
1184 (int)obj_ptr
.rsvp_obj_frr
->setup_prio
,
1185 (int)obj_ptr
.rsvp_obj_frr
->hold_prio
,
1186 (int)obj_ptr
.rsvp_obj_frr
->hop_limit
,
1188 printf("%s Include-any: 0x%08x, Exclude-any: 0x%08x, Include-all: 0x%08x",
1190 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->include_any
),
1191 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->exclude_any
),
1192 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->include_all
));
1193 obj_tlen
-=sizeof(struct rsvp_obj_frr_t
);
1194 obj_tptr
+=sizeof(struct rsvp_obj_frr_t
);
1197 case RSVP_CTYPE_TUNNEL_IPV4
: /* old style */
1200 printf("%s Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps",
1202 (int)obj_ptr
.rsvp_obj_frr
->setup_prio
,
1203 (int)obj_ptr
.rsvp_obj_frr
->hold_prio
,
1204 (int)obj_ptr
.rsvp_obj_frr
->hop_limit
,
1206 printf("%s Include Colors: 0x%08x, Exclude Colors: 0x%08x",
1208 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->include_any
),
1209 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->exclude_any
));
1219 case RSVP_OBJ_DETOUR
:
1220 switch(rsvp_obj_ctype
) {
1221 case RSVP_CTYPE_TUNNEL_IPV4
:
1222 while(obj_tlen
>= 8) {
1223 printf("%s PLR-ID: %s, Avoid-Node-ID: %s",
1225 ipaddr_string(obj_tptr
),
1226 ipaddr_string(obj_tptr
+4));
1236 case RSVP_OBJ_CLASSTYPE
:
1237 switch(rsvp_obj_ctype
) {
1241 EXTRACT_32BITS(obj_tptr
)&0x7);
1250 case RSVP_OBJ_ERROR_SPEC
:
1251 switch(rsvp_obj_ctype
) {
1252 case RSVP_CTYPE_3
: /* fall through - FIXME add TLV parser */
1253 case RSVP_CTYPE_IPV4
:
1256 error_code
=*(obj_tptr
+5);
1257 error_value
=EXTRACT_16BITS(obj_tptr
+6);
1258 printf("%s Error Node Address: %s, Flags: [0x%02x]%s Error Code: %s (%u)",
1260 ipaddr_string(obj_tptr
),
1263 tok2str(rsvp_obj_error_code_values
,"unknown",error_code
),
1265 switch (error_code
) {
1266 case RSVP_OBJ_ERROR_SPEC_CODE_ROUTING
:
1267 printf(", Error Value: %s (%u)",
1268 tok2str(rsvp_obj_error_code_routing_values
,"unknown",error_value
),
1271 case RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE
:
1272 printf(", Error Value: %s (%u)",
1273 tok2str(rsvp_obj_error_code_diffserv_te_values
,"unknown",error_value
),
1277 printf(", Unknown Error Value (%u)", error_value
);
1284 case RSVP_CTYPE_4
: /* fall through - FIXME add TLV parser */
1285 case RSVP_CTYPE_IPV6
:
1288 error_code
=*(obj_tptr
+17);
1289 error_value
=EXTRACT_16BITS(obj_tptr
+18);
1290 printf("%s Error Node Address: %s, Flags: [0x%02x]%s Error Code: %s (%u)",
1292 ip6addr_string(obj_tptr
),
1295 tok2str(rsvp_obj_error_code_values
,"unknown",error_code
),
1298 switch (error_code
) {
1299 case RSVP_OBJ_ERROR_SPEC_CODE_ROUTING
:
1300 printf(", Error Value: %s (%u)",
1301 tok2str(rsvp_obj_error_code_routing_values
,"unknown",error_value
),
1316 case RSVP_OBJ_PROPERTIES
:
1317 switch(rsvp_obj_ctype
) {
1321 padbytes
= EXTRACT_16BITS(obj_tptr
+2);
1322 printf("%s TLV count: %u, padding bytes: %u",
1324 EXTRACT_16BITS(obj_tptr
),
1328 /* loop through as long there is anything longer than the TLV header (2) */
1329 while(obj_tlen
>= 2 + padbytes
) {
1330 printf("%s %s TLV (0x%02x), length: %u", /* length includes header */
1332 tok2str(rsvp_obj_prop_tlv_values
,"unknown",*obj_tptr
),
1335 if (obj_tlen
< *(obj_tptr
+1))
1337 if (*(obj_tptr
+1) < 2)
1339 print_unknown_data(obj_tptr
+2,"\n\t\t",*(obj_tptr
+1)-2);
1340 obj_tlen
-=*(obj_tptr
+1);
1341 obj_tptr
+=*(obj_tptr
+1);
1349 case RSVP_OBJ_MESSAGE_ID
: /* fall through */
1350 case RSVP_OBJ_MESSAGE_ID_ACK
: /* fall through */
1351 case RSVP_OBJ_MESSAGE_ID_LIST
:
1352 switch(rsvp_obj_ctype
) {
1356 printf("%s Flags [0x%02x], epoch: %u",
1359 EXTRACT_24BITS(obj_tptr
+1));
1362 /* loop through as long there are no messages left */
1363 while(obj_tlen
>= 4) {
1364 printf("%s Message-ID 0x%08x (%u)",
1366 EXTRACT_32BITS(obj_tptr
),
1367 EXTRACT_32BITS(obj_tptr
));
1377 case RSVP_OBJ_INTEGRITY
:
1378 switch(rsvp_obj_ctype
) {
1380 if (obj_tlen
< sizeof(struct rsvp_obj_integrity_t
))
1382 obj_ptr
.rsvp_obj_integrity
= (const struct rsvp_obj_integrity_t
*)obj_tptr
;
1383 printf("%s Key-ID 0x%04x%08x, Sequence 0x%08x%08x, Flags [%s]",
1385 EXTRACT_16BITS(obj_ptr
.rsvp_obj_integrity
->key_id
),
1386 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->key_id
+2),
1387 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->sequence
),
1388 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->sequence
+4),
1389 bittok2str(rsvp_obj_integrity_flag_values
,
1391 obj_ptr
.rsvp_obj_integrity
->flags
));
1392 printf("%s MD5-sum 0x%08x%08x%08x%08x (unverified)",
1394 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->digest
),
1395 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->digest
+4),
1396 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->digest
+8),
1397 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->digest
+12));
1398 obj_tlen
+=sizeof(struct rsvp_obj_integrity_t
);
1399 obj_tptr
+=sizeof(struct rsvp_obj_integrity_t
);
1407 * FIXME those are the defined objects that lack a decoder
1408 * you are welcome to contribute code ;-)
1411 case RSVP_OBJ_SCOPE
:
1412 case RSVP_OBJ_POLICY_DATA
:
1413 case RSVP_OBJ_LABEL_SET
:
1414 case RSVP_OBJ_ACCEPT_LABEL_SET
:
1415 case RSVP_OBJ_PROTECTION
:
1418 print_unknown_data(obj_tptr
,"\n\t ",obj_tlen
); /* FIXME indentation */
1421 /* do we also want to see a hex dump ? */
1422 if (vflag
> 1 || hexdump
==TRUE
)
1423 print_unknown_data(tptr
+sizeof(sizeof(struct rsvp_object_header
)),"\n\t ", /* FIXME indentation */
1424 rsvp_obj_len
-sizeof(struct rsvp_object_header
));
1431 printf("\n\t\t packet exceeded snapshot");
1437 rsvp_print(register const u_char
*pptr
, register u_int len
) {
1439 const struct rsvp_common_header
*rsvp_com_header
;
1440 const u_char
*tptr
,*subtptr
;
1441 u_short tlen
,subtlen
;
1445 rsvp_com_header
= (const struct rsvp_common_header
*)pptr
;
1446 TCHECK(*rsvp_com_header
);
1449 * Sanity checking of the header.
1451 if (RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
) != RSVP_VERSION
) {
1452 printf("ERROR: RSVP version %u packet not supported",
1453 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
));
1457 /* in non-verbose mode just lets print the basic Message Type*/
1459 printf("RSVPv%u %s Message, length: %u",
1460 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
),
1461 tok2str(rsvp_msg_type_values
, "unknown (%u)",rsvp_com_header
->msg_type
),
1466 /* ok they seem to want to know everything - lets fully decode it */
1468 tlen
=EXTRACT_16BITS(rsvp_com_header
->length
);
1470 printf("\n\tRSVPv%u %s Message (%u), Flags: [%s], length: %u, ttl: %u, checksum: 0x%04x",
1471 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
),
1472 tok2str(rsvp_msg_type_values
, "unknown, type: %u",rsvp_com_header
->msg_type
),
1473 rsvp_com_header
->msg_type
,
1474 bittok2str(rsvp_header_flag_values
,"none",RSVP_EXTRACT_FLAGS(rsvp_com_header
->version_flags
)),
1476 rsvp_com_header
->ttl
,
1477 EXTRACT_16BITS(rsvp_com_header
->checksum
));
1479 if (tlen
< sizeof(const struct rsvp_common_header
)) {
1480 printf("ERROR: common header too short %u < %lu", tlen
,
1481 (unsigned long)sizeof(const struct rsvp_common_header
));
1485 tptr
+=sizeof(const struct rsvp_common_header
);
1486 tlen
-=sizeof(const struct rsvp_common_header
);
1488 switch(rsvp_com_header
->msg_type
) {
1490 case RSVP_MSGTYPE_AGGREGATE
:
1493 rsvp_com_header
= (const struct rsvp_common_header
*)subtptr
;
1494 TCHECK(*rsvp_com_header
);
1497 * Sanity checking of the header.
1499 if (RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
) != RSVP_VERSION
) {
1500 printf("ERROR: RSVP version %u packet not supported",
1501 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
));
1504 subtlen
=EXTRACT_16BITS(rsvp_com_header
->length
);
1506 printf("\n\t RSVPv%u %s Message (%u), Flags: [%s], length: %u, ttl: %u, checksum: 0x%04x",
1507 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
),
1508 tok2str(rsvp_msg_type_values
, "unknown, type: %u",rsvp_com_header
->msg_type
),
1509 rsvp_com_header
->msg_type
,
1510 bittok2str(rsvp_header_flag_values
,"none",RSVP_EXTRACT_FLAGS(rsvp_com_header
->version_flags
)),
1512 rsvp_com_header
->ttl
,
1513 EXTRACT_16BITS(rsvp_com_header
->checksum
));
1515 if (subtlen
< sizeof(const struct rsvp_common_header
)) {
1516 printf("ERROR: common header too short %u < %lu", subtlen
,
1517 (unsigned long)sizeof(const struct rsvp_common_header
));
1521 if (tlen
< subtlen
) {
1522 printf("ERROR: common header too large %u > %u", subtlen
,
1527 subtptr
+=sizeof(const struct rsvp_common_header
);
1528 subtlen
-=sizeof(const struct rsvp_common_header
);
1530 if (rsvp_obj_print(subtptr
,"\n\t ", subtlen
) == -1)
1533 tptr
+=subtlen
+sizeof(const struct rsvp_common_header
);
1534 tlen
-=subtlen
+sizeof(const struct rsvp_common_header
);
1539 case RSVP_MSGTYPE_PATH
:
1540 case RSVP_MSGTYPE_RESV
:
1541 case RSVP_MSGTYPE_PATHERR
:
1542 case RSVP_MSGTYPE_RESVERR
:
1543 case RSVP_MSGTYPE_PATHTEAR
:
1544 case RSVP_MSGTYPE_RESVTEAR
:
1545 case RSVP_MSGTYPE_RESVCONF
:
1546 case RSVP_MSGTYPE_HELLO_OLD
:
1547 case RSVP_MSGTYPE_HELLO
:
1548 case RSVP_MSGTYPE_ACK
:
1549 case RSVP_MSGTYPE_SREFRESH
:
1550 if (rsvp_obj_print(tptr
,"\n\t ", tlen
) == -1)
1555 print_unknown_data(tptr
,"\n\t ",tlen
);
1561 printf("\n\t\t packet exceeded snapshot");