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.33.2.14 2007-02-26 13:32:36 hannes Exp $";
27 #include <tcpdump-stdinc.h>
33 #include "interface.h"
35 #include "addrtoname.h"
36 #include "ethertype.h"
41 * RFC 2205 common header
44 * +-------------+-------------+-------------+-------------+
45 * | Vers | Flags| Msg Type | RSVP Checksum |
46 * +-------------+-------------+-------------+-------------+
47 * | Send_TTL | (Reserved) | RSVP Length |
48 * +-------------+-------------+-------------+-------------+
52 struct rsvp_common_header
{
53 u_int8_t version_flags
;
62 * RFC2205 object header
66 * +-------------+-------------+-------------+-------------+
67 * | Length (bytes) | Class-Num | C-Type |
68 * +-------------+-------------+-------------+-------------+
70 * // (Object contents) //
72 * +-------------+-------------+-------------+-------------+
75 struct rsvp_object_header
{
81 #define RSVP_VERSION 1
82 #define RSVP_EXTRACT_VERSION(x) (((x)&0xf0)>>4)
83 #define RSVP_EXTRACT_FLAGS(x) ((x)&0x0f)
85 #define RSVP_MSGTYPE_PATH 1
86 #define RSVP_MSGTYPE_RESV 2
87 #define RSVP_MSGTYPE_PATHERR 3
88 #define RSVP_MSGTYPE_RESVERR 4
89 #define RSVP_MSGTYPE_PATHTEAR 5
90 #define RSVP_MSGTYPE_RESVTEAR 6
91 #define RSVP_MSGTYPE_RESVCONF 7
92 #define RSVP_MSGTYPE_AGGREGATE 12
93 #define RSVP_MSGTYPE_ACK 13
94 #define RSVP_MSGTYPE_HELLO_OLD 14 /* ancient Hellos */
95 #define RSVP_MSGTYPE_SREFRESH 15
96 #define RSVP_MSGTYPE_HELLO 20
98 static const struct tok rsvp_msg_type_values
[] = {
99 { RSVP_MSGTYPE_PATH
, "Path" },
100 { RSVP_MSGTYPE_RESV
, "Resv" },
101 { RSVP_MSGTYPE_PATHERR
, "PathErr" },
102 { RSVP_MSGTYPE_RESVERR
, "ResvErr" },
103 { RSVP_MSGTYPE_PATHTEAR
, "PathTear" },
104 { RSVP_MSGTYPE_RESVTEAR
, "ResvTear" },
105 { RSVP_MSGTYPE_RESVCONF
, "ResvConf" },
106 { RSVP_MSGTYPE_AGGREGATE
, "Aggregate" },
107 { RSVP_MSGTYPE_ACK
, "Acknowledgement" },
108 { RSVP_MSGTYPE_HELLO_OLD
, "Hello (Old)" },
109 { RSVP_MSGTYPE_SREFRESH
, "Refresh" },
110 { RSVP_MSGTYPE_HELLO
, "Hello" },
114 static const struct tok rsvp_header_flag_values
[] = {
115 { 0x01, "Refresh reduction capable" }, /* rfc2961 */
119 #define RSVP_OBJ_SESSION 1 /* rfc2205 */
120 #define RSVP_OBJ_RSVP_HOP 3 /* rfc2205, rfc3473 */
121 #define RSVP_OBJ_INTEGRITY 4 /* rfc2747 */
122 #define RSVP_OBJ_TIME_VALUES 5 /* rfc2205 */
123 #define RSVP_OBJ_ERROR_SPEC 6
124 #define RSVP_OBJ_SCOPE 7
125 #define RSVP_OBJ_STYLE 8 /* rfc2205 */
126 #define RSVP_OBJ_FLOWSPEC 9 /* rfc2215 */
127 #define RSVP_OBJ_FILTERSPEC 10 /* rfc2215 */
128 #define RSVP_OBJ_SENDER_TEMPLATE 11
129 #define RSVP_OBJ_SENDER_TSPEC 12 /* rfc2215 */
130 #define RSVP_OBJ_ADSPEC 13 /* rfc2215 */
131 #define RSVP_OBJ_POLICY_DATA 14
132 #define RSVP_OBJ_CONFIRM 15 /* rfc2205 */
133 #define RSVP_OBJ_LABEL 16 /* rfc3209 */
134 #define RSVP_OBJ_LABEL_REQ 19 /* rfc3209 */
135 #define RSVP_OBJ_ERO 20 /* rfc3209 */
136 #define RSVP_OBJ_RRO 21 /* rfc3209 */
137 #define RSVP_OBJ_HELLO 22 /* rfc3209 */
138 #define RSVP_OBJ_MESSAGE_ID 23 /* rfc2961 */
139 #define RSVP_OBJ_MESSAGE_ID_ACK 24 /* rfc2961 */
140 #define RSVP_OBJ_MESSAGE_ID_LIST 25 /* rfc2961 */
141 #define RSVP_OBJ_RECOVERY_LABEL 34 /* rfc3473 */
142 #define RSVP_OBJ_UPSTREAM_LABEL 35 /* rfc3473 */
143 #define RSVP_OBJ_LABEL_SET 36 /* rfc3473 */
144 #define RSVP_OBJ_PROTECTION 37 /* rfc3473 */
145 #define RSVP_OBJ_DETOUR 63 /* draft-ietf-mpls-rsvp-lsp-fastreroute-07 */
146 #define RSVP_OBJ_CLASSTYPE 66 /* rfc4124 */
147 #define RSVP_OBJ_CLASSTYPE_OLD 125 /* draft-ietf-tewg-diff-te-proto-07 */
148 #define RSVP_OBJ_SUGGESTED_LABEL 129 /* rfc3473 */
149 #define RSVP_OBJ_ACCEPT_LABEL_SET 130 /* rfc3473 */
150 #define RSVP_OBJ_RESTART_CAPABILITY 131 /* rfc3473 */
151 #define RSVP_OBJ_NOTIFY_REQ 195 /* rfc3473 */
152 #define RSVP_OBJ_ADMIN_STATUS 196 /* rfc3473 */
153 #define RSVP_OBJ_PROPERTIES 204 /* juniper proprietary */
154 #define RSVP_OBJ_FASTREROUTE 205 /* draft-ietf-mpls-rsvp-lsp-fastreroute-07 */
155 #define RSVP_OBJ_SESSION_ATTRIBUTE 207 /* rfc3209 */
156 #define RSVP_OBJ_GENERALIZED_UNI 229 /* OIF RSVP extensions UNI 1.0 Signaling, Rel. 2 */
157 #define RSVP_OBJ_CALL_ID 230 /* rfc3474 */
158 #define RSVP_OBJ_CALL_OPS 236 /* rfc3474 */
160 static const struct tok rsvp_obj_values
[] = {
161 { RSVP_OBJ_SESSION
, "Session" },
162 { RSVP_OBJ_RSVP_HOP
, "RSVP Hop" },
163 { RSVP_OBJ_INTEGRITY
, "Integrity" },
164 { RSVP_OBJ_TIME_VALUES
, "Time Values" },
165 { RSVP_OBJ_ERROR_SPEC
, "Error Spec" },
166 { RSVP_OBJ_SCOPE
, "Scope" },
167 { RSVP_OBJ_STYLE
, "Style" },
168 { RSVP_OBJ_FLOWSPEC
, "Flowspec" },
169 { RSVP_OBJ_FILTERSPEC
, "FilterSpec" },
170 { RSVP_OBJ_SENDER_TEMPLATE
, "Sender Template" },
171 { RSVP_OBJ_SENDER_TSPEC
, "Sender TSpec" },
172 { RSVP_OBJ_ADSPEC
, "Adspec" },
173 { RSVP_OBJ_POLICY_DATA
, "Policy Data" },
174 { RSVP_OBJ_CONFIRM
, "Confirm" },
175 { RSVP_OBJ_LABEL
, "Label" },
176 { RSVP_OBJ_LABEL_REQ
, "Label Request" },
177 { RSVP_OBJ_ERO
, "ERO" },
178 { RSVP_OBJ_RRO
, "RRO" },
179 { RSVP_OBJ_HELLO
, "Hello" },
180 { RSVP_OBJ_MESSAGE_ID
, "Message ID" },
181 { RSVP_OBJ_MESSAGE_ID_ACK
, "Message ID Ack" },
182 { RSVP_OBJ_MESSAGE_ID_LIST
, "Message ID List" },
183 { RSVP_OBJ_RECOVERY_LABEL
, "Recovery Label" },
184 { RSVP_OBJ_UPSTREAM_LABEL
, "Upstream Label" },
185 { RSVP_OBJ_LABEL_SET
, "Label Set" },
186 { RSVP_OBJ_ACCEPT_LABEL_SET
, "Acceptable Label Set" },
187 { RSVP_OBJ_DETOUR
, "Detour" },
188 { RSVP_OBJ_CLASSTYPE
, "Class Type" },
189 { RSVP_OBJ_CLASSTYPE_OLD
, "Class Type (old)" },
190 { RSVP_OBJ_SUGGESTED_LABEL
, "Suggested Label" },
191 { RSVP_OBJ_PROPERTIES
, "Properties" },
192 { RSVP_OBJ_FASTREROUTE
, "Fast Re-Route" },
193 { RSVP_OBJ_SESSION_ATTRIBUTE
, "Session Attribute" },
194 { RSVP_OBJ_GENERALIZED_UNI
, "Generalized UNI" },
195 { RSVP_OBJ_CALL_ID
, "Call-ID" },
196 { RSVP_OBJ_CALL_OPS
, "Call Capability" },
197 { RSVP_OBJ_RESTART_CAPABILITY
, "Restart Capability" },
198 { RSVP_OBJ_NOTIFY_REQ
, "Notify Request" },
199 { RSVP_OBJ_PROTECTION
, "Protection" },
200 { RSVP_OBJ_ADMIN_STATUS
, "Administrative Status" },
204 #define RSVP_CTYPE_IPV4 1
205 #define RSVP_CTYPE_IPV6 2
206 #define RSVP_CTYPE_TUNNEL_IPV4 7
207 #define RSVP_CTYPE_TUNNEL_IPV6 8
208 #define RSVP_CTYPE_UNI_IPV4 11 /* OIF RSVP extensions UNI 1.0 Signaling Rel. 2 */
209 #define RSVP_CTYPE_1 1
210 #define RSVP_CTYPE_2 2
211 #define RSVP_CTYPE_3 3
212 #define RSVP_CTYPE_4 4
215 * the ctypes are not globally unique so for
216 * translating it to strings we build a table based
217 * on objects offsetted by the ctype
220 static const struct tok rsvp_ctype_values
[] = {
221 { 256*RSVP_OBJ_RSVP_HOP
+RSVP_CTYPE_IPV4
, "IPv4" },
222 { 256*RSVP_OBJ_RSVP_HOP
+RSVP_CTYPE_IPV6
, "IPv6" },
223 { 256*RSVP_OBJ_RSVP_HOP
+RSVP_CTYPE_3
, "IPv4 plus opt. TLVs" },
224 { 256*RSVP_OBJ_RSVP_HOP
+RSVP_CTYPE_4
, "IPv6 plus opt. TLVs" },
225 { 256*RSVP_OBJ_NOTIFY_REQ
+RSVP_CTYPE_IPV4
, "IPv4" },
226 { 256*RSVP_OBJ_NOTIFY_REQ
+RSVP_CTYPE_IPV6
, "IPv6" },
227 { 256*RSVP_OBJ_CONFIRM
+RSVP_CTYPE_IPV4
, "IPv4" },
228 { 256*RSVP_OBJ_CONFIRM
+RSVP_CTYPE_IPV6
, "IPv6" },
229 { 256*RSVP_OBJ_TIME_VALUES
+RSVP_CTYPE_1
, "1" },
230 { 256*RSVP_OBJ_FLOWSPEC
+RSVP_CTYPE_1
, "obsolete" },
231 { 256*RSVP_OBJ_FLOWSPEC
+RSVP_CTYPE_2
, "IntServ" },
232 { 256*RSVP_OBJ_SENDER_TSPEC
+RSVP_CTYPE_2
, "IntServ" },
233 { 256*RSVP_OBJ_ADSPEC
+RSVP_CTYPE_2
, "IntServ" },
234 { 256*RSVP_OBJ_FILTERSPEC
+RSVP_CTYPE_IPV4
, "IPv4" },
235 { 256*RSVP_OBJ_FILTERSPEC
+RSVP_CTYPE_IPV6
, "IPv6" },
236 { 256*RSVP_OBJ_FILTERSPEC
+RSVP_CTYPE_3
, "IPv6 Flow-label" },
237 { 256*RSVP_OBJ_FILTERSPEC
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
238 { 256*RSVP_OBJ_SESSION
+RSVP_CTYPE_IPV4
, "IPv4" },
239 { 256*RSVP_OBJ_SESSION
+RSVP_CTYPE_IPV6
, "IPv6" },
240 { 256*RSVP_OBJ_SESSION
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
241 { 256*RSVP_OBJ_SESSION
+RSVP_CTYPE_UNI_IPV4
, "UNI IPv4" },
242 { 256*RSVP_OBJ_SENDER_TEMPLATE
+RSVP_CTYPE_IPV4
, "IPv4" },
243 { 256*RSVP_OBJ_SENDER_TEMPLATE
+RSVP_CTYPE_IPV6
, "IPv6" },
244 { 256*RSVP_OBJ_SENDER_TEMPLATE
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
245 { 256*RSVP_OBJ_MESSAGE_ID
+RSVP_CTYPE_1
, "1" },
246 { 256*RSVP_OBJ_MESSAGE_ID_ACK
+RSVP_CTYPE_1
, "Message id ack" },
247 { 256*RSVP_OBJ_MESSAGE_ID_ACK
+RSVP_CTYPE_2
, "Message id nack" },
248 { 256*RSVP_OBJ_MESSAGE_ID_LIST
+RSVP_CTYPE_1
, "1" },
249 { 256*RSVP_OBJ_STYLE
+RSVP_CTYPE_1
, "1" },
250 { 256*RSVP_OBJ_HELLO
+RSVP_CTYPE_1
, "Hello Request" },
251 { 256*RSVP_OBJ_HELLO
+RSVP_CTYPE_2
, "Hello Ack" },
252 { 256*RSVP_OBJ_LABEL_REQ
+RSVP_CTYPE_1
, "without label range" },
253 { 256*RSVP_OBJ_LABEL_REQ
+RSVP_CTYPE_2
, "with ATM label range" },
254 { 256*RSVP_OBJ_LABEL_REQ
+RSVP_CTYPE_3
, "with FR label range" },
255 { 256*RSVP_OBJ_LABEL_REQ
+RSVP_CTYPE_4
, "Generalized Label" },
256 { 256*RSVP_OBJ_LABEL
+RSVP_CTYPE_1
, "Label" },
257 { 256*RSVP_OBJ_LABEL
+RSVP_CTYPE_2
, "Generalized Label" },
258 { 256*RSVP_OBJ_LABEL
+RSVP_CTYPE_3
, "Waveband Switching" },
259 { 256*RSVP_OBJ_SUGGESTED_LABEL
+RSVP_CTYPE_1
, "Label" },
260 { 256*RSVP_OBJ_SUGGESTED_LABEL
+RSVP_CTYPE_2
, "Generalized Label" },
261 { 256*RSVP_OBJ_SUGGESTED_LABEL
+RSVP_CTYPE_3
, "Waveband Switching" },
262 { 256*RSVP_OBJ_UPSTREAM_LABEL
+RSVP_CTYPE_1
, "Label" },
263 { 256*RSVP_OBJ_UPSTREAM_LABEL
+RSVP_CTYPE_2
, "Generalized Label" },
264 { 256*RSVP_OBJ_UPSTREAM_LABEL
+RSVP_CTYPE_3
, "Waveband Switching" },
265 { 256*RSVP_OBJ_RECOVERY_LABEL
+RSVP_CTYPE_1
, "Label" },
266 { 256*RSVP_OBJ_RECOVERY_LABEL
+RSVP_CTYPE_2
, "Generalized Label" },
267 { 256*RSVP_OBJ_RECOVERY_LABEL
+RSVP_CTYPE_3
, "Waveband Switching" },
268 { 256*RSVP_OBJ_ERO
+RSVP_CTYPE_IPV4
, "IPv4" },
269 { 256*RSVP_OBJ_RRO
+RSVP_CTYPE_IPV4
, "IPv4" },
270 { 256*RSVP_OBJ_ERROR_SPEC
+RSVP_CTYPE_IPV4
, "IPv4" },
271 { 256*RSVP_OBJ_ERROR_SPEC
+RSVP_CTYPE_IPV6
, "IPv6" },
272 { 256*RSVP_OBJ_ERROR_SPEC
+RSVP_CTYPE_3
, "IPv4 plus opt. TLVs" },
273 { 256*RSVP_OBJ_ERROR_SPEC
+RSVP_CTYPE_4
, "IPv6 plus opt. TLVs" },
274 { 256*RSVP_OBJ_RESTART_CAPABILITY
+RSVP_CTYPE_1
, "IPv4" },
275 { 256*RSVP_OBJ_SESSION_ATTRIBUTE
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
276 { 256*RSVP_OBJ_FASTREROUTE
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" }, /* old style*/
277 { 256*RSVP_OBJ_FASTREROUTE
+RSVP_CTYPE_1
, "1" }, /* new style */
278 { 256*RSVP_OBJ_DETOUR
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
279 { 256*RSVP_OBJ_PROPERTIES
+RSVP_CTYPE_1
, "1" },
280 { 256*RSVP_OBJ_ADMIN_STATUS
+RSVP_CTYPE_1
, "1" },
281 { 256*RSVP_OBJ_CLASSTYPE
+RSVP_CTYPE_1
, "1" },
282 { 256*RSVP_OBJ_CLASSTYPE_OLD
+RSVP_CTYPE_1
, "1" },
283 { 256*RSVP_OBJ_LABEL_SET
+RSVP_CTYPE_1
, "1" },
284 { 256*RSVP_OBJ_GENERALIZED_UNI
+RSVP_CTYPE_1
, "1" },
288 struct rsvp_obj_integrity_t
{
292 u_int8_t sequence
[8];
296 static const struct tok rsvp_obj_integrity_flag_values
[] = {
297 { 0x80, "Handshake" },
301 struct rsvp_obj_frr_t
{
306 u_int8_t bandwidth
[4];
307 u_int8_t include_any
[4];
308 u_int8_t exclude_any
[4];
309 u_int8_t include_all
[4];
313 #define RSVP_OBJ_XRO_MASK_SUBOBJ(x) ((x)&0x7f)
314 #define RSVP_OBJ_XRO_MASK_LOOSE(x) ((x)&0x80)
316 #define RSVP_OBJ_XRO_RES 0
317 #define RSVP_OBJ_XRO_IPV4 1
318 #define RSVP_OBJ_XRO_IPV6 2
319 #define RSVP_OBJ_XRO_ASN 32
320 #define RSVP_OBJ_XRO_MPLS 64
322 static const struct tok rsvp_obj_xro_values
[] = {
323 { RSVP_OBJ_XRO_RES
, "Reserved" },
324 { RSVP_OBJ_XRO_IPV4
, "IPv4 prefix" },
325 { RSVP_OBJ_XRO_IPV6
, "IPv6 prefix" },
326 { RSVP_OBJ_XRO_ASN
, "Autonomous system number" },
327 { RSVP_OBJ_XRO_MPLS
, "MPLS label switched path termination" },
331 /* draft-ietf-mpls-rsvp-lsp-fastreroute-07.txt */
332 static const struct tok rsvp_obj_rro_flag_values
[] = {
333 { 0x01, "Local protection available" },
334 { 0x02, "Local protection in use" },
335 { 0x04, "Bandwidth protection" },
336 { 0x08, "Node protection" },
340 static const struct tok rsvp_resstyle_values
[] = {
341 { 17, "Wildcard Filter" },
342 { 10, "Fixed Filter" },
343 { 18, "Shared Explicit" },
347 #define RSVP_OBJ_INTSERV_GUARANTEED_SERV 2
348 #define RSVP_OBJ_INTSERV_CONTROLLED_LOAD 5
350 static const struct tok rsvp_intserv_service_type_values
[] = {
351 { 1, "Default/Global Information" },
352 { RSVP_OBJ_INTSERV_GUARANTEED_SERV
, "Guaranteed Service" },
353 { RSVP_OBJ_INTSERV_CONTROLLED_LOAD
, "Controlled Load" },
357 static const struct tok rsvp_intserv_parameter_id_values
[] = {
359 { 6, "Path b/w estimate" },
360 { 8, "Minimum path latency" },
361 { 10, "Composed MTU" },
362 { 127, "Token Bucket TSpec" },
363 { 130, "Guaranteed Service RSpec" },
364 { 133, "End-to-end composed value for C" },
365 { 134, "End-to-end composed value for D" },
366 { 135, "Since-last-reshaping point composed C" },
367 { 136, "Since-last-reshaping point composed D" },
371 static struct tok rsvp_session_attribute_flag_values
[] = {
372 { 0x01, "Local Protection desired" },
373 { 0x02, "Label Recording desired" },
374 { 0x04, "SE Style desired" },
375 { 0x08, "Bandwidth protection desired" }, /* draft-ietf-mpls-rsvp-lsp-fastreroute-02.txt */
376 { 0x10, "Node protection desired" }, /* draft-ietf-mpls-rsvp-lsp-fastreroute-02.txt */
380 static struct tok rsvp_obj_prop_tlv_values
[] = {
382 { 0x02, "Metric 1" },
383 { 0x04, "Metric 2" },
384 { 0x08, "CCC Status" },
385 { 0x10, "Path Type" },
389 #define RSVP_OBJ_ERROR_SPEC_CODE_ROUTING 24
390 #define RSVP_OBJ_ERROR_SPEC_CODE_NOTIFY 25
391 #define RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE 28
392 #define RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE_OLD 125
394 static struct tok rsvp_obj_error_code_values
[] = {
395 { RSVP_OBJ_ERROR_SPEC_CODE_ROUTING
, "Routing Problem" },
396 { RSVP_OBJ_ERROR_SPEC_CODE_NOTIFY
, "Notify Error" },
397 { RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE
, "Diffserv TE Error" },
398 { RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE_OLD
, "Diffserv TE Error (Old)" },
402 static struct tok rsvp_obj_error_code_routing_values
[] = {
403 { 1, "Bad EXPLICIT_ROUTE object" },
404 { 2, "Bad strict node" },
405 { 3, "Bad loose node" },
406 { 4, "Bad initial subobject" },
407 { 5, "No route available toward destination" },
408 { 6, "Unacceptable label value" },
409 { 7, "RRO indicated routing loops" },
410 { 8, "non-RSVP-capable router in the path" },
411 { 9, "MPLS label allocation failure" },
412 { 10, "Unsupported L3PID" },
416 static struct tok rsvp_obj_error_code_diffserv_te_values
[] = {
417 { 1, "Unexpected CT object" },
418 { 2, "Unsupported CT" },
419 { 3, "Invalid CT value" },
420 { 4, "CT/setup priority do not form a configured TE-Class" },
421 { 5, "CT/holding priority do not form a configured TE-Class" },
422 { 6, "CT/setup priority and CT/holding priority do not form a configured TE-Class" },
423 { 7, "Inconsistency between signaled PSC and signaled CT" },
424 { 8, "Inconsistency between signaled PHBs and signaled CT" },
428 /* rfc3473 / rfc 3471 */
429 static const struct tok rsvp_obj_admin_status_flag_values
[] = {
430 { 0x80000000, "Reflect" },
431 { 0x00000004, "Testing" },
432 { 0x00000002, "Admin-down" },
433 { 0x00000001, "Delete-in-progress" },
437 /* label set actions - rfc3471 */
438 #define LABEL_SET_INCLUSIVE_LIST 0
439 #define LABEL_SET_EXCLUSIVE_LIST 1
440 #define LABEL_SET_INCLUSIVE_RANGE 2
441 #define LABEL_SET_EXCLUSIVE_RANGE 3
443 static const struct tok rsvp_obj_label_set_action_values
[] = {
444 { LABEL_SET_INCLUSIVE_LIST
, "Inclusive list" },
445 { LABEL_SET_EXCLUSIVE_LIST
, "Exclusive list" },
446 { LABEL_SET_INCLUSIVE_RANGE
, "Inclusive range" },
447 { LABEL_SET_EXCLUSIVE_RANGE
, "Exclusive range" },
451 /* OIF RSVP extensions UNI 1.0 Signaling, release 2 */
452 #define RSVP_GEN_UNI_SUBOBJ_SOURCE_TNA_ADDRESS 1
453 #define RSVP_GEN_UNI_SUBOBJ_DESTINATION_TNA_ADDRESS 2
454 #define RSVP_GEN_UNI_SUBOBJ_DIVERSITY 3
455 #define RSVP_GEN_UNI_SUBOBJ_EGRESS_LABEL 4
456 #define RSVP_GEN_UNI_SUBOBJ_SERVICE_LEVEL 5
458 static const struct tok rsvp_obj_generalized_uni_values
[] = {
459 { RSVP_GEN_UNI_SUBOBJ_SOURCE_TNA_ADDRESS
, "Source TNA address" },
460 { RSVP_GEN_UNI_SUBOBJ_DESTINATION_TNA_ADDRESS
, "Destination TNA address" },
461 { RSVP_GEN_UNI_SUBOBJ_DIVERSITY
, "Diversity" },
462 { RSVP_GEN_UNI_SUBOBJ_EGRESS_LABEL
, "Egress label" },
463 { RSVP_GEN_UNI_SUBOBJ_SERVICE_LEVEL
, "Service level" },
467 static int rsvp_intserv_print(const u_char
*, u_short
);
470 * this is a dissector for all the intserv defined
471 * specs as defined per rfc2215
472 * it is called from various rsvp objects;
473 * returns the amount of bytes being processed
476 rsvp_intserv_print(const u_char
*tptr
, u_short obj_tlen
) {
478 int parameter_id
,parameter_length
;
486 parameter_id
= *(tptr
);
487 parameter_length
= EXTRACT_16BITS(tptr
+2)<<2; /* convert wordcount to bytecount */
489 printf("\n\t Parameter ID: %s (%u), length: %u, Flags: [0x%02x]",
490 tok2str(rsvp_intserv_parameter_id_values
,"unknown",parameter_id
),
495 if (obj_tlen
< parameter_length
+4)
497 switch(parameter_id
) { /* parameter_id */
501 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
502 * | 4 (e) | (f) | 1 (g) |
503 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
504 * | IS hop cnt (32-bit unsigned integer) |
505 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
507 if (parameter_length
== 4)
508 printf("\n\t\tIS hop count: %u", EXTRACT_32BITS(tptr
+4));
513 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
514 * | 6 (h) | (i) | 1 (j) |
515 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
516 * | Path b/w estimate (32-bit IEEE floating point number) |
517 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
519 if (parameter_length
== 4) {
520 bw
.i
= EXTRACT_32BITS(tptr
+4);
521 printf("\n\t\tPath b/w estimate: %.10g Mbps", bw
.f
/125000);
527 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
528 * | 8 (k) | (l) | 1 (m) |
529 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
530 * | Minimum path latency (32-bit integer) |
531 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
533 if (parameter_length
== 4) {
534 printf("\n\t\tMinimum path latency: ");
535 if (EXTRACT_32BITS(tptr
+4) == 0xffffffff)
536 printf("don't care");
538 printf("%u", EXTRACT_32BITS(tptr
+4));
545 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
546 * | 10 (n) | (o) | 1 (p) |
547 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
548 * | Composed MTU (32-bit unsigned integer) |
549 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
551 if (parameter_length
== 4)
552 printf("\n\t\tComposed MTU: %u bytes", EXTRACT_32BITS(tptr
+4));
556 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
557 * | 127 (e) | 0 (f) | 5 (g) |
558 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
559 * | Token Bucket Rate [r] (32-bit IEEE floating point number) |
560 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
561 * | Token Bucket Size [b] (32-bit IEEE floating point number) |
562 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
563 * | Peak Data Rate [p] (32-bit IEEE floating point number) |
564 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
565 * | Minimum Policed Unit [m] (32-bit integer) |
566 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
567 * | Maximum Packet Size [M] (32-bit integer) |
568 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
571 if (parameter_length
== 20) {
572 bw
.i
= EXTRACT_32BITS(tptr
+4);
573 printf("\n\t\tToken Bucket Rate: %.10g Mbps", bw
.f
/125000);
574 bw
.i
= EXTRACT_32BITS(tptr
+8);
575 printf("\n\t\tToken Bucket Size: %.10g bytes", bw
.f
);
576 bw
.i
= EXTRACT_32BITS(tptr
+12);
577 printf("\n\t\tPeak Data Rate: %.10g Mbps", bw
.f
/125000);
578 printf("\n\t\tMinimum Policed Unit: %u bytes", EXTRACT_32BITS(tptr
+16));
579 printf("\n\t\tMaximum Packet Size: %u bytes", EXTRACT_32BITS(tptr
+20));
585 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
586 * | 130 (h) | 0 (i) | 2 (j) |
587 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
588 * | Rate [R] (32-bit IEEE floating point number) |
589 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
590 * | Slack Term [S] (32-bit integer) |
591 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
594 if (parameter_length
== 8) {
595 bw
.i
= EXTRACT_32BITS(tptr
+4);
596 printf("\n\t\tRate: %.10g Mbps", bw
.f
/125000);
597 printf("\n\t\tSlack Term: %u", EXTRACT_32BITS(tptr
+8));
605 if (parameter_length
== 4)
606 printf("\n\t\tValue: %u", EXTRACT_32BITS(tptr
+4));
611 print_unknown_data(tptr
+4,"\n\t\t",parameter_length
);
613 return (parameter_length
+4); /* header length 4 bytes */
617 rsvp_obj_print (const u_char
*tptr
, const char *ident
, u_int tlen
) {
619 const struct rsvp_object_header
*rsvp_obj_header
;
620 const u_char
*obj_tptr
;
622 const struct rsvp_obj_integrity_t
*rsvp_obj_integrity
;
623 const struct rsvp_obj_frr_t
*rsvp_obj_frr
;
626 u_short rsvp_obj_len
,rsvp_obj_ctype
,obj_tlen
,intserv_serv_tlen
;
627 int hexdump
,processed
,padbytes
,error_code
,error_value
,i
;
634 while(tlen
>=sizeof(struct rsvp_object_header
)) {
635 /* did we capture enough for fully decoding the object header ? */
636 if (!TTEST2(*tptr
, sizeof(struct rsvp_object_header
)))
639 rsvp_obj_header
= (const struct rsvp_object_header
*)tptr
;
640 rsvp_obj_len
=EXTRACT_16BITS(rsvp_obj_header
->length
);
641 rsvp_obj_ctype
=rsvp_obj_header
->ctype
;
643 if(rsvp_obj_len
% 4) {
644 printf("%sERROR: object header size %u not a multiple of 4", ident
, rsvp_obj_len
);
647 if(rsvp_obj_len
< sizeof(struct rsvp_object_header
)) {
648 printf("%sERROR: object header too short %u < %lu", ident
, rsvp_obj_len
,
649 (unsigned long)sizeof(const struct rsvp_object_header
));
653 printf("%s%s Object (%u) Flags: [%s",
655 tok2str(rsvp_obj_values
,
657 rsvp_obj_header
->class_num
),
658 rsvp_obj_header
->class_num
,
659 ((rsvp_obj_header
->class_num
)&0x80) ? "ignore" : "reject");
661 if (rsvp_obj_header
->class_num
> 128)
663 ((rsvp_obj_header
->class_num
)&0x40) ? "and forward" : "silently");
665 printf(" if unknown], Class-Type: %s (%u), length: %u",
666 tok2str(rsvp_ctype_values
,
668 ((rsvp_obj_header
->class_num
)<<8)+rsvp_obj_ctype
),
672 if(tlen
< rsvp_obj_len
) {
673 printf("%sERROR: object goes past end of objects TLV", ident
);
677 obj_tptr
=tptr
+sizeof(struct rsvp_object_header
);
678 obj_tlen
=rsvp_obj_len
-sizeof(struct rsvp_object_header
);
680 /* did we capture enough for fully decoding the object ? */
681 if (!TTEST2(*tptr
, rsvp_obj_len
))
685 switch(rsvp_obj_header
->class_num
) {
686 case RSVP_OBJ_SESSION
:
687 switch(rsvp_obj_ctype
) {
688 case RSVP_CTYPE_IPV4
:
691 printf("%s IPv4 DestAddress: %s, Protocol ID: 0x%02x",
693 ipaddr_string(obj_tptr
),
694 *(obj_tptr
+sizeof(struct in_addr
)));
695 printf("%s Flags: [0x%02x], DestPort %u",
698 EXTRACT_16BITS(obj_tptr
+6));
703 case RSVP_CTYPE_IPV6
:
706 printf("%s IPv6 DestAddress: %s, Protocol ID: 0x%02x",
708 ip6addr_string(obj_tptr
),
709 *(obj_tptr
+sizeof(struct in6_addr
)));
710 printf("%s Flags: [0x%02x], DestPort %u",
712 *(obj_tptr
+sizeof(struct in6_addr
)+1),
713 EXTRACT_16BITS(obj_tptr
+sizeof(struct in6_addr
)+2));
718 case RSVP_CTYPE_TUNNEL_IPV6
:
721 printf("%s IPv6 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
723 ip6addr_string(obj_tptr
),
724 EXTRACT_16BITS(obj_tptr
+18),
725 ip6addr_string(obj_tptr
+20));
730 case RSVP_CTYPE_TUNNEL_IPV4
:
731 case RSVP_CTYPE_UNI_IPV4
:
734 printf("%s IPv4 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
736 ipaddr_string(obj_tptr
),
737 EXTRACT_16BITS(obj_tptr
+6),
738 ipaddr_string(obj_tptr
+8));
747 case RSVP_OBJ_CONFIRM
:
748 switch(rsvp_obj_ctype
) {
749 case RSVP_CTYPE_IPV4
:
750 if (obj_tlen
< sizeof(struct in_addr
))
752 printf("%s IPv4 Receiver Address: %s",
754 ipaddr_string(obj_tptr
));
755 obj_tlen
-=sizeof(struct in_addr
);
756 obj_tptr
+=sizeof(struct in_addr
);
759 case RSVP_CTYPE_IPV6
:
760 if (obj_tlen
< sizeof(struct in6_addr
))
762 printf("%s IPv6 Receiver Address: %s",
764 ip6addr_string(obj_tptr
));
765 obj_tlen
-=sizeof(struct in6_addr
);
766 obj_tptr
+=sizeof(struct in6_addr
);
774 case RSVP_OBJ_NOTIFY_REQ
:
775 switch(rsvp_obj_ctype
) {
776 case RSVP_CTYPE_IPV4
:
777 if (obj_tlen
< sizeof(struct in_addr
))
779 printf("%s IPv4 Notify Node Address: %s",
781 ipaddr_string(obj_tptr
));
782 obj_tlen
-=sizeof(struct in_addr
);
783 obj_tptr
+=sizeof(struct in_addr
);
786 case RSVP_CTYPE_IPV6
:
787 if (obj_tlen
< sizeof(struct in6_addr
))
789 printf("%s IPv6 Notify Node Address: %s",
791 ip6addr_string(obj_tptr
));
792 obj_tlen
-=sizeof(struct in6_addr
);
793 obj_tptr
+=sizeof(struct in6_addr
);
801 case RSVP_OBJ_SUGGESTED_LABEL
: /* fall through */
802 case RSVP_OBJ_UPSTREAM_LABEL
: /* fall through */
803 case RSVP_OBJ_RECOVERY_LABEL
: /* fall through */
805 switch(rsvp_obj_ctype
) {
807 while(obj_tlen
>= 4 ) {
808 printf("%s Label: %u", ident
, EXTRACT_32BITS(obj_tptr
));
816 printf("%s Generalized Label: %u",
818 EXTRACT_32BITS(obj_tptr
));
825 printf("%s Waveband ID: %u%s Start Label: %u, Stop Label: %u",
827 EXTRACT_32BITS(obj_tptr
),
829 EXTRACT_32BITS(obj_tptr
+4),
830 EXTRACT_32BITS(obj_tptr
+8));
840 switch(rsvp_obj_ctype
) {
844 printf("%s Reservation Style: %s, Flags: [0x%02x]",
846 tok2str(rsvp_resstyle_values
,
848 EXTRACT_24BITS(obj_tptr
+1)),
858 case RSVP_OBJ_SENDER_TEMPLATE
:
859 switch(rsvp_obj_ctype
) {
860 case RSVP_CTYPE_IPV4
:
863 printf("%s Source Address: %s, Source Port: %u",
865 ipaddr_string(obj_tptr
),
866 EXTRACT_16BITS(obj_tptr
+6));
871 case RSVP_CTYPE_IPV6
:
874 printf("%s Source Address: %s, Source Port: %u",
876 ip6addr_string(obj_tptr
),
877 EXTRACT_16BITS(obj_tptr
+18));
882 case RSVP_CTYPE_TUNNEL_IPV4
:
885 printf("%s IPv4 Tunnel Sender Address: %s, LSP-ID: 0x%04x",
887 ipaddr_string(obj_tptr
),
888 EXTRACT_16BITS(obj_tptr
+6));
897 case RSVP_OBJ_LABEL_REQ
:
898 switch(rsvp_obj_ctype
) {
900 while(obj_tlen
>= 4 ) {
901 printf("%s L3 Protocol ID: %s",
903 tok2str(ethertype_values
,
904 "Unknown Protocol (0x%04x)",
905 EXTRACT_16BITS(obj_tptr
+2)));
913 printf("%s L3 Protocol ID: %s",
915 tok2str(ethertype_values
,
916 "Unknown Protocol (0x%04x)",
917 EXTRACT_16BITS(obj_tptr
+2)));
918 printf(",%s merge capability",((*(obj_tptr
+4))&0x80) ? "no" : "" );
919 printf("%s Minimum VPI/VCI: %u/%u",
921 (EXTRACT_16BITS(obj_tptr
+4))&0xfff,
922 (EXTRACT_16BITS(obj_tptr
+6))&0xfff);
923 printf("%s Maximum VPI/VCI: %u/%u",
925 (EXTRACT_16BITS(obj_tptr
+8))&0xfff,
926 (EXTRACT_16BITS(obj_tptr
+10))&0xfff);
933 printf("%s L3 Protocol ID: %s",
935 tok2str(ethertype_values
,
936 "Unknown Protocol (0x%04x)",
937 EXTRACT_16BITS(obj_tptr
+2)));
938 printf("%s Minimum/Maximum DLCI: %u/%u, %s%s bit DLCI",
940 (EXTRACT_32BITS(obj_tptr
+4))&0x7fffff,
941 (EXTRACT_32BITS(obj_tptr
+8))&0x7fffff,
942 (((EXTRACT_16BITS(obj_tptr
+4)>>7)&3) == 0 ) ? "10" : "",
943 (((EXTRACT_16BITS(obj_tptr
+4)>>7)&3) == 2 ) ? "23" : "");
950 printf("%s LSP Encoding Type: %s (%u)",
952 tok2str(gmpls_encoding_values
,
956 printf("%s Switching Type: %s (%u), Payload ID: %s (0x%04x)",
958 tok2str(gmpls_switch_cap_values
,
962 tok2str(gmpls_payload_values
,
964 EXTRACT_16BITS(obj_tptr
+2)),
965 EXTRACT_16BITS(obj_tptr
+2));
976 switch(rsvp_obj_ctype
) {
977 case RSVP_CTYPE_IPV4
:
978 while(obj_tlen
>= 4 ) {
979 printf("%s Subobject Type: %s, length %u",
981 tok2str(rsvp_obj_xro_values
,
983 RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr
)),
986 if (*(obj_tptr
+1) == 0) { /* prevent infinite loops */
987 printf("%s ERROR: zero length ERO subtype",ident
);
991 switch(RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr
)) {
992 case RSVP_OBJ_XRO_IPV4
:
993 printf(", %s, %s/%u, Flags: [%s]",
994 RSVP_OBJ_XRO_MASK_LOOSE(*obj_tptr
) ? "Loose" : "Strict",
995 ipaddr_string(obj_tptr
+2),
997 bittok2str(rsvp_obj_rro_flag_values
,
999 *(obj_tptr
+7))); /* rfc3209 says that this field is rsvd. */
1001 obj_tlen
-=*(obj_tptr
+1);
1002 obj_tptr
+=*(obj_tptr
+1);
1010 case RSVP_OBJ_HELLO
:
1011 switch(rsvp_obj_ctype
) {
1016 printf("%s Source Instance: 0x%08x, Destination Instance: 0x%08x",
1018 EXTRACT_32BITS(obj_tptr
),
1019 EXTRACT_32BITS(obj_tptr
+4));
1028 case RSVP_OBJ_RESTART_CAPABILITY
:
1029 switch(rsvp_obj_ctype
) {
1033 printf("%s Restart Time: %ums, Recovery Time: %ums",
1035 EXTRACT_32BITS(obj_tptr
),
1036 EXTRACT_32BITS(obj_tptr
+4));
1045 case RSVP_OBJ_SESSION_ATTRIBUTE
:
1046 switch(rsvp_obj_ctype
) {
1047 case RSVP_CTYPE_TUNNEL_IPV4
:
1050 namelen
= *(obj_tptr
+3);
1051 if (obj_tlen
< 4+namelen
)
1053 printf("%s Session Name: ", ident
);
1054 for (i
= 0; i
< namelen
; i
++)
1055 safeputchar(*(obj_tptr
+4+i
));
1056 printf("%s Setup Priority: %u, Holding Priority: %u, Flags: [%s]",
1060 tok2str(rsvp_session_attribute_flag_values
,
1064 obj_tlen
-=4+*(obj_tptr
+3);
1065 obj_tptr
+=4+*(obj_tptr
+3);
1072 case RSVP_OBJ_GENERALIZED_UNI
:
1073 switch(rsvp_obj_ctype
) {
1074 int subobj_type
,af
,subobj_len
,total_subobj_len
;
1081 /* read variable length subobjects */
1082 total_subobj_len
= obj_tlen
;
1083 while(total_subobj_len
> 0) {
1084 subobj_len
= EXTRACT_16BITS(obj_tptr
);
1085 subobj_type
= (EXTRACT_16BITS(obj_tptr
+2))>>8;
1086 af
= (EXTRACT_16BITS(obj_tptr
+2))&0x00FF;
1088 printf("%s Subobject Type: %s (%u), AF: %s (%u), length: %u",
1090 tok2str(rsvp_obj_generalized_uni_values
, "Unknown", subobj_type
),
1092 tok2str(af_values
, "Unknown", af
), af
,
1095 switch(subobj_type
) {
1096 case RSVP_GEN_UNI_SUBOBJ_SOURCE_TNA_ADDRESS
:
1097 case RSVP_GEN_UNI_SUBOBJ_DESTINATION_TNA_ADDRESS
:
1103 printf("%s UNI IPv4 TNA address: %s",
1104 ident
, ipaddr_string(obj_tptr
+4));
1108 if (subobj_len
< 20)
1110 printf("%s UNI IPv6 TNA address: %s",
1111 ident
, ip6addr_string(obj_tptr
+4));
1116 /* unless we have a TLV parser lets just hexdump */
1123 case RSVP_GEN_UNI_SUBOBJ_DIVERSITY
:
1125 /* unless we have a TLV parser lets just hexdump */
1130 case RSVP_GEN_UNI_SUBOBJ_EGRESS_LABEL
:
1131 if (subobj_len
< 16) {
1135 printf("%s U-bit: %x, Label type: %u, Logical port id: %u, Label: %u",
1137 ((EXTRACT_32BITS(obj_tptr
+4))>>31),
1138 ((EXTRACT_32BITS(obj_tptr
+4))&0xFF),
1139 EXTRACT_32BITS(obj_tptr
+8),
1140 EXTRACT_32BITS(obj_tptr
+12));
1143 case RSVP_GEN_UNI_SUBOBJ_SERVICE_LEVEL
:
1144 if (subobj_len
< 8) {
1148 printf("%s Service level: %u",
1149 ident
, (EXTRACT_32BITS(obj_tptr
+4))>>24);
1156 total_subobj_len
-=subobj_len
;
1157 obj_tptr
+=subobj_len
;
1158 obj_tlen
+=subobj_len
;
1161 if (total_subobj_len
) {
1162 /* unless we have a TLV parser lets just hexdump */
1172 case RSVP_OBJ_RSVP_HOP
:
1173 switch(rsvp_obj_ctype
) {
1174 case RSVP_CTYPE_3
: /* fall through - FIXME add TLV parser */
1175 case RSVP_CTYPE_IPV4
:
1178 printf("%s Previous/Next Interface: %s, Logical Interface Handle: 0x%08x",
1180 ipaddr_string(obj_tptr
),
1181 EXTRACT_32BITS(obj_tptr
+4));
1185 hexdump
=TRUE
; /* unless we have a TLV parser lets just hexdump */
1188 case RSVP_CTYPE_4
: /* fall through - FIXME add TLV parser */
1189 case RSVP_CTYPE_IPV6
:
1192 printf("%s Previous/Next Interface: %s, Logical Interface Handle: 0x%08x",
1194 ip6addr_string(obj_tptr
),
1195 EXTRACT_32BITS(obj_tptr
+16));
1198 hexdump
=TRUE
; /* unless we have a TLV parser lets just hexdump */
1206 case RSVP_OBJ_TIME_VALUES
:
1207 switch(rsvp_obj_ctype
) {
1211 printf("%s Refresh Period: %ums",
1213 EXTRACT_32BITS(obj_tptr
));
1222 /* those three objects do share the same semantics */
1223 case RSVP_OBJ_SENDER_TSPEC
:
1224 case RSVP_OBJ_ADSPEC
:
1225 case RSVP_OBJ_FLOWSPEC
:
1226 switch(rsvp_obj_ctype
) {
1230 printf("%s Msg-Version: %u, length: %u",
1232 (*obj_tptr
& 0xf0) >> 4,
1233 EXTRACT_16BITS(obj_tptr
+2)<<2);
1234 obj_tptr
+=4; /* get to the start of the service header */
1237 while (obj_tlen
>= 4) {
1238 intserv_serv_tlen
=EXTRACT_16BITS(obj_tptr
+2)<<2;
1239 printf("%s Service Type: %s (%u), break bit %s set, Service length: %u",
1241 tok2str(rsvp_intserv_service_type_values
,"unknown",*(obj_tptr
)),
1243 (*(obj_tptr
+1)&0x80) ? "" : "not",
1246 obj_tptr
+=4; /* get to the start of the parameter list */
1249 while (intserv_serv_tlen
>=4) {
1250 processed
= rsvp_intserv_print(obj_tptr
, obj_tlen
);
1253 obj_tlen
-=processed
;
1254 intserv_serv_tlen
-=processed
;
1255 obj_tptr
+=processed
;
1264 case RSVP_OBJ_FILTERSPEC
:
1265 switch(rsvp_obj_ctype
) {
1266 case RSVP_CTYPE_IPV4
:
1269 printf("%s Source Address: %s, Source Port: %u",
1271 ipaddr_string(obj_tptr
),
1272 EXTRACT_16BITS(obj_tptr
+6));
1277 case RSVP_CTYPE_IPV6
:
1280 printf("%s Source Address: %s, Source Port: %u",
1282 ip6addr_string(obj_tptr
),
1283 EXTRACT_16BITS(obj_tptr
+18));
1290 printf("%s Source Address: %s, Flow Label: %u",
1292 ip6addr_string(obj_tptr
),
1293 EXTRACT_24BITS(obj_tptr
+17));
1297 case RSVP_CTYPE_TUNNEL_IPV6
:
1300 printf("%s Source Address: %s, LSP-ID: 0x%04x",
1302 ipaddr_string(obj_tptr
),
1303 EXTRACT_16BITS(obj_tptr
+18));
1308 case RSVP_CTYPE_TUNNEL_IPV4
:
1311 printf("%s Source Address: %s, LSP-ID: 0x%04x",
1313 ipaddr_string(obj_tptr
),
1314 EXTRACT_16BITS(obj_tptr
+6));
1323 case RSVP_OBJ_FASTREROUTE
:
1324 /* the differences between c-type 1 and 7 are minor */
1325 obj_ptr
.rsvp_obj_frr
= (const struct rsvp_obj_frr_t
*)obj_tptr
;
1326 bw
.i
= EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->bandwidth
);
1328 switch(rsvp_obj_ctype
) {
1329 case RSVP_CTYPE_1
: /* new style */
1330 if (obj_tlen
< sizeof(struct rsvp_obj_frr_t
))
1332 printf("%s Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps",
1334 (int)obj_ptr
.rsvp_obj_frr
->setup_prio
,
1335 (int)obj_ptr
.rsvp_obj_frr
->hold_prio
,
1336 (int)obj_ptr
.rsvp_obj_frr
->hop_limit
,
1338 printf("%s Include-any: 0x%08x, Exclude-any: 0x%08x, Include-all: 0x%08x",
1340 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->include_any
),
1341 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->exclude_any
),
1342 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->include_all
));
1343 obj_tlen
-=sizeof(struct rsvp_obj_frr_t
);
1344 obj_tptr
+=sizeof(struct rsvp_obj_frr_t
);
1347 case RSVP_CTYPE_TUNNEL_IPV4
: /* old style */
1350 printf("%s Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps",
1352 (int)obj_ptr
.rsvp_obj_frr
->setup_prio
,
1353 (int)obj_ptr
.rsvp_obj_frr
->hold_prio
,
1354 (int)obj_ptr
.rsvp_obj_frr
->hop_limit
,
1356 printf("%s Include Colors: 0x%08x, Exclude Colors: 0x%08x",
1358 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->include_any
),
1359 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->exclude_any
));
1369 case RSVP_OBJ_DETOUR
:
1370 switch(rsvp_obj_ctype
) {
1371 case RSVP_CTYPE_TUNNEL_IPV4
:
1372 while(obj_tlen
>= 8) {
1373 printf("%s PLR-ID: %s, Avoid-Node-ID: %s",
1375 ipaddr_string(obj_tptr
),
1376 ipaddr_string(obj_tptr
+4));
1386 case RSVP_OBJ_CLASSTYPE
:
1387 case RSVP_OBJ_CLASSTYPE_OLD
: /* fall through */
1388 switch(rsvp_obj_ctype
) {
1392 EXTRACT_32BITS(obj_tptr
)&0x7);
1401 case RSVP_OBJ_ERROR_SPEC
:
1402 switch(rsvp_obj_ctype
) {
1403 case RSVP_CTYPE_3
: /* fall through - FIXME add TLV parser */
1404 case RSVP_CTYPE_IPV4
:
1407 error_code
=*(obj_tptr
+5);
1408 error_value
=EXTRACT_16BITS(obj_tptr
+6);
1409 printf("%s Error Node Address: %s, Flags: [0x%02x]%s Error Code: %s (%u)",
1411 ipaddr_string(obj_tptr
),
1414 tok2str(rsvp_obj_error_code_values
,"unknown",error_code
),
1416 switch (error_code
) {
1417 case RSVP_OBJ_ERROR_SPEC_CODE_ROUTING
:
1418 printf(", Error Value: %s (%u)",
1419 tok2str(rsvp_obj_error_code_routing_values
,"unknown",error_value
),
1422 case RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE
: /* fall through */
1423 case RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE_OLD
:
1424 printf(", Error Value: %s (%u)",
1425 tok2str(rsvp_obj_error_code_diffserv_te_values
,"unknown",error_value
),
1429 printf(", Unknown Error Value (%u)", error_value
);
1436 case RSVP_CTYPE_4
: /* fall through - FIXME add TLV parser */
1437 case RSVP_CTYPE_IPV6
:
1440 error_code
=*(obj_tptr
+17);
1441 error_value
=EXTRACT_16BITS(obj_tptr
+18);
1442 printf("%s Error Node Address: %s, Flags: [0x%02x]%s Error Code: %s (%u)",
1444 ip6addr_string(obj_tptr
),
1447 tok2str(rsvp_obj_error_code_values
,"unknown",error_code
),
1450 switch (error_code
) {
1451 case RSVP_OBJ_ERROR_SPEC_CODE_ROUTING
:
1452 printf(", Error Value: %s (%u)",
1453 tok2str(rsvp_obj_error_code_routing_values
,"unknown",error_value
),
1468 case RSVP_OBJ_PROPERTIES
:
1469 switch(rsvp_obj_ctype
) {
1473 padbytes
= EXTRACT_16BITS(obj_tptr
+2);
1474 printf("%s TLV count: %u, padding bytes: %u",
1476 EXTRACT_16BITS(obj_tptr
),
1480 /* loop through as long there is anything longer than the TLV header (2) */
1481 while(obj_tlen
>= 2 + padbytes
) {
1482 printf("%s %s TLV (0x%02x), length: %u", /* length includes header */
1484 tok2str(rsvp_obj_prop_tlv_values
,"unknown",*obj_tptr
),
1487 if (obj_tlen
< *(obj_tptr
+1))
1489 if (*(obj_tptr
+1) < 2)
1491 print_unknown_data(obj_tptr
+2,"\n\t\t",*(obj_tptr
+1)-2);
1492 obj_tlen
-=*(obj_tptr
+1);
1493 obj_tptr
+=*(obj_tptr
+1);
1501 case RSVP_OBJ_MESSAGE_ID
: /* fall through */
1502 case RSVP_OBJ_MESSAGE_ID_ACK
: /* fall through */
1503 case RSVP_OBJ_MESSAGE_ID_LIST
:
1504 switch(rsvp_obj_ctype
) {
1509 printf("%s Flags [0x%02x], epoch: %u",
1512 EXTRACT_24BITS(obj_tptr
+1));
1515 /* loop through as long there are no messages left */
1516 while(obj_tlen
>= 4) {
1517 printf("%s Message-ID 0x%08x (%u)",
1519 EXTRACT_32BITS(obj_tptr
),
1520 EXTRACT_32BITS(obj_tptr
));
1530 case RSVP_OBJ_INTEGRITY
:
1531 switch(rsvp_obj_ctype
) {
1533 if (obj_tlen
< sizeof(struct rsvp_obj_integrity_t
))
1535 obj_ptr
.rsvp_obj_integrity
= (const struct rsvp_obj_integrity_t
*)obj_tptr
;
1536 printf("%s Key-ID 0x%04x%08x, Sequence 0x%08x%08x, Flags [%s]",
1538 EXTRACT_16BITS(obj_ptr
.rsvp_obj_integrity
->key_id
),
1539 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->key_id
+2),
1540 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->sequence
),
1541 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->sequence
+4),
1542 bittok2str(rsvp_obj_integrity_flag_values
,
1544 obj_ptr
.rsvp_obj_integrity
->flags
));
1545 printf("%s MD5-sum 0x%08x%08x%08x%08x (unverified)",
1547 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->digest
),
1548 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->digest
+4),
1549 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->digest
+8),
1550 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->digest
+12));
1551 obj_tlen
+=sizeof(struct rsvp_obj_integrity_t
);
1552 obj_tptr
+=sizeof(struct rsvp_obj_integrity_t
);
1559 case RSVP_OBJ_ADMIN_STATUS
:
1560 switch(rsvp_obj_ctype
) {
1564 printf("%s Flags [%s]", ident
,
1565 bittok2str(rsvp_obj_admin_status_flag_values
, "none",
1566 EXTRACT_32BITS(obj_tptr
)));
1575 case RSVP_OBJ_LABEL_SET
:
1576 switch(rsvp_obj_ctype
) {
1581 u_int action
, subchannel
;
1582 action
= (EXTRACT_16BITS(obj_tptr
)>>8);
1584 printf("%s Action: %s (%u), Label type: %u", ident
,
1585 tok2str(rsvp_obj_label_set_action_values
, "Unknown", action
),
1586 action
, ((EXTRACT_32BITS(obj_tptr
) & 0x7F)));
1589 case LABEL_SET_INCLUSIVE_RANGE
:
1590 case LABEL_SET_EXCLUSIVE_RANGE
: /* fall through */
1592 /* only a couple of subchannels are expected */
1595 printf("%s Start range: %u, End range: %u", ident
,
1596 EXTRACT_32BITS(obj_tptr
+4),
1597 EXTRACT_32BITS(obj_tptr
+8));
1606 while(obj_tlen
>= 4 ) {
1607 printf("%s Subchannel #%u: %u", ident
, subchannel
,
1608 EXTRACT_32BITS(obj_tptr
));
1622 * FIXME those are the defined objects that lack a decoder
1623 * you are welcome to contribute code ;-)
1626 case RSVP_OBJ_SCOPE
:
1627 case RSVP_OBJ_POLICY_DATA
:
1628 case RSVP_OBJ_ACCEPT_LABEL_SET
:
1629 case RSVP_OBJ_PROTECTION
:
1632 print_unknown_data(obj_tptr
,"\n\t ",obj_tlen
); /* FIXME indentation */
1635 /* do we also want to see a hex dump ? */
1636 if (vflag
> 1 || hexdump
==TRUE
)
1637 print_unknown_data(tptr
+sizeof(sizeof(struct rsvp_object_header
)),"\n\t ", /* FIXME indentation */
1638 rsvp_obj_len
-sizeof(struct rsvp_object_header
));
1645 printf("\n\t\t packet exceeded snapshot");
1651 rsvp_print(register const u_char
*pptr
, register u_int len
) {
1653 const struct rsvp_common_header
*rsvp_com_header
;
1654 const u_char
*tptr
,*subtptr
;
1655 u_short tlen
,subtlen
;
1659 rsvp_com_header
= (const struct rsvp_common_header
*)pptr
;
1660 TCHECK(*rsvp_com_header
);
1663 * Sanity checking of the header.
1665 if (RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
) != RSVP_VERSION
) {
1666 printf("ERROR: RSVP version %u packet not supported",
1667 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
));
1671 /* in non-verbose mode just lets print the basic Message Type*/
1673 printf("RSVPv%u %s Message, length: %u",
1674 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
),
1675 tok2str(rsvp_msg_type_values
, "unknown (%u)",rsvp_com_header
->msg_type
),
1680 /* ok they seem to want to know everything - lets fully decode it */
1682 tlen
=EXTRACT_16BITS(rsvp_com_header
->length
);
1684 printf("\n\tRSVPv%u %s Message (%u), Flags: [%s], length: %u, ttl: %u, checksum: 0x%04x",
1685 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
),
1686 tok2str(rsvp_msg_type_values
, "unknown, type: %u",rsvp_com_header
->msg_type
),
1687 rsvp_com_header
->msg_type
,
1688 bittok2str(rsvp_header_flag_values
,"none",RSVP_EXTRACT_FLAGS(rsvp_com_header
->version_flags
)),
1690 rsvp_com_header
->ttl
,
1691 EXTRACT_16BITS(rsvp_com_header
->checksum
));
1693 if (tlen
< sizeof(const struct rsvp_common_header
)) {
1694 printf("ERROR: common header too short %u < %lu", tlen
,
1695 (unsigned long)sizeof(const struct rsvp_common_header
));
1699 tptr
+=sizeof(const struct rsvp_common_header
);
1700 tlen
-=sizeof(const struct rsvp_common_header
);
1702 switch(rsvp_com_header
->msg_type
) {
1704 case RSVP_MSGTYPE_AGGREGATE
:
1707 rsvp_com_header
= (const struct rsvp_common_header
*)subtptr
;
1708 TCHECK(*rsvp_com_header
);
1711 * Sanity checking of the header.
1713 if (RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
) != RSVP_VERSION
) {
1714 printf("ERROR: RSVP version %u packet not supported",
1715 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
));
1718 subtlen
=EXTRACT_16BITS(rsvp_com_header
->length
);
1720 printf("\n\t RSVPv%u %s Message (%u), Flags: [%s], length: %u, ttl: %u, checksum: 0x%04x",
1721 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
),
1722 tok2str(rsvp_msg_type_values
, "unknown, type: %u",rsvp_com_header
->msg_type
),
1723 rsvp_com_header
->msg_type
,
1724 bittok2str(rsvp_header_flag_values
,"none",RSVP_EXTRACT_FLAGS(rsvp_com_header
->version_flags
)),
1726 rsvp_com_header
->ttl
,
1727 EXTRACT_16BITS(rsvp_com_header
->checksum
));
1729 if (subtlen
< sizeof(const struct rsvp_common_header
)) {
1730 printf("ERROR: common header too short %u < %lu", subtlen
,
1731 (unsigned long)sizeof(const struct rsvp_common_header
));
1735 if (tlen
< subtlen
) {
1736 printf("ERROR: common header too large %u > %u", subtlen
,
1741 subtptr
+=sizeof(const struct rsvp_common_header
);
1742 subtlen
-=sizeof(const struct rsvp_common_header
);
1744 if (rsvp_obj_print(subtptr
,"\n\t ", subtlen
) == -1)
1747 tptr
+=subtlen
+sizeof(const struct rsvp_common_header
);
1748 tlen
-=subtlen
+sizeof(const struct rsvp_common_header
);
1753 case RSVP_MSGTYPE_PATH
:
1754 case RSVP_MSGTYPE_RESV
:
1755 case RSVP_MSGTYPE_PATHERR
:
1756 case RSVP_MSGTYPE_RESVERR
:
1757 case RSVP_MSGTYPE_PATHTEAR
:
1758 case RSVP_MSGTYPE_RESVTEAR
:
1759 case RSVP_MSGTYPE_RESVCONF
:
1760 case RSVP_MSGTYPE_HELLO_OLD
:
1761 case RSVP_MSGTYPE_HELLO
:
1762 case RSVP_MSGTYPE_ACK
:
1763 case RSVP_MSGTYPE_SREFRESH
:
1764 if (rsvp_obj_print(tptr
,"\n\t ", tlen
) == -1)
1769 print_unknown_data(tptr
,"\n\t ",tlen
);
1775 printf("\n\t\t packet exceeded snapshot");