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