Home | History | Annotate | Line # | Download | only in dist
print-lmp.c revision 1.12
      1 /*
      2  * Redistribution and use in source and binary forms, with or without
      3  * modification, are permitted provided that: (1) source code
      4  * distributions retain the above copyright notice and this paragraph
      5  * in its entirety, and (2) distributions including binary code include
      6  * the above copyright notice and this paragraph in its entirety in
      7  * the documentation or other materials provided with the distribution.
      8  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND
      9  * WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
     10  * LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
     11  * FOR A PARTICULAR PURPOSE.
     12  *
     13  * Original code by Hannes Gredler (hannes (at) gredler.at)
     14  * Support for LMP service discovery extensions (defined by OIF UNI 1.0)
     15  * added by Manu Pathak (mapathak (at) cisco.com), May 2005
     16  */
     17 
     18 /* \summary: Link Management Protocol (LMP) printer */
     19 
     20 /* specification: RFC 4204 */
     21 /* OIF UNI 1.0: https://web.archive.org/web/20160401194747/http://www.oiforum.com/public/documents/OIF-UNI-01.0.pdf */
     22 
     23 #include <sys/cdefs.h>
     24 #ifndef lint
     25 __RCSID("$NetBSD: print-lmp.c,v 1.12 2023/08/17 20:19:40 christos Exp $");
     26 #endif
     27 
     28 #ifdef HAVE_CONFIG_H
     29 #include <config.h>
     30 #endif
     31 
     32 #include "netdissect-stdinc.h"
     33 
     34 #define ND_LONGJMP_FROM_TCHECK
     35 #include "netdissect.h"
     36 #include "extract.h"
     37 #include "addrtoname.h"
     38 #include "gmpls.h"
     39 
     40 
     41 /*
     42  * LMP common header
     43  *
     44  *  0                   1                   2                   3
     45  *  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
     46  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     47  * | Vers  |      (Reserved)       |    Flags      |    Msg Type   |
     48  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     49  * |          LMP Length           |          (Reserved)           |
     50  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     51  */
     52 
     53 struct lmp_common_header {
     54     nd_uint16_t version_res;
     55     nd_uint8_t  flags;
     56     nd_uint8_t  msg_type;
     57     nd_uint16_t length;
     58     nd_byte     reserved[2];
     59 };
     60 
     61 #define LMP_VERSION            1
     62 #define	LMP_EXTRACT_VERSION(x) (((x)&0xf000)>>12)
     63 
     64 static const struct tok lmp_header_flag_values[] = {
     65     { 0x01, "Control Channel Down"},
     66     { 0x02, "LMP restart"},
     67     { 0, NULL}
     68 };
     69 
     70 static const struct tok lmp_obj_te_link_flag_values[] = {
     71     { 0x01, "Fault Management Supported"},
     72     { 0x02, "Link Verification Supported"},
     73     { 0, NULL}
     74 };
     75 
     76 static const struct tok lmp_obj_data_link_flag_values[] = {
     77     { 0x01, "Data Link Port"},
     78     { 0x02, "Allocated for user traffic"},
     79     { 0x04, "Failed link"},
     80     { 0, NULL}
     81 };
     82 
     83 static const struct tok lmp_obj_channel_status_values[] = {
     84     { 1, "Signal Okay"},
     85     { 2, "Signal Degraded"},
     86     { 3, "Signal Fail"},
     87     { 0, NULL}
     88 };
     89 
     90 static const struct tok lmp_obj_begin_verify_flag_values[] = {
     91     { 0x0001, "Verify all links"},
     92     { 0x0002, "Data link type"},
     93     { 0, NULL}
     94 };
     95 
     96 static const struct tok lmp_obj_begin_verify_error_values[] = {
     97     { 0x01, "Link Verification Procedure Not supported"},
     98     { 0x02, "Unwilling to verify"},
     99     { 0x04, "Unsupported verification transport mechanism"},
    100     { 0x08, "Link-Id configuration error"},
    101     { 0x10, "Unknown object c-type"},
    102     { 0, NULL}
    103 };
    104 
    105 static const struct tok lmp_obj_link_summary_error_values[] = {
    106     { 0x01, "Unacceptable non-negotiable LINK-SUMMARY parameters"},
    107     { 0x02, "Renegotiate LINK-SUMMARY parameters"},
    108     { 0x04, "Invalid TE-LINK Object"},
    109     { 0x08, "Invalid DATA-LINK Object"},
    110     { 0x10, "Unknown TE-LINK Object c-type"},
    111     { 0x20, "Unknown DATA-LINK Object c-type"},
    112     { 0, NULL}
    113 };
    114 
    115 /* Service Config Supported Protocols Flags */
    116 static const struct tok lmp_obj_service_config_sp_flag_values[] = {
    117     { 0x01, "RSVP Supported"},
    118     { 0x02, "LDP Supported"},
    119     { 0, NULL}
    120 };
    121 
    122 /* Service Config Client Port Service Attribute Transparency Flags */
    123 static const struct tok lmp_obj_service_config_cpsa_tp_flag_values[] = {
    124     { 0x01, "Path/VC Overhead Transparency Supported"},
    125     { 0x02, "Line/MS Overhead Transparency Supported"},
    126     { 0x04, "Section/RS Overhead Transparency Supported"},
    127     { 0, NULL}
    128 };
    129 
    130 /* Service Config Client Port Service Attribute Contiguous Concatenation Types Flags */
    131 static const struct tok lmp_obj_service_config_cpsa_cct_flag_values[] = {
    132     { 0x01, "Contiguous Concatenation Types Supported"},
    133     { 0, NULL}
    134 };
    135 
    136 /* Service Config Network Service Attributes Transparency Flags */
    137 static const struct tok lmp_obj_service_config_nsa_transparency_flag_values[] = {
    138     { 0x01, "Standard SOH/RSOH Transparency Supported"},
    139     { 0x02, "Standard LOH/MSOH Transparency Supported"},
    140     { 0, NULL}
    141 };
    142 
    143 /* Service Config Network Service Attributes TCM Monitoring Flags */
    144 static const struct tok lmp_obj_service_config_nsa_tcm_flag_values[] = {
    145     { 0x01, "Transparent Tandem Connection Monitoring Supported"},
    146     { 0, NULL}
    147 };
    148 
    149 /* Network Service Attributes Network Diversity Flags */
    150 static const struct tok lmp_obj_service_config_nsa_network_diversity_flag_values[] = {
    151     { 0x01, "Node Diversity Supported"},
    152     { 0x02, "Link Diversity Supported"},
    153     { 0x04, "SRLG Diversity Supported"},
    154     { 0, NULL}
    155 };
    156 
    157 #define	LMP_MSGTYPE_CONFIG                 1
    158 #define	LMP_MSGTYPE_CONFIG_ACK             2
    159 #define	LMP_MSGTYPE_CONFIG_NACK            3
    160 #define	LMP_MSGTYPE_HELLO                  4
    161 #define	LMP_MSGTYPE_VERIFY_BEGIN           5
    162 #define	LMP_MSGTYPE_VERIFY_BEGIN_ACK       6
    163 #define	LMP_MSGTYPE_VERIFY_BEGIN_NACK      7
    164 #define LMP_MSGTYPE_VERIFY_END             8
    165 #define LMP_MSGTYPE_VERIFY_END_ACK         9
    166 #define LMP_MSGTYPE_TEST                  10
    167 #define LMP_MSGTYPE_TEST_STATUS_SUCCESS   11
    168 #define	LMP_MSGTYPE_TEST_STATUS_FAILURE   12
    169 #define	LMP_MSGTYPE_TEST_STATUS_ACK       13
    170 #define	LMP_MSGTYPE_LINK_SUMMARY          14
    171 #define	LMP_MSGTYPE_LINK_SUMMARY_ACK      15
    172 #define	LMP_MSGTYPE_LINK_SUMMARY_NACK     16
    173 #define	LMP_MSGTYPE_CHANNEL_STATUS        17
    174 #define	LMP_MSGTYPE_CHANNEL_STATUS_ACK    18
    175 #define	LMP_MSGTYPE_CHANNEL_STATUS_REQ    19
    176 #define	LMP_MSGTYPE_CHANNEL_STATUS_RESP   20
    177 /* LMP Service Discovery message types defined by UNI 1.0 */
    178 #define LMP_MSGTYPE_SERVICE_CONFIG        50
    179 #define LMP_MSGTYPE_SERVICE_CONFIG_ACK    51
    180 #define LMP_MSGTYPE_SERVICE_CONFIG_NACK   52
    181 
    182 static const struct tok lmp_msg_type_values[] = {
    183     { LMP_MSGTYPE_CONFIG, "Config"},
    184     { LMP_MSGTYPE_CONFIG_ACK, "Config ACK"},
    185     { LMP_MSGTYPE_CONFIG_NACK, "Config NACK"},
    186     { LMP_MSGTYPE_HELLO, "Hello"},
    187     { LMP_MSGTYPE_VERIFY_BEGIN, "Begin Verify"},
    188     { LMP_MSGTYPE_VERIFY_BEGIN_ACK, "Begin Verify ACK"},
    189     { LMP_MSGTYPE_VERIFY_BEGIN_NACK, "Begin Verify NACK"},
    190     { LMP_MSGTYPE_VERIFY_END, "End Verify"},
    191     { LMP_MSGTYPE_VERIFY_END_ACK, "End Verify ACK"},
    192     { LMP_MSGTYPE_TEST, "Test"},
    193     { LMP_MSGTYPE_TEST_STATUS_SUCCESS, "Test Status Success"},
    194     { LMP_MSGTYPE_TEST_STATUS_FAILURE, "Test Status Failure"},
    195     { LMP_MSGTYPE_TEST_STATUS_ACK, "Test Status ACK"},
    196     { LMP_MSGTYPE_LINK_SUMMARY, "Link Summary"},
    197     { LMP_MSGTYPE_LINK_SUMMARY_ACK, "Link Summary ACK"},
    198     { LMP_MSGTYPE_LINK_SUMMARY_NACK, "Link Summary NACK"},
    199     { LMP_MSGTYPE_CHANNEL_STATUS, "Channel Status"},
    200     { LMP_MSGTYPE_CHANNEL_STATUS_ACK, "Channel Status ACK"},
    201     { LMP_MSGTYPE_CHANNEL_STATUS_REQ, "Channel Status Request"},
    202     { LMP_MSGTYPE_CHANNEL_STATUS_RESP, "Channel Status Response"},
    203     { LMP_MSGTYPE_SERVICE_CONFIG, "Service Config"},
    204     { LMP_MSGTYPE_SERVICE_CONFIG_ACK, "Service Config ACK"},
    205     { LMP_MSGTYPE_SERVICE_CONFIG_NACK, "Service Config NACK"},
    206     { 0, NULL}
    207 };
    208 
    209 /*
    210  * LMP object header
    211  *
    212  *  0                   1                   2                   3
    213  *  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
    214  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    215  * |N|   C-Type    |     Class     |            Length             |
    216  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    217  * |                                                               |
    218  * //                       (object contents)                     //
    219  * |                                                               |
    220  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    221  */
    222 
    223 struct lmp_object_header {
    224     nd_uint8_t  ctype;
    225     nd_uint8_t  class_num;
    226     nd_uint16_t length;
    227 };
    228 
    229 #define	LMP_OBJ_CC_ID                 1
    230 #define	LMP_OBJ_NODE_ID               2
    231 #define	LMP_OBJ_LINK_ID               3
    232 #define	LMP_OBJ_INTERFACE_ID          4
    233 #define	LMP_OBJ_MESSAGE_ID            5
    234 #define	LMP_OBJ_CONFIG                6
    235 #define	LMP_OBJ_HELLO                 7
    236 #define	LMP_OBJ_VERIFY_BEGIN          8
    237 #define LMP_OBJ_VERIFY_BEGIN_ACK      9
    238 #define LMP_OBJ_VERIFY_ID            10
    239 #define LMP_OBJ_TE_LINK              11
    240 #define LMP_OBJ_DATA_LINK            12
    241 #define LMP_OBJ_CHANNEL_STATUS       13
    242 #define LMP_OBJ_CHANNEL_STATUS_REQ   14
    243 #define LMP_OBJ_ERROR_CODE           20
    244 
    245 #define LMP_OBJ_SERVICE_CONFIG       51 /* defined in UNI 1.0 */
    246 
    247 static const struct tok lmp_obj_values[] = {
    248     { LMP_OBJ_CC_ID, "Control Channel ID" },
    249     { LMP_OBJ_NODE_ID, "Node ID" },
    250     { LMP_OBJ_LINK_ID, "Link ID" },
    251     { LMP_OBJ_INTERFACE_ID, "Interface ID" },
    252     { LMP_OBJ_MESSAGE_ID, "Message ID" },
    253     { LMP_OBJ_CONFIG, "Configuration" },
    254     { LMP_OBJ_HELLO, "Hello" },
    255     { LMP_OBJ_VERIFY_BEGIN, "Verify Begin" },
    256     { LMP_OBJ_VERIFY_BEGIN_ACK, "Verify Begin ACK" },
    257     { LMP_OBJ_VERIFY_ID, "Verify ID" },
    258     { LMP_OBJ_TE_LINK, "TE Link" },
    259     { LMP_OBJ_DATA_LINK, "Data Link" },
    260     { LMP_OBJ_CHANNEL_STATUS, "Channel Status" },
    261     { LMP_OBJ_CHANNEL_STATUS_REQ, "Channel Status Request" },
    262     { LMP_OBJ_ERROR_CODE, "Error Code" },
    263     { LMP_OBJ_SERVICE_CONFIG, "Service Config" },
    264 
    265     { 0, NULL}
    266 };
    267 
    268 #define INT_SWITCHING_TYPE_SUBOBJ 1
    269 #define WAVELENGTH_SUBOBJ         2
    270 
    271 static const struct tok lmp_data_link_subobj[] = {
    272     { INT_SWITCHING_TYPE_SUBOBJ, "Interface Switching Type" },
    273     { WAVELENGTH_SUBOBJ        , "Wavelength" },
    274     { 0, NULL}
    275 };
    276 
    277 #define	LMP_CTYPE_IPV4       1
    278 #define	LMP_CTYPE_IPV6       2
    279 
    280 #define	LMP_CTYPE_LOC        1
    281 #define	LMP_CTYPE_RMT        2
    282 #define	LMP_CTYPE_UNMD       3
    283 
    284 #define	LMP_CTYPE_IPV4_LOC   1
    285 #define	LMP_CTYPE_IPV4_RMT   2
    286 #define	LMP_CTYPE_IPV6_LOC   3
    287 #define	LMP_CTYPE_IPV6_RMT   4
    288 #define	LMP_CTYPE_UNMD_LOC   5
    289 #define	LMP_CTYPE_UNMD_RMT   6
    290 
    291 #define	LMP_CTYPE_1          1
    292 #define	LMP_CTYPE_2          2
    293 
    294 #define LMP_CTYPE_HELLO_CONFIG  1
    295 #define LMP_CTYPE_HELLO         1
    296 
    297 #define LMP_CTYPE_BEGIN_VERIFY_ERROR 1
    298 #define LMP_CTYPE_LINK_SUMMARY_ERROR 2
    299 
    300 /* C-Types for Service Config Object */
    301 #define LMP_CTYPE_SERVICE_CONFIG_SP                   1
    302 #define LMP_CTYPE_SERVICE_CONFIG_CPSA                 2
    303 #define LMP_CTYPE_SERVICE_CONFIG_TRANSPARENCY_TCM     3
    304 #define LMP_CTYPE_SERVICE_CONFIG_NETWORK_DIVERSITY    4
    305 
    306 /*
    307  * Different link types allowed in the Client Port Service Attributes
    308  * subobject defined for LMP Service Discovery in the UNI 1.0 spec
    309  */
    310 #define LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SDH     5 /* UNI 1.0 Sec 9.4.2 */
    311 #define LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SONET   6 /* UNI 1.0 Sec 9.4.2 */
    312 
    313 /*
    314  * the ctypes are not globally unique so for
    315  * translating it to strings we build a table based
    316  * on objects offsetted by the ctype
    317  */
    318 
    319 static const struct tok lmp_ctype_values[] = {
    320     { 256*LMP_OBJ_CC_ID+LMP_CTYPE_LOC, "Local" },
    321     { 256*LMP_OBJ_CC_ID+LMP_CTYPE_RMT, "Remote" },
    322     { 256*LMP_OBJ_NODE_ID+LMP_CTYPE_LOC, "Local" },
    323     { 256*LMP_OBJ_NODE_ID+LMP_CTYPE_RMT, "Remote" },
    324     { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_IPV4_LOC, "IPv4 Local" },
    325     { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_IPV4_RMT, "IPv4 Remote" },
    326     { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_IPV6_LOC, "IPv6 Local" },
    327     { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_IPV6_RMT, "IPv6 Remote" },
    328     { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_UNMD_LOC, "Unnumbered Local" },
    329     { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_UNMD_RMT, "Unnumbered Remote" },
    330     { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_IPV4_LOC, "IPv4 Local" },
    331     { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_IPV4_RMT, "IPv4 Remote" },
    332     { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_IPV6_LOC, "IPv6 Local" },
    333     { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_IPV6_RMT, "IPv6 Remote" },
    334     { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_UNMD_LOC, "Unnumbered Local" },
    335     { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_UNMD_RMT, "Unnumbered Remote" },
    336     { 256*LMP_OBJ_MESSAGE_ID+LMP_CTYPE_1, "1" },
    337     { 256*LMP_OBJ_MESSAGE_ID+LMP_CTYPE_2, "2" },
    338     { 256*LMP_OBJ_CONFIG+LMP_CTYPE_1, "1" },
    339     { 256*LMP_OBJ_HELLO+LMP_CTYPE_1, "1" },
    340     { 256*LMP_OBJ_VERIFY_BEGIN+LMP_CTYPE_1, "1" },
    341     { 256*LMP_OBJ_VERIFY_BEGIN_ACK+LMP_CTYPE_1, "1" },
    342     { 256*LMP_OBJ_VERIFY_ID+LMP_CTYPE_1, "1" },
    343     { 256*LMP_OBJ_TE_LINK+LMP_CTYPE_IPV4, "IPv4" },
    344     { 256*LMP_OBJ_TE_LINK+LMP_CTYPE_IPV6, "IPv6" },
    345     { 256*LMP_OBJ_TE_LINK+LMP_CTYPE_UNMD, "Unnumbered" },
    346     { 256*LMP_OBJ_DATA_LINK+LMP_CTYPE_IPV4, "IPv4" },
    347     { 256*LMP_OBJ_DATA_LINK+LMP_CTYPE_IPV6, "IPv6" },
    348     { 256*LMP_OBJ_DATA_LINK+LMP_CTYPE_UNMD, "Unnumbered" },
    349     { 256*LMP_OBJ_CHANNEL_STATUS+LMP_CTYPE_IPV4, "IPv4" },
    350     { 256*LMP_OBJ_CHANNEL_STATUS+LMP_CTYPE_IPV6, "IPv6" },
    351     { 256*LMP_OBJ_CHANNEL_STATUS+LMP_CTYPE_UNMD, "Unnumbered" },
    352     { 256*LMP_OBJ_CHANNEL_STATUS_REQ+LMP_CTYPE_IPV4, "IPv4" },
    353     { 256*LMP_OBJ_CHANNEL_STATUS_REQ+LMP_CTYPE_IPV6, "IPv6" },
    354     { 256*LMP_OBJ_CHANNEL_STATUS_REQ+LMP_CTYPE_UNMD, "Unnumbered" },
    355     { 256*LMP_OBJ_ERROR_CODE+LMP_CTYPE_1, "1" },
    356     { 256*LMP_OBJ_ERROR_CODE+LMP_CTYPE_2, "2" },
    357     { 256*LMP_OBJ_SERVICE_CONFIG+LMP_CTYPE_SERVICE_CONFIG_SP, "1" },
    358     { 256*LMP_OBJ_SERVICE_CONFIG+LMP_CTYPE_SERVICE_CONFIG_CPSA, "2" },
    359     { 256*LMP_OBJ_SERVICE_CONFIG+LMP_CTYPE_SERVICE_CONFIG_TRANSPARENCY_TCM, "3" },
    360     { 256*LMP_OBJ_SERVICE_CONFIG+LMP_CTYPE_SERVICE_CONFIG_NETWORK_DIVERSITY, "4" },
    361     { 0, NULL}
    362 };
    363 
    364 static int
    365 lmp_print_data_link_subobjs(netdissect_options *ndo, const u_char *obj_tptr,
    366                             int total_subobj_len, int offset)
    367 {
    368     int hexdump = FALSE;
    369     int subobj_type, subobj_len;
    370 
    371     union { /* int to float conversion buffer */
    372         float f;
    373         uint32_t i;
    374     } bw;
    375 
    376     while (total_subobj_len > 0 && hexdump == FALSE ) {
    377 	subobj_type = GET_U_1(obj_tptr + offset);
    378 	subobj_len  = GET_U_1(obj_tptr + offset + 1);
    379 	ND_PRINT("\n\t    Subobject, Type: %s (%u), Length: %u",
    380 		tok2str(lmp_data_link_subobj,
    381 			"Unknown",
    382 			subobj_type),
    383 			subobj_type,
    384 			subobj_len);
    385 	if (subobj_len < 4) {
    386 	    ND_PRINT(" (too short)");
    387 	    break;
    388 	}
    389 	if ((subobj_len % 4) != 0) {
    390 	    ND_PRINT(" (not a multiple of 4)");
    391 	    break;
    392 	}
    393 	if (total_subobj_len < subobj_len) {
    394 	    ND_PRINT(" (goes past the end of the object)");
    395 	    break;
    396 	}
    397 	switch(subobj_type) {
    398 	case INT_SWITCHING_TYPE_SUBOBJ:
    399 	    ND_PRINT("\n\t      Switching Type: %s (%u)",
    400 		tok2str(gmpls_switch_cap_values,
    401 			"Unknown",
    402 			GET_U_1(obj_tptr + offset + 2)),
    403 		GET_U_1(obj_tptr + offset + 2));
    404 	    ND_PRINT("\n\t      Encoding Type: %s (%u)",
    405 		tok2str(gmpls_encoding_values,
    406 			"Unknown",
    407 			GET_U_1(obj_tptr + offset + 3)),
    408 		GET_U_1(obj_tptr + offset + 3));
    409 	    bw.i = GET_BE_U_4(obj_tptr + offset + 4);
    410 	    ND_PRINT("\n\t      Min Reservable Bandwidth: %.3f Mbps",
    411                 bw.f*8/1000000);
    412 	    bw.i = GET_BE_U_4(obj_tptr + offset + 8);
    413 	    ND_PRINT("\n\t      Max Reservable Bandwidth: %.3f Mbps",
    414                 bw.f*8/1000000);
    415 	    break;
    416 	case WAVELENGTH_SUBOBJ:
    417 	    ND_PRINT("\n\t      Wavelength: %u",
    418 		GET_BE_U_4(obj_tptr + offset + 4));
    419 	    break;
    420 	default:
    421 	    /* Any Unknown Subobject ==> Exit loop */
    422 	    hexdump=TRUE;
    423 	    break;
    424 	}
    425 	total_subobj_len-=subobj_len;
    426 	offset+=subobj_len;
    427     }
    428     return (hexdump);
    429 }
    430 
    431 void
    432 lmp_print(netdissect_options *ndo,
    433           const u_char *pptr, u_int length)
    434 {
    435     const struct lmp_common_header *lmp_com_header;
    436     const u_char *tptr,*obj_tptr;
    437     u_int version_res, tlen, lmp_obj_len, lmp_obj_ctype, obj_tlen;
    438     int hexdump;
    439     u_int offset;
    440     u_int link_type;
    441 
    442     union { /* int to float conversion buffer */
    443         float f;
    444         uint32_t i;
    445     } bw;
    446 
    447     ndo->ndo_protocol = "lmp";
    448     tptr=pptr;
    449     lmp_com_header = (const struct lmp_common_header *)pptr;
    450     ND_TCHECK_SIZE(lmp_com_header);
    451 
    452     version_res = GET_BE_U_2(lmp_com_header->version_res);
    453 
    454     /*
    455      * Sanity checking of the header.
    456      */
    457     if (LMP_EXTRACT_VERSION(version_res) != LMP_VERSION) {
    458 	ND_PRINT("LMP version %u packet not supported",
    459                LMP_EXTRACT_VERSION(version_res));
    460 	return;
    461     }
    462 
    463     /* in non-verbose mode just lets print the basic Message Type*/
    464     if (ndo->ndo_vflag < 1) {
    465         ND_PRINT("LMPv%u %s Message, length: %u",
    466                LMP_EXTRACT_VERSION(version_res),
    467                tok2str(lmp_msg_type_values, "unknown (%u)",GET_U_1(lmp_com_header->msg_type)),
    468                length);
    469         return;
    470     }
    471 
    472     /* ok they seem to want to know everything - lets fully decode it */
    473 
    474     tlen=GET_BE_U_2(lmp_com_header->length);
    475 
    476     ND_PRINT("\n\tLMPv%u, msg-type: %s, Flags: [%s], length: %u",
    477            LMP_EXTRACT_VERSION(version_res),
    478            tok2str(lmp_msg_type_values, "unknown, type: %u",GET_U_1(lmp_com_header->msg_type)),
    479            bittok2str(lmp_header_flag_values,"none",GET_U_1(lmp_com_header->flags)),
    480            tlen);
    481     if (tlen < sizeof(struct lmp_common_header)) {
    482         ND_PRINT(" (too short)");
    483         return;
    484     }
    485     if (tlen > length) {
    486         ND_PRINT(" (too long)");
    487         tlen = length;
    488     }
    489 
    490     tptr+=sizeof(struct lmp_common_header);
    491     tlen-=sizeof(struct lmp_common_header);
    492 
    493     while(tlen>0) {
    494         const struct lmp_object_header *lmp_obj_header =
    495             (const struct lmp_object_header *)tptr;
    496         lmp_obj_len=GET_BE_U_2(lmp_obj_header->length);
    497         lmp_obj_ctype=GET_U_1(lmp_obj_header->ctype)&0x7f;
    498 
    499         ND_PRINT("\n\t  %s Object (%u), Class-Type: %s (%u) Flags: [%snegotiable], length: %u",
    500                tok2str(lmp_obj_values,
    501                        "Unknown",
    502                        GET_U_1(lmp_obj_header->class_num)),
    503                GET_U_1(lmp_obj_header->class_num),
    504                tok2str(lmp_ctype_values,
    505                        "Unknown",
    506                        (GET_U_1(lmp_obj_header->class_num)<<8)+lmp_obj_ctype),
    507                lmp_obj_ctype,
    508                GET_U_1(lmp_obj_header->ctype)&0x80 ? "" : "non-",
    509                lmp_obj_len);
    510 
    511         if (lmp_obj_len < 4) {
    512             ND_PRINT(" (too short)");
    513             return;
    514         }
    515         if ((lmp_obj_len % 4) != 0) {
    516             ND_PRINT(" (not a multiple of 4)");
    517             return;
    518         }
    519 
    520         obj_tptr=tptr+sizeof(struct lmp_object_header);
    521         obj_tlen=lmp_obj_len-sizeof(struct lmp_object_header);
    522 
    523         /* did we capture enough for fully decoding the object ? */
    524         ND_TCHECK_LEN(tptr, lmp_obj_len);
    525         hexdump=FALSE;
    526 
    527         switch(GET_U_1(lmp_obj_header->class_num)) {
    528 
    529         case LMP_OBJ_CC_ID:
    530             switch(lmp_obj_ctype) {
    531             case LMP_CTYPE_LOC:
    532             case LMP_CTYPE_RMT:
    533                 if (obj_tlen != 4) {
    534                     ND_PRINT(" (not correct for object)");
    535                     break;
    536                 }
    537                 ND_PRINT("\n\t    Control Channel ID: %u (0x%08x)",
    538                        GET_BE_U_4(obj_tptr),
    539                        GET_BE_U_4(obj_tptr));
    540                 break;
    541 
    542             default:
    543                 hexdump=TRUE;
    544             }
    545             break;
    546 
    547         case LMP_OBJ_LINK_ID:
    548         case LMP_OBJ_INTERFACE_ID:
    549             switch(lmp_obj_ctype) {
    550             case LMP_CTYPE_IPV4_LOC:
    551             case LMP_CTYPE_IPV4_RMT:
    552                 if (obj_tlen != 4) {
    553                     ND_PRINT(" (not correct for object)");
    554                     break;
    555                 }
    556                 ND_PRINT("\n\t    IPv4 Link ID: %s (0x%08x)",
    557                        GET_IPADDR_STRING(obj_tptr),
    558                        GET_BE_U_4(obj_tptr));
    559                 break;
    560             case LMP_CTYPE_IPV6_LOC:
    561             case LMP_CTYPE_IPV6_RMT:
    562                 if (obj_tlen != 16) {
    563                     ND_PRINT(" (not correct for object)");
    564                     break;
    565                 }
    566                 ND_PRINT("\n\t    IPv6 Link ID: %s (0x%08x)",
    567                        GET_IP6ADDR_STRING(obj_tptr),
    568                        GET_BE_U_4(obj_tptr));
    569                 break;
    570             case LMP_CTYPE_UNMD_LOC:
    571             case LMP_CTYPE_UNMD_RMT:
    572                 if (obj_tlen != 4) {
    573                     ND_PRINT(" (not correct for object)");
    574                     break;
    575                 }
    576                 ND_PRINT("\n\t    Link ID: %u (0x%08x)",
    577                        GET_BE_U_4(obj_tptr),
    578                        GET_BE_U_4(obj_tptr));
    579                 break;
    580             default:
    581                 hexdump=TRUE;
    582             }
    583             break;
    584 
    585         case LMP_OBJ_MESSAGE_ID:
    586             switch(lmp_obj_ctype) {
    587             case LMP_CTYPE_1:
    588                 if (obj_tlen != 4) {
    589                     ND_PRINT(" (not correct for object)");
    590                     break;
    591                 }
    592                 ND_PRINT("\n\t    Message ID: %u (0x%08x)",
    593                        GET_BE_U_4(obj_tptr),
    594                        GET_BE_U_4(obj_tptr));
    595                 break;
    596             case LMP_CTYPE_2:
    597                 if (obj_tlen != 4) {
    598                     ND_PRINT(" (not correct for object)");
    599                     break;
    600                 }
    601                 ND_PRINT("\n\t    Message ID Ack: %u (0x%08x)",
    602                        GET_BE_U_4(obj_tptr),
    603                        GET_BE_U_4(obj_tptr));
    604                 break;
    605             default:
    606                 hexdump=TRUE;
    607             }
    608             break;
    609 
    610         case LMP_OBJ_NODE_ID:
    611             switch(lmp_obj_ctype) {
    612             case LMP_CTYPE_LOC:
    613             case LMP_CTYPE_RMT:
    614                 if (obj_tlen != 4) {
    615                     ND_PRINT(" (not correct for object)");
    616                     break;
    617                 }
    618                 ND_PRINT("\n\t    Node ID: %s (0x%08x)",
    619                        GET_IPADDR_STRING(obj_tptr),
    620                        GET_BE_U_4(obj_tptr));
    621                 break;
    622 
    623             default:
    624                 hexdump=TRUE;
    625             }
    626             break;
    627 
    628         case LMP_OBJ_CONFIG:
    629             switch(lmp_obj_ctype) {
    630             case LMP_CTYPE_HELLO_CONFIG:
    631                 if (obj_tlen != 4) {
    632                     ND_PRINT(" (not correct for object)");
    633                     break;
    634                 }
    635                 ND_PRINT("\n\t    Hello Interval: %u\n\t    Hello Dead Interval: %u",
    636                        GET_BE_U_2(obj_tptr),
    637                        GET_BE_U_2(obj_tptr + 2));
    638                 break;
    639 
    640             default:
    641                 hexdump=TRUE;
    642             }
    643             break;
    644 
    645         case LMP_OBJ_HELLO:
    646             switch(lmp_obj_ctype) {
    647 	    case LMP_CTYPE_HELLO:
    648                 if (obj_tlen != 8) {
    649                     ND_PRINT(" (not correct for object)");
    650                     break;
    651                 }
    652                 ND_PRINT("\n\t    Tx Seq: %u, Rx Seq: %u",
    653                        GET_BE_U_4(obj_tptr),
    654                        GET_BE_U_4(obj_tptr + 4));
    655                 break;
    656 
    657             default:
    658                 hexdump=TRUE;
    659             }
    660             break;
    661 
    662         case LMP_OBJ_TE_LINK:
    663 	    switch(lmp_obj_ctype) {
    664 	    case LMP_CTYPE_IPV4:
    665                 if (obj_tlen != 12) {
    666                     ND_PRINT(" (not correct for object)");
    667                     break;
    668                 }
    669 		ND_PRINT("\n\t    Flags: [%s]",
    670 		    bittok2str(lmp_obj_te_link_flag_values,
    671 			"none",
    672 			GET_U_1(obj_tptr)));
    673 
    674 		ND_PRINT("\n\t    Local Link-ID: %s (0x%08x)"
    675 		       "\n\t    Remote Link-ID: %s (0x%08x)",
    676                        GET_IPADDR_STRING(obj_tptr+4),
    677                        GET_BE_U_4(obj_tptr + 4),
    678                        GET_IPADDR_STRING(obj_tptr+8),
    679                        GET_BE_U_4(obj_tptr + 8));
    680 		break;
    681 
    682 	    case LMP_CTYPE_IPV6:
    683                 if (obj_tlen != 36) {
    684                     ND_PRINT(" (not correct for object)");
    685                     break;
    686                 }
    687 		ND_PRINT("\n\t    Flags: [%s]",
    688 		    bittok2str(lmp_obj_te_link_flag_values,
    689 			"none",
    690 			GET_U_1(obj_tptr)));
    691 
    692 		ND_PRINT("\n\t    Local Link-ID: %s (0x%08x)"
    693 		       "\n\t    Remote Link-ID: %s (0x%08x)",
    694                        GET_IP6ADDR_STRING(obj_tptr+4),
    695                        GET_BE_U_4(obj_tptr + 4),
    696                        GET_IP6ADDR_STRING(obj_tptr+20),
    697                        GET_BE_U_4(obj_tptr + 20));
    698                 break;
    699 
    700 	    case LMP_CTYPE_UNMD:
    701                 if (obj_tlen != 12) {
    702                     ND_PRINT(" (not correct for object)");
    703                     break;
    704                 }
    705 		ND_PRINT("\n\t    Flags: [%s]",
    706 		    bittok2str(lmp_obj_te_link_flag_values,
    707 			"none",
    708 			GET_U_1(obj_tptr)));
    709 
    710 		ND_PRINT("\n\t    Local Link-ID: %u (0x%08x)"
    711 		       "\n\t    Remote Link-ID: %u (0x%08x)",
    712                        GET_BE_U_4(obj_tptr + 4),
    713                        GET_BE_U_4(obj_tptr + 4),
    714                        GET_BE_U_4(obj_tptr + 8),
    715                        GET_BE_U_4(obj_tptr + 8));
    716 		break;
    717 
    718             default:
    719                 hexdump=TRUE;
    720             }
    721             break;
    722 
    723         case LMP_OBJ_DATA_LINK:
    724 	    switch(lmp_obj_ctype) {
    725 	    case LMP_CTYPE_IPV4:
    726                 if (obj_tlen < 12) {
    727                     ND_PRINT(" (not correct for object)");
    728                     break;
    729                 }
    730 	        ND_PRINT("\n\t    Flags: [%s]",
    731 		    bittok2str(lmp_obj_data_link_flag_values,
    732 			"none",
    733 			GET_U_1(obj_tptr)));
    734                 ND_PRINT("\n\t    Local Interface ID: %s (0x%08x)"
    735                        "\n\t    Remote Interface ID: %s (0x%08x)",
    736                        GET_IPADDR_STRING(obj_tptr+4),
    737                        GET_BE_U_4(obj_tptr + 4),
    738                        GET_IPADDR_STRING(obj_tptr+8),
    739                        GET_BE_U_4(obj_tptr + 8));
    740 
    741 		if (lmp_print_data_link_subobjs(ndo, obj_tptr, obj_tlen - 12, 12))
    742 		    hexdump=TRUE;
    743 		break;
    744 
    745 	    case LMP_CTYPE_IPV6:
    746                 if (obj_tlen < 36) {
    747                     ND_PRINT(" (not correct for object)");
    748                     break;
    749                 }
    750 	        ND_PRINT("\n\t    Flags: [%s]",
    751 		    bittok2str(lmp_obj_data_link_flag_values,
    752 			"none",
    753 			GET_U_1(obj_tptr)));
    754                 ND_PRINT("\n\t    Local Interface ID: %s (0x%08x)"
    755                        "\n\t    Remote Interface ID: %s (0x%08x)",
    756                        GET_IP6ADDR_STRING(obj_tptr+4),
    757                        GET_BE_U_4(obj_tptr + 4),
    758                        GET_IP6ADDR_STRING(obj_tptr+20),
    759                        GET_BE_U_4(obj_tptr + 20));
    760 
    761 		if (lmp_print_data_link_subobjs(ndo, obj_tptr, obj_tlen - 36, 36))
    762 		    hexdump=TRUE;
    763 		break;
    764 
    765 	    case LMP_CTYPE_UNMD:
    766                 if (obj_tlen < 12) {
    767                     ND_PRINT(" (not correct for object)");
    768                     break;
    769                 }
    770 	        ND_PRINT("\n\t    Flags: [%s]",
    771 		    bittok2str(lmp_obj_data_link_flag_values,
    772 			"none",
    773 			GET_U_1(obj_tptr)));
    774                 ND_PRINT("\n\t    Local Interface ID: %u (0x%08x)"
    775                        "\n\t    Remote Interface ID: %u (0x%08x)",
    776                        GET_BE_U_4(obj_tptr + 4),
    777                        GET_BE_U_4(obj_tptr + 4),
    778                        GET_BE_U_4(obj_tptr + 8),
    779                        GET_BE_U_4(obj_tptr + 8));
    780 
    781 		if (lmp_print_data_link_subobjs(ndo, obj_tptr, obj_tlen - 12, 12))
    782 		    hexdump=TRUE;
    783 		break;
    784 
    785             default:
    786                 hexdump=TRUE;
    787             }
    788             break;
    789 
    790         case LMP_OBJ_VERIFY_BEGIN:
    791 	    switch(lmp_obj_ctype) {
    792             case LMP_CTYPE_1:
    793                 if (obj_tlen != 20) {
    794                     ND_PRINT(" (not correct for object)");
    795                     break;
    796                 }
    797 		ND_PRINT("\n\t    Flags: %s",
    798 		bittok2str(lmp_obj_begin_verify_flag_values,
    799 			"none",
    800 			GET_BE_U_2(obj_tptr)));
    801 		ND_PRINT("\n\t    Verify Interval: %u",
    802 			GET_BE_U_2(obj_tptr + 2));
    803 		ND_PRINT("\n\t    Data links: %u",
    804 			GET_BE_U_4(obj_tptr + 4));
    805                 ND_PRINT("\n\t    Encoding type: %s",
    806 			tok2str(gmpls_encoding_values, "Unknown", GET_U_1((obj_tptr + 8))));
    807                 ND_PRINT("\n\t    Verify Transport Mechanism: %u (0x%x)%s",
    808 			GET_BE_U_2(obj_tptr + 10),
    809 			GET_BE_U_2(obj_tptr + 10),
    810 			GET_BE_U_2(obj_tptr + 10)&8000 ? " (Payload test messages capable)" : "");
    811                 bw.i = GET_BE_U_4(obj_tptr + 12);
    812 		ND_PRINT("\n\t    Transmission Rate: %.3f Mbps",bw.f*8/1000000);
    813 		ND_PRINT("\n\t    Wavelength: %u",
    814 			GET_BE_U_4(obj_tptr + 16));
    815 		break;
    816 
    817             default:
    818                 hexdump=TRUE;
    819             }
    820             break;
    821 
    822         case LMP_OBJ_VERIFY_BEGIN_ACK:
    823 	    switch(lmp_obj_ctype) {
    824             case LMP_CTYPE_1:
    825                 if (obj_tlen != 4) {
    826                     ND_PRINT(" (not correct for object)");
    827                     break;
    828                 }
    829                 ND_PRINT("\n\t    Verify Dead Interval: %u"
    830                        "\n\t    Verify Transport Response: %u",
    831                        GET_BE_U_2(obj_tptr),
    832                        GET_BE_U_2(obj_tptr + 2));
    833                 break;
    834 
    835             default:
    836                 hexdump=TRUE;
    837             }
    838             break;
    839 
    840 	case LMP_OBJ_VERIFY_ID:
    841 	    switch(lmp_obj_ctype) {
    842             case LMP_CTYPE_1:
    843                 if (obj_tlen != 4) {
    844                     ND_PRINT(" (not correct for object)");
    845                     break;
    846                 }
    847                 ND_PRINT("\n\t    Verify ID: %u",
    848                        GET_BE_U_4(obj_tptr));
    849                 break;
    850 
    851             default:
    852                 hexdump=TRUE;
    853             }
    854             break;
    855 
    856 	case LMP_OBJ_CHANNEL_STATUS:
    857             switch(lmp_obj_ctype) {
    858 	    case LMP_CTYPE_IPV4:
    859 		offset = 0;
    860 		/* Decode pairs: <Interface_ID (4 bytes), Channel_status (4 bytes)> */
    861 		while (offset+8 <= obj_tlen) {
    862 			ND_PRINT("\n\t    Interface ID: %s (0x%08x)",
    863 			GET_IPADDR_STRING(obj_tptr+offset),
    864 			GET_BE_U_4(obj_tptr + offset));
    865 
    866 			ND_PRINT("\n\t\t    Active: %s (%u)",
    867 				(GET_BE_U_4(obj_tptr + offset + 4)>>31) ?
    868 				"Allocated" : "Non-allocated",
    869 				(GET_BE_U_4(obj_tptr + offset + 4)>>31));
    870 
    871 			ND_PRINT("\n\t\t    Direction: %s (%u)",
    872 				(GET_BE_U_4(obj_tptr + offset + 4)>>30)&0x1 ?
    873 				"Transmit" : "Receive",
    874 				(GET_BE_U_4(obj_tptr + offset + 4)>>30)&0x1);
    875 
    876 			ND_PRINT("\n\t\t    Channel Status: %s (%u)",
    877 					tok2str(lmp_obj_channel_status_values,
    878 					"Unknown",
    879 					GET_BE_U_4(obj_tptr + offset + 4)&0x3FFFFFF),
    880 					GET_BE_U_4(obj_tptr + offset + 4)&0x3FFFFFF);
    881 			offset+=8;
    882 		}
    883                 break;
    884 
    885 	    case LMP_CTYPE_IPV6:
    886 		offset = 0;
    887 		/* Decode pairs: <Interface_ID (16 bytes), Channel_status (4 bytes)> */
    888 		while (offset+20 <= obj_tlen) {
    889 			ND_PRINT("\n\t    Interface ID: %s (0x%08x)",
    890 			GET_IP6ADDR_STRING(obj_tptr+offset),
    891 			GET_BE_U_4(obj_tptr + offset));
    892 
    893 			ND_PRINT("\n\t\t    Active: %s (%u)",
    894 				(GET_BE_U_4(obj_tptr + offset + 16)>>31) ?
    895 				"Allocated" : "Non-allocated",
    896 				(GET_BE_U_4(obj_tptr + offset + 16)>>31));
    897 
    898 			ND_PRINT("\n\t\t    Direction: %s (%u)",
    899 				(GET_BE_U_4(obj_tptr + offset + 16)>>30)&0x1 ?
    900 				"Transmit" : "Receive",
    901 				(GET_BE_U_4(obj_tptr + offset + 16)>>30)&0x1);
    902 
    903 			ND_PRINT("\n\t\t    Channel Status: %s (%u)",
    904 					tok2str(lmp_obj_channel_status_values,
    905 					"Unknown",
    906 					GET_BE_U_4(obj_tptr + offset + 16)&0x3FFFFFF),
    907 					GET_BE_U_4(obj_tptr + offset + 16)&0x3FFFFFF);
    908 			offset+=20;
    909 		}
    910                 break;
    911 
    912 	    case LMP_CTYPE_UNMD:
    913 		offset = 0;
    914 		/* Decode pairs: <Interface_ID (4 bytes), Channel_status (4 bytes)> */
    915 		while (offset+8 <= obj_tlen) {
    916 			ND_PRINT("\n\t    Interface ID: %u (0x%08x)",
    917 			GET_BE_U_4(obj_tptr + offset),
    918 			GET_BE_U_4(obj_tptr + offset));
    919 
    920 			ND_PRINT("\n\t\t    Active: %s (%u)",
    921 				(GET_BE_U_4(obj_tptr + offset + 4)>>31) ?
    922 				"Allocated" : "Non-allocated",
    923 				(GET_BE_U_4(obj_tptr + offset + 4)>>31));
    924 
    925 			ND_PRINT("\n\t\t    Direction: %s (%u)",
    926 				(GET_BE_U_4(obj_tptr + offset + 4)>>30)&0x1 ?
    927 				"Transmit" : "Receive",
    928 				(GET_BE_U_4(obj_tptr + offset + 4)>>30)&0x1);
    929 
    930 			ND_PRINT("\n\t\t    Channel Status: %s (%u)",
    931 					tok2str(lmp_obj_channel_status_values,
    932 					"Unknown",
    933 					GET_BE_U_4(obj_tptr + offset + 4)&0x3FFFFFF),
    934 					GET_BE_U_4(obj_tptr + offset + 4)&0x3FFFFFF);
    935 			offset+=8;
    936 		}
    937                 break;
    938 
    939             default:
    940                 hexdump=TRUE;
    941             }
    942             break;
    943 
    944 	case LMP_OBJ_CHANNEL_STATUS_REQ:
    945             switch(lmp_obj_ctype) {
    946 	    case LMP_CTYPE_IPV4:
    947 		offset = 0;
    948 		while (offset+4 <= obj_tlen) {
    949 			ND_PRINT("\n\t    Interface ID: %s (0x%08x)",
    950 			GET_IPADDR_STRING(obj_tptr+offset),
    951 			GET_BE_U_4(obj_tptr + offset));
    952 			offset+=4;
    953 		}
    954                 break;
    955 
    956 	    case LMP_CTYPE_IPV6:
    957 		offset = 0;
    958 		while (offset+16 <= obj_tlen) {
    959 			ND_PRINT("\n\t    Interface ID: %s (0x%08x)",
    960 			GET_IP6ADDR_STRING(obj_tptr+offset),
    961 			GET_BE_U_4(obj_tptr + offset));
    962 			offset+=16;
    963 		}
    964                 break;
    965 
    966 	    case LMP_CTYPE_UNMD:
    967 		offset = 0;
    968 		while (offset+4 <= obj_tlen) {
    969 			ND_PRINT("\n\t    Interface ID: %u (0x%08x)",
    970 			GET_BE_U_4(obj_tptr + offset),
    971 			GET_BE_U_4(obj_tptr + offset));
    972 			offset+=4;
    973 		}
    974                 break;
    975 
    976 	    default:
    977                 hexdump=TRUE;
    978             }
    979             break;
    980 
    981         case LMP_OBJ_ERROR_CODE:
    982 	    switch(lmp_obj_ctype) {
    983             case LMP_CTYPE_BEGIN_VERIFY_ERROR:
    984                 if (obj_tlen != 4) {
    985                     ND_PRINT(" (not correct for object)");
    986                     break;
    987                 }
    988 		ND_PRINT("\n\t    Error Code: %s",
    989 		bittok2str(lmp_obj_begin_verify_error_values,
    990 			"none",
    991 			GET_BE_U_4(obj_tptr)));
    992                 break;
    993 
    994             case LMP_CTYPE_LINK_SUMMARY_ERROR:
    995                 if (obj_tlen != 4) {
    996                     ND_PRINT(" (not correct for object)");
    997                     break;
    998                 }
    999 		ND_PRINT("\n\t    Error Code: %s",
   1000 		bittok2str(lmp_obj_link_summary_error_values,
   1001 			"none",
   1002 			GET_BE_U_4(obj_tptr)));
   1003                 break;
   1004             default:
   1005                 hexdump=TRUE;
   1006             }
   1007             break;
   1008 
   1009 	case LMP_OBJ_SERVICE_CONFIG:
   1010 	    switch (lmp_obj_ctype) {
   1011 	    case LMP_CTYPE_SERVICE_CONFIG_SP:
   1012                 if (obj_tlen != 4) {
   1013                     ND_PRINT(" (not correct for object)");
   1014                     break;
   1015                 }
   1016 		ND_PRINT("\n\t Flags: %s",
   1017 		       bittok2str(lmp_obj_service_config_sp_flag_values,
   1018 				  "none",
   1019 				  GET_U_1(obj_tptr)));
   1020 
   1021 		ND_PRINT("\n\t  UNI Version: %u",
   1022 		       GET_U_1(obj_tptr + 1));
   1023 
   1024 		break;
   1025 
   1026             case LMP_CTYPE_SERVICE_CONFIG_CPSA:
   1027                 if (obj_tlen != 16) {
   1028                     ND_PRINT(" (not correct for object)");
   1029                     break;
   1030                 }
   1031 
   1032 		link_type = GET_U_1(obj_tptr);
   1033 
   1034 		ND_PRINT("\n\t Link Type: %s (%u)",
   1035 		       tok2str(lmp_sd_service_config_cpsa_link_type_values,
   1036 			       "Unknown", link_type),
   1037 		       link_type);
   1038 
   1039 		switch (link_type) {
   1040 		case LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SDH:
   1041 		    ND_PRINT("\n\t Signal Type: %s (%u)",
   1042 			   tok2str(lmp_sd_service_config_cpsa_signal_type_sdh_values,
   1043 				   "Unknown",
   1044 				   GET_U_1(obj_tptr + 1)),
   1045 			   GET_U_1(obj_tptr + 1));
   1046 		    break;
   1047 
   1048 		case LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SONET:
   1049 		    ND_PRINT("\n\t Signal Type: %s (%u)",
   1050 			   tok2str(lmp_sd_service_config_cpsa_signal_type_sonet_values,
   1051 				   "Unknown",
   1052 				   GET_U_1(obj_tptr + 1)),
   1053 			   GET_U_1(obj_tptr + 1));
   1054 		    break;
   1055 		}
   1056 
   1057 		ND_PRINT("\n\t Transparency: %s",
   1058 		       bittok2str(lmp_obj_service_config_cpsa_tp_flag_values,
   1059 				  "none",
   1060 				  GET_U_1(obj_tptr + 2)));
   1061 
   1062 		ND_PRINT("\n\t Contiguous Concatenation Types: %s",
   1063 		       bittok2str(lmp_obj_service_config_cpsa_cct_flag_values,
   1064 				  "none",
   1065 				  GET_U_1(obj_tptr + 3)));
   1066 
   1067 		ND_PRINT("\n\t Minimum NCC: %u",
   1068 		       GET_BE_U_2(obj_tptr + 4));
   1069 
   1070 		ND_PRINT("\n\t Maximum NCC: %u",
   1071 		       GET_BE_U_2(obj_tptr + 6));
   1072 
   1073 		ND_PRINT("\n\t Minimum NVC:%u",
   1074 		       GET_BE_U_2(obj_tptr + 8));
   1075 
   1076 		ND_PRINT("\n\t Maximum NVC:%u",
   1077 		       GET_BE_U_2(obj_tptr + 10));
   1078 
   1079 		ND_PRINT("\n\t    Local Interface ID: %s (0x%08x)",
   1080 		       GET_IPADDR_STRING(obj_tptr+12),
   1081 		       GET_BE_U_4(obj_tptr + 12));
   1082 
   1083 		break;
   1084 
   1085 	    case LMP_CTYPE_SERVICE_CONFIG_TRANSPARENCY_TCM:
   1086                 if (obj_tlen != 8) {
   1087                     ND_PRINT(" (not correct for object)");
   1088                     break;
   1089                 }
   1090 
   1091 		ND_PRINT("\n\t Transparency Flags: %s",
   1092 		       bittok2str(
   1093 			   lmp_obj_service_config_nsa_transparency_flag_values,
   1094 			   "none",
   1095 			   GET_BE_U_4(obj_tptr)));
   1096 
   1097 		ND_PRINT("\n\t TCM Monitoring Flags: %s",
   1098 		       bittok2str(
   1099 			   lmp_obj_service_config_nsa_tcm_flag_values,
   1100 			   "none",
   1101 			   GET_U_1(obj_tptr + 7)));
   1102 
   1103 		break;
   1104 
   1105 	    case LMP_CTYPE_SERVICE_CONFIG_NETWORK_DIVERSITY:
   1106                 if (obj_tlen != 4) {
   1107                     ND_PRINT(" (not correct for object)");
   1108                     break;
   1109                 }
   1110 
   1111 		ND_PRINT("\n\t Diversity: Flags: %s",
   1112 		       bittok2str(
   1113 			   lmp_obj_service_config_nsa_network_diversity_flag_values,
   1114 			   "none",
   1115 			   GET_U_1(obj_tptr + 3)));
   1116 		break;
   1117 
   1118 	    default:
   1119 		hexdump = TRUE;
   1120 	    }
   1121 
   1122 	break;
   1123 
   1124         default:
   1125             if (ndo->ndo_vflag <= 1)
   1126                 print_unknown_data(ndo,obj_tptr,"\n\t    ",obj_tlen);
   1127             break;
   1128         }
   1129         /* do we want to see an additionally hexdump ? */
   1130         if (ndo->ndo_vflag > 1 || hexdump==TRUE)
   1131             print_unknown_data(ndo,tptr+sizeof(struct lmp_object_header),"\n\t    ",
   1132                                lmp_obj_len-sizeof(struct lmp_object_header));
   1133 
   1134         if (tlen < lmp_obj_len) {
   1135             ND_PRINT(" [remaining objects length %u < %u]", tlen, lmp_obj_len);
   1136             nd_print_invalid(ndo);
   1137             break;
   1138         }
   1139         tptr+=lmp_obj_len;
   1140         tlen-=lmp_obj_len;
   1141     }
   1142 }
   1143