print-rsvp.c revision 1.4 1 1.1 christos /*
2 1.1 christos * Copyright (c) 1998-2007 The TCPDUMP project
3 1.1 christos *
4 1.1 christos * Redistribution and use in source and binary forms, with or without
5 1.1 christos * modification, are permitted provided that: (1) source code
6 1.1 christos * distributions retain the above copyright notice and this paragraph
7 1.1 christos * in its entirety, and (2) distributions including binary code include
8 1.1 christos * the above copyright notice and this paragraph in its entirety in
9 1.1 christos * the documentation or other materials provided with the distribution.
10 1.1 christos * THIS SOFTWARE IS PROVIDED ``AS IS'' AND
11 1.1 christos * WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
12 1.1 christos * LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
13 1.1 christos * FOR A PARTICULAR PURPOSE.
14 1.1 christos *
15 1.1 christos * Original code by Hannes Gredler (hannes (at) juniper.net)
16 1.1 christos */
17 1.1 christos
18 1.2 christos #include <sys/cdefs.h>
19 1.1 christos #ifndef lint
20 1.2 christos #if 0
21 1.1 christos static const char rcsid[] _U_ =
22 1.4 christos "@(#) Header: /tcpdump/master/tcpdump/print-rsvp.c,v 1.50 2008-08-16 11:36:20 hannes Exp ";
23 1.2 christos #else
24 1.4 christos __RCSID("$NetBSD: print-rsvp.c,v 1.4 2013/04/06 19:33:08 christos Exp $");
25 1.2 christos #endif
26 1.1 christos #endif
27 1.1 christos
28 1.1 christos #ifdef HAVE_CONFIG_H
29 1.1 christos #include "config.h"
30 1.1 christos #endif
31 1.1 christos
32 1.1 christos #include <tcpdump-stdinc.h>
33 1.1 christos
34 1.1 christos #include <stdio.h>
35 1.1 christos #include <stdlib.h>
36 1.1 christos #include <string.h>
37 1.1 christos
38 1.1 christos #include "interface.h"
39 1.1 christos #include "extract.h"
40 1.1 christos #include "addrtoname.h"
41 1.1 christos #include "ethertype.h"
42 1.1 christos #include "gmpls.h"
43 1.1 christos #include "af.h"
44 1.1 christos #include "signature.h"
45 1.1 christos
46 1.1 christos /*
47 1.1 christos * RFC 2205 common header
48 1.1 christos *
49 1.1 christos * 0 1 2 3
50 1.1 christos * +-------------+-------------+-------------+-------------+
51 1.1 christos * | Vers | Flags| Msg Type | RSVP Checksum |
52 1.1 christos * +-------------+-------------+-------------+-------------+
53 1.1 christos * | Send_TTL | (Reserved) | RSVP Length |
54 1.1 christos * +-------------+-------------+-------------+-------------+
55 1.1 christos *
56 1.1 christos */
57 1.1 christos
58 1.1 christos struct rsvp_common_header {
59 1.1 christos u_int8_t version_flags;
60 1.1 christos u_int8_t msg_type;
61 1.1 christos u_int8_t checksum[2];
62 1.1 christos u_int8_t ttl;
63 1.1 christos u_int8_t reserved;
64 1.1 christos u_int8_t length[2];
65 1.1 christos };
66 1.1 christos
67 1.1 christos /*
68 1.1 christos * RFC2205 object header
69 1.1 christos *
70 1.1 christos *
71 1.1 christos * 0 1 2 3
72 1.1 christos * +-------------+-------------+-------------+-------------+
73 1.1 christos * | Length (bytes) | Class-Num | C-Type |
74 1.1 christos * +-------------+-------------+-------------+-------------+
75 1.1 christos * | |
76 1.1 christos * // (Object contents) //
77 1.1 christos * | |
78 1.1 christos * +-------------+-------------+-------------+-------------+
79 1.1 christos */
80 1.1 christos
81 1.1 christos struct rsvp_object_header {
82 1.1 christos u_int8_t length[2];
83 1.1 christos u_int8_t class_num;
84 1.1 christos u_int8_t ctype;
85 1.1 christos };
86 1.1 christos
87 1.1 christos #define RSVP_VERSION 1
88 1.1 christos #define RSVP_EXTRACT_VERSION(x) (((x)&0xf0)>>4)
89 1.1 christos #define RSVP_EXTRACT_FLAGS(x) ((x)&0x0f)
90 1.1 christos
91 1.1 christos #define RSVP_MSGTYPE_PATH 1
92 1.1 christos #define RSVP_MSGTYPE_RESV 2
93 1.1 christos #define RSVP_MSGTYPE_PATHERR 3
94 1.1 christos #define RSVP_MSGTYPE_RESVERR 4
95 1.1 christos #define RSVP_MSGTYPE_PATHTEAR 5
96 1.1 christos #define RSVP_MSGTYPE_RESVTEAR 6
97 1.1 christos #define RSVP_MSGTYPE_RESVCONF 7
98 1.1 christos #define RSVP_MSGTYPE_AGGREGATE 12
99 1.1 christos #define RSVP_MSGTYPE_ACK 13
100 1.1 christos #define RSVP_MSGTYPE_HELLO_OLD 14 /* ancient Hellos */
101 1.1 christos #define RSVP_MSGTYPE_SREFRESH 15
102 1.1 christos #define RSVP_MSGTYPE_HELLO 20
103 1.1 christos
104 1.1 christos static const struct tok rsvp_msg_type_values[] = {
105 1.1 christos { RSVP_MSGTYPE_PATH, "Path" },
106 1.1 christos { RSVP_MSGTYPE_RESV, "Resv" },
107 1.1 christos { RSVP_MSGTYPE_PATHERR, "PathErr" },
108 1.1 christos { RSVP_MSGTYPE_RESVERR, "ResvErr" },
109 1.1 christos { RSVP_MSGTYPE_PATHTEAR, "PathTear" },
110 1.1 christos { RSVP_MSGTYPE_RESVTEAR, "ResvTear" },
111 1.1 christos { RSVP_MSGTYPE_RESVCONF, "ResvConf" },
112 1.1 christos { RSVP_MSGTYPE_AGGREGATE, "Aggregate" },
113 1.1 christos { RSVP_MSGTYPE_ACK, "Acknowledgement" },
114 1.1 christos { RSVP_MSGTYPE_HELLO_OLD, "Hello (Old)" },
115 1.1 christos { RSVP_MSGTYPE_SREFRESH, "Refresh" },
116 1.1 christos { RSVP_MSGTYPE_HELLO, "Hello" },
117 1.1 christos { 0, NULL}
118 1.1 christos };
119 1.1 christos
120 1.1 christos static const struct tok rsvp_header_flag_values[] = {
121 1.1 christos { 0x01, "Refresh reduction capable" }, /* rfc2961 */
122 1.1 christos { 0, NULL}
123 1.1 christos };
124 1.1 christos
125 1.1 christos #define RSVP_OBJ_SESSION 1 /* rfc2205 */
126 1.1 christos #define RSVP_OBJ_RSVP_HOP 3 /* rfc2205, rfc3473 */
127 1.1 christos #define RSVP_OBJ_INTEGRITY 4 /* rfc2747 */
128 1.1 christos #define RSVP_OBJ_TIME_VALUES 5 /* rfc2205 */
129 1.1 christos #define RSVP_OBJ_ERROR_SPEC 6
130 1.1 christos #define RSVP_OBJ_SCOPE 7
131 1.1 christos #define RSVP_OBJ_STYLE 8 /* rfc2205 */
132 1.1 christos #define RSVP_OBJ_FLOWSPEC 9 /* rfc2215 */
133 1.1 christos #define RSVP_OBJ_FILTERSPEC 10 /* rfc2215 */
134 1.1 christos #define RSVP_OBJ_SENDER_TEMPLATE 11
135 1.1 christos #define RSVP_OBJ_SENDER_TSPEC 12 /* rfc2215 */
136 1.1 christos #define RSVP_OBJ_ADSPEC 13 /* rfc2215 */
137 1.1 christos #define RSVP_OBJ_POLICY_DATA 14
138 1.1 christos #define RSVP_OBJ_CONFIRM 15 /* rfc2205 */
139 1.1 christos #define RSVP_OBJ_LABEL 16 /* rfc3209 */
140 1.1 christos #define RSVP_OBJ_LABEL_REQ 19 /* rfc3209 */
141 1.1 christos #define RSVP_OBJ_ERO 20 /* rfc3209 */
142 1.1 christos #define RSVP_OBJ_RRO 21 /* rfc3209 */
143 1.1 christos #define RSVP_OBJ_HELLO 22 /* rfc3209 */
144 1.1 christos #define RSVP_OBJ_MESSAGE_ID 23 /* rfc2961 */
145 1.1 christos #define RSVP_OBJ_MESSAGE_ID_ACK 24 /* rfc2961 */
146 1.1 christos #define RSVP_OBJ_MESSAGE_ID_LIST 25 /* rfc2961 */
147 1.1 christos #define RSVP_OBJ_RECOVERY_LABEL 34 /* rfc3473 */
148 1.1 christos #define RSVP_OBJ_UPSTREAM_LABEL 35 /* rfc3473 */
149 1.1 christos #define RSVP_OBJ_LABEL_SET 36 /* rfc3473 */
150 1.1 christos #define RSVP_OBJ_PROTECTION 37 /* rfc3473 */
151 1.1 christos #define RSVP_OBJ_S2L 50 /* rfc4875 */
152 1.1 christos #define RSVP_OBJ_DETOUR 63 /* draft-ietf-mpls-rsvp-lsp-fastreroute-07 */
153 1.1 christos #define RSVP_OBJ_CLASSTYPE 66 /* rfc4124 */
154 1.1 christos #define RSVP_OBJ_CLASSTYPE_OLD 125 /* draft-ietf-tewg-diff-te-proto-07 */
155 1.1 christos #define RSVP_OBJ_SUGGESTED_LABEL 129 /* rfc3473 */
156 1.1 christos #define RSVP_OBJ_ACCEPT_LABEL_SET 130 /* rfc3473 */
157 1.1 christos #define RSVP_OBJ_RESTART_CAPABILITY 131 /* rfc3473 */
158 1.1 christos #define RSVP_OBJ_NOTIFY_REQ 195 /* rfc3473 */
159 1.1 christos #define RSVP_OBJ_ADMIN_STATUS 196 /* rfc3473 */
160 1.1 christos #define RSVP_OBJ_PROPERTIES 204 /* juniper proprietary */
161 1.1 christos #define RSVP_OBJ_FASTREROUTE 205 /* draft-ietf-mpls-rsvp-lsp-fastreroute-07 */
162 1.1 christos #define RSVP_OBJ_SESSION_ATTRIBUTE 207 /* rfc3209 */
163 1.1 christos #define RSVP_OBJ_GENERALIZED_UNI 229 /* OIF RSVP extensions UNI 1.0 Signaling, Rel. 2 */
164 1.1 christos #define RSVP_OBJ_CALL_ID 230 /* rfc3474 */
165 1.1 christos #define RSVP_OBJ_CALL_OPS 236 /* rfc3474 */
166 1.1 christos
167 1.1 christos static const struct tok rsvp_obj_values[] = {
168 1.1 christos { RSVP_OBJ_SESSION, "Session" },
169 1.1 christos { RSVP_OBJ_RSVP_HOP, "RSVP Hop" },
170 1.1 christos { RSVP_OBJ_INTEGRITY, "Integrity" },
171 1.1 christos { RSVP_OBJ_TIME_VALUES, "Time Values" },
172 1.1 christos { RSVP_OBJ_ERROR_SPEC, "Error Spec" },
173 1.1 christos { RSVP_OBJ_SCOPE, "Scope" },
174 1.1 christos { RSVP_OBJ_STYLE, "Style" },
175 1.1 christos { RSVP_OBJ_FLOWSPEC, "Flowspec" },
176 1.1 christos { RSVP_OBJ_FILTERSPEC, "FilterSpec" },
177 1.1 christos { RSVP_OBJ_SENDER_TEMPLATE, "Sender Template" },
178 1.1 christos { RSVP_OBJ_SENDER_TSPEC, "Sender TSpec" },
179 1.1 christos { RSVP_OBJ_ADSPEC, "Adspec" },
180 1.1 christos { RSVP_OBJ_POLICY_DATA, "Policy Data" },
181 1.1 christos { RSVP_OBJ_CONFIRM, "Confirm" },
182 1.1 christos { RSVP_OBJ_LABEL, "Label" },
183 1.1 christos { RSVP_OBJ_LABEL_REQ, "Label Request" },
184 1.1 christos { RSVP_OBJ_ERO, "ERO" },
185 1.1 christos { RSVP_OBJ_RRO, "RRO" },
186 1.1 christos { RSVP_OBJ_HELLO, "Hello" },
187 1.1 christos { RSVP_OBJ_MESSAGE_ID, "Message ID" },
188 1.1 christos { RSVP_OBJ_MESSAGE_ID_ACK, "Message ID Ack" },
189 1.1 christos { RSVP_OBJ_MESSAGE_ID_LIST, "Message ID List" },
190 1.1 christos { RSVP_OBJ_RECOVERY_LABEL, "Recovery Label" },
191 1.1 christos { RSVP_OBJ_UPSTREAM_LABEL, "Upstream Label" },
192 1.1 christos { RSVP_OBJ_LABEL_SET, "Label Set" },
193 1.1 christos { RSVP_OBJ_ACCEPT_LABEL_SET, "Acceptable Label Set" },
194 1.1 christos { RSVP_OBJ_DETOUR, "Detour" },
195 1.1 christos { RSVP_OBJ_CLASSTYPE, "Class Type" },
196 1.1 christos { RSVP_OBJ_CLASSTYPE_OLD, "Class Type (old)" },
197 1.1 christos { RSVP_OBJ_SUGGESTED_LABEL, "Suggested Label" },
198 1.1 christos { RSVP_OBJ_PROPERTIES, "Properties" },
199 1.1 christos { RSVP_OBJ_FASTREROUTE, "Fast Re-Route" },
200 1.1 christos { RSVP_OBJ_SESSION_ATTRIBUTE, "Session Attribute" },
201 1.1 christos { RSVP_OBJ_GENERALIZED_UNI, "Generalized UNI" },
202 1.1 christos { RSVP_OBJ_CALL_ID, "Call-ID" },
203 1.1 christos { RSVP_OBJ_CALL_OPS, "Call Capability" },
204 1.1 christos { RSVP_OBJ_RESTART_CAPABILITY, "Restart Capability" },
205 1.1 christos { RSVP_OBJ_NOTIFY_REQ, "Notify Request" },
206 1.1 christos { RSVP_OBJ_PROTECTION, "Protection" },
207 1.1 christos { RSVP_OBJ_ADMIN_STATUS, "Administrative Status" },
208 1.1 christos { RSVP_OBJ_S2L, "Sub-LSP to LSP" },
209 1.1 christos { 0, NULL}
210 1.1 christos };
211 1.1 christos
212 1.1 christos #define RSVP_CTYPE_IPV4 1
213 1.1 christos #define RSVP_CTYPE_IPV6 2
214 1.1 christos #define RSVP_CTYPE_TUNNEL_IPV4 7
215 1.1 christos #define RSVP_CTYPE_TUNNEL_IPV6 8
216 1.1 christos #define RSVP_CTYPE_UNI_IPV4 11 /* OIF RSVP extensions UNI 1.0 Signaling Rel. 2 */
217 1.1 christos #define RSVP_CTYPE_1 1
218 1.1 christos #define RSVP_CTYPE_2 2
219 1.1 christos #define RSVP_CTYPE_3 3
220 1.1 christos #define RSVP_CTYPE_4 4
221 1.1 christos #define RSVP_CTYPE_12 12
222 1.1 christos #define RSVP_CTYPE_13 13
223 1.1 christos #define RSVP_CTYPE_14 14
224 1.1 christos
225 1.1 christos /*
226 1.1 christos * the ctypes are not globally unique so for
227 1.1 christos * translating it to strings we build a table based
228 1.1 christos * on objects offsetted by the ctype
229 1.1 christos */
230 1.1 christos
231 1.1 christos static const struct tok rsvp_ctype_values[] = {
232 1.1 christos { 256*RSVP_OBJ_RSVP_HOP+RSVP_CTYPE_IPV4, "IPv4" },
233 1.1 christos { 256*RSVP_OBJ_RSVP_HOP+RSVP_CTYPE_IPV6, "IPv6" },
234 1.1 christos { 256*RSVP_OBJ_RSVP_HOP+RSVP_CTYPE_3, "IPv4 plus opt. TLVs" },
235 1.1 christos { 256*RSVP_OBJ_RSVP_HOP+RSVP_CTYPE_4, "IPv6 plus opt. TLVs" },
236 1.1 christos { 256*RSVP_OBJ_NOTIFY_REQ+RSVP_CTYPE_IPV4, "IPv4" },
237 1.1 christos { 256*RSVP_OBJ_NOTIFY_REQ+RSVP_CTYPE_IPV6, "IPv6" },
238 1.1 christos { 256*RSVP_OBJ_CONFIRM+RSVP_CTYPE_IPV4, "IPv4" },
239 1.1 christos { 256*RSVP_OBJ_CONFIRM+RSVP_CTYPE_IPV6, "IPv6" },
240 1.1 christos { 256*RSVP_OBJ_TIME_VALUES+RSVP_CTYPE_1, "1" },
241 1.1 christos { 256*RSVP_OBJ_FLOWSPEC+RSVP_CTYPE_1, "obsolete" },
242 1.1 christos { 256*RSVP_OBJ_FLOWSPEC+RSVP_CTYPE_2, "IntServ" },
243 1.1 christos { 256*RSVP_OBJ_SENDER_TSPEC+RSVP_CTYPE_2, "IntServ" },
244 1.1 christos { 256*RSVP_OBJ_ADSPEC+RSVP_CTYPE_2, "IntServ" },
245 1.1 christos { 256*RSVP_OBJ_FILTERSPEC+RSVP_CTYPE_IPV4, "IPv4" },
246 1.1 christos { 256*RSVP_OBJ_FILTERSPEC+RSVP_CTYPE_IPV6, "IPv6" },
247 1.1 christos { 256*RSVP_OBJ_FILTERSPEC+RSVP_CTYPE_3, "IPv6 Flow-label" },
248 1.1 christos { 256*RSVP_OBJ_FILTERSPEC+RSVP_CTYPE_TUNNEL_IPV4, "Tunnel IPv4" },
249 1.1 christos { 256*RSVP_OBJ_FILTERSPEC+RSVP_CTYPE_12, "IPv4 P2MP LSP Tunnel" },
250 1.1 christos { 256*RSVP_OBJ_FILTERSPEC+RSVP_CTYPE_13, "IPv6 P2MP LSP Tunnel" },
251 1.1 christos { 256*RSVP_OBJ_SESSION+RSVP_CTYPE_IPV4, "IPv4" },
252 1.1 christos { 256*RSVP_OBJ_SESSION+RSVP_CTYPE_IPV6, "IPv6" },
253 1.1 christos { 256*RSVP_OBJ_SESSION+RSVP_CTYPE_TUNNEL_IPV4, "Tunnel IPv4" },
254 1.1 christos { 256*RSVP_OBJ_SESSION+RSVP_CTYPE_UNI_IPV4, "UNI IPv4" },
255 1.1 christos { 256*RSVP_OBJ_SESSION+RSVP_CTYPE_13, "IPv4 P2MP LSP Tunnel" },
256 1.1 christos { 256*RSVP_OBJ_SESSION+RSVP_CTYPE_14, "IPv6 P2MP LSP Tunnel" },
257 1.1 christos { 256*RSVP_OBJ_SENDER_TEMPLATE+RSVP_CTYPE_IPV4, "IPv4" },
258 1.1 christos { 256*RSVP_OBJ_SENDER_TEMPLATE+RSVP_CTYPE_IPV6, "IPv6" },
259 1.1 christos { 256*RSVP_OBJ_SENDER_TEMPLATE+RSVP_CTYPE_TUNNEL_IPV4, "Tunnel IPv4" },
260 1.1 christos { 256*RSVP_OBJ_SENDER_TEMPLATE+RSVP_CTYPE_12, "IPv4 P2MP LSP Tunnel" },
261 1.1 christos { 256*RSVP_OBJ_SENDER_TEMPLATE+RSVP_CTYPE_13, "IPv6 P2MP LSP Tunnel" },
262 1.1 christos { 256*RSVP_OBJ_MESSAGE_ID+RSVP_CTYPE_1, "1" },
263 1.1 christos { 256*RSVP_OBJ_MESSAGE_ID_ACK+RSVP_CTYPE_1, "Message id ack" },
264 1.1 christos { 256*RSVP_OBJ_MESSAGE_ID_ACK+RSVP_CTYPE_2, "Message id nack" },
265 1.1 christos { 256*RSVP_OBJ_MESSAGE_ID_LIST+RSVP_CTYPE_1, "1" },
266 1.1 christos { 256*RSVP_OBJ_STYLE+RSVP_CTYPE_1, "1" },
267 1.1 christos { 256*RSVP_OBJ_HELLO+RSVP_CTYPE_1, "Hello Request" },
268 1.1 christos { 256*RSVP_OBJ_HELLO+RSVP_CTYPE_2, "Hello Ack" },
269 1.1 christos { 256*RSVP_OBJ_LABEL_REQ+RSVP_CTYPE_1, "without label range" },
270 1.1 christos { 256*RSVP_OBJ_LABEL_REQ+RSVP_CTYPE_2, "with ATM label range" },
271 1.1 christos { 256*RSVP_OBJ_LABEL_REQ+RSVP_CTYPE_3, "with FR label range" },
272 1.1 christos { 256*RSVP_OBJ_LABEL_REQ+RSVP_CTYPE_4, "Generalized Label" },
273 1.1 christos { 256*RSVP_OBJ_LABEL+RSVP_CTYPE_1, "Label" },
274 1.1 christos { 256*RSVP_OBJ_LABEL+RSVP_CTYPE_2, "Generalized Label" },
275 1.1 christos { 256*RSVP_OBJ_LABEL+RSVP_CTYPE_3, "Waveband Switching" },
276 1.1 christos { 256*RSVP_OBJ_SUGGESTED_LABEL+RSVP_CTYPE_1, "Label" },
277 1.1 christos { 256*RSVP_OBJ_SUGGESTED_LABEL+RSVP_CTYPE_2, "Generalized Label" },
278 1.1 christos { 256*RSVP_OBJ_SUGGESTED_LABEL+RSVP_CTYPE_3, "Waveband Switching" },
279 1.1 christos { 256*RSVP_OBJ_UPSTREAM_LABEL+RSVP_CTYPE_1, "Label" },
280 1.1 christos { 256*RSVP_OBJ_UPSTREAM_LABEL+RSVP_CTYPE_2, "Generalized Label" },
281 1.1 christos { 256*RSVP_OBJ_UPSTREAM_LABEL+RSVP_CTYPE_3, "Waveband Switching" },
282 1.1 christos { 256*RSVP_OBJ_RECOVERY_LABEL+RSVP_CTYPE_1, "Label" },
283 1.1 christos { 256*RSVP_OBJ_RECOVERY_LABEL+RSVP_CTYPE_2, "Generalized Label" },
284 1.1 christos { 256*RSVP_OBJ_RECOVERY_LABEL+RSVP_CTYPE_3, "Waveband Switching" },
285 1.1 christos { 256*RSVP_OBJ_ERO+RSVP_CTYPE_IPV4, "IPv4" },
286 1.1 christos { 256*RSVP_OBJ_RRO+RSVP_CTYPE_IPV4, "IPv4" },
287 1.1 christos { 256*RSVP_OBJ_ERROR_SPEC+RSVP_CTYPE_IPV4, "IPv4" },
288 1.1 christos { 256*RSVP_OBJ_ERROR_SPEC+RSVP_CTYPE_IPV6, "IPv6" },
289 1.1 christos { 256*RSVP_OBJ_ERROR_SPEC+RSVP_CTYPE_3, "IPv4 plus opt. TLVs" },
290 1.1 christos { 256*RSVP_OBJ_ERROR_SPEC+RSVP_CTYPE_4, "IPv6 plus opt. TLVs" },
291 1.1 christos { 256*RSVP_OBJ_RESTART_CAPABILITY+RSVP_CTYPE_1, "IPv4" },
292 1.1 christos { 256*RSVP_OBJ_SESSION_ATTRIBUTE+RSVP_CTYPE_TUNNEL_IPV4, "Tunnel IPv4" },
293 1.1 christos { 256*RSVP_OBJ_FASTREROUTE+RSVP_CTYPE_TUNNEL_IPV4, "Tunnel IPv4" }, /* old style*/
294 1.1 christos { 256*RSVP_OBJ_FASTREROUTE+RSVP_CTYPE_1, "1" }, /* new style */
295 1.1 christos { 256*RSVP_OBJ_DETOUR+RSVP_CTYPE_TUNNEL_IPV4, "Tunnel IPv4" },
296 1.1 christos { 256*RSVP_OBJ_PROPERTIES+RSVP_CTYPE_1, "1" },
297 1.1 christos { 256*RSVP_OBJ_ADMIN_STATUS+RSVP_CTYPE_1, "1" },
298 1.1 christos { 256*RSVP_OBJ_CLASSTYPE+RSVP_CTYPE_1, "1" },
299 1.1 christos { 256*RSVP_OBJ_CLASSTYPE_OLD+RSVP_CTYPE_1, "1" },
300 1.1 christos { 256*RSVP_OBJ_LABEL_SET+RSVP_CTYPE_1, "1" },
301 1.1 christos { 256*RSVP_OBJ_GENERALIZED_UNI+RSVP_CTYPE_1, "1" },
302 1.1 christos { 256*RSVP_OBJ_S2L+RSVP_CTYPE_IPV4, "IPv4 sub-LSP" },
303 1.1 christos { 256*RSVP_OBJ_S2L+RSVP_CTYPE_IPV6, "IPv6 sub-LSP" },
304 1.1 christos { 0, NULL}
305 1.1 christos };
306 1.1 christos
307 1.1 christos struct rsvp_obj_integrity_t {
308 1.1 christos u_int8_t flags;
309 1.1 christos u_int8_t res;
310 1.1 christos u_int8_t key_id[6];
311 1.1 christos u_int8_t sequence[8];
312 1.1 christos u_int8_t digest[16];
313 1.1 christos };
314 1.1 christos
315 1.1 christos static const struct tok rsvp_obj_integrity_flag_values[] = {
316 1.1 christos { 0x80, "Handshake" },
317 1.1 christos { 0, NULL}
318 1.1 christos };
319 1.1 christos
320 1.1 christos struct rsvp_obj_frr_t {
321 1.1 christos u_int8_t setup_prio;
322 1.1 christos u_int8_t hold_prio;
323 1.1 christos u_int8_t hop_limit;
324 1.1 christos u_int8_t flags;
325 1.1 christos u_int8_t bandwidth[4];
326 1.1 christos u_int8_t include_any[4];
327 1.1 christos u_int8_t exclude_any[4];
328 1.1 christos u_int8_t include_all[4];
329 1.1 christos };
330 1.1 christos
331 1.1 christos
332 1.1 christos #define RSVP_OBJ_XRO_MASK_SUBOBJ(x) ((x)&0x7f)
333 1.1 christos #define RSVP_OBJ_XRO_MASK_LOOSE(x) ((x)&0x80)
334 1.1 christos
335 1.1 christos #define RSVP_OBJ_XRO_RES 0
336 1.1 christos #define RSVP_OBJ_XRO_IPV4 1
337 1.1 christos #define RSVP_OBJ_XRO_IPV6 2
338 1.1 christos #define RSVP_OBJ_XRO_LABEL 3
339 1.1 christos #define RSVP_OBJ_XRO_ASN 32
340 1.1 christos #define RSVP_OBJ_XRO_MPLS 64
341 1.1 christos
342 1.1 christos static const struct tok rsvp_obj_xro_values[] = {
343 1.1 christos { RSVP_OBJ_XRO_RES, "Reserved" },
344 1.1 christos { RSVP_OBJ_XRO_IPV4, "IPv4 prefix" },
345 1.1 christos { RSVP_OBJ_XRO_IPV6, "IPv6 prefix" },
346 1.1 christos { RSVP_OBJ_XRO_LABEL, "Label" },
347 1.1 christos { RSVP_OBJ_XRO_ASN, "Autonomous system number" },
348 1.1 christos { RSVP_OBJ_XRO_MPLS, "MPLS label switched path termination" },
349 1.1 christos { 0, NULL}
350 1.1 christos };
351 1.1 christos
352 1.1 christos /* draft-ietf-mpls-rsvp-lsp-fastreroute-07.txt */
353 1.1 christos static const struct tok rsvp_obj_rro_flag_values[] = {
354 1.1 christos { 0x01, "Local protection available" },
355 1.1 christos { 0x02, "Local protection in use" },
356 1.1 christos { 0x04, "Bandwidth protection" },
357 1.1 christos { 0x08, "Node protection" },
358 1.1 christos { 0, NULL}
359 1.1 christos };
360 1.1 christos
361 1.1 christos /* RFC3209 */
362 1.1 christos static const struct tok rsvp_obj_rro_label_flag_values[] = {
363 1.1 christos { 0x01, "Global" },
364 1.1 christos { 0, NULL}
365 1.1 christos };
366 1.1 christos
367 1.1 christos static const struct tok rsvp_resstyle_values[] = {
368 1.1 christos { 17, "Wildcard Filter" },
369 1.1 christos { 10, "Fixed Filter" },
370 1.1 christos { 18, "Shared Explicit" },
371 1.1 christos { 0, NULL}
372 1.1 christos };
373 1.1 christos
374 1.1 christos #define RSVP_OBJ_INTSERV_GUARANTEED_SERV 2
375 1.1 christos #define RSVP_OBJ_INTSERV_CONTROLLED_LOAD 5
376 1.1 christos
377 1.1 christos static const struct tok rsvp_intserv_service_type_values[] = {
378 1.1 christos { 1, "Default/Global Information" },
379 1.1 christos { RSVP_OBJ_INTSERV_GUARANTEED_SERV, "Guaranteed Service" },
380 1.1 christos { RSVP_OBJ_INTSERV_CONTROLLED_LOAD, "Controlled Load" },
381 1.1 christos { 0, NULL}
382 1.1 christos };
383 1.1 christos
384 1.1 christos static const struct tok rsvp_intserv_parameter_id_values[] = {
385 1.1 christos { 4, "IS hop cnt" },
386 1.1 christos { 6, "Path b/w estimate" },
387 1.1 christos { 8, "Minimum path latency" },
388 1.1 christos { 10, "Composed MTU" },
389 1.1 christos { 127, "Token Bucket TSpec" },
390 1.1 christos { 130, "Guaranteed Service RSpec" },
391 1.1 christos { 133, "End-to-end composed value for C" },
392 1.1 christos { 134, "End-to-end composed value for D" },
393 1.1 christos { 135, "Since-last-reshaping point composed C" },
394 1.1 christos { 136, "Since-last-reshaping point composed D" },
395 1.1 christos { 0, NULL}
396 1.1 christos };
397 1.1 christos
398 1.1 christos static struct tok rsvp_session_attribute_flag_values[] = {
399 1.1 christos { 0x01, "Local Protection" },
400 1.1 christos { 0x02, "Label Recording" },
401 1.1 christos { 0x04, "SE Style" },
402 1.1 christos { 0x08, "Bandwidth protection" }, /* RFC4090 */
403 1.1 christos { 0x10, "Node protection" }, /* RFC4090 */
404 1.1 christos { 0, NULL}
405 1.1 christos };
406 1.1 christos
407 1.1 christos static struct tok rsvp_obj_prop_tlv_values[] = {
408 1.1 christos { 0x01, "Cos" },
409 1.1 christos { 0x02, "Metric 1" },
410 1.1 christos { 0x04, "Metric 2" },
411 1.1 christos { 0x08, "CCC Status" },
412 1.1 christos { 0x10, "Path Type" },
413 1.1 christos { 0, NULL}
414 1.1 christos };
415 1.1 christos
416 1.1 christos #define RSVP_OBJ_ERROR_SPEC_CODE_ROUTING 24
417 1.1 christos #define RSVP_OBJ_ERROR_SPEC_CODE_NOTIFY 25
418 1.1 christos #define RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE 28
419 1.1 christos #define RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE_OLD 125
420 1.1 christos
421 1.1 christos static struct tok rsvp_obj_error_code_values[] = {
422 1.1 christos { RSVP_OBJ_ERROR_SPEC_CODE_ROUTING, "Routing Problem" },
423 1.1 christos { RSVP_OBJ_ERROR_SPEC_CODE_NOTIFY, "Notify Error" },
424 1.1 christos { RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE, "Diffserv TE Error" },
425 1.1 christos { RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE_OLD, "Diffserv TE Error (Old)" },
426 1.1 christos { 0, NULL}
427 1.1 christos };
428 1.1 christos
429 1.1 christos static struct tok rsvp_obj_error_code_routing_values[] = {
430 1.1 christos { 1, "Bad EXPLICIT_ROUTE object" },
431 1.1 christos { 2, "Bad strict node" },
432 1.1 christos { 3, "Bad loose node" },
433 1.1 christos { 4, "Bad initial subobject" },
434 1.1 christos { 5, "No route available toward destination" },
435 1.1 christos { 6, "Unacceptable label value" },
436 1.1 christos { 7, "RRO indicated routing loops" },
437 1.1 christos { 8, "non-RSVP-capable router in the path" },
438 1.1 christos { 9, "MPLS label allocation failure" },
439 1.1 christos { 10, "Unsupported L3PID" },
440 1.1 christos { 0, NULL}
441 1.1 christos };
442 1.1 christos
443 1.1 christos static struct tok rsvp_obj_error_code_diffserv_te_values[] = {
444 1.1 christos { 1, "Unexpected CT object" },
445 1.1 christos { 2, "Unsupported CT" },
446 1.1 christos { 3, "Invalid CT value" },
447 1.1 christos { 4, "CT/setup priority do not form a configured TE-Class" },
448 1.1 christos { 5, "CT/holding priority do not form a configured TE-Class" },
449 1.1 christos { 6, "CT/setup priority and CT/holding priority do not form a configured TE-Class" },
450 1.1 christos { 7, "Inconsistency between signaled PSC and signaled CT" },
451 1.1 christos { 8, "Inconsistency between signaled PHBs and signaled CT" },
452 1.1 christos { 0, NULL}
453 1.1 christos };
454 1.1 christos
455 1.1 christos /* rfc3473 / rfc 3471 */
456 1.1 christos static const struct tok rsvp_obj_admin_status_flag_values[] = {
457 1.1 christos { 0x80000000, "Reflect" },
458 1.1 christos { 0x00000004, "Testing" },
459 1.1 christos { 0x00000002, "Admin-down" },
460 1.1 christos { 0x00000001, "Delete-in-progress" },
461 1.1 christos { 0, NULL}
462 1.1 christos };
463 1.1 christos
464 1.1 christos /* label set actions - rfc3471 */
465 1.1 christos #define LABEL_SET_INCLUSIVE_LIST 0
466 1.1 christos #define LABEL_SET_EXCLUSIVE_LIST 1
467 1.1 christos #define LABEL_SET_INCLUSIVE_RANGE 2
468 1.1 christos #define LABEL_SET_EXCLUSIVE_RANGE 3
469 1.1 christos
470 1.1 christos static const struct tok rsvp_obj_label_set_action_values[] = {
471 1.1 christos { LABEL_SET_INCLUSIVE_LIST, "Inclusive list" },
472 1.1 christos { LABEL_SET_EXCLUSIVE_LIST, "Exclusive list" },
473 1.1 christos { LABEL_SET_INCLUSIVE_RANGE, "Inclusive range" },
474 1.1 christos { LABEL_SET_EXCLUSIVE_RANGE, "Exclusive range" },
475 1.1 christos { 0, NULL}
476 1.1 christos };
477 1.1 christos
478 1.1 christos /* OIF RSVP extensions UNI 1.0 Signaling, release 2 */
479 1.1 christos #define RSVP_GEN_UNI_SUBOBJ_SOURCE_TNA_ADDRESS 1
480 1.1 christos #define RSVP_GEN_UNI_SUBOBJ_DESTINATION_TNA_ADDRESS 2
481 1.1 christos #define RSVP_GEN_UNI_SUBOBJ_DIVERSITY 3
482 1.1 christos #define RSVP_GEN_UNI_SUBOBJ_EGRESS_LABEL 4
483 1.1 christos #define RSVP_GEN_UNI_SUBOBJ_SERVICE_LEVEL 5
484 1.1 christos
485 1.1 christos static const struct tok rsvp_obj_generalized_uni_values[] = {
486 1.1 christos { RSVP_GEN_UNI_SUBOBJ_SOURCE_TNA_ADDRESS, "Source TNA address" },
487 1.1 christos { RSVP_GEN_UNI_SUBOBJ_DESTINATION_TNA_ADDRESS, "Destination TNA address" },
488 1.1 christos { RSVP_GEN_UNI_SUBOBJ_DIVERSITY, "Diversity" },
489 1.1 christos { RSVP_GEN_UNI_SUBOBJ_EGRESS_LABEL, "Egress label" },
490 1.1 christos { RSVP_GEN_UNI_SUBOBJ_SERVICE_LEVEL, "Service level" },
491 1.1 christos { 0, NULL}
492 1.1 christos };
493 1.1 christos
494 1.1 christos static int rsvp_intserv_print(const u_char *, u_short);
495 1.1 christos
496 1.1 christos /*
497 1.1 christos * this is a dissector for all the intserv defined
498 1.1 christos * specs as defined per rfc2215
499 1.1 christos * it is called from various rsvp objects;
500 1.1 christos * returns the amount of bytes being processed
501 1.1 christos */
502 1.1 christos static int
503 1.1 christos rsvp_intserv_print(const u_char *tptr, u_short obj_tlen) {
504 1.1 christos
505 1.1 christos int parameter_id,parameter_length;
506 1.1 christos union {
507 1.1 christos float f;
508 1.1 christos u_int32_t i;
509 1.1 christos } bw;
510 1.1 christos
511 1.1 christos if (obj_tlen < 4)
512 1.1 christos return 0;
513 1.1 christos parameter_id = *(tptr);
514 1.1 christos parameter_length = EXTRACT_16BITS(tptr+2)<<2; /* convert wordcount to bytecount */
515 1.1 christos
516 1.1 christos printf("\n\t Parameter ID: %s (%u), length: %u, Flags: [0x%02x]",
517 1.1 christos tok2str(rsvp_intserv_parameter_id_values,"unknown",parameter_id),
518 1.1 christos parameter_id,
519 1.1 christos parameter_length,
520 1.1 christos *(tptr+1));
521 1.1 christos
522 1.1 christos if (obj_tlen < parameter_length+4)
523 1.1 christos return 0;
524 1.1 christos switch(parameter_id) { /* parameter_id */
525 1.1 christos
526 1.1 christos case 4:
527 1.1 christos /*
528 1.1 christos * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
529 1.1 christos * | 4 (e) | (f) | 1 (g) |
530 1.1 christos * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
531 1.1 christos * | IS hop cnt (32-bit unsigned integer) |
532 1.1 christos * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
533 1.1 christos */
534 1.1 christos if (parameter_length == 4)
535 1.1 christos printf("\n\t\tIS hop count: %u", EXTRACT_32BITS(tptr+4));
536 1.1 christos break;
537 1.1 christos
538 1.1 christos case 6:
539 1.1 christos /*
540 1.1 christos * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
541 1.1 christos * | 6 (h) | (i) | 1 (j) |
542 1.1 christos * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
543 1.1 christos * | Path b/w estimate (32-bit IEEE floating point number) |
544 1.1 christos * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
545 1.1 christos */
546 1.1 christos if (parameter_length == 4) {
547 1.1 christos bw.i = EXTRACT_32BITS(tptr+4);
548 1.1 christos printf("\n\t\tPath b/w estimate: %.10g Mbps", bw.f/125000);
549 1.1 christos }
550 1.1 christos break;
551 1.1 christos
552 1.1 christos case 8:
553 1.1 christos /*
554 1.1 christos * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
555 1.1 christos * | 8 (k) | (l) | 1 (m) |
556 1.1 christos * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
557 1.1 christos * | Minimum path latency (32-bit integer) |
558 1.1 christos * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
559 1.1 christos */
560 1.1 christos if (parameter_length == 4) {
561 1.1 christos printf("\n\t\tMinimum path latency: ");
562 1.1 christos if (EXTRACT_32BITS(tptr+4) == 0xffffffff)
563 1.1 christos printf("don't care");
564 1.1 christos else
565 1.1 christos printf("%u", EXTRACT_32BITS(tptr+4));
566 1.1 christos }
567 1.1 christos break;
568 1.1 christos
569 1.1 christos case 10:
570 1.1 christos
571 1.1 christos /*
572 1.1 christos * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
573 1.1 christos * | 10 (n) | (o) | 1 (p) |
574 1.1 christos * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
575 1.1 christos * | Composed MTU (32-bit unsigned integer) |
576 1.1 christos * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
577 1.1 christos */
578 1.1 christos if (parameter_length == 4)
579 1.1 christos printf("\n\t\tComposed MTU: %u bytes", EXTRACT_32BITS(tptr+4));
580 1.1 christos break;
581 1.1 christos case 127:
582 1.1 christos /*
583 1.1 christos * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
584 1.1 christos * | 127 (e) | 0 (f) | 5 (g) |
585 1.1 christos * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
586 1.1 christos * | Token Bucket Rate [r] (32-bit IEEE floating point number) |
587 1.1 christos * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
588 1.1 christos * | Token Bucket Size [b] (32-bit IEEE floating point number) |
589 1.1 christos * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
590 1.1 christos * | Peak Data Rate [p] (32-bit IEEE floating point number) |
591 1.1 christos * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
592 1.1 christos * | Minimum Policed Unit [m] (32-bit integer) |
593 1.1 christos * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
594 1.1 christos * | Maximum Packet Size [M] (32-bit integer) |
595 1.1 christos * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
596 1.1 christos */
597 1.1 christos
598 1.1 christos if (parameter_length == 20) {
599 1.1 christos bw.i = EXTRACT_32BITS(tptr+4);
600 1.1 christos printf("\n\t\tToken Bucket Rate: %.10g Mbps", bw.f/125000);
601 1.1 christos bw.i = EXTRACT_32BITS(tptr+8);
602 1.1 christos printf("\n\t\tToken Bucket Size: %.10g bytes", bw.f);
603 1.1 christos bw.i = EXTRACT_32BITS(tptr+12);
604 1.1 christos printf("\n\t\tPeak Data Rate: %.10g Mbps", bw.f/125000);
605 1.1 christos printf("\n\t\tMinimum Policed Unit: %u bytes", EXTRACT_32BITS(tptr+16));
606 1.1 christos printf("\n\t\tMaximum Packet Size: %u bytes", EXTRACT_32BITS(tptr+20));
607 1.1 christos }
608 1.1 christos break;
609 1.1 christos
610 1.1 christos case 130:
611 1.1 christos /*
612 1.1 christos * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
613 1.1 christos * | 130 (h) | 0 (i) | 2 (j) |
614 1.1 christos * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
615 1.1 christos * | Rate [R] (32-bit IEEE floating point number) |
616 1.1 christos * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
617 1.1 christos * | Slack Term [S] (32-bit integer) |
618 1.1 christos * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
619 1.1 christos */
620 1.1 christos
621 1.1 christos if (parameter_length == 8) {
622 1.1 christos bw.i = EXTRACT_32BITS(tptr+4);
623 1.1 christos printf("\n\t\tRate: %.10g Mbps", bw.f/125000);
624 1.1 christos printf("\n\t\tSlack Term: %u", EXTRACT_32BITS(tptr+8));
625 1.1 christos }
626 1.1 christos break;
627 1.1 christos
628 1.1 christos case 133:
629 1.1 christos case 134:
630 1.1 christos case 135:
631 1.1 christos case 136:
632 1.1 christos if (parameter_length == 4)
633 1.1 christos printf("\n\t\tValue: %u", EXTRACT_32BITS(tptr+4));
634 1.1 christos break;
635 1.1 christos
636 1.1 christos default:
637 1.1 christos if (vflag <= 1)
638 1.1 christos print_unknown_data(tptr+4,"\n\t\t",parameter_length);
639 1.1 christos }
640 1.1 christos return (parameter_length+4); /* header length 4 bytes */
641 1.1 christos }
642 1.1 christos
643 1.1 christos static int
644 1.1 christos rsvp_obj_print (const u_char *pptr
645 1.1 christos #ifndef HAVE_LIBCRYPTO
646 1.1 christos _U_
647 1.1 christos #endif
648 1.1 christos , u_int plen
649 1.1 christos #ifndef HAVE_LIBCRYPTO
650 1.1 christos _U_
651 1.1 christos #endif
652 1.1 christos , const u_char *tptr,
653 1.1 christos const char *ident, u_int tlen) {
654 1.1 christos
655 1.1 christos const struct rsvp_object_header *rsvp_obj_header;
656 1.1 christos const u_char *obj_tptr;
657 1.1 christos union {
658 1.1 christos const struct rsvp_obj_integrity_t *rsvp_obj_integrity;
659 1.1 christos const struct rsvp_obj_frr_t *rsvp_obj_frr;
660 1.1 christos } obj_ptr;
661 1.1 christos
662 1.1 christos u_short rsvp_obj_len,rsvp_obj_ctype,obj_tlen,intserv_serv_tlen;
663 1.1 christos int hexdump,processed,padbytes,error_code,error_value,i,sigcheck;
664 1.1 christos union {
665 1.1 christos float f;
666 1.1 christos u_int32_t i;
667 1.1 christos } bw;
668 1.1 christos u_int8_t namelen;
669 1.1 christos
670 1.1 christos u_int action, subchannel;
671 1.1 christos
672 1.1 christos while(tlen>=sizeof(struct rsvp_object_header)) {
673 1.1 christos /* did we capture enough for fully decoding the object header ? */
674 1.1 christos if (!TTEST2(*tptr, sizeof(struct rsvp_object_header)))
675 1.1 christos goto trunc;
676 1.1 christos
677 1.1 christos rsvp_obj_header = (const struct rsvp_object_header *)tptr;
678 1.1 christos rsvp_obj_len=EXTRACT_16BITS(rsvp_obj_header->length);
679 1.1 christos rsvp_obj_ctype=rsvp_obj_header->ctype;
680 1.1 christos
681 1.1 christos if(rsvp_obj_len % 4) {
682 1.1 christos printf("%sERROR: object header size %u not a multiple of 4", ident, rsvp_obj_len);
683 1.1 christos return -1;
684 1.1 christos }
685 1.1 christos if(rsvp_obj_len < sizeof(struct rsvp_object_header)) {
686 1.1 christos printf("%sERROR: object header too short %u < %lu", ident, rsvp_obj_len,
687 1.1 christos (unsigned long)sizeof(const struct rsvp_object_header));
688 1.1 christos return -1;
689 1.1 christos }
690 1.1 christos
691 1.1 christos printf("%s%s Object (%u) Flags: [%s",
692 1.1 christos ident,
693 1.1 christos tok2str(rsvp_obj_values,
694 1.1 christos "Unknown",
695 1.1 christos rsvp_obj_header->class_num),
696 1.1 christos rsvp_obj_header->class_num,
697 1.1 christos ((rsvp_obj_header->class_num)&0x80) ? "ignore" : "reject");
698 1.1 christos
699 1.1 christos if (rsvp_obj_header->class_num > 128)
700 1.1 christos printf(" %s",
701 1.1 christos ((rsvp_obj_header->class_num)&0x40) ? "and forward" : "silently");
702 1.1 christos
703 1.1 christos printf(" if unknown], Class-Type: %s (%u), length: %u",
704 1.1 christos tok2str(rsvp_ctype_values,
705 1.1 christos "Unknown",
706 1.1 christos ((rsvp_obj_header->class_num)<<8)+rsvp_obj_ctype),
707 1.1 christos rsvp_obj_ctype,
708 1.1 christos rsvp_obj_len);
709 1.1 christos
710 1.1 christos if(tlen < rsvp_obj_len) {
711 1.1 christos printf("%sERROR: object goes past end of objects TLV", ident);
712 1.1 christos return -1;
713 1.1 christos }
714 1.1 christos
715 1.1 christos obj_tptr=tptr+sizeof(struct rsvp_object_header);
716 1.1 christos obj_tlen=rsvp_obj_len-sizeof(struct rsvp_object_header);
717 1.1 christos
718 1.1 christos /* did we capture enough for fully decoding the object ? */
719 1.1 christos if (!TTEST2(*tptr, rsvp_obj_len))
720 1.1 christos return -1;
721 1.1 christos hexdump=FALSE;
722 1.1 christos
723 1.1 christos switch(rsvp_obj_header->class_num) {
724 1.1 christos case RSVP_OBJ_SESSION:
725 1.1 christos switch(rsvp_obj_ctype) {
726 1.1 christos case RSVP_CTYPE_IPV4:
727 1.1 christos if (obj_tlen < 8)
728 1.1 christos return -1;
729 1.1 christos printf("%s IPv4 DestAddress: %s, Protocol ID: 0x%02x",
730 1.1 christos ident,
731 1.1 christos ipaddr_string(obj_tptr),
732 1.1 christos *(obj_tptr+sizeof(struct in_addr)));
733 1.1 christos printf("%s Flags: [0x%02x], DestPort %u",
734 1.1 christos ident,
735 1.1 christos *(obj_tptr+5),
736 1.1 christos EXTRACT_16BITS(obj_tptr+6));
737 1.1 christos obj_tlen-=8;
738 1.1 christos obj_tptr+=8;
739 1.1 christos break;
740 1.1 christos #ifdef INET6
741 1.1 christos case RSVP_CTYPE_IPV6:
742 1.1 christos if (obj_tlen < 20)
743 1.1 christos return -1;
744 1.1 christos printf("%s IPv6 DestAddress: %s, Protocol ID: 0x%02x",
745 1.1 christos ident,
746 1.1 christos ip6addr_string(obj_tptr),
747 1.1 christos *(obj_tptr+sizeof(struct in6_addr)));
748 1.1 christos printf("%s Flags: [0x%02x], DestPort %u",
749 1.1 christos ident,
750 1.1 christos *(obj_tptr+sizeof(struct in6_addr)+1),
751 1.1 christos EXTRACT_16BITS(obj_tptr+sizeof(struct in6_addr)+2));
752 1.1 christos obj_tlen-=20;
753 1.1 christos obj_tptr+=20;
754 1.1 christos break;
755 1.1 christos
756 1.1 christos case RSVP_CTYPE_TUNNEL_IPV6:
757 1.1 christos if (obj_tlen < 36)
758 1.1 christos return -1;
759 1.1 christos printf("%s IPv6 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
760 1.1 christos ident,
761 1.1 christos ip6addr_string(obj_tptr),
762 1.1 christos EXTRACT_16BITS(obj_tptr+18),
763 1.1 christos ip6addr_string(obj_tptr+20));
764 1.1 christos obj_tlen-=36;
765 1.1 christos obj_tptr+=36;
766 1.1 christos break;
767 1.1 christos
768 1.1 christos case RSVP_CTYPE_14: /* IPv6 p2mp LSP Tunnel */
769 1.1 christos if (obj_tlen < 26)
770 1.1 christos return -1;
771 1.1 christos printf("%s IPv6 P2MP LSP ID: 0x%08x, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
772 1.1 christos ident,
773 1.1 christos EXTRACT_32BITS(obj_tptr),
774 1.1 christos EXTRACT_16BITS(obj_tptr+6),
775 1.1 christos ip6addr_string(obj_tptr+8));
776 1.1 christos obj_tlen-=26;
777 1.1 christos obj_tptr+=26;
778 1.1 christos break;
779 1.1 christos #endif
780 1.1 christos case RSVP_CTYPE_13: /* IPv4 p2mp LSP Tunnel */
781 1.1 christos if (obj_tlen < 12)
782 1.1 christos return -1;
783 1.1 christos printf("%s IPv4 P2MP LSP ID: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
784 1.1 christos ident,
785 1.1 christos ipaddr_string(obj_tptr),
786 1.1 christos EXTRACT_16BITS(obj_tptr+6),
787 1.1 christos ipaddr_string(obj_tptr+8));
788 1.1 christos obj_tlen-=12;
789 1.1 christos obj_tptr+=12;
790 1.1 christos break;
791 1.1 christos case RSVP_CTYPE_TUNNEL_IPV4:
792 1.1 christos case RSVP_CTYPE_UNI_IPV4:
793 1.1 christos if (obj_tlen < 12)
794 1.1 christos return -1;
795 1.1 christos printf("%s IPv4 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s",
796 1.1 christos ident,
797 1.1 christos ipaddr_string(obj_tptr),
798 1.1 christos EXTRACT_16BITS(obj_tptr+6),
799 1.1 christos ipaddr_string(obj_tptr+8));
800 1.1 christos obj_tlen-=12;
801 1.1 christos obj_tptr+=12;
802 1.1 christos break;
803 1.1 christos default:
804 1.1 christos hexdump=TRUE;
805 1.1 christos }
806 1.1 christos break;
807 1.1 christos
808 1.1 christos case RSVP_OBJ_CONFIRM:
809 1.1 christos switch(rsvp_obj_ctype) {
810 1.1 christos case RSVP_CTYPE_IPV4:
811 1.1 christos if (obj_tlen < sizeof(struct in_addr))
812 1.1 christos return -1;
813 1.1 christos printf("%s IPv4 Receiver Address: %s",
814 1.1 christos ident,
815 1.1 christos ipaddr_string(obj_tptr));
816 1.1 christos obj_tlen-=sizeof(struct in_addr);
817 1.1 christos obj_tptr+=sizeof(struct in_addr);
818 1.1 christos break;
819 1.1 christos #ifdef INET6
820 1.1 christos case RSVP_CTYPE_IPV6:
821 1.1 christos if (obj_tlen < sizeof(struct in6_addr))
822 1.1 christos return -1;
823 1.1 christos printf("%s IPv6 Receiver Address: %s",
824 1.1 christos ident,
825 1.1 christos ip6addr_string(obj_tptr));
826 1.1 christos obj_tlen-=sizeof(struct in6_addr);
827 1.1 christos obj_tptr+=sizeof(struct in6_addr);
828 1.1 christos break;
829 1.1 christos #endif
830 1.1 christos default:
831 1.1 christos hexdump=TRUE;
832 1.1 christos }
833 1.1 christos break;
834 1.1 christos
835 1.1 christos case RSVP_OBJ_NOTIFY_REQ:
836 1.1 christos switch(rsvp_obj_ctype) {
837 1.1 christos case RSVP_CTYPE_IPV4:
838 1.1 christos if (obj_tlen < sizeof(struct in_addr))
839 1.1 christos return -1;
840 1.1 christos printf("%s IPv4 Notify Node Address: %s",
841 1.1 christos ident,
842 1.1 christos ipaddr_string(obj_tptr));
843 1.1 christos obj_tlen-=sizeof(struct in_addr);
844 1.1 christos obj_tptr+=sizeof(struct in_addr);
845 1.1 christos break;
846 1.1 christos #ifdef INET6
847 1.1 christos case RSVP_CTYPE_IPV6:
848 1.1 christos if (obj_tlen < sizeof(struct in6_addr))
849 1.1 christos return-1;
850 1.1 christos printf("%s IPv6 Notify Node Address: %s",
851 1.1 christos ident,
852 1.1 christos ip6addr_string(obj_tptr));
853 1.1 christos obj_tlen-=sizeof(struct in6_addr);
854 1.1 christos obj_tptr+=sizeof(struct in6_addr);
855 1.1 christos break;
856 1.1 christos #endif
857 1.1 christos default:
858 1.1 christos hexdump=TRUE;
859 1.1 christos }
860 1.1 christos break;
861 1.1 christos
862 1.1 christos case RSVP_OBJ_SUGGESTED_LABEL: /* fall through */
863 1.1 christos case RSVP_OBJ_UPSTREAM_LABEL: /* fall through */
864 1.1 christos case RSVP_OBJ_RECOVERY_LABEL: /* fall through */
865 1.1 christos case RSVP_OBJ_LABEL:
866 1.1 christos switch(rsvp_obj_ctype) {
867 1.1 christos case RSVP_CTYPE_1:
868 1.1 christos while(obj_tlen >= 4 ) {
869 1.1 christos printf("%s Label: %u", ident, EXTRACT_32BITS(obj_tptr));
870 1.1 christos obj_tlen-=4;
871 1.1 christos obj_tptr+=4;
872 1.1 christos }
873 1.1 christos break;
874 1.1 christos case RSVP_CTYPE_2:
875 1.1 christos if (obj_tlen < 4)
876 1.1 christos return-1;
877 1.1 christos printf("%s Generalized Label: %u",
878 1.1 christos ident,
879 1.1 christos EXTRACT_32BITS(obj_tptr));
880 1.1 christos obj_tlen-=4;
881 1.1 christos obj_tptr+=4;
882 1.1 christos break;
883 1.1 christos case RSVP_CTYPE_3:
884 1.1 christos if (obj_tlen < 12)
885 1.1 christos return-1;
886 1.1 christos printf("%s Waveband ID: %u%s Start Label: %u, Stop Label: %u",
887 1.1 christos ident,
888 1.1 christos EXTRACT_32BITS(obj_tptr),
889 1.1 christos ident,
890 1.1 christos EXTRACT_32BITS(obj_tptr+4),
891 1.1 christos EXTRACT_32BITS(obj_tptr+8));
892 1.1 christos obj_tlen-=12;
893 1.1 christos obj_tptr+=12;
894 1.1 christos break;
895 1.1 christos default:
896 1.1 christos hexdump=TRUE;
897 1.1 christos }
898 1.1 christos break;
899 1.1 christos
900 1.1 christos case RSVP_OBJ_STYLE:
901 1.1 christos switch(rsvp_obj_ctype) {
902 1.1 christos case RSVP_CTYPE_1:
903 1.1 christos if (obj_tlen < 4)
904 1.1 christos return-1;
905 1.1 christos printf("%s Reservation Style: %s, Flags: [0x%02x]",
906 1.1 christos ident,
907 1.1 christos tok2str(rsvp_resstyle_values,
908 1.1 christos "Unknown",
909 1.1 christos EXTRACT_24BITS(obj_tptr+1)),
910 1.1 christos *(obj_tptr));
911 1.1 christos obj_tlen-=4;
912 1.1 christos obj_tptr+=4;
913 1.1 christos break;
914 1.1 christos default:
915 1.1 christos hexdump=TRUE;
916 1.1 christos }
917 1.1 christos break;
918 1.1 christos
919 1.1 christos case RSVP_OBJ_SENDER_TEMPLATE:
920 1.1 christos switch(rsvp_obj_ctype) {
921 1.1 christos case RSVP_CTYPE_IPV4:
922 1.1 christos if (obj_tlen < 8)
923 1.1 christos return-1;
924 1.1 christos printf("%s Source Address: %s, Source Port: %u",
925 1.1 christos ident,
926 1.1 christos ipaddr_string(obj_tptr),
927 1.1 christos EXTRACT_16BITS(obj_tptr+6));
928 1.1 christos obj_tlen-=8;
929 1.1 christos obj_tptr+=8;
930 1.1 christos break;
931 1.1 christos #ifdef INET6
932 1.1 christos case RSVP_CTYPE_IPV6:
933 1.1 christos if (obj_tlen < 20)
934 1.1 christos return-1;
935 1.1 christos printf("%s Source Address: %s, Source Port: %u",
936 1.1 christos ident,
937 1.1 christos ip6addr_string(obj_tptr),
938 1.1 christos EXTRACT_16BITS(obj_tptr+18));
939 1.1 christos obj_tlen-=20;
940 1.1 christos obj_tptr+=20;
941 1.1 christos break;
942 1.1 christos case RSVP_CTYPE_13: /* IPv6 p2mp LSP tunnel */
943 1.1 christos if (obj_tlen < 40)
944 1.1 christos return-1;
945 1.1 christos printf("%s IPv6 Tunnel Sender Address: %s, LSP ID: 0x%04x"
946 1.1 christos "%s Sub-Group Originator ID: %s, Sub-Group ID: 0x%04x",
947 1.1 christos ident,
948 1.1 christos ip6addr_string(obj_tptr),
949 1.1 christos EXTRACT_16BITS(obj_tptr+18),
950 1.1 christos ident,
951 1.1 christos ip6addr_string(obj_tptr+20),
952 1.1 christos EXTRACT_16BITS(obj_tptr+38));
953 1.1 christos obj_tlen-=40;
954 1.1 christos obj_tptr+=40;
955 1.1 christos break;
956 1.1 christos #endif
957 1.1 christos case RSVP_CTYPE_TUNNEL_IPV4:
958 1.1 christos if (obj_tlen < 8)
959 1.1 christos return-1;
960 1.1 christos printf("%s IPv4 Tunnel Sender Address: %s, LSP-ID: 0x%04x",
961 1.1 christos ident,
962 1.1 christos ipaddr_string(obj_tptr),
963 1.1 christos EXTRACT_16BITS(obj_tptr+6));
964 1.1 christos obj_tlen-=8;
965 1.1 christos obj_tptr+=8;
966 1.1 christos break;
967 1.1 christos case RSVP_CTYPE_12: /* IPv4 p2mp LSP tunnel */
968 1.1 christos if (obj_tlen < 16)
969 1.1 christos return-1;
970 1.1 christos printf("%s IPv4 Tunnel Sender Address: %s, LSP ID: 0x%04x"
971 1.1 christos "%s Sub-Group Originator ID: %s, Sub-Group ID: 0x%04x",
972 1.1 christos ident,
973 1.1 christos ipaddr_string(obj_tptr),
974 1.1 christos EXTRACT_16BITS(obj_tptr+6),
975 1.1 christos ident,
976 1.1 christos ipaddr_string(obj_tptr+8),
977 1.1 christos EXTRACT_16BITS(obj_tptr+12));
978 1.1 christos obj_tlen-=16;
979 1.1 christos obj_tptr+=16;
980 1.1 christos break;
981 1.1 christos default:
982 1.1 christos hexdump=TRUE;
983 1.1 christos }
984 1.1 christos break;
985 1.1 christos
986 1.1 christos case RSVP_OBJ_LABEL_REQ:
987 1.1 christos switch(rsvp_obj_ctype) {
988 1.1 christos case RSVP_CTYPE_1:
989 1.1 christos while(obj_tlen >= 4 ) {
990 1.1 christos printf("%s L3 Protocol ID: %s",
991 1.1 christos ident,
992 1.1 christos tok2str(ethertype_values,
993 1.1 christos "Unknown Protocol (0x%04x)",
994 1.1 christos EXTRACT_16BITS(obj_tptr+2)));
995 1.1 christos obj_tlen-=4;
996 1.1 christos obj_tptr+=4;
997 1.1 christos }
998 1.1 christos break;
999 1.1 christos case RSVP_CTYPE_2:
1000 1.1 christos if (obj_tlen < 12)
1001 1.1 christos return-1;
1002 1.1 christos printf("%s L3 Protocol ID: %s",
1003 1.1 christos ident,
1004 1.1 christos tok2str(ethertype_values,
1005 1.1 christos "Unknown Protocol (0x%04x)",
1006 1.1 christos EXTRACT_16BITS(obj_tptr+2)));
1007 1.1 christos printf(",%s merge capability",((*(obj_tptr+4))&0x80) ? "no" : "" );
1008 1.1 christos printf("%s Minimum VPI/VCI: %u/%u",
1009 1.1 christos ident,
1010 1.1 christos (EXTRACT_16BITS(obj_tptr+4))&0xfff,
1011 1.1 christos (EXTRACT_16BITS(obj_tptr+6))&0xfff);
1012 1.1 christos printf("%s Maximum VPI/VCI: %u/%u",
1013 1.1 christos ident,
1014 1.1 christos (EXTRACT_16BITS(obj_tptr+8))&0xfff,
1015 1.1 christos (EXTRACT_16BITS(obj_tptr+10))&0xfff);
1016 1.1 christos obj_tlen-=12;
1017 1.1 christos obj_tptr+=12;
1018 1.1 christos break;
1019 1.1 christos case RSVP_CTYPE_3:
1020 1.1 christos if (obj_tlen < 12)
1021 1.1 christos return-1;
1022 1.1 christos printf("%s L3 Protocol ID: %s",
1023 1.1 christos ident,
1024 1.1 christos tok2str(ethertype_values,
1025 1.1 christos "Unknown Protocol (0x%04x)",
1026 1.1 christos EXTRACT_16BITS(obj_tptr+2)));
1027 1.1 christos printf("%s Minimum/Maximum DLCI: %u/%u, %s%s bit DLCI",
1028 1.1 christos ident,
1029 1.1 christos (EXTRACT_32BITS(obj_tptr+4))&0x7fffff,
1030 1.1 christos (EXTRACT_32BITS(obj_tptr+8))&0x7fffff,
1031 1.1 christos (((EXTRACT_16BITS(obj_tptr+4)>>7)&3) == 0 ) ? "10" : "",
1032 1.1 christos (((EXTRACT_16BITS(obj_tptr+4)>>7)&3) == 2 ) ? "23" : "");
1033 1.1 christos obj_tlen-=12;
1034 1.1 christos obj_tptr+=12;
1035 1.1 christos break;
1036 1.1 christos case RSVP_CTYPE_4:
1037 1.1 christos if (obj_tlen < 4)
1038 1.1 christos return-1;
1039 1.1 christos printf("%s LSP Encoding Type: %s (%u)",
1040 1.1 christos ident,
1041 1.1 christos tok2str(gmpls_encoding_values,
1042 1.1 christos "Unknown",
1043 1.1 christos *obj_tptr),
1044 1.1 christos *obj_tptr);
1045 1.1 christos printf("%s Switching Type: %s (%u), Payload ID: %s (0x%04x)",
1046 1.1 christos ident,
1047 1.1 christos tok2str(gmpls_switch_cap_values,
1048 1.1 christos "Unknown",
1049 1.1 christos *(obj_tptr+1)),
1050 1.1 christos *(obj_tptr+1),
1051 1.1 christos tok2str(gmpls_payload_values,
1052 1.1 christos "Unknown",
1053 1.1 christos EXTRACT_16BITS(obj_tptr+2)),
1054 1.1 christos EXTRACT_16BITS(obj_tptr+2));
1055 1.1 christos obj_tlen-=4;
1056 1.1 christos obj_tptr+=4;
1057 1.1 christos break;
1058 1.1 christos default:
1059 1.1 christos hexdump=TRUE;
1060 1.1 christos }
1061 1.1 christos break;
1062 1.1 christos
1063 1.1 christos case RSVP_OBJ_RRO:
1064 1.1 christos case RSVP_OBJ_ERO:
1065 1.1 christos switch(rsvp_obj_ctype) {
1066 1.1 christos case RSVP_CTYPE_IPV4:
1067 1.1 christos while(obj_tlen >= 4 ) {
1068 1.1 christos printf("%s Subobject Type: %s, length %u",
1069 1.1 christos ident,
1070 1.1 christos tok2str(rsvp_obj_xro_values,
1071 1.1 christos "Unknown %u",
1072 1.1 christos RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr)),
1073 1.1 christos *(obj_tptr+1));
1074 1.1 christos
1075 1.1 christos if (*(obj_tptr+1) == 0) { /* prevent infinite loops */
1076 1.1 christos printf("%s ERROR: zero length ERO subtype",ident);
1077 1.1 christos break;
1078 1.1 christos }
1079 1.1 christos
1080 1.1 christos switch(RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr)) {
1081 1.1 christos case RSVP_OBJ_XRO_IPV4:
1082 1.1 christos printf(", %s, %s/%u, Flags: [%s]",
1083 1.1 christos RSVP_OBJ_XRO_MASK_LOOSE(*obj_tptr) ? "Loose" : "Strict",
1084 1.1 christos ipaddr_string(obj_tptr+2),
1085 1.1 christos *(obj_tptr+6),
1086 1.1 christos bittok2str(rsvp_obj_rro_flag_values,
1087 1.1 christos "none",
1088 1.1 christos *(obj_tptr+7))); /* rfc3209 says that this field is rsvd. */
1089 1.1 christos break;
1090 1.1 christos case RSVP_OBJ_XRO_LABEL:
1091 1.1 christos printf(", Flags: [%s] (%#x), Class-Type: %s (%u), %u",
1092 1.1 christos bittok2str(rsvp_obj_rro_label_flag_values,
1093 1.1 christos "none",
1094 1.1 christos *(obj_tptr+2)),
1095 1.1 christos *(obj_tptr+2),
1096 1.1 christos tok2str(rsvp_ctype_values,
1097 1.1 christos "Unknown",
1098 1.1 christos *(obj_tptr+3) + 256*RSVP_OBJ_RRO),
1099 1.1 christos *(obj_tptr+3),
1100 1.1 christos EXTRACT_32BITS(obj_tptr+4));
1101 1.1 christos }
1102 1.1 christos obj_tlen-=*(obj_tptr+1);
1103 1.1 christos obj_tptr+=*(obj_tptr+1);
1104 1.1 christos }
1105 1.1 christos break;
1106 1.1 christos default:
1107 1.1 christos hexdump=TRUE;
1108 1.1 christos }
1109 1.1 christos break;
1110 1.1 christos
1111 1.1 christos case RSVP_OBJ_HELLO:
1112 1.1 christos switch(rsvp_obj_ctype) {
1113 1.1 christos case RSVP_CTYPE_1:
1114 1.1 christos case RSVP_CTYPE_2:
1115 1.1 christos if (obj_tlen < 8)
1116 1.1 christos return-1;
1117 1.1 christos printf("%s Source Instance: 0x%08x, Destination Instance: 0x%08x",
1118 1.1 christos ident,
1119 1.1 christos EXTRACT_32BITS(obj_tptr),
1120 1.1 christos EXTRACT_32BITS(obj_tptr+4));
1121 1.1 christos obj_tlen-=8;
1122 1.1 christos obj_tptr+=8;
1123 1.1 christos break;
1124 1.1 christos default:
1125 1.1 christos hexdump=TRUE;
1126 1.1 christos }
1127 1.1 christos break;
1128 1.1 christos
1129 1.1 christos case RSVP_OBJ_RESTART_CAPABILITY:
1130 1.1 christos switch(rsvp_obj_ctype) {
1131 1.1 christos case RSVP_CTYPE_1:
1132 1.1 christos if (obj_tlen < 8)
1133 1.1 christos return-1;
1134 1.1 christos printf("%s Restart Time: %ums, Recovery Time: %ums",
1135 1.1 christos ident,
1136 1.1 christos EXTRACT_32BITS(obj_tptr),
1137 1.1 christos EXTRACT_32BITS(obj_tptr+4));
1138 1.1 christos obj_tlen-=8;
1139 1.1 christos obj_tptr+=8;
1140 1.1 christos break;
1141 1.1 christos default:
1142 1.1 christos hexdump=TRUE;
1143 1.1 christos }
1144 1.1 christos break;
1145 1.1 christos
1146 1.1 christos case RSVP_OBJ_SESSION_ATTRIBUTE:
1147 1.1 christos switch(rsvp_obj_ctype) {
1148 1.1 christos case RSVP_CTYPE_TUNNEL_IPV4:
1149 1.1 christos if (obj_tlen < 4)
1150 1.1 christos return-1;
1151 1.1 christos namelen = *(obj_tptr+3);
1152 1.1 christos if (obj_tlen < 4+namelen)
1153 1.1 christos return-1;
1154 1.1 christos printf("%s Session Name: ", ident);
1155 1.1 christos for (i = 0; i < namelen; i++)
1156 1.1 christos safeputchar(*(obj_tptr+4+i));
1157 1.1 christos printf("%s Setup Priority: %u, Holding Priority: %u, Flags: [%s] (%#x)",
1158 1.1 christos ident,
1159 1.1 christos (int)*obj_tptr,
1160 1.1 christos (int)*(obj_tptr+1),
1161 1.1 christos bittok2str(rsvp_session_attribute_flag_values,
1162 1.1 christos "none",
1163 1.1 christos *(obj_tptr+2)),
1164 1.1 christos *(obj_tptr+2));
1165 1.1 christos obj_tlen-=4+*(obj_tptr+3);
1166 1.1 christos obj_tptr+=4+*(obj_tptr+3);
1167 1.1 christos break;
1168 1.1 christos default:
1169 1.1 christos hexdump=TRUE;
1170 1.1 christos }
1171 1.1 christos break;
1172 1.1 christos
1173 1.1 christos case RSVP_OBJ_GENERALIZED_UNI:
1174 1.1 christos switch(rsvp_obj_ctype) {
1175 1.1 christos int subobj_type,af,subobj_len,total_subobj_len;
1176 1.1 christos
1177 1.1 christos case RSVP_CTYPE_1:
1178 1.1 christos
1179 1.1 christos if (obj_tlen < 4)
1180 1.1 christos return-1;
1181 1.1 christos
1182 1.1 christos /* read variable length subobjects */
1183 1.1 christos total_subobj_len = obj_tlen;
1184 1.1 christos while(total_subobj_len > 0) {
1185 1.1 christos subobj_len = EXTRACT_16BITS(obj_tptr);
1186 1.1 christos subobj_type = (EXTRACT_16BITS(obj_tptr+2))>>8;
1187 1.1 christos af = (EXTRACT_16BITS(obj_tptr+2))&0x00FF;
1188 1.1 christos
1189 1.1 christos printf("%s Subobject Type: %s (%u), AF: %s (%u), length: %u",
1190 1.1 christos ident,
1191 1.1 christos tok2str(rsvp_obj_generalized_uni_values, "Unknown", subobj_type),
1192 1.1 christos subobj_type,
1193 1.1 christos tok2str(af_values, "Unknown", af), af,
1194 1.1 christos subobj_len);
1195 1.1 christos
1196 1.1 christos switch(subobj_type) {
1197 1.1 christos case RSVP_GEN_UNI_SUBOBJ_SOURCE_TNA_ADDRESS:
1198 1.1 christos case RSVP_GEN_UNI_SUBOBJ_DESTINATION_TNA_ADDRESS:
1199 1.1 christos
1200 1.1 christos switch(af) {
1201 1.1 christos case AFNUM_INET:
1202 1.1 christos if (subobj_len < 8)
1203 1.1 christos return -1;
1204 1.1 christos printf("%s UNI IPv4 TNA address: %s",
1205 1.1 christos ident, ipaddr_string(obj_tptr+4));
1206 1.1 christos break;
1207 1.1 christos #ifdef INET6
1208 1.1 christos case AFNUM_INET6:
1209 1.1 christos if (subobj_len < 20)
1210 1.1 christos return -1;
1211 1.1 christos printf("%s UNI IPv6 TNA address: %s",
1212 1.1 christos ident, ip6addr_string(obj_tptr+4));
1213 1.1 christos break;
1214 1.1 christos #endif
1215 1.1 christos case AFNUM_NSAP:
1216 1.1 christos if (subobj_len) {
1217 1.1 christos /* unless we have a TLV parser lets just hexdump */
1218 1.1 christos hexdump=TRUE;
1219 1.1 christos }
1220 1.1 christos break;
1221 1.1 christos }
1222 1.1 christos break;
1223 1.1 christos
1224 1.1 christos case RSVP_GEN_UNI_SUBOBJ_DIVERSITY:
1225 1.1 christos if (subobj_len) {
1226 1.1 christos /* unless we have a TLV parser lets just hexdump */
1227 1.1 christos hexdump=TRUE;
1228 1.1 christos }
1229 1.1 christos break;
1230 1.1 christos
1231 1.1 christos case RSVP_GEN_UNI_SUBOBJ_EGRESS_LABEL:
1232 1.1 christos if (subobj_len < 16) {
1233 1.1 christos return -1;
1234 1.1 christos }
1235 1.1 christos
1236 1.1 christos printf("%s U-bit: %x, Label type: %u, Logical port id: %u, Label: %u",
1237 1.1 christos ident,
1238 1.1 christos ((EXTRACT_32BITS(obj_tptr+4))>>31),
1239 1.1 christos ((EXTRACT_32BITS(obj_tptr+4))&0xFF),
1240 1.1 christos EXTRACT_32BITS(obj_tptr+8),
1241 1.1 christos EXTRACT_32BITS(obj_tptr+12));
1242 1.1 christos break;
1243 1.1 christos
1244 1.1 christos case RSVP_GEN_UNI_SUBOBJ_SERVICE_LEVEL:
1245 1.1 christos if (subobj_len < 8) {
1246 1.1 christos return -1;
1247 1.1 christos }
1248 1.1 christos
1249 1.1 christos printf("%s Service level: %u",
1250 1.1 christos ident, (EXTRACT_32BITS(obj_tptr+4))>>24);
1251 1.1 christos break;
1252 1.1 christos
1253 1.1 christos default:
1254 1.1 christos hexdump=TRUE;
1255 1.1 christos break;
1256 1.1 christos }
1257 1.1 christos total_subobj_len-=subobj_len;
1258 1.1 christos obj_tptr+=subobj_len;
1259 1.1 christos obj_tlen+=subobj_len;
1260 1.1 christos }
1261 1.1 christos
1262 1.1 christos if (total_subobj_len) {
1263 1.1 christos /* unless we have a TLV parser lets just hexdump */
1264 1.1 christos hexdump=TRUE;
1265 1.1 christos }
1266 1.1 christos break;
1267 1.1 christos
1268 1.1 christos default:
1269 1.1 christos hexdump=TRUE;
1270 1.1 christos }
1271 1.1 christos break;
1272 1.1 christos
1273 1.1 christos case RSVP_OBJ_RSVP_HOP:
1274 1.1 christos switch(rsvp_obj_ctype) {
1275 1.1 christos case RSVP_CTYPE_3: /* fall through - FIXME add TLV parser */
1276 1.1 christos case RSVP_CTYPE_IPV4:
1277 1.1 christos if (obj_tlen < 8)
1278 1.1 christos return-1;
1279 1.1 christos printf("%s Previous/Next Interface: %s, Logical Interface Handle: 0x%08x",
1280 1.1 christos ident,
1281 1.1 christos ipaddr_string(obj_tptr),
1282 1.1 christos EXTRACT_32BITS(obj_tptr+4));
1283 1.1 christos obj_tlen-=8;
1284 1.1 christos obj_tptr+=8;
1285 1.1 christos if (obj_tlen)
1286 1.1 christos hexdump=TRUE; /* unless we have a TLV parser lets just hexdump */
1287 1.1 christos break;
1288 1.1 christos #ifdef INET6
1289 1.1 christos case RSVP_CTYPE_4: /* fall through - FIXME add TLV parser */
1290 1.1 christos case RSVP_CTYPE_IPV6:
1291 1.1 christos if (obj_tlen < 20)
1292 1.1 christos return-1;
1293 1.1 christos printf("%s Previous/Next Interface: %s, Logical Interface Handle: 0x%08x",
1294 1.1 christos ident,
1295 1.1 christos ip6addr_string(obj_tptr),
1296 1.1 christos EXTRACT_32BITS(obj_tptr+16));
1297 1.1 christos obj_tlen-=20;
1298 1.1 christos obj_tptr+=20;
1299 1.1 christos hexdump=TRUE; /* unless we have a TLV parser lets just hexdump */
1300 1.1 christos break;
1301 1.1 christos #endif
1302 1.1 christos default:
1303 1.1 christos hexdump=TRUE;
1304 1.1 christos }
1305 1.1 christos break;
1306 1.1 christos
1307 1.1 christos case RSVP_OBJ_TIME_VALUES:
1308 1.1 christos switch(rsvp_obj_ctype) {
1309 1.1 christos case RSVP_CTYPE_1:
1310 1.1 christos if (obj_tlen < 4)
1311 1.1 christos return-1;
1312 1.1 christos printf("%s Refresh Period: %ums",
1313 1.1 christos ident,
1314 1.1 christos EXTRACT_32BITS(obj_tptr));
1315 1.1 christos obj_tlen-=4;
1316 1.1 christos obj_tptr+=4;
1317 1.1 christos break;
1318 1.1 christos default:
1319 1.1 christos hexdump=TRUE;
1320 1.1 christos }
1321 1.1 christos break;
1322 1.1 christos
1323 1.1 christos /* those three objects do share the same semantics */
1324 1.1 christos case RSVP_OBJ_SENDER_TSPEC:
1325 1.1 christos case RSVP_OBJ_ADSPEC:
1326 1.1 christos case RSVP_OBJ_FLOWSPEC:
1327 1.1 christos switch(rsvp_obj_ctype) {
1328 1.1 christos case RSVP_CTYPE_2:
1329 1.1 christos if (obj_tlen < 4)
1330 1.1 christos return-1;
1331 1.1 christos printf("%s Msg-Version: %u, length: %u",
1332 1.1 christos ident,
1333 1.1 christos (*obj_tptr & 0xf0) >> 4,
1334 1.1 christos EXTRACT_16BITS(obj_tptr+2)<<2);
1335 1.1 christos obj_tptr+=4; /* get to the start of the service header */
1336 1.1 christos obj_tlen-=4;
1337 1.1 christos
1338 1.1 christos while (obj_tlen >= 4) {
1339 1.1 christos intserv_serv_tlen=EXTRACT_16BITS(obj_tptr+2)<<2;
1340 1.1 christos printf("%s Service Type: %s (%u), break bit %s set, Service length: %u",
1341 1.1 christos ident,
1342 1.1 christos tok2str(rsvp_intserv_service_type_values,"unknown",*(obj_tptr)),
1343 1.1 christos *(obj_tptr),
1344 1.1 christos (*(obj_tptr+1)&0x80) ? "" : "not",
1345 1.1 christos intserv_serv_tlen);
1346 1.1 christos
1347 1.1 christos obj_tptr+=4; /* get to the start of the parameter list */
1348 1.1 christos obj_tlen-=4;
1349 1.1 christos
1350 1.1 christos while (intserv_serv_tlen>=4) {
1351 1.1 christos processed = rsvp_intserv_print(obj_tptr, obj_tlen);
1352 1.1 christos if (processed == 0)
1353 1.1 christos break;
1354 1.1 christos obj_tlen-=processed;
1355 1.1 christos intserv_serv_tlen-=processed;
1356 1.1 christos obj_tptr+=processed;
1357 1.1 christos }
1358 1.1 christos }
1359 1.1 christos break;
1360 1.1 christos default:
1361 1.1 christos hexdump=TRUE;
1362 1.1 christos }
1363 1.1 christos break;
1364 1.1 christos
1365 1.1 christos case RSVP_OBJ_FILTERSPEC:
1366 1.1 christos switch(rsvp_obj_ctype) {
1367 1.1 christos case RSVP_CTYPE_IPV4:
1368 1.1 christos if (obj_tlen < 8)
1369 1.1 christos return-1;
1370 1.1 christos printf("%s Source Address: %s, Source Port: %u",
1371 1.1 christos ident,
1372 1.1 christos ipaddr_string(obj_tptr),
1373 1.1 christos EXTRACT_16BITS(obj_tptr+6));
1374 1.1 christos obj_tlen-=8;
1375 1.1 christos obj_tptr+=8;
1376 1.1 christos break;
1377 1.1 christos #ifdef INET6
1378 1.1 christos case RSVP_CTYPE_IPV6:
1379 1.1 christos if (obj_tlen < 20)
1380 1.1 christos return-1;
1381 1.1 christos printf("%s Source Address: %s, Source Port: %u",
1382 1.1 christos ident,
1383 1.1 christos ip6addr_string(obj_tptr),
1384 1.1 christos EXTRACT_16BITS(obj_tptr+18));
1385 1.1 christos obj_tlen-=20;
1386 1.1 christos obj_tptr+=20;
1387 1.1 christos break;
1388 1.1 christos case RSVP_CTYPE_3:
1389 1.1 christos if (obj_tlen < 20)
1390 1.1 christos return-1;
1391 1.1 christos printf("%s Source Address: %s, Flow Label: %u",
1392 1.1 christos ident,
1393 1.1 christos ip6addr_string(obj_tptr),
1394 1.1 christos EXTRACT_24BITS(obj_tptr+17));
1395 1.1 christos obj_tlen-=20;
1396 1.1 christos obj_tptr+=20;
1397 1.1 christos break;
1398 1.1 christos case RSVP_CTYPE_TUNNEL_IPV6:
1399 1.1 christos if (obj_tlen < 20)
1400 1.1 christos return-1;
1401 1.1 christos printf("%s Source Address: %s, LSP-ID: 0x%04x",
1402 1.1 christos ident,
1403 1.1 christos ipaddr_string(obj_tptr),
1404 1.1 christos EXTRACT_16BITS(obj_tptr+18));
1405 1.1 christos obj_tlen-=20;
1406 1.1 christos obj_tptr+=20;
1407 1.1 christos break;
1408 1.1 christos case RSVP_CTYPE_13: /* IPv6 p2mp LSP tunnel */
1409 1.1 christos if (obj_tlen < 40)
1410 1.1 christos return-1;
1411 1.1 christos printf("%s IPv6 Tunnel Sender Address: %s, LSP ID: 0x%04x"
1412 1.1 christos "%s Sub-Group Originator ID: %s, Sub-Group ID: 0x%04x",
1413 1.1 christos ident,
1414 1.1 christos ip6addr_string(obj_tptr),
1415 1.1 christos EXTRACT_16BITS(obj_tptr+18),
1416 1.1 christos ident,
1417 1.1 christos ip6addr_string(obj_tptr+20),
1418 1.1 christos EXTRACT_16BITS(obj_tptr+38));
1419 1.1 christos obj_tlen-=40;
1420 1.1 christos obj_tptr+=40;
1421 1.1 christos break;
1422 1.1 christos #endif
1423 1.1 christos case RSVP_CTYPE_TUNNEL_IPV4:
1424 1.1 christos if (obj_tlen < 8)
1425 1.1 christos return-1;
1426 1.1 christos printf("%s Source Address: %s, LSP-ID: 0x%04x",
1427 1.1 christos ident,
1428 1.1 christos ipaddr_string(obj_tptr),
1429 1.1 christos EXTRACT_16BITS(obj_tptr+6));
1430 1.1 christos obj_tlen-=8;
1431 1.1 christos obj_tptr+=8;
1432 1.1 christos break;
1433 1.1 christos case RSVP_CTYPE_12: /* IPv4 p2mp LSP tunnel */
1434 1.1 christos if (obj_tlen < 16)
1435 1.1 christos return-1;
1436 1.1 christos printf("%s IPv4 Tunnel Sender Address: %s, LSP ID: 0x%04x"
1437 1.1 christos "%s Sub-Group Originator ID: %s, Sub-Group ID: 0x%04x",
1438 1.1 christos ident,
1439 1.1 christos ipaddr_string(obj_tptr),
1440 1.1 christos EXTRACT_16BITS(obj_tptr+6),
1441 1.1 christos ident,
1442 1.1 christos ipaddr_string(obj_tptr+8),
1443 1.1 christos EXTRACT_16BITS(obj_tptr+12));
1444 1.1 christos obj_tlen-=16;
1445 1.1 christos obj_tptr+=16;
1446 1.1 christos break;
1447 1.1 christos default:
1448 1.1 christos hexdump=TRUE;
1449 1.1 christos }
1450 1.1 christos break;
1451 1.1 christos
1452 1.1 christos case RSVP_OBJ_FASTREROUTE:
1453 1.1 christos /* the differences between c-type 1 and 7 are minor */
1454 1.1 christos obj_ptr.rsvp_obj_frr = (const struct rsvp_obj_frr_t *)obj_tptr;
1455 1.1 christos bw.i = EXTRACT_32BITS(obj_ptr.rsvp_obj_frr->bandwidth);
1456 1.1 christos
1457 1.1 christos switch(rsvp_obj_ctype) {
1458 1.1 christos case RSVP_CTYPE_1: /* new style */
1459 1.1 christos if (obj_tlen < sizeof(struct rsvp_obj_frr_t))
1460 1.1 christos return-1;
1461 1.1 christos printf("%s Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps",
1462 1.1 christos ident,
1463 1.1 christos (int)obj_ptr.rsvp_obj_frr->setup_prio,
1464 1.1 christos (int)obj_ptr.rsvp_obj_frr->hold_prio,
1465 1.1 christos (int)obj_ptr.rsvp_obj_frr->hop_limit,
1466 1.1 christos bw.f*8/1000000);
1467 1.1 christos printf("%s Include-any: 0x%08x, Exclude-any: 0x%08x, Include-all: 0x%08x",
1468 1.1 christos ident,
1469 1.1 christos EXTRACT_32BITS(obj_ptr.rsvp_obj_frr->include_any),
1470 1.1 christos EXTRACT_32BITS(obj_ptr.rsvp_obj_frr->exclude_any),
1471 1.1 christos EXTRACT_32BITS(obj_ptr.rsvp_obj_frr->include_all));
1472 1.1 christos obj_tlen-=sizeof(struct rsvp_obj_frr_t);
1473 1.1 christos obj_tptr+=sizeof(struct rsvp_obj_frr_t);
1474 1.1 christos break;
1475 1.1 christos
1476 1.1 christos case RSVP_CTYPE_TUNNEL_IPV4: /* old style */
1477 1.1 christos if (obj_tlen < 16)
1478 1.1 christos return-1;
1479 1.1 christos printf("%s Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps",
1480 1.1 christos ident,
1481 1.1 christos (int)obj_ptr.rsvp_obj_frr->setup_prio,
1482 1.1 christos (int)obj_ptr.rsvp_obj_frr->hold_prio,
1483 1.1 christos (int)obj_ptr.rsvp_obj_frr->hop_limit,
1484 1.1 christos bw.f*8/1000000);
1485 1.1 christos printf("%s Include Colors: 0x%08x, Exclude Colors: 0x%08x",
1486 1.1 christos ident,
1487 1.1 christos EXTRACT_32BITS(obj_ptr.rsvp_obj_frr->include_any),
1488 1.1 christos EXTRACT_32BITS(obj_ptr.rsvp_obj_frr->exclude_any));
1489 1.1 christos obj_tlen-=16;
1490 1.1 christos obj_tptr+=16;
1491 1.1 christos break;
1492 1.1 christos
1493 1.1 christos default:
1494 1.1 christos hexdump=TRUE;
1495 1.1 christos }
1496 1.1 christos break;
1497 1.1 christos
1498 1.1 christos case RSVP_OBJ_DETOUR:
1499 1.1 christos switch(rsvp_obj_ctype) {
1500 1.1 christos case RSVP_CTYPE_TUNNEL_IPV4:
1501 1.1 christos while(obj_tlen >= 8) {
1502 1.1 christos printf("%s PLR-ID: %s, Avoid-Node-ID: %s",
1503 1.1 christos ident,
1504 1.1 christos ipaddr_string(obj_tptr),
1505 1.1 christos ipaddr_string(obj_tptr+4));
1506 1.1 christos obj_tlen-=8;
1507 1.1 christos obj_tptr+=8;
1508 1.1 christos }
1509 1.1 christos break;
1510 1.1 christos default:
1511 1.1 christos hexdump=TRUE;
1512 1.1 christos }
1513 1.1 christos break;
1514 1.1 christos
1515 1.1 christos case RSVP_OBJ_CLASSTYPE:
1516 1.1 christos case RSVP_OBJ_CLASSTYPE_OLD: /* fall through */
1517 1.1 christos switch(rsvp_obj_ctype) {
1518 1.1 christos case RSVP_CTYPE_1:
1519 1.1 christos printf("%s CT: %u",
1520 1.1 christos ident,
1521 1.1 christos EXTRACT_32BITS(obj_tptr)&0x7);
1522 1.1 christos obj_tlen-=4;
1523 1.1 christos obj_tptr+=4;
1524 1.1 christos break;
1525 1.1 christos default:
1526 1.1 christos hexdump=TRUE;
1527 1.1 christos }
1528 1.1 christos break;
1529 1.1 christos
1530 1.1 christos case RSVP_OBJ_ERROR_SPEC:
1531 1.1 christos switch(rsvp_obj_ctype) {
1532 1.1 christos case RSVP_CTYPE_3: /* fall through - FIXME add TLV parser */
1533 1.1 christos case RSVP_CTYPE_IPV4:
1534 1.1 christos if (obj_tlen < 8)
1535 1.1 christos return-1;
1536 1.1 christos error_code=*(obj_tptr+5);
1537 1.1 christos error_value=EXTRACT_16BITS(obj_tptr+6);
1538 1.1 christos printf("%s Error Node Address: %s, Flags: [0x%02x]%s Error Code: %s (%u)",
1539 1.1 christos ident,
1540 1.1 christos ipaddr_string(obj_tptr),
1541 1.1 christos *(obj_tptr+4),
1542 1.1 christos ident,
1543 1.1 christos tok2str(rsvp_obj_error_code_values,"unknown",error_code),
1544 1.1 christos error_code);
1545 1.1 christos switch (error_code) {
1546 1.1 christos case RSVP_OBJ_ERROR_SPEC_CODE_ROUTING:
1547 1.1 christos printf(", Error Value: %s (%u)",
1548 1.1 christos tok2str(rsvp_obj_error_code_routing_values,"unknown",error_value),
1549 1.1 christos error_value);
1550 1.1 christos break;
1551 1.1 christos case RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE: /* fall through */
1552 1.1 christos case RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE_OLD:
1553 1.1 christos printf(", Error Value: %s (%u)",
1554 1.1 christos tok2str(rsvp_obj_error_code_diffserv_te_values,"unknown",error_value),
1555 1.1 christos error_value);
1556 1.1 christos break;
1557 1.1 christos default:
1558 1.1 christos printf(", Unknown Error Value (%u)", error_value);
1559 1.1 christos break;
1560 1.1 christos }
1561 1.1 christos obj_tlen-=8;
1562 1.1 christos obj_tptr+=8;
1563 1.1 christos break;
1564 1.1 christos #ifdef INET6
1565 1.1 christos case RSVP_CTYPE_4: /* fall through - FIXME add TLV parser */
1566 1.1 christos case RSVP_CTYPE_IPV6:
1567 1.1 christos if (obj_tlen < 20)
1568 1.1 christos return-1;
1569 1.1 christos error_code=*(obj_tptr+17);
1570 1.1 christos error_value=EXTRACT_16BITS(obj_tptr+18);
1571 1.1 christos printf("%s Error Node Address: %s, Flags: [0x%02x]%s Error Code: %s (%u)",
1572 1.1 christos ident,
1573 1.1 christos ip6addr_string(obj_tptr),
1574 1.1 christos *(obj_tptr+16),
1575 1.1 christos ident,
1576 1.1 christos tok2str(rsvp_obj_error_code_values,"unknown",error_code),
1577 1.1 christos error_code);
1578 1.1 christos
1579 1.1 christos switch (error_code) {
1580 1.1 christos case RSVP_OBJ_ERROR_SPEC_CODE_ROUTING:
1581 1.1 christos printf(", Error Value: %s (%u)",
1582 1.1 christos tok2str(rsvp_obj_error_code_routing_values,"unknown",error_value),
1583 1.1 christos error_value);
1584 1.1 christos break;
1585 1.1 christos default:
1586 1.1 christos break;
1587 1.1 christos }
1588 1.1 christos obj_tlen-=20;
1589 1.1 christos obj_tptr+=20;
1590 1.1 christos break;
1591 1.1 christos #endif
1592 1.1 christos default:
1593 1.1 christos hexdump=TRUE;
1594 1.1 christos }
1595 1.1 christos break;
1596 1.1 christos
1597 1.1 christos case RSVP_OBJ_PROPERTIES:
1598 1.1 christos switch(rsvp_obj_ctype) {
1599 1.1 christos case RSVP_CTYPE_1:
1600 1.1 christos if (obj_tlen < 4)
1601 1.1 christos return-1;
1602 1.1 christos padbytes = EXTRACT_16BITS(obj_tptr+2);
1603 1.1 christos printf("%s TLV count: %u, padding bytes: %u",
1604 1.1 christos ident,
1605 1.1 christos EXTRACT_16BITS(obj_tptr),
1606 1.1 christos padbytes);
1607 1.1 christos obj_tlen-=4;
1608 1.1 christos obj_tptr+=4;
1609 1.1 christos /* loop through as long there is anything longer than the TLV header (2) */
1610 1.1 christos while(obj_tlen >= 2 + padbytes) {
1611 1.1 christos printf("%s %s TLV (0x%02x), length: %u", /* length includes header */
1612 1.1 christos ident,
1613 1.1 christos tok2str(rsvp_obj_prop_tlv_values,"unknown",*obj_tptr),
1614 1.1 christos *obj_tptr,
1615 1.1 christos *(obj_tptr+1));
1616 1.1 christos if (obj_tlen < *(obj_tptr+1))
1617 1.1 christos return-1;
1618 1.1 christos if (*(obj_tptr+1) < 2)
1619 1.1 christos return -1;
1620 1.1 christos print_unknown_data(obj_tptr+2,"\n\t\t",*(obj_tptr+1)-2);
1621 1.1 christos obj_tlen-=*(obj_tptr+1);
1622 1.1 christos obj_tptr+=*(obj_tptr+1);
1623 1.1 christos }
1624 1.1 christos break;
1625 1.1 christos default:
1626 1.1 christos hexdump=TRUE;
1627 1.1 christos }
1628 1.1 christos break;
1629 1.1 christos
1630 1.1 christos case RSVP_OBJ_MESSAGE_ID: /* fall through */
1631 1.1 christos case RSVP_OBJ_MESSAGE_ID_ACK: /* fall through */
1632 1.1 christos case RSVP_OBJ_MESSAGE_ID_LIST:
1633 1.1 christos switch(rsvp_obj_ctype) {
1634 1.1 christos case RSVP_CTYPE_1:
1635 1.1 christos case RSVP_CTYPE_2:
1636 1.1 christos if (obj_tlen < 8)
1637 1.1 christos return-1;
1638 1.1 christos printf("%s Flags [0x%02x], epoch: %u",
1639 1.1 christos ident,
1640 1.1 christos *obj_tptr,
1641 1.1 christos EXTRACT_24BITS(obj_tptr+1));
1642 1.1 christos obj_tlen-=4;
1643 1.1 christos obj_tptr+=4;
1644 1.1 christos /* loop through as long there are no messages left */
1645 1.1 christos while(obj_tlen >= 4) {
1646 1.1 christos printf("%s Message-ID 0x%08x (%u)",
1647 1.1 christos ident,
1648 1.1 christos EXTRACT_32BITS(obj_tptr),
1649 1.1 christos EXTRACT_32BITS(obj_tptr));
1650 1.1 christos obj_tlen-=4;
1651 1.1 christos obj_tptr+=4;
1652 1.1 christos }
1653 1.1 christos break;
1654 1.1 christos default:
1655 1.1 christos hexdump=TRUE;
1656 1.1 christos }
1657 1.1 christos break;
1658 1.1 christos
1659 1.1 christos case RSVP_OBJ_INTEGRITY:
1660 1.1 christos switch(rsvp_obj_ctype) {
1661 1.1 christos case RSVP_CTYPE_1:
1662 1.1 christos if (obj_tlen < sizeof(struct rsvp_obj_integrity_t))
1663 1.1 christos return-1;
1664 1.1 christos obj_ptr.rsvp_obj_integrity = (const struct rsvp_obj_integrity_t *)obj_tptr;
1665 1.1 christos printf("%s Key-ID 0x%04x%08x, Sequence 0x%08x%08x, Flags [%s]",
1666 1.1 christos ident,
1667 1.1 christos EXTRACT_16BITS(obj_ptr.rsvp_obj_integrity->key_id),
1668 1.1 christos EXTRACT_32BITS(obj_ptr.rsvp_obj_integrity->key_id+2),
1669 1.1 christos EXTRACT_32BITS(obj_ptr.rsvp_obj_integrity->sequence),
1670 1.1 christos EXTRACT_32BITS(obj_ptr.rsvp_obj_integrity->sequence+4),
1671 1.1 christos bittok2str(rsvp_obj_integrity_flag_values,
1672 1.1 christos "none",
1673 1.1 christos obj_ptr.rsvp_obj_integrity->flags));
1674 1.1 christos printf("%s MD5-sum 0x%08x%08x%08x%08x ",
1675 1.1 christos ident,
1676 1.1 christos EXTRACT_32BITS(obj_ptr.rsvp_obj_integrity->digest),
1677 1.1 christos EXTRACT_32BITS(obj_ptr.rsvp_obj_integrity->digest+4),
1678 1.1 christos EXTRACT_32BITS(obj_ptr.rsvp_obj_integrity->digest+8),
1679 1.1 christos EXTRACT_32BITS(obj_ptr.rsvp_obj_integrity->digest+12));
1680 1.1 christos
1681 1.1 christos #ifdef HAVE_LIBCRYPTO
1682 1.1 christos sigcheck = signature_verify(pptr, plen, (unsigned char *)obj_ptr.\
1683 1.1 christos rsvp_obj_integrity->digest);
1684 1.1 christos #else
1685 1.1 christos sigcheck = CANT_CHECK_SIGNATURE;
1686 1.1 christos #endif
1687 1.1 christos printf(" (%s)", tok2str(signature_check_values, "Unknown", sigcheck));
1688 1.1 christos
1689 1.1 christos obj_tlen+=sizeof(struct rsvp_obj_integrity_t);
1690 1.1 christos obj_tptr+=sizeof(struct rsvp_obj_integrity_t);
1691 1.1 christos break;
1692 1.1 christos default:
1693 1.1 christos hexdump=TRUE;
1694 1.1 christos }
1695 1.1 christos break;
1696 1.1 christos
1697 1.1 christos case RSVP_OBJ_ADMIN_STATUS:
1698 1.1 christos switch(rsvp_obj_ctype) {
1699 1.1 christos case RSVP_CTYPE_1:
1700 1.1 christos if (obj_tlen < 4)
1701 1.1 christos return-1;
1702 1.1 christos printf("%s Flags [%s]", ident,
1703 1.1 christos bittok2str(rsvp_obj_admin_status_flag_values, "none",
1704 1.1 christos EXTRACT_32BITS(obj_tptr)));
1705 1.1 christos obj_tlen-=4;
1706 1.1 christos obj_tptr+=4;
1707 1.1 christos break;
1708 1.1 christos default:
1709 1.1 christos hexdump=TRUE;
1710 1.1 christos }
1711 1.1 christos break;
1712 1.1 christos
1713 1.1 christos case RSVP_OBJ_LABEL_SET:
1714 1.1 christos switch(rsvp_obj_ctype) {
1715 1.1 christos case RSVP_CTYPE_1:
1716 1.1 christos if (obj_tlen < 4)
1717 1.1 christos return-1;
1718 1.1 christos action = (EXTRACT_16BITS(obj_tptr)>>8);
1719 1.1 christos
1720 1.1 christos printf("%s Action: %s (%u), Label type: %u", ident,
1721 1.1 christos tok2str(rsvp_obj_label_set_action_values, "Unknown", action),
1722 1.1 christos action, ((EXTRACT_32BITS(obj_tptr) & 0x7F)));
1723 1.1 christos
1724 1.1 christos switch (action) {
1725 1.1 christos case LABEL_SET_INCLUSIVE_RANGE:
1726 1.1 christos case LABEL_SET_EXCLUSIVE_RANGE: /* fall through */
1727 1.1 christos
1728 1.1 christos /* only a couple of subchannels are expected */
1729 1.1 christos if (obj_tlen < 12)
1730 1.1 christos return -1;
1731 1.1 christos printf("%s Start range: %u, End range: %u", ident,
1732 1.1 christos EXTRACT_32BITS(obj_tptr+4),
1733 1.1 christos EXTRACT_32BITS(obj_tptr+8));
1734 1.1 christos obj_tlen-=12;
1735 1.1 christos obj_tptr+=12;
1736 1.1 christos break;
1737 1.1 christos
1738 1.1 christos default:
1739 1.1 christos obj_tlen-=4;
1740 1.1 christos obj_tptr+=4;
1741 1.1 christos subchannel = 1;
1742 1.1 christos while(obj_tlen >= 4 ) {
1743 1.1 christos printf("%s Subchannel #%u: %u", ident, subchannel,
1744 1.1 christos EXTRACT_32BITS(obj_tptr));
1745 1.1 christos obj_tptr+=4;
1746 1.1 christos obj_tlen-=4;
1747 1.1 christos subchannel++;
1748 1.1 christos }
1749 1.1 christos break;
1750 1.1 christos }
1751 1.1 christos break;
1752 1.1 christos default:
1753 1.1 christos hexdump=TRUE;
1754 1.1 christos }
1755 1.1 christos
1756 1.1 christos case RSVP_OBJ_S2L:
1757 1.1 christos switch (rsvp_obj_ctype) {
1758 1.1 christos case RSVP_CTYPE_IPV4:
1759 1.1 christos if (obj_tlen < 4)
1760 1.1 christos return-1;
1761 1.1 christos printf("%s Sub-LSP destination address: %s",
1762 1.1 christos ident, ipaddr_string(obj_tptr));
1763 1.1 christos
1764 1.1 christos obj_tlen-=4;
1765 1.1 christos obj_tptr+=4;
1766 1.1 christos break;
1767 1.1 christos #ifdef INET6
1768 1.1 christos case RSVP_CTYPE_IPV6:
1769 1.1 christos if (obj_tlen < 16)
1770 1.1 christos return-1;
1771 1.1 christos printf("%s Sub-LSP destination address: %s",
1772 1.1 christos ident, ip6addr_string(obj_tptr));
1773 1.1 christos
1774 1.1 christos obj_tlen-=16;
1775 1.1 christos obj_tptr+=16;
1776 1.1 christos break;
1777 1.1 christos #endif
1778 1.1 christos default:
1779 1.1 christos hexdump=TRUE;
1780 1.1 christos }
1781 1.1 christos
1782 1.1 christos /*
1783 1.1 christos * FIXME those are the defined objects that lack a decoder
1784 1.1 christos * you are welcome to contribute code ;-)
1785 1.1 christos */
1786 1.1 christos
1787 1.1 christos case RSVP_OBJ_SCOPE:
1788 1.1 christos case RSVP_OBJ_POLICY_DATA:
1789 1.1 christos case RSVP_OBJ_ACCEPT_LABEL_SET:
1790 1.1 christos case RSVP_OBJ_PROTECTION:
1791 1.1 christos default:
1792 1.1 christos if (vflag <= 1)
1793 1.1 christos print_unknown_data(obj_tptr,"\n\t ",obj_tlen); /* FIXME indentation */
1794 1.1 christos break;
1795 1.1 christos }
1796 1.1 christos /* do we also want to see a hex dump ? */
1797 1.1 christos if (vflag > 1 || hexdump==TRUE)
1798 1.3 christos print_unknown_data(tptr+sizeof(struct rsvp_object_header),"\n\t ", /* FIXME indentation */
1799 1.1 christos rsvp_obj_len-sizeof(struct rsvp_object_header));
1800 1.1 christos
1801 1.1 christos tptr+=rsvp_obj_len;
1802 1.1 christos tlen-=rsvp_obj_len;
1803 1.1 christos }
1804 1.1 christos return 0;
1805 1.1 christos trunc:
1806 1.1 christos printf("\n\t\t packet exceeded snapshot");
1807 1.1 christos return -1;
1808 1.1 christos }
1809 1.1 christos
1810 1.1 christos
1811 1.1 christos void
1812 1.1 christos rsvp_print(register const u_char *pptr, register u_int len) {
1813 1.1 christos
1814 1.1 christos struct rsvp_common_header *rsvp_com_header;
1815 1.1 christos const u_char *tptr,*subtptr;
1816 1.1 christos u_short plen, tlen, subtlen;
1817 1.1 christos
1818 1.1 christos tptr=pptr;
1819 1.1 christos
1820 1.1 christos rsvp_com_header = (struct rsvp_common_header *)pptr;
1821 1.1 christos TCHECK(*rsvp_com_header);
1822 1.1 christos
1823 1.1 christos /*
1824 1.1 christos * Sanity checking of the header.
1825 1.1 christos */
1826 1.1 christos if (RSVP_EXTRACT_VERSION(rsvp_com_header->version_flags) != RSVP_VERSION) {
1827 1.1 christos printf("ERROR: RSVP version %u packet not supported",
1828 1.1 christos RSVP_EXTRACT_VERSION(rsvp_com_header->version_flags));
1829 1.1 christos return;
1830 1.1 christos }
1831 1.1 christos
1832 1.1 christos /* in non-verbose mode just lets print the basic Message Type*/
1833 1.1 christos if (vflag < 1) {
1834 1.1 christos printf("RSVPv%u %s Message, length: %u",
1835 1.1 christos RSVP_EXTRACT_VERSION(rsvp_com_header->version_flags),
1836 1.1 christos tok2str(rsvp_msg_type_values, "unknown (%u)",rsvp_com_header->msg_type),
1837 1.1 christos len);
1838 1.1 christos return;
1839 1.1 christos }
1840 1.1 christos
1841 1.1 christos /* ok they seem to want to know everything - lets fully decode it */
1842 1.1 christos
1843 1.1 christos plen = tlen = EXTRACT_16BITS(rsvp_com_header->length);
1844 1.1 christos
1845 1.1 christos printf("\n\tRSVPv%u %s Message (%u), Flags: [%s], length: %u, ttl: %u, checksum: 0x%04x",
1846 1.1 christos RSVP_EXTRACT_VERSION(rsvp_com_header->version_flags),
1847 1.1 christos tok2str(rsvp_msg_type_values, "unknown, type: %u",rsvp_com_header->msg_type),
1848 1.1 christos rsvp_com_header->msg_type,
1849 1.1 christos bittok2str(rsvp_header_flag_values,"none",RSVP_EXTRACT_FLAGS(rsvp_com_header->version_flags)),
1850 1.1 christos tlen,
1851 1.1 christos rsvp_com_header->ttl,
1852 1.1 christos EXTRACT_16BITS(rsvp_com_header->checksum));
1853 1.1 christos
1854 1.1 christos /*
1855 1.1 christos * Clear checksum prior to signature verification.
1856 1.1 christos */
1857 1.1 christos rsvp_com_header->checksum[0] = 0;
1858 1.1 christos rsvp_com_header->checksum[1] = 0;
1859 1.1 christos
1860 1.1 christos if (tlen < sizeof(const struct rsvp_common_header)) {
1861 1.1 christos printf("ERROR: common header too short %u < %lu", tlen,
1862 1.1 christos (unsigned long)sizeof(const struct rsvp_common_header));
1863 1.1 christos return;
1864 1.1 christos }
1865 1.1 christos
1866 1.1 christos tptr+=sizeof(const struct rsvp_common_header);
1867 1.1 christos tlen-=sizeof(const struct rsvp_common_header);
1868 1.1 christos
1869 1.1 christos switch(rsvp_com_header->msg_type) {
1870 1.1 christos
1871 1.1 christos case RSVP_MSGTYPE_AGGREGATE:
1872 1.1 christos while(tlen > 0) {
1873 1.1 christos subtptr=tptr;
1874 1.1 christos rsvp_com_header = (struct rsvp_common_header *)subtptr;
1875 1.1 christos TCHECK(*rsvp_com_header);
1876 1.1 christos
1877 1.1 christos /*
1878 1.1 christos * Sanity checking of the header.
1879 1.1 christos */
1880 1.1 christos if (RSVP_EXTRACT_VERSION(rsvp_com_header->version_flags) != RSVP_VERSION) {
1881 1.1 christos printf("ERROR: RSVP version %u packet not supported",
1882 1.1 christos RSVP_EXTRACT_VERSION(rsvp_com_header->version_flags));
1883 1.1 christos return;
1884 1.1 christos }
1885 1.1 christos subtlen=EXTRACT_16BITS(rsvp_com_header->length);
1886 1.1 christos
1887 1.1 christos printf("\n\t RSVPv%u %s Message (%u), Flags: [%s], length: %u, ttl: %u, checksum: 0x%04x",
1888 1.1 christos RSVP_EXTRACT_VERSION(rsvp_com_header->version_flags),
1889 1.1 christos tok2str(rsvp_msg_type_values, "unknown, type: %u",rsvp_com_header->msg_type),
1890 1.1 christos rsvp_com_header->msg_type,
1891 1.1 christos bittok2str(rsvp_header_flag_values,"none",RSVP_EXTRACT_FLAGS(rsvp_com_header->version_flags)),
1892 1.1 christos subtlen,
1893 1.1 christos rsvp_com_header->ttl,
1894 1.1 christos EXTRACT_16BITS(rsvp_com_header->checksum));
1895 1.1 christos
1896 1.1 christos /*
1897 1.1 christos * Clear checksum prior to signature verification.
1898 1.1 christos */
1899 1.1 christos rsvp_com_header->checksum[0] = 0;
1900 1.1 christos rsvp_com_header->checksum[1] = 0;
1901 1.1 christos
1902 1.1 christos if (subtlen < sizeof(const struct rsvp_common_header)) {
1903 1.1 christos printf("ERROR: common header too short %u < %lu", subtlen,
1904 1.1 christos (unsigned long)sizeof(const struct rsvp_common_header));
1905 1.1 christos return;
1906 1.1 christos }
1907 1.1 christos
1908 1.1 christos if (tlen < subtlen) {
1909 1.1 christos printf("ERROR: common header too large %u > %u", subtlen,
1910 1.1 christos tlen);
1911 1.1 christos return;
1912 1.1 christos }
1913 1.1 christos
1914 1.1 christos subtptr+=sizeof(const struct rsvp_common_header);
1915 1.1 christos subtlen-=sizeof(const struct rsvp_common_header);
1916 1.1 christos
1917 1.1 christos if (rsvp_obj_print(pptr, plen, subtptr,"\n\t ", subtlen) == -1)
1918 1.1 christos return;
1919 1.1 christos
1920 1.1 christos tptr+=subtlen+sizeof(const struct rsvp_common_header);
1921 1.1 christos tlen-=subtlen+sizeof(const struct rsvp_common_header);
1922 1.1 christos }
1923 1.1 christos
1924 1.1 christos break;
1925 1.1 christos
1926 1.1 christos case RSVP_MSGTYPE_PATH:
1927 1.1 christos case RSVP_MSGTYPE_RESV:
1928 1.1 christos case RSVP_MSGTYPE_PATHERR:
1929 1.1 christos case RSVP_MSGTYPE_RESVERR:
1930 1.1 christos case RSVP_MSGTYPE_PATHTEAR:
1931 1.1 christos case RSVP_MSGTYPE_RESVTEAR:
1932 1.1 christos case RSVP_MSGTYPE_RESVCONF:
1933 1.1 christos case RSVP_MSGTYPE_HELLO_OLD:
1934 1.1 christos case RSVP_MSGTYPE_HELLO:
1935 1.1 christos case RSVP_MSGTYPE_ACK:
1936 1.1 christos case RSVP_MSGTYPE_SREFRESH:
1937 1.1 christos if (rsvp_obj_print(pptr, plen, tptr,"\n\t ", tlen) == -1)
1938 1.1 christos return;
1939 1.1 christos break;
1940 1.1 christos
1941 1.1 christos default:
1942 1.1 christos print_unknown_data(tptr,"\n\t ",tlen);
1943 1.1 christos break;
1944 1.1 christos }
1945 1.1 christos
1946 1.1 christos return;
1947 1.1 christos trunc:
1948 1.1 christos printf("\n\t\t packet exceeded snapshot");
1949 1.1 christos }
1950