4 * Copyright (c) 1998-2007 The TCPDUMP project
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that: (1) source code
8 * distributions retain the above copyright notice and this paragraph
9 * in its entirety, and (2) distributions including binary code include
10 * the above copyright notice and this paragraph in its entirety in
11 * the documentation or other materials provided with the distribution.
12 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND
13 * WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
14 * LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
15 * FOR A PARTICULAR PURPOSE.
17 * Original code by Hannes Gredler (hannes@juniper.net)
20 #include <sys/cdefs.h>
23 static const char rcsid
[] _U_
=
24 "@(#) Header: /tcpdump/master/tcpdump/print-rsvp.c,v 1.33.2.14 2007/02/26 13:32:36 hannes Exp";
26 __RCSID("$NetBSD: tcpdump2rcsid.ex,v 1.1 2001/06/25 20:09:58 itojun Exp $");
34 #include <tcpdump-stdinc.h>
40 #include "interface.h"
42 #include "addrtoname.h"
43 #include "ethertype.h"
48 * RFC 2205 common header
51 * +-------------+-------------+-------------+-------------+
52 * | Vers | Flags| Msg Type | RSVP Checksum |
53 * +-------------+-------------+-------------+-------------+
54 * | Send_TTL | (Reserved) | RSVP Length |
55 * +-------------+-------------+-------------+-------------+
59 struct rsvp_common_header
{
60 u_int8_t version_flags
;
69 * RFC2205 object header
73 * +-------------+-------------+-------------+-------------+
74 * | Length (bytes) | Class-Num | C-Type |
75 * +-------------+-------------+-------------+-------------+
77 * // (Object contents) //
79 * +-------------+-------------+-------------+-------------+
82 struct rsvp_object_header
{
88 #define RSVP_VERSION 1
89 #define RSVP_EXTRACT_VERSION(x) (((x)&0xf0)>>4)
90 #define RSVP_EXTRACT_FLAGS(x) ((x)&0x0f)
92 #define RSVP_MSGTYPE_PATH 1
93 #define RSVP_MSGTYPE_RESV 2
94 #define RSVP_MSGTYPE_PATHERR 3
95 #define RSVP_MSGTYPE_RESVERR 4
96 #define RSVP_MSGTYPE_PATHTEAR 5
97 #define RSVP_MSGTYPE_RESVTEAR 6
98 #define RSVP_MSGTYPE_RESVCONF 7
99 #define RSVP_MSGTYPE_AGGREGATE 12
100 #define RSVP_MSGTYPE_ACK 13
101 #define RSVP_MSGTYPE_HELLO_OLD 14 /* ancient Hellos */
102 #define RSVP_MSGTYPE_SREFRESH 15
103 #define RSVP_MSGTYPE_HELLO 20
105 static const struct tok rsvp_msg_type_values
[] = {
106 { RSVP_MSGTYPE_PATH
, "Path" },
107 { RSVP_MSGTYPE_RESV
, "Resv" },
108 { RSVP_MSGTYPE_PATHERR
, "PathErr" },
109 { RSVP_MSGTYPE_RESVERR
, "ResvErr" },
110 { RSVP_MSGTYPE_PATHTEAR
, "PathTear" },
111 { RSVP_MSGTYPE_RESVTEAR
, "ResvTear" },
112 { RSVP_MSGTYPE_RESVCONF
, "ResvConf" },
113 { RSVP_MSGTYPE_AGGREGATE
, "Aggregate" },
114 { RSVP_MSGTYPE_ACK
, "Acknowledgement" },
115 { RSVP_MSGTYPE_HELLO_OLD
, "Hello (Old)" },
116 { RSVP_MSGTYPE_SREFRESH
, "Refresh" },
117 { RSVP_MSGTYPE_HELLO
, "Hello" },
121 static const struct tok rsvp_header_flag_values
[] = {
122 { 0x01, "Refresh reduction capable" }, /* rfc2961 */
126 #define RSVP_OBJ_SESSION 1 /* rfc2205 */
127 #define RSVP_OBJ_RSVP_HOP 3 /* rfc2205, rfc3473 */
128 #define RSVP_OBJ_INTEGRITY 4 /* rfc2747 */
129 #define RSVP_OBJ_TIME_VALUES 5 /* rfc2205 */
130 #define RSVP_OBJ_ERROR_SPEC 6
131 #define RSVP_OBJ_SCOPE 7
132 #define RSVP_OBJ_STYLE 8 /* rfc2205 */
133 #define RSVP_OBJ_FLOWSPEC 9 /* rfc2215 */
134 #define RSVP_OBJ_FILTERSPEC 10 /* rfc2215 */
135 #define RSVP_OBJ_SENDER_TEMPLATE 11
136 #define RSVP_OBJ_SENDER_TSPEC 12 /* rfc2215 */
137 #define RSVP_OBJ_ADSPEC 13 /* rfc2215 */
138 #define RSVP_OBJ_POLICY_DATA 14
139 #define RSVP_OBJ_CONFIRM 15 /* rfc2205 */
140 #define RSVP_OBJ_LABEL 16 /* rfc3209 */
141 #define RSVP_OBJ_LABEL_REQ 19 /* rfc3209 */
142 #define RSVP_OBJ_ERO 20 /* rfc3209 */
143 #define RSVP_OBJ_RRO 21 /* rfc3209 */
144 #define RSVP_OBJ_HELLO 22 /* rfc3209 */
145 #define RSVP_OBJ_MESSAGE_ID 23 /* rfc2961 */
146 #define RSVP_OBJ_MESSAGE_ID_ACK 24 /* rfc2961 */
147 #define RSVP_OBJ_MESSAGE_ID_LIST 25 /* rfc2961 */
148 #define RSVP_OBJ_RECOVERY_LABEL 34 /* rfc3473 */
149 #define RSVP_OBJ_UPSTREAM_LABEL 35 /* rfc3473 */
150 #define RSVP_OBJ_LABEL_SET 36 /* rfc3473 */
151 #define RSVP_OBJ_PROTECTION 37 /* rfc3473 */
152 #define RSVP_OBJ_DETOUR 63 /* draft-ietf-mpls-rsvp-lsp-fastreroute-07 */
153 #define RSVP_OBJ_CLASSTYPE 66 /* rfc4124 */
154 #define RSVP_OBJ_CLASSTYPE_OLD 125 /* draft-ietf-tewg-diff-te-proto-07 */
155 #define RSVP_OBJ_SUGGESTED_LABEL 129 /* rfc3473 */
156 #define RSVP_OBJ_ACCEPT_LABEL_SET 130 /* rfc3473 */
157 #define RSVP_OBJ_RESTART_CAPABILITY 131 /* rfc3473 */
158 #define RSVP_OBJ_NOTIFY_REQ 195 /* rfc3473 */
159 #define RSVP_OBJ_ADMIN_STATUS 196 /* rfc3473 */
160 #define RSVP_OBJ_PROPERTIES 204 /* juniper proprietary */
161 #define RSVP_OBJ_FASTREROUTE 205 /* draft-ietf-mpls-rsvp-lsp-fastreroute-07 */
162 #define RSVP_OBJ_SESSION_ATTRIBUTE 207 /* rfc3209 */
163 #define RSVP_OBJ_GENERALIZED_UNI 229 /* OIF RSVP extensions UNI 1.0 Signaling, Rel. 2 */
164 #define RSVP_OBJ_CALL_ID 230 /* rfc3474 */
165 #define RSVP_OBJ_CALL_OPS 236 /* rfc3474 */
167 static const struct tok rsvp_obj_values
[] = {
168 { RSVP_OBJ_SESSION
, "Session" },
169 { RSVP_OBJ_RSVP_HOP
, "RSVP Hop" },
170 { RSVP_OBJ_INTEGRITY
, "Integrity" },
171 { RSVP_OBJ_TIME_VALUES
, "Time Values" },
172 { RSVP_OBJ_ERROR_SPEC
, "Error Spec" },
173 { RSVP_OBJ_SCOPE
, "Scope" },
174 { RSVP_OBJ_STYLE
, "Style" },
175 { RSVP_OBJ_FLOWSPEC
, "Flowspec" },
176 { RSVP_OBJ_FILTERSPEC
, "FilterSpec" },
177 { RSVP_OBJ_SENDER_TEMPLATE
, "Sender Template" },
178 { RSVP_OBJ_SENDER_TSPEC
, "Sender TSpec" },
179 { RSVP_OBJ_ADSPEC
, "Adspec" },
180 { RSVP_OBJ_POLICY_DATA
, "Policy Data" },
181 { RSVP_OBJ_CONFIRM
, "Confirm" },
182 { RSVP_OBJ_LABEL
, "Label" },
183 { RSVP_OBJ_LABEL_REQ
, "Label Request" },
184 { RSVP_OBJ_ERO
, "ERO" },
185 { RSVP_OBJ_RRO
, "RRO" },
186 { RSVP_OBJ_HELLO
, "Hello" },
187 { RSVP_OBJ_MESSAGE_ID
, "Message ID" },
188 { RSVP_OBJ_MESSAGE_ID_ACK
, "Message ID Ack" },
189 { RSVP_OBJ_MESSAGE_ID_LIST
, "Message ID List" },
190 { RSVP_OBJ_RECOVERY_LABEL
, "Recovery Label" },
191 { RSVP_OBJ_UPSTREAM_LABEL
, "Upstream Label" },
192 { RSVP_OBJ_LABEL_SET
, "Label Set" },
193 { RSVP_OBJ_ACCEPT_LABEL_SET
, "Acceptable Label Set" },
194 { RSVP_OBJ_DETOUR
, "Detour" },
195 { RSVP_OBJ_CLASSTYPE
, "Class Type" },
196 { RSVP_OBJ_CLASSTYPE_OLD
, "Class Type (old)" },
197 { RSVP_OBJ_SUGGESTED_LABEL
, "Suggested Label" },
198 { RSVP_OBJ_PROPERTIES
, "Properties" },
199 { RSVP_OBJ_FASTREROUTE
, "Fast Re-Route" },
200 { RSVP_OBJ_SESSION_ATTRIBUTE
, "Session Attribute" },
201 { RSVP_OBJ_GENERALIZED_UNI
, "Generalized UNI" },
202 { RSVP_OBJ_CALL_ID
, "Call-ID" },
203 { RSVP_OBJ_CALL_OPS
, "Call Capability" },
204 { RSVP_OBJ_RESTART_CAPABILITY
, "Restart Capability" },
205 { RSVP_OBJ_NOTIFY_REQ
, "Notify Request" },
206 { RSVP_OBJ_PROTECTION
, "Protection" },
207 { RSVP_OBJ_ADMIN_STATUS
, "Administrative Status" },
211 #define RSVP_CTYPE_IPV4 1
212 #define RSVP_CTYPE_IPV6 2
213 #define RSVP_CTYPE_TUNNEL_IPV4 7
214 #define RSVP_CTYPE_TUNNEL_IPV6 8
215 #define RSVP_CTYPE_UNI_IPV4 11 /* OIF RSVP extensions UNI 1.0 Signaling Rel. 2 */
216 #define RSVP_CTYPE_1 1
217 #define RSVP_CTYPE_2 2
218 #define RSVP_CTYPE_3 3
219 #define RSVP_CTYPE_4 4
222 * the ctypes are not globally unique so for
223 * translating it to strings we build a table based
224 * on objects offsetted by the ctype
227 static const struct tok rsvp_ctype_values
[] = {
228 { 256*RSVP_OBJ_RSVP_HOP
+RSVP_CTYPE_IPV4
, "IPv4" },
229 { 256*RSVP_OBJ_RSVP_HOP
+RSVP_CTYPE_IPV6
, "IPv6" },
230 { 256*RSVP_OBJ_RSVP_HOP
+RSVP_CTYPE_3
, "IPv4 plus opt. TLVs" },
231 { 256*RSVP_OBJ_RSVP_HOP
+RSVP_CTYPE_4
, "IPv6 plus opt. TLVs" },
232 { 256*RSVP_OBJ_NOTIFY_REQ
+RSVP_CTYPE_IPV4
, "IPv4" },
233 { 256*RSVP_OBJ_NOTIFY_REQ
+RSVP_CTYPE_IPV6
, "IPv6" },
234 { 256*RSVP_OBJ_CONFIRM
+RSVP_CTYPE_IPV4
, "IPv4" },
235 { 256*RSVP_OBJ_CONFIRM
+RSVP_CTYPE_IPV6
, "IPv6" },
236 { 256*RSVP_OBJ_TIME_VALUES
+RSVP_CTYPE_1
, "1" },
237 { 256*RSVP_OBJ_FLOWSPEC
+RSVP_CTYPE_1
, "obsolete" },
238 { 256*RSVP_OBJ_FLOWSPEC
+RSVP_CTYPE_2
, "IntServ" },
239 { 256*RSVP_OBJ_SENDER_TSPEC
+RSVP_CTYPE_2
, "IntServ" },
240 { 256*RSVP_OBJ_ADSPEC
+RSVP_CTYPE_2
, "IntServ" },
241 { 256*RSVP_OBJ_FILTERSPEC
+RSVP_CTYPE_IPV4
, "IPv4" },
242 { 256*RSVP_OBJ_FILTERSPEC
+RSVP_CTYPE_IPV6
, "IPv6" },
243 { 256*RSVP_OBJ_FILTERSPEC
+RSVP_CTYPE_3
, "IPv6 Flow-label" },
244 { 256*RSVP_OBJ_FILTERSPEC
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
245 { 256*RSVP_OBJ_SESSION
+RSVP_CTYPE_IPV4
, "IPv4" },
246 { 256*RSVP_OBJ_SESSION
+RSVP_CTYPE_IPV6
, "IPv6" },
247 { 256*RSVP_OBJ_SESSION
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
248 { 256*RSVP_OBJ_SESSION
+RSVP_CTYPE_UNI_IPV4
, "UNI IPv4" },
249 { 256*RSVP_OBJ_SENDER_TEMPLATE
+RSVP_CTYPE_IPV4
, "IPv4" },
250 { 256*RSVP_OBJ_SENDER_TEMPLATE
+RSVP_CTYPE_IPV6
, "IPv6" },
251 { 256*RSVP_OBJ_SENDER_TEMPLATE
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
252 { 256*RSVP_OBJ_MESSAGE_ID
+RSVP_CTYPE_1
, "1" },
253 { 256*RSVP_OBJ_MESSAGE_ID_ACK
+RSVP_CTYPE_1
, "Message id ack" },
254 { 256*RSVP_OBJ_MESSAGE_ID_ACK
+RSVP_CTYPE_2
, "Message id nack" },
255 { 256*RSVP_OBJ_MESSAGE_ID_LIST
+RSVP_CTYPE_1
, "1" },
256 { 256*RSVP_OBJ_STYLE
+RSVP_CTYPE_1
, "1" },
257 { 256*RSVP_OBJ_HELLO
+RSVP_CTYPE_1
, "Hello Request" },
258 { 256*RSVP_OBJ_HELLO
+RSVP_CTYPE_2
, "Hello Ack" },
259 { 256*RSVP_OBJ_LABEL_REQ
+RSVP_CTYPE_1
, "without label range" },
260 { 256*RSVP_OBJ_LABEL_REQ
+RSVP_CTYPE_2
, "with ATM label range" },
261 { 256*RSVP_OBJ_LABEL_REQ
+RSVP_CTYPE_3
, "with FR label range" },
262 { 256*RSVP_OBJ_LABEL_REQ
+RSVP_CTYPE_4
, "Generalized Label" },
263 { 256*RSVP_OBJ_LABEL
+RSVP_CTYPE_1
, "Label" },
264 { 256*RSVP_OBJ_LABEL
+RSVP_CTYPE_2
, "Generalized Label" },
265 { 256*RSVP_OBJ_LABEL
+RSVP_CTYPE_3
, "Waveband Switching" },
266 { 256*RSVP_OBJ_SUGGESTED_LABEL
+RSVP_CTYPE_1
, "Label" },
267 { 256*RSVP_OBJ_SUGGESTED_LABEL
+RSVP_CTYPE_2
, "Generalized Label" },
268 { 256*RSVP_OBJ_SUGGESTED_LABEL
+RSVP_CTYPE_3
, "Waveband Switching" },
269 { 256*RSVP_OBJ_UPSTREAM_LABEL
+RSVP_CTYPE_1
, "Label" },
270 { 256*RSVP_OBJ_UPSTREAM_LABEL
+RSVP_CTYPE_2
, "Generalized Label" },
271 { 256*RSVP_OBJ_UPSTREAM_LABEL
+RSVP_CTYPE_3
, "Waveband Switching" },
272 { 256*RSVP_OBJ_RECOVERY_LABEL
+RSVP_CTYPE_1
, "Label" },
273 { 256*RSVP_OBJ_RECOVERY_LABEL
+RSVP_CTYPE_2
, "Generalized Label" },
274 { 256*RSVP_OBJ_RECOVERY_LABEL
+RSVP_CTYPE_3
, "Waveband Switching" },
275 { 256*RSVP_OBJ_ERO
+RSVP_CTYPE_IPV4
, "IPv4" },
276 { 256*RSVP_OBJ_RRO
+RSVP_CTYPE_IPV4
, "IPv4" },
277 { 256*RSVP_OBJ_ERROR_SPEC
+RSVP_CTYPE_IPV4
, "IPv4" },
278 { 256*RSVP_OBJ_ERROR_SPEC
+RSVP_CTYPE_IPV6
, "IPv6" },
279 { 256*RSVP_OBJ_ERROR_SPEC
+RSVP_CTYPE_3
, "IPv4 plus opt. TLVs" },
280 { 256*RSVP_OBJ_ERROR_SPEC
+RSVP_CTYPE_4
, "IPv6 plus opt. TLVs" },
281 { 256*RSVP_OBJ_RESTART_CAPABILITY
+RSVP_CTYPE_1
, "IPv4" },
282 { 256*RSVP_OBJ_SESSION_ATTRIBUTE
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
283 { 256*RSVP_OBJ_FASTREROUTE
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" }, /* old style*/
284 { 256*RSVP_OBJ_FASTREROUTE
+RSVP_CTYPE_1
, "1" }, /* new style */
285 { 256*RSVP_OBJ_DETOUR
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
286 { 256*RSVP_OBJ_PROPERTIES
+RSVP_CTYPE_1
, "1" },
287 { 256*RSVP_OBJ_ADMIN_STATUS
+RSVP_CTYPE_1
, "1" },
288 { 256*RSVP_OBJ_CLASSTYPE
+RSVP_CTYPE_1
, "1" },
289 { 256*RSVP_OBJ_CLASSTYPE_OLD
+RSVP_CTYPE_1
, "1" },
290 { 256*RSVP_OBJ_LABEL_SET
+RSVP_CTYPE_1
, "1" },
291 { 256*RSVP_OBJ_GENERALIZED_UNI
+RSVP_CTYPE_1
, "1" },
295 struct rsvp_obj_integrity_t
{
299 u_int8_t sequence
[8];
303 static const struct tok rsvp_obj_integrity_flag_values
[] = {
304 { 0x80, "Handshake" },
308 struct rsvp_obj_frr_t
{
313 u_int8_t bandwidth
[4];
314 u_int8_t include_any
[4];
315 u_int8_t exclude_any
[4];
316 u_int8_t include_all
[4];
320 #define RSVP_OBJ_XRO_MASK_SUBOBJ(x) ((x)&0x7f)
321 #define RSVP_OBJ_XRO_MASK_LOOSE(x) ((x)&0x80)
323 #define RSVP_OBJ_XRO_RES 0
324 #define RSVP_OBJ_XRO_IPV4 1
325 #define RSVP_OBJ_XRO_IPV6 2
326 #define RSVP_OBJ_XRO_ASN 32
327 #define RSVP_OBJ_XRO_MPLS 64
329 static const struct tok rsvp_obj_xro_values
[] = {
330 { RSVP_OBJ_XRO_RES
, "Reserved" },
331 { RSVP_OBJ_XRO_IPV4
, "IPv4 prefix" },
332 { RSVP_OBJ_XRO_IPV6
, "IPv6 prefix" },
333 { RSVP_OBJ_XRO_ASN
, "Autonomous system number" },
334 { RSVP_OBJ_XRO_MPLS
, "MPLS label switched path termination" },
338 /* draft-ietf-mpls-rsvp-lsp-fastreroute-07.txt */
339 static const struct tok rsvp_obj_rro_flag_values
[] = {
340 { 0x01, "Local protection available" },
341 { 0x02, "Local protection in use" },
342 { 0x04, "Bandwidth protection" },
343 { 0x08, "Node protection" },
347 static const struct tok rsvp_resstyle_values
[] = {
348 { 17, "Wildcard Filter" },
349 { 10, "Fixed Filter" },
350 { 18, "Shared Explicit" },
354 #define RSVP_OBJ_INTSERV_GUARANTEED_SERV 2
355 #define RSVP_OBJ_INTSERV_CONTROLLED_LOAD 5
357 static const struct tok rsvp_intserv_service_type_values
[] = {
358 { 1, "Default/Global Information" },
359 { RSVP_OBJ_INTSERV_GUARANTEED_SERV
, "Guaranteed Service" },
360 { RSVP_OBJ_INTSERV_CONTROLLED_LOAD
, "Controlled Load" },
364 static const struct tok rsvp_intserv_parameter_id_values
[] = {
366 { 6, "Path b/w estimate" },
367 { 8, "Minimum path latency" },
368 { 10, "Composed MTU" },
369 { 127, "Token Bucket TSpec" },
370 { 130, "Guaranteed Service RSpec" },
371 { 133, "End-to-end composed value for C" },
372 { 134, "End-to-end composed value for D" },
373 { 135, "Since-last-reshaping point composed C" },
374 { 136, "Since-last-reshaping point composed D" },
378 static struct tok rsvp_session_attribute_flag_values
[] = {
379 { 0x01, "Local Protection desired" },
380 { 0x02, "Label Recording desired" },
381 { 0x04, "SE Style desired" },
382 { 0x08, "Bandwidth protection desired" }, /* draft-ietf-mpls-rsvp-lsp-fastreroute-02.txt */
383 { 0x10, "Node protection desired" }, /* draft-ietf-mpls-rsvp-lsp-fastreroute-02.txt */
387 static struct tok rsvp_obj_prop_tlv_values
[] = {
389 { 0x02, "Metric 1" },
390 { 0x04, "Metric 2" },
391 { 0x08, "CCC Status" },
392 { 0x10, "Path Type" },
396 #define RSVP_OBJ_ERROR_SPEC_CODE_ROUTING 24
397 #define RSVP_OBJ_ERROR_SPEC_CODE_NOTIFY 25
398 #define RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE 28
399 #define RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE_OLD 125
401 static struct tok rsvp_obj_error_code_values
[] = {
402 { RSVP_OBJ_ERROR_SPEC_CODE_ROUTING
, "Routing Problem" },
403 { RSVP_OBJ_ERROR_SPEC_CODE_NOTIFY
, "Notify Error" },
404 { RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE
, "Diffserv TE Error" },
405 { RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE_OLD
, "Diffserv TE Error (Old)" },
409 static struct tok rsvp_obj_error_code_routing_values
[] = {
410 { 1, "Bad EXPLICIT_ROUTE object" },
411 { 2, "Bad strict node" },
412 { 3, "Bad loose node" },
413 { 4, "Bad initial subobject" },
414 { 5, "No route available toward destination" },
415 { 6, "Unacceptable label value" },
416 { 7, "RRO indicated routing loops" },
417 { 8, "non-RSVP-capable router in the path" },
418 { 9, "MPLS label allocation failure" },
419 { 10, "Unsupported L3PID" },
423 static struct tok rsvp_obj_error_code_diffserv_te_values
[] = {
424 { 1, "Unexpected CT object" },
425 { 2, "Unsupported CT" },
426 { 3, "Invalid CT value" },
427 { 4, "CT/setup priority do not form a configured TE-Class" },
428 { 5, "CT/holding priority do not form a configured TE-Class" },
429 { 6, "CT/setup priority and CT/holding priority do not form a configured TE-Class" },
430 { 7, "Inconsistency between signaled PSC and signaled CT" },
431 { 8, "Inconsistency between signaled PHBs and signaled CT" },
435 /* rfc3473 / rfc 3471 */
436 static const struct tok rsvp_obj_admin_status_flag_values
[] = {
437 { 0x80000000, "Reflect" },
438 { 0x00000004, "Testing" },
439 { 0x00000002, "Admin-down" },
440 { 0x00000001, "Delete-in-progress" },
444 /* label set actions - rfc3471 */
445 #define LABEL_SET_INCLUSIVE_LIST 0
446 #define LABEL_SET_EXCLUSIVE_LIST 1
447 #define LABEL_SET_INCLUSIVE_RANGE 2
448 #define LABEL_SET_EXCLUSIVE_RANGE 3
450 static const struct tok rsvp_obj_label_set_action_values
[] = {
451 { LABEL_SET_INCLUSIVE_LIST
, "Inclusive list" },
452 { LABEL_SET_EXCLUSIVE_LIST
, "Exclusive list" },
453 { LABEL_SET_INCLUSIVE_RANGE
, "Inclusive range" },
454 { LABEL_SET_EXCLUSIVE_RANGE
, "Exclusive range" },
458 /* OIF RSVP extensions UNI 1.0 Signaling, release 2 */
459 #define RSVP_GEN_UNI_SUBOBJ_SOURCE_TNA_ADDRESS 1
460 #define RSVP_GEN_UNI_SUBOBJ_DESTINATION_TNA_ADDRESS 2
461 #define RSVP_GEN_UNI_SUBOBJ_DIVERSITY 3
462 #define RSVP_GEN_UNI_SUBOBJ_EGRESS_LABEL 4
463 #define RSVP_GEN_UNI_SUBOBJ_SERVICE_LEVEL 5
465 static const struct tok rsvp_obj_generalized_uni_values
[] = {
466 { RSVP_GEN_UNI_SUBOBJ_SOURCE_TNA_ADDRESS
, "Source TNA address" },
467 { RSVP_GEN_UNI_SUBOBJ_DESTINATION_TNA_ADDRESS
, "Destination TNA address" },
468 { RSVP_GEN_UNI_SUBOBJ_DIVERSITY
, "Diversity" },
469 { RSVP_GEN_UNI_SUBOBJ_EGRESS_LABEL
, "Egress label" },
470 { RSVP_GEN_UNI_SUBOBJ_SERVICE_LEVEL
, "Service level" },
474 static int rsvp_intserv_print(const u_char
*, u_short
);
477 * this is a dissector for all the intserv defined
478 * specs as defined per rfc2215
479 * it is called from various rsvp objects;
480 * returns the amount of bytes being processed
483 rsvp_intserv_print(const u_char
*tptr
, u_short obj_tlen
) {
485 int parameter_id
,parameter_length
;
493 parameter_id
= *(tptr
);
494 parameter_length
= EXTRACT_16BITS(tptr
+2)<<2; /* convert wordcount to bytecount */
496 printf("\n\t Parameter ID: %s (%u), length: %u, Flags: [0x%02x]",
497 tok2str(rsvp_intserv_parameter_id_values
,"unknown",parameter_id
),
502 if (obj_tlen
< parameter_length
+4)
504 switch(parameter_id
) { /* parameter_id */
508 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
509 * | 4 (e) | (f) | 1 (g) |
510 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
511 * | IS hop cnt (32-bit unsigned integer) |
512 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
514 if (parameter_length
== 4)
515 printf("\n\t\tIS hop count: %u", EXTRACT_32BITS(tptr
+4));
520 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
521 * | 6 (h) | (i) | 1 (j) |
522 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
523 * | Path b/w estimate (32-bit IEEE floating point number) |
524 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
526 if (parameter_length
== 4) {
527 bw
.i
= EXTRACT_32BITS(tptr
+4);
528 printf("\n\t\tPath b/w estimate: %.10g Mbps", bw
.f
/125000);
534 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
535 * | 8 (k) | (l) | 1 (m) |
536 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
537 * | Minimum path latency (32-bit integer) |
538 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
540 if (parameter_length
== 4) {
541 printf("\n\t\tMinimum path latency: ");
542 if (EXTRACT_32BITS(tptr
+4) == 0xffffffff)
543 printf("don't care");
545 printf("%u", EXTRACT_32BITS(tptr
+4));
552 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
553 * | 10 (n) | (o) | 1 (p) |
554 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
555 * | Composed MTU (32-bit unsigned integer) |
556 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
558 if (parameter_length
== 4)
559 printf("\n\t\tComposed MTU: %u bytes", EXTRACT_32BITS(tptr
+4));
563 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
564 * | 127 (e) | 0 (f) | 5 (g) |
565 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
566 * | Token Bucket Rate [r] (32-bit IEEE floating point number) |
567 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
568 * | Token Bucket Size [b] (32-bit IEEE floating point number) |
569 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
570 * | Peak Data Rate [p] (32-bit IEEE floating point number) |
571 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
572 * | Minimum Policed Unit [m] (32-bit integer) |
573 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
574 * | Maximum Packet Size [M] (32-bit integer) |
575 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
578 if (parameter_length
== 20) {
579 bw
.i
= EXTRACT_32BITS(tptr
+4);
580 printf("\n\t\tToken Bucket Rate: %.10g Mbps", bw
.f
/125000);
581 bw
.i
= EXTRACT_32BITS(tptr
+8);
582 printf("\n\t\tToken Bucket Size: %.10g bytes", bw
.f
);
583 bw
.i
= EXTRACT_32BITS(tptr
+12);
584 printf("\n\t\tPeak Data Rate: %.10g Mbps", bw
.f
/125000);
585 printf("\n\t\tMinimum Policed Unit: %u bytes", EXTRACT_32BITS(tptr
+16));
586 printf("\n\t\tMaximum Packet Size: %u bytes", EXTRACT_32BITS(tptr
+20));
592 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
593 * | 130 (h) | 0 (i) | 2 (j) |
594 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
595 * | Rate [R] (32-bit IEEE floating point number) |
596 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
597 * | Slack Term [S] (32-bit integer) |
598 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
601 if (parameter_length
== 8) {
602 bw
.i
= EXTRACT_32BITS(tptr
+4);
603 printf("\n\t\tRate: %.10g Mbps", bw
.f
/125000);
604 printf("\n\t\tSlack Term: %u", EXTRACT_32BITS(tptr
+8));
612 if (parameter_length
== 4)
613 printf("\n\t\tValue: %u", EXTRACT_32BITS(tptr
+4));
618 print_unknown_data(tptr
+4,"\n\t\t",parameter_length
);
620 return (parameter_length
+4); /* header length 4 bytes */
624 rsvp_obj_print (const u_char
*tptr
, const char *ident
, u_int tlen
) {
626 const struct rsvp_object_header
*rsvp_obj_header
;
627 const u_char
*obj_tptr
;
629 const struct rsvp_obj_integrity_t
*rsvp_obj_integrity
;
630 const struct rsvp_obj_frr_t
*rsvp_obj_frr
;
633 u_short rsvp_obj_len
,rsvp_obj_ctype
,obj_tlen
,intserv_serv_tlen
;
634 int hexdump
,processed
,padbytes
,error_code
,error_value
,i
;
641 while(tlen
>=sizeof(struct rsvp_object_header
)) {
642 /* did we capture enough for fully decoding the object header ? */
643 if (!TTEST2(*tptr
, sizeof(struct rsvp_object_header
)))
646 rsvp_obj_header
= (const struct rsvp_object_header
*)tptr
;
647 rsvp_obj_len
=EXTRACT_16BITS(rsvp_obj_header
->length
);
648 rsvp_obj_ctype
=rsvp_obj_header
->ctype
;
650 if(rsvp_obj_len
% 4) {
651 printf("%sERROR: object header size %u not a multiple of 4", ident
, rsvp_obj_len
);
654 if(rsvp_obj_len
< sizeof(struct rsvp_object_header
)) {
655 printf("%sERROR: object header too short %u < %lu", ident
, rsvp_obj_len
,
656 (unsigned long)sizeof(const struct rsvp_object_header
));
660 printf("%s%s Object (%u) Flags: [%s",
662 tok2str(rsvp_obj_values
,
664 rsvp_obj_header
->class_num
),
665 rsvp_obj_header
->class_num
,
666 ((rsvp_obj_header
->class_num
)&0x80) ? "ignore" : "reject");
668 if (rsvp_obj_header
->class_num
> 128)
670 ((rsvp_obj_header
->class_num
)&0x40) ? "and forward" : "silently");
672 printf(" if unknown], Class-Type: %s (%u), length: %u",
673 tok2str(rsvp_ctype_values
,
675 ((rsvp_obj_header
->class_num
)<<8)+rsvp_obj_ctype
),
679 if(tlen
< rsvp_obj_len
) {
680 printf("%sERROR: object goes past end of objects TLV", ident
);
684 obj_tptr
=tptr
+sizeof(struct rsvp_object_header
);
685 obj_tlen
=rsvp_obj_len
-sizeof(struct rsvp_object_header
);
687 /* did we capture enough for fully decoding the object ? */
688 if (!TTEST2(*tptr
, rsvp_obj_len
))
692 switch(rsvp_obj_header
->class_num
) {
693 case RSVP_OBJ_SESSION
:
694 switch(rsvp_obj_ctype
) {
695 case RSVP_CTYPE_IPV4
:
698 printf("%s IPv4 DestAddress: %s, Protocol ID: 0x%02x",
700 ipaddr_string(obj_tptr
),
701 *(obj_tptr
+sizeof(struct in_addr
)));
702 printf("%s Flags: [0x%02x], DestPort %u",
705 EXTRACT_16BITS(obj_tptr
+6));
710 case RSVP_CTYPE_IPV6
:
713 printf("%s IPv6 DestAddress: %s, Protocol ID: 0x%02x",
715 ip6addr_string(obj_tptr
),
716 *(obj_tptr
+sizeof(struct in6_addr
)));
717 printf("%s Flags: [0x%02x], DestPort %u",
719 *(obj_tptr
+sizeof(struct in6_addr
)+1),
720 EXTRACT_16BITS(obj_tptr
+sizeof(struct in6_addr
)+2));
725 case RSVP_CTYPE_TUNNEL_IPV6
:
728 printf("%s IPv6 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
730 ip6addr_string(obj_tptr
),
731 EXTRACT_16BITS(obj_tptr
+18),
732 ip6addr_string(obj_tptr
+20));
737 case RSVP_CTYPE_TUNNEL_IPV4
:
738 case RSVP_CTYPE_UNI_IPV4
:
741 printf("%s IPv4 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
743 ipaddr_string(obj_tptr
),
744 EXTRACT_16BITS(obj_tptr
+6),
745 ipaddr_string(obj_tptr
+8));
754 case RSVP_OBJ_CONFIRM
:
755 switch(rsvp_obj_ctype
) {
756 case RSVP_CTYPE_IPV4
:
757 if (obj_tlen
< sizeof(struct in_addr
))
759 printf("%s IPv4 Receiver Address: %s",
761 ipaddr_string(obj_tptr
));
762 obj_tlen
-=sizeof(struct in_addr
);
763 obj_tptr
+=sizeof(struct in_addr
);
766 case RSVP_CTYPE_IPV6
:
767 if (obj_tlen
< sizeof(struct in6_addr
))
769 printf("%s IPv6 Receiver Address: %s",
771 ip6addr_string(obj_tptr
));
772 obj_tlen
-=sizeof(struct in6_addr
);
773 obj_tptr
+=sizeof(struct in6_addr
);
781 case RSVP_OBJ_NOTIFY_REQ
:
782 switch(rsvp_obj_ctype
) {
783 case RSVP_CTYPE_IPV4
:
784 if (obj_tlen
< sizeof(struct in_addr
))
786 printf("%s IPv4 Notify Node Address: %s",
788 ipaddr_string(obj_tptr
));
789 obj_tlen
-=sizeof(struct in_addr
);
790 obj_tptr
+=sizeof(struct in_addr
);
793 case RSVP_CTYPE_IPV6
:
794 if (obj_tlen
< sizeof(struct in6_addr
))
796 printf("%s IPv6 Notify Node Address: %s",
798 ip6addr_string(obj_tptr
));
799 obj_tlen
-=sizeof(struct in6_addr
);
800 obj_tptr
+=sizeof(struct in6_addr
);
808 case RSVP_OBJ_SUGGESTED_LABEL
: /* fall through */
809 case RSVP_OBJ_UPSTREAM_LABEL
: /* fall through */
810 case RSVP_OBJ_RECOVERY_LABEL
: /* fall through */
812 switch(rsvp_obj_ctype
) {
814 while(obj_tlen
>= 4 ) {
815 printf("%s Label: %u", ident
, EXTRACT_32BITS(obj_tptr
));
823 printf("%s Generalized Label: %u",
825 EXTRACT_32BITS(obj_tptr
));
832 printf("%s Waveband ID: %u%s Start Label: %u, Stop Label: %u",
834 EXTRACT_32BITS(obj_tptr
),
836 EXTRACT_32BITS(obj_tptr
+4),
837 EXTRACT_32BITS(obj_tptr
+8));
847 switch(rsvp_obj_ctype
) {
851 printf("%s Reservation Style: %s, Flags: [0x%02x]",
853 tok2str(rsvp_resstyle_values
,
855 EXTRACT_24BITS(obj_tptr
+1)),
865 case RSVP_OBJ_SENDER_TEMPLATE
:
866 switch(rsvp_obj_ctype
) {
867 case RSVP_CTYPE_IPV4
:
870 printf("%s Source Address: %s, Source Port: %u",
872 ipaddr_string(obj_tptr
),
873 EXTRACT_16BITS(obj_tptr
+6));
878 case RSVP_CTYPE_IPV6
:
881 printf("%s Source Address: %s, Source Port: %u",
883 ip6addr_string(obj_tptr
),
884 EXTRACT_16BITS(obj_tptr
+18));
889 case RSVP_CTYPE_TUNNEL_IPV4
:
892 printf("%s IPv4 Tunnel Sender Address: %s, LSP-ID: 0x%04x",
894 ipaddr_string(obj_tptr
),
895 EXTRACT_16BITS(obj_tptr
+6));
904 case RSVP_OBJ_LABEL_REQ
:
905 switch(rsvp_obj_ctype
) {
907 while(obj_tlen
>= 4 ) {
908 printf("%s L3 Protocol ID: %s",
910 tok2str(ethertype_values
,
911 "Unknown Protocol (0x%04x)",
912 EXTRACT_16BITS(obj_tptr
+2)));
920 printf("%s L3 Protocol ID: %s",
922 tok2str(ethertype_values
,
923 "Unknown Protocol (0x%04x)",
924 EXTRACT_16BITS(obj_tptr
+2)));
925 printf(",%s merge capability",((*(obj_tptr
+4))&0x80) ? "no" : "" );
926 printf("%s Minimum VPI/VCI: %u/%u",
928 (EXTRACT_16BITS(obj_tptr
+4))&0xfff,
929 (EXTRACT_16BITS(obj_tptr
+6))&0xfff);
930 printf("%s Maximum VPI/VCI: %u/%u",
932 (EXTRACT_16BITS(obj_tptr
+8))&0xfff,
933 (EXTRACT_16BITS(obj_tptr
+10))&0xfff);
940 printf("%s L3 Protocol ID: %s",
942 tok2str(ethertype_values
,
943 "Unknown Protocol (0x%04x)",
944 EXTRACT_16BITS(obj_tptr
+2)));
945 printf("%s Minimum/Maximum DLCI: %u/%u, %s%s bit DLCI",
947 (EXTRACT_32BITS(obj_tptr
+4))&0x7fffff,
948 (EXTRACT_32BITS(obj_tptr
+8))&0x7fffff,
949 (((EXTRACT_16BITS(obj_tptr
+4)>>7)&3) == 0 ) ? "10" : "",
950 (((EXTRACT_16BITS(obj_tptr
+4)>>7)&3) == 2 ) ? "23" : "");
957 printf("%s LSP Encoding Type: %s (%u)",
959 tok2str(gmpls_encoding_values
,
963 printf("%s Switching Type: %s (%u), Payload ID: %s (0x%04x)",
965 tok2str(gmpls_switch_cap_values
,
969 tok2str(gmpls_payload_values
,
971 EXTRACT_16BITS(obj_tptr
+2)),
972 EXTRACT_16BITS(obj_tptr
+2));
983 switch(rsvp_obj_ctype
) {
984 case RSVP_CTYPE_IPV4
:
985 while(obj_tlen
>= 4 ) {
986 printf("%s Subobject Type: %s, length %u",
988 tok2str(rsvp_obj_xro_values
,
990 RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr
)),
993 if (*(obj_tptr
+1) == 0) { /* prevent infinite loops */
994 printf("%s ERROR: zero length ERO subtype",ident
);
998 switch(RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr
)) {
999 case RSVP_OBJ_XRO_IPV4
:
1000 printf(", %s, %s/%u, Flags: [%s]",
1001 RSVP_OBJ_XRO_MASK_LOOSE(*obj_tptr
) ? "Loose" : "Strict",
1002 ipaddr_string(obj_tptr
+2),
1004 bittok2str(rsvp_obj_rro_flag_values
,
1006 *(obj_tptr
+7))); /* rfc3209 says that this field is rsvd. */
1008 obj_tlen
-=*(obj_tptr
+1);
1009 obj_tptr
+=*(obj_tptr
+1);
1017 case RSVP_OBJ_HELLO
:
1018 switch(rsvp_obj_ctype
) {
1023 printf("%s Source Instance: 0x%08x, Destination Instance: 0x%08x",
1025 EXTRACT_32BITS(obj_tptr
),
1026 EXTRACT_32BITS(obj_tptr
+4));
1035 case RSVP_OBJ_RESTART_CAPABILITY
:
1036 switch(rsvp_obj_ctype
) {
1040 printf("%s Restart Time: %ums, Recovery Time: %ums",
1042 EXTRACT_32BITS(obj_tptr
),
1043 EXTRACT_32BITS(obj_tptr
+4));
1052 case RSVP_OBJ_SESSION_ATTRIBUTE
:
1053 switch(rsvp_obj_ctype
) {
1054 case RSVP_CTYPE_TUNNEL_IPV4
:
1057 namelen
= *(obj_tptr
+3);
1058 if (obj_tlen
< 4+namelen
)
1060 printf("%s Session Name: ", ident
);
1061 for (i
= 0; i
< namelen
; i
++)
1062 safeputchar(*(obj_tptr
+4+i
));
1063 printf("%s Setup Priority: %u, Holding Priority: %u, Flags: [%s]",
1067 tok2str(rsvp_session_attribute_flag_values
,
1071 obj_tlen
-=4+*(obj_tptr
+3);
1072 obj_tptr
+=4+*(obj_tptr
+3);
1079 case RSVP_OBJ_GENERALIZED_UNI
:
1080 switch(rsvp_obj_ctype
) {
1081 int subobj_type
,af
,subobj_len
,total_subobj_len
;
1088 /* read variable length subobjects */
1089 total_subobj_len
= obj_tlen
;
1090 while(total_subobj_len
> 0) {
1091 subobj_len
= EXTRACT_16BITS(obj_tptr
);
1092 subobj_type
= (EXTRACT_16BITS(obj_tptr
+2))>>8;
1093 af
= (EXTRACT_16BITS(obj_tptr
+2))&0x00FF;
1095 printf("%s Subobject Type: %s (%u), AF: %s (%u), length: %u",
1097 tok2str(rsvp_obj_generalized_uni_values
, "Unknown", subobj_type
),
1099 tok2str(af_values
, "Unknown", af
), af
,
1102 switch(subobj_type
) {
1103 case RSVP_GEN_UNI_SUBOBJ_SOURCE_TNA_ADDRESS
:
1104 case RSVP_GEN_UNI_SUBOBJ_DESTINATION_TNA_ADDRESS
:
1110 printf("%s UNI IPv4 TNA address: %s",
1111 ident
, ipaddr_string(obj_tptr
+4));
1115 if (subobj_len
< 20)
1117 printf("%s UNI IPv6 TNA address: %s",
1118 ident
, ip6addr_string(obj_tptr
+4));
1123 /* unless we have a TLV parser lets just hexdump */
1130 case RSVP_GEN_UNI_SUBOBJ_DIVERSITY
:
1132 /* unless we have a TLV parser lets just hexdump */
1137 case RSVP_GEN_UNI_SUBOBJ_EGRESS_LABEL
:
1138 if (subobj_len
< 16) {
1142 printf("%s U-bit: %x, Label type: %u, Logical port id: %u, Label: %u",
1144 ((EXTRACT_32BITS(obj_tptr
+4))>>31),
1145 ((EXTRACT_32BITS(obj_tptr
+4))&0xFF),
1146 EXTRACT_32BITS(obj_tptr
+8),
1147 EXTRACT_32BITS(obj_tptr
+12));
1150 case RSVP_GEN_UNI_SUBOBJ_SERVICE_LEVEL
:
1151 if (subobj_len
< 8) {
1155 printf("%s Service level: %u",
1156 ident
, (EXTRACT_32BITS(obj_tptr
+4))>>24);
1163 total_subobj_len
-=subobj_len
;
1164 obj_tptr
+=subobj_len
;
1165 obj_tlen
+=subobj_len
;
1168 if (total_subobj_len
) {
1169 /* unless we have a TLV parser lets just hexdump */
1179 case RSVP_OBJ_RSVP_HOP
:
1180 switch(rsvp_obj_ctype
) {
1181 case RSVP_CTYPE_3
: /* fall through - FIXME add TLV parser */
1182 case RSVP_CTYPE_IPV4
:
1185 printf("%s Previous/Next Interface: %s, Logical Interface Handle: 0x%08x",
1187 ipaddr_string(obj_tptr
),
1188 EXTRACT_32BITS(obj_tptr
+4));
1192 hexdump
=TRUE
; /* unless we have a TLV parser lets just hexdump */
1195 case RSVP_CTYPE_4
: /* fall through - FIXME add TLV parser */
1196 case RSVP_CTYPE_IPV6
:
1199 printf("%s Previous/Next Interface: %s, Logical Interface Handle: 0x%08x",
1201 ip6addr_string(obj_tptr
),
1202 EXTRACT_32BITS(obj_tptr
+16));
1205 hexdump
=TRUE
; /* unless we have a TLV parser lets just hexdump */
1213 case RSVP_OBJ_TIME_VALUES
:
1214 switch(rsvp_obj_ctype
) {
1218 printf("%s Refresh Period: %ums",
1220 EXTRACT_32BITS(obj_tptr
));
1229 /* those three objects do share the same semantics */
1230 case RSVP_OBJ_SENDER_TSPEC
:
1231 case RSVP_OBJ_ADSPEC
:
1232 case RSVP_OBJ_FLOWSPEC
:
1233 switch(rsvp_obj_ctype
) {
1237 printf("%s Msg-Version: %u, length: %u",
1239 (*obj_tptr
& 0xf0) >> 4,
1240 EXTRACT_16BITS(obj_tptr
+2)<<2);
1241 obj_tptr
+=4; /* get to the start of the service header */
1244 while (obj_tlen
>= 4) {
1245 intserv_serv_tlen
=EXTRACT_16BITS(obj_tptr
+2)<<2;
1246 printf("%s Service Type: %s (%u), break bit %s set, Service length: %u",
1248 tok2str(rsvp_intserv_service_type_values
,"unknown",*(obj_tptr
)),
1250 (*(obj_tptr
+1)&0x80) ? "" : "not",
1253 obj_tptr
+=4; /* get to the start of the parameter list */
1256 while (intserv_serv_tlen
>=4) {
1257 processed
= rsvp_intserv_print(obj_tptr
, obj_tlen
);
1260 obj_tlen
-=processed
;
1261 intserv_serv_tlen
-=processed
;
1262 obj_tptr
+=processed
;
1271 case RSVP_OBJ_FILTERSPEC
:
1272 switch(rsvp_obj_ctype
) {
1273 case RSVP_CTYPE_IPV4
:
1276 printf("%s Source Address: %s, Source Port: %u",
1278 ipaddr_string(obj_tptr
),
1279 EXTRACT_16BITS(obj_tptr
+6));
1284 case RSVP_CTYPE_IPV6
:
1287 printf("%s Source Address: %s, Source Port: %u",
1289 ip6addr_string(obj_tptr
),
1290 EXTRACT_16BITS(obj_tptr
+18));
1297 printf("%s Source Address: %s, Flow Label: %u",
1299 ip6addr_string(obj_tptr
),
1300 EXTRACT_24BITS(obj_tptr
+17));
1304 case RSVP_CTYPE_TUNNEL_IPV6
:
1307 printf("%s Source Address: %s, LSP-ID: 0x%04x",
1309 ipaddr_string(obj_tptr
),
1310 EXTRACT_16BITS(obj_tptr
+18));
1315 case RSVP_CTYPE_TUNNEL_IPV4
:
1318 printf("%s Source Address: %s, LSP-ID: 0x%04x",
1320 ipaddr_string(obj_tptr
),
1321 EXTRACT_16BITS(obj_tptr
+6));
1330 case RSVP_OBJ_FASTREROUTE
:
1331 /* the differences between c-type 1 and 7 are minor */
1332 obj_ptr
.rsvp_obj_frr
= (const struct rsvp_obj_frr_t
*)obj_tptr
;
1333 bw
.i
= EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->bandwidth
);
1335 switch(rsvp_obj_ctype
) {
1336 case RSVP_CTYPE_1
: /* new style */
1337 if (obj_tlen
< sizeof(struct rsvp_obj_frr_t
))
1339 printf("%s Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps",
1341 (int)obj_ptr
.rsvp_obj_frr
->setup_prio
,
1342 (int)obj_ptr
.rsvp_obj_frr
->hold_prio
,
1343 (int)obj_ptr
.rsvp_obj_frr
->hop_limit
,
1345 printf("%s Include-any: 0x%08x, Exclude-any: 0x%08x, Include-all: 0x%08x",
1347 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->include_any
),
1348 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->exclude_any
),
1349 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->include_all
));
1350 obj_tlen
-=sizeof(struct rsvp_obj_frr_t
);
1351 obj_tptr
+=sizeof(struct rsvp_obj_frr_t
);
1354 case RSVP_CTYPE_TUNNEL_IPV4
: /* old style */
1357 printf("%s Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps",
1359 (int)obj_ptr
.rsvp_obj_frr
->setup_prio
,
1360 (int)obj_ptr
.rsvp_obj_frr
->hold_prio
,
1361 (int)obj_ptr
.rsvp_obj_frr
->hop_limit
,
1363 printf("%s Include Colors: 0x%08x, Exclude Colors: 0x%08x",
1365 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->include_any
),
1366 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->exclude_any
));
1376 case RSVP_OBJ_DETOUR
:
1377 switch(rsvp_obj_ctype
) {
1378 case RSVP_CTYPE_TUNNEL_IPV4
:
1379 while(obj_tlen
>= 8) {
1380 printf("%s PLR-ID: %s, Avoid-Node-ID: %s",
1382 ipaddr_string(obj_tptr
),
1383 ipaddr_string(obj_tptr
+4));
1393 case RSVP_OBJ_CLASSTYPE
:
1394 case RSVP_OBJ_CLASSTYPE_OLD
: /* fall through */
1395 switch(rsvp_obj_ctype
) {
1399 EXTRACT_32BITS(obj_tptr
)&0x7);
1408 case RSVP_OBJ_ERROR_SPEC
:
1409 switch(rsvp_obj_ctype
) {
1410 case RSVP_CTYPE_3
: /* fall through - FIXME add TLV parser */
1411 case RSVP_CTYPE_IPV4
:
1414 error_code
=*(obj_tptr
+5);
1415 error_value
=EXTRACT_16BITS(obj_tptr
+6);
1416 printf("%s Error Node Address: %s, Flags: [0x%02x]%s Error Code: %s (%u)",
1418 ipaddr_string(obj_tptr
),
1421 tok2str(rsvp_obj_error_code_values
,"unknown",error_code
),
1423 switch (error_code
) {
1424 case RSVP_OBJ_ERROR_SPEC_CODE_ROUTING
:
1425 printf(", Error Value: %s (%u)",
1426 tok2str(rsvp_obj_error_code_routing_values
,"unknown",error_value
),
1429 case RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE
: /* fall through */
1430 case RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE_OLD
:
1431 printf(", Error Value: %s (%u)",
1432 tok2str(rsvp_obj_error_code_diffserv_te_values
,"unknown",error_value
),
1436 printf(", Unknown Error Value (%u)", error_value
);
1443 case RSVP_CTYPE_4
: /* fall through - FIXME add TLV parser */
1444 case RSVP_CTYPE_IPV6
:
1447 error_code
=*(obj_tptr
+17);
1448 error_value
=EXTRACT_16BITS(obj_tptr
+18);
1449 printf("%s Error Node Address: %s, Flags: [0x%02x]%s Error Code: %s (%u)",
1451 ip6addr_string(obj_tptr
),
1454 tok2str(rsvp_obj_error_code_values
,"unknown",error_code
),
1457 switch (error_code
) {
1458 case RSVP_OBJ_ERROR_SPEC_CODE_ROUTING
:
1459 printf(", Error Value: %s (%u)",
1460 tok2str(rsvp_obj_error_code_routing_values
,"unknown",error_value
),
1475 case RSVP_OBJ_PROPERTIES
:
1476 switch(rsvp_obj_ctype
) {
1480 padbytes
= EXTRACT_16BITS(obj_tptr
+2);
1481 printf("%s TLV count: %u, padding bytes: %u",
1483 EXTRACT_16BITS(obj_tptr
),
1487 /* loop through as long there is anything longer than the TLV header (2) */
1488 while(obj_tlen
>= 2 + padbytes
) {
1489 printf("%s %s TLV (0x%02x), length: %u", /* length includes header */
1491 tok2str(rsvp_obj_prop_tlv_values
,"unknown",*obj_tptr
),
1494 if (obj_tlen
< *(obj_tptr
+1))
1496 if (*(obj_tptr
+1) < 2)
1498 print_unknown_data(obj_tptr
+2,"\n\t\t",*(obj_tptr
+1)-2);
1499 obj_tlen
-=*(obj_tptr
+1);
1500 obj_tptr
+=*(obj_tptr
+1);
1508 case RSVP_OBJ_MESSAGE_ID
: /* fall through */
1509 case RSVP_OBJ_MESSAGE_ID_ACK
: /* fall through */
1510 case RSVP_OBJ_MESSAGE_ID_LIST
:
1511 switch(rsvp_obj_ctype
) {
1516 printf("%s Flags [0x%02x], epoch: %u",
1519 EXTRACT_24BITS(obj_tptr
+1));
1522 /* loop through as long there are no messages left */
1523 while(obj_tlen
>= 4) {
1524 printf("%s Message-ID 0x%08x (%u)",
1526 EXTRACT_32BITS(obj_tptr
),
1527 EXTRACT_32BITS(obj_tptr
));
1537 case RSVP_OBJ_INTEGRITY
:
1538 switch(rsvp_obj_ctype
) {
1540 if (obj_tlen
< sizeof(struct rsvp_obj_integrity_t
))
1542 obj_ptr
.rsvp_obj_integrity
= (const struct rsvp_obj_integrity_t
*)obj_tptr
;
1543 printf("%s Key-ID 0x%04x%08x, Sequence 0x%08x%08x, Flags [%s]",
1545 EXTRACT_16BITS(obj_ptr
.rsvp_obj_integrity
->key_id
),
1546 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->key_id
+2),
1547 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->sequence
),
1548 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->sequence
+4),
1549 bittok2str(rsvp_obj_integrity_flag_values
,
1551 obj_ptr
.rsvp_obj_integrity
->flags
));
1552 printf("%s MD5-sum 0x%08x%08x%08x%08x (unverified)",
1554 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->digest
),
1555 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->digest
+4),
1556 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->digest
+8),
1557 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->digest
+12));
1558 obj_tlen
+=sizeof(struct rsvp_obj_integrity_t
);
1559 obj_tptr
+=sizeof(struct rsvp_obj_integrity_t
);
1566 case RSVP_OBJ_ADMIN_STATUS
:
1567 switch(rsvp_obj_ctype
) {
1571 printf("%s Flags [%s]", ident
,
1572 bittok2str(rsvp_obj_admin_status_flag_values
, "none",
1573 EXTRACT_32BITS(obj_tptr
)));
1582 case RSVP_OBJ_LABEL_SET
:
1583 switch(rsvp_obj_ctype
) {
1588 u_int action
, subchannel
;
1589 action
= (EXTRACT_16BITS(obj_tptr
)>>8);
1591 printf("%s Action: %s (%u), Label type: %u", ident
,
1592 tok2str(rsvp_obj_label_set_action_values
, "Unknown", action
),
1593 action
, ((EXTRACT_32BITS(obj_tptr
) & 0x7F)));
1596 case LABEL_SET_INCLUSIVE_RANGE
:
1597 case LABEL_SET_EXCLUSIVE_RANGE
: /* fall through */
1599 /* only a couple of subchannels are expected */
1602 printf("%s Start range: %u, End range: %u", ident
,
1603 EXTRACT_32BITS(obj_tptr
+4),
1604 EXTRACT_32BITS(obj_tptr
+8));
1613 while(obj_tlen
>= 4 ) {
1614 printf("%s Subchannel #%u: %u", ident
, subchannel
,
1615 EXTRACT_32BITS(obj_tptr
));
1629 * FIXME those are the defined objects that lack a decoder
1630 * you are welcome to contribute code ;-)
1633 case RSVP_OBJ_SCOPE
:
1634 case RSVP_OBJ_POLICY_DATA
:
1635 case RSVP_OBJ_ACCEPT_LABEL_SET
:
1636 case RSVP_OBJ_PROTECTION
:
1639 print_unknown_data(obj_tptr
,"\n\t ",obj_tlen
); /* FIXME indentation */
1642 /* do we also want to see a hex dump ? */
1643 if (vflag
> 1 || hexdump
==TRUE
)
1644 print_unknown_data(tptr
+sizeof(sizeof(struct rsvp_object_header
)),"\n\t ", /* FIXME indentation */
1645 rsvp_obj_len
-sizeof(struct rsvp_object_header
));
1652 printf("\n\t\t packet exceeded snapshot");
1658 rsvp_print(register const u_char
*pptr
, register u_int len
) {
1660 const struct rsvp_common_header
*rsvp_com_header
;
1661 const u_char
*tptr
,*subtptr
;
1662 u_short tlen
,subtlen
;
1666 rsvp_com_header
= (const struct rsvp_common_header
*)pptr
;
1667 TCHECK(*rsvp_com_header
);
1670 * Sanity checking of the header.
1672 if (RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
) != RSVP_VERSION
) {
1673 printf("ERROR: RSVP version %u packet not supported",
1674 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
));
1678 /* in non-verbose mode just lets print the basic Message Type*/
1680 printf("RSVPv%u %s Message, length: %u",
1681 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
),
1682 tok2str(rsvp_msg_type_values
, "unknown (%u)",rsvp_com_header
->msg_type
),
1687 /* ok they seem to want to know everything - lets fully decode it */
1689 tlen
=EXTRACT_16BITS(rsvp_com_header
->length
);
1691 printf("\n\tRSVPv%u %s Message (%u), Flags: [%s], length: %u, ttl: %u, checksum: 0x%04x",
1692 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
),
1693 tok2str(rsvp_msg_type_values
, "unknown, type: %u",rsvp_com_header
->msg_type
),
1694 rsvp_com_header
->msg_type
,
1695 bittok2str(rsvp_header_flag_values
,"none",RSVP_EXTRACT_FLAGS(rsvp_com_header
->version_flags
)),
1697 rsvp_com_header
->ttl
,
1698 EXTRACT_16BITS(rsvp_com_header
->checksum
));
1700 if (tlen
< sizeof(const struct rsvp_common_header
)) {
1701 printf("ERROR: common header too short %u < %lu", tlen
,
1702 (unsigned long)sizeof(const struct rsvp_common_header
));
1706 tptr
+=sizeof(const struct rsvp_common_header
);
1707 tlen
-=sizeof(const struct rsvp_common_header
);
1709 switch(rsvp_com_header
->msg_type
) {
1711 case RSVP_MSGTYPE_AGGREGATE
:
1714 rsvp_com_header
= (const struct rsvp_common_header
*)subtptr
;
1715 TCHECK(*rsvp_com_header
);
1718 * Sanity checking of the header.
1720 if (RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
) != RSVP_VERSION
) {
1721 printf("ERROR: RSVP version %u packet not supported",
1722 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
));
1725 subtlen
=EXTRACT_16BITS(rsvp_com_header
->length
);
1727 printf("\n\t RSVPv%u %s Message (%u), Flags: [%s], length: %u, ttl: %u, checksum: 0x%04x",
1728 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
),
1729 tok2str(rsvp_msg_type_values
, "unknown, type: %u",rsvp_com_header
->msg_type
),
1730 rsvp_com_header
->msg_type
,
1731 bittok2str(rsvp_header_flag_values
,"none",RSVP_EXTRACT_FLAGS(rsvp_com_header
->version_flags
)),
1733 rsvp_com_header
->ttl
,
1734 EXTRACT_16BITS(rsvp_com_header
->checksum
));
1736 if (subtlen
< sizeof(const struct rsvp_common_header
)) {
1737 printf("ERROR: common header too short %u < %lu", subtlen
,
1738 (unsigned long)sizeof(const struct rsvp_common_header
));
1742 if (tlen
< subtlen
) {
1743 printf("ERROR: common header too large %u > %u", subtlen
,
1748 subtptr
+=sizeof(const struct rsvp_common_header
);
1749 subtlen
-=sizeof(const struct rsvp_common_header
);
1751 if (rsvp_obj_print(subtptr
,"\n\t ", subtlen
) == -1)
1754 tptr
+=subtlen
+sizeof(const struct rsvp_common_header
);
1755 tlen
-=subtlen
+sizeof(const struct rsvp_common_header
);
1760 case RSVP_MSGTYPE_PATH
:
1761 case RSVP_MSGTYPE_RESV
:
1762 case RSVP_MSGTYPE_PATHERR
:
1763 case RSVP_MSGTYPE_RESVERR
:
1764 case RSVP_MSGTYPE_PATHTEAR
:
1765 case RSVP_MSGTYPE_RESVTEAR
:
1766 case RSVP_MSGTYPE_RESVCONF
:
1767 case RSVP_MSGTYPE_HELLO_OLD
:
1768 case RSVP_MSGTYPE_HELLO
:
1769 case RSVP_MSGTYPE_ACK
:
1770 case RSVP_MSGTYPE_SREFRESH
:
1771 if (rsvp_obj_print(tptr
,"\n\t ", tlen
) == -1)
1776 print_unknown_data(tptr
,"\n\t ",tlen
);
1782 printf("\n\t\t packet exceeded snapshot");