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