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.41 2005-09-22 14:47:04 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_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
, "1" },
242 { 256*RSVP_OBJ_MESSAGE_ID_LIST
+RSVP_CTYPE_1
, "1" },
243 { 256*RSVP_OBJ_STYLE
+RSVP_CTYPE_1
, "1" },
244 { 256*RSVP_OBJ_HELLO
+RSVP_CTYPE_1
, "Hello Request" },
245 { 256*RSVP_OBJ_HELLO
+RSVP_CTYPE_2
, "Hello Ack" },
246 { 256*RSVP_OBJ_LABEL_REQ
+RSVP_CTYPE_1
, "without label range" },
247 { 256*RSVP_OBJ_LABEL_REQ
+RSVP_CTYPE_2
, "with ATM label range" },
248 { 256*RSVP_OBJ_LABEL_REQ
+RSVP_CTYPE_3
, "with FR label range" },
249 { 256*RSVP_OBJ_LABEL_REQ
+RSVP_CTYPE_4
, "Generalized Label" },
250 { 256*RSVP_OBJ_LABEL
+RSVP_CTYPE_1
, "Label" },
251 { 256*RSVP_OBJ_LABEL
+RSVP_CTYPE_2
, "Generalized Label" },
252 { 256*RSVP_OBJ_LABEL
+RSVP_CTYPE_3
, "Waveband Switching" },
253 { 256*RSVP_OBJ_SUGGESTED_LABEL
+RSVP_CTYPE_1
, "Label" },
254 { 256*RSVP_OBJ_SUGGESTED_LABEL
+RSVP_CTYPE_2
, "Generalized Label" },
255 { 256*RSVP_OBJ_SUGGESTED_LABEL
+RSVP_CTYPE_3
, "Waveband Switching" },
256 { 256*RSVP_OBJ_UPSTREAM_LABEL
+RSVP_CTYPE_1
, "Label" },
257 { 256*RSVP_OBJ_UPSTREAM_LABEL
+RSVP_CTYPE_2
, "Generalized Label" },
258 { 256*RSVP_OBJ_UPSTREAM_LABEL
+RSVP_CTYPE_3
, "Waveband Switching" },
259 { 256*RSVP_OBJ_RECOVERY_LABEL
+RSVP_CTYPE_1
, "Label" },
260 { 256*RSVP_OBJ_RECOVERY_LABEL
+RSVP_CTYPE_2
, "Generalized Label" },
261 { 256*RSVP_OBJ_RECOVERY_LABEL
+RSVP_CTYPE_3
, "Waveband Switching" },
262 { 256*RSVP_OBJ_ERO
+RSVP_CTYPE_IPV4
, "IPv4" },
263 { 256*RSVP_OBJ_RRO
+RSVP_CTYPE_IPV4
, "IPv4" },
264 { 256*RSVP_OBJ_ERROR_SPEC
+RSVP_CTYPE_IPV4
, "IPv4" },
265 { 256*RSVP_OBJ_ERROR_SPEC
+RSVP_CTYPE_IPV6
, "IPv6" },
266 { 256*RSVP_OBJ_ERROR_SPEC
+RSVP_CTYPE_3
, "IPv4 plus opt. TLVs" },
267 { 256*RSVP_OBJ_ERROR_SPEC
+RSVP_CTYPE_4
, "IPv6 plus opt. TLVs" },
268 { 256*RSVP_OBJ_RESTART_CAPABILITY
+RSVP_CTYPE_1
, "IPv4" },
269 { 256*RSVP_OBJ_SESSION_ATTRIBUTE
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
270 { 256*RSVP_OBJ_FASTREROUTE
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" }, /* old style*/
271 { 256*RSVP_OBJ_FASTREROUTE
+RSVP_CTYPE_1
, "1" }, /* new style */
272 { 256*RSVP_OBJ_DETOUR
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
273 { 256*RSVP_OBJ_PROPERTIES
+RSVP_CTYPE_1
, "1" },
274 { 256*RSVP_OBJ_CLASSTYPE
+RSVP_CTYPE_1
, "1" },
275 { 256*RSVP_OBJ_CLASSTYPE_OLD
+RSVP_CTYPE_1
, "1" },
279 struct rsvp_obj_integrity_t
{
283 u_int8_t sequence
[8];
287 static const struct tok rsvp_obj_integrity_flag_values
[] = {
288 { 0x80, "Handshake" },
292 struct rsvp_obj_frr_t
{
297 u_int8_t bandwidth
[4];
298 u_int8_t include_any
[4];
299 u_int8_t exclude_any
[4];
300 u_int8_t include_all
[4];
304 #define RSVP_OBJ_XRO_MASK_SUBOBJ(x) ((x)&0x7f)
305 #define RSVP_OBJ_XRO_MASK_LOOSE(x) ((x)&0x80)
307 #define RSVP_OBJ_XRO_RES 0
308 #define RSVP_OBJ_XRO_IPV4 1
309 #define RSVP_OBJ_XRO_IPV6 2
310 #define RSVP_OBJ_XRO_ASN 32
311 #define RSVP_OBJ_XRO_MPLS 64
313 static const struct tok rsvp_obj_xro_values
[] = {
314 { RSVP_OBJ_XRO_RES
, "Reserved" },
315 { RSVP_OBJ_XRO_IPV4
, "IPv4 prefix" },
316 { RSVP_OBJ_XRO_IPV6
, "IPv6 prefix" },
317 { RSVP_OBJ_XRO_ASN
, "Autonomous system number" },
318 { RSVP_OBJ_XRO_MPLS
, "MPLS label switched path termination" },
322 /* draft-ietf-mpls-rsvp-lsp-fastreroute-07.txt */
323 static const struct tok rsvp_obj_rro_flag_values
[] = {
324 { 0x01, "Local protection available" },
325 { 0x02, "Local protection in use" },
326 { 0x04, "Bandwidth protection" },
327 { 0x08, "Node protection" },
331 static const struct tok rsvp_resstyle_values
[] = {
332 { 17, "Wildcard Filter" },
333 { 10, "Fixed Filter" },
334 { 18, "Shared Explicit" },
338 #define RSVP_OBJ_INTSERV_GUARANTEED_SERV 2
339 #define RSVP_OBJ_INTSERV_CONTROLLED_LOAD 5
341 static const struct tok rsvp_intserv_service_type_values
[] = {
342 { 1, "Default/Global Information" },
343 { RSVP_OBJ_INTSERV_GUARANTEED_SERV
, "Guaranteed Service" },
344 { RSVP_OBJ_INTSERV_CONTROLLED_LOAD
, "Controlled Load" },
348 static const struct tok rsvp_intserv_parameter_id_values
[] = {
350 { 6, "Path b/w estimate" },
351 { 8, "Minimum path latency" },
352 { 10, "Composed MTU" },
353 { 127, "Token Bucket TSpec" },
354 { 130, "Guaranteed Service RSpec" },
355 { 133, "End-to-end composed value for C" },
356 { 134, "End-to-end composed value for D" },
357 { 135, "Since-last-reshaping point composed C" },
358 { 136, "Since-last-reshaping point composed D" },
362 static struct tok rsvp_session_attribute_flag_values
[] = {
363 { 0x01, "Local Protection desired" },
364 { 0x02, "Label Recording desired" },
365 { 0x04, "SE Style desired" },
366 { 0x08, "Bandwidth protection desired" }, /* draft-ietf-mpls-rsvp-lsp-fastreroute-02.txt */
367 { 0x10, "Node protection desired" }, /* draft-ietf-mpls-rsvp-lsp-fastreroute-02.txt */
371 static struct tok rsvp_obj_prop_tlv_values
[] = {
373 { 0x02, "Metric 1" },
374 { 0x04, "Metric 2" },
375 { 0x08, "CCC Status" },
376 { 0x10, "Path Type" },
380 #define RSVP_OBJ_ERROR_SPEC_CODE_ROUTING 24
381 #define RSVP_OBJ_ERROR_SPEC_CODE_NOTIFY 25
382 #define RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE 28
383 #define RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE_OLD 125
385 static struct tok rsvp_obj_error_code_values
[] = {
386 { RSVP_OBJ_ERROR_SPEC_CODE_ROUTING
, "Routing Problem" },
387 { RSVP_OBJ_ERROR_SPEC_CODE_NOTIFY
, "Notify Error" },
388 { RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE
, "Diffserv TE Error" },
389 { RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE_OLD
, "Diffserv TE Error (Old)" },
393 static struct tok rsvp_obj_error_code_routing_values
[] = {
394 { 1, "Bad EXPLICIT_ROUTE object" },
395 { 2, "Bad strict node" },
396 { 3, "Bad loose node" },
397 { 4, "Bad initial subobject" },
398 { 5, "No route available toward destination" },
399 { 6, "Unacceptable label value" },
400 { 7, "RRO indicated routing loops" },
401 { 8, "non-RSVP-capable router in the path" },
402 { 9, "MPLS label allocation failure" },
403 { 10, "Unsupported L3PID" },
407 static struct tok rsvp_obj_error_code_diffserv_te_values
[] = {
408 { 1, "Unexpected CT object" },
409 { 2, "Unsupported CT" },
410 { 3, "Invalid CT value" },
411 { 4, "CT/setup priority do not form a configured TE-Class" },
412 { 5, "CT/holding priority do not form a configured TE-Class" },
413 { 6, "CT/setup priority and CT/holding priority do not form a configured TE-Class" },
414 { 7, "Inconsistency between signaled PSC and signaled CT" },
415 { 8, "Inconsistency between signaled PHBs and signaled CT" },
423 static int rsvp_intserv_print(const u_char
*, u_short
);
426 * this is a dissector for all the intserv defined
427 * specs as defined per rfc2215
428 * it is called from various rsvp objects;
429 * returns the amount of bytes being processed
432 rsvp_intserv_print(const u_char
*tptr
, u_short obj_tlen
) {
434 int parameter_id
,parameter_length
;
442 parameter_id
= *(tptr
);
443 parameter_length
= EXTRACT_16BITS(tptr
+2)<<2; /* convert wordcount to bytecount */
445 printf("\n\t Parameter ID: %s (%u), length: %u, Flags: [0x%02x]",
446 tok2str(rsvp_intserv_parameter_id_values
,"unknown",parameter_id
),
451 if (obj_tlen
< parameter_length
+4)
453 switch(parameter_id
) { /* parameter_id */
457 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
458 * | 4 (e) | (f) | 1 (g) |
459 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
460 * | IS hop cnt (32-bit unsigned integer) |
461 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
463 if (parameter_length
== 4)
464 printf("\n\t\tIS hop count: %u", EXTRACT_32BITS(tptr
+4));
469 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
470 * | 6 (h) | (i) | 1 (j) |
471 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
472 * | Path b/w estimate (32-bit IEEE floating point number) |
473 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
475 if (parameter_length
== 4) {
476 bw
.i
= EXTRACT_32BITS(tptr
+4);
477 printf("\n\t\tPath b/w estimate: %.10g Mbps", bw
.f
/125000);
483 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
484 * | 8 (k) | (l) | 1 (m) |
485 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
486 * | Minimum path latency (32-bit integer) |
487 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
489 if (parameter_length
== 4) {
490 printf("\n\t\tMinimum path latency: ");
491 if (EXTRACT_32BITS(tptr
+4) == 0xffffffff)
492 printf("don't care");
494 printf("%u", EXTRACT_32BITS(tptr
+4));
501 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
502 * | 10 (n) | (o) | 1 (p) |
503 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
504 * | Composed MTU (32-bit unsigned integer) |
505 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
507 if (parameter_length
== 4)
508 printf("\n\t\tComposed MTU: %u bytes", EXTRACT_32BITS(tptr
+4));
512 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
513 * | 127 (e) | 0 (f) | 5 (g) |
514 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
515 * | Token Bucket Rate [r] (32-bit IEEE floating point number) |
516 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
517 * | Token Bucket Size [b] (32-bit IEEE floating point number) |
518 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
519 * | Peak Data Rate [p] (32-bit IEEE floating point number) |
520 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
521 * | Minimum Policed Unit [m] (32-bit integer) |
522 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
523 * | Maximum Packet Size [M] (32-bit integer) |
524 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
527 if (parameter_length
== 20) {
528 bw
.i
= EXTRACT_32BITS(tptr
+4);
529 printf("\n\t\tToken Bucket Rate: %.10g Mbps", bw
.f
/125000);
530 bw
.i
= EXTRACT_32BITS(tptr
+8);
531 printf("\n\t\tToken Bucket Size: %.10g bytes", bw
.f
);
532 bw
.i
= EXTRACT_32BITS(tptr
+12);
533 printf("\n\t\tPeak Data Rate: %.10g Mbps", bw
.f
/125000);
534 printf("\n\t\tMinimum Policed Unit: %u bytes", EXTRACT_32BITS(tptr
+16));
535 printf("\n\t\tMaximum Packet Size: %u bytes", EXTRACT_32BITS(tptr
+20));
541 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
542 * | 130 (h) | 0 (i) | 2 (j) |
543 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
544 * | Rate [R] (32-bit IEEE floating point number) |
545 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
546 * | Slack Term [S] (32-bit integer) |
547 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
550 if (parameter_length
== 8) {
551 bw
.i
= EXTRACT_32BITS(tptr
+4);
552 printf("\n\t\tRate: %.10g Mbps", bw
.f
/125000);
553 printf("\n\t\tSlack Term: %u", EXTRACT_32BITS(tptr
+8));
561 if (parameter_length
== 4)
562 printf("\n\t\tValue: %u", EXTRACT_32BITS(tptr
+4));
567 print_unknown_data(tptr
+4,"\n\t\t",parameter_length
);
569 return (parameter_length
+4); /* header length 4 bytes */
573 rsvp_obj_print (const u_char
*tptr
, const char *ident
, u_int tlen
) {
575 const struct rsvp_object_header
*rsvp_obj_header
;
576 const u_char
*obj_tptr
;
578 const struct rsvp_obj_integrity_t
*rsvp_obj_integrity
;
579 const struct rsvp_obj_frr_t
*rsvp_obj_frr
;
582 u_short rsvp_obj_len
,rsvp_obj_ctype
,obj_tlen
,intserv_serv_tlen
;
583 int hexdump
,processed
,padbytes
,error_code
,error_value
,i
;
590 while(tlen
>=sizeof(struct rsvp_object_header
)) {
591 /* did we capture enough for fully decoding the object header ? */
592 if (!TTEST2(*tptr
, sizeof(struct rsvp_object_header
)))
595 rsvp_obj_header
= (const struct rsvp_object_header
*)tptr
;
596 rsvp_obj_len
=EXTRACT_16BITS(rsvp_obj_header
->length
);
597 rsvp_obj_ctype
=rsvp_obj_header
->ctype
;
599 if(rsvp_obj_len
% 4) {
600 printf("%sERROR: object header size %u not a multiple of 4", ident
, rsvp_obj_len
);
603 if(rsvp_obj_len
< sizeof(struct rsvp_object_header
)) {
604 printf("%sERROR: object header too short %u < %lu", ident
, rsvp_obj_len
,
605 (unsigned long)sizeof(const struct rsvp_object_header
));
609 printf("%s%s Object (%u) Flags: [%s",
611 tok2str(rsvp_obj_values
,
613 rsvp_obj_header
->class_num
),
614 rsvp_obj_header
->class_num
,
615 ((rsvp_obj_header
->class_num
)&0x80) ? "ignore" : "reject");
617 if (rsvp_obj_header
->class_num
> 128)
619 ((rsvp_obj_header
->class_num
)&0x40) ? "and forward" : "silently");
621 printf(" if unknown], Class-Type: %s (%u), length: %u",
622 tok2str(rsvp_ctype_values
,
624 ((rsvp_obj_header
->class_num
)<<8)+rsvp_obj_ctype
),
628 if(tlen
< rsvp_obj_len
) {
629 printf("%sERROR: object goes past end of objects TLV", ident
);
633 obj_tptr
=tptr
+sizeof(struct rsvp_object_header
);
634 obj_tlen
=rsvp_obj_len
-sizeof(struct rsvp_object_header
);
636 /* did we capture enough for fully decoding the object ? */
637 if (!TTEST2(*tptr
, rsvp_obj_len
))
641 switch(rsvp_obj_header
->class_num
) {
642 case RSVP_OBJ_SESSION
:
643 switch(rsvp_obj_ctype
) {
644 case RSVP_CTYPE_IPV4
:
647 printf("%s IPv4 DestAddress: %s, Protocol ID: 0x%02x",
649 ipaddr_string(obj_tptr
),
650 *(obj_tptr
+sizeof(struct in_addr
)));
651 printf("%s Flags: [0x%02x], DestPort %u",
654 EXTRACT_16BITS(obj_tptr
+6));
659 case RSVP_CTYPE_IPV6
:
662 printf("%s IPv6 DestAddress: %s, Protocol ID: 0x%02x",
664 ip6addr_string(obj_tptr
),
665 *(obj_tptr
+sizeof(struct in6_addr
)));
666 printf("%s Flags: [0x%02x], DestPort %u",
668 *(obj_tptr
+sizeof(struct in6_addr
)+1),
669 EXTRACT_16BITS(obj_tptr
+sizeof(struct in6_addr
)+2));
674 case RSVP_CTYPE_TUNNEL_IPV6
:
677 printf("%s IPv6 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
679 ip6addr_string(obj_tptr
),
680 EXTRACT_16BITS(obj_tptr
+18),
681 ip6addr_string(obj_tptr
+20));
686 case RSVP_CTYPE_TUNNEL_IPV4
:
689 printf("%s IPv4 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
691 ipaddr_string(obj_tptr
),
692 EXTRACT_16BITS(obj_tptr
+6),
693 ipaddr_string(obj_tptr
+8));
702 case RSVP_OBJ_CONFIRM
:
703 switch(rsvp_obj_ctype
) {
704 case RSVP_CTYPE_IPV4
:
705 if (obj_tlen
< sizeof(struct in_addr
))
707 printf("%s IPv4 Receiver Address: %s",
709 ipaddr_string(obj_tptr
));
710 obj_tlen
-=sizeof(struct in_addr
);
711 obj_tptr
+=sizeof(struct in_addr
);
714 case RSVP_CTYPE_IPV6
:
715 if (obj_tlen
< sizeof(struct in6_addr
))
717 printf("%s IPv6 Receiver Address: %s",
719 ip6addr_string(obj_tptr
));
720 obj_tlen
-=sizeof(struct in6_addr
);
721 obj_tptr
+=sizeof(struct in6_addr
);
729 case RSVP_OBJ_NOTIFY_REQ
:
730 switch(rsvp_obj_ctype
) {
731 case RSVP_CTYPE_IPV4
:
732 if (obj_tlen
< sizeof(struct in_addr
))
734 printf("%s IPv4 Notify Node Address: %s",
736 ipaddr_string(obj_tptr
));
737 obj_tlen
-=sizeof(struct in_addr
);
738 obj_tptr
+=sizeof(struct in_addr
);
741 case RSVP_CTYPE_IPV6
:
742 if (obj_tlen
< sizeof(struct in6_addr
))
744 printf("%s IPv6 Notify Node Address: %s",
746 ip6addr_string(obj_tptr
));
747 obj_tlen
-=sizeof(struct in6_addr
);
748 obj_tptr
+=sizeof(struct in6_addr
);
756 case RSVP_OBJ_SUGGESTED_LABEL
: /* fall through */
757 case RSVP_OBJ_UPSTREAM_LABEL
: /* fall through */
758 case RSVP_OBJ_RECOVERY_LABEL
: /* fall through */
760 switch(rsvp_obj_ctype
) {
762 while(obj_tlen
>= 4 ) {
763 printf("%s Label: %u", ident
, EXTRACT_32BITS(obj_tptr
));
771 printf("%s Generalized Label: %u",
773 EXTRACT_32BITS(obj_tptr
));
780 printf("%s Waveband ID: %u%s Start Label: %u, Stop Label: %u",
782 EXTRACT_32BITS(obj_tptr
),
784 EXTRACT_32BITS(obj_tptr
+4),
785 EXTRACT_32BITS(obj_tptr
+8));
795 switch(rsvp_obj_ctype
) {
799 printf("%s Reservation Style: %s, Flags: [0x%02x]",
801 tok2str(rsvp_resstyle_values
,
803 EXTRACT_24BITS(obj_tptr
+1)),
813 case RSVP_OBJ_SENDER_TEMPLATE
:
814 switch(rsvp_obj_ctype
) {
815 case RSVP_CTYPE_IPV4
:
818 printf("%s Source Address: %s, Source Port: %u",
820 ipaddr_string(obj_tptr
),
821 EXTRACT_16BITS(obj_tptr
+6));
826 case RSVP_CTYPE_IPV6
:
829 printf("%s Source Address: %s, Source Port: %u",
831 ip6addr_string(obj_tptr
),
832 EXTRACT_16BITS(obj_tptr
+18));
837 case RSVP_CTYPE_TUNNEL_IPV4
:
840 printf("%s IPv4 Tunnel Sender Address: %s, LSP-ID: 0x%04x",
842 ipaddr_string(obj_tptr
),
843 EXTRACT_16BITS(obj_tptr
+6));
852 case RSVP_OBJ_LABEL_REQ
:
853 switch(rsvp_obj_ctype
) {
855 while(obj_tlen
>= 4 ) {
856 printf("%s L3 Protocol ID: %s",
858 tok2str(ethertype_values
,
859 "Unknown Protocol (0x%04x)",
860 EXTRACT_16BITS(obj_tptr
+2)));
868 printf("%s L3 Protocol ID: %s",
870 tok2str(ethertype_values
,
871 "Unknown Protocol (0x%04x)",
872 EXTRACT_16BITS(obj_tptr
+2)));
873 printf(",%s merge capability",((*(obj_tptr
+4))&0x80) ? "no" : "" );
874 printf("%s Minimum VPI/VCI: %u/%u",
876 (EXTRACT_16BITS(obj_tptr
+4))&0xfff,
877 (EXTRACT_16BITS(obj_tptr
+6))&0xfff);
878 printf("%s Maximum VPI/VCI: %u/%u",
880 (EXTRACT_16BITS(obj_tptr
+8))&0xfff,
881 (EXTRACT_16BITS(obj_tptr
+10))&0xfff);
888 printf("%s L3 Protocol ID: %s",
890 tok2str(ethertype_values
,
891 "Unknown Protocol (0x%04x)",
892 EXTRACT_16BITS(obj_tptr
+2)));
893 printf("%s Minimum/Maximum DLCI: %u/%u, %s%s bit DLCI",
895 (EXTRACT_32BITS(obj_tptr
+4))&0x7fffff,
896 (EXTRACT_32BITS(obj_tptr
+8))&0x7fffff,
897 (((EXTRACT_16BITS(obj_tptr
+4)>>7)&3) == 0 ) ? "10" : "",
898 (((EXTRACT_16BITS(obj_tptr
+4)>>7)&3) == 2 ) ? "23" : "");
905 printf("%s LSP Encoding Type: %s (%u)",
907 tok2str(gmpls_encoding_values
,
911 printf("%s Switching Type: %s (%u), Payload ID: %s (0x%04x)",
913 tok2str(gmpls_switch_cap_values
,
917 tok2str(gmpls_payload_values
,
919 EXTRACT_16BITS(obj_tptr
+2)),
920 EXTRACT_16BITS(obj_tptr
+2));
931 switch(rsvp_obj_ctype
) {
932 case RSVP_CTYPE_IPV4
:
933 while(obj_tlen
>= 4 ) {
934 printf("%s Subobject Type: %s, length %u",
936 tok2str(rsvp_obj_xro_values
,
938 RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr
)),
941 if (*(obj_tptr
+1) == 0) { /* prevent infinite loops */
942 printf("%s ERROR: zero length ERO subtype",ident
);
946 switch(RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr
)) {
947 case RSVP_OBJ_XRO_IPV4
:
948 printf(", %s, %s/%u, Flags: [%s]",
949 RSVP_OBJ_XRO_MASK_LOOSE(*obj_tptr
) ? "Loose" : "Strict",
950 ipaddr_string(obj_tptr
+2),
952 bittok2str(rsvp_obj_rro_flag_values
,
954 *(obj_tptr
+7))); /* rfc3209 says that this field is rsvd. */
956 obj_tlen
-=*(obj_tptr
+1);
957 obj_tptr
+=*(obj_tptr
+1);
966 switch(rsvp_obj_ctype
) {
971 printf("%s Source Instance: 0x%08x, Destination Instance: 0x%08x",
973 EXTRACT_32BITS(obj_tptr
),
974 EXTRACT_32BITS(obj_tptr
+4));
983 case RSVP_OBJ_RESTART_CAPABILITY
:
984 switch(rsvp_obj_ctype
) {
988 printf("%s Restart Time: %ums, Recovery Time: %ums",
990 EXTRACT_32BITS(obj_tptr
),
991 EXTRACT_32BITS(obj_tptr
+4));
1000 case RSVP_OBJ_SESSION_ATTRIBUTE
:
1001 switch(rsvp_obj_ctype
) {
1002 case RSVP_CTYPE_TUNNEL_IPV4
:
1005 namelen
= *(obj_tptr
+3);
1006 if (obj_tlen
< 4+namelen
)
1008 printf("%s Session Name: ", ident
);
1009 for (i
= 0; i
< namelen
; i
++)
1010 safeputchar(*(obj_tptr
+4+i
));
1011 printf("%s Setup Priority: %u, Holding Priority: %u, Flags: [%s]",
1015 tok2str(rsvp_session_attribute_flag_values
,
1019 obj_tlen
-=4+*(obj_tptr
+3);
1020 obj_tptr
+=4+*(obj_tptr
+3);
1027 case RSVP_OBJ_RSVP_HOP
:
1028 switch(rsvp_obj_ctype
) {
1029 case RSVP_CTYPE_3
: /* fall through - FIXME add TLV parser */
1030 case RSVP_CTYPE_IPV4
:
1033 printf("%s Previous/Next Interface: %s, Logical Interface Handle: 0x%08x",
1035 ipaddr_string(obj_tptr
),
1036 EXTRACT_32BITS(obj_tptr
+4));
1040 hexdump
=TRUE
; /* unless we have a TLV parser lets just hexdump */
1043 case RSVP_CTYPE_4
: /* fall through - FIXME add TLV parser */
1044 case RSVP_CTYPE_IPV6
:
1047 printf("%s Previous/Next Interface: %s, Logical Interface Handle: 0x%08x",
1049 ip6addr_string(obj_tptr
),
1050 EXTRACT_32BITS(obj_tptr
+16));
1053 hexdump
=TRUE
; /* unless we have a TLV parser lets just hexdump */
1061 case RSVP_OBJ_TIME_VALUES
:
1062 switch(rsvp_obj_ctype
) {
1066 printf("%s Refresh Period: %ums",
1068 EXTRACT_32BITS(obj_tptr
));
1077 /* those three objects do share the same semantics */
1078 case RSVP_OBJ_SENDER_TSPEC
:
1079 case RSVP_OBJ_ADSPEC
:
1080 case RSVP_OBJ_FLOWSPEC
:
1081 switch(rsvp_obj_ctype
) {
1085 printf("%s Msg-Version: %u, length: %u",
1087 (*obj_tptr
& 0xf0) >> 4,
1088 EXTRACT_16BITS(obj_tptr
+2)<<2);
1089 obj_tptr
+=4; /* get to the start of the service header */
1092 while (obj_tlen
>= 4) {
1093 intserv_serv_tlen
=EXTRACT_16BITS(obj_tptr
+2)<<2;
1094 printf("%s Service Type: %s (%u), break bit %s set, Service length: %u",
1096 tok2str(rsvp_intserv_service_type_values
,"unknown",*(obj_tptr
)),
1098 (*(obj_tptr
+1)&0x80) ? "" : "not",
1101 obj_tptr
+=4; /* get to the start of the parameter list */
1104 while (intserv_serv_tlen
>=4) {
1105 processed
= rsvp_intserv_print(obj_tptr
, obj_tlen
);
1108 obj_tlen
-=processed
;
1109 intserv_serv_tlen
-=processed
;
1110 obj_tptr
+=processed
;
1119 case RSVP_OBJ_FILTERSPEC
:
1120 switch(rsvp_obj_ctype
) {
1121 case RSVP_CTYPE_IPV4
:
1124 printf("%s Source Address: %s, Source Port: %u",
1126 ipaddr_string(obj_tptr
),
1127 EXTRACT_16BITS(obj_tptr
+6));
1132 case RSVP_CTYPE_IPV6
:
1135 printf("%s Source Address: %s, Source Port: %u",
1137 ip6addr_string(obj_tptr
),
1138 EXTRACT_16BITS(obj_tptr
+18));
1145 printf("%s Source Address: %s, Flow Label: %u",
1147 ip6addr_string(obj_tptr
),
1148 EXTRACT_24BITS(obj_tptr
+17));
1152 case RSVP_CTYPE_TUNNEL_IPV6
:
1155 printf("%s Source Address: %s, LSP-ID: 0x%04x",
1157 ipaddr_string(obj_tptr
),
1158 EXTRACT_16BITS(obj_tptr
+18));
1163 case RSVP_CTYPE_TUNNEL_IPV4
:
1166 printf("%s Source Address: %s, LSP-ID: 0x%04x",
1168 ipaddr_string(obj_tptr
),
1169 EXTRACT_16BITS(obj_tptr
+6));
1178 case RSVP_OBJ_FASTREROUTE
:
1179 /* the differences between c-type 1 and 7 are minor */
1180 obj_ptr
.rsvp_obj_frr
= (const struct rsvp_obj_frr_t
*)obj_tptr
;
1181 bw
.i
= EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->bandwidth
);
1183 switch(rsvp_obj_ctype
) {
1184 case RSVP_CTYPE_1
: /* new style */
1185 if (obj_tlen
< sizeof(struct rsvp_obj_frr_t
))
1187 printf("%s Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps",
1189 (int)obj_ptr
.rsvp_obj_frr
->setup_prio
,
1190 (int)obj_ptr
.rsvp_obj_frr
->hold_prio
,
1191 (int)obj_ptr
.rsvp_obj_frr
->hop_limit
,
1193 printf("%s Include-any: 0x%08x, Exclude-any: 0x%08x, Include-all: 0x%08x",
1195 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->include_any
),
1196 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->exclude_any
),
1197 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->include_all
));
1198 obj_tlen
-=sizeof(struct rsvp_obj_frr_t
);
1199 obj_tptr
+=sizeof(struct rsvp_obj_frr_t
);
1202 case RSVP_CTYPE_TUNNEL_IPV4
: /* old style */
1205 printf("%s Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps",
1207 (int)obj_ptr
.rsvp_obj_frr
->setup_prio
,
1208 (int)obj_ptr
.rsvp_obj_frr
->hold_prio
,
1209 (int)obj_ptr
.rsvp_obj_frr
->hop_limit
,
1211 printf("%s Include Colors: 0x%08x, Exclude Colors: 0x%08x",
1213 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->include_any
),
1214 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->exclude_any
));
1224 case RSVP_OBJ_DETOUR
:
1225 switch(rsvp_obj_ctype
) {
1226 case RSVP_CTYPE_TUNNEL_IPV4
:
1227 while(obj_tlen
>= 8) {
1228 printf("%s PLR-ID: %s, Avoid-Node-ID: %s",
1230 ipaddr_string(obj_tptr
),
1231 ipaddr_string(obj_tptr
+4));
1241 case RSVP_OBJ_CLASSTYPE
:
1242 case RSVP_OBJ_CLASSTYPE_OLD
: /* fall through */
1243 switch(rsvp_obj_ctype
) {
1247 EXTRACT_32BITS(obj_tptr
)&0x7);
1256 case RSVP_OBJ_ERROR_SPEC
:
1257 switch(rsvp_obj_ctype
) {
1258 case RSVP_CTYPE_3
: /* fall through - FIXME add TLV parser */
1259 case RSVP_CTYPE_IPV4
:
1262 error_code
=*(obj_tptr
+5);
1263 error_value
=EXTRACT_16BITS(obj_tptr
+6);
1264 printf("%s Error Node Address: %s, Flags: [0x%02x]%s Error Code: %s (%u)",
1266 ipaddr_string(obj_tptr
),
1269 tok2str(rsvp_obj_error_code_values
,"unknown",error_code
),
1271 switch (error_code
) {
1272 case RSVP_OBJ_ERROR_SPEC_CODE_ROUTING
:
1273 printf(", Error Value: %s (%u)",
1274 tok2str(rsvp_obj_error_code_routing_values
,"unknown",error_value
),
1277 case RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE
: /* fall through */
1278 case RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE_OLD
:
1279 printf(", Error Value: %s (%u)",
1280 tok2str(rsvp_obj_error_code_diffserv_te_values
,"unknown",error_value
),
1284 printf(", Unknown Error Value (%u)", error_value
);
1291 case RSVP_CTYPE_4
: /* fall through - FIXME add TLV parser */
1292 case RSVP_CTYPE_IPV6
:
1295 error_code
=*(obj_tptr
+17);
1296 error_value
=EXTRACT_16BITS(obj_tptr
+18);
1297 printf("%s Error Node Address: %s, Flags: [0x%02x]%s Error Code: %s (%u)",
1299 ip6addr_string(obj_tptr
),
1302 tok2str(rsvp_obj_error_code_values
,"unknown",error_code
),
1305 switch (error_code
) {
1306 case RSVP_OBJ_ERROR_SPEC_CODE_ROUTING
:
1307 printf(", Error Value: %s (%u)",
1308 tok2str(rsvp_obj_error_code_routing_values
,"unknown",error_value
),
1323 case RSVP_OBJ_PROPERTIES
:
1324 switch(rsvp_obj_ctype
) {
1328 padbytes
= EXTRACT_16BITS(obj_tptr
+2);
1329 printf("%s TLV count: %u, padding bytes: %u",
1331 EXTRACT_16BITS(obj_tptr
),
1335 /* loop through as long there is anything longer than the TLV header (2) */
1336 while(obj_tlen
>= 2 + padbytes
) {
1337 printf("%s %s TLV (0x%02x), length: %u", /* length includes header */
1339 tok2str(rsvp_obj_prop_tlv_values
,"unknown",*obj_tptr
),
1342 if (obj_tlen
< *(obj_tptr
+1))
1344 if (*(obj_tptr
+1) < 2)
1346 print_unknown_data(obj_tptr
+2,"\n\t\t",*(obj_tptr
+1)-2);
1347 obj_tlen
-=*(obj_tptr
+1);
1348 obj_tptr
+=*(obj_tptr
+1);
1356 case RSVP_OBJ_MESSAGE_ID
: /* fall through */
1357 case RSVP_OBJ_MESSAGE_ID_ACK
: /* fall through */
1358 case RSVP_OBJ_MESSAGE_ID_LIST
:
1359 switch(rsvp_obj_ctype
) {
1363 printf("%s Flags [0x%02x], epoch: %u",
1366 EXTRACT_24BITS(obj_tptr
+1));
1369 /* loop through as long there are no messages left */
1370 while(obj_tlen
>= 4) {
1371 printf("%s Message-ID 0x%08x (%u)",
1373 EXTRACT_32BITS(obj_tptr
),
1374 EXTRACT_32BITS(obj_tptr
));
1384 case RSVP_OBJ_INTEGRITY
:
1385 switch(rsvp_obj_ctype
) {
1387 if (obj_tlen
< sizeof(struct rsvp_obj_integrity_t
))
1389 obj_ptr
.rsvp_obj_integrity
= (const struct rsvp_obj_integrity_t
*)obj_tptr
;
1390 printf("%s Key-ID 0x%04x%08x, Sequence 0x%08x%08x, Flags [%s]",
1392 EXTRACT_16BITS(obj_ptr
.rsvp_obj_integrity
->key_id
),
1393 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->key_id
+2),
1394 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->sequence
),
1395 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->sequence
+4),
1396 bittok2str(rsvp_obj_integrity_flag_values
,
1398 obj_ptr
.rsvp_obj_integrity
->flags
));
1399 printf("%s MD5-sum 0x%08x%08x%08x%08x (unverified)",
1401 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->digest
),
1402 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->digest
+4),
1403 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->digest
+8),
1404 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->digest
+12));
1405 obj_tlen
+=sizeof(struct rsvp_obj_integrity_t
);
1406 obj_tptr
+=sizeof(struct rsvp_obj_integrity_t
);
1414 * FIXME those are the defined objects that lack a decoder
1415 * you are welcome to contribute code ;-)
1418 case RSVP_OBJ_SCOPE
:
1419 case RSVP_OBJ_POLICY_DATA
:
1420 case RSVP_OBJ_LABEL_SET
:
1421 case RSVP_OBJ_ACCEPT_LABEL_SET
:
1422 case RSVP_OBJ_PROTECTION
:
1425 print_unknown_data(obj_tptr
,"\n\t ",obj_tlen
); /* FIXME indentation */
1428 /* do we also want to see a hex dump ? */
1429 if (vflag
> 1 || hexdump
==TRUE
)
1430 print_unknown_data(tptr
+sizeof(sizeof(struct rsvp_object_header
)),"\n\t ", /* FIXME indentation */
1431 rsvp_obj_len
-sizeof(struct rsvp_object_header
));
1438 printf("\n\t\t packet exceeded snapshot");
1444 rsvp_print(register const u_char
*pptr
, register u_int len
) {
1446 const struct rsvp_common_header
*rsvp_com_header
;
1447 const u_char
*tptr
,*subtptr
;
1448 u_short tlen
,subtlen
;
1452 rsvp_com_header
= (const struct rsvp_common_header
*)pptr
;
1453 TCHECK(*rsvp_com_header
);
1456 * Sanity checking of the header.
1458 if (RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
) != RSVP_VERSION
) {
1459 printf("ERROR: RSVP version %u packet not supported",
1460 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
));
1464 /* in non-verbose mode just lets print the basic Message Type*/
1466 printf("RSVPv%u %s Message, length: %u",
1467 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
),
1468 tok2str(rsvp_msg_type_values
, "unknown (%u)",rsvp_com_header
->msg_type
),
1473 /* ok they seem to want to know everything - lets fully decode it */
1475 tlen
=EXTRACT_16BITS(rsvp_com_header
->length
);
1477 printf("\n\tRSVPv%u %s Message (%u), Flags: [%s], length: %u, ttl: %u, checksum: 0x%04x",
1478 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
),
1479 tok2str(rsvp_msg_type_values
, "unknown, type: %u",rsvp_com_header
->msg_type
),
1480 rsvp_com_header
->msg_type
,
1481 bittok2str(rsvp_header_flag_values
,"none",RSVP_EXTRACT_FLAGS(rsvp_com_header
->version_flags
)),
1483 rsvp_com_header
->ttl
,
1484 EXTRACT_16BITS(rsvp_com_header
->checksum
));
1486 if (tlen
< sizeof(const struct rsvp_common_header
)) {
1487 printf("ERROR: common header too short %u < %lu", tlen
,
1488 (unsigned long)sizeof(const struct rsvp_common_header
));
1492 tptr
+=sizeof(const struct rsvp_common_header
);
1493 tlen
-=sizeof(const struct rsvp_common_header
);
1495 switch(rsvp_com_header
->msg_type
) {
1497 case RSVP_MSGTYPE_AGGREGATE
:
1500 rsvp_com_header
= (const struct rsvp_common_header
*)subtptr
;
1501 TCHECK(*rsvp_com_header
);
1504 * Sanity checking of the header.
1506 if (RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
) != RSVP_VERSION
) {
1507 printf("ERROR: RSVP version %u packet not supported",
1508 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
));
1511 subtlen
=EXTRACT_16BITS(rsvp_com_header
->length
);
1513 printf("\n\t RSVPv%u %s Message (%u), Flags: [%s], length: %u, ttl: %u, checksum: 0x%04x",
1514 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
),
1515 tok2str(rsvp_msg_type_values
, "unknown, type: %u",rsvp_com_header
->msg_type
),
1516 rsvp_com_header
->msg_type
,
1517 bittok2str(rsvp_header_flag_values
,"none",RSVP_EXTRACT_FLAGS(rsvp_com_header
->version_flags
)),
1519 rsvp_com_header
->ttl
,
1520 EXTRACT_16BITS(rsvp_com_header
->checksum
));
1522 if (subtlen
< sizeof(const struct rsvp_common_header
)) {
1523 printf("ERROR: common header too short %u < %lu", subtlen
,
1524 (unsigned long)sizeof(const struct rsvp_common_header
));
1528 if (tlen
< subtlen
) {
1529 printf("ERROR: common header too large %u > %u", subtlen
,
1534 subtptr
+=sizeof(const struct rsvp_common_header
);
1535 subtlen
-=sizeof(const struct rsvp_common_header
);
1537 if (rsvp_obj_print(subtptr
,"\n\t ", subtlen
) == -1)
1540 tptr
+=subtlen
+sizeof(const struct rsvp_common_header
);
1541 tlen
-=subtlen
+sizeof(const struct rsvp_common_header
);
1546 case RSVP_MSGTYPE_PATH
:
1547 case RSVP_MSGTYPE_RESV
:
1548 case RSVP_MSGTYPE_PATHERR
:
1549 case RSVP_MSGTYPE_RESVERR
:
1550 case RSVP_MSGTYPE_PATHTEAR
:
1551 case RSVP_MSGTYPE_RESVTEAR
:
1552 case RSVP_MSGTYPE_RESVCONF
:
1553 case RSVP_MSGTYPE_HELLO_OLD
:
1554 case RSVP_MSGTYPE_HELLO
:
1555 case RSVP_MSGTYPE_ACK
:
1556 case RSVP_MSGTYPE_SREFRESH
:
1557 if (rsvp_obj_print(tptr
,"\n\t ", tlen
) == -1)
1562 print_unknown_data(tptr
,"\n\t ",tlen
);
1568 printf("\n\t\t packet exceeded snapshot");