2 * Copyright (c) 1998-2007 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.46 2007-02-26 11:07:06 hannes Exp $";
27 #include <tcpdump-stdinc.h>
33 #include "interface.h"
35 #include "addrtoname.h"
36 #include "ethertype.h"
40 * RFC 2205 common header
43 * +-------------+-------------+-------------+-------------+
44 * | Vers | Flags| Msg Type | RSVP Checksum |
45 * +-------------+-------------+-------------+-------------+
46 * | Send_TTL | (Reserved) | RSVP Length |
47 * +-------------+-------------+-------------+-------------+
51 struct rsvp_common_header
{
52 u_int8_t version_flags
;
61 * RFC2205 object header
65 * +-------------+-------------+-------------+-------------+
66 * | Length (bytes) | Class-Num | C-Type |
67 * +-------------+-------------+-------------+-------------+
69 * // (Object contents) //
71 * +-------------+-------------+-------------+-------------+
74 struct rsvp_object_header
{
80 #define RSVP_VERSION 1
81 #define RSVP_EXTRACT_VERSION(x) (((x)&0xf0)>>4)
82 #define RSVP_EXTRACT_FLAGS(x) ((x)&0x0f)
84 #define RSVP_MSGTYPE_PATH 1
85 #define RSVP_MSGTYPE_RESV 2
86 #define RSVP_MSGTYPE_PATHERR 3
87 #define RSVP_MSGTYPE_RESVERR 4
88 #define RSVP_MSGTYPE_PATHTEAR 5
89 #define RSVP_MSGTYPE_RESVTEAR 6
90 #define RSVP_MSGTYPE_RESVCONF 7
91 #define RSVP_MSGTYPE_AGGREGATE 12
92 #define RSVP_MSGTYPE_ACK 13
93 #define RSVP_MSGTYPE_HELLO_OLD 14 /* ancient Hellos */
94 #define RSVP_MSGTYPE_SREFRESH 15
95 #define RSVP_MSGTYPE_HELLO 20
97 static const struct tok rsvp_msg_type_values
[] = {
98 { RSVP_MSGTYPE_PATH
, "Path" },
99 { RSVP_MSGTYPE_RESV
, "Resv" },
100 { RSVP_MSGTYPE_PATHERR
, "PathErr" },
101 { RSVP_MSGTYPE_RESVERR
, "ResvErr" },
102 { RSVP_MSGTYPE_PATHTEAR
, "PathTear" },
103 { RSVP_MSGTYPE_RESVTEAR
, "ResvTear" },
104 { RSVP_MSGTYPE_RESVCONF
, "ResvConf" },
105 { RSVP_MSGTYPE_AGGREGATE
, "Aggregate" },
106 { RSVP_MSGTYPE_ACK
, "Acknowledgement" },
107 { RSVP_MSGTYPE_HELLO_OLD
, "Hello (Old)" },
108 { RSVP_MSGTYPE_SREFRESH
, "Refresh" },
109 { RSVP_MSGTYPE_HELLO
, "Hello" },
113 static const struct tok rsvp_header_flag_values
[] = {
114 { 0x01, "Refresh reduction capable" }, /* rfc2961 */
118 #define RSVP_OBJ_SESSION 1 /* rfc2205 */
119 #define RSVP_OBJ_RSVP_HOP 3 /* rfc2205, rfc3473 */
120 #define RSVP_OBJ_INTEGRITY 4 /* rfc2747 */
121 #define RSVP_OBJ_TIME_VALUES 5 /* rfc2205 */
122 #define RSVP_OBJ_ERROR_SPEC 6
123 #define RSVP_OBJ_SCOPE 7
124 #define RSVP_OBJ_STYLE 8 /* rfc2205 */
125 #define RSVP_OBJ_FLOWSPEC 9 /* rfc2215 */
126 #define RSVP_OBJ_FILTERSPEC 10 /* rfc2215 */
127 #define RSVP_OBJ_SENDER_TEMPLATE 11
128 #define RSVP_OBJ_SENDER_TSPEC 12 /* rfc2215 */
129 #define RSVP_OBJ_ADSPEC 13 /* rfc2215 */
130 #define RSVP_OBJ_POLICY_DATA 14
131 #define RSVP_OBJ_CONFIRM 15 /* rfc2205 */
132 #define RSVP_OBJ_LABEL 16 /* rfc3209 */
133 #define RSVP_OBJ_LABEL_REQ 19 /* rfc3209 */
134 #define RSVP_OBJ_ERO 20 /* rfc3209 */
135 #define RSVP_OBJ_RRO 21 /* rfc3209 */
136 #define RSVP_OBJ_HELLO 22 /* rfc3209 */
137 #define RSVP_OBJ_MESSAGE_ID 23 /* rfc2961 */
138 #define RSVP_OBJ_MESSAGE_ID_ACK 24 /* rfc2961 */
139 #define RSVP_OBJ_MESSAGE_ID_LIST 25 /* rfc2961 */
140 #define RSVP_OBJ_RECOVERY_LABEL 34 /* rfc3473 */
141 #define RSVP_OBJ_UPSTREAM_LABEL 35 /* rfc3473 */
142 #define RSVP_OBJ_LABEL_SET 36 /* rfc3473 */
143 #define RSVP_OBJ_PROTECTION 37 /* rfc3473 */
144 #define RSVP_OBJ_DETOUR 63 /* draft-ietf-mpls-rsvp-lsp-fastreroute-07 */
145 #define RSVP_OBJ_CLASSTYPE 66 /* rfc4124 */
146 #define RSVP_OBJ_CLASSTYPE_OLD 125 /* draft-ietf-tewg-diff-te-proto-07 */
147 #define RSVP_OBJ_SUGGESTED_LABEL 129 /* rfc3473 */
148 #define RSVP_OBJ_ACCEPT_LABEL_SET 130 /* rfc3473 */
149 #define RSVP_OBJ_RESTART_CAPABILITY 131 /* rfc3473 */
150 #define RSVP_OBJ_NOTIFY_REQ 195 /* rfc3473 */
151 #define RSVP_OBJ_ADMIN_STATUS 196 /* rfc3473 */
152 #define RSVP_OBJ_PROPERTIES 204 /* juniper proprietary */
153 #define RSVP_OBJ_FASTREROUTE 205 /* draft-ietf-mpls-rsvp-lsp-fastreroute-07 */
154 #define RSVP_OBJ_SESSION_ATTRIBUTE 207 /* rfc3209 */
155 #define RSVP_OBJ_CALL_ID 230 /* rfc3474 */
156 #define RSVP_OBJ_CALL_OPS 236 /* rfc3474 */
158 static const struct tok rsvp_obj_values
[] = {
159 { RSVP_OBJ_SESSION
, "Session" },
160 { RSVP_OBJ_RSVP_HOP
, "RSVP Hop" },
161 { RSVP_OBJ_INTEGRITY
, "Integrity" },
162 { RSVP_OBJ_TIME_VALUES
, "Time Values" },
163 { RSVP_OBJ_ERROR_SPEC
, "Error Spec" },
164 { RSVP_OBJ_SCOPE
, "Scope" },
165 { RSVP_OBJ_STYLE
, "Style" },
166 { RSVP_OBJ_FLOWSPEC
, "Flowspec" },
167 { RSVP_OBJ_FILTERSPEC
, "FilterSpec" },
168 { RSVP_OBJ_SENDER_TEMPLATE
, "Sender Template" },
169 { RSVP_OBJ_SENDER_TSPEC
, "Sender TSpec" },
170 { RSVP_OBJ_ADSPEC
, "Adspec" },
171 { RSVP_OBJ_POLICY_DATA
, "Policy Data" },
172 { RSVP_OBJ_CONFIRM
, "Confirm" },
173 { RSVP_OBJ_LABEL
, "Label" },
174 { RSVP_OBJ_LABEL_REQ
, "Label Request" },
175 { RSVP_OBJ_ERO
, "ERO" },
176 { RSVP_OBJ_RRO
, "RRO" },
177 { RSVP_OBJ_HELLO
, "Hello" },
178 { RSVP_OBJ_MESSAGE_ID
, "Message ID" },
179 { RSVP_OBJ_MESSAGE_ID_ACK
, "Message ID Ack" },
180 { RSVP_OBJ_MESSAGE_ID_LIST
, "Message ID List" },
181 { RSVP_OBJ_RECOVERY_LABEL
, "Recovery Label" },
182 { RSVP_OBJ_UPSTREAM_LABEL
, "Upstream Label" },
183 { RSVP_OBJ_LABEL_SET
, "Label Set" },
184 { RSVP_OBJ_ACCEPT_LABEL_SET
, "Acceptable Label Set" },
185 { RSVP_OBJ_DETOUR
, "Detour" },
186 { RSVP_OBJ_CLASSTYPE
, "Class Type" },
187 { RSVP_OBJ_CLASSTYPE_OLD
, "Class Type (old)" },
188 { RSVP_OBJ_SUGGESTED_LABEL
, "Suggested Label" },
189 { RSVP_OBJ_PROPERTIES
, "Properties" },
190 { RSVP_OBJ_FASTREROUTE
, "Fast Re-Route" },
191 { RSVP_OBJ_SESSION_ATTRIBUTE
, "Session Attribute" },
192 { RSVP_OBJ_CALL_ID
, "Call-ID" },
193 { RSVP_OBJ_CALL_OPS
, "Call Capability" },
194 { RSVP_OBJ_RESTART_CAPABILITY
, "Restart Capability" },
195 { RSVP_OBJ_NOTIFY_REQ
, "Notify Request" },
196 { RSVP_OBJ_PROTECTION
, "Protection" },
197 { RSVP_OBJ_ADMIN_STATUS
, "Administrative Status" },
201 #define RSVP_CTYPE_IPV4 1
202 #define RSVP_CTYPE_IPV6 2
203 #define RSVP_CTYPE_TUNNEL_IPV4 7
204 #define RSVP_CTYPE_TUNNEL_IPV6 8
205 #define RSVP_CTYPE_1 1
206 #define RSVP_CTYPE_2 2
207 #define RSVP_CTYPE_3 3
208 #define RSVP_CTYPE_4 4
211 * the ctypes are not globally unique so for
212 * translating it to strings we build a table based
213 * on objects offsetted by the ctype
216 static const struct tok rsvp_ctype_values
[] = {
217 { 256*RSVP_OBJ_RSVP_HOP
+RSVP_CTYPE_IPV4
, "IPv4" },
218 { 256*RSVP_OBJ_RSVP_HOP
+RSVP_CTYPE_IPV6
, "IPv6" },
219 { 256*RSVP_OBJ_RSVP_HOP
+RSVP_CTYPE_3
, "IPv4 plus opt. TLVs" },
220 { 256*RSVP_OBJ_RSVP_HOP
+RSVP_CTYPE_4
, "IPv6 plus opt. TLVs" },
221 { 256*RSVP_OBJ_NOTIFY_REQ
+RSVP_CTYPE_IPV4
, "IPv4" },
222 { 256*RSVP_OBJ_NOTIFY_REQ
+RSVP_CTYPE_IPV6
, "IPv6" },
223 { 256*RSVP_OBJ_CONFIRM
+RSVP_CTYPE_IPV4
, "IPv4" },
224 { 256*RSVP_OBJ_CONFIRM
+RSVP_CTYPE_IPV6
, "IPv6" },
225 { 256*RSVP_OBJ_TIME_VALUES
+RSVP_CTYPE_1
, "1" },
226 { 256*RSVP_OBJ_FLOWSPEC
+RSVP_CTYPE_1
, "obsolete" },
227 { 256*RSVP_OBJ_FLOWSPEC
+RSVP_CTYPE_2
, "IntServ" },
228 { 256*RSVP_OBJ_SENDER_TSPEC
+RSVP_CTYPE_2
, "IntServ" },
229 { 256*RSVP_OBJ_ADSPEC
+RSVP_CTYPE_2
, "IntServ" },
230 { 256*RSVP_OBJ_FILTERSPEC
+RSVP_CTYPE_IPV4
, "IPv4" },
231 { 256*RSVP_OBJ_FILTERSPEC
+RSVP_CTYPE_IPV6
, "IPv6" },
232 { 256*RSVP_OBJ_FILTERSPEC
+RSVP_CTYPE_3
, "IPv6 Flow-label" },
233 { 256*RSVP_OBJ_FILTERSPEC
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
234 { 256*RSVP_OBJ_SESSION
+RSVP_CTYPE_IPV4
, "IPv4" },
235 { 256*RSVP_OBJ_SESSION
+RSVP_CTYPE_IPV6
, "IPv6" },
236 { 256*RSVP_OBJ_SESSION
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
237 { 256*RSVP_OBJ_SENDER_TEMPLATE
+RSVP_CTYPE_IPV4
, "IPv4" },
238 { 256*RSVP_OBJ_SENDER_TEMPLATE
+RSVP_CTYPE_IPV6
, "IPv6" },
239 { 256*RSVP_OBJ_SENDER_TEMPLATE
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
240 { 256*RSVP_OBJ_MESSAGE_ID
+RSVP_CTYPE_1
, "1" },
241 { 256*RSVP_OBJ_MESSAGE_ID_ACK
+RSVP_CTYPE_1
, "Message id ack" },
242 { 256*RSVP_OBJ_MESSAGE_ID_ACK
+RSVP_CTYPE_2
, "Message id nack" },
243 { 256*RSVP_OBJ_MESSAGE_ID_LIST
+RSVP_CTYPE_1
, "1" },
244 { 256*RSVP_OBJ_STYLE
+RSVP_CTYPE_1
, "1" },
245 { 256*RSVP_OBJ_HELLO
+RSVP_CTYPE_1
, "Hello Request" },
246 { 256*RSVP_OBJ_HELLO
+RSVP_CTYPE_2
, "Hello Ack" },
247 { 256*RSVP_OBJ_LABEL_REQ
+RSVP_CTYPE_1
, "without label range" },
248 { 256*RSVP_OBJ_LABEL_REQ
+RSVP_CTYPE_2
, "with ATM label range" },
249 { 256*RSVP_OBJ_LABEL_REQ
+RSVP_CTYPE_3
, "with FR label range" },
250 { 256*RSVP_OBJ_LABEL_REQ
+RSVP_CTYPE_4
, "Generalized Label" },
251 { 256*RSVP_OBJ_LABEL
+RSVP_CTYPE_1
, "Label" },
252 { 256*RSVP_OBJ_LABEL
+RSVP_CTYPE_2
, "Generalized Label" },
253 { 256*RSVP_OBJ_LABEL
+RSVP_CTYPE_3
, "Waveband Switching" },
254 { 256*RSVP_OBJ_SUGGESTED_LABEL
+RSVP_CTYPE_1
, "Label" },
255 { 256*RSVP_OBJ_SUGGESTED_LABEL
+RSVP_CTYPE_2
, "Generalized Label" },
256 { 256*RSVP_OBJ_SUGGESTED_LABEL
+RSVP_CTYPE_3
, "Waveband Switching" },
257 { 256*RSVP_OBJ_UPSTREAM_LABEL
+RSVP_CTYPE_1
, "Label" },
258 { 256*RSVP_OBJ_UPSTREAM_LABEL
+RSVP_CTYPE_2
, "Generalized Label" },
259 { 256*RSVP_OBJ_UPSTREAM_LABEL
+RSVP_CTYPE_3
, "Waveband Switching" },
260 { 256*RSVP_OBJ_RECOVERY_LABEL
+RSVP_CTYPE_1
, "Label" },
261 { 256*RSVP_OBJ_RECOVERY_LABEL
+RSVP_CTYPE_2
, "Generalized Label" },
262 { 256*RSVP_OBJ_RECOVERY_LABEL
+RSVP_CTYPE_3
, "Waveband Switching" },
263 { 256*RSVP_OBJ_ERO
+RSVP_CTYPE_IPV4
, "IPv4" },
264 { 256*RSVP_OBJ_RRO
+RSVP_CTYPE_IPV4
, "IPv4" },
265 { 256*RSVP_OBJ_ERROR_SPEC
+RSVP_CTYPE_IPV4
, "IPv4" },
266 { 256*RSVP_OBJ_ERROR_SPEC
+RSVP_CTYPE_IPV6
, "IPv6" },
267 { 256*RSVP_OBJ_ERROR_SPEC
+RSVP_CTYPE_3
, "IPv4 plus opt. TLVs" },
268 { 256*RSVP_OBJ_ERROR_SPEC
+RSVP_CTYPE_4
, "IPv6 plus opt. TLVs" },
269 { 256*RSVP_OBJ_RESTART_CAPABILITY
+RSVP_CTYPE_1
, "IPv4" },
270 { 256*RSVP_OBJ_SESSION_ATTRIBUTE
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
271 { 256*RSVP_OBJ_FASTREROUTE
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" }, /* old style*/
272 { 256*RSVP_OBJ_FASTREROUTE
+RSVP_CTYPE_1
, "1" }, /* new style */
273 { 256*RSVP_OBJ_DETOUR
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
274 { 256*RSVP_OBJ_PROPERTIES
+RSVP_CTYPE_1
, "1" },
275 { 256*RSVP_OBJ_ADMIN_STATUS
+RSVP_CTYPE_1
, "1" },
276 { 256*RSVP_OBJ_CLASSTYPE
+RSVP_CTYPE_1
, "1" },
277 { 256*RSVP_OBJ_CLASSTYPE_OLD
+RSVP_CTYPE_1
, "1" },
278 { 256*RSVP_OBJ_LABEL_SET
+RSVP_CTYPE_1
, "1" },
282 struct rsvp_obj_integrity_t
{
286 u_int8_t sequence
[8];
290 static const struct tok rsvp_obj_integrity_flag_values
[] = {
291 { 0x80, "Handshake" },
295 struct rsvp_obj_frr_t
{
300 u_int8_t bandwidth
[4];
301 u_int8_t include_any
[4];
302 u_int8_t exclude_any
[4];
303 u_int8_t include_all
[4];
307 #define RSVP_OBJ_XRO_MASK_SUBOBJ(x) ((x)&0x7f)
308 #define RSVP_OBJ_XRO_MASK_LOOSE(x) ((x)&0x80)
310 #define RSVP_OBJ_XRO_RES 0
311 #define RSVP_OBJ_XRO_IPV4 1
312 #define RSVP_OBJ_XRO_IPV6 2
313 #define RSVP_OBJ_XRO_ASN 32
314 #define RSVP_OBJ_XRO_MPLS 64
316 static const struct tok rsvp_obj_xro_values
[] = {
317 { RSVP_OBJ_XRO_RES
, "Reserved" },
318 { RSVP_OBJ_XRO_IPV4
, "IPv4 prefix" },
319 { RSVP_OBJ_XRO_IPV6
, "IPv6 prefix" },
320 { RSVP_OBJ_XRO_ASN
, "Autonomous system number" },
321 { RSVP_OBJ_XRO_MPLS
, "MPLS label switched path termination" },
325 /* draft-ietf-mpls-rsvp-lsp-fastreroute-07.txt */
326 static const struct tok rsvp_obj_rro_flag_values
[] = {
327 { 0x01, "Local protection available" },
328 { 0x02, "Local protection in use" },
329 { 0x04, "Bandwidth protection" },
330 { 0x08, "Node protection" },
334 static const struct tok rsvp_resstyle_values
[] = {
335 { 17, "Wildcard Filter" },
336 { 10, "Fixed Filter" },
337 { 18, "Shared Explicit" },
341 #define RSVP_OBJ_INTSERV_GUARANTEED_SERV 2
342 #define RSVP_OBJ_INTSERV_CONTROLLED_LOAD 5
344 static const struct tok rsvp_intserv_service_type_values
[] = {
345 { 1, "Default/Global Information" },
346 { RSVP_OBJ_INTSERV_GUARANTEED_SERV
, "Guaranteed Service" },
347 { RSVP_OBJ_INTSERV_CONTROLLED_LOAD
, "Controlled Load" },
351 static const struct tok rsvp_intserv_parameter_id_values
[] = {
353 { 6, "Path b/w estimate" },
354 { 8, "Minimum path latency" },
355 { 10, "Composed MTU" },
356 { 127, "Token Bucket TSpec" },
357 { 130, "Guaranteed Service RSpec" },
358 { 133, "End-to-end composed value for C" },
359 { 134, "End-to-end composed value for D" },
360 { 135, "Since-last-reshaping point composed C" },
361 { 136, "Since-last-reshaping point composed D" },
365 static struct tok rsvp_session_attribute_flag_values
[] = {
366 { 0x01, "Local Protection desired" },
367 { 0x02, "Label Recording desired" },
368 { 0x04, "SE Style desired" },
369 { 0x08, "Bandwidth protection desired" }, /* draft-ietf-mpls-rsvp-lsp-fastreroute-02.txt */
370 { 0x10, "Node protection desired" }, /* draft-ietf-mpls-rsvp-lsp-fastreroute-02.txt */
374 static struct tok rsvp_obj_prop_tlv_values
[] = {
376 { 0x02, "Metric 1" },
377 { 0x04, "Metric 2" },
378 { 0x08, "CCC Status" },
379 { 0x10, "Path Type" },
383 #define RSVP_OBJ_ERROR_SPEC_CODE_ROUTING 24
384 #define RSVP_OBJ_ERROR_SPEC_CODE_NOTIFY 25
385 #define RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE 28
386 #define RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE_OLD 125
388 static struct tok rsvp_obj_error_code_values
[] = {
389 { RSVP_OBJ_ERROR_SPEC_CODE_ROUTING
, "Routing Problem" },
390 { RSVP_OBJ_ERROR_SPEC_CODE_NOTIFY
, "Notify Error" },
391 { RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE
, "Diffserv TE Error" },
392 { RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE_OLD
, "Diffserv TE Error (Old)" },
396 static struct tok rsvp_obj_error_code_routing_values
[] = {
397 { 1, "Bad EXPLICIT_ROUTE object" },
398 { 2, "Bad strict node" },
399 { 3, "Bad loose node" },
400 { 4, "Bad initial subobject" },
401 { 5, "No route available toward destination" },
402 { 6, "Unacceptable label value" },
403 { 7, "RRO indicated routing loops" },
404 { 8, "non-RSVP-capable router in the path" },
405 { 9, "MPLS label allocation failure" },
406 { 10, "Unsupported L3PID" },
410 static struct tok rsvp_obj_error_code_diffserv_te_values
[] = {
411 { 1, "Unexpected CT object" },
412 { 2, "Unsupported CT" },
413 { 3, "Invalid CT value" },
414 { 4, "CT/setup priority do not form a configured TE-Class" },
415 { 5, "CT/holding priority do not form a configured TE-Class" },
416 { 6, "CT/setup priority and CT/holding priority do not form a configured TE-Class" },
417 { 7, "Inconsistency between signaled PSC and signaled CT" },
418 { 8, "Inconsistency between signaled PHBs and signaled CT" },
422 /* rfc3473 / rfc 3471 */
423 static const struct tok rsvp_obj_admin_status_flag_values
[] = {
424 { 0x80000000, "Reflect" },
425 { 0x00000004, "Testing" },
426 { 0x00000002, "Admin-down" },
427 { 0x00000001, "Delete-in-progress" },
431 /* label set actions - rfc3471 */
432 #define LABEL_SET_INCLUSIVE_LIST 0
433 #define LABEL_SET_EXCLUSIVE_LIST 1
434 #define LABEL_SET_INCLUSIVE_RANGE 2
435 #define LABEL_SET_EXCLUSIVE_RANGE 3
437 static const struct tok label_set_action_values
[] = {
438 { LABEL_SET_INCLUSIVE_LIST
, "Inclusive list" },
439 { LABEL_SET_EXCLUSIVE_LIST
, "Exclusive list" },
440 { LABEL_SET_INCLUSIVE_RANGE
, "Inclusive range" },
441 { LABEL_SET_EXCLUSIVE_RANGE
, "Exclusive range" },
445 static int rsvp_intserv_print(const u_char
*, u_short
);
448 * this is a dissector for all the intserv defined
449 * specs as defined per rfc2215
450 * it is called from various rsvp objects;
451 * returns the amount of bytes being processed
454 rsvp_intserv_print(const u_char
*tptr
, u_short obj_tlen
) {
456 int parameter_id
,parameter_length
;
464 parameter_id
= *(tptr
);
465 parameter_length
= EXTRACT_16BITS(tptr
+2)<<2; /* convert wordcount to bytecount */
467 printf("\n\t Parameter ID: %s (%u), length: %u, Flags: [0x%02x]",
468 tok2str(rsvp_intserv_parameter_id_values
,"unknown",parameter_id
),
473 if (obj_tlen
< parameter_length
+4)
475 switch(parameter_id
) { /* parameter_id */
479 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
480 * | 4 (e) | (f) | 1 (g) |
481 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
482 * | IS hop cnt (32-bit unsigned integer) |
483 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
485 if (parameter_length
== 4)
486 printf("\n\t\tIS hop count: %u", EXTRACT_32BITS(tptr
+4));
491 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
492 * | 6 (h) | (i) | 1 (j) |
493 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
494 * | Path b/w estimate (32-bit IEEE floating point number) |
495 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
497 if (parameter_length
== 4) {
498 bw
.i
= EXTRACT_32BITS(tptr
+4);
499 printf("\n\t\tPath b/w estimate: %.10g Mbps", bw
.f
/125000);
505 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
506 * | 8 (k) | (l) | 1 (m) |
507 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
508 * | Minimum path latency (32-bit integer) |
509 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
511 if (parameter_length
== 4) {
512 printf("\n\t\tMinimum path latency: ");
513 if (EXTRACT_32BITS(tptr
+4) == 0xffffffff)
514 printf("don't care");
516 printf("%u", EXTRACT_32BITS(tptr
+4));
523 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
524 * | 10 (n) | (o) | 1 (p) |
525 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
526 * | Composed MTU (32-bit unsigned integer) |
527 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
529 if (parameter_length
== 4)
530 printf("\n\t\tComposed MTU: %u bytes", EXTRACT_32BITS(tptr
+4));
534 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
535 * | 127 (e) | 0 (f) | 5 (g) |
536 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
537 * | Token Bucket Rate [r] (32-bit IEEE floating point number) |
538 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
539 * | Token Bucket Size [b] (32-bit IEEE floating point number) |
540 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
541 * | Peak Data Rate [p] (32-bit IEEE floating point number) |
542 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
543 * | Minimum Policed Unit [m] (32-bit integer) |
544 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
545 * | Maximum Packet Size [M] (32-bit integer) |
546 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
549 if (parameter_length
== 20) {
550 bw
.i
= EXTRACT_32BITS(tptr
+4);
551 printf("\n\t\tToken Bucket Rate: %.10g Mbps", bw
.f
/125000);
552 bw
.i
= EXTRACT_32BITS(tptr
+8);
553 printf("\n\t\tToken Bucket Size: %.10g bytes", bw
.f
);
554 bw
.i
= EXTRACT_32BITS(tptr
+12);
555 printf("\n\t\tPeak Data Rate: %.10g Mbps", bw
.f
/125000);
556 printf("\n\t\tMinimum Policed Unit: %u bytes", EXTRACT_32BITS(tptr
+16));
557 printf("\n\t\tMaximum Packet Size: %u bytes", EXTRACT_32BITS(tptr
+20));
563 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
564 * | 130 (h) | 0 (i) | 2 (j) |
565 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
566 * | Rate [R] (32-bit IEEE floating point number) |
567 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
568 * | Slack Term [S] (32-bit integer) |
569 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
572 if (parameter_length
== 8) {
573 bw
.i
= EXTRACT_32BITS(tptr
+4);
574 printf("\n\t\tRate: %.10g Mbps", bw
.f
/125000);
575 printf("\n\t\tSlack Term: %u", EXTRACT_32BITS(tptr
+8));
583 if (parameter_length
== 4)
584 printf("\n\t\tValue: %u", EXTRACT_32BITS(tptr
+4));
589 print_unknown_data(tptr
+4,"\n\t\t",parameter_length
);
591 return (parameter_length
+4); /* header length 4 bytes */
595 rsvp_obj_print (const u_char
*tptr
, const char *ident
, u_int tlen
) {
597 const struct rsvp_object_header
*rsvp_obj_header
;
598 const u_char
*obj_tptr
;
600 const struct rsvp_obj_integrity_t
*rsvp_obj_integrity
;
601 const struct rsvp_obj_frr_t
*rsvp_obj_frr
;
604 u_short rsvp_obj_len
,rsvp_obj_ctype
,obj_tlen
,intserv_serv_tlen
;
605 int hexdump
,processed
,padbytes
,error_code
,error_value
,i
;
612 while(tlen
>=sizeof(struct rsvp_object_header
)) {
613 /* did we capture enough for fully decoding the object header ? */
614 if (!TTEST2(*tptr
, sizeof(struct rsvp_object_header
)))
617 rsvp_obj_header
= (const struct rsvp_object_header
*)tptr
;
618 rsvp_obj_len
=EXTRACT_16BITS(rsvp_obj_header
->length
);
619 rsvp_obj_ctype
=rsvp_obj_header
->ctype
;
621 if(rsvp_obj_len
% 4) {
622 printf("%sERROR: object header size %u not a multiple of 4", ident
, rsvp_obj_len
);
625 if(rsvp_obj_len
< sizeof(struct rsvp_object_header
)) {
626 printf("%sERROR: object header too short %u < %lu", ident
, rsvp_obj_len
,
627 (unsigned long)sizeof(const struct rsvp_object_header
));
631 printf("%s%s Object (%u) Flags: [%s",
633 tok2str(rsvp_obj_values
,
635 rsvp_obj_header
->class_num
),
636 rsvp_obj_header
->class_num
,
637 ((rsvp_obj_header
->class_num
)&0x80) ? "ignore" : "reject");
639 if (rsvp_obj_header
->class_num
> 128)
641 ((rsvp_obj_header
->class_num
)&0x40) ? "and forward" : "silently");
643 printf(" if unknown], Class-Type: %s (%u), length: %u",
644 tok2str(rsvp_ctype_values
,
646 ((rsvp_obj_header
->class_num
)<<8)+rsvp_obj_ctype
),
650 if(tlen
< rsvp_obj_len
) {
651 printf("%sERROR: object goes past end of objects TLV", ident
);
655 obj_tptr
=tptr
+sizeof(struct rsvp_object_header
);
656 obj_tlen
=rsvp_obj_len
-sizeof(struct rsvp_object_header
);
658 /* did we capture enough for fully decoding the object ? */
659 if (!TTEST2(*tptr
, rsvp_obj_len
))
663 switch(rsvp_obj_header
->class_num
) {
664 case RSVP_OBJ_SESSION
:
665 switch(rsvp_obj_ctype
) {
666 case RSVP_CTYPE_IPV4
:
669 printf("%s IPv4 DestAddress: %s, Protocol ID: 0x%02x",
671 ipaddr_string(obj_tptr
),
672 *(obj_tptr
+sizeof(struct in_addr
)));
673 printf("%s Flags: [0x%02x], DestPort %u",
676 EXTRACT_16BITS(obj_tptr
+6));
681 case RSVP_CTYPE_IPV6
:
684 printf("%s IPv6 DestAddress: %s, Protocol ID: 0x%02x",
686 ip6addr_string(obj_tptr
),
687 *(obj_tptr
+sizeof(struct in6_addr
)));
688 printf("%s Flags: [0x%02x], DestPort %u",
690 *(obj_tptr
+sizeof(struct in6_addr
)+1),
691 EXTRACT_16BITS(obj_tptr
+sizeof(struct in6_addr
)+2));
696 case RSVP_CTYPE_TUNNEL_IPV6
:
699 printf("%s IPv6 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
701 ip6addr_string(obj_tptr
),
702 EXTRACT_16BITS(obj_tptr
+18),
703 ip6addr_string(obj_tptr
+20));
708 case RSVP_CTYPE_TUNNEL_IPV4
:
711 printf("%s IPv4 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
713 ipaddr_string(obj_tptr
),
714 EXTRACT_16BITS(obj_tptr
+6),
715 ipaddr_string(obj_tptr
+8));
724 case RSVP_OBJ_CONFIRM
:
725 switch(rsvp_obj_ctype
) {
726 case RSVP_CTYPE_IPV4
:
727 if (obj_tlen
< sizeof(struct in_addr
))
729 printf("%s IPv4 Receiver 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 Receiver 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_NOTIFY_REQ
:
752 switch(rsvp_obj_ctype
) {
753 case RSVP_CTYPE_IPV4
:
754 if (obj_tlen
< sizeof(struct in_addr
))
756 printf("%s IPv4 Notify Node Address: %s",
758 ipaddr_string(obj_tptr
));
759 obj_tlen
-=sizeof(struct in_addr
);
760 obj_tptr
+=sizeof(struct in_addr
);
763 case RSVP_CTYPE_IPV6
:
764 if (obj_tlen
< sizeof(struct in6_addr
))
766 printf("%s IPv6 Notify Node Address: %s",
768 ip6addr_string(obj_tptr
));
769 obj_tlen
-=sizeof(struct in6_addr
);
770 obj_tptr
+=sizeof(struct in6_addr
);
778 case RSVP_OBJ_SUGGESTED_LABEL
: /* fall through */
779 case RSVP_OBJ_UPSTREAM_LABEL
: /* fall through */
780 case RSVP_OBJ_RECOVERY_LABEL
: /* fall through */
782 switch(rsvp_obj_ctype
) {
784 while(obj_tlen
>= 4 ) {
785 printf("%s Label: %u", ident
, EXTRACT_32BITS(obj_tptr
));
793 printf("%s Generalized Label: %u",
795 EXTRACT_32BITS(obj_tptr
));
802 printf("%s Waveband ID: %u%s Start Label: %u, Stop Label: %u",
804 EXTRACT_32BITS(obj_tptr
),
806 EXTRACT_32BITS(obj_tptr
+4),
807 EXTRACT_32BITS(obj_tptr
+8));
817 switch(rsvp_obj_ctype
) {
821 printf("%s Reservation Style: %s, Flags: [0x%02x]",
823 tok2str(rsvp_resstyle_values
,
825 EXTRACT_24BITS(obj_tptr
+1)),
835 case RSVP_OBJ_SENDER_TEMPLATE
:
836 switch(rsvp_obj_ctype
) {
837 case RSVP_CTYPE_IPV4
:
840 printf("%s Source Address: %s, Source Port: %u",
842 ipaddr_string(obj_tptr
),
843 EXTRACT_16BITS(obj_tptr
+6));
848 case RSVP_CTYPE_IPV6
:
851 printf("%s Source Address: %s, Source Port: %u",
853 ip6addr_string(obj_tptr
),
854 EXTRACT_16BITS(obj_tptr
+18));
859 case RSVP_CTYPE_TUNNEL_IPV4
:
862 printf("%s IPv4 Tunnel Sender Address: %s, LSP-ID: 0x%04x",
864 ipaddr_string(obj_tptr
),
865 EXTRACT_16BITS(obj_tptr
+6));
874 case RSVP_OBJ_LABEL_REQ
:
875 switch(rsvp_obj_ctype
) {
877 while(obj_tlen
>= 4 ) {
878 printf("%s L3 Protocol ID: %s",
880 tok2str(ethertype_values
,
881 "Unknown Protocol (0x%04x)",
882 EXTRACT_16BITS(obj_tptr
+2)));
890 printf("%s L3 Protocol ID: %s",
892 tok2str(ethertype_values
,
893 "Unknown Protocol (0x%04x)",
894 EXTRACT_16BITS(obj_tptr
+2)));
895 printf(",%s merge capability",((*(obj_tptr
+4))&0x80) ? "no" : "" );
896 printf("%s Minimum VPI/VCI: %u/%u",
898 (EXTRACT_16BITS(obj_tptr
+4))&0xfff,
899 (EXTRACT_16BITS(obj_tptr
+6))&0xfff);
900 printf("%s Maximum VPI/VCI: %u/%u",
902 (EXTRACT_16BITS(obj_tptr
+8))&0xfff,
903 (EXTRACT_16BITS(obj_tptr
+10))&0xfff);
910 printf("%s L3 Protocol ID: %s",
912 tok2str(ethertype_values
,
913 "Unknown Protocol (0x%04x)",
914 EXTRACT_16BITS(obj_tptr
+2)));
915 printf("%s Minimum/Maximum DLCI: %u/%u, %s%s bit DLCI",
917 (EXTRACT_32BITS(obj_tptr
+4))&0x7fffff,
918 (EXTRACT_32BITS(obj_tptr
+8))&0x7fffff,
919 (((EXTRACT_16BITS(obj_tptr
+4)>>7)&3) == 0 ) ? "10" : "",
920 (((EXTRACT_16BITS(obj_tptr
+4)>>7)&3) == 2 ) ? "23" : "");
927 printf("%s LSP Encoding Type: %s (%u)",
929 tok2str(gmpls_encoding_values
,
933 printf("%s Switching Type: %s (%u), Payload ID: %s (0x%04x)",
935 tok2str(gmpls_switch_cap_values
,
939 tok2str(gmpls_payload_values
,
941 EXTRACT_16BITS(obj_tptr
+2)),
942 EXTRACT_16BITS(obj_tptr
+2));
953 switch(rsvp_obj_ctype
) {
954 case RSVP_CTYPE_IPV4
:
955 while(obj_tlen
>= 4 ) {
956 printf("%s Subobject Type: %s, length %u",
958 tok2str(rsvp_obj_xro_values
,
960 RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr
)),
963 if (*(obj_tptr
+1) == 0) { /* prevent infinite loops */
964 printf("%s ERROR: zero length ERO subtype",ident
);
968 switch(RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr
)) {
969 case RSVP_OBJ_XRO_IPV4
:
970 printf(", %s, %s/%u, Flags: [%s]",
971 RSVP_OBJ_XRO_MASK_LOOSE(*obj_tptr
) ? "Loose" : "Strict",
972 ipaddr_string(obj_tptr
+2),
974 bittok2str(rsvp_obj_rro_flag_values
,
976 *(obj_tptr
+7))); /* rfc3209 says that this field is rsvd. */
978 obj_tlen
-=*(obj_tptr
+1);
979 obj_tptr
+=*(obj_tptr
+1);
988 switch(rsvp_obj_ctype
) {
993 printf("%s Source Instance: 0x%08x, Destination Instance: 0x%08x",
995 EXTRACT_32BITS(obj_tptr
),
996 EXTRACT_32BITS(obj_tptr
+4));
1005 case RSVP_OBJ_RESTART_CAPABILITY
:
1006 switch(rsvp_obj_ctype
) {
1010 printf("%s Restart Time: %ums, Recovery Time: %ums",
1012 EXTRACT_32BITS(obj_tptr
),
1013 EXTRACT_32BITS(obj_tptr
+4));
1022 case RSVP_OBJ_SESSION_ATTRIBUTE
:
1023 switch(rsvp_obj_ctype
) {
1024 case RSVP_CTYPE_TUNNEL_IPV4
:
1027 namelen
= *(obj_tptr
+3);
1028 if (obj_tlen
< 4+namelen
)
1030 printf("%s Session Name: ", ident
);
1031 for (i
= 0; i
< namelen
; i
++)
1032 safeputchar(*(obj_tptr
+4+i
));
1033 printf("%s Setup Priority: %u, Holding Priority: %u, Flags: [%s]",
1037 tok2str(rsvp_session_attribute_flag_values
,
1041 obj_tlen
-=4+*(obj_tptr
+3);
1042 obj_tptr
+=4+*(obj_tptr
+3);
1049 case RSVP_OBJ_RSVP_HOP
:
1050 switch(rsvp_obj_ctype
) {
1051 case RSVP_CTYPE_3
: /* fall through - FIXME add TLV parser */
1052 case RSVP_CTYPE_IPV4
:
1055 printf("%s Previous/Next Interface: %s, Logical Interface Handle: 0x%08x",
1057 ipaddr_string(obj_tptr
),
1058 EXTRACT_32BITS(obj_tptr
+4));
1062 hexdump
=TRUE
; /* unless we have a TLV parser lets just hexdump */
1065 case RSVP_CTYPE_4
: /* fall through - FIXME add TLV parser */
1066 case RSVP_CTYPE_IPV6
:
1069 printf("%s Previous/Next Interface: %s, Logical Interface Handle: 0x%08x",
1071 ip6addr_string(obj_tptr
),
1072 EXTRACT_32BITS(obj_tptr
+16));
1075 hexdump
=TRUE
; /* unless we have a TLV parser lets just hexdump */
1083 case RSVP_OBJ_TIME_VALUES
:
1084 switch(rsvp_obj_ctype
) {
1088 printf("%s Refresh Period: %ums",
1090 EXTRACT_32BITS(obj_tptr
));
1099 /* those three objects do share the same semantics */
1100 case RSVP_OBJ_SENDER_TSPEC
:
1101 case RSVP_OBJ_ADSPEC
:
1102 case RSVP_OBJ_FLOWSPEC
:
1103 switch(rsvp_obj_ctype
) {
1107 printf("%s Msg-Version: %u, length: %u",
1109 (*obj_tptr
& 0xf0) >> 4,
1110 EXTRACT_16BITS(obj_tptr
+2)<<2);
1111 obj_tptr
+=4; /* get to the start of the service header */
1114 while (obj_tlen
>= 4) {
1115 intserv_serv_tlen
=EXTRACT_16BITS(obj_tptr
+2)<<2;
1116 printf("%s Service Type: %s (%u), break bit %s set, Service length: %u",
1118 tok2str(rsvp_intserv_service_type_values
,"unknown",*(obj_tptr
)),
1120 (*(obj_tptr
+1)&0x80) ? "" : "not",
1123 obj_tptr
+=4; /* get to the start of the parameter list */
1126 while (intserv_serv_tlen
>=4) {
1127 processed
= rsvp_intserv_print(obj_tptr
, obj_tlen
);
1130 obj_tlen
-=processed
;
1131 intserv_serv_tlen
-=processed
;
1132 obj_tptr
+=processed
;
1141 case RSVP_OBJ_FILTERSPEC
:
1142 switch(rsvp_obj_ctype
) {
1143 case RSVP_CTYPE_IPV4
:
1146 printf("%s Source Address: %s, Source Port: %u",
1148 ipaddr_string(obj_tptr
),
1149 EXTRACT_16BITS(obj_tptr
+6));
1154 case RSVP_CTYPE_IPV6
:
1157 printf("%s Source Address: %s, Source Port: %u",
1159 ip6addr_string(obj_tptr
),
1160 EXTRACT_16BITS(obj_tptr
+18));
1167 printf("%s Source Address: %s, Flow Label: %u",
1169 ip6addr_string(obj_tptr
),
1170 EXTRACT_24BITS(obj_tptr
+17));
1174 case RSVP_CTYPE_TUNNEL_IPV6
:
1177 printf("%s Source Address: %s, LSP-ID: 0x%04x",
1179 ipaddr_string(obj_tptr
),
1180 EXTRACT_16BITS(obj_tptr
+18));
1185 case RSVP_CTYPE_TUNNEL_IPV4
:
1188 printf("%s Source Address: %s, LSP-ID: 0x%04x",
1190 ipaddr_string(obj_tptr
),
1191 EXTRACT_16BITS(obj_tptr
+6));
1200 case RSVP_OBJ_FASTREROUTE
:
1201 /* the differences between c-type 1 and 7 are minor */
1202 obj_ptr
.rsvp_obj_frr
= (const struct rsvp_obj_frr_t
*)obj_tptr
;
1203 bw
.i
= EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->bandwidth
);
1205 switch(rsvp_obj_ctype
) {
1206 case RSVP_CTYPE_1
: /* new style */
1207 if (obj_tlen
< sizeof(struct rsvp_obj_frr_t
))
1209 printf("%s Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps",
1211 (int)obj_ptr
.rsvp_obj_frr
->setup_prio
,
1212 (int)obj_ptr
.rsvp_obj_frr
->hold_prio
,
1213 (int)obj_ptr
.rsvp_obj_frr
->hop_limit
,
1215 printf("%s Include-any: 0x%08x, Exclude-any: 0x%08x, Include-all: 0x%08x",
1217 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->include_any
),
1218 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->exclude_any
),
1219 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->include_all
));
1220 obj_tlen
-=sizeof(struct rsvp_obj_frr_t
);
1221 obj_tptr
+=sizeof(struct rsvp_obj_frr_t
);
1224 case RSVP_CTYPE_TUNNEL_IPV4
: /* old style */
1227 printf("%s Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps",
1229 (int)obj_ptr
.rsvp_obj_frr
->setup_prio
,
1230 (int)obj_ptr
.rsvp_obj_frr
->hold_prio
,
1231 (int)obj_ptr
.rsvp_obj_frr
->hop_limit
,
1233 printf("%s Include Colors: 0x%08x, Exclude Colors: 0x%08x",
1235 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->include_any
),
1236 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->exclude_any
));
1246 case RSVP_OBJ_DETOUR
:
1247 switch(rsvp_obj_ctype
) {
1248 case RSVP_CTYPE_TUNNEL_IPV4
:
1249 while(obj_tlen
>= 8) {
1250 printf("%s PLR-ID: %s, Avoid-Node-ID: %s",
1252 ipaddr_string(obj_tptr
),
1253 ipaddr_string(obj_tptr
+4));
1263 case RSVP_OBJ_CLASSTYPE
:
1264 case RSVP_OBJ_CLASSTYPE_OLD
: /* fall through */
1265 switch(rsvp_obj_ctype
) {
1269 EXTRACT_32BITS(obj_tptr
)&0x7);
1278 case RSVP_OBJ_ERROR_SPEC
:
1279 switch(rsvp_obj_ctype
) {
1280 case RSVP_CTYPE_3
: /* fall through - FIXME add TLV parser */
1281 case RSVP_CTYPE_IPV4
:
1284 error_code
=*(obj_tptr
+5);
1285 error_value
=EXTRACT_16BITS(obj_tptr
+6);
1286 printf("%s Error Node Address: %s, Flags: [0x%02x]%s Error Code: %s (%u)",
1288 ipaddr_string(obj_tptr
),
1291 tok2str(rsvp_obj_error_code_values
,"unknown",error_code
),
1293 switch (error_code
) {
1294 case RSVP_OBJ_ERROR_SPEC_CODE_ROUTING
:
1295 printf(", Error Value: %s (%u)",
1296 tok2str(rsvp_obj_error_code_routing_values
,"unknown",error_value
),
1299 case RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE
: /* fall through */
1300 case RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE_OLD
:
1301 printf(", Error Value: %s (%u)",
1302 tok2str(rsvp_obj_error_code_diffserv_te_values
,"unknown",error_value
),
1306 printf(", Unknown Error Value (%u)", error_value
);
1313 case RSVP_CTYPE_4
: /* fall through - FIXME add TLV parser */
1314 case RSVP_CTYPE_IPV6
:
1317 error_code
=*(obj_tptr
+17);
1318 error_value
=EXTRACT_16BITS(obj_tptr
+18);
1319 printf("%s Error Node Address: %s, Flags: [0x%02x]%s Error Code: %s (%u)",
1321 ip6addr_string(obj_tptr
),
1324 tok2str(rsvp_obj_error_code_values
,"unknown",error_code
),
1327 switch (error_code
) {
1328 case RSVP_OBJ_ERROR_SPEC_CODE_ROUTING
:
1329 printf(", Error Value: %s (%u)",
1330 tok2str(rsvp_obj_error_code_routing_values
,"unknown",error_value
),
1345 case RSVP_OBJ_PROPERTIES
:
1346 switch(rsvp_obj_ctype
) {
1350 padbytes
= EXTRACT_16BITS(obj_tptr
+2);
1351 printf("%s TLV count: %u, padding bytes: %u",
1353 EXTRACT_16BITS(obj_tptr
),
1357 /* loop through as long there is anything longer than the TLV header (2) */
1358 while(obj_tlen
>= 2 + padbytes
) {
1359 printf("%s %s TLV (0x%02x), length: %u", /* length includes header */
1361 tok2str(rsvp_obj_prop_tlv_values
,"unknown",*obj_tptr
),
1364 if (obj_tlen
< *(obj_tptr
+1))
1366 if (*(obj_tptr
+1) < 2)
1368 print_unknown_data(obj_tptr
+2,"\n\t\t",*(obj_tptr
+1)-2);
1369 obj_tlen
-=*(obj_tptr
+1);
1370 obj_tptr
+=*(obj_tptr
+1);
1378 case RSVP_OBJ_MESSAGE_ID
: /* fall through */
1379 case RSVP_OBJ_MESSAGE_ID_ACK
: /* fall through */
1380 case RSVP_OBJ_MESSAGE_ID_LIST
:
1381 switch(rsvp_obj_ctype
) {
1386 printf("%s Flags [0x%02x], epoch: %u",
1389 EXTRACT_24BITS(obj_tptr
+1));
1392 /* loop through as long there are no messages left */
1393 while(obj_tlen
>= 4) {
1394 printf("%s Message-ID 0x%08x (%u)",
1396 EXTRACT_32BITS(obj_tptr
),
1397 EXTRACT_32BITS(obj_tptr
));
1407 case RSVP_OBJ_INTEGRITY
:
1408 switch(rsvp_obj_ctype
) {
1410 if (obj_tlen
< sizeof(struct rsvp_obj_integrity_t
))
1412 obj_ptr
.rsvp_obj_integrity
= (const struct rsvp_obj_integrity_t
*)obj_tptr
;
1413 printf("%s Key-ID 0x%04x%08x, Sequence 0x%08x%08x, Flags [%s]",
1415 EXTRACT_16BITS(obj_ptr
.rsvp_obj_integrity
->key_id
),
1416 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->key_id
+2),
1417 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->sequence
),
1418 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->sequence
+4),
1419 bittok2str(rsvp_obj_integrity_flag_values
,
1421 obj_ptr
.rsvp_obj_integrity
->flags
));
1422 printf("%s MD5-sum 0x%08x%08x%08x%08x (unverified)",
1424 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->digest
),
1425 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->digest
+4),
1426 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->digest
+8),
1427 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->digest
+12));
1428 obj_tlen
+=sizeof(struct rsvp_obj_integrity_t
);
1429 obj_tptr
+=sizeof(struct rsvp_obj_integrity_t
);
1436 case RSVP_OBJ_ADMIN_STATUS
:
1437 switch(rsvp_obj_ctype
) {
1441 printf("%s Flags [%s]", ident
,
1442 bittok2str(rsvp_obj_admin_status_flag_values
, "none",
1443 EXTRACT_32BITS(obj_tptr
)));
1452 case RSVP_OBJ_LABEL_SET
:
1453 switch(rsvp_obj_ctype
) {
1458 u_int action
, subchannel
;
1459 action
= (EXTRACT_16BITS(obj_tptr
)>>8);
1461 printf("%s Action: %s (%u), Label type: %u", ident
,
1462 tok2str(label_set_action_values
, "Unknown", action
),
1463 action
, ((EXTRACT_32BITS(obj_tptr
) & 0x7F)));
1466 case LABEL_SET_INCLUSIVE_RANGE
:
1467 case LABEL_SET_EXCLUSIVE_RANGE
: /* fall through */
1469 /* only a couple of subchannels are expected */
1472 printf("%s Start range: %u, End range: %u", ident
,
1473 EXTRACT_32BITS(obj_tptr
+4),
1474 EXTRACT_32BITS(obj_tptr
+8));
1483 while(obj_tlen
>= 4 ) {
1484 printf("%s Subchannel #%u: %u", ident
, subchannel
,
1485 EXTRACT_32BITS(obj_tptr
));
1499 * FIXME those are the defined objects that lack a decoder
1500 * you are welcome to contribute code ;-)
1503 case RSVP_OBJ_SCOPE
:
1504 case RSVP_OBJ_POLICY_DATA
:
1505 case RSVP_OBJ_ACCEPT_LABEL_SET
:
1506 case RSVP_OBJ_PROTECTION
:
1509 print_unknown_data(obj_tptr
,"\n\t ",obj_tlen
); /* FIXME indentation */
1512 /* do we also want to see a hex dump ? */
1513 if (vflag
> 1 || hexdump
==TRUE
)
1514 print_unknown_data(tptr
+sizeof(sizeof(struct rsvp_object_header
)),"\n\t ", /* FIXME indentation */
1515 rsvp_obj_len
-sizeof(struct rsvp_object_header
));
1522 printf("\n\t\t packet exceeded snapshot");
1528 rsvp_print(register const u_char
*pptr
, register u_int len
) {
1530 const struct rsvp_common_header
*rsvp_com_header
;
1531 const u_char
*tptr
,*subtptr
;
1532 u_short tlen
,subtlen
;
1536 rsvp_com_header
= (const struct rsvp_common_header
*)pptr
;
1537 TCHECK(*rsvp_com_header
);
1540 * Sanity checking of the header.
1542 if (RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
) != RSVP_VERSION
) {
1543 printf("ERROR: RSVP version %u packet not supported",
1544 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
));
1548 /* in non-verbose mode just lets print the basic Message Type*/
1550 printf("RSVPv%u %s Message, length: %u",
1551 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
),
1552 tok2str(rsvp_msg_type_values
, "unknown (%u)",rsvp_com_header
->msg_type
),
1557 /* ok they seem to want to know everything - lets fully decode it */
1559 tlen
=EXTRACT_16BITS(rsvp_com_header
->length
);
1561 printf("\n\tRSVPv%u %s Message (%u), Flags: [%s], length: %u, ttl: %u, checksum: 0x%04x",
1562 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
),
1563 tok2str(rsvp_msg_type_values
, "unknown, type: %u",rsvp_com_header
->msg_type
),
1564 rsvp_com_header
->msg_type
,
1565 bittok2str(rsvp_header_flag_values
,"none",RSVP_EXTRACT_FLAGS(rsvp_com_header
->version_flags
)),
1567 rsvp_com_header
->ttl
,
1568 EXTRACT_16BITS(rsvp_com_header
->checksum
));
1570 if (tlen
< sizeof(const struct rsvp_common_header
)) {
1571 printf("ERROR: common header too short %u < %lu", tlen
,
1572 (unsigned long)sizeof(const struct rsvp_common_header
));
1576 tptr
+=sizeof(const struct rsvp_common_header
);
1577 tlen
-=sizeof(const struct rsvp_common_header
);
1579 switch(rsvp_com_header
->msg_type
) {
1581 case RSVP_MSGTYPE_AGGREGATE
:
1584 rsvp_com_header
= (const struct rsvp_common_header
*)subtptr
;
1585 TCHECK(*rsvp_com_header
);
1588 * Sanity checking of the header.
1590 if (RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
) != RSVP_VERSION
) {
1591 printf("ERROR: RSVP version %u packet not supported",
1592 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
));
1595 subtlen
=EXTRACT_16BITS(rsvp_com_header
->length
);
1597 printf("\n\t RSVPv%u %s Message (%u), Flags: [%s], length: %u, ttl: %u, checksum: 0x%04x",
1598 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
),
1599 tok2str(rsvp_msg_type_values
, "unknown, type: %u",rsvp_com_header
->msg_type
),
1600 rsvp_com_header
->msg_type
,
1601 bittok2str(rsvp_header_flag_values
,"none",RSVP_EXTRACT_FLAGS(rsvp_com_header
->version_flags
)),
1603 rsvp_com_header
->ttl
,
1604 EXTRACT_16BITS(rsvp_com_header
->checksum
));
1606 if (subtlen
< sizeof(const struct rsvp_common_header
)) {
1607 printf("ERROR: common header too short %u < %lu", subtlen
,
1608 (unsigned long)sizeof(const struct rsvp_common_header
));
1612 if (tlen
< subtlen
) {
1613 printf("ERROR: common header too large %u > %u", subtlen
,
1618 subtptr
+=sizeof(const struct rsvp_common_header
);
1619 subtlen
-=sizeof(const struct rsvp_common_header
);
1621 if (rsvp_obj_print(subtptr
,"\n\t ", subtlen
) == -1)
1624 tptr
+=subtlen
+sizeof(const struct rsvp_common_header
);
1625 tlen
-=subtlen
+sizeof(const struct rsvp_common_header
);
1630 case RSVP_MSGTYPE_PATH
:
1631 case RSVP_MSGTYPE_RESV
:
1632 case RSVP_MSGTYPE_PATHERR
:
1633 case RSVP_MSGTYPE_RESVERR
:
1634 case RSVP_MSGTYPE_PATHTEAR
:
1635 case RSVP_MSGTYPE_RESVTEAR
:
1636 case RSVP_MSGTYPE_RESVCONF
:
1637 case RSVP_MSGTYPE_HELLO_OLD
:
1638 case RSVP_MSGTYPE_HELLO
:
1639 case RSVP_MSGTYPE_ACK
:
1640 case RSVP_MSGTYPE_SREFRESH
:
1641 if (rsvp_obj_print(tptr
,"\n\t ", tlen
) == -1)
1646 print_unknown_data(tptr
,"\n\t ",tlen
);
1652 printf("\n\t\t packet exceeded snapshot");