2 * Redistribution and use in source and binary forms, with or without
3 * modification, are permitted provided that: (1) source code
4 * distributions retain the above copyright notice and this paragraph
5 * in its entirety, and (2) distributions including binary code include
6 * the above copyright notice and this paragraph in its entirety in
7 * the documentation or other materials provided with the distribution.
8 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND
9 * WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
10 * LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
11 * FOR A PARTICULAR PURPOSE.
13 * Original code by Hannes Gredler (hannes@juniper.net)
17 static const char rcsid
[] _U_
=
18 "@(#) $Header: /tcpdump/master/tcpdump/print-rsvp.c,v 1.32 2004-09-16 09:02:43 hannes Exp $";
25 #include <tcpdump-stdinc.h>
31 #include "interface.h"
33 #include "addrtoname.h"
34 #include "ethertype.h"
38 * RFC 2205 common header
41 * +-------------+-------------+-------------+-------------+
42 * | Vers | Flags| Msg Type | RSVP Checksum |
43 * +-------------+-------------+-------------+-------------+
44 * | Send_TTL | (Reserved) | RSVP Length |
45 * +-------------+-------------+-------------+-------------+
49 struct rsvp_common_header
{
50 u_int8_t version_flags
;
59 * RFC2205 object header
63 * +-------------+-------------+-------------+-------------+
64 * | Length (bytes) | Class-Num | C-Type |
65 * +-------------+-------------+-------------+-------------+
67 * // (Object contents) //
69 * +-------------+-------------+-------------+-------------+
72 struct rsvp_object_header
{
78 #define RSVP_VERSION 1
79 #define RSVP_EXTRACT_VERSION(x) (((x)&0xf0)>>4)
80 #define RSVP_EXTRACT_FLAGS(x) ((x)&0x0f)
82 #define RSVP_MSGTYPE_PATH 1
83 #define RSVP_MSGTYPE_RESV 2
84 #define RSVP_MSGTYPE_PATHERR 3
85 #define RSVP_MSGTYPE_RESVERR 4
86 #define RSVP_MSGTYPE_PATHTEAR 5
87 #define RSVP_MSGTYPE_RESVTEAR 6
88 #define RSVP_MSGTYPE_RESVCONF 7
89 #define RSVP_MSGTYPE_AGGREGATE 12
90 #define RSVP_MSGTYPE_ACK 13
91 #define RSVP_MSGTYPE_HELLO_OLD 14 /* ancient Hellos */
92 #define RSVP_MSGTYPE_SREFRESH 15
93 #define RSVP_MSGTYPE_HELLO 20
95 static const struct tok rsvp_msg_type_values
[] = {
96 { RSVP_MSGTYPE_PATH
, "Path" },
97 { RSVP_MSGTYPE_RESV
, "Resv" },
98 { RSVP_MSGTYPE_PATHERR
, "PathErr" },
99 { RSVP_MSGTYPE_RESVERR
, "ResvErr" },
100 { RSVP_MSGTYPE_PATHTEAR
, "PathTear" },
101 { RSVP_MSGTYPE_RESVTEAR
, "ResvTear" },
102 { RSVP_MSGTYPE_RESVCONF
, "ResvConf" },
103 { RSVP_MSGTYPE_AGGREGATE
, "Aggregate" },
104 { RSVP_MSGTYPE_ACK
, "Acknowledgement" },
105 { RSVP_MSGTYPE_HELLO_OLD
, "Hello (Old)" },
106 { RSVP_MSGTYPE_SREFRESH
, "Refresh" },
107 { RSVP_MSGTYPE_HELLO
, "Hello" },
111 static const struct tok rsvp_header_flag_values
[] = {
112 { 0x01, "Refresh reduction capable" }, /* rfc2961 */
116 #define RSVP_OBJ_SESSION 1 /* rfc2205 */
117 #define RSVP_OBJ_RSVP_HOP 3 /* rfc2205, rfc3473 */
118 #define RSVP_OBJ_INTEGRITY 4
119 #define RSVP_OBJ_TIME_VALUES 5 /* rfc2205 */
120 #define RSVP_OBJ_ERROR_SPEC 6
121 #define RSVP_OBJ_SCOPE 7
122 #define RSVP_OBJ_STYLE 8 /* rfc2205 */
123 #define RSVP_OBJ_FLOWSPEC 9 /* rfc2215 */
124 #define RSVP_OBJ_FILTERSPEC 10 /* rfc2215 */
125 #define RSVP_OBJ_SENDER_TEMPLATE 11
126 #define RSVP_OBJ_SENDER_TSPEC 12 /* rfc2215 */
127 #define RSVP_OBJ_ADSPEC 13 /* rfc2215 */
128 #define RSVP_OBJ_POLICY_DATA 14
129 #define RSVP_OBJ_CONFIRM 15 /* rfc2205 */
130 #define RSVP_OBJ_LABEL 16 /* rfc3209 */
131 #define RSVP_OBJ_LABEL_REQ 19 /* rfc3209 */
132 #define RSVP_OBJ_ERO 20 /* rfc3209 */
133 #define RSVP_OBJ_RRO 21 /* rfc3209 */
134 #define RSVP_OBJ_HELLO 22 /* rfc3209 */
135 #define RSVP_OBJ_MESSAGE_ID 23
136 #define RSVP_OBJ_MESSAGE_ID_ACK 24
137 #define RSVP_OBJ_MESSAGE_ID_LIST 25
138 #define RSVP_OBJ_RECOVERY_LABEL 34 /* rfc3473 */
139 #define RSVP_OBJ_UPSTREAM_LABEL 35 /* rfc3473 */
140 #define RSVP_OBJ_LABEL_SET 36 /* rfc3473 */
141 #define RSVP_OBJ_PROTECTION 37 /* rfc3473 */
142 #define RSVP_OBJ_DETOUR 63 /* draft-ietf-mpls-rsvp-lsp-fastreroute-01 */
143 #define RSVP_OBJ_CLASSTYPE 125 /* draft-ietf-tewg-diff-te-proto-07 */
144 #define RSVP_OBJ_SUGGESTED_LABEL 129 /* rfc3473 */
145 #define RSVP_OBJ_ACCEPT_LABEL_SET 130 /* rfc3473 */
146 #define RSVP_OBJ_RESTART_CAPABILITY 131 /* rfc3473 */
147 #define RSVP_OBJ_NOTIFY_REQ 195 /* rfc3473 */
148 #define RSVP_OBJ_ADMIN_STATUS 196 /* rfc3473 */
149 #define RSVP_OBJ_PROPERTIES 204 /* juniper proprietary */
150 #define RSVP_OBJ_FASTREROUTE 205 /* draft-ietf-mpls-rsvp-lsp-fastreroute-01 */
151 #define RSVP_OBJ_SESSION_ATTRIBUTE 207 /* rfc3209 */
152 #define RSVP_OBJ_CALL_ID 230 /* rfc3474 */
153 #define RSVP_OBJ_CALL_OPS 236 /* rfc3474 */
155 static const struct tok rsvp_obj_values
[] = {
156 { RSVP_OBJ_SESSION
, "Session" },
157 { RSVP_OBJ_RSVP_HOP
, "RSVP Hop" },
158 { RSVP_OBJ_INTEGRITY
, "Integrity" },
159 { RSVP_OBJ_TIME_VALUES
, "Time Values" },
160 { RSVP_OBJ_ERROR_SPEC
, "Error Spec" },
161 { RSVP_OBJ_SCOPE
, "Scope" },
162 { RSVP_OBJ_STYLE
, "Style" },
163 { RSVP_OBJ_FLOWSPEC
, "Flowspec" },
164 { RSVP_OBJ_FILTERSPEC
, "FilterSpec" },
165 { RSVP_OBJ_SENDER_TEMPLATE
, "Sender Template" },
166 { RSVP_OBJ_SENDER_TSPEC
, "Sender TSpec" },
167 { RSVP_OBJ_ADSPEC
, "Adspec" },
168 { RSVP_OBJ_POLICY_DATA
, "Policy Data" },
169 { RSVP_OBJ_CONFIRM
, "Confirm" },
170 { RSVP_OBJ_LABEL
, "Label" },
171 { RSVP_OBJ_LABEL_REQ
, "Label Request" },
172 { RSVP_OBJ_ERO
, "ERO" },
173 { RSVP_OBJ_RRO
, "RRO" },
174 { RSVP_OBJ_HELLO
, "Hello" },
175 { RSVP_OBJ_MESSAGE_ID
, "Message ID" },
176 { RSVP_OBJ_MESSAGE_ID_ACK
, "Message ID Ack" },
177 { RSVP_OBJ_MESSAGE_ID_LIST
, "Message ID List" },
178 { RSVP_OBJ_RECOVERY_LABEL
, "Recovery Label" },
179 { RSVP_OBJ_UPSTREAM_LABEL
, "Upstream Label" },
180 { RSVP_OBJ_LABEL_SET
, "Label Set" },
181 { RSVP_OBJ_ACCEPT_LABEL_SET
, "Acceptable Label Set" },
182 { RSVP_OBJ_DETOUR
, "Detour" },
183 { RSVP_OBJ_CLASSTYPE
, "Class Type" },
184 { RSVP_OBJ_SUGGESTED_LABEL
, "Suggested Label" },
185 { RSVP_OBJ_PROPERTIES
, "Properties" },
186 { RSVP_OBJ_FASTREROUTE
, "Fast Re-Route" },
187 { RSVP_OBJ_SESSION_ATTRIBUTE
, "Session Attribute" },
188 { RSVP_OBJ_CALL_ID
, "Call-ID" },
189 { RSVP_OBJ_CALL_OPS
, "Call Capability" },
190 { RSVP_OBJ_RESTART_CAPABILITY
, "Restart Capability" },
191 { RSVP_OBJ_NOTIFY_REQ
, "Notify Request" },
192 { RSVP_OBJ_PROTECTION
, "Protection" },
193 { RSVP_OBJ_ADMIN_STATUS
, "Administrative Status" },
197 #define RSVP_CTYPE_IPV4 1
198 #define RSVP_CTYPE_IPV6 2
199 #define RSVP_CTYPE_TUNNEL_IPV4 7
200 #define RSVP_CTYPE_TUNNEL_IPV6 8
201 #define RSVP_CTYPE_1 1
202 #define RSVP_CTYPE_2 2
203 #define RSVP_CTYPE_3 3
204 #define RSVP_CTYPE_4 4
207 * the ctypes are not globally unique so for
208 * translating it to strings we build a table based
209 * on objects offsetted by the ctype
212 static const struct tok rsvp_ctype_values
[] = {
213 { 256*RSVP_OBJ_RSVP_HOP
+RSVP_CTYPE_IPV4
, "IPv4" },
214 { 256*RSVP_OBJ_RSVP_HOP
+RSVP_CTYPE_IPV6
, "IPv6" },
215 { 256*RSVP_OBJ_RSVP_HOP
+RSVP_CTYPE_3
, "IPv4 plus opt. TLVs" },
216 { 256*RSVP_OBJ_RSVP_HOP
+RSVP_CTYPE_4
, "IPv6 plus opt. TLVs" },
217 { 256*RSVP_OBJ_NOTIFY_REQ
+RSVP_CTYPE_IPV4
, "IPv4" },
218 { 256*RSVP_OBJ_NOTIFY_REQ
+RSVP_CTYPE_IPV6
, "IPv6" },
219 { 256*RSVP_OBJ_CONFIRM
+RSVP_CTYPE_IPV4
, "IPv4" },
220 { 256*RSVP_OBJ_CONFIRM
+RSVP_CTYPE_IPV6
, "IPv6" },
221 { 256*RSVP_OBJ_TIME_VALUES
+RSVP_CTYPE_1
, "1" },
222 { 256*RSVP_OBJ_FLOWSPEC
+RSVP_CTYPE_1
, "obsolete" },
223 { 256*RSVP_OBJ_FLOWSPEC
+RSVP_CTYPE_2
, "IntServ" },
224 { 256*RSVP_OBJ_SENDER_TSPEC
+RSVP_CTYPE_2
, "IntServ" },
225 { 256*RSVP_OBJ_ADSPEC
+RSVP_CTYPE_2
, "IntServ" },
226 { 256*RSVP_OBJ_FILTERSPEC
+RSVP_CTYPE_IPV4
, "IPv4" },
227 { 256*RSVP_OBJ_FILTERSPEC
+RSVP_CTYPE_IPV6
, "IPv6" },
228 { 256*RSVP_OBJ_FILTERSPEC
+RSVP_CTYPE_3
, "IPv6 Flow-label" },
229 { 256*RSVP_OBJ_FILTERSPEC
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
230 { 256*RSVP_OBJ_SESSION
+RSVP_CTYPE_IPV4
, "IPv4" },
231 { 256*RSVP_OBJ_SESSION
+RSVP_CTYPE_IPV6
, "IPv6" },
232 { 256*RSVP_OBJ_SESSION
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
233 { 256*RSVP_OBJ_SENDER_TEMPLATE
+RSVP_CTYPE_IPV4
, "IPv4" },
234 { 256*RSVP_OBJ_SENDER_TEMPLATE
+RSVP_CTYPE_IPV6
, "IPv6" },
235 { 256*RSVP_OBJ_SENDER_TEMPLATE
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
236 { 256*RSVP_OBJ_MESSAGE_ID
+RSVP_CTYPE_1
, "1" },
237 { 256*RSVP_OBJ_MESSAGE_ID_ACK
+RSVP_CTYPE_1
, "1" },
238 { 256*RSVP_OBJ_MESSAGE_ID_LIST
+RSVP_CTYPE_1
, "1" },
239 { 256*RSVP_OBJ_STYLE
+RSVP_CTYPE_1
, "1" },
240 { 256*RSVP_OBJ_HELLO
+RSVP_CTYPE_1
, "Hello Request" },
241 { 256*RSVP_OBJ_HELLO
+RSVP_CTYPE_2
, "Hello Ack" },
242 { 256*RSVP_OBJ_LABEL_REQ
+RSVP_CTYPE_1
, "without label range" },
243 { 256*RSVP_OBJ_LABEL_REQ
+RSVP_CTYPE_2
, "with ATM label range" },
244 { 256*RSVP_OBJ_LABEL_REQ
+RSVP_CTYPE_3
, "with FR label range" },
245 { 256*RSVP_OBJ_LABEL_REQ
+RSVP_CTYPE_4
, "Generalized Label" },
246 { 256*RSVP_OBJ_LABEL
+RSVP_CTYPE_1
, "Label" },
247 { 256*RSVP_OBJ_LABEL
+RSVP_CTYPE_2
, "Generalized Label" },
248 { 256*RSVP_OBJ_LABEL
+RSVP_CTYPE_3
, "Waveband Switching" },
249 { 256*RSVP_OBJ_SUGGESTED_LABEL
+RSVP_CTYPE_1
, "Label" },
250 { 256*RSVP_OBJ_SUGGESTED_LABEL
+RSVP_CTYPE_2
, "Generalized Label" },
251 { 256*RSVP_OBJ_SUGGESTED_LABEL
+RSVP_CTYPE_3
, "Waveband Switching" },
252 { 256*RSVP_OBJ_UPSTREAM_LABEL
+RSVP_CTYPE_1
, "Label" },
253 { 256*RSVP_OBJ_UPSTREAM_LABEL
+RSVP_CTYPE_2
, "Generalized Label" },
254 { 256*RSVP_OBJ_UPSTREAM_LABEL
+RSVP_CTYPE_3
, "Waveband Switching" },
255 { 256*RSVP_OBJ_RECOVERY_LABEL
+RSVP_CTYPE_1
, "Label" },
256 { 256*RSVP_OBJ_RECOVERY_LABEL
+RSVP_CTYPE_2
, "Generalized Label" },
257 { 256*RSVP_OBJ_RECOVERY_LABEL
+RSVP_CTYPE_3
, "Waveband Switching" },
258 { 256*RSVP_OBJ_ERO
+RSVP_CTYPE_IPV4
, "IPv4" },
259 { 256*RSVP_OBJ_RRO
+RSVP_CTYPE_IPV4
, "IPv4" },
260 { 256*RSVP_OBJ_ERROR_SPEC
+RSVP_CTYPE_IPV4
, "IPv4" },
261 { 256*RSVP_OBJ_ERROR_SPEC
+RSVP_CTYPE_IPV6
, "IPv6" },
262 { 256*RSVP_OBJ_ERROR_SPEC
+RSVP_CTYPE_3
, "IPv4 plus opt. TLVs" },
263 { 256*RSVP_OBJ_ERROR_SPEC
+RSVP_CTYPE_4
, "IPv6 plus opt. TLVs" },
264 { 256*RSVP_OBJ_RESTART_CAPABILITY
+RSVP_CTYPE_1
, "IPv4" },
265 { 256*RSVP_OBJ_SESSION_ATTRIBUTE
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
266 { 256*RSVP_OBJ_FASTREROUTE
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
267 { 256*RSVP_OBJ_DETOUR
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
268 { 256*RSVP_OBJ_PROPERTIES
+RSVP_CTYPE_1
, "1" },
269 { 256*RSVP_OBJ_CLASSTYPE
+RSVP_CTYPE_1
, "1" },
273 #define RSVP_OBJ_XRO_MASK_SUBOBJ(x) ((x)&0x7f)
274 #define RSVP_OBJ_XRO_MASK_LOOSE(x) ((x)&0x80)
276 #define RSVP_OBJ_XRO_RES 0
277 #define RSVP_OBJ_XRO_IPV4 1
278 #define RSVP_OBJ_XRO_IPV6 2
279 #define RSVP_OBJ_XRO_ASN 32
280 #define RSVP_OBJ_XRO_MPLS 64
282 static const struct tok rsvp_obj_xro_values
[] = {
283 { RSVP_OBJ_XRO_RES
, "Reserved" },
284 { RSVP_OBJ_XRO_IPV4
, "IPv4 prefix" },
285 { RSVP_OBJ_XRO_IPV6
, "IPv6 prefix" },
286 { RSVP_OBJ_XRO_ASN
, "Autonomous system number" },
287 { RSVP_OBJ_XRO_MPLS
, "MPLS label switched path termination" },
291 /* draft-ietf-mpls-rsvp-lsp-fastreroute-02.txt */
292 static const struct tok rsvp_obj_rro_flag_values
[] = {
293 { 0x01, "Local protection available" },
294 { 0x02, "Local protection in use" },
295 { 0x04, "Bandwidth protection" },
296 { 0x08, "Node protection" },
300 static const struct tok rsvp_resstyle_values
[] = {
301 { 17, "Wildcard Filter" },
302 { 10, "Fixed Filter" },
303 { 18, "Shared Explicit" },
307 #define RSVP_OBJ_INTSERV_GUARANTEED_SERV 2
308 #define RSVP_OBJ_INTSERV_CONTROLLED_LOAD 5
310 static const struct tok rsvp_intserv_service_type_values
[] = {
311 { 1, "Default/Global Information" },
312 { RSVP_OBJ_INTSERV_GUARANTEED_SERV
, "Guaranteed Service" },
313 { RSVP_OBJ_INTSERV_CONTROLLED_LOAD
, "Controlled Load" },
317 static const struct tok rsvp_intserv_parameter_id_values
[] = {
319 { 6, "Path b/w estimate" },
320 { 8, "Minimum path latency" },
321 { 10, "Composed MTU" },
322 { 127, "Token Bucket TSpec" },
323 { 130, "Guaranteed Service RSpec" },
324 { 133, "End-to-end composed value for C" },
325 { 134, "End-to-end composed value for D" },
326 { 135, "Since-last-reshaping point composed C" },
327 { 136, "Since-last-reshaping point composed D" },
331 static struct tok rsvp_session_attribute_flag_values
[] = {
332 { 0x01, "Local Protection desired" },
333 { 0x02, "Label Recording desired" },
334 { 0x04, "SE Style desired" },
335 { 0x08, "Bandwidth protection desired" }, /* draft-ietf-mpls-rsvp-lsp-fastreroute-02.txt */
336 { 0x10, "Node protection desired" }, /* draft-ietf-mpls-rsvp-lsp-fastreroute-02.txt */
340 static struct tok rsvp_obj_prop_tlv_values
[] = {
342 { 0x02, "Metric 1" },
343 { 0x04, "Metric 2" },
344 { 0x08, "CCC Status" },
345 { 0x10, "Path Type" },
349 #define RSVP_OBJ_ERROR_SPEC_CODE_ROUTING 24
350 #define RSVP_OBJ_ERROR_SPEC_CODE_NOTIFY 25
351 #define RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE 125
353 static struct tok rsvp_obj_error_code_values
[] = {
354 { RSVP_OBJ_ERROR_SPEC_CODE_ROUTING
, "Routing Problem" },
355 { RSVP_OBJ_ERROR_SPEC_CODE_NOTIFY
, "Notify Error" },
356 { RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE
, "Diffserv TE Error" },
360 static struct tok rsvp_obj_error_code_routing_values
[] = {
361 { 1, "Bad EXPLICIT_ROUTE object" },
362 { 2, "Bad strict node" },
363 { 3, "Bad loose node" },
364 { 4, "Bad initial subobject" },
365 { 5, "No route available toward destination" },
366 { 6, "Unacceptable label value" },
367 { 7, "RRO indicated routing loops" },
368 { 8, "non-RSVP-capable router in the path" },
369 { 9, "MPLS label allocation failure" },
370 { 10, "Unsupported L3PID" },
374 static struct tok rsvp_obj_error_code_diffserv_te_values
[] = {
375 { 1, "Unexpected CLASSTYPE object" },
376 { 2, "Unsupported Class-Type" },
377 { 3, "Invalid Class-Type value" },
378 { 4, "Class-Type and setup priority do not form a configured TE-Class" },
379 { 5, "Class-Type and holding priority do not form a configured TE-Class" },
380 { 6, "Inconsistency between signaled PSC and signaled Class-Type" },
381 { 7, "Inconsistency between signaled PHBs and signaled Class-Type" },
389 static int rsvp_intserv_print(const u_char
*, u_short
);
392 * this is a dissector for all the intserv defined
393 * specs as defined per rfc2215
394 * it is called from various rsvp objects;
395 * returns the amount of bytes being processed
398 rsvp_intserv_print(const u_char
*tptr
, u_short obj_tlen
) {
400 int parameter_id
,parameter_length
;
408 parameter_id
= *(tptr
);
409 parameter_length
= EXTRACT_16BITS(tptr
+2)<<2; /* convert wordcount to bytecount */
411 printf("\n\t Parameter ID: %s (%u), length: %u, Flags: [0x%02x]",
412 tok2str(rsvp_intserv_parameter_id_values
,"unknown",parameter_id
),
417 if (obj_tlen
< parameter_length
+4)
419 switch(parameter_id
) { /* parameter_id */
423 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
424 * | 4 (e) | (f) | 1 (g) |
425 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
426 * | IS hop cnt (32-bit unsigned integer) |
427 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
429 if (parameter_length
== 4)
430 printf("\n\t\tIS hop count: %u", EXTRACT_32BITS(tptr
+4));
435 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
436 * | 6 (h) | (i) | 1 (j) |
437 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
438 * | Path b/w estimate (32-bit IEEE floating point number) |
439 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
441 if (parameter_length
== 4) {
442 bw
.i
= EXTRACT_32BITS(tptr
+4);
443 printf("\n\t\tPath b/w estimate: %.10g Mbps", bw
.f
/125000);
449 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
450 * | 8 (k) | (l) | 1 (m) |
451 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
452 * | Minimum path latency (32-bit integer) |
453 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
455 if (parameter_length
== 4) {
456 printf("\n\t\tMinimum path latency: ");
457 if (EXTRACT_32BITS(tptr
+4) == 0xffffffff)
458 printf("don't care");
460 printf("%u", EXTRACT_32BITS(tptr
+4));
467 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
468 * | 10 (n) | (o) | 1 (p) |
469 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
470 * | Composed MTU (32-bit unsigned integer) |
471 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
473 if (parameter_length
== 4)
474 printf("\n\t\tComposed MTU: %u bytes", EXTRACT_32BITS(tptr
+4));
478 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
479 * | 127 (e) | 0 (f) | 5 (g) |
480 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
481 * | Token Bucket Rate [r] (32-bit IEEE floating point number) |
482 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
483 * | Token Bucket Size [b] (32-bit IEEE floating point number) |
484 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
485 * | Peak Data Rate [p] (32-bit IEEE floating point number) |
486 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
487 * | Minimum Policed Unit [m] (32-bit integer) |
488 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
489 * | Maximum Packet Size [M] (32-bit integer) |
490 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
493 if (parameter_length
== 20) {
494 bw
.i
= EXTRACT_32BITS(tptr
+4);
495 printf("\n\t\tToken Bucket Rate: %.10g Mbps", bw
.f
/125000);
496 bw
.i
= EXTRACT_32BITS(tptr
+8);
497 printf("\n\t\tToken Bucket Size: %.10g bytes", bw
.f
);
498 bw
.i
= EXTRACT_32BITS(tptr
+12);
499 printf("\n\t\tPeak Data Rate: %.10g Mbps", bw
.f
/125000);
500 printf("\n\t\tMinimum Policed Unit: %u bytes", EXTRACT_32BITS(tptr
+16));
501 printf("\n\t\tMaximum Packet Size: %u bytes", EXTRACT_32BITS(tptr
+20));
507 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
508 * | 130 (h) | 0 (i) | 2 (j) |
509 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
510 * | Rate [R] (32-bit IEEE floating point number) |
511 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
512 * | Slack Term [S] (32-bit integer) |
513 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
516 if (parameter_length
== 8) {
517 bw
.i
= EXTRACT_32BITS(tptr
+4);
518 printf("\n\t\tRate: %.10g Mbps", bw
.f
/125000);
519 printf("\n\t\tSlack Term: %u", EXTRACT_32BITS(tptr
+8));
527 if (parameter_length
== 4)
528 printf("\n\t\tValue: %u", EXTRACT_32BITS(tptr
+4));
533 print_unknown_data(tptr
+4,"\n\t\t",parameter_length
);
535 return (parameter_length
+4); /* header length 4 bytes */
539 rsvp_obj_print (const u_char
*tptr
, const char *ident
, u_int tlen
) {
541 const struct rsvp_object_header
*rsvp_obj_header
;
542 const u_char
*obj_tptr
;
543 u_short rsvp_obj_len
,rsvp_obj_ctype
,obj_tlen
,intserv_serv_tlen
;
544 int hexdump
,processed
,padbytes
,error_code
,error_value
,i
;
552 /* did we capture enough for fully decoding the object header ? */
553 if (!TTEST2(*tptr
, sizeof(struct rsvp_object_header
)))
556 rsvp_obj_header
= (const struct rsvp_object_header
*)tptr
;
557 rsvp_obj_len
=EXTRACT_16BITS(rsvp_obj_header
->length
);
558 rsvp_obj_ctype
=rsvp_obj_header
->ctype
;
560 if(rsvp_obj_len
% 4 || rsvp_obj_len
< sizeof(struct rsvp_object_header
)) {
561 printf("ERROR: object header too short %u < %lu", rsvp_obj_len
,
562 (unsigned long)sizeof(const struct rsvp_object_header
));
566 printf("%s%s Object (%u) Flags: [%s",
568 tok2str(rsvp_obj_values
,
570 rsvp_obj_header
->class_num
),
571 rsvp_obj_header
->class_num
,
572 ((rsvp_obj_header
->class_num
)&0x80) ? "ignore" : "reject");
574 if (rsvp_obj_header
->class_num
> 128)
576 ((rsvp_obj_header
->class_num
)&0x40) ? "and forward" : "silently");
578 printf(" if unknown], Class-Type: %s (%u), length: %u",
579 tok2str(rsvp_ctype_values
,
581 ((rsvp_obj_header
->class_num
)<<8)+rsvp_obj_ctype
),
585 obj_tptr
=tptr
+sizeof(struct rsvp_object_header
);
586 obj_tlen
=rsvp_obj_len
-sizeof(struct rsvp_object_header
);
588 /* did we capture enough for fully decoding the object ? */
589 if (!TTEST2(*tptr
, rsvp_obj_len
))
593 switch(rsvp_obj_header
->class_num
) {
594 case RSVP_OBJ_SESSION
:
595 switch(rsvp_obj_ctype
) {
596 case RSVP_CTYPE_IPV4
:
599 printf("%s IPv4 DestAddress: %s, Protocol ID: 0x%02x",
601 ipaddr_string(obj_tptr
),
603 printf("%s Flags: [0x%02x], DestPort %u",
606 EXTRACT_16BITS(obj_tptr
+6));
611 case RSVP_CTYPE_IPV6
:
614 printf("%s IPv6 DestAddress: %s, Protocol ID: 0x%02x",
616 ip6addr_string(obj_tptr
),
618 printf("%s Flags: [0x%02x], DestPort %u",
621 EXTRACT_16BITS(obj_tptr
+18));
626 case RSVP_CTYPE_TUNNEL_IPV6
:
629 printf("%s IPv6 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
631 ip6addr_string(obj_tptr
),
632 EXTRACT_16BITS(obj_tptr
+18),
633 ip6addr_string(obj_tptr
+20));
638 case RSVP_CTYPE_TUNNEL_IPV4
:
641 printf("%s IPv4 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
643 ipaddr_string(obj_tptr
),
644 EXTRACT_16BITS(obj_tptr
+6),
645 ipaddr_string(obj_tptr
+8));
654 case RSVP_OBJ_CONFIRM
:
655 switch(rsvp_obj_ctype
) {
656 case RSVP_CTYPE_IPV4
:
659 printf("%s IPv4 Receiver Address: %s",
661 ipaddr_string(obj_tptr
));
666 case RSVP_CTYPE_IPV6
:
669 printf("%s IPv6 Receiver Address: %s",
671 ip6addr_string(obj_tptr
));
681 case RSVP_OBJ_NOTIFY_REQ
:
682 switch(rsvp_obj_ctype
) {
683 case RSVP_CTYPE_IPV4
:
686 printf("%s IPv4 Notify Node Address: %s",
688 ipaddr_string(obj_tptr
));
693 case RSVP_CTYPE_IPV6
:
696 printf("%s IPv6 Notify Node Address: %s",
698 ip6addr_string(obj_tptr
));
708 case RSVP_OBJ_SUGGESTED_LABEL
: /* fall through */
709 case RSVP_OBJ_UPSTREAM_LABEL
: /* fall through */
710 case RSVP_OBJ_RECOVERY_LABEL
: /* fall through */
712 switch(rsvp_obj_ctype
) {
714 while(obj_tlen
>= 4 ) {
715 printf("%s Label: %u", ident
, EXTRACT_32BITS(obj_tptr
));
723 printf("%s Generalized Label: %u",
725 EXTRACT_32BITS(obj_tptr
));
732 printf("%s Waveband ID: %u%s Start Label: %u, Stop Label: %u",
734 EXTRACT_32BITS(obj_tptr
),
736 EXTRACT_32BITS(obj_tptr
+4),
737 EXTRACT_32BITS(obj_tptr
+8));
747 switch(rsvp_obj_ctype
) {
751 printf("%s Reservation Style: %s, Flags: [0x%02x]",
753 tok2str(rsvp_resstyle_values
,
755 EXTRACT_24BITS(obj_tptr
+1)),
765 case RSVP_OBJ_SENDER_TEMPLATE
:
766 switch(rsvp_obj_ctype
) {
767 case RSVP_CTYPE_IPV4
:
770 printf("%s Source Address: %s, Source Port: %u",
772 ipaddr_string(obj_tptr
),
773 EXTRACT_16BITS(obj_tptr
+6));
778 case RSVP_CTYPE_IPV6
:
781 printf("%s Source Address: %s, Source Port: %u",
783 ip6addr_string(obj_tptr
),
784 EXTRACT_16BITS(obj_tptr
+18));
789 case RSVP_CTYPE_TUNNEL_IPV4
:
792 printf("%s IPv4 Tunnel Sender Address: %s, LSP-ID: 0x%04x",
794 ipaddr_string(obj_tptr
),
795 EXTRACT_16BITS(obj_tptr
+6));
804 case RSVP_OBJ_LABEL_REQ
:
805 switch(rsvp_obj_ctype
) {
807 while(obj_tlen
>= 4 ) {
808 printf("%s L3 Protocol ID: %s",
810 tok2str(ethertype_values
,
811 "Unknown Protocol (0x%04x)",
812 EXTRACT_16BITS(obj_tptr
+2)));
820 printf("%s L3 Protocol ID: %s",
822 tok2str(ethertype_values
,
823 "Unknown Protocol (0x%04x)",
824 EXTRACT_16BITS(obj_tptr
+2)));
825 printf(",%s merge capability",((*(obj_tptr
+4))&0x80) ? "no" : "" );
826 printf("%s Minimum VPI/VCI: %u/%u",
828 (EXTRACT_16BITS(obj_tptr
+4))&0xfff,
829 (EXTRACT_16BITS(obj_tptr
+6))&0xfff);
830 printf("%s Maximum VPI/VCI: %u/%u",
832 (EXTRACT_16BITS(obj_tptr
+8))&0xfff,
833 (EXTRACT_16BITS(obj_tptr
+10))&0xfff);
840 printf("%s L3 Protocol ID: %s",
842 tok2str(ethertype_values
,
843 "Unknown Protocol (0x%04x)",
844 EXTRACT_16BITS(obj_tptr
+2)));
845 printf("%s Minimum/Maximum DLCI: %u/%u, %s%s bit DLCI",
847 (EXTRACT_32BITS(obj_tptr
+4))&0x7fffff,
848 (EXTRACT_32BITS(obj_tptr
+8))&0x7fffff,
849 (((EXTRACT_16BITS(obj_tptr
+4)>>7)&3) == 0 ) ? "10" : "",
850 (((EXTRACT_16BITS(obj_tptr
+4)>>7)&3) == 2 ) ? "23" : "");
857 printf("%s LSP Encoding Type: %s (%u)",
859 tok2str(gmpls_encoding_values
,
863 printf("%s Switching Type: %s (%u), Payload ID: %s (0x%04x)",
865 tok2str(gmpls_switch_cap_values
,
869 tok2str(gmpls_payload_values
,
871 EXTRACT_16BITS(obj_tptr
+2)),
872 EXTRACT_16BITS(obj_tptr
+2));
883 switch(rsvp_obj_ctype
) {
884 case RSVP_CTYPE_IPV4
:
885 while(obj_tlen
>= 4 ) {
886 printf("%s Subobject Type: %s",
888 tok2str(rsvp_obj_xro_values
,
890 RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr
)));
891 switch(RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr
)) {
892 case RSVP_OBJ_XRO_IPV4
:
893 printf(", %s, %s/%u, Flags: [%s]",
894 RSVP_OBJ_XRO_MASK_LOOSE(*obj_tptr
) ? "Loose" : "Strict",
895 ipaddr_string(obj_tptr
+2),
897 bittok2str(rsvp_obj_rro_flag_values
,
899 *(obj_tptr
+7))); /* rfc3209 says that this field is rsvd. */
901 obj_tlen
-=*(obj_tptr
+1);
902 obj_tptr
+=*(obj_tptr
+1);
911 switch(rsvp_obj_ctype
) {
916 printf("%s Source Instance: 0x%08x, Destination Instance: 0x%08x",
918 EXTRACT_32BITS(obj_tptr
),
919 EXTRACT_32BITS(obj_tptr
+4));
928 case RSVP_OBJ_RESTART_CAPABILITY
:
929 switch(rsvp_obj_ctype
) {
933 printf("%s Restart Time: %ums, Recovery Time: %ums",
935 EXTRACT_16BITS(obj_tptr
),
936 EXTRACT_16BITS(obj_tptr
+4));
945 case RSVP_OBJ_SESSION_ATTRIBUTE
:
946 switch(rsvp_obj_ctype
) {
947 case RSVP_CTYPE_TUNNEL_IPV4
:
950 namelen
= *(obj_tptr
+3);
951 if (obj_tlen
< 4+namelen
)
953 printf("%s Session Name: ", ident
);
954 for (i
= 0; i
< namelen
; i
++)
955 safeputchar(*(obj_tptr
+4+i
));
956 printf("%s Setup Priority: %u, Holding Priority: %u, Flags: [%s]",
960 tok2str(rsvp_session_attribute_flag_values
,
964 obj_tlen
-=4+*(obj_tptr
+3);
965 obj_tptr
+=4+*(obj_tptr
+3);
972 case RSVP_OBJ_RSVP_HOP
:
973 switch(rsvp_obj_ctype
) {
974 case RSVP_CTYPE_3
: /* fall through - FIXME add TLV parser */
975 case RSVP_CTYPE_IPV4
:
978 printf("%s Previous/Next Interface: %s, Logical Interface Handle: 0x%08x",
980 ipaddr_string(obj_tptr
),
981 EXTRACT_32BITS(obj_tptr
+4));
984 hexdump
=TRUE
; /* unless we have a TLV parser lets just hexdump */
987 case RSVP_CTYPE_4
: /* fall through - FIXME add TLV parser */
988 case RSVP_CTYPE_IPV6
:
991 printf("%s Previous/Next Interface: %s, Logical Interface Handle: 0x%08x",
993 ip6addr_string(obj_tptr
),
994 EXTRACT_32BITS(obj_tptr
+16));
997 hexdump
=TRUE
; /* unless we have a TLV parser lets just hexdump */
1005 case RSVP_OBJ_TIME_VALUES
:
1006 switch(rsvp_obj_ctype
) {
1010 printf("%s Refresh Period: %ums",
1012 EXTRACT_32BITS(obj_tptr
));
1021 /* those three objects do share the same semantics */
1022 case RSVP_OBJ_SENDER_TSPEC
:
1023 case RSVP_OBJ_ADSPEC
:
1024 case RSVP_OBJ_FLOWSPEC
:
1025 switch(rsvp_obj_ctype
) {
1029 printf("%s Msg-Version: %u, length: %u",
1031 (*obj_tptr
& 0xf0) >> 4,
1032 EXTRACT_16BITS(obj_tptr
+2)<<2);
1033 obj_tptr
+=4; /* get to the start of the service header */
1036 while (obj_tlen
>= 4) {
1037 intserv_serv_tlen
=EXTRACT_16BITS(obj_tptr
+2)<<2;
1038 printf("%s Service Type: %s (%u), break bit %s set, Service length: %u",
1040 tok2str(rsvp_intserv_service_type_values
,"unknown",*(obj_tptr
)),
1042 (*(obj_tptr
+1)&0x80) ? "" : "not",
1045 obj_tptr
+=4; /* get to the start of the parameter list */
1048 while (intserv_serv_tlen
>=4) {
1049 processed
= rsvp_intserv_print(obj_tptr
, obj_tlen
);
1052 obj_tlen
-=processed
;
1053 intserv_serv_tlen
-=processed
;
1054 obj_tptr
+=processed
;
1063 case RSVP_OBJ_FILTERSPEC
:
1064 switch(rsvp_obj_ctype
) {
1065 case RSVP_CTYPE_IPV4
:
1068 printf("%s Source Address: %s, Source Port: %u",
1070 ipaddr_string(obj_tptr
),
1071 EXTRACT_16BITS(obj_tptr
+6));
1076 case RSVP_CTYPE_IPV6
:
1079 printf("%s Source Address: %s, Source Port: %u",
1081 ip6addr_string(obj_tptr
),
1082 EXTRACT_16BITS(obj_tptr
+18));
1089 printf("%s Source Address: %s, Flow Label: %u",
1091 ip6addr_string(obj_tptr
),
1092 EXTRACT_24BITS(obj_tptr
+17));
1096 case RSVP_CTYPE_TUNNEL_IPV6
:
1099 printf("%s Source Address: %s, LSP-ID: 0x%04x",
1101 ipaddr_string(obj_tptr
),
1102 EXTRACT_16BITS(obj_tptr
+18));
1107 case RSVP_CTYPE_TUNNEL_IPV4
:
1110 printf("%s Source Address: %s, LSP-ID: 0x%04x",
1112 ipaddr_string(obj_tptr
),
1113 EXTRACT_16BITS(obj_tptr
+6));
1122 case RSVP_OBJ_FASTREROUTE
:
1123 switch(rsvp_obj_ctype
) {
1124 case RSVP_CTYPE_TUNNEL_IPV4
:
1127 bw
.i
= EXTRACT_32BITS(obj_tptr
+4);
1128 printf("%s Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps",
1134 printf("%s Include Colors: 0x%08x, Exclude Colors: 0x%08x",
1136 EXTRACT_32BITS(obj_tptr
+8),
1137 EXTRACT_32BITS(obj_tptr
+12));
1146 case RSVP_OBJ_DETOUR
:
1147 switch(rsvp_obj_ctype
) {
1148 case RSVP_CTYPE_TUNNEL_IPV4
:
1149 while(obj_tlen
>= 8) {
1150 printf("%s PLR-ID: %s, Avoid-Node-ID: %s",
1152 ipaddr_string(obj_tptr
),
1153 ipaddr_string(obj_tptr
+4));
1163 case RSVP_OBJ_CLASSTYPE
:
1164 switch(rsvp_obj_ctype
) {
1166 printf("%s Class Type: %u",
1168 EXTRACT_32BITS(obj_tptr
)&0x7);
1177 case RSVP_OBJ_ERROR_SPEC
:
1178 switch(rsvp_obj_ctype
) {
1179 case RSVP_CTYPE_3
: /* fall through - FIXME add TLV parser */
1180 case RSVP_CTYPE_IPV4
:
1183 error_code
=*(obj_tptr
+5);
1184 error_value
=EXTRACT_16BITS(obj_tptr
+6);
1185 printf("%s Error Node Address: %s, Flags: [0x%02x]%s Error Code: %s (%u)",
1187 ipaddr_string(obj_tptr
),
1190 tok2str(rsvp_obj_error_code_values
,"unknown",error_code
),
1192 switch (error_code
) {
1193 case RSVP_OBJ_ERROR_SPEC_CODE_ROUTING
:
1194 printf(", Error Value: %s (%u)",
1195 tok2str(rsvp_obj_error_code_routing_values
,"unknown",error_value
),
1198 case RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE
:
1199 printf(", Error Value: %s (%u)",
1200 tok2str(rsvp_obj_error_code_diffserv_te_values
,"unknown",error_value
),
1204 printf(", Unknown Error Value (%u)", error_value
);
1211 case RSVP_CTYPE_4
: /* fall through - FIXME add TLV parser */
1212 case RSVP_CTYPE_IPV6
:
1215 error_code
=*(obj_tptr
+17);
1216 error_value
=EXTRACT_16BITS(obj_tptr
+18);
1217 printf("%s Error Node Address: %s, Flags: [0x%02x]%s Error Code: %s (%u)",
1219 ip6addr_string(obj_tptr
),
1222 tok2str(rsvp_obj_error_code_values
,"unknown",error_code
),
1225 switch (error_code
) {
1226 case RSVP_OBJ_ERROR_SPEC_CODE_ROUTING
:
1227 printf(", Error Value: %s (%u)",
1228 tok2str(rsvp_obj_error_code_routing_values
,"unknown",error_value
),
1243 case RSVP_OBJ_PROPERTIES
:
1244 switch(rsvp_obj_ctype
) {
1248 padbytes
= EXTRACT_16BITS(obj_tptr
+2);
1249 printf("%s TLV count: %u, padding bytes: %u",
1251 EXTRACT_16BITS(obj_tptr
),
1255 /* loop through as long there is anything longer than the TLV header (2) */
1256 while(obj_tlen
>= 2 + padbytes
) {
1257 printf("%s %s TLV (0x%02x), length: %u", /* length includes header */
1259 tok2str(rsvp_obj_prop_tlv_values
,"unknown",*obj_tptr
),
1262 if (obj_tlen
< *(obj_tptr
+1))
1264 print_unknown_data(obj_tptr
+2,"\n\t\t",*(obj_tptr
+1)-2);
1265 obj_tlen
-=*(obj_tptr
+1);
1266 obj_tptr
+=*(obj_tptr
+1);
1274 case RSVP_OBJ_MESSAGE_ID
: /* fall through */
1275 case RSVP_OBJ_MESSAGE_ID_ACK
: /* fall through */
1276 case RSVP_OBJ_MESSAGE_ID_LIST
:
1277 switch(rsvp_obj_ctype
) {
1281 printf("%s Flags [0x%02x], epoch: %u",
1284 EXTRACT_24BITS(obj_tptr
+1));
1287 /* loop through as long there are no messages left */
1288 while(obj_tlen
>= 4) {
1289 printf("%s Message-ID 0x%08x (%u)",
1291 EXTRACT_32BITS(obj_tptr
),
1292 EXTRACT_32BITS(obj_tptr
));
1303 * FIXME those are the defined objects that lack a decoder
1304 * you are welcome to contribute code ;-)
1307 case RSVP_OBJ_INTEGRITY
:
1308 case RSVP_OBJ_SCOPE
:
1309 case RSVP_OBJ_POLICY_DATA
:
1310 case RSVP_OBJ_LABEL_SET
:
1311 case RSVP_OBJ_ACCEPT_LABEL_SET
:
1312 case RSVP_OBJ_PROTECTION
:
1315 print_unknown_data(obj_tptr
,"\n\t ",obj_tlen
); /* FIXME indentation */
1318 /* do we also want to see a hex dump ? */
1319 if (vflag
> 1 || hexdump
==TRUE
)
1320 print_unknown_data(tptr
+sizeof(sizeof(struct rsvp_object_header
)),"\n\t ", /* FIXME indentation */
1321 rsvp_obj_len
-sizeof(struct rsvp_object_header
));
1328 printf("\n\t\t packet exceeded snapshot");
1334 rsvp_print(register const u_char
*pptr
, register u_int len
) {
1336 const struct rsvp_common_header
*rsvp_com_header
;
1337 const u_char
*tptr
,*subtptr
;
1338 u_short tlen
,subtlen
;
1342 rsvp_com_header
= (const struct rsvp_common_header
*)pptr
;
1343 TCHECK(*rsvp_com_header
);
1346 * Sanity checking of the header.
1348 if (RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
) != RSVP_VERSION
) {
1349 printf("ERROR: RSVP version %u packet not supported",
1350 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
));
1354 /* in non-verbose mode just lets print the basic Message Type*/
1356 printf("RSVPv%u %s Message, length: %u",
1357 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
),
1358 tok2str(rsvp_msg_type_values
, "unknown (%u)",rsvp_com_header
->msg_type
),
1363 /* ok they seem to want to know everything - lets fully decode it */
1365 tlen
=EXTRACT_16BITS(rsvp_com_header
->length
);
1367 printf("\n\tRSVPv%u %s Message (%u), Flags: [%s], length: %u, ttl: %u, checksum: 0x%04x",
1368 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
),
1369 tok2str(rsvp_msg_type_values
, "unknown, type: %u",rsvp_com_header
->msg_type
),
1370 rsvp_com_header
->msg_type
,
1371 bittok2str(rsvp_header_flag_values
,"none",RSVP_EXTRACT_FLAGS(rsvp_com_header
->version_flags
)),
1373 rsvp_com_header
->ttl
,
1374 EXTRACT_16BITS(rsvp_com_header
->checksum
));
1376 if (tlen
< sizeof(const struct rsvp_common_header
)) {
1377 printf("ERROR: common header too short %u < %lu", tlen
,
1378 (unsigned long)sizeof(const struct rsvp_common_header
));
1382 tptr
+=sizeof(const struct rsvp_common_header
);
1383 tlen
-=sizeof(const struct rsvp_common_header
);
1385 switch(rsvp_com_header
->msg_type
) {
1387 case RSVP_MSGTYPE_AGGREGATE
:
1390 rsvp_com_header
= (const struct rsvp_common_header
*)subtptr
;
1391 TCHECK(*rsvp_com_header
);
1394 * Sanity checking of the header.
1396 if (RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
) != RSVP_VERSION
) {
1397 printf("ERROR: RSVP version %u packet not supported",
1398 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
));
1401 subtlen
=EXTRACT_16BITS(rsvp_com_header
->length
);
1403 printf("\n\t RSVPv%u %s Message (%u), Flags: [%s], length: %u, ttl: %u, checksum: 0x%04x",
1404 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
),
1405 tok2str(rsvp_msg_type_values
, "unknown, type: %u",rsvp_com_header
->msg_type
),
1406 rsvp_com_header
->msg_type
,
1407 bittok2str(rsvp_header_flag_values
,"none",RSVP_EXTRACT_FLAGS(rsvp_com_header
->version_flags
)),
1409 rsvp_com_header
->ttl
,
1410 EXTRACT_16BITS(rsvp_com_header
->checksum
));
1412 if (subtlen
< sizeof(const struct rsvp_common_header
)) {
1413 printf("ERROR: common header too short %u < %lu", subtlen
,
1414 (unsigned long)sizeof(const struct rsvp_common_header
));
1418 subtptr
+=sizeof(const struct rsvp_common_header
);
1419 subtlen
-=sizeof(const struct rsvp_common_header
);
1421 if (rsvp_obj_print(subtptr
,"\n\t ", subtlen
) == -1)
1424 tptr
+=subtlen
+sizeof(const struct rsvp_common_header
);
1425 tlen
-=subtlen
+sizeof(const struct rsvp_common_header
);
1430 case RSVP_MSGTYPE_PATH
:
1431 case RSVP_MSGTYPE_RESV
:
1432 case RSVP_MSGTYPE_PATHERR
:
1433 case RSVP_MSGTYPE_RESVERR
:
1434 case RSVP_MSGTYPE_PATHTEAR
:
1435 case RSVP_MSGTYPE_RESVTEAR
:
1436 case RSVP_MSGTYPE_RESVCONF
:
1437 case RSVP_MSGTYPE_HELLO_OLD
:
1438 case RSVP_MSGTYPE_HELLO
:
1439 case RSVP_MSGTYPE_ACK
:
1440 case RSVP_MSGTYPE_SREFRESH
:
1441 if (rsvp_obj_print(tptr
,"\n\t ", tlen
) == -1)
1446 print_unknown_data(tptr
,"\n\t ",tlen
);
1452 printf("\n\t\t packet exceeded snapshot");