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.48 2007-09-13 17:29:50 guy 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 u_int action
, subchannel
;
636 while(tlen
>=sizeof(struct rsvp_object_header
)) {
637 /* did we capture enough for fully decoding the object header ? */
638 if (!TTEST2(*tptr
, sizeof(struct rsvp_object_header
)))
641 rsvp_obj_header
= (const struct rsvp_object_header
*)tptr
;
642 rsvp_obj_len
=EXTRACT_16BITS(rsvp_obj_header
->length
);
643 rsvp_obj_ctype
=rsvp_obj_header
->ctype
;
645 if(rsvp_obj_len
% 4) {
646 printf("%sERROR: object header size %u not a multiple of 4", ident
, rsvp_obj_len
);
649 if(rsvp_obj_len
< sizeof(struct rsvp_object_header
)) {
650 printf("%sERROR: object header too short %u < %lu", ident
, rsvp_obj_len
,
651 (unsigned long)sizeof(const struct rsvp_object_header
));
655 printf("%s%s Object (%u) Flags: [%s",
657 tok2str(rsvp_obj_values
,
659 rsvp_obj_header
->class_num
),
660 rsvp_obj_header
->class_num
,
661 ((rsvp_obj_header
->class_num
)&0x80) ? "ignore" : "reject");
663 if (rsvp_obj_header
->class_num
> 128)
665 ((rsvp_obj_header
->class_num
)&0x40) ? "and forward" : "silently");
667 printf(" if unknown], Class-Type: %s (%u), length: %u",
668 tok2str(rsvp_ctype_values
,
670 ((rsvp_obj_header
->class_num
)<<8)+rsvp_obj_ctype
),
674 if(tlen
< rsvp_obj_len
) {
675 printf("%sERROR: object goes past end of objects TLV", ident
);
679 obj_tptr
=tptr
+sizeof(struct rsvp_object_header
);
680 obj_tlen
=rsvp_obj_len
-sizeof(struct rsvp_object_header
);
682 /* did we capture enough for fully decoding the object ? */
683 if (!TTEST2(*tptr
, rsvp_obj_len
))
687 switch(rsvp_obj_header
->class_num
) {
688 case RSVP_OBJ_SESSION
:
689 switch(rsvp_obj_ctype
) {
690 case RSVP_CTYPE_IPV4
:
693 printf("%s IPv4 DestAddress: %s, Protocol ID: 0x%02x",
695 ipaddr_string(obj_tptr
),
696 *(obj_tptr
+sizeof(struct in_addr
)));
697 printf("%s Flags: [0x%02x], DestPort %u",
700 EXTRACT_16BITS(obj_tptr
+6));
705 case RSVP_CTYPE_IPV6
:
708 printf("%s IPv6 DestAddress: %s, Protocol ID: 0x%02x",
710 ip6addr_string(obj_tptr
),
711 *(obj_tptr
+sizeof(struct in6_addr
)));
712 printf("%s Flags: [0x%02x], DestPort %u",
714 *(obj_tptr
+sizeof(struct in6_addr
)+1),
715 EXTRACT_16BITS(obj_tptr
+sizeof(struct in6_addr
)+2));
720 case RSVP_CTYPE_TUNNEL_IPV6
:
723 printf("%s IPv6 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
725 ip6addr_string(obj_tptr
),
726 EXTRACT_16BITS(obj_tptr
+18),
727 ip6addr_string(obj_tptr
+20));
732 case RSVP_CTYPE_TUNNEL_IPV4
:
733 case RSVP_CTYPE_UNI_IPV4
:
736 printf("%s IPv4 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
738 ipaddr_string(obj_tptr
),
739 EXTRACT_16BITS(obj_tptr
+6),
740 ipaddr_string(obj_tptr
+8));
749 case RSVP_OBJ_CONFIRM
:
750 switch(rsvp_obj_ctype
) {
751 case RSVP_CTYPE_IPV4
:
752 if (obj_tlen
< sizeof(struct in_addr
))
754 printf("%s IPv4 Receiver Address: %s",
756 ipaddr_string(obj_tptr
));
757 obj_tlen
-=sizeof(struct in_addr
);
758 obj_tptr
+=sizeof(struct in_addr
);
761 case RSVP_CTYPE_IPV6
:
762 if (obj_tlen
< sizeof(struct in6_addr
))
764 printf("%s IPv6 Receiver Address: %s",
766 ip6addr_string(obj_tptr
));
767 obj_tlen
-=sizeof(struct in6_addr
);
768 obj_tptr
+=sizeof(struct in6_addr
);
776 case RSVP_OBJ_NOTIFY_REQ
:
777 switch(rsvp_obj_ctype
) {
778 case RSVP_CTYPE_IPV4
:
779 if (obj_tlen
< sizeof(struct in_addr
))
781 printf("%s IPv4 Notify Node Address: %s",
783 ipaddr_string(obj_tptr
));
784 obj_tlen
-=sizeof(struct in_addr
);
785 obj_tptr
+=sizeof(struct in_addr
);
788 case RSVP_CTYPE_IPV6
:
789 if (obj_tlen
< sizeof(struct in6_addr
))
791 printf("%s IPv6 Notify Node Address: %s",
793 ip6addr_string(obj_tptr
));
794 obj_tlen
-=sizeof(struct in6_addr
);
795 obj_tptr
+=sizeof(struct in6_addr
);
803 case RSVP_OBJ_SUGGESTED_LABEL
: /* fall through */
804 case RSVP_OBJ_UPSTREAM_LABEL
: /* fall through */
805 case RSVP_OBJ_RECOVERY_LABEL
: /* fall through */
807 switch(rsvp_obj_ctype
) {
809 while(obj_tlen
>= 4 ) {
810 printf("%s Label: %u", ident
, EXTRACT_32BITS(obj_tptr
));
818 printf("%s Generalized Label: %u",
820 EXTRACT_32BITS(obj_tptr
));
827 printf("%s Waveband ID: %u%s Start Label: %u, Stop Label: %u",
829 EXTRACT_32BITS(obj_tptr
),
831 EXTRACT_32BITS(obj_tptr
+4),
832 EXTRACT_32BITS(obj_tptr
+8));
842 switch(rsvp_obj_ctype
) {
846 printf("%s Reservation Style: %s, Flags: [0x%02x]",
848 tok2str(rsvp_resstyle_values
,
850 EXTRACT_24BITS(obj_tptr
+1)),
860 case RSVP_OBJ_SENDER_TEMPLATE
:
861 switch(rsvp_obj_ctype
) {
862 case RSVP_CTYPE_IPV4
:
865 printf("%s Source Address: %s, Source Port: %u",
867 ipaddr_string(obj_tptr
),
868 EXTRACT_16BITS(obj_tptr
+6));
873 case RSVP_CTYPE_IPV6
:
876 printf("%s Source Address: %s, Source Port: %u",
878 ip6addr_string(obj_tptr
),
879 EXTRACT_16BITS(obj_tptr
+18));
884 case RSVP_CTYPE_TUNNEL_IPV4
:
887 printf("%s IPv4 Tunnel Sender Address: %s, LSP-ID: 0x%04x",
889 ipaddr_string(obj_tptr
),
890 EXTRACT_16BITS(obj_tptr
+6));
899 case RSVP_OBJ_LABEL_REQ
:
900 switch(rsvp_obj_ctype
) {
902 while(obj_tlen
>= 4 ) {
903 printf("%s L3 Protocol ID: %s",
905 tok2str(ethertype_values
,
906 "Unknown Protocol (0x%04x)",
907 EXTRACT_16BITS(obj_tptr
+2)));
915 printf("%s L3 Protocol ID: %s",
917 tok2str(ethertype_values
,
918 "Unknown Protocol (0x%04x)",
919 EXTRACT_16BITS(obj_tptr
+2)));
920 printf(",%s merge capability",((*(obj_tptr
+4))&0x80) ? "no" : "" );
921 printf("%s Minimum VPI/VCI: %u/%u",
923 (EXTRACT_16BITS(obj_tptr
+4))&0xfff,
924 (EXTRACT_16BITS(obj_tptr
+6))&0xfff);
925 printf("%s Maximum VPI/VCI: %u/%u",
927 (EXTRACT_16BITS(obj_tptr
+8))&0xfff,
928 (EXTRACT_16BITS(obj_tptr
+10))&0xfff);
935 printf("%s L3 Protocol ID: %s",
937 tok2str(ethertype_values
,
938 "Unknown Protocol (0x%04x)",
939 EXTRACT_16BITS(obj_tptr
+2)));
940 printf("%s Minimum/Maximum DLCI: %u/%u, %s%s bit DLCI",
942 (EXTRACT_32BITS(obj_tptr
+4))&0x7fffff,
943 (EXTRACT_32BITS(obj_tptr
+8))&0x7fffff,
944 (((EXTRACT_16BITS(obj_tptr
+4)>>7)&3) == 0 ) ? "10" : "",
945 (((EXTRACT_16BITS(obj_tptr
+4)>>7)&3) == 2 ) ? "23" : "");
952 printf("%s LSP Encoding Type: %s (%u)",
954 tok2str(gmpls_encoding_values
,
958 printf("%s Switching Type: %s (%u), Payload ID: %s (0x%04x)",
960 tok2str(gmpls_switch_cap_values
,
964 tok2str(gmpls_payload_values
,
966 EXTRACT_16BITS(obj_tptr
+2)),
967 EXTRACT_16BITS(obj_tptr
+2));
978 switch(rsvp_obj_ctype
) {
979 case RSVP_CTYPE_IPV4
:
980 while(obj_tlen
>= 4 ) {
981 printf("%s Subobject Type: %s, length %u",
983 tok2str(rsvp_obj_xro_values
,
985 RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr
)),
988 if (*(obj_tptr
+1) == 0) { /* prevent infinite loops */
989 printf("%s ERROR: zero length ERO subtype",ident
);
993 switch(RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr
)) {
994 case RSVP_OBJ_XRO_IPV4
:
995 printf(", %s, %s/%u, Flags: [%s]",
996 RSVP_OBJ_XRO_MASK_LOOSE(*obj_tptr
) ? "Loose" : "Strict",
997 ipaddr_string(obj_tptr
+2),
999 bittok2str(rsvp_obj_rro_flag_values
,
1001 *(obj_tptr
+7))); /* rfc3209 says that this field is rsvd. */
1003 obj_tlen
-=*(obj_tptr
+1);
1004 obj_tptr
+=*(obj_tptr
+1);
1012 case RSVP_OBJ_HELLO
:
1013 switch(rsvp_obj_ctype
) {
1018 printf("%s Source Instance: 0x%08x, Destination Instance: 0x%08x",
1020 EXTRACT_32BITS(obj_tptr
),
1021 EXTRACT_32BITS(obj_tptr
+4));
1030 case RSVP_OBJ_RESTART_CAPABILITY
:
1031 switch(rsvp_obj_ctype
) {
1035 printf("%s Restart Time: %ums, Recovery Time: %ums",
1037 EXTRACT_32BITS(obj_tptr
),
1038 EXTRACT_32BITS(obj_tptr
+4));
1047 case RSVP_OBJ_SESSION_ATTRIBUTE
:
1048 switch(rsvp_obj_ctype
) {
1049 case RSVP_CTYPE_TUNNEL_IPV4
:
1052 namelen
= *(obj_tptr
+3);
1053 if (obj_tlen
< 4+namelen
)
1055 printf("%s Session Name: ", ident
);
1056 for (i
= 0; i
< namelen
; i
++)
1057 safeputchar(*(obj_tptr
+4+i
));
1058 printf("%s Setup Priority: %u, Holding Priority: %u, Flags: [%s]",
1062 tok2str(rsvp_session_attribute_flag_values
,
1066 obj_tlen
-=4+*(obj_tptr
+3);
1067 obj_tptr
+=4+*(obj_tptr
+3);
1074 case RSVP_OBJ_GENERALIZED_UNI
:
1075 switch(rsvp_obj_ctype
) {
1076 int subobj_type
,af
,subobj_len
,total_subobj_len
;
1083 /* read variable length subobjects */
1084 total_subobj_len
= obj_tlen
;
1085 while(total_subobj_len
> 0) {
1086 subobj_len
= EXTRACT_16BITS(obj_tptr
);
1087 subobj_type
= (EXTRACT_16BITS(obj_tptr
+2))>>8;
1088 af
= (EXTRACT_16BITS(obj_tptr
+2))&0x00FF;
1090 printf("%s Subobject Type: %s (%u), AF: %s (%u), length: %u",
1092 tok2str(rsvp_obj_generalized_uni_values
, "Unknown", subobj_type
),
1094 tok2str(af_values
, "Unknown", af
), af
,
1097 switch(subobj_type
) {
1098 case RSVP_GEN_UNI_SUBOBJ_SOURCE_TNA_ADDRESS
:
1099 case RSVP_GEN_UNI_SUBOBJ_DESTINATION_TNA_ADDRESS
:
1105 printf("%s UNI IPv4 TNA address: %s",
1106 ident
, ipaddr_string(obj_tptr
+4));
1110 if (subobj_len
< 20)
1112 printf("%s UNI IPv6 TNA address: %s",
1113 ident
, ip6addr_string(obj_tptr
+4));
1118 /* unless we have a TLV parser lets just hexdump */
1125 case RSVP_GEN_UNI_SUBOBJ_DIVERSITY
:
1127 /* unless we have a TLV parser lets just hexdump */
1132 case RSVP_GEN_UNI_SUBOBJ_EGRESS_LABEL
:
1133 if (subobj_len
< 16) {
1137 printf("%s U-bit: %x, Label type: %u, Logical port id: %u, Label: %u",
1139 ((EXTRACT_32BITS(obj_tptr
+4))>>31),
1140 ((EXTRACT_32BITS(obj_tptr
+4))&0xFF),
1141 EXTRACT_32BITS(obj_tptr
+8),
1142 EXTRACT_32BITS(obj_tptr
+12));
1145 case RSVP_GEN_UNI_SUBOBJ_SERVICE_LEVEL
:
1146 if (subobj_len
< 8) {
1150 printf("%s Service level: %u",
1151 ident
, (EXTRACT_32BITS(obj_tptr
+4))>>24);
1158 total_subobj_len
-=subobj_len
;
1159 obj_tptr
+=subobj_len
;
1160 obj_tlen
+=subobj_len
;
1163 if (total_subobj_len
) {
1164 /* unless we have a TLV parser lets just hexdump */
1174 case RSVP_OBJ_RSVP_HOP
:
1175 switch(rsvp_obj_ctype
) {
1176 case RSVP_CTYPE_3
: /* fall through - FIXME add TLV parser */
1177 case RSVP_CTYPE_IPV4
:
1180 printf("%s Previous/Next Interface: %s, Logical Interface Handle: 0x%08x",
1182 ipaddr_string(obj_tptr
),
1183 EXTRACT_32BITS(obj_tptr
+4));
1187 hexdump
=TRUE
; /* unless we have a TLV parser lets just hexdump */
1190 case RSVP_CTYPE_4
: /* fall through - FIXME add TLV parser */
1191 case RSVP_CTYPE_IPV6
:
1194 printf("%s Previous/Next Interface: %s, Logical Interface Handle: 0x%08x",
1196 ip6addr_string(obj_tptr
),
1197 EXTRACT_32BITS(obj_tptr
+16));
1200 hexdump
=TRUE
; /* unless we have a TLV parser lets just hexdump */
1208 case RSVP_OBJ_TIME_VALUES
:
1209 switch(rsvp_obj_ctype
) {
1213 printf("%s Refresh Period: %ums",
1215 EXTRACT_32BITS(obj_tptr
));
1224 /* those three objects do share the same semantics */
1225 case RSVP_OBJ_SENDER_TSPEC
:
1226 case RSVP_OBJ_ADSPEC
:
1227 case RSVP_OBJ_FLOWSPEC
:
1228 switch(rsvp_obj_ctype
) {
1232 printf("%s Msg-Version: %u, length: %u",
1234 (*obj_tptr
& 0xf0) >> 4,
1235 EXTRACT_16BITS(obj_tptr
+2)<<2);
1236 obj_tptr
+=4; /* get to the start of the service header */
1239 while (obj_tlen
>= 4) {
1240 intserv_serv_tlen
=EXTRACT_16BITS(obj_tptr
+2)<<2;
1241 printf("%s Service Type: %s (%u), break bit %s set, Service length: %u",
1243 tok2str(rsvp_intserv_service_type_values
,"unknown",*(obj_tptr
)),
1245 (*(obj_tptr
+1)&0x80) ? "" : "not",
1248 obj_tptr
+=4; /* get to the start of the parameter list */
1251 while (intserv_serv_tlen
>=4) {
1252 processed
= rsvp_intserv_print(obj_tptr
, obj_tlen
);
1255 obj_tlen
-=processed
;
1256 intserv_serv_tlen
-=processed
;
1257 obj_tptr
+=processed
;
1266 case RSVP_OBJ_FILTERSPEC
:
1267 switch(rsvp_obj_ctype
) {
1268 case RSVP_CTYPE_IPV4
:
1271 printf("%s Source Address: %s, Source Port: %u",
1273 ipaddr_string(obj_tptr
),
1274 EXTRACT_16BITS(obj_tptr
+6));
1279 case RSVP_CTYPE_IPV6
:
1282 printf("%s Source Address: %s, Source Port: %u",
1284 ip6addr_string(obj_tptr
),
1285 EXTRACT_16BITS(obj_tptr
+18));
1292 printf("%s Source Address: %s, Flow Label: %u",
1294 ip6addr_string(obj_tptr
),
1295 EXTRACT_24BITS(obj_tptr
+17));
1299 case RSVP_CTYPE_TUNNEL_IPV6
:
1302 printf("%s Source Address: %s, LSP-ID: 0x%04x",
1304 ipaddr_string(obj_tptr
),
1305 EXTRACT_16BITS(obj_tptr
+18));
1310 case RSVP_CTYPE_TUNNEL_IPV4
:
1313 printf("%s Source Address: %s, LSP-ID: 0x%04x",
1315 ipaddr_string(obj_tptr
),
1316 EXTRACT_16BITS(obj_tptr
+6));
1325 case RSVP_OBJ_FASTREROUTE
:
1326 /* the differences between c-type 1 and 7 are minor */
1327 obj_ptr
.rsvp_obj_frr
= (const struct rsvp_obj_frr_t
*)obj_tptr
;
1328 bw
.i
= EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->bandwidth
);
1330 switch(rsvp_obj_ctype
) {
1331 case RSVP_CTYPE_1
: /* new style */
1332 if (obj_tlen
< sizeof(struct rsvp_obj_frr_t
))
1334 printf("%s Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps",
1336 (int)obj_ptr
.rsvp_obj_frr
->setup_prio
,
1337 (int)obj_ptr
.rsvp_obj_frr
->hold_prio
,
1338 (int)obj_ptr
.rsvp_obj_frr
->hop_limit
,
1340 printf("%s Include-any: 0x%08x, Exclude-any: 0x%08x, Include-all: 0x%08x",
1342 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->include_any
),
1343 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->exclude_any
),
1344 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->include_all
));
1345 obj_tlen
-=sizeof(struct rsvp_obj_frr_t
);
1346 obj_tptr
+=sizeof(struct rsvp_obj_frr_t
);
1349 case RSVP_CTYPE_TUNNEL_IPV4
: /* old style */
1352 printf("%s Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps",
1354 (int)obj_ptr
.rsvp_obj_frr
->setup_prio
,
1355 (int)obj_ptr
.rsvp_obj_frr
->hold_prio
,
1356 (int)obj_ptr
.rsvp_obj_frr
->hop_limit
,
1358 printf("%s Include Colors: 0x%08x, Exclude Colors: 0x%08x",
1360 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->include_any
),
1361 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->exclude_any
));
1371 case RSVP_OBJ_DETOUR
:
1372 switch(rsvp_obj_ctype
) {
1373 case RSVP_CTYPE_TUNNEL_IPV4
:
1374 while(obj_tlen
>= 8) {
1375 printf("%s PLR-ID: %s, Avoid-Node-ID: %s",
1377 ipaddr_string(obj_tptr
),
1378 ipaddr_string(obj_tptr
+4));
1388 case RSVP_OBJ_CLASSTYPE
:
1389 case RSVP_OBJ_CLASSTYPE_OLD
: /* fall through */
1390 switch(rsvp_obj_ctype
) {
1394 EXTRACT_32BITS(obj_tptr
)&0x7);
1403 case RSVP_OBJ_ERROR_SPEC
:
1404 switch(rsvp_obj_ctype
) {
1405 case RSVP_CTYPE_3
: /* fall through - FIXME add TLV parser */
1406 case RSVP_CTYPE_IPV4
:
1409 error_code
=*(obj_tptr
+5);
1410 error_value
=EXTRACT_16BITS(obj_tptr
+6);
1411 printf("%s Error Node Address: %s, Flags: [0x%02x]%s Error Code: %s (%u)",
1413 ipaddr_string(obj_tptr
),
1416 tok2str(rsvp_obj_error_code_values
,"unknown",error_code
),
1418 switch (error_code
) {
1419 case RSVP_OBJ_ERROR_SPEC_CODE_ROUTING
:
1420 printf(", Error Value: %s (%u)",
1421 tok2str(rsvp_obj_error_code_routing_values
,"unknown",error_value
),
1424 case RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE
: /* fall through */
1425 case RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE_OLD
:
1426 printf(", Error Value: %s (%u)",
1427 tok2str(rsvp_obj_error_code_diffserv_te_values
,"unknown",error_value
),
1431 printf(", Unknown Error Value (%u)", error_value
);
1438 case RSVP_CTYPE_4
: /* fall through - FIXME add TLV parser */
1439 case RSVP_CTYPE_IPV6
:
1442 error_code
=*(obj_tptr
+17);
1443 error_value
=EXTRACT_16BITS(obj_tptr
+18);
1444 printf("%s Error Node Address: %s, Flags: [0x%02x]%s Error Code: %s (%u)",
1446 ip6addr_string(obj_tptr
),
1449 tok2str(rsvp_obj_error_code_values
,"unknown",error_code
),
1452 switch (error_code
) {
1453 case RSVP_OBJ_ERROR_SPEC_CODE_ROUTING
:
1454 printf(", Error Value: %s (%u)",
1455 tok2str(rsvp_obj_error_code_routing_values
,"unknown",error_value
),
1470 case RSVP_OBJ_PROPERTIES
:
1471 switch(rsvp_obj_ctype
) {
1475 padbytes
= EXTRACT_16BITS(obj_tptr
+2);
1476 printf("%s TLV count: %u, padding bytes: %u",
1478 EXTRACT_16BITS(obj_tptr
),
1482 /* loop through as long there is anything longer than the TLV header (2) */
1483 while(obj_tlen
>= 2 + padbytes
) {
1484 printf("%s %s TLV (0x%02x), length: %u", /* length includes header */
1486 tok2str(rsvp_obj_prop_tlv_values
,"unknown",*obj_tptr
),
1489 if (obj_tlen
< *(obj_tptr
+1))
1491 if (*(obj_tptr
+1) < 2)
1493 print_unknown_data(obj_tptr
+2,"\n\t\t",*(obj_tptr
+1)-2);
1494 obj_tlen
-=*(obj_tptr
+1);
1495 obj_tptr
+=*(obj_tptr
+1);
1503 case RSVP_OBJ_MESSAGE_ID
: /* fall through */
1504 case RSVP_OBJ_MESSAGE_ID_ACK
: /* fall through */
1505 case RSVP_OBJ_MESSAGE_ID_LIST
:
1506 switch(rsvp_obj_ctype
) {
1511 printf("%s Flags [0x%02x], epoch: %u",
1514 EXTRACT_24BITS(obj_tptr
+1));
1517 /* loop through as long there are no messages left */
1518 while(obj_tlen
>= 4) {
1519 printf("%s Message-ID 0x%08x (%u)",
1521 EXTRACT_32BITS(obj_tptr
),
1522 EXTRACT_32BITS(obj_tptr
));
1532 case RSVP_OBJ_INTEGRITY
:
1533 switch(rsvp_obj_ctype
) {
1535 if (obj_tlen
< sizeof(struct rsvp_obj_integrity_t
))
1537 obj_ptr
.rsvp_obj_integrity
= (const struct rsvp_obj_integrity_t
*)obj_tptr
;
1538 printf("%s Key-ID 0x%04x%08x, Sequence 0x%08x%08x, Flags [%s]",
1540 EXTRACT_16BITS(obj_ptr
.rsvp_obj_integrity
->key_id
),
1541 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->key_id
+2),
1542 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->sequence
),
1543 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->sequence
+4),
1544 bittok2str(rsvp_obj_integrity_flag_values
,
1546 obj_ptr
.rsvp_obj_integrity
->flags
));
1547 printf("%s MD5-sum 0x%08x%08x%08x%08x (unverified)",
1549 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->digest
),
1550 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->digest
+4),
1551 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->digest
+8),
1552 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->digest
+12));
1553 obj_tlen
+=sizeof(struct rsvp_obj_integrity_t
);
1554 obj_tptr
+=sizeof(struct rsvp_obj_integrity_t
);
1561 case RSVP_OBJ_ADMIN_STATUS
:
1562 switch(rsvp_obj_ctype
) {
1566 printf("%s Flags [%s]", ident
,
1567 bittok2str(rsvp_obj_admin_status_flag_values
, "none",
1568 EXTRACT_32BITS(obj_tptr
)));
1577 case RSVP_OBJ_LABEL_SET
:
1578 switch(rsvp_obj_ctype
) {
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");