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.9 2006/06/23 02:07:27 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" },
419 static int rsvp_intserv_print(const u_char
*, u_short
);
422 * this is a dissector for all the intserv defined
423 * specs as defined per rfc2215
424 * it is called from various rsvp objects;
425 * returns the amount of bytes being processed
428 rsvp_intserv_print(const u_char
*tptr
, u_short obj_tlen
) {
430 int parameter_id
,parameter_length
;
438 parameter_id
= *(tptr
);
439 parameter_length
= EXTRACT_16BITS(tptr
+2)<<2; /* convert wordcount to bytecount */
441 printf("\n\t Parameter ID: %s (%u), length: %u, Flags: [0x%02x]",
442 tok2str(rsvp_intserv_parameter_id_values
,"unknown",parameter_id
),
447 if (obj_tlen
< parameter_length
+4)
449 switch(parameter_id
) { /* parameter_id */
453 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
454 * | 4 (e) | (f) | 1 (g) |
455 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
456 * | IS hop cnt (32-bit unsigned integer) |
457 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
459 if (parameter_length
== 4)
460 printf("\n\t\tIS hop count: %u", EXTRACT_32BITS(tptr
+4));
465 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
466 * | 6 (h) | (i) | 1 (j) |
467 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
468 * | Path b/w estimate (32-bit IEEE floating point number) |
469 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
471 if (parameter_length
== 4) {
472 bw
.i
= EXTRACT_32BITS(tptr
+4);
473 printf("\n\t\tPath b/w estimate: %.10g Mbps", bw
.f
/125000);
479 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
480 * | 8 (k) | (l) | 1 (m) |
481 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
482 * | Minimum path latency (32-bit integer) |
483 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
485 if (parameter_length
== 4) {
486 printf("\n\t\tMinimum path latency: ");
487 if (EXTRACT_32BITS(tptr
+4) == 0xffffffff)
488 printf("don't care");
490 printf("%u", EXTRACT_32BITS(tptr
+4));
497 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
498 * | 10 (n) | (o) | 1 (p) |
499 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
500 * | Composed MTU (32-bit unsigned integer) |
501 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
503 if (parameter_length
== 4)
504 printf("\n\t\tComposed MTU: %u bytes", EXTRACT_32BITS(tptr
+4));
508 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
509 * | 127 (e) | 0 (f) | 5 (g) |
510 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
511 * | Token Bucket Rate [r] (32-bit IEEE floating point number) |
512 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
513 * | Token Bucket Size [b] (32-bit IEEE floating point number) |
514 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
515 * | Peak Data Rate [p] (32-bit IEEE floating point number) |
516 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
517 * | Minimum Policed Unit [m] (32-bit integer) |
518 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
519 * | Maximum Packet Size [M] (32-bit integer) |
520 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
523 if (parameter_length
== 20) {
524 bw
.i
= EXTRACT_32BITS(tptr
+4);
525 printf("\n\t\tToken Bucket Rate: %.10g Mbps", bw
.f
/125000);
526 bw
.i
= EXTRACT_32BITS(tptr
+8);
527 printf("\n\t\tToken Bucket Size: %.10g bytes", bw
.f
);
528 bw
.i
= EXTRACT_32BITS(tptr
+12);
529 printf("\n\t\tPeak Data Rate: %.10g Mbps", bw
.f
/125000);
530 printf("\n\t\tMinimum Policed Unit: %u bytes", EXTRACT_32BITS(tptr
+16));
531 printf("\n\t\tMaximum Packet Size: %u bytes", EXTRACT_32BITS(tptr
+20));
537 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
538 * | 130 (h) | 0 (i) | 2 (j) |
539 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
540 * | Rate [R] (32-bit IEEE floating point number) |
541 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
542 * | Slack Term [S] (32-bit integer) |
543 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
546 if (parameter_length
== 8) {
547 bw
.i
= EXTRACT_32BITS(tptr
+4);
548 printf("\n\t\tRate: %.10g Mbps", bw
.f
/125000);
549 printf("\n\t\tSlack Term: %u", EXTRACT_32BITS(tptr
+8));
557 if (parameter_length
== 4)
558 printf("\n\t\tValue: %u", EXTRACT_32BITS(tptr
+4));
563 print_unknown_data(tptr
+4,"\n\t\t",parameter_length
);
565 return (parameter_length
+4); /* header length 4 bytes */
569 rsvp_obj_print (const u_char
*tptr
, const char *ident
, u_int tlen
) {
571 const struct rsvp_object_header
*rsvp_obj_header
;
572 const u_char
*obj_tptr
;
574 const struct rsvp_obj_integrity_t
*rsvp_obj_integrity
;
575 const struct rsvp_obj_frr_t
*rsvp_obj_frr
;
578 u_short rsvp_obj_len
,rsvp_obj_ctype
,obj_tlen
,intserv_serv_tlen
;
579 int hexdump
,processed
,padbytes
,error_code
,error_value
,i
;
586 while(tlen
>=sizeof(struct rsvp_object_header
)) {
587 /* did we capture enough for fully decoding the object header ? */
588 if (!TTEST2(*tptr
, sizeof(struct rsvp_object_header
)))
591 rsvp_obj_header
= (const struct rsvp_object_header
*)tptr
;
592 rsvp_obj_len
=EXTRACT_16BITS(rsvp_obj_header
->length
);
593 rsvp_obj_ctype
=rsvp_obj_header
->ctype
;
595 if(rsvp_obj_len
% 4) {
596 printf("%sERROR: object header size %u not a multiple of 4", ident
, rsvp_obj_len
);
599 if(rsvp_obj_len
< sizeof(struct rsvp_object_header
)) {
600 printf("%sERROR: object header too short %u < %lu", ident
, rsvp_obj_len
,
601 (unsigned long)sizeof(const struct rsvp_object_header
));
605 printf("%s%s Object (%u) Flags: [%s",
607 tok2str(rsvp_obj_values
,
609 rsvp_obj_header
->class_num
),
610 rsvp_obj_header
->class_num
,
611 ((rsvp_obj_header
->class_num
)&0x80) ? "ignore" : "reject");
613 if (rsvp_obj_header
->class_num
> 128)
615 ((rsvp_obj_header
->class_num
)&0x40) ? "and forward" : "silently");
617 printf(" if unknown], Class-Type: %s (%u), length: %u",
618 tok2str(rsvp_ctype_values
,
620 ((rsvp_obj_header
->class_num
)<<8)+rsvp_obj_ctype
),
624 if(tlen
< rsvp_obj_len
) {
625 printf("%sERROR: object goes past end of objects TLV", ident
);
629 obj_tptr
=tptr
+sizeof(struct rsvp_object_header
);
630 obj_tlen
=rsvp_obj_len
-sizeof(struct rsvp_object_header
);
632 /* did we capture enough for fully decoding the object ? */
633 if (!TTEST2(*tptr
, rsvp_obj_len
))
637 switch(rsvp_obj_header
->class_num
) {
638 case RSVP_OBJ_SESSION
:
639 switch(rsvp_obj_ctype
) {
640 case RSVP_CTYPE_IPV4
:
643 printf("%s IPv4 DestAddress: %s, Protocol ID: 0x%02x",
645 ipaddr_string(obj_tptr
),
646 *(obj_tptr
+sizeof(struct in_addr
)));
647 printf("%s Flags: [0x%02x], DestPort %u",
650 EXTRACT_16BITS(obj_tptr
+6));
655 case RSVP_CTYPE_IPV6
:
658 printf("%s IPv6 DestAddress: %s, Protocol ID: 0x%02x",
660 ip6addr_string(obj_tptr
),
661 *(obj_tptr
+sizeof(struct in6_addr
)));
662 printf("%s Flags: [0x%02x], DestPort %u",
664 *(obj_tptr
+sizeof(struct in6_addr
)+1),
665 EXTRACT_16BITS(obj_tptr
+sizeof(struct in6_addr
)+2));
670 case RSVP_CTYPE_TUNNEL_IPV6
:
673 printf("%s IPv6 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
675 ip6addr_string(obj_tptr
),
676 EXTRACT_16BITS(obj_tptr
+18),
677 ip6addr_string(obj_tptr
+20));
682 case RSVP_CTYPE_TUNNEL_IPV4
:
685 printf("%s IPv4 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
687 ipaddr_string(obj_tptr
),
688 EXTRACT_16BITS(obj_tptr
+6),
689 ipaddr_string(obj_tptr
+8));
698 case RSVP_OBJ_CONFIRM
:
699 switch(rsvp_obj_ctype
) {
700 case RSVP_CTYPE_IPV4
:
701 if (obj_tlen
< sizeof(struct in_addr
))
703 printf("%s IPv4 Receiver Address: %s",
705 ipaddr_string(obj_tptr
));
706 obj_tlen
-=sizeof(struct in_addr
);
707 obj_tptr
+=sizeof(struct in_addr
);
710 case RSVP_CTYPE_IPV6
:
711 if (obj_tlen
< sizeof(struct in6_addr
))
713 printf("%s IPv6 Receiver Address: %s",
715 ip6addr_string(obj_tptr
));
716 obj_tlen
-=sizeof(struct in6_addr
);
717 obj_tptr
+=sizeof(struct in6_addr
);
725 case RSVP_OBJ_NOTIFY_REQ
:
726 switch(rsvp_obj_ctype
) {
727 case RSVP_CTYPE_IPV4
:
728 if (obj_tlen
< sizeof(struct in_addr
))
730 printf("%s IPv4 Notify Node Address: %s",
732 ipaddr_string(obj_tptr
));
733 obj_tlen
-=sizeof(struct in_addr
);
734 obj_tptr
+=sizeof(struct in_addr
);
737 case RSVP_CTYPE_IPV6
:
738 if (obj_tlen
< sizeof(struct in6_addr
))
740 printf("%s IPv6 Notify Node Address: %s",
742 ip6addr_string(obj_tptr
));
743 obj_tlen
-=sizeof(struct in6_addr
);
744 obj_tptr
+=sizeof(struct in6_addr
);
752 case RSVP_OBJ_SUGGESTED_LABEL
: /* fall through */
753 case RSVP_OBJ_UPSTREAM_LABEL
: /* fall through */
754 case RSVP_OBJ_RECOVERY_LABEL
: /* fall through */
756 switch(rsvp_obj_ctype
) {
758 while(obj_tlen
>= 4 ) {
759 printf("%s Label: %u", ident
, EXTRACT_32BITS(obj_tptr
));
767 printf("%s Generalized Label: %u",
769 EXTRACT_32BITS(obj_tptr
));
776 printf("%s Waveband ID: %u%s Start Label: %u, Stop Label: %u",
778 EXTRACT_32BITS(obj_tptr
),
780 EXTRACT_32BITS(obj_tptr
+4),
781 EXTRACT_32BITS(obj_tptr
+8));
791 switch(rsvp_obj_ctype
) {
795 printf("%s Reservation Style: %s, Flags: [0x%02x]",
797 tok2str(rsvp_resstyle_values
,
799 EXTRACT_24BITS(obj_tptr
+1)),
809 case RSVP_OBJ_SENDER_TEMPLATE
:
810 switch(rsvp_obj_ctype
) {
811 case RSVP_CTYPE_IPV4
:
814 printf("%s Source Address: %s, Source Port: %u",
816 ipaddr_string(obj_tptr
),
817 EXTRACT_16BITS(obj_tptr
+6));
822 case RSVP_CTYPE_IPV6
:
825 printf("%s Source Address: %s, Source Port: %u",
827 ip6addr_string(obj_tptr
),
828 EXTRACT_16BITS(obj_tptr
+18));
833 case RSVP_CTYPE_TUNNEL_IPV4
:
836 printf("%s IPv4 Tunnel Sender Address: %s, LSP-ID: 0x%04x",
838 ipaddr_string(obj_tptr
),
839 EXTRACT_16BITS(obj_tptr
+6));
848 case RSVP_OBJ_LABEL_REQ
:
849 switch(rsvp_obj_ctype
) {
851 while(obj_tlen
>= 4 ) {
852 printf("%s L3 Protocol ID: %s",
854 tok2str(ethertype_values
,
855 "Unknown Protocol (0x%04x)",
856 EXTRACT_16BITS(obj_tptr
+2)));
864 printf("%s L3 Protocol ID: %s",
866 tok2str(ethertype_values
,
867 "Unknown Protocol (0x%04x)",
868 EXTRACT_16BITS(obj_tptr
+2)));
869 printf(",%s merge capability",((*(obj_tptr
+4))&0x80) ? "no" : "" );
870 printf("%s Minimum VPI/VCI: %u/%u",
872 (EXTRACT_16BITS(obj_tptr
+4))&0xfff,
873 (EXTRACT_16BITS(obj_tptr
+6))&0xfff);
874 printf("%s Maximum VPI/VCI: %u/%u",
876 (EXTRACT_16BITS(obj_tptr
+8))&0xfff,
877 (EXTRACT_16BITS(obj_tptr
+10))&0xfff);
884 printf("%s L3 Protocol ID: %s",
886 tok2str(ethertype_values
,
887 "Unknown Protocol (0x%04x)",
888 EXTRACT_16BITS(obj_tptr
+2)));
889 printf("%s Minimum/Maximum DLCI: %u/%u, %s%s bit DLCI",
891 (EXTRACT_32BITS(obj_tptr
+4))&0x7fffff,
892 (EXTRACT_32BITS(obj_tptr
+8))&0x7fffff,
893 (((EXTRACT_16BITS(obj_tptr
+4)>>7)&3) == 0 ) ? "10" : "",
894 (((EXTRACT_16BITS(obj_tptr
+4)>>7)&3) == 2 ) ? "23" : "");
901 printf("%s LSP Encoding Type: %s (%u)",
903 tok2str(gmpls_encoding_values
,
907 printf("%s Switching Type: %s (%u), Payload ID: %s (0x%04x)",
909 tok2str(gmpls_switch_cap_values
,
913 tok2str(gmpls_payload_values
,
915 EXTRACT_16BITS(obj_tptr
+2)),
916 EXTRACT_16BITS(obj_tptr
+2));
927 switch(rsvp_obj_ctype
) {
928 case RSVP_CTYPE_IPV4
:
929 while(obj_tlen
>= 4 ) {
930 printf("%s Subobject Type: %s, length %u",
932 tok2str(rsvp_obj_xro_values
,
934 RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr
)),
937 if (*(obj_tptr
+1) == 0) { /* prevent infinite loops */
938 printf("%s ERROR: zero length ERO subtype",ident
);
942 switch(RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr
)) {
943 case RSVP_OBJ_XRO_IPV4
:
944 printf(", %s, %s/%u, Flags: [%s]",
945 RSVP_OBJ_XRO_MASK_LOOSE(*obj_tptr
) ? "Loose" : "Strict",
946 ipaddr_string(obj_tptr
+2),
948 bittok2str(rsvp_obj_rro_flag_values
,
950 *(obj_tptr
+7))); /* rfc3209 says that this field is rsvd. */
952 obj_tlen
-=*(obj_tptr
+1);
953 obj_tptr
+=*(obj_tptr
+1);
962 switch(rsvp_obj_ctype
) {
967 printf("%s Source Instance: 0x%08x, Destination Instance: 0x%08x",
969 EXTRACT_32BITS(obj_tptr
),
970 EXTRACT_32BITS(obj_tptr
+4));
979 case RSVP_OBJ_RESTART_CAPABILITY
:
980 switch(rsvp_obj_ctype
) {
984 printf("%s Restart Time: %ums, Recovery Time: %ums",
986 EXTRACT_32BITS(obj_tptr
),
987 EXTRACT_32BITS(obj_tptr
+4));
996 case RSVP_OBJ_SESSION_ATTRIBUTE
:
997 switch(rsvp_obj_ctype
) {
998 case RSVP_CTYPE_TUNNEL_IPV4
:
1001 namelen
= *(obj_tptr
+3);
1002 if (obj_tlen
< 4+namelen
)
1004 printf("%s Session Name: ", ident
);
1005 for (i
= 0; i
< namelen
; i
++)
1006 safeputchar(*(obj_tptr
+4+i
));
1007 printf("%s Setup Priority: %u, Holding Priority: %u, Flags: [%s]",
1011 tok2str(rsvp_session_attribute_flag_values
,
1015 obj_tlen
-=4+*(obj_tptr
+3);
1016 obj_tptr
+=4+*(obj_tptr
+3);
1023 case RSVP_OBJ_RSVP_HOP
:
1024 switch(rsvp_obj_ctype
) {
1025 case RSVP_CTYPE_3
: /* fall through - FIXME add TLV parser */
1026 case RSVP_CTYPE_IPV4
:
1029 printf("%s Previous/Next Interface: %s, Logical Interface Handle: 0x%08x",
1031 ipaddr_string(obj_tptr
),
1032 EXTRACT_32BITS(obj_tptr
+4));
1036 hexdump
=TRUE
; /* unless we have a TLV parser lets just hexdump */
1039 case RSVP_CTYPE_4
: /* fall through - FIXME add TLV parser */
1040 case RSVP_CTYPE_IPV6
:
1043 printf("%s Previous/Next Interface: %s, Logical Interface Handle: 0x%08x",
1045 ip6addr_string(obj_tptr
),
1046 EXTRACT_32BITS(obj_tptr
+16));
1049 hexdump
=TRUE
; /* unless we have a TLV parser lets just hexdump */
1057 case RSVP_OBJ_TIME_VALUES
:
1058 switch(rsvp_obj_ctype
) {
1062 printf("%s Refresh Period: %ums",
1064 EXTRACT_32BITS(obj_tptr
));
1073 /* those three objects do share the same semantics */
1074 case RSVP_OBJ_SENDER_TSPEC
:
1075 case RSVP_OBJ_ADSPEC
:
1076 case RSVP_OBJ_FLOWSPEC
:
1077 switch(rsvp_obj_ctype
) {
1081 printf("%s Msg-Version: %u, length: %u",
1083 (*obj_tptr
& 0xf0) >> 4,
1084 EXTRACT_16BITS(obj_tptr
+2)<<2);
1085 obj_tptr
+=4; /* get to the start of the service header */
1088 while (obj_tlen
>= 4) {
1089 intserv_serv_tlen
=EXTRACT_16BITS(obj_tptr
+2)<<2;
1090 printf("%s Service Type: %s (%u), break bit %s set, Service length: %u",
1092 tok2str(rsvp_intserv_service_type_values
,"unknown",*(obj_tptr
)),
1094 (*(obj_tptr
+1)&0x80) ? "" : "not",
1097 obj_tptr
+=4; /* get to the start of the parameter list */
1100 while (intserv_serv_tlen
>=4) {
1101 processed
= rsvp_intserv_print(obj_tptr
, obj_tlen
);
1104 obj_tlen
-=processed
;
1105 intserv_serv_tlen
-=processed
;
1106 obj_tptr
+=processed
;
1115 case RSVP_OBJ_FILTERSPEC
:
1116 switch(rsvp_obj_ctype
) {
1117 case RSVP_CTYPE_IPV4
:
1120 printf("%s Source Address: %s, Source Port: %u",
1122 ipaddr_string(obj_tptr
),
1123 EXTRACT_16BITS(obj_tptr
+6));
1128 case RSVP_CTYPE_IPV6
:
1131 printf("%s Source Address: %s, Source Port: %u",
1133 ip6addr_string(obj_tptr
),
1134 EXTRACT_16BITS(obj_tptr
+18));
1141 printf("%s Source Address: %s, Flow Label: %u",
1143 ip6addr_string(obj_tptr
),
1144 EXTRACT_24BITS(obj_tptr
+17));
1148 case RSVP_CTYPE_TUNNEL_IPV6
:
1151 printf("%s Source Address: %s, LSP-ID: 0x%04x",
1153 ipaddr_string(obj_tptr
),
1154 EXTRACT_16BITS(obj_tptr
+18));
1159 case RSVP_CTYPE_TUNNEL_IPV4
:
1162 printf("%s Source Address: %s, LSP-ID: 0x%04x",
1164 ipaddr_string(obj_tptr
),
1165 EXTRACT_16BITS(obj_tptr
+6));
1174 case RSVP_OBJ_FASTREROUTE
:
1175 /* the differences between c-type 1 and 7 are minor */
1176 obj_ptr
.rsvp_obj_frr
= (const struct rsvp_obj_frr_t
*)obj_tptr
;
1177 bw
.i
= EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->bandwidth
);
1179 switch(rsvp_obj_ctype
) {
1180 case RSVP_CTYPE_1
: /* new style */
1181 if (obj_tlen
< sizeof(struct rsvp_obj_frr_t
))
1183 printf("%s Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps",
1185 (int)obj_ptr
.rsvp_obj_frr
->setup_prio
,
1186 (int)obj_ptr
.rsvp_obj_frr
->hold_prio
,
1187 (int)obj_ptr
.rsvp_obj_frr
->hop_limit
,
1189 printf("%s Include-any: 0x%08x, Exclude-any: 0x%08x, Include-all: 0x%08x",
1191 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->include_any
),
1192 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->exclude_any
),
1193 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->include_all
));
1194 obj_tlen
-=sizeof(struct rsvp_obj_frr_t
);
1195 obj_tptr
+=sizeof(struct rsvp_obj_frr_t
);
1198 case RSVP_CTYPE_TUNNEL_IPV4
: /* old style */
1201 printf("%s Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps",
1203 (int)obj_ptr
.rsvp_obj_frr
->setup_prio
,
1204 (int)obj_ptr
.rsvp_obj_frr
->hold_prio
,
1205 (int)obj_ptr
.rsvp_obj_frr
->hop_limit
,
1207 printf("%s Include Colors: 0x%08x, Exclude Colors: 0x%08x",
1209 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->include_any
),
1210 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->exclude_any
));
1220 case RSVP_OBJ_DETOUR
:
1221 switch(rsvp_obj_ctype
) {
1222 case RSVP_CTYPE_TUNNEL_IPV4
:
1223 while(obj_tlen
>= 8) {
1224 printf("%s PLR-ID: %s, Avoid-Node-ID: %s",
1226 ipaddr_string(obj_tptr
),
1227 ipaddr_string(obj_tptr
+4));
1237 case RSVP_OBJ_CLASSTYPE
:
1238 case RSVP_OBJ_CLASSTYPE_OLD
: /* fall through */
1239 switch(rsvp_obj_ctype
) {
1243 EXTRACT_32BITS(obj_tptr
)&0x7);
1252 case RSVP_OBJ_ERROR_SPEC
:
1253 switch(rsvp_obj_ctype
) {
1254 case RSVP_CTYPE_3
: /* fall through - FIXME add TLV parser */
1255 case RSVP_CTYPE_IPV4
:
1258 error_code
=*(obj_tptr
+5);
1259 error_value
=EXTRACT_16BITS(obj_tptr
+6);
1260 printf("%s Error Node Address: %s, Flags: [0x%02x]%s Error Code: %s (%u)",
1262 ipaddr_string(obj_tptr
),
1265 tok2str(rsvp_obj_error_code_values
,"unknown",error_code
),
1267 switch (error_code
) {
1268 case RSVP_OBJ_ERROR_SPEC_CODE_ROUTING
:
1269 printf(", Error Value: %s (%u)",
1270 tok2str(rsvp_obj_error_code_routing_values
,"unknown",error_value
),
1273 case RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE
: /* fall through */
1274 case RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE_OLD
:
1275 printf(", Error Value: %s (%u)",
1276 tok2str(rsvp_obj_error_code_diffserv_te_values
,"unknown",error_value
),
1280 printf(", Unknown Error Value (%u)", error_value
);
1287 case RSVP_CTYPE_4
: /* fall through - FIXME add TLV parser */
1288 case RSVP_CTYPE_IPV6
:
1291 error_code
=*(obj_tptr
+17);
1292 error_value
=EXTRACT_16BITS(obj_tptr
+18);
1293 printf("%s Error Node Address: %s, Flags: [0x%02x]%s Error Code: %s (%u)",
1295 ip6addr_string(obj_tptr
),
1298 tok2str(rsvp_obj_error_code_values
,"unknown",error_code
),
1301 switch (error_code
) {
1302 case RSVP_OBJ_ERROR_SPEC_CODE_ROUTING
:
1303 printf(", Error Value: %s (%u)",
1304 tok2str(rsvp_obj_error_code_routing_values
,"unknown",error_value
),
1319 case RSVP_OBJ_PROPERTIES
:
1320 switch(rsvp_obj_ctype
) {
1324 padbytes
= EXTRACT_16BITS(obj_tptr
+2);
1325 printf("%s TLV count: %u, padding bytes: %u",
1327 EXTRACT_16BITS(obj_tptr
),
1331 /* loop through as long there is anything longer than the TLV header (2) */
1332 while(obj_tlen
>= 2 + padbytes
) {
1333 printf("%s %s TLV (0x%02x), length: %u", /* length includes header */
1335 tok2str(rsvp_obj_prop_tlv_values
,"unknown",*obj_tptr
),
1338 if (obj_tlen
< *(obj_tptr
+1))
1340 if (*(obj_tptr
+1) < 2)
1342 print_unknown_data(obj_tptr
+2,"\n\t\t",*(obj_tptr
+1)-2);
1343 obj_tlen
-=*(obj_tptr
+1);
1344 obj_tptr
+=*(obj_tptr
+1);
1352 case RSVP_OBJ_MESSAGE_ID
: /* fall through */
1353 case RSVP_OBJ_MESSAGE_ID_ACK
: /* fall through */
1354 case RSVP_OBJ_MESSAGE_ID_LIST
:
1355 switch(rsvp_obj_ctype
) {
1359 printf("%s Flags [0x%02x], epoch: %u",
1362 EXTRACT_24BITS(obj_tptr
+1));
1365 /* loop through as long there are no messages left */
1366 while(obj_tlen
>= 4) {
1367 printf("%s Message-ID 0x%08x (%u)",
1369 EXTRACT_32BITS(obj_tptr
),
1370 EXTRACT_32BITS(obj_tptr
));
1380 case RSVP_OBJ_INTEGRITY
:
1381 switch(rsvp_obj_ctype
) {
1383 if (obj_tlen
< sizeof(struct rsvp_obj_integrity_t
))
1385 obj_ptr
.rsvp_obj_integrity
= (const struct rsvp_obj_integrity_t
*)obj_tptr
;
1386 printf("%s Key-ID 0x%04x%08x, Sequence 0x%08x%08x, Flags [%s]",
1388 EXTRACT_16BITS(obj_ptr
.rsvp_obj_integrity
->key_id
),
1389 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->key_id
+2),
1390 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->sequence
),
1391 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->sequence
+4),
1392 bittok2str(rsvp_obj_integrity_flag_values
,
1394 obj_ptr
.rsvp_obj_integrity
->flags
));
1395 printf("%s MD5-sum 0x%08x%08x%08x%08x (unverified)",
1397 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->digest
),
1398 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->digest
+4),
1399 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->digest
+8),
1400 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->digest
+12));
1401 obj_tlen
+=sizeof(struct rsvp_obj_integrity_t
);
1402 obj_tptr
+=sizeof(struct rsvp_obj_integrity_t
);
1410 * FIXME those are the defined objects that lack a decoder
1411 * you are welcome to contribute code ;-)
1414 case RSVP_OBJ_SCOPE
:
1415 case RSVP_OBJ_POLICY_DATA
:
1416 case RSVP_OBJ_LABEL_SET
:
1417 case RSVP_OBJ_ACCEPT_LABEL_SET
:
1418 case RSVP_OBJ_PROTECTION
:
1421 print_unknown_data(obj_tptr
,"\n\t ",obj_tlen
); /* FIXME indentation */
1424 /* do we also want to see a hex dump ? */
1425 if (vflag
> 1 || hexdump
==TRUE
)
1426 print_unknown_data(tptr
+sizeof(sizeof(struct rsvp_object_header
)),"\n\t ", /* FIXME indentation */
1427 rsvp_obj_len
-sizeof(struct rsvp_object_header
));
1434 printf("\n\t\t packet exceeded snapshot");
1440 rsvp_print(register const u_char
*pptr
, register u_int len
) {
1442 const struct rsvp_common_header
*rsvp_com_header
;
1443 const u_char
*tptr
,*subtptr
;
1444 u_short tlen
,subtlen
;
1448 rsvp_com_header
= (const struct rsvp_common_header
*)pptr
;
1449 TCHECK(*rsvp_com_header
);
1452 * Sanity checking of the header.
1454 if (RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
) != RSVP_VERSION
) {
1455 printf("ERROR: RSVP version %u packet not supported",
1456 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
));
1460 /* in non-verbose mode just lets print the basic Message Type*/
1462 printf("RSVPv%u %s Message, length: %u",
1463 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
),
1464 tok2str(rsvp_msg_type_values
, "unknown (%u)",rsvp_com_header
->msg_type
),
1469 /* ok they seem to want to know everything - lets fully decode it */
1471 tlen
=EXTRACT_16BITS(rsvp_com_header
->length
);
1473 printf("\n\tRSVPv%u %s Message (%u), Flags: [%s], length: %u, ttl: %u, checksum: 0x%04x",
1474 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
),
1475 tok2str(rsvp_msg_type_values
, "unknown, type: %u",rsvp_com_header
->msg_type
),
1476 rsvp_com_header
->msg_type
,
1477 bittok2str(rsvp_header_flag_values
,"none",RSVP_EXTRACT_FLAGS(rsvp_com_header
->version_flags
)),
1479 rsvp_com_header
->ttl
,
1480 EXTRACT_16BITS(rsvp_com_header
->checksum
));
1482 if (tlen
< sizeof(const struct rsvp_common_header
)) {
1483 printf("ERROR: common header too short %u < %lu", tlen
,
1484 (unsigned long)sizeof(const struct rsvp_common_header
));
1488 tptr
+=sizeof(const struct rsvp_common_header
);
1489 tlen
-=sizeof(const struct rsvp_common_header
);
1491 switch(rsvp_com_header
->msg_type
) {
1493 case RSVP_MSGTYPE_AGGREGATE
:
1496 rsvp_com_header
= (const struct rsvp_common_header
*)subtptr
;
1497 TCHECK(*rsvp_com_header
);
1500 * Sanity checking of the header.
1502 if (RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
) != RSVP_VERSION
) {
1503 printf("ERROR: RSVP version %u packet not supported",
1504 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
));
1507 subtlen
=EXTRACT_16BITS(rsvp_com_header
->length
);
1509 printf("\n\t RSVPv%u %s Message (%u), Flags: [%s], length: %u, ttl: %u, checksum: 0x%04x",
1510 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
),
1511 tok2str(rsvp_msg_type_values
, "unknown, type: %u",rsvp_com_header
->msg_type
),
1512 rsvp_com_header
->msg_type
,
1513 bittok2str(rsvp_header_flag_values
,"none",RSVP_EXTRACT_FLAGS(rsvp_com_header
->version_flags
)),
1515 rsvp_com_header
->ttl
,
1516 EXTRACT_16BITS(rsvp_com_header
->checksum
));
1518 if (subtlen
< sizeof(const struct rsvp_common_header
)) {
1519 printf("ERROR: common header too short %u < %lu", subtlen
,
1520 (unsigned long)sizeof(const struct rsvp_common_header
));
1524 if (tlen
< subtlen
) {
1525 printf("ERROR: common header too large %u > %u", subtlen
,
1530 subtptr
+=sizeof(const struct rsvp_common_header
);
1531 subtlen
-=sizeof(const struct rsvp_common_header
);
1533 if (rsvp_obj_print(subtptr
,"\n\t ", subtlen
) == -1)
1536 tptr
+=subtlen
+sizeof(const struct rsvp_common_header
);
1537 tlen
-=subtlen
+sizeof(const struct rsvp_common_header
);
1542 case RSVP_MSGTYPE_PATH
:
1543 case RSVP_MSGTYPE_RESV
:
1544 case RSVP_MSGTYPE_PATHERR
:
1545 case RSVP_MSGTYPE_RESVERR
:
1546 case RSVP_MSGTYPE_PATHTEAR
:
1547 case RSVP_MSGTYPE_RESVTEAR
:
1548 case RSVP_MSGTYPE_RESVCONF
:
1549 case RSVP_MSGTYPE_HELLO_OLD
:
1550 case RSVP_MSGTYPE_HELLO
:
1551 case RSVP_MSGTYPE_ACK
:
1552 case RSVP_MSGTYPE_SREFRESH
:
1553 if (rsvp_obj_print(tptr
,"\n\t ", tlen
) == -1)
1558 print_unknown_data(tptr
,"\n\t ",tlen
);
1564 printf("\n\t\t packet exceeded snapshot");