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