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.12 2007-02-26 07:32:55 hannes Exp $";
27 #include <tcpdump-stdinc.h>
33 #include "interface.h"
35 #include "addrtoname.h"
36 #include "ethertype.h"
40 * RFC 2205 common header
43 * +-------------+-------------+-------------+-------------+
44 * | Vers | Flags| Msg Type | RSVP Checksum |
45 * +-------------+-------------+-------------+-------------+
46 * | Send_TTL | (Reserved) | RSVP Length |
47 * +-------------+-------------+-------------+-------------+
51 struct rsvp_common_header
{
52 u_int8_t version_flags
;
61 * RFC2205 object header
65 * +-------------+-------------+-------------+-------------+
66 * | Length (bytes) | Class-Num | C-Type |
67 * +-------------+-------------+-------------+-------------+
69 * // (Object contents) //
71 * +-------------+-------------+-------------+-------------+
74 struct rsvp_object_header
{
80 #define RSVP_VERSION 1
81 #define RSVP_EXTRACT_VERSION(x) (((x)&0xf0)>>4)
82 #define RSVP_EXTRACT_FLAGS(x) ((x)&0x0f)
84 #define RSVP_MSGTYPE_PATH 1
85 #define RSVP_MSGTYPE_RESV 2
86 #define RSVP_MSGTYPE_PATHERR 3
87 #define RSVP_MSGTYPE_RESVERR 4
88 #define RSVP_MSGTYPE_PATHTEAR 5
89 #define RSVP_MSGTYPE_RESVTEAR 6
90 #define RSVP_MSGTYPE_RESVCONF 7
91 #define RSVP_MSGTYPE_AGGREGATE 12
92 #define RSVP_MSGTYPE_ACK 13
93 #define RSVP_MSGTYPE_HELLO_OLD 14 /* ancient Hellos */
94 #define RSVP_MSGTYPE_SREFRESH 15
95 #define RSVP_MSGTYPE_HELLO 20
97 static const struct tok rsvp_msg_type_values
[] = {
98 { RSVP_MSGTYPE_PATH
, "Path" },
99 { RSVP_MSGTYPE_RESV
, "Resv" },
100 { RSVP_MSGTYPE_PATHERR
, "PathErr" },
101 { RSVP_MSGTYPE_RESVERR
, "ResvErr" },
102 { RSVP_MSGTYPE_PATHTEAR
, "PathTear" },
103 { RSVP_MSGTYPE_RESVTEAR
, "ResvTear" },
104 { RSVP_MSGTYPE_RESVCONF
, "ResvConf" },
105 { RSVP_MSGTYPE_AGGREGATE
, "Aggregate" },
106 { RSVP_MSGTYPE_ACK
, "Acknowledgement" },
107 { RSVP_MSGTYPE_HELLO_OLD
, "Hello (Old)" },
108 { RSVP_MSGTYPE_SREFRESH
, "Refresh" },
109 { RSVP_MSGTYPE_HELLO
, "Hello" },
113 static const struct tok rsvp_header_flag_values
[] = {
114 { 0x01, "Refresh reduction capable" }, /* rfc2961 */
118 #define RSVP_OBJ_SESSION 1 /* rfc2205 */
119 #define RSVP_OBJ_RSVP_HOP 3 /* rfc2205, rfc3473 */
120 #define RSVP_OBJ_INTEGRITY 4 /* rfc2747 */
121 #define RSVP_OBJ_TIME_VALUES 5 /* rfc2205 */
122 #define RSVP_OBJ_ERROR_SPEC 6
123 #define RSVP_OBJ_SCOPE 7
124 #define RSVP_OBJ_STYLE 8 /* rfc2205 */
125 #define RSVP_OBJ_FLOWSPEC 9 /* rfc2215 */
126 #define RSVP_OBJ_FILTERSPEC 10 /* rfc2215 */
127 #define RSVP_OBJ_SENDER_TEMPLATE 11
128 #define RSVP_OBJ_SENDER_TSPEC 12 /* rfc2215 */
129 #define RSVP_OBJ_ADSPEC 13 /* rfc2215 */
130 #define RSVP_OBJ_POLICY_DATA 14
131 #define RSVP_OBJ_CONFIRM 15 /* rfc2205 */
132 #define RSVP_OBJ_LABEL 16 /* rfc3209 */
133 #define RSVP_OBJ_LABEL_REQ 19 /* rfc3209 */
134 #define RSVP_OBJ_ERO 20 /* rfc3209 */
135 #define RSVP_OBJ_RRO 21 /* rfc3209 */
136 #define RSVP_OBJ_HELLO 22 /* rfc3209 */
137 #define RSVP_OBJ_MESSAGE_ID 23 /* rfc2961 */
138 #define RSVP_OBJ_MESSAGE_ID_ACK 24 /* rfc2961 */
139 #define RSVP_OBJ_MESSAGE_ID_LIST 25 /* rfc2961 */
140 #define RSVP_OBJ_RECOVERY_LABEL 34 /* rfc3473 */
141 #define RSVP_OBJ_UPSTREAM_LABEL 35 /* rfc3473 */
142 #define RSVP_OBJ_LABEL_SET 36 /* rfc3473 */
143 #define RSVP_OBJ_PROTECTION 37 /* rfc3473 */
144 #define RSVP_OBJ_DETOUR 63 /* draft-ietf-mpls-rsvp-lsp-fastreroute-07 */
145 #define RSVP_OBJ_CLASSTYPE 66 /* rfc4124 */
146 #define RSVP_OBJ_CLASSTYPE_OLD 125 /* draft-ietf-tewg-diff-te-proto-07 */
147 #define RSVP_OBJ_SUGGESTED_LABEL 129 /* rfc3473 */
148 #define RSVP_OBJ_ACCEPT_LABEL_SET 130 /* rfc3473 */
149 #define RSVP_OBJ_RESTART_CAPABILITY 131 /* rfc3473 */
150 #define RSVP_OBJ_NOTIFY_REQ 195 /* rfc3473 */
151 #define RSVP_OBJ_ADMIN_STATUS 196 /* rfc3473 */
152 #define RSVP_OBJ_PROPERTIES 204 /* juniper proprietary */
153 #define RSVP_OBJ_FASTREROUTE 205 /* draft-ietf-mpls-rsvp-lsp-fastreroute-07 */
154 #define RSVP_OBJ_SESSION_ATTRIBUTE 207 /* rfc3209 */
155 #define RSVP_OBJ_CALL_ID 230 /* rfc3474 */
156 #define RSVP_OBJ_CALL_OPS 236 /* rfc3474 */
158 static const struct tok rsvp_obj_values
[] = {
159 { RSVP_OBJ_SESSION
, "Session" },
160 { RSVP_OBJ_RSVP_HOP
, "RSVP Hop" },
161 { RSVP_OBJ_INTEGRITY
, "Integrity" },
162 { RSVP_OBJ_TIME_VALUES
, "Time Values" },
163 { RSVP_OBJ_ERROR_SPEC
, "Error Spec" },
164 { RSVP_OBJ_SCOPE
, "Scope" },
165 { RSVP_OBJ_STYLE
, "Style" },
166 { RSVP_OBJ_FLOWSPEC
, "Flowspec" },
167 { RSVP_OBJ_FILTERSPEC
, "FilterSpec" },
168 { RSVP_OBJ_SENDER_TEMPLATE
, "Sender Template" },
169 { RSVP_OBJ_SENDER_TSPEC
, "Sender TSpec" },
170 { RSVP_OBJ_ADSPEC
, "Adspec" },
171 { RSVP_OBJ_POLICY_DATA
, "Policy Data" },
172 { RSVP_OBJ_CONFIRM
, "Confirm" },
173 { RSVP_OBJ_LABEL
, "Label" },
174 { RSVP_OBJ_LABEL_REQ
, "Label Request" },
175 { RSVP_OBJ_ERO
, "ERO" },
176 { RSVP_OBJ_RRO
, "RRO" },
177 { RSVP_OBJ_HELLO
, "Hello" },
178 { RSVP_OBJ_MESSAGE_ID
, "Message ID" },
179 { RSVP_OBJ_MESSAGE_ID_ACK
, "Message ID Ack" },
180 { RSVP_OBJ_MESSAGE_ID_LIST
, "Message ID List" },
181 { RSVP_OBJ_RECOVERY_LABEL
, "Recovery Label" },
182 { RSVP_OBJ_UPSTREAM_LABEL
, "Upstream Label" },
183 { RSVP_OBJ_LABEL_SET
, "Label Set" },
184 { RSVP_OBJ_ACCEPT_LABEL_SET
, "Acceptable Label Set" },
185 { RSVP_OBJ_DETOUR
, "Detour" },
186 { RSVP_OBJ_CLASSTYPE
, "Class Type" },
187 { RSVP_OBJ_CLASSTYPE_OLD
, "Class Type (old)" },
188 { RSVP_OBJ_SUGGESTED_LABEL
, "Suggested Label" },
189 { RSVP_OBJ_PROPERTIES
, "Properties" },
190 { RSVP_OBJ_FASTREROUTE
, "Fast Re-Route" },
191 { RSVP_OBJ_SESSION_ATTRIBUTE
, "Session Attribute" },
192 { RSVP_OBJ_CALL_ID
, "Call-ID" },
193 { RSVP_OBJ_CALL_OPS
, "Call Capability" },
194 { RSVP_OBJ_RESTART_CAPABILITY
, "Restart Capability" },
195 { RSVP_OBJ_NOTIFY_REQ
, "Notify Request" },
196 { RSVP_OBJ_PROTECTION
, "Protection" },
197 { RSVP_OBJ_ADMIN_STATUS
, "Administrative Status" },
201 #define RSVP_CTYPE_IPV4 1
202 #define RSVP_CTYPE_IPV6 2
203 #define RSVP_CTYPE_TUNNEL_IPV4 7
204 #define RSVP_CTYPE_TUNNEL_IPV6 8
205 #define RSVP_CTYPE_1 1
206 #define RSVP_CTYPE_2 2
207 #define RSVP_CTYPE_3 3
208 #define RSVP_CTYPE_4 4
211 * the ctypes are not globally unique so for
212 * translating it to strings we build a table based
213 * on objects offsetted by the ctype
216 static const struct tok rsvp_ctype_values
[] = {
217 { 256*RSVP_OBJ_RSVP_HOP
+RSVP_CTYPE_IPV4
, "IPv4" },
218 { 256*RSVP_OBJ_RSVP_HOP
+RSVP_CTYPE_IPV6
, "IPv6" },
219 { 256*RSVP_OBJ_RSVP_HOP
+RSVP_CTYPE_3
, "IPv4 plus opt. TLVs" },
220 { 256*RSVP_OBJ_RSVP_HOP
+RSVP_CTYPE_4
, "IPv6 plus opt. TLVs" },
221 { 256*RSVP_OBJ_NOTIFY_REQ
+RSVP_CTYPE_IPV4
, "IPv4" },
222 { 256*RSVP_OBJ_NOTIFY_REQ
+RSVP_CTYPE_IPV6
, "IPv6" },
223 { 256*RSVP_OBJ_CONFIRM
+RSVP_CTYPE_IPV4
, "IPv4" },
224 { 256*RSVP_OBJ_CONFIRM
+RSVP_CTYPE_IPV6
, "IPv6" },
225 { 256*RSVP_OBJ_TIME_VALUES
+RSVP_CTYPE_1
, "1" },
226 { 256*RSVP_OBJ_FLOWSPEC
+RSVP_CTYPE_1
, "obsolete" },
227 { 256*RSVP_OBJ_FLOWSPEC
+RSVP_CTYPE_2
, "IntServ" },
228 { 256*RSVP_OBJ_SENDER_TSPEC
+RSVP_CTYPE_2
, "IntServ" },
229 { 256*RSVP_OBJ_ADSPEC
+RSVP_CTYPE_2
, "IntServ" },
230 { 256*RSVP_OBJ_FILTERSPEC
+RSVP_CTYPE_IPV4
, "IPv4" },
231 { 256*RSVP_OBJ_FILTERSPEC
+RSVP_CTYPE_IPV6
, "IPv6" },
232 { 256*RSVP_OBJ_FILTERSPEC
+RSVP_CTYPE_3
, "IPv6 Flow-label" },
233 { 256*RSVP_OBJ_FILTERSPEC
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
234 { 256*RSVP_OBJ_SESSION
+RSVP_CTYPE_IPV4
, "IPv4" },
235 { 256*RSVP_OBJ_SESSION
+RSVP_CTYPE_IPV6
, "IPv6" },
236 { 256*RSVP_OBJ_SESSION
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
237 { 256*RSVP_OBJ_SENDER_TEMPLATE
+RSVP_CTYPE_IPV4
, "IPv4" },
238 { 256*RSVP_OBJ_SENDER_TEMPLATE
+RSVP_CTYPE_IPV6
, "IPv6" },
239 { 256*RSVP_OBJ_SENDER_TEMPLATE
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
240 { 256*RSVP_OBJ_MESSAGE_ID
+RSVP_CTYPE_1
, "1" },
241 { 256*RSVP_OBJ_MESSAGE_ID_ACK
+RSVP_CTYPE_1
, "Message id ack" },
242 { 256*RSVP_OBJ_MESSAGE_ID_ACK
+RSVP_CTYPE_2
, "Message id nack" },
243 { 256*RSVP_OBJ_MESSAGE_ID_LIST
+RSVP_CTYPE_1
, "1" },
244 { 256*RSVP_OBJ_STYLE
+RSVP_CTYPE_1
, "1" },
245 { 256*RSVP_OBJ_HELLO
+RSVP_CTYPE_1
, "Hello Request" },
246 { 256*RSVP_OBJ_HELLO
+RSVP_CTYPE_2
, "Hello Ack" },
247 { 256*RSVP_OBJ_LABEL_REQ
+RSVP_CTYPE_1
, "without label range" },
248 { 256*RSVP_OBJ_LABEL_REQ
+RSVP_CTYPE_2
, "with ATM label range" },
249 { 256*RSVP_OBJ_LABEL_REQ
+RSVP_CTYPE_3
, "with FR label range" },
250 { 256*RSVP_OBJ_LABEL_REQ
+RSVP_CTYPE_4
, "Generalized Label" },
251 { 256*RSVP_OBJ_LABEL
+RSVP_CTYPE_1
, "Label" },
252 { 256*RSVP_OBJ_LABEL
+RSVP_CTYPE_2
, "Generalized Label" },
253 { 256*RSVP_OBJ_LABEL
+RSVP_CTYPE_3
, "Waveband Switching" },
254 { 256*RSVP_OBJ_SUGGESTED_LABEL
+RSVP_CTYPE_1
, "Label" },
255 { 256*RSVP_OBJ_SUGGESTED_LABEL
+RSVP_CTYPE_2
, "Generalized Label" },
256 { 256*RSVP_OBJ_SUGGESTED_LABEL
+RSVP_CTYPE_3
, "Waveband Switching" },
257 { 256*RSVP_OBJ_UPSTREAM_LABEL
+RSVP_CTYPE_1
, "Label" },
258 { 256*RSVP_OBJ_UPSTREAM_LABEL
+RSVP_CTYPE_2
, "Generalized Label" },
259 { 256*RSVP_OBJ_UPSTREAM_LABEL
+RSVP_CTYPE_3
, "Waveband Switching" },
260 { 256*RSVP_OBJ_RECOVERY_LABEL
+RSVP_CTYPE_1
, "Label" },
261 { 256*RSVP_OBJ_RECOVERY_LABEL
+RSVP_CTYPE_2
, "Generalized Label" },
262 { 256*RSVP_OBJ_RECOVERY_LABEL
+RSVP_CTYPE_3
, "Waveband Switching" },
263 { 256*RSVP_OBJ_ERO
+RSVP_CTYPE_IPV4
, "IPv4" },
264 { 256*RSVP_OBJ_RRO
+RSVP_CTYPE_IPV4
, "IPv4" },
265 { 256*RSVP_OBJ_ERROR_SPEC
+RSVP_CTYPE_IPV4
, "IPv4" },
266 { 256*RSVP_OBJ_ERROR_SPEC
+RSVP_CTYPE_IPV6
, "IPv6" },
267 { 256*RSVP_OBJ_ERROR_SPEC
+RSVP_CTYPE_3
, "IPv4 plus opt. TLVs" },
268 { 256*RSVP_OBJ_ERROR_SPEC
+RSVP_CTYPE_4
, "IPv6 plus opt. TLVs" },
269 { 256*RSVP_OBJ_RESTART_CAPABILITY
+RSVP_CTYPE_1
, "IPv4" },
270 { 256*RSVP_OBJ_SESSION_ATTRIBUTE
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
271 { 256*RSVP_OBJ_FASTREROUTE
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" }, /* old style*/
272 { 256*RSVP_OBJ_FASTREROUTE
+RSVP_CTYPE_1
, "1" }, /* new style */
273 { 256*RSVP_OBJ_DETOUR
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
274 { 256*RSVP_OBJ_PROPERTIES
+RSVP_CTYPE_1
, "1" },
275 { 256*RSVP_OBJ_ADMIN_STATUS
+RSVP_CTYPE_1
, "1" },
276 { 256*RSVP_OBJ_CLASSTYPE
+RSVP_CTYPE_1
, "1" },
277 { 256*RSVP_OBJ_CLASSTYPE_OLD
+RSVP_CTYPE_1
, "1" },
281 struct rsvp_obj_integrity_t
{
285 u_int8_t sequence
[8];
289 static const struct tok rsvp_obj_integrity_flag_values
[] = {
290 { 0x80, "Handshake" },
294 struct rsvp_obj_frr_t
{
299 u_int8_t bandwidth
[4];
300 u_int8_t include_any
[4];
301 u_int8_t exclude_any
[4];
302 u_int8_t include_all
[4];
306 #define RSVP_OBJ_XRO_MASK_SUBOBJ(x) ((x)&0x7f)
307 #define RSVP_OBJ_XRO_MASK_LOOSE(x) ((x)&0x80)
309 #define RSVP_OBJ_XRO_RES 0
310 #define RSVP_OBJ_XRO_IPV4 1
311 #define RSVP_OBJ_XRO_IPV6 2
312 #define RSVP_OBJ_XRO_ASN 32
313 #define RSVP_OBJ_XRO_MPLS 64
315 static const struct tok rsvp_obj_xro_values
[] = {
316 { RSVP_OBJ_XRO_RES
, "Reserved" },
317 { RSVP_OBJ_XRO_IPV4
, "IPv4 prefix" },
318 { RSVP_OBJ_XRO_IPV6
, "IPv6 prefix" },
319 { RSVP_OBJ_XRO_ASN
, "Autonomous system number" },
320 { RSVP_OBJ_XRO_MPLS
, "MPLS label switched path termination" },
324 /* draft-ietf-mpls-rsvp-lsp-fastreroute-07.txt */
325 static const struct tok rsvp_obj_rro_flag_values
[] = {
326 { 0x01, "Local protection available" },
327 { 0x02, "Local protection in use" },
328 { 0x04, "Bandwidth protection" },
329 { 0x08, "Node protection" },
333 static const struct tok rsvp_resstyle_values
[] = {
334 { 17, "Wildcard Filter" },
335 { 10, "Fixed Filter" },
336 { 18, "Shared Explicit" },
340 #define RSVP_OBJ_INTSERV_GUARANTEED_SERV 2
341 #define RSVP_OBJ_INTSERV_CONTROLLED_LOAD 5
343 static const struct tok rsvp_intserv_service_type_values
[] = {
344 { 1, "Default/Global Information" },
345 { RSVP_OBJ_INTSERV_GUARANTEED_SERV
, "Guaranteed Service" },
346 { RSVP_OBJ_INTSERV_CONTROLLED_LOAD
, "Controlled Load" },
350 static const struct tok rsvp_intserv_parameter_id_values
[] = {
352 { 6, "Path b/w estimate" },
353 { 8, "Minimum path latency" },
354 { 10, "Composed MTU" },
355 { 127, "Token Bucket TSpec" },
356 { 130, "Guaranteed Service RSpec" },
357 { 133, "End-to-end composed value for C" },
358 { 134, "End-to-end composed value for D" },
359 { 135, "Since-last-reshaping point composed C" },
360 { 136, "Since-last-reshaping point composed D" },
364 static struct tok rsvp_session_attribute_flag_values
[] = {
365 { 0x01, "Local Protection desired" },
366 { 0x02, "Label Recording desired" },
367 { 0x04, "SE Style desired" },
368 { 0x08, "Bandwidth protection desired" }, /* draft-ietf-mpls-rsvp-lsp-fastreroute-02.txt */
369 { 0x10, "Node protection desired" }, /* draft-ietf-mpls-rsvp-lsp-fastreroute-02.txt */
373 static struct tok rsvp_obj_prop_tlv_values
[] = {
375 { 0x02, "Metric 1" },
376 { 0x04, "Metric 2" },
377 { 0x08, "CCC Status" },
378 { 0x10, "Path Type" },
382 #define RSVP_OBJ_ERROR_SPEC_CODE_ROUTING 24
383 #define RSVP_OBJ_ERROR_SPEC_CODE_NOTIFY 25
384 #define RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE 28
385 #define RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE_OLD 125
387 static struct tok rsvp_obj_error_code_values
[] = {
388 { RSVP_OBJ_ERROR_SPEC_CODE_ROUTING
, "Routing Problem" },
389 { RSVP_OBJ_ERROR_SPEC_CODE_NOTIFY
, "Notify Error" },
390 { RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE
, "Diffserv TE Error" },
391 { RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE_OLD
, "Diffserv TE Error (Old)" },
395 static struct tok rsvp_obj_error_code_routing_values
[] = {
396 { 1, "Bad EXPLICIT_ROUTE object" },
397 { 2, "Bad strict node" },
398 { 3, "Bad loose node" },
399 { 4, "Bad initial subobject" },
400 { 5, "No route available toward destination" },
401 { 6, "Unacceptable label value" },
402 { 7, "RRO indicated routing loops" },
403 { 8, "non-RSVP-capable router in the path" },
404 { 9, "MPLS label allocation failure" },
405 { 10, "Unsupported L3PID" },
409 static struct tok rsvp_obj_error_code_diffserv_te_values
[] = {
410 { 1, "Unexpected CT object" },
411 { 2, "Unsupported CT" },
412 { 3, "Invalid CT value" },
413 { 4, "CT/setup priority do not form a configured TE-Class" },
414 { 5, "CT/holding priority do not form a configured TE-Class" },
415 { 6, "CT/setup priority and CT/holding priority do not form a configured TE-Class" },
416 { 7, "Inconsistency between signaled PSC and signaled CT" },
417 { 8, "Inconsistency between signaled PHBs and signaled CT" },
421 /* rfc3473 / rfc 3471 */
422 static const struct tok rsvp_obj_admin_status_flag_values
[] = {
423 { 0x80000000, "Reflect" },
424 { 0x00000004, "Testing" },
425 { 0x00000002, "Admin-down" },
426 { 0x00000001, "Delete-in-progress" },
430 static int rsvp_intserv_print(const u_char
*, u_short
);
433 * this is a dissector for all the intserv defined
434 * specs as defined per rfc2215
435 * it is called from various rsvp objects;
436 * returns the amount of bytes being processed
439 rsvp_intserv_print(const u_char
*tptr
, u_short obj_tlen
) {
441 int parameter_id
,parameter_length
;
449 parameter_id
= *(tptr
);
450 parameter_length
= EXTRACT_16BITS(tptr
+2)<<2; /* convert wordcount to bytecount */
452 printf("\n\t Parameter ID: %s (%u), length: %u, Flags: [0x%02x]",
453 tok2str(rsvp_intserv_parameter_id_values
,"unknown",parameter_id
),
458 if (obj_tlen
< parameter_length
+4)
460 switch(parameter_id
) { /* parameter_id */
464 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
465 * | 4 (e) | (f) | 1 (g) |
466 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
467 * | IS hop cnt (32-bit unsigned integer) |
468 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
470 if (parameter_length
== 4)
471 printf("\n\t\tIS hop count: %u", EXTRACT_32BITS(tptr
+4));
476 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
477 * | 6 (h) | (i) | 1 (j) |
478 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
479 * | Path b/w estimate (32-bit IEEE floating point number) |
480 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
482 if (parameter_length
== 4) {
483 bw
.i
= EXTRACT_32BITS(tptr
+4);
484 printf("\n\t\tPath b/w estimate: %.10g Mbps", bw
.f
/125000);
490 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
491 * | 8 (k) | (l) | 1 (m) |
492 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
493 * | Minimum path latency (32-bit integer) |
494 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
496 if (parameter_length
== 4) {
497 printf("\n\t\tMinimum path latency: ");
498 if (EXTRACT_32BITS(tptr
+4) == 0xffffffff)
499 printf("don't care");
501 printf("%u", EXTRACT_32BITS(tptr
+4));
508 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
509 * | 10 (n) | (o) | 1 (p) |
510 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
511 * | Composed MTU (32-bit unsigned integer) |
512 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
514 if (parameter_length
== 4)
515 printf("\n\t\tComposed MTU: %u bytes", EXTRACT_32BITS(tptr
+4));
519 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
520 * | 127 (e) | 0 (f) | 5 (g) |
521 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
522 * | Token Bucket Rate [r] (32-bit IEEE floating point number) |
523 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
524 * | Token Bucket Size [b] (32-bit IEEE floating point number) |
525 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
526 * | Peak Data Rate [p] (32-bit IEEE floating point number) |
527 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
528 * | Minimum Policed Unit [m] (32-bit integer) |
529 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
530 * | Maximum Packet Size [M] (32-bit integer) |
531 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
534 if (parameter_length
== 20) {
535 bw
.i
= EXTRACT_32BITS(tptr
+4);
536 printf("\n\t\tToken Bucket Rate: %.10g Mbps", bw
.f
/125000);
537 bw
.i
= EXTRACT_32BITS(tptr
+8);
538 printf("\n\t\tToken Bucket Size: %.10g bytes", bw
.f
);
539 bw
.i
= EXTRACT_32BITS(tptr
+12);
540 printf("\n\t\tPeak Data Rate: %.10g Mbps", bw
.f
/125000);
541 printf("\n\t\tMinimum Policed Unit: %u bytes", EXTRACT_32BITS(tptr
+16));
542 printf("\n\t\tMaximum Packet Size: %u bytes", EXTRACT_32BITS(tptr
+20));
548 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
549 * | 130 (h) | 0 (i) | 2 (j) |
550 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
551 * | Rate [R] (32-bit IEEE floating point number) |
552 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
553 * | Slack Term [S] (32-bit integer) |
554 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
557 if (parameter_length
== 8) {
558 bw
.i
= EXTRACT_32BITS(tptr
+4);
559 printf("\n\t\tRate: %.10g Mbps", bw
.f
/125000);
560 printf("\n\t\tSlack Term: %u", EXTRACT_32BITS(tptr
+8));
568 if (parameter_length
== 4)
569 printf("\n\t\tValue: %u", EXTRACT_32BITS(tptr
+4));
574 print_unknown_data(tptr
+4,"\n\t\t",parameter_length
);
576 return (parameter_length
+4); /* header length 4 bytes */
580 rsvp_obj_print (const u_char
*tptr
, const char *ident
, u_int tlen
) {
582 const struct rsvp_object_header
*rsvp_obj_header
;
583 const u_char
*obj_tptr
;
585 const struct rsvp_obj_integrity_t
*rsvp_obj_integrity
;
586 const struct rsvp_obj_frr_t
*rsvp_obj_frr
;
589 u_short rsvp_obj_len
,rsvp_obj_ctype
,obj_tlen
,intserv_serv_tlen
;
590 int hexdump
,processed
,padbytes
,error_code
,error_value
,i
;
597 while(tlen
>=sizeof(struct rsvp_object_header
)) {
598 /* did we capture enough for fully decoding the object header ? */
599 if (!TTEST2(*tptr
, sizeof(struct rsvp_object_header
)))
602 rsvp_obj_header
= (const struct rsvp_object_header
*)tptr
;
603 rsvp_obj_len
=EXTRACT_16BITS(rsvp_obj_header
->length
);
604 rsvp_obj_ctype
=rsvp_obj_header
->ctype
;
606 if(rsvp_obj_len
% 4) {
607 printf("%sERROR: object header size %u not a multiple of 4", ident
, rsvp_obj_len
);
610 if(rsvp_obj_len
< sizeof(struct rsvp_object_header
)) {
611 printf("%sERROR: object header too short %u < %lu", ident
, rsvp_obj_len
,
612 (unsigned long)sizeof(const struct rsvp_object_header
));
616 printf("%s%s Object (%u) Flags: [%s",
618 tok2str(rsvp_obj_values
,
620 rsvp_obj_header
->class_num
),
621 rsvp_obj_header
->class_num
,
622 ((rsvp_obj_header
->class_num
)&0x80) ? "ignore" : "reject");
624 if (rsvp_obj_header
->class_num
> 128)
626 ((rsvp_obj_header
->class_num
)&0x40) ? "and forward" : "silently");
628 printf(" if unknown], Class-Type: %s (%u), length: %u",
629 tok2str(rsvp_ctype_values
,
631 ((rsvp_obj_header
->class_num
)<<8)+rsvp_obj_ctype
),
635 if(tlen
< rsvp_obj_len
) {
636 printf("%sERROR: object goes past end of objects TLV", ident
);
640 obj_tptr
=tptr
+sizeof(struct rsvp_object_header
);
641 obj_tlen
=rsvp_obj_len
-sizeof(struct rsvp_object_header
);
643 /* did we capture enough for fully decoding the object ? */
644 if (!TTEST2(*tptr
, rsvp_obj_len
))
648 switch(rsvp_obj_header
->class_num
) {
649 case RSVP_OBJ_SESSION
:
650 switch(rsvp_obj_ctype
) {
651 case RSVP_CTYPE_IPV4
:
654 printf("%s IPv4 DestAddress: %s, Protocol ID: 0x%02x",
656 ipaddr_string(obj_tptr
),
657 *(obj_tptr
+sizeof(struct in_addr
)));
658 printf("%s Flags: [0x%02x], DestPort %u",
661 EXTRACT_16BITS(obj_tptr
+6));
666 case RSVP_CTYPE_IPV6
:
669 printf("%s IPv6 DestAddress: %s, Protocol ID: 0x%02x",
671 ip6addr_string(obj_tptr
),
672 *(obj_tptr
+sizeof(struct in6_addr
)));
673 printf("%s Flags: [0x%02x], DestPort %u",
675 *(obj_tptr
+sizeof(struct in6_addr
)+1),
676 EXTRACT_16BITS(obj_tptr
+sizeof(struct in6_addr
)+2));
681 case RSVP_CTYPE_TUNNEL_IPV6
:
684 printf("%s IPv6 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
686 ip6addr_string(obj_tptr
),
687 EXTRACT_16BITS(obj_tptr
+18),
688 ip6addr_string(obj_tptr
+20));
693 case RSVP_CTYPE_TUNNEL_IPV4
:
696 printf("%s IPv4 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
698 ipaddr_string(obj_tptr
),
699 EXTRACT_16BITS(obj_tptr
+6),
700 ipaddr_string(obj_tptr
+8));
709 case RSVP_OBJ_CONFIRM
:
710 switch(rsvp_obj_ctype
) {
711 case RSVP_CTYPE_IPV4
:
712 if (obj_tlen
< sizeof(struct in_addr
))
714 printf("%s IPv4 Receiver Address: %s",
716 ipaddr_string(obj_tptr
));
717 obj_tlen
-=sizeof(struct in_addr
);
718 obj_tptr
+=sizeof(struct in_addr
);
721 case RSVP_CTYPE_IPV6
:
722 if (obj_tlen
< sizeof(struct in6_addr
))
724 printf("%s IPv6 Receiver Address: %s",
726 ip6addr_string(obj_tptr
));
727 obj_tlen
-=sizeof(struct in6_addr
);
728 obj_tptr
+=sizeof(struct in6_addr
);
736 case RSVP_OBJ_NOTIFY_REQ
:
737 switch(rsvp_obj_ctype
) {
738 case RSVP_CTYPE_IPV4
:
739 if (obj_tlen
< sizeof(struct in_addr
))
741 printf("%s IPv4 Notify Node Address: %s",
743 ipaddr_string(obj_tptr
));
744 obj_tlen
-=sizeof(struct in_addr
);
745 obj_tptr
+=sizeof(struct in_addr
);
748 case RSVP_CTYPE_IPV6
:
749 if (obj_tlen
< sizeof(struct in6_addr
))
751 printf("%s IPv6 Notify Node Address: %s",
753 ip6addr_string(obj_tptr
));
754 obj_tlen
-=sizeof(struct in6_addr
);
755 obj_tptr
+=sizeof(struct in6_addr
);
763 case RSVP_OBJ_SUGGESTED_LABEL
: /* fall through */
764 case RSVP_OBJ_UPSTREAM_LABEL
: /* fall through */
765 case RSVP_OBJ_RECOVERY_LABEL
: /* fall through */
767 switch(rsvp_obj_ctype
) {
769 while(obj_tlen
>= 4 ) {
770 printf("%s Label: %u", ident
, EXTRACT_32BITS(obj_tptr
));
778 printf("%s Generalized Label: %u",
780 EXTRACT_32BITS(obj_tptr
));
787 printf("%s Waveband ID: %u%s Start Label: %u, Stop Label: %u",
789 EXTRACT_32BITS(obj_tptr
),
791 EXTRACT_32BITS(obj_tptr
+4),
792 EXTRACT_32BITS(obj_tptr
+8));
802 switch(rsvp_obj_ctype
) {
806 printf("%s Reservation Style: %s, Flags: [0x%02x]",
808 tok2str(rsvp_resstyle_values
,
810 EXTRACT_24BITS(obj_tptr
+1)),
820 case RSVP_OBJ_SENDER_TEMPLATE
:
821 switch(rsvp_obj_ctype
) {
822 case RSVP_CTYPE_IPV4
:
825 printf("%s Source Address: %s, Source Port: %u",
827 ipaddr_string(obj_tptr
),
828 EXTRACT_16BITS(obj_tptr
+6));
833 case RSVP_CTYPE_IPV6
:
836 printf("%s Source Address: %s, Source Port: %u",
838 ip6addr_string(obj_tptr
),
839 EXTRACT_16BITS(obj_tptr
+18));
844 case RSVP_CTYPE_TUNNEL_IPV4
:
847 printf("%s IPv4 Tunnel Sender Address: %s, LSP-ID: 0x%04x",
849 ipaddr_string(obj_tptr
),
850 EXTRACT_16BITS(obj_tptr
+6));
859 case RSVP_OBJ_LABEL_REQ
:
860 switch(rsvp_obj_ctype
) {
862 while(obj_tlen
>= 4 ) {
863 printf("%s L3 Protocol ID: %s",
865 tok2str(ethertype_values
,
866 "Unknown Protocol (0x%04x)",
867 EXTRACT_16BITS(obj_tptr
+2)));
875 printf("%s L3 Protocol ID: %s",
877 tok2str(ethertype_values
,
878 "Unknown Protocol (0x%04x)",
879 EXTRACT_16BITS(obj_tptr
+2)));
880 printf(",%s merge capability",((*(obj_tptr
+4))&0x80) ? "no" : "" );
881 printf("%s Minimum VPI/VCI: %u/%u",
883 (EXTRACT_16BITS(obj_tptr
+4))&0xfff,
884 (EXTRACT_16BITS(obj_tptr
+6))&0xfff);
885 printf("%s Maximum VPI/VCI: %u/%u",
887 (EXTRACT_16BITS(obj_tptr
+8))&0xfff,
888 (EXTRACT_16BITS(obj_tptr
+10))&0xfff);
895 printf("%s L3 Protocol ID: %s",
897 tok2str(ethertype_values
,
898 "Unknown Protocol (0x%04x)",
899 EXTRACT_16BITS(obj_tptr
+2)));
900 printf("%s Minimum/Maximum DLCI: %u/%u, %s%s bit DLCI",
902 (EXTRACT_32BITS(obj_tptr
+4))&0x7fffff,
903 (EXTRACT_32BITS(obj_tptr
+8))&0x7fffff,
904 (((EXTRACT_16BITS(obj_tptr
+4)>>7)&3) == 0 ) ? "10" : "",
905 (((EXTRACT_16BITS(obj_tptr
+4)>>7)&3) == 2 ) ? "23" : "");
912 printf("%s LSP Encoding Type: %s (%u)",
914 tok2str(gmpls_encoding_values
,
918 printf("%s Switching Type: %s (%u), Payload ID: %s (0x%04x)",
920 tok2str(gmpls_switch_cap_values
,
924 tok2str(gmpls_payload_values
,
926 EXTRACT_16BITS(obj_tptr
+2)),
927 EXTRACT_16BITS(obj_tptr
+2));
938 switch(rsvp_obj_ctype
) {
939 case RSVP_CTYPE_IPV4
:
940 while(obj_tlen
>= 4 ) {
941 printf("%s Subobject Type: %s, length %u",
943 tok2str(rsvp_obj_xro_values
,
945 RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr
)),
948 if (*(obj_tptr
+1) == 0) { /* prevent infinite loops */
949 printf("%s ERROR: zero length ERO subtype",ident
);
953 switch(RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr
)) {
954 case RSVP_OBJ_XRO_IPV4
:
955 printf(", %s, %s/%u, Flags: [%s]",
956 RSVP_OBJ_XRO_MASK_LOOSE(*obj_tptr
) ? "Loose" : "Strict",
957 ipaddr_string(obj_tptr
+2),
959 bittok2str(rsvp_obj_rro_flag_values
,
961 *(obj_tptr
+7))); /* rfc3209 says that this field is rsvd. */
963 obj_tlen
-=*(obj_tptr
+1);
964 obj_tptr
+=*(obj_tptr
+1);
973 switch(rsvp_obj_ctype
) {
978 printf("%s Source Instance: 0x%08x, Destination Instance: 0x%08x",
980 EXTRACT_32BITS(obj_tptr
),
981 EXTRACT_32BITS(obj_tptr
+4));
990 case RSVP_OBJ_RESTART_CAPABILITY
:
991 switch(rsvp_obj_ctype
) {
995 printf("%s Restart Time: %ums, Recovery Time: %ums",
997 EXTRACT_32BITS(obj_tptr
),
998 EXTRACT_32BITS(obj_tptr
+4));
1007 case RSVP_OBJ_SESSION_ATTRIBUTE
:
1008 switch(rsvp_obj_ctype
) {
1009 case RSVP_CTYPE_TUNNEL_IPV4
:
1012 namelen
= *(obj_tptr
+3);
1013 if (obj_tlen
< 4+namelen
)
1015 printf("%s Session Name: ", ident
);
1016 for (i
= 0; i
< namelen
; i
++)
1017 safeputchar(*(obj_tptr
+4+i
));
1018 printf("%s Setup Priority: %u, Holding Priority: %u, Flags: [%s]",
1022 tok2str(rsvp_session_attribute_flag_values
,
1026 obj_tlen
-=4+*(obj_tptr
+3);
1027 obj_tptr
+=4+*(obj_tptr
+3);
1034 case RSVP_OBJ_RSVP_HOP
:
1035 switch(rsvp_obj_ctype
) {
1036 case RSVP_CTYPE_3
: /* fall through - FIXME add TLV parser */
1037 case RSVP_CTYPE_IPV4
:
1040 printf("%s Previous/Next Interface: %s, Logical Interface Handle: 0x%08x",
1042 ipaddr_string(obj_tptr
),
1043 EXTRACT_32BITS(obj_tptr
+4));
1047 hexdump
=TRUE
; /* unless we have a TLV parser lets just hexdump */
1050 case RSVP_CTYPE_4
: /* fall through - FIXME add TLV parser */
1051 case RSVP_CTYPE_IPV6
:
1054 printf("%s Previous/Next Interface: %s, Logical Interface Handle: 0x%08x",
1056 ip6addr_string(obj_tptr
),
1057 EXTRACT_32BITS(obj_tptr
+16));
1060 hexdump
=TRUE
; /* unless we have a TLV parser lets just hexdump */
1068 case RSVP_OBJ_TIME_VALUES
:
1069 switch(rsvp_obj_ctype
) {
1073 printf("%s Refresh Period: %ums",
1075 EXTRACT_32BITS(obj_tptr
));
1084 /* those three objects do share the same semantics */
1085 case RSVP_OBJ_SENDER_TSPEC
:
1086 case RSVP_OBJ_ADSPEC
:
1087 case RSVP_OBJ_FLOWSPEC
:
1088 switch(rsvp_obj_ctype
) {
1092 printf("%s Msg-Version: %u, length: %u",
1094 (*obj_tptr
& 0xf0) >> 4,
1095 EXTRACT_16BITS(obj_tptr
+2)<<2);
1096 obj_tptr
+=4; /* get to the start of the service header */
1099 while (obj_tlen
>= 4) {
1100 intserv_serv_tlen
=EXTRACT_16BITS(obj_tptr
+2)<<2;
1101 printf("%s Service Type: %s (%u), break bit %s set, Service length: %u",
1103 tok2str(rsvp_intserv_service_type_values
,"unknown",*(obj_tptr
)),
1105 (*(obj_tptr
+1)&0x80) ? "" : "not",
1108 obj_tptr
+=4; /* get to the start of the parameter list */
1111 while (intserv_serv_tlen
>=4) {
1112 processed
= rsvp_intserv_print(obj_tptr
, obj_tlen
);
1115 obj_tlen
-=processed
;
1116 intserv_serv_tlen
-=processed
;
1117 obj_tptr
+=processed
;
1126 case RSVP_OBJ_FILTERSPEC
:
1127 switch(rsvp_obj_ctype
) {
1128 case RSVP_CTYPE_IPV4
:
1131 printf("%s Source Address: %s, Source Port: %u",
1133 ipaddr_string(obj_tptr
),
1134 EXTRACT_16BITS(obj_tptr
+6));
1139 case RSVP_CTYPE_IPV6
:
1142 printf("%s Source Address: %s, Source Port: %u",
1144 ip6addr_string(obj_tptr
),
1145 EXTRACT_16BITS(obj_tptr
+18));
1152 printf("%s Source Address: %s, Flow Label: %u",
1154 ip6addr_string(obj_tptr
),
1155 EXTRACT_24BITS(obj_tptr
+17));
1159 case RSVP_CTYPE_TUNNEL_IPV6
:
1162 printf("%s Source Address: %s, LSP-ID: 0x%04x",
1164 ipaddr_string(obj_tptr
),
1165 EXTRACT_16BITS(obj_tptr
+18));
1170 case RSVP_CTYPE_TUNNEL_IPV4
:
1173 printf("%s Source Address: %s, LSP-ID: 0x%04x",
1175 ipaddr_string(obj_tptr
),
1176 EXTRACT_16BITS(obj_tptr
+6));
1185 case RSVP_OBJ_FASTREROUTE
:
1186 /* the differences between c-type 1 and 7 are minor */
1187 obj_ptr
.rsvp_obj_frr
= (const struct rsvp_obj_frr_t
*)obj_tptr
;
1188 bw
.i
= EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->bandwidth
);
1190 switch(rsvp_obj_ctype
) {
1191 case RSVP_CTYPE_1
: /* new style */
1192 if (obj_tlen
< sizeof(struct rsvp_obj_frr_t
))
1194 printf("%s Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps",
1196 (int)obj_ptr
.rsvp_obj_frr
->setup_prio
,
1197 (int)obj_ptr
.rsvp_obj_frr
->hold_prio
,
1198 (int)obj_ptr
.rsvp_obj_frr
->hop_limit
,
1200 printf("%s Include-any: 0x%08x, Exclude-any: 0x%08x, Include-all: 0x%08x",
1202 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->include_any
),
1203 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->exclude_any
),
1204 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->include_all
));
1205 obj_tlen
-=sizeof(struct rsvp_obj_frr_t
);
1206 obj_tptr
+=sizeof(struct rsvp_obj_frr_t
);
1209 case RSVP_CTYPE_TUNNEL_IPV4
: /* old style */
1212 printf("%s Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps",
1214 (int)obj_ptr
.rsvp_obj_frr
->setup_prio
,
1215 (int)obj_ptr
.rsvp_obj_frr
->hold_prio
,
1216 (int)obj_ptr
.rsvp_obj_frr
->hop_limit
,
1218 printf("%s Include Colors: 0x%08x, Exclude Colors: 0x%08x",
1220 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->include_any
),
1221 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->exclude_any
));
1231 case RSVP_OBJ_DETOUR
:
1232 switch(rsvp_obj_ctype
) {
1233 case RSVP_CTYPE_TUNNEL_IPV4
:
1234 while(obj_tlen
>= 8) {
1235 printf("%s PLR-ID: %s, Avoid-Node-ID: %s",
1237 ipaddr_string(obj_tptr
),
1238 ipaddr_string(obj_tptr
+4));
1248 case RSVP_OBJ_CLASSTYPE
:
1249 case RSVP_OBJ_CLASSTYPE_OLD
: /* fall through */
1250 switch(rsvp_obj_ctype
) {
1254 EXTRACT_32BITS(obj_tptr
)&0x7);
1263 case RSVP_OBJ_ERROR_SPEC
:
1264 switch(rsvp_obj_ctype
) {
1265 case RSVP_CTYPE_3
: /* fall through - FIXME add TLV parser */
1266 case RSVP_CTYPE_IPV4
:
1269 error_code
=*(obj_tptr
+5);
1270 error_value
=EXTRACT_16BITS(obj_tptr
+6);
1271 printf("%s Error Node Address: %s, Flags: [0x%02x]%s Error Code: %s (%u)",
1273 ipaddr_string(obj_tptr
),
1276 tok2str(rsvp_obj_error_code_values
,"unknown",error_code
),
1278 switch (error_code
) {
1279 case RSVP_OBJ_ERROR_SPEC_CODE_ROUTING
:
1280 printf(", Error Value: %s (%u)",
1281 tok2str(rsvp_obj_error_code_routing_values
,"unknown",error_value
),
1284 case RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE
: /* fall through */
1285 case RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE_OLD
:
1286 printf(", Error Value: %s (%u)",
1287 tok2str(rsvp_obj_error_code_diffserv_te_values
,"unknown",error_value
),
1291 printf(", Unknown Error Value (%u)", error_value
);
1298 case RSVP_CTYPE_4
: /* fall through - FIXME add TLV parser */
1299 case RSVP_CTYPE_IPV6
:
1302 error_code
=*(obj_tptr
+17);
1303 error_value
=EXTRACT_16BITS(obj_tptr
+18);
1304 printf("%s Error Node Address: %s, Flags: [0x%02x]%s Error Code: %s (%u)",
1306 ip6addr_string(obj_tptr
),
1309 tok2str(rsvp_obj_error_code_values
,"unknown",error_code
),
1312 switch (error_code
) {
1313 case RSVP_OBJ_ERROR_SPEC_CODE_ROUTING
:
1314 printf(", Error Value: %s (%u)",
1315 tok2str(rsvp_obj_error_code_routing_values
,"unknown",error_value
),
1330 case RSVP_OBJ_PROPERTIES
:
1331 switch(rsvp_obj_ctype
) {
1335 padbytes
= EXTRACT_16BITS(obj_tptr
+2);
1336 printf("%s TLV count: %u, padding bytes: %u",
1338 EXTRACT_16BITS(obj_tptr
),
1342 /* loop through as long there is anything longer than the TLV header (2) */
1343 while(obj_tlen
>= 2 + padbytes
) {
1344 printf("%s %s TLV (0x%02x), length: %u", /* length includes header */
1346 tok2str(rsvp_obj_prop_tlv_values
,"unknown",*obj_tptr
),
1349 if (obj_tlen
< *(obj_tptr
+1))
1351 if (*(obj_tptr
+1) < 2)
1353 print_unknown_data(obj_tptr
+2,"\n\t\t",*(obj_tptr
+1)-2);
1354 obj_tlen
-=*(obj_tptr
+1);
1355 obj_tptr
+=*(obj_tptr
+1);
1363 case RSVP_OBJ_MESSAGE_ID
: /* fall through */
1364 case RSVP_OBJ_MESSAGE_ID_ACK
: /* fall through */
1365 case RSVP_OBJ_MESSAGE_ID_LIST
:
1366 switch(rsvp_obj_ctype
) {
1371 printf("%s Flags [0x%02x], epoch: %u",
1374 EXTRACT_24BITS(obj_tptr
+1));
1377 /* loop through as long there are no messages left */
1378 while(obj_tlen
>= 4) {
1379 printf("%s Message-ID 0x%08x (%u)",
1381 EXTRACT_32BITS(obj_tptr
),
1382 EXTRACT_32BITS(obj_tptr
));
1392 case RSVP_OBJ_INTEGRITY
:
1393 switch(rsvp_obj_ctype
) {
1395 if (obj_tlen
< sizeof(struct rsvp_obj_integrity_t
))
1397 obj_ptr
.rsvp_obj_integrity
= (const struct rsvp_obj_integrity_t
*)obj_tptr
;
1398 printf("%s Key-ID 0x%04x%08x, Sequence 0x%08x%08x, Flags [%s]",
1400 EXTRACT_16BITS(obj_ptr
.rsvp_obj_integrity
->key_id
),
1401 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->key_id
+2),
1402 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->sequence
),
1403 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->sequence
+4),
1404 bittok2str(rsvp_obj_integrity_flag_values
,
1406 obj_ptr
.rsvp_obj_integrity
->flags
));
1407 printf("%s MD5-sum 0x%08x%08x%08x%08x (unverified)",
1409 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->digest
),
1410 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->digest
+4),
1411 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->digest
+8),
1412 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->digest
+12));
1413 obj_tlen
+=sizeof(struct rsvp_obj_integrity_t
);
1414 obj_tptr
+=sizeof(struct rsvp_obj_integrity_t
);
1421 case RSVP_OBJ_ADMIN_STATUS
:
1422 switch(rsvp_obj_ctype
) {
1426 printf("%s Flags [%s]", ident
,
1427 bittok2str(rsvp_obj_admin_status_flag_values
, "none",
1428 EXTRACT_32BITS(obj_tptr
)));
1438 * FIXME those are the defined objects that lack a decoder
1439 * you are welcome to contribute code ;-)
1442 case RSVP_OBJ_SCOPE
:
1443 case RSVP_OBJ_POLICY_DATA
:
1444 case RSVP_OBJ_LABEL_SET
:
1445 case RSVP_OBJ_ACCEPT_LABEL_SET
:
1446 case RSVP_OBJ_PROTECTION
:
1449 print_unknown_data(obj_tptr
,"\n\t ",obj_tlen
); /* FIXME indentation */
1452 /* do we also want to see a hex dump ? */
1453 if (vflag
> 1 || hexdump
==TRUE
)
1454 print_unknown_data(tptr
+sizeof(sizeof(struct rsvp_object_header
)),"\n\t ", /* FIXME indentation */
1455 rsvp_obj_len
-sizeof(struct rsvp_object_header
));
1462 printf("\n\t\t packet exceeded snapshot");
1468 rsvp_print(register const u_char
*pptr
, register u_int len
) {
1470 const struct rsvp_common_header
*rsvp_com_header
;
1471 const u_char
*tptr
,*subtptr
;
1472 u_short tlen
,subtlen
;
1476 rsvp_com_header
= (const struct rsvp_common_header
*)pptr
;
1477 TCHECK(*rsvp_com_header
);
1480 * Sanity checking of the header.
1482 if (RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
) != RSVP_VERSION
) {
1483 printf("ERROR: RSVP version %u packet not supported",
1484 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
));
1488 /* in non-verbose mode just lets print the basic Message Type*/
1490 printf("RSVPv%u %s Message, length: %u",
1491 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
),
1492 tok2str(rsvp_msg_type_values
, "unknown (%u)",rsvp_com_header
->msg_type
),
1497 /* ok they seem to want to know everything - lets fully decode it */
1499 tlen
=EXTRACT_16BITS(rsvp_com_header
->length
);
1501 printf("\n\tRSVPv%u %s Message (%u), Flags: [%s], length: %u, ttl: %u, checksum: 0x%04x",
1502 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
),
1503 tok2str(rsvp_msg_type_values
, "unknown, type: %u",rsvp_com_header
->msg_type
),
1504 rsvp_com_header
->msg_type
,
1505 bittok2str(rsvp_header_flag_values
,"none",RSVP_EXTRACT_FLAGS(rsvp_com_header
->version_flags
)),
1507 rsvp_com_header
->ttl
,
1508 EXTRACT_16BITS(rsvp_com_header
->checksum
));
1510 if (tlen
< sizeof(const struct rsvp_common_header
)) {
1511 printf("ERROR: common header too short %u < %lu", tlen
,
1512 (unsigned long)sizeof(const struct rsvp_common_header
));
1516 tptr
+=sizeof(const struct rsvp_common_header
);
1517 tlen
-=sizeof(const struct rsvp_common_header
);
1519 switch(rsvp_com_header
->msg_type
) {
1521 case RSVP_MSGTYPE_AGGREGATE
:
1524 rsvp_com_header
= (const struct rsvp_common_header
*)subtptr
;
1525 TCHECK(*rsvp_com_header
);
1528 * Sanity checking of the header.
1530 if (RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
) != RSVP_VERSION
) {
1531 printf("ERROR: RSVP version %u packet not supported",
1532 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
));
1535 subtlen
=EXTRACT_16BITS(rsvp_com_header
->length
);
1537 printf("\n\t RSVPv%u %s Message (%u), Flags: [%s], length: %u, ttl: %u, checksum: 0x%04x",
1538 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
),
1539 tok2str(rsvp_msg_type_values
, "unknown, type: %u",rsvp_com_header
->msg_type
),
1540 rsvp_com_header
->msg_type
,
1541 bittok2str(rsvp_header_flag_values
,"none",RSVP_EXTRACT_FLAGS(rsvp_com_header
->version_flags
)),
1543 rsvp_com_header
->ttl
,
1544 EXTRACT_16BITS(rsvp_com_header
->checksum
));
1546 if (subtlen
< sizeof(const struct rsvp_common_header
)) {
1547 printf("ERROR: common header too short %u < %lu", subtlen
,
1548 (unsigned long)sizeof(const struct rsvp_common_header
));
1552 if (tlen
< subtlen
) {
1553 printf("ERROR: common header too large %u > %u", subtlen
,
1558 subtptr
+=sizeof(const struct rsvp_common_header
);
1559 subtlen
-=sizeof(const struct rsvp_common_header
);
1561 if (rsvp_obj_print(subtptr
,"\n\t ", subtlen
) == -1)
1564 tptr
+=subtlen
+sizeof(const struct rsvp_common_header
);
1565 tlen
-=subtlen
+sizeof(const struct rsvp_common_header
);
1570 case RSVP_MSGTYPE_PATH
:
1571 case RSVP_MSGTYPE_RESV
:
1572 case RSVP_MSGTYPE_PATHERR
:
1573 case RSVP_MSGTYPE_RESVERR
:
1574 case RSVP_MSGTYPE_PATHTEAR
:
1575 case RSVP_MSGTYPE_RESVTEAR
:
1576 case RSVP_MSGTYPE_RESVCONF
:
1577 case RSVP_MSGTYPE_HELLO_OLD
:
1578 case RSVP_MSGTYPE_HELLO
:
1579 case RSVP_MSGTYPE_ACK
:
1580 case RSVP_MSGTYPE_SREFRESH
:
1581 if (rsvp_obj_print(tptr
,"\n\t ", tlen
) == -1)
1586 print_unknown_data(tptr
,"\n\t ",tlen
);
1592 printf("\n\t\t packet exceeded snapshot");