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