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