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.49 2008-03-03 12:57:04 hannes Exp $";
27 #include <tcpdump-stdinc.h>
33 #include "interface.h"
35 #include "addrtoname.h"
36 #include "ethertype.h"
41 * RFC 2205 common header
44 * +-------------+-------------+-------------+-------------+
45 * | Vers | Flags| Msg Type | RSVP Checksum |
46 * +-------------+-------------+-------------+-------------+
47 * | Send_TTL | (Reserved) | RSVP Length |
48 * +-------------+-------------+-------------+-------------+
52 struct rsvp_common_header
{
53 u_int8_t version_flags
;
62 * RFC2205 object header
66 * +-------------+-------------+-------------+-------------+
67 * | Length (bytes) | Class-Num | C-Type |
68 * +-------------+-------------+-------------+-------------+
70 * // (Object contents) //
72 * +-------------+-------------+-------------+-------------+
75 struct rsvp_object_header
{
81 #define RSVP_VERSION 1
82 #define RSVP_EXTRACT_VERSION(x) (((x)&0xf0)>>4)
83 #define RSVP_EXTRACT_FLAGS(x) ((x)&0x0f)
85 #define RSVP_MSGTYPE_PATH 1
86 #define RSVP_MSGTYPE_RESV 2
87 #define RSVP_MSGTYPE_PATHERR 3
88 #define RSVP_MSGTYPE_RESVERR 4
89 #define RSVP_MSGTYPE_PATHTEAR 5
90 #define RSVP_MSGTYPE_RESVTEAR 6
91 #define RSVP_MSGTYPE_RESVCONF 7
92 #define RSVP_MSGTYPE_AGGREGATE 12
93 #define RSVP_MSGTYPE_ACK 13
94 #define RSVP_MSGTYPE_HELLO_OLD 14 /* ancient Hellos */
95 #define RSVP_MSGTYPE_SREFRESH 15
96 #define RSVP_MSGTYPE_HELLO 20
98 static const struct tok rsvp_msg_type_values
[] = {
99 { RSVP_MSGTYPE_PATH
, "Path" },
100 { RSVP_MSGTYPE_RESV
, "Resv" },
101 { RSVP_MSGTYPE_PATHERR
, "PathErr" },
102 { RSVP_MSGTYPE_RESVERR
, "ResvErr" },
103 { RSVP_MSGTYPE_PATHTEAR
, "PathTear" },
104 { RSVP_MSGTYPE_RESVTEAR
, "ResvTear" },
105 { RSVP_MSGTYPE_RESVCONF
, "ResvConf" },
106 { RSVP_MSGTYPE_AGGREGATE
, "Aggregate" },
107 { RSVP_MSGTYPE_ACK
, "Acknowledgement" },
108 { RSVP_MSGTYPE_HELLO_OLD
, "Hello (Old)" },
109 { RSVP_MSGTYPE_SREFRESH
, "Refresh" },
110 { RSVP_MSGTYPE_HELLO
, "Hello" },
114 static const struct tok rsvp_header_flag_values
[] = {
115 { 0x01, "Refresh reduction capable" }, /* rfc2961 */
119 #define RSVP_OBJ_SESSION 1 /* rfc2205 */
120 #define RSVP_OBJ_RSVP_HOP 3 /* rfc2205, rfc3473 */
121 #define RSVP_OBJ_INTEGRITY 4 /* rfc2747 */
122 #define RSVP_OBJ_TIME_VALUES 5 /* rfc2205 */
123 #define RSVP_OBJ_ERROR_SPEC 6
124 #define RSVP_OBJ_SCOPE 7
125 #define RSVP_OBJ_STYLE 8 /* rfc2205 */
126 #define RSVP_OBJ_FLOWSPEC 9 /* rfc2215 */
127 #define RSVP_OBJ_FILTERSPEC 10 /* rfc2215 */
128 #define RSVP_OBJ_SENDER_TEMPLATE 11
129 #define RSVP_OBJ_SENDER_TSPEC 12 /* rfc2215 */
130 #define RSVP_OBJ_ADSPEC 13 /* rfc2215 */
131 #define RSVP_OBJ_POLICY_DATA 14
132 #define RSVP_OBJ_CONFIRM 15 /* rfc2205 */
133 #define RSVP_OBJ_LABEL 16 /* rfc3209 */
134 #define RSVP_OBJ_LABEL_REQ 19 /* rfc3209 */
135 #define RSVP_OBJ_ERO 20 /* rfc3209 */
136 #define RSVP_OBJ_RRO 21 /* rfc3209 */
137 #define RSVP_OBJ_HELLO 22 /* rfc3209 */
138 #define RSVP_OBJ_MESSAGE_ID 23 /* rfc2961 */
139 #define RSVP_OBJ_MESSAGE_ID_ACK 24 /* rfc2961 */
140 #define RSVP_OBJ_MESSAGE_ID_LIST 25 /* rfc2961 */
141 #define RSVP_OBJ_RECOVERY_LABEL 34 /* rfc3473 */
142 #define RSVP_OBJ_UPSTREAM_LABEL 35 /* rfc3473 */
143 #define RSVP_OBJ_LABEL_SET 36 /* rfc3473 */
144 #define RSVP_OBJ_PROTECTION 37 /* rfc3473 */
145 #define RSVP_OBJ_S2L 50 /* rfc4875 */
146 #define RSVP_OBJ_DETOUR 63 /* draft-ietf-mpls-rsvp-lsp-fastreroute-07 */
147 #define RSVP_OBJ_CLASSTYPE 66 /* rfc4124 */
148 #define RSVP_OBJ_CLASSTYPE_OLD 125 /* draft-ietf-tewg-diff-te-proto-07 */
149 #define RSVP_OBJ_SUGGESTED_LABEL 129 /* rfc3473 */
150 #define RSVP_OBJ_ACCEPT_LABEL_SET 130 /* rfc3473 */
151 #define RSVP_OBJ_RESTART_CAPABILITY 131 /* rfc3473 */
152 #define RSVP_OBJ_NOTIFY_REQ 195 /* rfc3473 */
153 #define RSVP_OBJ_ADMIN_STATUS 196 /* rfc3473 */
154 #define RSVP_OBJ_PROPERTIES 204 /* juniper proprietary */
155 #define RSVP_OBJ_FASTREROUTE 205 /* draft-ietf-mpls-rsvp-lsp-fastreroute-07 */
156 #define RSVP_OBJ_SESSION_ATTRIBUTE 207 /* rfc3209 */
157 #define RSVP_OBJ_GENERALIZED_UNI 229 /* OIF RSVP extensions UNI 1.0 Signaling, Rel. 2 */
158 #define RSVP_OBJ_CALL_ID 230 /* rfc3474 */
159 #define RSVP_OBJ_CALL_OPS 236 /* rfc3474 */
161 static const struct tok rsvp_obj_values
[] = {
162 { RSVP_OBJ_SESSION
, "Session" },
163 { RSVP_OBJ_RSVP_HOP
, "RSVP Hop" },
164 { RSVP_OBJ_INTEGRITY
, "Integrity" },
165 { RSVP_OBJ_TIME_VALUES
, "Time Values" },
166 { RSVP_OBJ_ERROR_SPEC
, "Error Spec" },
167 { RSVP_OBJ_SCOPE
, "Scope" },
168 { RSVP_OBJ_STYLE
, "Style" },
169 { RSVP_OBJ_FLOWSPEC
, "Flowspec" },
170 { RSVP_OBJ_FILTERSPEC
, "FilterSpec" },
171 { RSVP_OBJ_SENDER_TEMPLATE
, "Sender Template" },
172 { RSVP_OBJ_SENDER_TSPEC
, "Sender TSpec" },
173 { RSVP_OBJ_ADSPEC
, "Adspec" },
174 { RSVP_OBJ_POLICY_DATA
, "Policy Data" },
175 { RSVP_OBJ_CONFIRM
, "Confirm" },
176 { RSVP_OBJ_LABEL
, "Label" },
177 { RSVP_OBJ_LABEL_REQ
, "Label Request" },
178 { RSVP_OBJ_ERO
, "ERO" },
179 { RSVP_OBJ_RRO
, "RRO" },
180 { RSVP_OBJ_HELLO
, "Hello" },
181 { RSVP_OBJ_MESSAGE_ID
, "Message ID" },
182 { RSVP_OBJ_MESSAGE_ID_ACK
, "Message ID Ack" },
183 { RSVP_OBJ_MESSAGE_ID_LIST
, "Message ID List" },
184 { RSVP_OBJ_RECOVERY_LABEL
, "Recovery Label" },
185 { RSVP_OBJ_UPSTREAM_LABEL
, "Upstream Label" },
186 { RSVP_OBJ_LABEL_SET
, "Label Set" },
187 { RSVP_OBJ_ACCEPT_LABEL_SET
, "Acceptable Label Set" },
188 { RSVP_OBJ_DETOUR
, "Detour" },
189 { RSVP_OBJ_CLASSTYPE
, "Class Type" },
190 { RSVP_OBJ_CLASSTYPE_OLD
, "Class Type (old)" },
191 { RSVP_OBJ_SUGGESTED_LABEL
, "Suggested Label" },
192 { RSVP_OBJ_PROPERTIES
, "Properties" },
193 { RSVP_OBJ_FASTREROUTE
, "Fast Re-Route" },
194 { RSVP_OBJ_SESSION_ATTRIBUTE
, "Session Attribute" },
195 { RSVP_OBJ_GENERALIZED_UNI
, "Generalized UNI" },
196 { RSVP_OBJ_CALL_ID
, "Call-ID" },
197 { RSVP_OBJ_CALL_OPS
, "Call Capability" },
198 { RSVP_OBJ_RESTART_CAPABILITY
, "Restart Capability" },
199 { RSVP_OBJ_NOTIFY_REQ
, "Notify Request" },
200 { RSVP_OBJ_PROTECTION
, "Protection" },
201 { RSVP_OBJ_ADMIN_STATUS
, "Administrative Status" },
202 { RSVP_OBJ_S2L
, "Sub-LSP to LSP" },
206 #define RSVP_CTYPE_IPV4 1
207 #define RSVP_CTYPE_IPV6 2
208 #define RSVP_CTYPE_TUNNEL_IPV4 7
209 #define RSVP_CTYPE_TUNNEL_IPV6 8
210 #define RSVP_CTYPE_UNI_IPV4 11 /* OIF RSVP extensions UNI 1.0 Signaling Rel. 2 */
211 #define RSVP_CTYPE_1 1
212 #define RSVP_CTYPE_2 2
213 #define RSVP_CTYPE_3 3
214 #define RSVP_CTYPE_4 4
215 #define RSVP_CTYPE_12 12
216 #define RSVP_CTYPE_13 13
217 #define RSVP_CTYPE_14 14
220 * the ctypes are not globally unique so for
221 * translating it to strings we build a table based
222 * on objects offsetted by the ctype
225 static const struct tok rsvp_ctype_values
[] = {
226 { 256*RSVP_OBJ_RSVP_HOP
+RSVP_CTYPE_IPV4
, "IPv4" },
227 { 256*RSVP_OBJ_RSVP_HOP
+RSVP_CTYPE_IPV6
, "IPv6" },
228 { 256*RSVP_OBJ_RSVP_HOP
+RSVP_CTYPE_3
, "IPv4 plus opt. TLVs" },
229 { 256*RSVP_OBJ_RSVP_HOP
+RSVP_CTYPE_4
, "IPv6 plus opt. TLVs" },
230 { 256*RSVP_OBJ_NOTIFY_REQ
+RSVP_CTYPE_IPV4
, "IPv4" },
231 { 256*RSVP_OBJ_NOTIFY_REQ
+RSVP_CTYPE_IPV6
, "IPv6" },
232 { 256*RSVP_OBJ_CONFIRM
+RSVP_CTYPE_IPV4
, "IPv4" },
233 { 256*RSVP_OBJ_CONFIRM
+RSVP_CTYPE_IPV6
, "IPv6" },
234 { 256*RSVP_OBJ_TIME_VALUES
+RSVP_CTYPE_1
, "1" },
235 { 256*RSVP_OBJ_FLOWSPEC
+RSVP_CTYPE_1
, "obsolete" },
236 { 256*RSVP_OBJ_FLOWSPEC
+RSVP_CTYPE_2
, "IntServ" },
237 { 256*RSVP_OBJ_SENDER_TSPEC
+RSVP_CTYPE_2
, "IntServ" },
238 { 256*RSVP_OBJ_ADSPEC
+RSVP_CTYPE_2
, "IntServ" },
239 { 256*RSVP_OBJ_FILTERSPEC
+RSVP_CTYPE_IPV4
, "IPv4" },
240 { 256*RSVP_OBJ_FILTERSPEC
+RSVP_CTYPE_IPV6
, "IPv6" },
241 { 256*RSVP_OBJ_FILTERSPEC
+RSVP_CTYPE_3
, "IPv6 Flow-label" },
242 { 256*RSVP_OBJ_FILTERSPEC
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
243 { 256*RSVP_OBJ_FILTERSPEC
+RSVP_CTYPE_12
, "IPv4 P2MP LSP Tunnel" },
244 { 256*RSVP_OBJ_FILTERSPEC
+RSVP_CTYPE_13
, "IPv6 P2MP LSP Tunnel" },
245 { 256*RSVP_OBJ_SESSION
+RSVP_CTYPE_IPV4
, "IPv4" },
246 { 256*RSVP_OBJ_SESSION
+RSVP_CTYPE_IPV6
, "IPv6" },
247 { 256*RSVP_OBJ_SESSION
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
248 { 256*RSVP_OBJ_SESSION
+RSVP_CTYPE_UNI_IPV4
, "UNI IPv4" },
249 { 256*RSVP_OBJ_SESSION
+RSVP_CTYPE_13
, "IPv4 P2MP LSP Tunnel" },
250 { 256*RSVP_OBJ_SESSION
+RSVP_CTYPE_14
, "IPv6 P2MP LSP Tunnel" },
251 { 256*RSVP_OBJ_SENDER_TEMPLATE
+RSVP_CTYPE_IPV4
, "IPv4" },
252 { 256*RSVP_OBJ_SENDER_TEMPLATE
+RSVP_CTYPE_IPV6
, "IPv6" },
253 { 256*RSVP_OBJ_SENDER_TEMPLATE
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
254 { 256*RSVP_OBJ_SENDER_TEMPLATE
+RSVP_CTYPE_12
, "IPv4 P2MP LSP Tunnel" },
255 { 256*RSVP_OBJ_SENDER_TEMPLATE
+RSVP_CTYPE_13
, "IPv6 P2MP LSP Tunnel" },
256 { 256*RSVP_OBJ_MESSAGE_ID
+RSVP_CTYPE_1
, "1" },
257 { 256*RSVP_OBJ_MESSAGE_ID_ACK
+RSVP_CTYPE_1
, "Message id ack" },
258 { 256*RSVP_OBJ_MESSAGE_ID_ACK
+RSVP_CTYPE_2
, "Message id nack" },
259 { 256*RSVP_OBJ_MESSAGE_ID_LIST
+RSVP_CTYPE_1
, "1" },
260 { 256*RSVP_OBJ_STYLE
+RSVP_CTYPE_1
, "1" },
261 { 256*RSVP_OBJ_HELLO
+RSVP_CTYPE_1
, "Hello Request" },
262 { 256*RSVP_OBJ_HELLO
+RSVP_CTYPE_2
, "Hello Ack" },
263 { 256*RSVP_OBJ_LABEL_REQ
+RSVP_CTYPE_1
, "without label range" },
264 { 256*RSVP_OBJ_LABEL_REQ
+RSVP_CTYPE_2
, "with ATM label range" },
265 { 256*RSVP_OBJ_LABEL_REQ
+RSVP_CTYPE_3
, "with FR label range" },
266 { 256*RSVP_OBJ_LABEL_REQ
+RSVP_CTYPE_4
, "Generalized Label" },
267 { 256*RSVP_OBJ_LABEL
+RSVP_CTYPE_1
, "Label" },
268 { 256*RSVP_OBJ_LABEL
+RSVP_CTYPE_2
, "Generalized Label" },
269 { 256*RSVP_OBJ_LABEL
+RSVP_CTYPE_3
, "Waveband Switching" },
270 { 256*RSVP_OBJ_SUGGESTED_LABEL
+RSVP_CTYPE_1
, "Label" },
271 { 256*RSVP_OBJ_SUGGESTED_LABEL
+RSVP_CTYPE_2
, "Generalized Label" },
272 { 256*RSVP_OBJ_SUGGESTED_LABEL
+RSVP_CTYPE_3
, "Waveband Switching" },
273 { 256*RSVP_OBJ_UPSTREAM_LABEL
+RSVP_CTYPE_1
, "Label" },
274 { 256*RSVP_OBJ_UPSTREAM_LABEL
+RSVP_CTYPE_2
, "Generalized Label" },
275 { 256*RSVP_OBJ_UPSTREAM_LABEL
+RSVP_CTYPE_3
, "Waveband Switching" },
276 { 256*RSVP_OBJ_RECOVERY_LABEL
+RSVP_CTYPE_1
, "Label" },
277 { 256*RSVP_OBJ_RECOVERY_LABEL
+RSVP_CTYPE_2
, "Generalized Label" },
278 { 256*RSVP_OBJ_RECOVERY_LABEL
+RSVP_CTYPE_3
, "Waveband Switching" },
279 { 256*RSVP_OBJ_ERO
+RSVP_CTYPE_IPV4
, "IPv4" },
280 { 256*RSVP_OBJ_RRO
+RSVP_CTYPE_IPV4
, "IPv4" },
281 { 256*RSVP_OBJ_ERROR_SPEC
+RSVP_CTYPE_IPV4
, "IPv4" },
282 { 256*RSVP_OBJ_ERROR_SPEC
+RSVP_CTYPE_IPV6
, "IPv6" },
283 { 256*RSVP_OBJ_ERROR_SPEC
+RSVP_CTYPE_3
, "IPv4 plus opt. TLVs" },
284 { 256*RSVP_OBJ_ERROR_SPEC
+RSVP_CTYPE_4
, "IPv6 plus opt. TLVs" },
285 { 256*RSVP_OBJ_RESTART_CAPABILITY
+RSVP_CTYPE_1
, "IPv4" },
286 { 256*RSVP_OBJ_SESSION_ATTRIBUTE
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
287 { 256*RSVP_OBJ_FASTREROUTE
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" }, /* old style*/
288 { 256*RSVP_OBJ_FASTREROUTE
+RSVP_CTYPE_1
, "1" }, /* new style */
289 { 256*RSVP_OBJ_DETOUR
+RSVP_CTYPE_TUNNEL_IPV4
, "Tunnel IPv4" },
290 { 256*RSVP_OBJ_PROPERTIES
+RSVP_CTYPE_1
, "1" },
291 { 256*RSVP_OBJ_ADMIN_STATUS
+RSVP_CTYPE_1
, "1" },
292 { 256*RSVP_OBJ_CLASSTYPE
+RSVP_CTYPE_1
, "1" },
293 { 256*RSVP_OBJ_CLASSTYPE_OLD
+RSVP_CTYPE_1
, "1" },
294 { 256*RSVP_OBJ_LABEL_SET
+RSVP_CTYPE_1
, "1" },
295 { 256*RSVP_OBJ_GENERALIZED_UNI
+RSVP_CTYPE_1
, "1" },
296 { 256*RSVP_OBJ_S2L
+RSVP_CTYPE_IPV4
, "IPv4 sub-LSP" },
297 { 256*RSVP_OBJ_S2L
+RSVP_CTYPE_IPV6
, "IPv6 sub-LSP" },
301 struct rsvp_obj_integrity_t
{
305 u_int8_t sequence
[8];
309 static const struct tok rsvp_obj_integrity_flag_values
[] = {
310 { 0x80, "Handshake" },
314 struct rsvp_obj_frr_t
{
319 u_int8_t bandwidth
[4];
320 u_int8_t include_any
[4];
321 u_int8_t exclude_any
[4];
322 u_int8_t include_all
[4];
326 #define RSVP_OBJ_XRO_MASK_SUBOBJ(x) ((x)&0x7f)
327 #define RSVP_OBJ_XRO_MASK_LOOSE(x) ((x)&0x80)
329 #define RSVP_OBJ_XRO_RES 0
330 #define RSVP_OBJ_XRO_IPV4 1
331 #define RSVP_OBJ_XRO_IPV6 2
332 #define RSVP_OBJ_XRO_ASN 32
333 #define RSVP_OBJ_XRO_MPLS 64
335 static const struct tok rsvp_obj_xro_values
[] = {
336 { RSVP_OBJ_XRO_RES
, "Reserved" },
337 { RSVP_OBJ_XRO_IPV4
, "IPv4 prefix" },
338 { RSVP_OBJ_XRO_IPV6
, "IPv6 prefix" },
339 { RSVP_OBJ_XRO_ASN
, "Autonomous system number" },
340 { RSVP_OBJ_XRO_MPLS
, "MPLS label switched path termination" },
344 /* draft-ietf-mpls-rsvp-lsp-fastreroute-07.txt */
345 static const struct tok rsvp_obj_rro_flag_values
[] = {
346 { 0x01, "Local protection available" },
347 { 0x02, "Local protection in use" },
348 { 0x04, "Bandwidth protection" },
349 { 0x08, "Node protection" },
353 static const struct tok rsvp_resstyle_values
[] = {
354 { 17, "Wildcard Filter" },
355 { 10, "Fixed Filter" },
356 { 18, "Shared Explicit" },
360 #define RSVP_OBJ_INTSERV_GUARANTEED_SERV 2
361 #define RSVP_OBJ_INTSERV_CONTROLLED_LOAD 5
363 static const struct tok rsvp_intserv_service_type_values
[] = {
364 { 1, "Default/Global Information" },
365 { RSVP_OBJ_INTSERV_GUARANTEED_SERV
, "Guaranteed Service" },
366 { RSVP_OBJ_INTSERV_CONTROLLED_LOAD
, "Controlled Load" },
370 static const struct tok rsvp_intserv_parameter_id_values
[] = {
372 { 6, "Path b/w estimate" },
373 { 8, "Minimum path latency" },
374 { 10, "Composed MTU" },
375 { 127, "Token Bucket TSpec" },
376 { 130, "Guaranteed Service RSpec" },
377 { 133, "End-to-end composed value for C" },
378 { 134, "End-to-end composed value for D" },
379 { 135, "Since-last-reshaping point composed C" },
380 { 136, "Since-last-reshaping point composed D" },
384 static struct tok rsvp_session_attribute_flag_values
[] = {
385 { 0x01, "Local Protection desired" },
386 { 0x02, "Label Recording desired" },
387 { 0x04, "SE Style desired" },
388 { 0x08, "Bandwidth protection desired" }, /* draft-ietf-mpls-rsvp-lsp-fastreroute-02.txt */
389 { 0x10, "Node protection desired" }, /* draft-ietf-mpls-rsvp-lsp-fastreroute-02.txt */
393 static struct tok rsvp_obj_prop_tlv_values
[] = {
395 { 0x02, "Metric 1" },
396 { 0x04, "Metric 2" },
397 { 0x08, "CCC Status" },
398 { 0x10, "Path Type" },
402 #define RSVP_OBJ_ERROR_SPEC_CODE_ROUTING 24
403 #define RSVP_OBJ_ERROR_SPEC_CODE_NOTIFY 25
404 #define RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE 28
405 #define RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE_OLD 125
407 static struct tok rsvp_obj_error_code_values
[] = {
408 { RSVP_OBJ_ERROR_SPEC_CODE_ROUTING
, "Routing Problem" },
409 { RSVP_OBJ_ERROR_SPEC_CODE_NOTIFY
, "Notify Error" },
410 { RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE
, "Diffserv TE Error" },
411 { RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE_OLD
, "Diffserv TE Error (Old)" },
415 static struct tok rsvp_obj_error_code_routing_values
[] = {
416 { 1, "Bad EXPLICIT_ROUTE object" },
417 { 2, "Bad strict node" },
418 { 3, "Bad loose node" },
419 { 4, "Bad initial subobject" },
420 { 5, "No route available toward destination" },
421 { 6, "Unacceptable label value" },
422 { 7, "RRO indicated routing loops" },
423 { 8, "non-RSVP-capable router in the path" },
424 { 9, "MPLS label allocation failure" },
425 { 10, "Unsupported L3PID" },
429 static struct tok rsvp_obj_error_code_diffserv_te_values
[] = {
430 { 1, "Unexpected CT object" },
431 { 2, "Unsupported CT" },
432 { 3, "Invalid CT value" },
433 { 4, "CT/setup priority do not form a configured TE-Class" },
434 { 5, "CT/holding priority do not form a configured TE-Class" },
435 { 6, "CT/setup priority and CT/holding priority do not form a configured TE-Class" },
436 { 7, "Inconsistency between signaled PSC and signaled CT" },
437 { 8, "Inconsistency between signaled PHBs and signaled CT" },
441 /* rfc3473 / rfc 3471 */
442 static const struct tok rsvp_obj_admin_status_flag_values
[] = {
443 { 0x80000000, "Reflect" },
444 { 0x00000004, "Testing" },
445 { 0x00000002, "Admin-down" },
446 { 0x00000001, "Delete-in-progress" },
450 /* label set actions - rfc3471 */
451 #define LABEL_SET_INCLUSIVE_LIST 0
452 #define LABEL_SET_EXCLUSIVE_LIST 1
453 #define LABEL_SET_INCLUSIVE_RANGE 2
454 #define LABEL_SET_EXCLUSIVE_RANGE 3
456 static const struct tok rsvp_obj_label_set_action_values
[] = {
457 { LABEL_SET_INCLUSIVE_LIST
, "Inclusive list" },
458 { LABEL_SET_EXCLUSIVE_LIST
, "Exclusive list" },
459 { LABEL_SET_INCLUSIVE_RANGE
, "Inclusive range" },
460 { LABEL_SET_EXCLUSIVE_RANGE
, "Exclusive range" },
464 /* OIF RSVP extensions UNI 1.0 Signaling, release 2 */
465 #define RSVP_GEN_UNI_SUBOBJ_SOURCE_TNA_ADDRESS 1
466 #define RSVP_GEN_UNI_SUBOBJ_DESTINATION_TNA_ADDRESS 2
467 #define RSVP_GEN_UNI_SUBOBJ_DIVERSITY 3
468 #define RSVP_GEN_UNI_SUBOBJ_EGRESS_LABEL 4
469 #define RSVP_GEN_UNI_SUBOBJ_SERVICE_LEVEL 5
471 static const struct tok rsvp_obj_generalized_uni_values
[] = {
472 { RSVP_GEN_UNI_SUBOBJ_SOURCE_TNA_ADDRESS
, "Source TNA address" },
473 { RSVP_GEN_UNI_SUBOBJ_DESTINATION_TNA_ADDRESS
, "Destination TNA address" },
474 { RSVP_GEN_UNI_SUBOBJ_DIVERSITY
, "Diversity" },
475 { RSVP_GEN_UNI_SUBOBJ_EGRESS_LABEL
, "Egress label" },
476 { RSVP_GEN_UNI_SUBOBJ_SERVICE_LEVEL
, "Service level" },
480 static int rsvp_intserv_print(const u_char
*, u_short
);
483 * this is a dissector for all the intserv defined
484 * specs as defined per rfc2215
485 * it is called from various rsvp objects;
486 * returns the amount of bytes being processed
489 rsvp_intserv_print(const u_char
*tptr
, u_short obj_tlen
) {
491 int parameter_id
,parameter_length
;
499 parameter_id
= *(tptr
);
500 parameter_length
= EXTRACT_16BITS(tptr
+2)<<2; /* convert wordcount to bytecount */
502 printf("\n\t Parameter ID: %s (%u), length: %u, Flags: [0x%02x]",
503 tok2str(rsvp_intserv_parameter_id_values
,"unknown",parameter_id
),
508 if (obj_tlen
< parameter_length
+4)
510 switch(parameter_id
) { /* parameter_id */
514 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
515 * | 4 (e) | (f) | 1 (g) |
516 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
517 * | IS hop cnt (32-bit unsigned integer) |
518 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
520 if (parameter_length
== 4)
521 printf("\n\t\tIS hop count: %u", EXTRACT_32BITS(tptr
+4));
526 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
527 * | 6 (h) | (i) | 1 (j) |
528 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
529 * | Path b/w estimate (32-bit IEEE floating point number) |
530 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
532 if (parameter_length
== 4) {
533 bw
.i
= EXTRACT_32BITS(tptr
+4);
534 printf("\n\t\tPath b/w estimate: %.10g Mbps", bw
.f
/125000);
540 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
541 * | 8 (k) | (l) | 1 (m) |
542 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
543 * | Minimum path latency (32-bit integer) |
544 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
546 if (parameter_length
== 4) {
547 printf("\n\t\tMinimum path latency: ");
548 if (EXTRACT_32BITS(tptr
+4) == 0xffffffff)
549 printf("don't care");
551 printf("%u", EXTRACT_32BITS(tptr
+4));
558 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
559 * | 10 (n) | (o) | 1 (p) |
560 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
561 * | Composed MTU (32-bit unsigned integer) |
562 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
564 if (parameter_length
== 4)
565 printf("\n\t\tComposed MTU: %u bytes", EXTRACT_32BITS(tptr
+4));
569 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
570 * | 127 (e) | 0 (f) | 5 (g) |
571 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
572 * | Token Bucket Rate [r] (32-bit IEEE floating point number) |
573 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
574 * | Token Bucket Size [b] (32-bit IEEE floating point number) |
575 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
576 * | Peak Data Rate [p] (32-bit IEEE floating point number) |
577 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
578 * | Minimum Policed Unit [m] (32-bit integer) |
579 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
580 * | Maximum Packet Size [M] (32-bit integer) |
581 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
584 if (parameter_length
== 20) {
585 bw
.i
= EXTRACT_32BITS(tptr
+4);
586 printf("\n\t\tToken Bucket Rate: %.10g Mbps", bw
.f
/125000);
587 bw
.i
= EXTRACT_32BITS(tptr
+8);
588 printf("\n\t\tToken Bucket Size: %.10g bytes", bw
.f
);
589 bw
.i
= EXTRACT_32BITS(tptr
+12);
590 printf("\n\t\tPeak Data Rate: %.10g Mbps", bw
.f
/125000);
591 printf("\n\t\tMinimum Policed Unit: %u bytes", EXTRACT_32BITS(tptr
+16));
592 printf("\n\t\tMaximum Packet Size: %u bytes", EXTRACT_32BITS(tptr
+20));
598 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
599 * | 130 (h) | 0 (i) | 2 (j) |
600 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
601 * | Rate [R] (32-bit IEEE floating point number) |
602 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
603 * | Slack Term [S] (32-bit integer) |
604 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
607 if (parameter_length
== 8) {
608 bw
.i
= EXTRACT_32BITS(tptr
+4);
609 printf("\n\t\tRate: %.10g Mbps", bw
.f
/125000);
610 printf("\n\t\tSlack Term: %u", EXTRACT_32BITS(tptr
+8));
618 if (parameter_length
== 4)
619 printf("\n\t\tValue: %u", EXTRACT_32BITS(tptr
+4));
624 print_unknown_data(tptr
+4,"\n\t\t",parameter_length
);
626 return (parameter_length
+4); /* header length 4 bytes */
630 rsvp_obj_print (const u_char
*tptr
, const char *ident
, u_int tlen
) {
632 const struct rsvp_object_header
*rsvp_obj_header
;
633 const u_char
*obj_tptr
;
635 const struct rsvp_obj_integrity_t
*rsvp_obj_integrity
;
636 const struct rsvp_obj_frr_t
*rsvp_obj_frr
;
639 u_short rsvp_obj_len
,rsvp_obj_ctype
,obj_tlen
,intserv_serv_tlen
;
640 int hexdump
,processed
,padbytes
,error_code
,error_value
,i
;
647 u_int action
, subchannel
;
649 while(tlen
>=sizeof(struct rsvp_object_header
)) {
650 /* did we capture enough for fully decoding the object header ? */
651 if (!TTEST2(*tptr
, sizeof(struct rsvp_object_header
)))
654 rsvp_obj_header
= (const struct rsvp_object_header
*)tptr
;
655 rsvp_obj_len
=EXTRACT_16BITS(rsvp_obj_header
->length
);
656 rsvp_obj_ctype
=rsvp_obj_header
->ctype
;
658 if(rsvp_obj_len
% 4) {
659 printf("%sERROR: object header size %u not a multiple of 4", ident
, rsvp_obj_len
);
662 if(rsvp_obj_len
< sizeof(struct rsvp_object_header
)) {
663 printf("%sERROR: object header too short %u < %lu", ident
, rsvp_obj_len
,
664 (unsigned long)sizeof(const struct rsvp_object_header
));
668 printf("%s%s Object (%u) Flags: [%s",
670 tok2str(rsvp_obj_values
,
672 rsvp_obj_header
->class_num
),
673 rsvp_obj_header
->class_num
,
674 ((rsvp_obj_header
->class_num
)&0x80) ? "ignore" : "reject");
676 if (rsvp_obj_header
->class_num
> 128)
678 ((rsvp_obj_header
->class_num
)&0x40) ? "and forward" : "silently");
680 printf(" if unknown], Class-Type: %s (%u), length: %u",
681 tok2str(rsvp_ctype_values
,
683 ((rsvp_obj_header
->class_num
)<<8)+rsvp_obj_ctype
),
687 if(tlen
< rsvp_obj_len
) {
688 printf("%sERROR: object goes past end of objects TLV", ident
);
692 obj_tptr
=tptr
+sizeof(struct rsvp_object_header
);
693 obj_tlen
=rsvp_obj_len
-sizeof(struct rsvp_object_header
);
695 /* did we capture enough for fully decoding the object ? */
696 if (!TTEST2(*tptr
, rsvp_obj_len
))
700 switch(rsvp_obj_header
->class_num
) {
701 case RSVP_OBJ_SESSION
:
702 switch(rsvp_obj_ctype
) {
703 case RSVP_CTYPE_IPV4
:
706 printf("%s IPv4 DestAddress: %s, Protocol ID: 0x%02x",
708 ipaddr_string(obj_tptr
),
709 *(obj_tptr
+sizeof(struct in_addr
)));
710 printf("%s Flags: [0x%02x], DestPort %u",
713 EXTRACT_16BITS(obj_tptr
+6));
718 case RSVP_CTYPE_IPV6
:
721 printf("%s IPv6 DestAddress: %s, Protocol ID: 0x%02x",
723 ip6addr_string(obj_tptr
),
724 *(obj_tptr
+sizeof(struct in6_addr
)));
725 printf("%s Flags: [0x%02x], DestPort %u",
727 *(obj_tptr
+sizeof(struct in6_addr
)+1),
728 EXTRACT_16BITS(obj_tptr
+sizeof(struct in6_addr
)+2));
733 case RSVP_CTYPE_TUNNEL_IPV6
:
736 printf("%s IPv6 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
738 ip6addr_string(obj_tptr
),
739 EXTRACT_16BITS(obj_tptr
+18),
740 ip6addr_string(obj_tptr
+20));
745 case RSVP_CTYPE_14
: /* IPv6 p2mp LSP Tunnel */
748 printf("%s IPv6 P2MP LSP ID: 0x%08x, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
750 EXTRACT_32BITS(obj_tptr
),
751 EXTRACT_16BITS(obj_tptr
+6),
752 ip6addr_string(obj_tptr
+8));
757 case RSVP_CTYPE_13
: /* IPv4 p2mp LSP Tunnel */
760 printf("%s IPv4 P2MP LSP ID: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
762 ipaddr_string(obj_tptr
),
763 EXTRACT_16BITS(obj_tptr
+6),
764 ipaddr_string(obj_tptr
+8));
768 case RSVP_CTYPE_TUNNEL_IPV4
:
769 case RSVP_CTYPE_UNI_IPV4
:
772 printf("%s IPv4 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
774 ipaddr_string(obj_tptr
),
775 EXTRACT_16BITS(obj_tptr
+6),
776 ipaddr_string(obj_tptr
+8));
785 case RSVP_OBJ_CONFIRM
:
786 switch(rsvp_obj_ctype
) {
787 case RSVP_CTYPE_IPV4
:
788 if (obj_tlen
< sizeof(struct in_addr
))
790 printf("%s IPv4 Receiver Address: %s",
792 ipaddr_string(obj_tptr
));
793 obj_tlen
-=sizeof(struct in_addr
);
794 obj_tptr
+=sizeof(struct in_addr
);
797 case RSVP_CTYPE_IPV6
:
798 if (obj_tlen
< sizeof(struct in6_addr
))
800 printf("%s IPv6 Receiver Address: %s",
802 ip6addr_string(obj_tptr
));
803 obj_tlen
-=sizeof(struct in6_addr
);
804 obj_tptr
+=sizeof(struct in6_addr
);
812 case RSVP_OBJ_NOTIFY_REQ
:
813 switch(rsvp_obj_ctype
) {
814 case RSVP_CTYPE_IPV4
:
815 if (obj_tlen
< sizeof(struct in_addr
))
817 printf("%s IPv4 Notify Node Address: %s",
819 ipaddr_string(obj_tptr
));
820 obj_tlen
-=sizeof(struct in_addr
);
821 obj_tptr
+=sizeof(struct in_addr
);
824 case RSVP_CTYPE_IPV6
:
825 if (obj_tlen
< sizeof(struct in6_addr
))
827 printf("%s IPv6 Notify Node Address: %s",
829 ip6addr_string(obj_tptr
));
830 obj_tlen
-=sizeof(struct in6_addr
);
831 obj_tptr
+=sizeof(struct in6_addr
);
839 case RSVP_OBJ_SUGGESTED_LABEL
: /* fall through */
840 case RSVP_OBJ_UPSTREAM_LABEL
: /* fall through */
841 case RSVP_OBJ_RECOVERY_LABEL
: /* fall through */
843 switch(rsvp_obj_ctype
) {
845 while(obj_tlen
>= 4 ) {
846 printf("%s Label: %u", ident
, EXTRACT_32BITS(obj_tptr
));
854 printf("%s Generalized Label: %u",
856 EXTRACT_32BITS(obj_tptr
));
863 printf("%s Waveband ID: %u%s Start Label: %u, Stop Label: %u",
865 EXTRACT_32BITS(obj_tptr
),
867 EXTRACT_32BITS(obj_tptr
+4),
868 EXTRACT_32BITS(obj_tptr
+8));
878 switch(rsvp_obj_ctype
) {
882 printf("%s Reservation Style: %s, Flags: [0x%02x]",
884 tok2str(rsvp_resstyle_values
,
886 EXTRACT_24BITS(obj_tptr
+1)),
896 case RSVP_OBJ_SENDER_TEMPLATE
:
897 switch(rsvp_obj_ctype
) {
898 case RSVP_CTYPE_IPV4
:
901 printf("%s Source Address: %s, Source Port: %u",
903 ipaddr_string(obj_tptr
),
904 EXTRACT_16BITS(obj_tptr
+6));
909 case RSVP_CTYPE_IPV6
:
912 printf("%s Source Address: %s, Source Port: %u",
914 ip6addr_string(obj_tptr
),
915 EXTRACT_16BITS(obj_tptr
+18));
919 case RSVP_CTYPE_13
: /* IPv6 p2mp LSP tunnel */
922 printf("%s IPv6 Tunnel Sender Address: %s, LSP ID: 0x%04x"
923 "%s Sub-Group Originator ID: %s, Sub-Group ID: 0x%04x",
925 ip6addr_string(obj_tptr
),
926 EXTRACT_16BITS(obj_tptr
+18),
928 ip6addr_string(obj_tptr
+20),
929 EXTRACT_16BITS(obj_tptr
+38));
934 case RSVP_CTYPE_TUNNEL_IPV4
:
937 printf("%s IPv4 Tunnel Sender Address: %s, LSP-ID: 0x%04x",
939 ipaddr_string(obj_tptr
),
940 EXTRACT_16BITS(obj_tptr
+6));
944 case RSVP_CTYPE_12
: /* IPv4 p2mp LSP tunnel */
947 printf("%s IPv4 Tunnel Sender Address: %s, LSP ID: 0x%04x"
948 "%s Sub-Group Originator ID: %s, Sub-Group ID: 0x%04x",
950 ipaddr_string(obj_tptr
),
951 EXTRACT_16BITS(obj_tptr
+6),
953 ipaddr_string(obj_tptr
+8),
954 EXTRACT_16BITS(obj_tptr
+12));
963 case RSVP_OBJ_LABEL_REQ
:
964 switch(rsvp_obj_ctype
) {
966 while(obj_tlen
>= 4 ) {
967 printf("%s L3 Protocol ID: %s",
969 tok2str(ethertype_values
,
970 "Unknown Protocol (0x%04x)",
971 EXTRACT_16BITS(obj_tptr
+2)));
979 printf("%s L3 Protocol ID: %s",
981 tok2str(ethertype_values
,
982 "Unknown Protocol (0x%04x)",
983 EXTRACT_16BITS(obj_tptr
+2)));
984 printf(",%s merge capability",((*(obj_tptr
+4))&0x80) ? "no" : "" );
985 printf("%s Minimum VPI/VCI: %u/%u",
987 (EXTRACT_16BITS(obj_tptr
+4))&0xfff,
988 (EXTRACT_16BITS(obj_tptr
+6))&0xfff);
989 printf("%s Maximum VPI/VCI: %u/%u",
991 (EXTRACT_16BITS(obj_tptr
+8))&0xfff,
992 (EXTRACT_16BITS(obj_tptr
+10))&0xfff);
999 printf("%s L3 Protocol ID: %s",
1001 tok2str(ethertype_values
,
1002 "Unknown Protocol (0x%04x)",
1003 EXTRACT_16BITS(obj_tptr
+2)));
1004 printf("%s Minimum/Maximum DLCI: %u/%u, %s%s bit DLCI",
1006 (EXTRACT_32BITS(obj_tptr
+4))&0x7fffff,
1007 (EXTRACT_32BITS(obj_tptr
+8))&0x7fffff,
1008 (((EXTRACT_16BITS(obj_tptr
+4)>>7)&3) == 0 ) ? "10" : "",
1009 (((EXTRACT_16BITS(obj_tptr
+4)>>7)&3) == 2 ) ? "23" : "");
1016 printf("%s LSP Encoding Type: %s (%u)",
1018 tok2str(gmpls_encoding_values
,
1022 printf("%s Switching Type: %s (%u), Payload ID: %s (0x%04x)",
1024 tok2str(gmpls_switch_cap_values
,
1028 tok2str(gmpls_payload_values
,
1030 EXTRACT_16BITS(obj_tptr
+2)),
1031 EXTRACT_16BITS(obj_tptr
+2));
1042 switch(rsvp_obj_ctype
) {
1043 case RSVP_CTYPE_IPV4
:
1044 while(obj_tlen
>= 4 ) {
1045 printf("%s Subobject Type: %s, length %u",
1047 tok2str(rsvp_obj_xro_values
,
1049 RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr
)),
1052 if (*(obj_tptr
+1) == 0) { /* prevent infinite loops */
1053 printf("%s ERROR: zero length ERO subtype",ident
);
1057 switch(RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr
)) {
1058 case RSVP_OBJ_XRO_IPV4
:
1059 printf(", %s, %s/%u, Flags: [%s]",
1060 RSVP_OBJ_XRO_MASK_LOOSE(*obj_tptr
) ? "Loose" : "Strict",
1061 ipaddr_string(obj_tptr
+2),
1063 bittok2str(rsvp_obj_rro_flag_values
,
1065 *(obj_tptr
+7))); /* rfc3209 says that this field is rsvd. */
1067 obj_tlen
-=*(obj_tptr
+1);
1068 obj_tptr
+=*(obj_tptr
+1);
1076 case RSVP_OBJ_HELLO
:
1077 switch(rsvp_obj_ctype
) {
1082 printf("%s Source Instance: 0x%08x, Destination Instance: 0x%08x",
1084 EXTRACT_32BITS(obj_tptr
),
1085 EXTRACT_32BITS(obj_tptr
+4));
1094 case RSVP_OBJ_RESTART_CAPABILITY
:
1095 switch(rsvp_obj_ctype
) {
1099 printf("%s Restart Time: %ums, Recovery Time: %ums",
1101 EXTRACT_32BITS(obj_tptr
),
1102 EXTRACT_32BITS(obj_tptr
+4));
1111 case RSVP_OBJ_SESSION_ATTRIBUTE
:
1112 switch(rsvp_obj_ctype
) {
1113 case RSVP_CTYPE_TUNNEL_IPV4
:
1116 namelen
= *(obj_tptr
+3);
1117 if (obj_tlen
< 4+namelen
)
1119 printf("%s Session Name: ", ident
);
1120 for (i
= 0; i
< namelen
; i
++)
1121 safeputchar(*(obj_tptr
+4+i
));
1122 printf("%s Setup Priority: %u, Holding Priority: %u, Flags: [%s]",
1126 tok2str(rsvp_session_attribute_flag_values
,
1130 obj_tlen
-=4+*(obj_tptr
+3);
1131 obj_tptr
+=4+*(obj_tptr
+3);
1138 case RSVP_OBJ_GENERALIZED_UNI
:
1139 switch(rsvp_obj_ctype
) {
1140 int subobj_type
,af
,subobj_len
,total_subobj_len
;
1147 /* read variable length subobjects */
1148 total_subobj_len
= obj_tlen
;
1149 while(total_subobj_len
> 0) {
1150 subobj_len
= EXTRACT_16BITS(obj_tptr
);
1151 subobj_type
= (EXTRACT_16BITS(obj_tptr
+2))>>8;
1152 af
= (EXTRACT_16BITS(obj_tptr
+2))&0x00FF;
1154 printf("%s Subobject Type: %s (%u), AF: %s (%u), length: %u",
1156 tok2str(rsvp_obj_generalized_uni_values
, "Unknown", subobj_type
),
1158 tok2str(af_values
, "Unknown", af
), af
,
1161 switch(subobj_type
) {
1162 case RSVP_GEN_UNI_SUBOBJ_SOURCE_TNA_ADDRESS
:
1163 case RSVP_GEN_UNI_SUBOBJ_DESTINATION_TNA_ADDRESS
:
1169 printf("%s UNI IPv4 TNA address: %s",
1170 ident
, ipaddr_string(obj_tptr
+4));
1174 if (subobj_len
< 20)
1176 printf("%s UNI IPv6 TNA address: %s",
1177 ident
, ip6addr_string(obj_tptr
+4));
1182 /* unless we have a TLV parser lets just hexdump */
1189 case RSVP_GEN_UNI_SUBOBJ_DIVERSITY
:
1191 /* unless we have a TLV parser lets just hexdump */
1196 case RSVP_GEN_UNI_SUBOBJ_EGRESS_LABEL
:
1197 if (subobj_len
< 16) {
1201 printf("%s U-bit: %x, Label type: %u, Logical port id: %u, Label: %u",
1203 ((EXTRACT_32BITS(obj_tptr
+4))>>31),
1204 ((EXTRACT_32BITS(obj_tptr
+4))&0xFF),
1205 EXTRACT_32BITS(obj_tptr
+8),
1206 EXTRACT_32BITS(obj_tptr
+12));
1209 case RSVP_GEN_UNI_SUBOBJ_SERVICE_LEVEL
:
1210 if (subobj_len
< 8) {
1214 printf("%s Service level: %u",
1215 ident
, (EXTRACT_32BITS(obj_tptr
+4))>>24);
1222 total_subobj_len
-=subobj_len
;
1223 obj_tptr
+=subobj_len
;
1224 obj_tlen
+=subobj_len
;
1227 if (total_subobj_len
) {
1228 /* unless we have a TLV parser lets just hexdump */
1238 case RSVP_OBJ_RSVP_HOP
:
1239 switch(rsvp_obj_ctype
) {
1240 case RSVP_CTYPE_3
: /* fall through - FIXME add TLV parser */
1241 case RSVP_CTYPE_IPV4
:
1244 printf("%s Previous/Next Interface: %s, Logical Interface Handle: 0x%08x",
1246 ipaddr_string(obj_tptr
),
1247 EXTRACT_32BITS(obj_tptr
+4));
1251 hexdump
=TRUE
; /* unless we have a TLV parser lets just hexdump */
1254 case RSVP_CTYPE_4
: /* fall through - FIXME add TLV parser */
1255 case RSVP_CTYPE_IPV6
:
1258 printf("%s Previous/Next Interface: %s, Logical Interface Handle: 0x%08x",
1260 ip6addr_string(obj_tptr
),
1261 EXTRACT_32BITS(obj_tptr
+16));
1264 hexdump
=TRUE
; /* unless we have a TLV parser lets just hexdump */
1272 case RSVP_OBJ_TIME_VALUES
:
1273 switch(rsvp_obj_ctype
) {
1277 printf("%s Refresh Period: %ums",
1279 EXTRACT_32BITS(obj_tptr
));
1288 /* those three objects do share the same semantics */
1289 case RSVP_OBJ_SENDER_TSPEC
:
1290 case RSVP_OBJ_ADSPEC
:
1291 case RSVP_OBJ_FLOWSPEC
:
1292 switch(rsvp_obj_ctype
) {
1296 printf("%s Msg-Version: %u, length: %u",
1298 (*obj_tptr
& 0xf0) >> 4,
1299 EXTRACT_16BITS(obj_tptr
+2)<<2);
1300 obj_tptr
+=4; /* get to the start of the service header */
1303 while (obj_tlen
>= 4) {
1304 intserv_serv_tlen
=EXTRACT_16BITS(obj_tptr
+2)<<2;
1305 printf("%s Service Type: %s (%u), break bit %s set, Service length: %u",
1307 tok2str(rsvp_intserv_service_type_values
,"unknown",*(obj_tptr
)),
1309 (*(obj_tptr
+1)&0x80) ? "" : "not",
1312 obj_tptr
+=4; /* get to the start of the parameter list */
1315 while (intserv_serv_tlen
>=4) {
1316 processed
= rsvp_intserv_print(obj_tptr
, obj_tlen
);
1319 obj_tlen
-=processed
;
1320 intserv_serv_tlen
-=processed
;
1321 obj_tptr
+=processed
;
1330 case RSVP_OBJ_FILTERSPEC
:
1331 switch(rsvp_obj_ctype
) {
1332 case RSVP_CTYPE_IPV4
:
1335 printf("%s Source Address: %s, Source Port: %u",
1337 ipaddr_string(obj_tptr
),
1338 EXTRACT_16BITS(obj_tptr
+6));
1343 case RSVP_CTYPE_IPV6
:
1346 printf("%s Source Address: %s, Source Port: %u",
1348 ip6addr_string(obj_tptr
),
1349 EXTRACT_16BITS(obj_tptr
+18));
1356 printf("%s Source Address: %s, Flow Label: %u",
1358 ip6addr_string(obj_tptr
),
1359 EXTRACT_24BITS(obj_tptr
+17));
1363 case RSVP_CTYPE_TUNNEL_IPV6
:
1366 printf("%s Source Address: %s, LSP-ID: 0x%04x",
1368 ipaddr_string(obj_tptr
),
1369 EXTRACT_16BITS(obj_tptr
+18));
1373 case RSVP_CTYPE_13
: /* IPv6 p2mp LSP tunnel */
1376 printf("%s IPv6 Tunnel Sender Address: %s, LSP ID: 0x%04x"
1377 "%s Sub-Group Originator ID: %s, Sub-Group ID: 0x%04x",
1379 ip6addr_string(obj_tptr
),
1380 EXTRACT_16BITS(obj_tptr
+18),
1382 ip6addr_string(obj_tptr
+20),
1383 EXTRACT_16BITS(obj_tptr
+38));
1388 case RSVP_CTYPE_TUNNEL_IPV4
:
1391 printf("%s Source Address: %s, LSP-ID: 0x%04x",
1393 ipaddr_string(obj_tptr
),
1394 EXTRACT_16BITS(obj_tptr
+6));
1398 case RSVP_CTYPE_12
: /* IPv4 p2mp LSP tunnel */
1401 printf("%s IPv4 Tunnel Sender Address: %s, LSP ID: 0x%04x"
1402 "%s Sub-Group Originator ID: %s, Sub-Group ID: 0x%04x",
1404 ipaddr_string(obj_tptr
),
1405 EXTRACT_16BITS(obj_tptr
+6),
1407 ipaddr_string(obj_tptr
+8),
1408 EXTRACT_16BITS(obj_tptr
+12));
1417 case RSVP_OBJ_FASTREROUTE
:
1418 /* the differences between c-type 1 and 7 are minor */
1419 obj_ptr
.rsvp_obj_frr
= (const struct rsvp_obj_frr_t
*)obj_tptr
;
1420 bw
.i
= EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->bandwidth
);
1422 switch(rsvp_obj_ctype
) {
1423 case RSVP_CTYPE_1
: /* new style */
1424 if (obj_tlen
< sizeof(struct rsvp_obj_frr_t
))
1426 printf("%s Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps",
1428 (int)obj_ptr
.rsvp_obj_frr
->setup_prio
,
1429 (int)obj_ptr
.rsvp_obj_frr
->hold_prio
,
1430 (int)obj_ptr
.rsvp_obj_frr
->hop_limit
,
1432 printf("%s Include-any: 0x%08x, Exclude-any: 0x%08x, Include-all: 0x%08x",
1434 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->include_any
),
1435 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->exclude_any
),
1436 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->include_all
));
1437 obj_tlen
-=sizeof(struct rsvp_obj_frr_t
);
1438 obj_tptr
+=sizeof(struct rsvp_obj_frr_t
);
1441 case RSVP_CTYPE_TUNNEL_IPV4
: /* old style */
1444 printf("%s Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps",
1446 (int)obj_ptr
.rsvp_obj_frr
->setup_prio
,
1447 (int)obj_ptr
.rsvp_obj_frr
->hold_prio
,
1448 (int)obj_ptr
.rsvp_obj_frr
->hop_limit
,
1450 printf("%s Include Colors: 0x%08x, Exclude Colors: 0x%08x",
1452 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->include_any
),
1453 EXTRACT_32BITS(obj_ptr
.rsvp_obj_frr
->exclude_any
));
1463 case RSVP_OBJ_DETOUR
:
1464 switch(rsvp_obj_ctype
) {
1465 case RSVP_CTYPE_TUNNEL_IPV4
:
1466 while(obj_tlen
>= 8) {
1467 printf("%s PLR-ID: %s, Avoid-Node-ID: %s",
1469 ipaddr_string(obj_tptr
),
1470 ipaddr_string(obj_tptr
+4));
1480 case RSVP_OBJ_CLASSTYPE
:
1481 case RSVP_OBJ_CLASSTYPE_OLD
: /* fall through */
1482 switch(rsvp_obj_ctype
) {
1486 EXTRACT_32BITS(obj_tptr
)&0x7);
1495 case RSVP_OBJ_ERROR_SPEC
:
1496 switch(rsvp_obj_ctype
) {
1497 case RSVP_CTYPE_3
: /* fall through - FIXME add TLV parser */
1498 case RSVP_CTYPE_IPV4
:
1501 error_code
=*(obj_tptr
+5);
1502 error_value
=EXTRACT_16BITS(obj_tptr
+6);
1503 printf("%s Error Node Address: %s, Flags: [0x%02x]%s Error Code: %s (%u)",
1505 ipaddr_string(obj_tptr
),
1508 tok2str(rsvp_obj_error_code_values
,"unknown",error_code
),
1510 switch (error_code
) {
1511 case RSVP_OBJ_ERROR_SPEC_CODE_ROUTING
:
1512 printf(", Error Value: %s (%u)",
1513 tok2str(rsvp_obj_error_code_routing_values
,"unknown",error_value
),
1516 case RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE
: /* fall through */
1517 case RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE_OLD
:
1518 printf(", Error Value: %s (%u)",
1519 tok2str(rsvp_obj_error_code_diffserv_te_values
,"unknown",error_value
),
1523 printf(", Unknown Error Value (%u)", error_value
);
1530 case RSVP_CTYPE_4
: /* fall through - FIXME add TLV parser */
1531 case RSVP_CTYPE_IPV6
:
1534 error_code
=*(obj_tptr
+17);
1535 error_value
=EXTRACT_16BITS(obj_tptr
+18);
1536 printf("%s Error Node Address: %s, Flags: [0x%02x]%s Error Code: %s (%u)",
1538 ip6addr_string(obj_tptr
),
1541 tok2str(rsvp_obj_error_code_values
,"unknown",error_code
),
1544 switch (error_code
) {
1545 case RSVP_OBJ_ERROR_SPEC_CODE_ROUTING
:
1546 printf(", Error Value: %s (%u)",
1547 tok2str(rsvp_obj_error_code_routing_values
,"unknown",error_value
),
1562 case RSVP_OBJ_PROPERTIES
:
1563 switch(rsvp_obj_ctype
) {
1567 padbytes
= EXTRACT_16BITS(obj_tptr
+2);
1568 printf("%s TLV count: %u, padding bytes: %u",
1570 EXTRACT_16BITS(obj_tptr
),
1574 /* loop through as long there is anything longer than the TLV header (2) */
1575 while(obj_tlen
>= 2 + padbytes
) {
1576 printf("%s %s TLV (0x%02x), length: %u", /* length includes header */
1578 tok2str(rsvp_obj_prop_tlv_values
,"unknown",*obj_tptr
),
1581 if (obj_tlen
< *(obj_tptr
+1))
1583 if (*(obj_tptr
+1) < 2)
1585 print_unknown_data(obj_tptr
+2,"\n\t\t",*(obj_tptr
+1)-2);
1586 obj_tlen
-=*(obj_tptr
+1);
1587 obj_tptr
+=*(obj_tptr
+1);
1595 case RSVP_OBJ_MESSAGE_ID
: /* fall through */
1596 case RSVP_OBJ_MESSAGE_ID_ACK
: /* fall through */
1597 case RSVP_OBJ_MESSAGE_ID_LIST
:
1598 switch(rsvp_obj_ctype
) {
1603 printf("%s Flags [0x%02x], epoch: %u",
1606 EXTRACT_24BITS(obj_tptr
+1));
1609 /* loop through as long there are no messages left */
1610 while(obj_tlen
>= 4) {
1611 printf("%s Message-ID 0x%08x (%u)",
1613 EXTRACT_32BITS(obj_tptr
),
1614 EXTRACT_32BITS(obj_tptr
));
1624 case RSVP_OBJ_INTEGRITY
:
1625 switch(rsvp_obj_ctype
) {
1627 if (obj_tlen
< sizeof(struct rsvp_obj_integrity_t
))
1629 obj_ptr
.rsvp_obj_integrity
= (const struct rsvp_obj_integrity_t
*)obj_tptr
;
1630 printf("%s Key-ID 0x%04x%08x, Sequence 0x%08x%08x, Flags [%s]",
1632 EXTRACT_16BITS(obj_ptr
.rsvp_obj_integrity
->key_id
),
1633 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->key_id
+2),
1634 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->sequence
),
1635 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->sequence
+4),
1636 bittok2str(rsvp_obj_integrity_flag_values
,
1638 obj_ptr
.rsvp_obj_integrity
->flags
));
1639 printf("%s MD5-sum 0x%08x%08x%08x%08x (unverified)",
1641 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->digest
),
1642 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->digest
+4),
1643 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->digest
+8),
1644 EXTRACT_32BITS(obj_ptr
.rsvp_obj_integrity
->digest
+12));
1645 obj_tlen
+=sizeof(struct rsvp_obj_integrity_t
);
1646 obj_tptr
+=sizeof(struct rsvp_obj_integrity_t
);
1653 case RSVP_OBJ_ADMIN_STATUS
:
1654 switch(rsvp_obj_ctype
) {
1658 printf("%s Flags [%s]", ident
,
1659 bittok2str(rsvp_obj_admin_status_flag_values
, "none",
1660 EXTRACT_32BITS(obj_tptr
)));
1669 case RSVP_OBJ_LABEL_SET
:
1670 switch(rsvp_obj_ctype
) {
1674 action
= (EXTRACT_16BITS(obj_tptr
)>>8);
1676 printf("%s Action: %s (%u), Label type: %u", ident
,
1677 tok2str(rsvp_obj_label_set_action_values
, "Unknown", action
),
1678 action
, ((EXTRACT_32BITS(obj_tptr
) & 0x7F)));
1681 case LABEL_SET_INCLUSIVE_RANGE
:
1682 case LABEL_SET_EXCLUSIVE_RANGE
: /* fall through */
1684 /* only a couple of subchannels are expected */
1687 printf("%s Start range: %u, End range: %u", ident
,
1688 EXTRACT_32BITS(obj_tptr
+4),
1689 EXTRACT_32BITS(obj_tptr
+8));
1698 while(obj_tlen
>= 4 ) {
1699 printf("%s Subchannel #%u: %u", ident
, subchannel
,
1700 EXTRACT_32BITS(obj_tptr
));
1713 switch (rsvp_obj_ctype
) {
1714 case RSVP_CTYPE_IPV4
:
1717 printf("%s Sub-LSP destination address: %s",
1718 ident
, ipaddr_string(obj_tptr
));
1724 case RSVP_CTYPE_IPV6
:
1727 printf("%s Sub-LSP destination address: %s",
1728 ident
, ip6addr_string(obj_tptr
));
1739 * FIXME those are the defined objects that lack a decoder
1740 * you are welcome to contribute code ;-)
1743 case RSVP_OBJ_SCOPE
:
1744 case RSVP_OBJ_POLICY_DATA
:
1745 case RSVP_OBJ_ACCEPT_LABEL_SET
:
1746 case RSVP_OBJ_PROTECTION
:
1749 print_unknown_data(obj_tptr
,"\n\t ",obj_tlen
); /* FIXME indentation */
1752 /* do we also want to see a hex dump ? */
1753 if (vflag
> 1 || hexdump
==TRUE
)
1754 print_unknown_data(tptr
+sizeof(sizeof(struct rsvp_object_header
)),"\n\t ", /* FIXME indentation */
1755 rsvp_obj_len
-sizeof(struct rsvp_object_header
));
1762 printf("\n\t\t packet exceeded snapshot");
1768 rsvp_print(register const u_char
*pptr
, register u_int len
) {
1770 const struct rsvp_common_header
*rsvp_com_header
;
1771 const u_char
*tptr
,*subtptr
;
1772 u_short tlen
,subtlen
;
1776 rsvp_com_header
= (const struct rsvp_common_header
*)pptr
;
1777 TCHECK(*rsvp_com_header
);
1780 * Sanity checking of the header.
1782 if (RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
) != RSVP_VERSION
) {
1783 printf("ERROR: RSVP version %u packet not supported",
1784 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
));
1788 /* in non-verbose mode just lets print the basic Message Type*/
1790 printf("RSVPv%u %s Message, length: %u",
1791 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
),
1792 tok2str(rsvp_msg_type_values
, "unknown (%u)",rsvp_com_header
->msg_type
),
1797 /* ok they seem to want to know everything - lets fully decode it */
1799 tlen
=EXTRACT_16BITS(rsvp_com_header
->length
);
1801 printf("\n\tRSVPv%u %s Message (%u), Flags: [%s], length: %u, ttl: %u, checksum: 0x%04x",
1802 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
),
1803 tok2str(rsvp_msg_type_values
, "unknown, type: %u",rsvp_com_header
->msg_type
),
1804 rsvp_com_header
->msg_type
,
1805 bittok2str(rsvp_header_flag_values
,"none",RSVP_EXTRACT_FLAGS(rsvp_com_header
->version_flags
)),
1807 rsvp_com_header
->ttl
,
1808 EXTRACT_16BITS(rsvp_com_header
->checksum
));
1810 if (tlen
< sizeof(const struct rsvp_common_header
)) {
1811 printf("ERROR: common header too short %u < %lu", tlen
,
1812 (unsigned long)sizeof(const struct rsvp_common_header
));
1816 tptr
+=sizeof(const struct rsvp_common_header
);
1817 tlen
-=sizeof(const struct rsvp_common_header
);
1819 switch(rsvp_com_header
->msg_type
) {
1821 case RSVP_MSGTYPE_AGGREGATE
:
1824 rsvp_com_header
= (const struct rsvp_common_header
*)subtptr
;
1825 TCHECK(*rsvp_com_header
);
1828 * Sanity checking of the header.
1830 if (RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
) != RSVP_VERSION
) {
1831 printf("ERROR: RSVP version %u packet not supported",
1832 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
));
1835 subtlen
=EXTRACT_16BITS(rsvp_com_header
->length
);
1837 printf("\n\t RSVPv%u %s Message (%u), Flags: [%s], length: %u, ttl: %u, checksum: 0x%04x",
1838 RSVP_EXTRACT_VERSION(rsvp_com_header
->version_flags
),
1839 tok2str(rsvp_msg_type_values
, "unknown, type: %u",rsvp_com_header
->msg_type
),
1840 rsvp_com_header
->msg_type
,
1841 bittok2str(rsvp_header_flag_values
,"none",RSVP_EXTRACT_FLAGS(rsvp_com_header
->version_flags
)),
1843 rsvp_com_header
->ttl
,
1844 EXTRACT_16BITS(rsvp_com_header
->checksum
));
1846 if (subtlen
< sizeof(const struct rsvp_common_header
)) {
1847 printf("ERROR: common header too short %u < %lu", subtlen
,
1848 (unsigned long)sizeof(const struct rsvp_common_header
));
1852 if (tlen
< subtlen
) {
1853 printf("ERROR: common header too large %u > %u", subtlen
,
1858 subtptr
+=sizeof(const struct rsvp_common_header
);
1859 subtlen
-=sizeof(const struct rsvp_common_header
);
1861 if (rsvp_obj_print(subtptr
,"\n\t ", subtlen
) == -1)
1864 tptr
+=subtlen
+sizeof(const struct rsvp_common_header
);
1865 tlen
-=subtlen
+sizeof(const struct rsvp_common_header
);
1870 case RSVP_MSGTYPE_PATH
:
1871 case RSVP_MSGTYPE_RESV
:
1872 case RSVP_MSGTYPE_PATHERR
:
1873 case RSVP_MSGTYPE_RESVERR
:
1874 case RSVP_MSGTYPE_PATHTEAR
:
1875 case RSVP_MSGTYPE_RESVTEAR
:
1876 case RSVP_MSGTYPE_RESVCONF
:
1877 case RSVP_MSGTYPE_HELLO_OLD
:
1878 case RSVP_MSGTYPE_HELLO
:
1879 case RSVP_MSGTYPE_ACK
:
1880 case RSVP_MSGTYPE_SREFRESH
:
1881 if (rsvp_obj_print(tptr
,"\n\t ", tlen
) == -1)
1886 print_unknown_data(tptr
,"\n\t ",tlen
);
1892 printf("\n\t\t packet exceeded snapshot");