1146773Ssam/* 2146773Ssam * Redistribution and use in source and binary forms, with or without 3146773Ssam * modification, are permitted provided that: (1) source code 4146773Ssam * distributions retain the above copyright notice and this paragraph 5146773Ssam * in its entirety, and (2) distributions including binary code include 6146773Ssam * the above copyright notice and this paragraph in its entirety in 7146773Ssam * the documentation or other materials provided with the distribution. 8146773Ssam * THIS SOFTWARE IS PROVIDED ``AS IS'' AND 9146773Ssam * WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT 10146773Ssam * LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 11146773Ssam * FOR A PARTICULAR PURPOSE. 12146773Ssam * 13327234Semaste * Original code by Hannes Gredler (hannes@gredler.at) 14327234Semaste * Support for LMP service discovery extensions (defined by OIF UNI 1.0) 15327234Semaste * added by Manu Pathak (mapathak@cisco.com), May 2005 16146773Ssam */ 17146773Ssam 18313537Sglebius/* \summary: Link Management Protocol (LMP) printer */ 19313537Sglebius 20313537Sglebius/* specification: RFC 4204 */ 21327234Semaste/* OIF UNI 1.0: http://www.oiforum.com/public/documents/OIF-UNI-01.0.pdf */ 22313537Sglebius 23146773Ssam#ifdef HAVE_CONFIG_H 24146773Ssam#include "config.h" 25146773Ssam#endif 26146773Ssam 27313537Sglebius#include <netdissect-stdinc.h> 28146773Ssam 29313537Sglebius#include "netdissect.h" 30146773Ssam#include "extract.h" 31146773Ssam#include "addrtoname.h" 32146773Ssam#include "gmpls.h" 33146773Ssam 34356341Scystatic const char tstr[] = " [|LMP]"; 35356341Scy 36146773Ssam/* 37146773Ssam * LMP common header 38146773Ssam * 39146773Ssam * 0 1 2 3 40146773Ssam * 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 41146773Ssam * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 42146773Ssam * | Vers | (Reserved) | Flags | Msg Type | 43146773Ssam * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 44146773Ssam * | LMP Length | (Reserved) | 45146773Ssam * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 46146773Ssam */ 47146773Ssam 48146773Ssamstruct lmp_common_header { 49276788Sdelphij uint8_t version_res[2]; 50276788Sdelphij uint8_t flags; 51276788Sdelphij uint8_t msg_type; 52276788Sdelphij uint8_t length[2]; 53276788Sdelphij uint8_t reserved[2]; 54146773Ssam}; 55146773Ssam 56146773Ssam#define LMP_VERSION 1 57276788Sdelphij#define LMP_EXTRACT_VERSION(x) (((x)&0xf0)>>4) 58146773Ssam 59146773Ssamstatic const struct tok lmp_header_flag_values[] = { 60172683Smlaier { 0x01, "Control Channel Down"}, 61146773Ssam { 0x02, "LMP restart"}, 62146773Ssam { 0, NULL} 63146773Ssam}; 64146773Ssam 65146773Ssamstatic const struct tok lmp_obj_te_link_flag_values[] = { 66146773Ssam { 0x01, "Fault Management Supported"}, 67146773Ssam { 0x02, "Link Verification Supported"}, 68146773Ssam { 0, NULL} 69146773Ssam}; 70146773Ssam 71146773Ssamstatic const struct tok lmp_obj_data_link_flag_values[] = { 72146773Ssam { 0x01, "Data Link Port"}, 73146773Ssam { 0x02, "Allocated for user traffic"}, 74146773Ssam { 0x04, "Failed link"}, 75146773Ssam { 0, NULL} 76146773Ssam}; 77146773Ssam 78146773Ssamstatic const struct tok lmp_obj_channel_status_values[] = { 79146773Ssam { 1, "Signal Okay"}, 80146773Ssam { 2, "Signal Degraded"}, 81146773Ssam { 3, "Signal Fail"}, 82146773Ssam { 0, NULL} 83146773Ssam}; 84146773Ssam 85146773Ssamstatic const struct tok lmp_obj_begin_verify_flag_values[] = { 86146773Ssam { 0x0001, "Verify all links"}, 87146773Ssam { 0x0002, "Data link type"}, 88146773Ssam { 0, NULL} 89146773Ssam}; 90146773Ssam 91146773Ssamstatic const struct tok lmp_obj_begin_verify_error_values[] = { 92190207Srpaulo { 0x01, "Link Verification Procedure Not supported"}, 93190207Srpaulo { 0x02, "Unwilling to verify"}, 94190207Srpaulo { 0x04, "Unsupported verification transport mechanism"}, 95190207Srpaulo { 0x08, "Link-Id configuration error"}, 96190207Srpaulo { 0x10, "Unknown object c-type"}, 97146773Ssam { 0, NULL} 98146773Ssam}; 99146773Ssam 100146773Ssamstatic const struct tok lmp_obj_link_summary_error_values[] = { 101190207Srpaulo { 0x01, "Unacceptable non-negotiable LINK-SUMMARY parameters"}, 102190207Srpaulo { 0x02, "Renegotiate LINK-SUMMARY parameters"}, 103190207Srpaulo { 0x04, "Invalid TE-LINK Object"}, 104190207Srpaulo { 0x08, "Invalid DATA-LINK Object"}, 105190207Srpaulo { 0x10, "Unknown TE-LINK Object c-type"}, 106190207Srpaulo { 0x20, "Unknown DATA-LINK Object c-type"}, 107146773Ssam { 0, NULL} 108146773Ssam}; 109146773Ssam 110147899Ssam/* Service Config Supported Protocols Flags */ 111147899Ssamstatic const struct tok lmp_obj_service_config_sp_flag_values[] = { 112147899Ssam { 0x01, "RSVP Supported"}, 113147899Ssam { 0x02, "LDP Supported"}, 114147899Ssam { 0, NULL} 115147899Ssam}; 116147899Ssam 117147899Ssam/* Service Config Client Port Service Attribute Transparency Flags */ 118147899Ssamstatic const struct tok lmp_obj_service_config_cpsa_tp_flag_values[] = { 119147899Ssam { 0x01, "Path/VC Overhead Transparency Supported"}, 120147899Ssam { 0x02, "Line/MS Overhead Transparency Supported"}, 121147899Ssam { 0x04, "Section/RS Overhead Transparency Supported"}, 122147899Ssam { 0, NULL} 123147899Ssam}; 124147899Ssam 125147899Ssam/* Service Config Client Port Service Attribute Contiguous Concatenation Types Flags */ 126147899Ssamstatic const struct tok lmp_obj_service_config_cpsa_cct_flag_values[] = { 127147899Ssam { 0x01, "Contiguous Concatenation Types Supported"}, 128147899Ssam { 0, NULL} 129147899Ssam}; 130147899Ssam 131147899Ssam/* Service Config Network Service Attributes Transparency Flags */ 132147899Ssamstatic const struct tok lmp_obj_service_config_nsa_transparency_flag_values[] = { 133147899Ssam { 0x01, "Standard SOH/RSOH Transparency Supported"}, 134147899Ssam { 0x02, "Standard LOH/MSOH Transparency Supported"}, 135147899Ssam { 0, NULL} 136147899Ssam}; 137147899Ssam 138147899Ssam/* Service Config Network Service Attributes TCM Monitoring Flags */ 139147899Ssamstatic const struct tok lmp_obj_service_config_nsa_tcm_flag_values[] = { 140147899Ssam { 0x01, "Transparent Tandem Connection Monitoring Supported"}, 141147899Ssam { 0, NULL} 142147899Ssam}; 143147899Ssam 144147899Ssam/* Network Service Attributes Network Diversity Flags */ 145147899Ssamstatic const struct tok lmp_obj_service_config_nsa_network_diversity_flag_values[] = { 146147899Ssam { 0x01, "Node Diversity Supported"}, 147147899Ssam { 0x02, "Link Diversity Supported"}, 148147899Ssam { 0x04, "SRLG Diversity Supported"}, 149147899Ssam { 0, NULL} 150147899Ssam}; 151147899Ssam 152146773Ssam#define LMP_MSGTYPE_CONFIG 1 153146773Ssam#define LMP_MSGTYPE_CONFIG_ACK 2 154146773Ssam#define LMP_MSGTYPE_CONFIG_NACK 3 155146773Ssam#define LMP_MSGTYPE_HELLO 4 156146773Ssam#define LMP_MSGTYPE_VERIFY_BEGIN 5 157146773Ssam#define LMP_MSGTYPE_VERIFY_BEGIN_ACK 6 158146773Ssam#define LMP_MSGTYPE_VERIFY_BEGIN_NACK 7 159146773Ssam#define LMP_MSGTYPE_VERIFY_END 8 160146773Ssam#define LMP_MSGTYPE_VERIFY_END_ACK 9 161146773Ssam#define LMP_MSGTYPE_TEST 10 162146773Ssam#define LMP_MSGTYPE_TEST_STATUS_SUCCESS 11 163146773Ssam#define LMP_MSGTYPE_TEST_STATUS_FAILURE 12 164146773Ssam#define LMP_MSGTYPE_TEST_STATUS_ACK 13 165146773Ssam#define LMP_MSGTYPE_LINK_SUMMARY 14 166146773Ssam#define LMP_MSGTYPE_LINK_SUMMARY_ACK 15 167146773Ssam#define LMP_MSGTYPE_LINK_SUMMARY_NACK 16 168146773Ssam#define LMP_MSGTYPE_CHANNEL_STATUS 17 169146773Ssam#define LMP_MSGTYPE_CHANNEL_STATUS_ACK 18 170146773Ssam#define LMP_MSGTYPE_CHANNEL_STATUS_REQ 19 171146773Ssam#define LMP_MSGTYPE_CHANNEL_STATUS_RESP 20 172147899Ssam/* LMP Service Discovery message types defined by UNI 1.0 */ 173147899Ssam#define LMP_MSGTYPE_SERVICE_CONFIG 50 174147899Ssam#define LMP_MSGTYPE_SERVICE_CONFIG_ACK 51 175147899Ssam#define LMP_MSGTYPE_SERVICE_CONFIG_NACK 52 176146773Ssam 177146773Ssamstatic const struct tok lmp_msg_type_values[] = { 178146773Ssam { LMP_MSGTYPE_CONFIG, "Config"}, 179146773Ssam { LMP_MSGTYPE_CONFIG_ACK, "Config ACK"}, 180146773Ssam { LMP_MSGTYPE_CONFIG_NACK, "Config NACK"}, 181146773Ssam { LMP_MSGTYPE_HELLO, "Hello"}, 182146773Ssam { LMP_MSGTYPE_VERIFY_BEGIN, "Begin Verify"}, 183146773Ssam { LMP_MSGTYPE_VERIFY_BEGIN_ACK, "Begin Verify ACK"}, 184146773Ssam { LMP_MSGTYPE_VERIFY_BEGIN_NACK, "Begin Verify NACK"}, 185146773Ssam { LMP_MSGTYPE_VERIFY_END, "End Verify"}, 186146773Ssam { LMP_MSGTYPE_VERIFY_END_ACK, "End Verify ACK"}, 187146773Ssam { LMP_MSGTYPE_TEST, "Test"}, 188146773Ssam { LMP_MSGTYPE_TEST_STATUS_SUCCESS, "Test Status Success"}, 189146773Ssam { LMP_MSGTYPE_TEST_STATUS_FAILURE, "Test Status Failure"}, 190146773Ssam { LMP_MSGTYPE_TEST_STATUS_ACK, "Test Status ACK"}, 191146773Ssam { LMP_MSGTYPE_LINK_SUMMARY, "Link Summary"}, 192146773Ssam { LMP_MSGTYPE_LINK_SUMMARY_ACK, "Link Summary ACK"}, 193146773Ssam { LMP_MSGTYPE_LINK_SUMMARY_NACK, "Link Summary NACK"}, 194146773Ssam { LMP_MSGTYPE_CHANNEL_STATUS, "Channel Status"}, 195146773Ssam { LMP_MSGTYPE_CHANNEL_STATUS_ACK, "Channel Status ACK"}, 196146773Ssam { LMP_MSGTYPE_CHANNEL_STATUS_REQ, "Channel Status Request"}, 197146773Ssam { LMP_MSGTYPE_CHANNEL_STATUS_RESP, "Channel Status Response"}, 198147899Ssam { LMP_MSGTYPE_SERVICE_CONFIG, "Service Config"}, 199147899Ssam { LMP_MSGTYPE_SERVICE_CONFIG_ACK, "Service Config ACK"}, 200147899Ssam { LMP_MSGTYPE_SERVICE_CONFIG_NACK, "Service Config NACK"}, 201146773Ssam { 0, NULL} 202146773Ssam}; 203146773Ssam 204276788Sdelphij/* 205146773Ssam * LMP object header 206146773Ssam * 207146773Ssam * 0 1 2 3 208146773Ssam * 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 209146773Ssam * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 210146773Ssam * |N| C-Type | Class | Length | 211146773Ssam * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 212146773Ssam * | | 213146773Ssam * // (object contents) // 214146773Ssam * | | 215276788Sdelphij * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 216146773Ssam */ 217146773Ssam 218146773Ssamstruct lmp_object_header { 219276788Sdelphij uint8_t ctype; 220276788Sdelphij uint8_t class_num; 221276788Sdelphij uint8_t length[2]; 222146773Ssam}; 223146773Ssam 224146773Ssam#define LMP_OBJ_CC_ID 1 225146773Ssam#define LMP_OBJ_NODE_ID 2 226146773Ssam#define LMP_OBJ_LINK_ID 3 227146773Ssam#define LMP_OBJ_INTERFACE_ID 4 228276788Sdelphij#define LMP_OBJ_MESSAGE_ID 5 229146773Ssam#define LMP_OBJ_CONFIG 6 230146773Ssam#define LMP_OBJ_HELLO 7 231146773Ssam#define LMP_OBJ_VERIFY_BEGIN 8 232146773Ssam#define LMP_OBJ_VERIFY_BEGIN_ACK 9 233146773Ssam#define LMP_OBJ_VERIFY_ID 10 234146773Ssam#define LMP_OBJ_TE_LINK 11 235146773Ssam#define LMP_OBJ_DATA_LINK 12 236146773Ssam#define LMP_OBJ_CHANNEL_STATUS 13 237146773Ssam#define LMP_OBJ_CHANNEL_STATUS_REQ 14 238146773Ssam#define LMP_OBJ_ERROR_CODE 20 239146773Ssam 240147899Ssam#define LMP_OBJ_SERVICE_CONFIG 51 /* defined in UNI 1.0 */ 241147899Ssam 242146773Ssamstatic const struct tok lmp_obj_values[] = { 243146773Ssam { LMP_OBJ_CC_ID, "Control Channel ID" }, 244146773Ssam { LMP_OBJ_NODE_ID, "Node ID" }, 245146773Ssam { LMP_OBJ_LINK_ID, "Link ID" }, 246146773Ssam { LMP_OBJ_INTERFACE_ID, "Interface ID" }, 247146773Ssam { LMP_OBJ_MESSAGE_ID, "Message ID" }, 248146773Ssam { LMP_OBJ_CONFIG, "Configuration" }, 249146773Ssam { LMP_OBJ_HELLO, "Hello" }, 250146773Ssam { LMP_OBJ_VERIFY_BEGIN, "Verify Begin" }, 251146773Ssam { LMP_OBJ_VERIFY_BEGIN_ACK, "Verify Begin ACK" }, 252146773Ssam { LMP_OBJ_VERIFY_ID, "Verify ID" }, 253146773Ssam { LMP_OBJ_TE_LINK, "TE Link" }, 254146773Ssam { LMP_OBJ_DATA_LINK, "Data Link" }, 255146773Ssam { LMP_OBJ_CHANNEL_STATUS, "Channel Status" }, 256146773Ssam { LMP_OBJ_CHANNEL_STATUS_REQ, "Channel Status Request" }, 257146773Ssam { LMP_OBJ_ERROR_CODE, "Error Code" }, 258147899Ssam { LMP_OBJ_SERVICE_CONFIG, "Service Config" }, 259147899Ssam 260146773Ssam { 0, NULL} 261146773Ssam}; 262146773Ssam 263146773Ssam#define INT_SWITCHING_TYPE_SUBOBJ 1 264146773Ssam#define WAVELENGTH_SUBOBJ 2 265146773Ssam 266146773Ssamstatic const struct tok lmp_data_link_subobj[] = { 267146773Ssam { INT_SWITCHING_TYPE_SUBOBJ, "Interface Switching Type" }, 268146773Ssam { WAVELENGTH_SUBOBJ , "Wavelength" }, 269146773Ssam { 0, NULL} 270146773Ssam}; 271146773Ssam 272146773Ssam#define LMP_CTYPE_IPV4 1 273146773Ssam#define LMP_CTYPE_IPV6 2 274146773Ssam 275146773Ssam#define LMP_CTYPE_LOC 1 276146773Ssam#define LMP_CTYPE_RMT 2 277146773Ssam#define LMP_CTYPE_UNMD 3 278276788Sdelphij 279146773Ssam#define LMP_CTYPE_IPV4_LOC 1 280146773Ssam#define LMP_CTYPE_IPV4_RMT 2 281146773Ssam#define LMP_CTYPE_IPV6_LOC 3 282146773Ssam#define LMP_CTYPE_IPV6_RMT 4 283276788Sdelphij#define LMP_CTYPE_UNMD_LOC 5 284276788Sdelphij#define LMP_CTYPE_UNMD_RMT 6 285146773Ssam 286146773Ssam#define LMP_CTYPE_1 1 287146773Ssam#define LMP_CTYPE_2 2 288146773Ssam 289146773Ssam#define LMP_CTYPE_HELLO_CONFIG 1 290146773Ssam#define LMP_CTYPE_HELLO 1 291146773Ssam 292146773Ssam#define LMP_CTYPE_BEGIN_VERIFY_ERROR 1 293146773Ssam#define LMP_CTYPE_LINK_SUMMARY_ERROR 2 294146773Ssam 295147899Ssam/* C-Types for Service Config Object */ 296147899Ssam#define LMP_CTYPE_SERVICE_CONFIG_SP 1 297147899Ssam#define LMP_CTYPE_SERVICE_CONFIG_CPSA 2 298147899Ssam#define LMP_CTYPE_SERVICE_CONFIG_TRANSPARENCY_TCM 3 299147899Ssam#define LMP_CTYPE_SERVICE_CONFIG_NETWORK_DIVERSITY 4 300147899Ssam 301276788Sdelphij/* 302147899Ssam * Different link types allowed in the Client Port Service Attributes 303147899Ssam * subobject defined for LMP Service Discovery in the UNI 1.0 spec 304147899Ssam */ 305147899Ssam#define LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SDH 5 /* UNI 1.0 Sec 9.4.2 */ 306147899Ssam#define LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SONET 6 /* UNI 1.0 Sec 9.4.2 */ 307147899Ssam 308146773Ssam/* 309146773Ssam * the ctypes are not globally unique so for 310146773Ssam * translating it to strings we build a table based 311146773Ssam * on objects offsetted by the ctype 312146773Ssam */ 313146773Ssam 314146773Ssamstatic const struct tok lmp_ctype_values[] = { 315146773Ssam { 256*LMP_OBJ_CC_ID+LMP_CTYPE_LOC, "Local" }, 316146773Ssam { 256*LMP_OBJ_CC_ID+LMP_CTYPE_RMT, "Remote" }, 317146773Ssam { 256*LMP_OBJ_NODE_ID+LMP_CTYPE_LOC, "Local" }, 318146773Ssam { 256*LMP_OBJ_NODE_ID+LMP_CTYPE_RMT, "Remote" }, 319146773Ssam { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_IPV4_LOC, "IPv4 Local" }, 320146773Ssam { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_IPV4_RMT, "IPv4 Remote" }, 321146773Ssam { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_IPV6_LOC, "IPv6 Local" }, 322146773Ssam { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_IPV6_RMT, "IPv6 Remote" }, 323146773Ssam { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_UNMD_LOC, "Unnumbered Local" }, 324146773Ssam { 256*LMP_OBJ_LINK_ID+LMP_CTYPE_UNMD_RMT, "Unnumbered Remote" }, 325146773Ssam { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_IPV4_LOC, "IPv4 Local" }, 326146773Ssam { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_IPV4_RMT, "IPv4 Remote" }, 327146773Ssam { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_IPV6_LOC, "IPv6 Local" }, 328146773Ssam { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_IPV6_RMT, "IPv6 Remote" }, 329146773Ssam { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_UNMD_LOC, "Unnumbered Local" }, 330146773Ssam { 256*LMP_OBJ_INTERFACE_ID+LMP_CTYPE_UNMD_RMT, "Unnumbered Remote" }, 331146773Ssam { 256*LMP_OBJ_MESSAGE_ID+LMP_CTYPE_1, "1" }, 332146773Ssam { 256*LMP_OBJ_MESSAGE_ID+LMP_CTYPE_2, "2" }, 333146773Ssam { 256*LMP_OBJ_CONFIG+LMP_CTYPE_1, "1" }, 334146773Ssam { 256*LMP_OBJ_HELLO+LMP_CTYPE_1, "1" }, 335146773Ssam { 256*LMP_OBJ_VERIFY_BEGIN+LMP_CTYPE_1, "1" }, 336146773Ssam { 256*LMP_OBJ_VERIFY_BEGIN_ACK+LMP_CTYPE_1, "1" }, 337146773Ssam { 256*LMP_OBJ_VERIFY_ID+LMP_CTYPE_1, "1" }, 338146773Ssam { 256*LMP_OBJ_TE_LINK+LMP_CTYPE_IPV4, "IPv4" }, 339146773Ssam { 256*LMP_OBJ_TE_LINK+LMP_CTYPE_IPV6, "IPv6" }, 340146773Ssam { 256*LMP_OBJ_TE_LINK+LMP_CTYPE_UNMD, "Unnumbered" }, 341146773Ssam { 256*LMP_OBJ_DATA_LINK+LMP_CTYPE_IPV4, "IPv4" }, 342146773Ssam { 256*LMP_OBJ_DATA_LINK+LMP_CTYPE_IPV6, "IPv6" }, 343146773Ssam { 256*LMP_OBJ_DATA_LINK+LMP_CTYPE_UNMD, "Unnumbered" }, 344146773Ssam { 256*LMP_OBJ_CHANNEL_STATUS+LMP_CTYPE_IPV4, "IPv4" }, 345146773Ssam { 256*LMP_OBJ_CHANNEL_STATUS+LMP_CTYPE_IPV6, "IPv6" }, 346146773Ssam { 256*LMP_OBJ_CHANNEL_STATUS+LMP_CTYPE_UNMD, "Unnumbered" }, 347146773Ssam { 256*LMP_OBJ_CHANNEL_STATUS_REQ+LMP_CTYPE_IPV4, "IPv4" }, 348146773Ssam { 256*LMP_OBJ_CHANNEL_STATUS_REQ+LMP_CTYPE_IPV6, "IPv6" }, 349146773Ssam { 256*LMP_OBJ_CHANNEL_STATUS_REQ+LMP_CTYPE_UNMD, "Unnumbered" }, 350146773Ssam { 256*LMP_OBJ_ERROR_CODE+LMP_CTYPE_1, "1" }, 351146773Ssam { 256*LMP_OBJ_ERROR_CODE+LMP_CTYPE_2, "2" }, 352147899Ssam { 256*LMP_OBJ_SERVICE_CONFIG+LMP_CTYPE_SERVICE_CONFIG_SP, "1" }, 353147899Ssam { 256*LMP_OBJ_SERVICE_CONFIG+LMP_CTYPE_SERVICE_CONFIG_CPSA, "2" }, 354147899Ssam { 256*LMP_OBJ_SERVICE_CONFIG+LMP_CTYPE_SERVICE_CONFIG_TRANSPARENCY_TCM, "3" }, 355147899Ssam { 256*LMP_OBJ_SERVICE_CONFIG+LMP_CTYPE_SERVICE_CONFIG_NETWORK_DIVERSITY, "4" }, 356146773Ssam { 0, NULL} 357146773Ssam}; 358146773Ssam 359327234Semastestatic int 360327234Semastelmp_print_data_link_subobjs(netdissect_options *ndo, const u_char *obj_tptr, 361327234Semaste int total_subobj_len, int offset) 362327234Semaste{ 363327234Semaste int hexdump = FALSE; 364327234Semaste int subobj_type, subobj_len; 365327234Semaste 366327234Semaste union { /* int to float conversion buffer */ 367327234Semaste float f; 368327234Semaste uint32_t i; 369327234Semaste } bw; 370327234Semaste 371327234Semaste while (total_subobj_len > 0 && hexdump == FALSE ) { 372356341Scy ND_TCHECK_16BITS(obj_tptr + offset); 373356341Scy subobj_type = EXTRACT_8BITS(obj_tptr + offset); 374356341Scy subobj_len = EXTRACT_8BITS(obj_tptr + offset + 1); 375327234Semaste ND_PRINT((ndo, "\n\t Subobject, Type: %s (%u), Length: %u", 376327234Semaste tok2str(lmp_data_link_subobj, 377327234Semaste "Unknown", 378327234Semaste subobj_type), 379327234Semaste subobj_type, 380327234Semaste subobj_len)); 381327234Semaste if (subobj_len < 4) { 382327234Semaste ND_PRINT((ndo, " (too short)")); 383327234Semaste break; 384327234Semaste } 385327234Semaste if ((subobj_len % 4) != 0) { 386327234Semaste ND_PRINT((ndo, " (not a multiple of 4)")); 387327234Semaste break; 388327234Semaste } 389327234Semaste if (total_subobj_len < subobj_len) { 390327234Semaste ND_PRINT((ndo, " (goes past the end of the object)")); 391327234Semaste break; 392327234Semaste } 393327234Semaste switch(subobj_type) { 394327234Semaste case INT_SWITCHING_TYPE_SUBOBJ: 395356341Scy ND_TCHECK_8BITS(obj_tptr + offset + 2); 396327234Semaste ND_PRINT((ndo, "\n\t Switching Type: %s (%u)", 397327234Semaste tok2str(gmpls_switch_cap_values, 398327234Semaste "Unknown", 399356341Scy EXTRACT_8BITS(obj_tptr + offset + 2)), 400356341Scy EXTRACT_8BITS(obj_tptr + offset + 2))); 401356341Scy ND_TCHECK_8BITS(obj_tptr + offset + 3); 402327234Semaste ND_PRINT((ndo, "\n\t Encoding Type: %s (%u)", 403327234Semaste tok2str(gmpls_encoding_values, 404327234Semaste "Unknown", 405356341Scy EXTRACT_8BITS(obj_tptr + offset + 3)), 406356341Scy EXTRACT_8BITS(obj_tptr + offset + 3))); 407356341Scy ND_TCHECK_32BITS(obj_tptr + offset + 4); 408327234Semaste bw.i = EXTRACT_32BITS(obj_tptr+offset+4); 409327234Semaste ND_PRINT((ndo, "\n\t Min Reservable Bandwidth: %.3f Mbps", 410327234Semaste bw.f*8/1000000)); 411356341Scy ND_TCHECK_32BITS(obj_tptr + offset + 8); 412327234Semaste bw.i = EXTRACT_32BITS(obj_tptr+offset+8); 413327234Semaste ND_PRINT((ndo, "\n\t Max Reservable Bandwidth: %.3f Mbps", 414327234Semaste bw.f*8/1000000)); 415327234Semaste break; 416327234Semaste case WAVELENGTH_SUBOBJ: 417356341Scy ND_TCHECK_32BITS(obj_tptr + offset + 4); 418327234Semaste ND_PRINT((ndo, "\n\t Wavelength: %u", 419327234Semaste EXTRACT_32BITS(obj_tptr+offset+4))); 420327234Semaste break; 421327234Semaste default: 422327234Semaste /* Any Unknown Subobject ==> Exit loop */ 423327234Semaste hexdump=TRUE; 424327234Semaste break; 425327234Semaste } 426327234Semaste total_subobj_len-=subobj_len; 427327234Semaste offset+=subobj_len; 428327234Semaste } 429327234Semaste return (hexdump); 430356341Scytrunc: 431356341Scy return -1; 432327234Semaste} 433327234Semaste 434146773Ssamvoid 435276788Sdelphijlmp_print(netdissect_options *ndo, 436285275Spkelsey register const u_char *pptr, register u_int len) 437285275Spkelsey{ 438146773Ssam const struct lmp_common_header *lmp_com_header; 439146773Ssam const struct lmp_object_header *lmp_obj_header; 440146773Ssam const u_char *tptr,*obj_tptr; 441327234Semaste u_int tlen,lmp_obj_len,lmp_obj_ctype,obj_tlen; 442356341Scy int hexdump, ret; 443327234Semaste u_int offset; 444327234Semaste u_int link_type; 445146773Ssam 446146773Ssam union { /* int to float conversion buffer */ 447276788Sdelphij float f; 448276788Sdelphij uint32_t i; 449146773Ssam } bw; 450146773Ssam 451146773Ssam tptr=pptr; 452146773Ssam lmp_com_header = (const struct lmp_common_header *)pptr; 453276788Sdelphij ND_TCHECK(*lmp_com_header); 454146773Ssam 455146773Ssam /* 456146773Ssam * Sanity checking of the header. 457146773Ssam */ 458146773Ssam if (LMP_EXTRACT_VERSION(lmp_com_header->version_res[0]) != LMP_VERSION) { 459276788Sdelphij ND_PRINT((ndo, "LMP version %u packet not supported", 460276788Sdelphij LMP_EXTRACT_VERSION(lmp_com_header->version_res[0]))); 461146773Ssam return; 462146773Ssam } 463146773Ssam 464146773Ssam /* in non-verbose mode just lets print the basic Message Type*/ 465276788Sdelphij if (ndo->ndo_vflag < 1) { 466276788Sdelphij ND_PRINT((ndo, "LMPv%u %s Message, length: %u", 467146773Ssam LMP_EXTRACT_VERSION(lmp_com_header->version_res[0]), 468146773Ssam tok2str(lmp_msg_type_values, "unknown (%u)",lmp_com_header->msg_type), 469276788Sdelphij len)); 470146773Ssam return; 471146773Ssam } 472146773Ssam 473146773Ssam /* ok they seem to want to know everything - lets fully decode it */ 474146773Ssam 475146773Ssam tlen=EXTRACT_16BITS(lmp_com_header->length); 476146773Ssam 477276788Sdelphij ND_PRINT((ndo, "\n\tLMPv%u, msg-type: %s, Flags: [%s], length: %u", 478146773Ssam LMP_EXTRACT_VERSION(lmp_com_header->version_res[0]), 479146773Ssam tok2str(lmp_msg_type_values, "unknown, type: %u",lmp_com_header->msg_type), 480146773Ssam bittok2str(lmp_header_flag_values,"none",lmp_com_header->flags), 481276788Sdelphij tlen)); 482327234Semaste if (tlen < sizeof(const struct lmp_common_header)) { 483327234Semaste ND_PRINT((ndo, " (too short)")); 484327234Semaste return; 485327234Semaste } 486327234Semaste if (tlen > len) { 487327234Semaste ND_PRINT((ndo, " (too long)")); 488327234Semaste tlen = len; 489327234Semaste } 490146773Ssam 491146773Ssam tptr+=sizeof(const struct lmp_common_header); 492146773Ssam tlen-=sizeof(const struct lmp_common_header); 493146773Ssam 494146773Ssam while(tlen>0) { 495146773Ssam /* did we capture enough for fully decoding the object header ? */ 496276788Sdelphij ND_TCHECK2(*tptr, sizeof(struct lmp_object_header)); 497146773Ssam 498146773Ssam lmp_obj_header = (const struct lmp_object_header *)tptr; 499146773Ssam lmp_obj_len=EXTRACT_16BITS(lmp_obj_header->length); 500146773Ssam lmp_obj_ctype=(lmp_obj_header->ctype)&0x7f; 501146773Ssam 502276788Sdelphij ND_PRINT((ndo, "\n\t %s Object (%u), Class-Type: %s (%u) Flags: [%snegotiable], length: %u", 503146773Ssam tok2str(lmp_obj_values, 504146773Ssam "Unknown", 505146773Ssam lmp_obj_header->class_num), 506146773Ssam lmp_obj_header->class_num, 507146773Ssam tok2str(lmp_ctype_values, 508146773Ssam "Unknown", 509146773Ssam ((lmp_obj_header->class_num)<<8)+lmp_obj_ctype), 510146773Ssam lmp_obj_ctype, 511146773Ssam (lmp_obj_header->ctype)&0x80 ? "" : "non-", 512276788Sdelphij lmp_obj_len)); 513146773Ssam 514327234Semaste if (lmp_obj_len < 4) { 515327234Semaste ND_PRINT((ndo, " (too short)")); 516327234Semaste return; 517327234Semaste } 518327234Semaste if ((lmp_obj_len % 4) != 0) { 519327234Semaste ND_PRINT((ndo, " (not a multiple of 4)")); 520327234Semaste return; 521327234Semaste } 522327234Semaste 523146773Ssam obj_tptr=tptr+sizeof(struct lmp_object_header); 524146773Ssam obj_tlen=lmp_obj_len-sizeof(struct lmp_object_header); 525146773Ssam 526146773Ssam /* did we capture enough for fully decoding the object ? */ 527276788Sdelphij ND_TCHECK2(*tptr, lmp_obj_len); 528146773Ssam hexdump=FALSE; 529146773Ssam 530146773Ssam switch(lmp_obj_header->class_num) { 531146773Ssam 532146773Ssam case LMP_OBJ_CC_ID: 533146773Ssam switch(lmp_obj_ctype) { 534146773Ssam case LMP_CTYPE_LOC: 535146773Ssam case LMP_CTYPE_RMT: 536327234Semaste if (obj_tlen != 4) { 537327234Semaste ND_PRINT((ndo, " (not correct for object)")); 538327234Semaste break; 539327234Semaste } 540276788Sdelphij ND_PRINT((ndo, "\n\t Control Channel ID: %u (0x%08x)", 541146773Ssam EXTRACT_32BITS(obj_tptr), 542276788Sdelphij EXTRACT_32BITS(obj_tptr))); 543146773Ssam break; 544146773Ssam 545146773Ssam default: 546146773Ssam hexdump=TRUE; 547146773Ssam } 548146773Ssam break; 549146773Ssam 550146773Ssam case LMP_OBJ_LINK_ID: 551146773Ssam case LMP_OBJ_INTERFACE_ID: 552146773Ssam switch(lmp_obj_ctype) { 553146773Ssam case LMP_CTYPE_IPV4_LOC: 554146773Ssam case LMP_CTYPE_IPV4_RMT: 555327234Semaste if (obj_tlen != 4) { 556327234Semaste ND_PRINT((ndo, " (not correct for object)")); 557327234Semaste break; 558327234Semaste } 559276788Sdelphij ND_PRINT((ndo, "\n\t IPv4 Link ID: %s (0x%08x)", 560276788Sdelphij ipaddr_string(ndo, obj_tptr), 561276788Sdelphij EXTRACT_32BITS(obj_tptr))); 562146773Ssam break; 563146773Ssam case LMP_CTYPE_IPV6_LOC: 564146773Ssam case LMP_CTYPE_IPV6_RMT: 565327234Semaste if (obj_tlen != 16) { 566327234Semaste ND_PRINT((ndo, " (not correct for object)")); 567327234Semaste break; 568327234Semaste } 569276788Sdelphij ND_PRINT((ndo, "\n\t IPv6 Link ID: %s (0x%08x)", 570276788Sdelphij ip6addr_string(ndo, obj_tptr), 571276788Sdelphij EXTRACT_32BITS(obj_tptr))); 572146773Ssam break; 573146773Ssam case LMP_CTYPE_UNMD_LOC: 574146773Ssam case LMP_CTYPE_UNMD_RMT: 575327234Semaste if (obj_tlen != 4) { 576327234Semaste ND_PRINT((ndo, " (not correct for object)")); 577327234Semaste break; 578327234Semaste } 579276788Sdelphij ND_PRINT((ndo, "\n\t Link ID: %u (0x%08x)", 580146773Ssam EXTRACT_32BITS(obj_tptr), 581276788Sdelphij EXTRACT_32BITS(obj_tptr))); 582146773Ssam break; 583146773Ssam default: 584146773Ssam hexdump=TRUE; 585146773Ssam } 586146773Ssam break; 587146773Ssam 588146773Ssam case LMP_OBJ_MESSAGE_ID: 589146773Ssam switch(lmp_obj_ctype) { 590146773Ssam case LMP_CTYPE_1: 591327234Semaste if (obj_tlen != 4) { 592327234Semaste ND_PRINT((ndo, " (not correct for object)")); 593327234Semaste break; 594327234Semaste } 595276788Sdelphij ND_PRINT((ndo, "\n\t Message ID: %u (0x%08x)", 596146773Ssam EXTRACT_32BITS(obj_tptr), 597276788Sdelphij EXTRACT_32BITS(obj_tptr))); 598146773Ssam break; 599146773Ssam case LMP_CTYPE_2: 600327234Semaste if (obj_tlen != 4) { 601327234Semaste ND_PRINT((ndo, " (not correct for object)")); 602327234Semaste break; 603327234Semaste } 604276788Sdelphij ND_PRINT((ndo, "\n\t Message ID Ack: %u (0x%08x)", 605146773Ssam EXTRACT_32BITS(obj_tptr), 606276788Sdelphij EXTRACT_32BITS(obj_tptr))); 607146773Ssam break; 608146773Ssam default: 609146773Ssam hexdump=TRUE; 610146773Ssam } 611146773Ssam break; 612146773Ssam 613146773Ssam case LMP_OBJ_NODE_ID: 614146773Ssam switch(lmp_obj_ctype) { 615146773Ssam case LMP_CTYPE_LOC: 616146773Ssam case LMP_CTYPE_RMT: 617327234Semaste if (obj_tlen != 4) { 618327234Semaste ND_PRINT((ndo, " (not correct for object)")); 619327234Semaste break; 620327234Semaste } 621276788Sdelphij ND_PRINT((ndo, "\n\t Node ID: %s (0x%08x)", 622276788Sdelphij ipaddr_string(ndo, obj_tptr), 623276788Sdelphij EXTRACT_32BITS(obj_tptr))); 624146773Ssam break; 625146773Ssam 626146773Ssam default: 627146773Ssam hexdump=TRUE; 628146773Ssam } 629146773Ssam break; 630146773Ssam 631146773Ssam case LMP_OBJ_CONFIG: 632146773Ssam switch(lmp_obj_ctype) { 633146773Ssam case LMP_CTYPE_HELLO_CONFIG: 634327234Semaste if (obj_tlen != 4) { 635327234Semaste ND_PRINT((ndo, " (not correct for object)")); 636327234Semaste break; 637327234Semaste } 638276788Sdelphij ND_PRINT((ndo, "\n\t Hello Interval: %u\n\t Hello Dead Interval: %u", 639146773Ssam EXTRACT_16BITS(obj_tptr), 640276788Sdelphij EXTRACT_16BITS(obj_tptr+2))); 641146773Ssam break; 642146773Ssam 643146773Ssam default: 644146773Ssam hexdump=TRUE; 645146773Ssam } 646146773Ssam break; 647276788Sdelphij 648146773Ssam case LMP_OBJ_HELLO: 649146773Ssam switch(lmp_obj_ctype) { 650146773Ssam case LMP_CTYPE_HELLO: 651327234Semaste if (obj_tlen != 8) { 652327234Semaste ND_PRINT((ndo, " (not correct for object)")); 653327234Semaste break; 654327234Semaste } 655276788Sdelphij ND_PRINT((ndo, "\n\t Tx Seq: %u, Rx Seq: %u", 656146773Ssam EXTRACT_32BITS(obj_tptr), 657276788Sdelphij EXTRACT_32BITS(obj_tptr+4))); 658146773Ssam break; 659146773Ssam 660146773Ssam default: 661146773Ssam hexdump=TRUE; 662146773Ssam } 663276788Sdelphij break; 664276788Sdelphij 665146773Ssam case LMP_OBJ_TE_LINK: 666327234Semaste switch(lmp_obj_ctype) { 667327234Semaste case LMP_CTYPE_IPV4: 668327234Semaste if (obj_tlen != 12) { 669327234Semaste ND_PRINT((ndo, " (not correct for object)")); 670327234Semaste break; 671327234Semaste } 672276788Sdelphij ND_PRINT((ndo, "\n\t Flags: [%s]", 673327234Semaste bittok2str(lmp_obj_te_link_flag_values, 674146773Ssam "none", 675327234Semaste EXTRACT_8BITS(obj_tptr)))); 676276788Sdelphij 677276788Sdelphij ND_PRINT((ndo, "\n\t Local Link-ID: %s (0x%08x)" 678276788Sdelphij "\n\t Remote Link-ID: %s (0x%08x)", 679276788Sdelphij ipaddr_string(ndo, obj_tptr+4), 680146773Ssam EXTRACT_32BITS(obj_tptr+4), 681276788Sdelphij ipaddr_string(ndo, obj_tptr+8), 682276788Sdelphij EXTRACT_32BITS(obj_tptr+8))); 683146773Ssam break; 684276788Sdelphij 685146773Ssam case LMP_CTYPE_IPV6: 686327234Semaste if (obj_tlen != 36) { 687327234Semaste ND_PRINT((ndo, " (not correct for object)")); 688327234Semaste break; 689327234Semaste } 690327234Semaste ND_PRINT((ndo, "\n\t Flags: [%s]", 691327234Semaste bittok2str(lmp_obj_te_link_flag_values, 692327234Semaste "none", 693327234Semaste EXTRACT_8BITS(obj_tptr)))); 694327234Semaste 695327234Semaste ND_PRINT((ndo, "\n\t Local Link-ID: %s (0x%08x)" 696327234Semaste "\n\t Remote Link-ID: %s (0x%08x)", 697327234Semaste ip6addr_string(ndo, obj_tptr+4), 698327234Semaste EXTRACT_32BITS(obj_tptr+4), 699327234Semaste ip6addr_string(ndo, obj_tptr+20), 700327234Semaste EXTRACT_32BITS(obj_tptr+20))); 701327234Semaste break; 702327234Semaste 703146773Ssam case LMP_CTYPE_UNMD: 704327234Semaste if (obj_tlen != 12) { 705327234Semaste ND_PRINT((ndo, " (not correct for object)")); 706327234Semaste break; 707327234Semaste } 708327234Semaste ND_PRINT((ndo, "\n\t Flags: [%s]", 709327234Semaste bittok2str(lmp_obj_te_link_flag_values, 710327234Semaste "none", 711327234Semaste EXTRACT_8BITS(obj_tptr)))); 712327234Semaste 713327234Semaste ND_PRINT((ndo, "\n\t Local Link-ID: %u (0x%08x)" 714327234Semaste "\n\t Remote Link-ID: %u (0x%08x)", 715327234Semaste EXTRACT_32BITS(obj_tptr+4), 716327234Semaste EXTRACT_32BITS(obj_tptr+4), 717327234Semaste EXTRACT_32BITS(obj_tptr+8), 718327234Semaste EXTRACT_32BITS(obj_tptr+8))); 719327234Semaste break; 720327234Semaste 721146773Ssam default: 722146773Ssam hexdump=TRUE; 723146773Ssam } 724146773Ssam break; 725276788Sdelphij 726146773Ssam case LMP_OBJ_DATA_LINK: 727146773Ssam switch(lmp_obj_ctype) { 728146773Ssam case LMP_CTYPE_IPV4: 729327234Semaste if (obj_tlen < 12) { 730327234Semaste ND_PRINT((ndo, " (not correct for object)")); 731327234Semaste break; 732327234Semaste } 733327234Semaste ND_PRINT((ndo, "\n\t Flags: [%s]", 734327234Semaste bittok2str(lmp_obj_data_link_flag_values, 735327234Semaste "none", 736327234Semaste EXTRACT_8BITS(obj_tptr)))); 737276788Sdelphij ND_PRINT((ndo, "\n\t Local Interface ID: %s (0x%08x)" 738276788Sdelphij "\n\t Remote Interface ID: %s (0x%08x)", 739276788Sdelphij ipaddr_string(ndo, obj_tptr+4), 740146773Ssam EXTRACT_32BITS(obj_tptr+4), 741276788Sdelphij ipaddr_string(ndo, obj_tptr+8), 742276788Sdelphij EXTRACT_32BITS(obj_tptr+8))); 743276788Sdelphij 744356341Scy ret = lmp_print_data_link_subobjs(ndo, obj_tptr, obj_tlen - 12, 12); 745356341Scy if (ret == -1) 746356341Scy goto trunc; 747356341Scy if (ret == TRUE) 748327234Semaste hexdump=TRUE; 749327234Semaste break; 750276788Sdelphij 751327234Semaste case LMP_CTYPE_IPV6: 752327234Semaste if (obj_tlen < 36) { 753327234Semaste ND_PRINT((ndo, " (not correct for object)")); 754327234Semaste break; 755327234Semaste } 756327234Semaste ND_PRINT((ndo, "\n\t Flags: [%s]", 757327234Semaste bittok2str(lmp_obj_data_link_flag_values, 758327234Semaste "none", 759327234Semaste EXTRACT_8BITS(obj_tptr)))); 760327234Semaste ND_PRINT((ndo, "\n\t Local Interface ID: %s (0x%08x)" 761327234Semaste "\n\t Remote Interface ID: %s (0x%08x)", 762327234Semaste ip6addr_string(ndo, obj_tptr+4), 763327234Semaste EXTRACT_32BITS(obj_tptr+4), 764327234Semaste ip6addr_string(ndo, obj_tptr+20), 765327234Semaste EXTRACT_32BITS(obj_tptr+20))); 766327234Semaste 767356341Scy ret = lmp_print_data_link_subobjs(ndo, obj_tptr, obj_tlen - 36, 36); 768356341Scy if (ret == -1) 769356341Scy goto trunc; 770356341Scy if (ret == TRUE) 771327234Semaste hexdump=TRUE; 772146773Ssam break; 773327234Semaste 774327234Semaste case LMP_CTYPE_UNMD: 775327234Semaste if (obj_tlen < 12) { 776327234Semaste ND_PRINT((ndo, " (not correct for object)")); 777327234Semaste break; 778327234Semaste } 779327234Semaste ND_PRINT((ndo, "\n\t Flags: [%s]", 780327234Semaste bittok2str(lmp_obj_data_link_flag_values, 781327234Semaste "none", 782327234Semaste EXTRACT_8BITS(obj_tptr)))); 783327234Semaste ND_PRINT((ndo, "\n\t Local Interface ID: %u (0x%08x)" 784327234Semaste "\n\t Remote Interface ID: %u (0x%08x)", 785327234Semaste EXTRACT_32BITS(obj_tptr+4), 786327234Semaste EXTRACT_32BITS(obj_tptr+4), 787327234Semaste EXTRACT_32BITS(obj_tptr+8), 788327234Semaste EXTRACT_32BITS(obj_tptr+8))); 789327234Semaste 790356341Scy ret = lmp_print_data_link_subobjs(ndo, obj_tptr, obj_tlen - 12, 12); 791356341Scy if (ret == -1) 792356341Scy goto trunc; 793356341Scy if (ret == TRUE) 794327234Semaste hexdump=TRUE; 795327234Semaste break; 796327234Semaste 797146773Ssam default: 798146773Ssam hexdump=TRUE; 799146773Ssam } 800276788Sdelphij break; 801276788Sdelphij 802146773Ssam case LMP_OBJ_VERIFY_BEGIN: 803146773Ssam switch(lmp_obj_ctype) { 804146773Ssam case LMP_CTYPE_1: 805327234Semaste if (obj_tlen != 20) { 806327234Semaste ND_PRINT((ndo, " (not correct for object)")); 807327234Semaste break; 808327234Semaste } 809276788Sdelphij ND_PRINT((ndo, "\n\t Flags: %s", 810146773Ssam bittok2str(lmp_obj_begin_verify_flag_values, 811146773Ssam "none", 812276788Sdelphij EXTRACT_16BITS(obj_tptr)))); 813276788Sdelphij ND_PRINT((ndo, "\n\t Verify Interval: %u", 814276788Sdelphij EXTRACT_16BITS(obj_tptr+2))); 815276788Sdelphij ND_PRINT((ndo, "\n\t Data links: %u", 816276788Sdelphij EXTRACT_32BITS(obj_tptr+4))); 817276788Sdelphij ND_PRINT((ndo, "\n\t Encoding type: %s", 818276788Sdelphij tok2str(gmpls_encoding_values, "Unknown", *(obj_tptr+8)))); 819276788Sdelphij ND_PRINT((ndo, "\n\t Verify Transport Mechanism: %u (0x%x)%s", 820146773Ssam EXTRACT_16BITS(obj_tptr+10), 821146773Ssam EXTRACT_16BITS(obj_tptr+10), 822276788Sdelphij EXTRACT_16BITS(obj_tptr+10)&8000 ? " (Payload test messages capable)" : "")); 823146773Ssam bw.i = EXTRACT_32BITS(obj_tptr+12); 824276788Sdelphij ND_PRINT((ndo, "\n\t Transmission Rate: %.3f Mbps",bw.f*8/1000000)); 825276788Sdelphij ND_PRINT((ndo, "\n\t Wavelength: %u", 826276788Sdelphij EXTRACT_32BITS(obj_tptr+16))); 827146773Ssam break; 828276788Sdelphij 829146773Ssam default: 830146773Ssam hexdump=TRUE; 831146773Ssam } 832276788Sdelphij break; 833276788Sdelphij 834146773Ssam case LMP_OBJ_VERIFY_BEGIN_ACK: 835146773Ssam switch(lmp_obj_ctype) { 836146773Ssam case LMP_CTYPE_1: 837327234Semaste if (obj_tlen != 4) { 838327234Semaste ND_PRINT((ndo, " (not correct for object)")); 839327234Semaste break; 840327234Semaste } 841276788Sdelphij ND_PRINT((ndo, "\n\t Verify Dead Interval: %u" 842276788Sdelphij "\n\t Verify Transport Response: %u", 843146773Ssam EXTRACT_16BITS(obj_tptr), 844276788Sdelphij EXTRACT_16BITS(obj_tptr+2))); 845146773Ssam break; 846276788Sdelphij 847146773Ssam default: 848146773Ssam hexdump=TRUE; 849146773Ssam } 850276788Sdelphij break; 851276788Sdelphij 852146773Ssam case LMP_OBJ_VERIFY_ID: 853146773Ssam switch(lmp_obj_ctype) { 854146773Ssam case LMP_CTYPE_1: 855327234Semaste if (obj_tlen != 4) { 856327234Semaste ND_PRINT((ndo, " (not correct for object)")); 857327234Semaste break; 858327234Semaste } 859276788Sdelphij ND_PRINT((ndo, "\n\t Verify ID: %u", 860276788Sdelphij EXTRACT_32BITS(obj_tptr))); 861146773Ssam break; 862276788Sdelphij 863146773Ssam default: 864146773Ssam hexdump=TRUE; 865146773Ssam } 866276788Sdelphij break; 867276788Sdelphij 868146773Ssam case LMP_OBJ_CHANNEL_STATUS: 869146773Ssam switch(lmp_obj_ctype) { 870146773Ssam case LMP_CTYPE_IPV4: 871146773Ssam offset = 0; 872146773Ssam /* Decode pairs: <Interface_ID (4 bytes), Channel_status (4 bytes)> */ 873327234Semaste while (offset+8 <= obj_tlen) { 874276788Sdelphij ND_PRINT((ndo, "\n\t Interface ID: %s (0x%08x)", 875276788Sdelphij ipaddr_string(ndo, obj_tptr+offset), 876276788Sdelphij EXTRACT_32BITS(obj_tptr+offset))); 877276788Sdelphij 878327234Semaste ND_PRINT((ndo, "\n\t\t Active: %s (%u)", 879327234Semaste (EXTRACT_32BITS(obj_tptr+offset+4)>>31) ? 880146773Ssam "Allocated" : "Non-allocated", 881276788Sdelphij (EXTRACT_32BITS(obj_tptr+offset+4)>>31))); 882276788Sdelphij 883327234Semaste ND_PRINT((ndo, "\n\t\t Direction: %s (%u)", 884327234Semaste (EXTRACT_32BITS(obj_tptr+offset+4)>>30)&0x1 ? 885146773Ssam "Transmit" : "Receive", 886276788Sdelphij (EXTRACT_32BITS(obj_tptr+offset+4)>>30)&0x1)); 887276788Sdelphij 888276788Sdelphij ND_PRINT((ndo, "\n\t\t Channel Status: %s (%u)", 889146773Ssam tok2str(lmp_obj_channel_status_values, 890146773Ssam "Unknown", 891146773Ssam EXTRACT_32BITS(obj_tptr+offset+4)&0x3FFFFFF), 892276788Sdelphij EXTRACT_32BITS(obj_tptr+offset+4)&0x3FFFFFF)); 893146773Ssam offset+=8; 894146773Ssam } 895146773Ssam break; 896327234Semaste 897146773Ssam case LMP_CTYPE_IPV6: 898327234Semaste offset = 0; 899327234Semaste /* Decode pairs: <Interface_ID (16 bytes), Channel_status (4 bytes)> */ 900327234Semaste while (offset+20 <= obj_tlen) { 901327234Semaste ND_PRINT((ndo, "\n\t Interface ID: %s (0x%08x)", 902327234Semaste ip6addr_string(ndo, obj_tptr+offset), 903327234Semaste EXTRACT_32BITS(obj_tptr+offset))); 904327234Semaste 905327234Semaste ND_PRINT((ndo, "\n\t\t Active: %s (%u)", 906327234Semaste (EXTRACT_32BITS(obj_tptr+offset+16)>>31) ? 907327234Semaste "Allocated" : "Non-allocated", 908327234Semaste (EXTRACT_32BITS(obj_tptr+offset+16)>>31))); 909327234Semaste 910327234Semaste ND_PRINT((ndo, "\n\t\t Direction: %s (%u)", 911327234Semaste (EXTRACT_32BITS(obj_tptr+offset+16)>>30)&0x1 ? 912327234Semaste "Transmit" : "Receive", 913327234Semaste (EXTRACT_32BITS(obj_tptr+offset+16)>>30)&0x1)); 914327234Semaste 915327234Semaste ND_PRINT((ndo, "\n\t\t Channel Status: %s (%u)", 916327234Semaste tok2str(lmp_obj_channel_status_values, 917327234Semaste "Unknown", 918327234Semaste EXTRACT_32BITS(obj_tptr+offset+16)&0x3FFFFFF), 919327234Semaste EXTRACT_32BITS(obj_tptr+offset+16)&0x3FFFFFF)); 920327234Semaste offset+=20; 921327234Semaste } 922327234Semaste break; 923327234Semaste 924327234Semaste case LMP_CTYPE_UNMD: 925327234Semaste offset = 0; 926327234Semaste /* Decode pairs: <Interface_ID (4 bytes), Channel_status (4 bytes)> */ 927327234Semaste while (offset+8 <= obj_tlen) { 928327234Semaste ND_PRINT((ndo, "\n\t Interface ID: %u (0x%08x)", 929327234Semaste EXTRACT_32BITS(obj_tptr+offset), 930327234Semaste EXTRACT_32BITS(obj_tptr+offset))); 931327234Semaste 932327234Semaste ND_PRINT((ndo, "\n\t\t Active: %s (%u)", 933327234Semaste (EXTRACT_32BITS(obj_tptr+offset+4)>>31) ? 934327234Semaste "Allocated" : "Non-allocated", 935327234Semaste (EXTRACT_32BITS(obj_tptr+offset+4)>>31))); 936327234Semaste 937327234Semaste ND_PRINT((ndo, "\n\t\t Direction: %s (%u)", 938327234Semaste (EXTRACT_32BITS(obj_tptr+offset+4)>>30)&0x1 ? 939327234Semaste "Transmit" : "Receive", 940327234Semaste (EXTRACT_32BITS(obj_tptr+offset+4)>>30)&0x1)); 941327234Semaste 942327234Semaste ND_PRINT((ndo, "\n\t\t Channel Status: %s (%u)", 943327234Semaste tok2str(lmp_obj_channel_status_values, 944327234Semaste "Unknown", 945327234Semaste EXTRACT_32BITS(obj_tptr+offset+4)&0x3FFFFFF), 946327234Semaste EXTRACT_32BITS(obj_tptr+offset+4)&0x3FFFFFF)); 947327234Semaste offset+=8; 948327234Semaste } 949327234Semaste break; 950327234Semaste 951146773Ssam default: 952146773Ssam hexdump=TRUE; 953146773Ssam } 954276788Sdelphij break; 955276788Sdelphij 956146773Ssam case LMP_OBJ_CHANNEL_STATUS_REQ: 957146773Ssam switch(lmp_obj_ctype) { 958146773Ssam case LMP_CTYPE_IPV4: 959146773Ssam offset = 0; 960327234Semaste while (offset+4 <= obj_tlen) { 961276788Sdelphij ND_PRINT((ndo, "\n\t Interface ID: %s (0x%08x)", 962276788Sdelphij ipaddr_string(ndo, obj_tptr+offset), 963276788Sdelphij EXTRACT_32BITS(obj_tptr+offset))); 964146773Ssam offset+=4; 965146773Ssam } 966146773Ssam break; 967327234Semaste 968146773Ssam case LMP_CTYPE_IPV6: 969327234Semaste offset = 0; 970327234Semaste while (offset+16 <= obj_tlen) { 971327234Semaste ND_PRINT((ndo, "\n\t Interface ID: %s (0x%08x)", 972327234Semaste ip6addr_string(ndo, obj_tptr+offset), 973327234Semaste EXTRACT_32BITS(obj_tptr+offset))); 974327234Semaste offset+=16; 975327234Semaste } 976327234Semaste break; 977327234Semaste 978327234Semaste case LMP_CTYPE_UNMD: 979327234Semaste offset = 0; 980327234Semaste while (offset+4 <= obj_tlen) { 981327234Semaste ND_PRINT((ndo, "\n\t Interface ID: %u (0x%08x)", 982327234Semaste EXTRACT_32BITS(obj_tptr+offset), 983327234Semaste EXTRACT_32BITS(obj_tptr+offset))); 984327234Semaste offset+=4; 985327234Semaste } 986327234Semaste break; 987327234Semaste 988146773Ssam default: 989146773Ssam hexdump=TRUE; 990146773Ssam } 991276788Sdelphij break; 992276788Sdelphij 993146773Ssam case LMP_OBJ_ERROR_CODE: 994146773Ssam switch(lmp_obj_ctype) { 995146773Ssam case LMP_CTYPE_BEGIN_VERIFY_ERROR: 996327234Semaste if (obj_tlen != 4) { 997327234Semaste ND_PRINT((ndo, " (not correct for object)")); 998327234Semaste break; 999327234Semaste } 1000276788Sdelphij ND_PRINT((ndo, "\n\t Error Code: %s", 1001146773Ssam bittok2str(lmp_obj_begin_verify_error_values, 1002146773Ssam "none", 1003276788Sdelphij EXTRACT_32BITS(obj_tptr)))); 1004146773Ssam break; 1005276788Sdelphij 1006146773Ssam case LMP_CTYPE_LINK_SUMMARY_ERROR: 1007327234Semaste if (obj_tlen != 4) { 1008327234Semaste ND_PRINT((ndo, " (not correct for object)")); 1009327234Semaste break; 1010327234Semaste } 1011276788Sdelphij ND_PRINT((ndo, "\n\t Error Code: %s", 1012146773Ssam bittok2str(lmp_obj_link_summary_error_values, 1013146773Ssam "none", 1014276788Sdelphij EXTRACT_32BITS(obj_tptr)))); 1015146773Ssam break; 1016146773Ssam default: 1017146773Ssam hexdump=TRUE; 1018146773Ssam } 1019276788Sdelphij break; 1020147899Ssam 1021147899Ssam case LMP_OBJ_SERVICE_CONFIG: 1022147899Ssam switch (lmp_obj_ctype) { 1023147899Ssam case LMP_CTYPE_SERVICE_CONFIG_SP: 1024327234Semaste if (obj_tlen != 4) { 1025327234Semaste ND_PRINT((ndo, " (not correct for object)")); 1026327234Semaste break; 1027327234Semaste } 1028276788Sdelphij ND_PRINT((ndo, "\n\t Flags: %s", 1029147899Ssam bittok2str(lmp_obj_service_config_sp_flag_values, 1030276788Sdelphij "none", 1031327234Semaste EXTRACT_8BITS(obj_tptr)))); 1032147899Ssam 1033276788Sdelphij ND_PRINT((ndo, "\n\t UNI Version: %u", 1034356341Scy EXTRACT_8BITS(obj_tptr + 1))); 1035147899Ssam 1036147899Ssam break; 1037276788Sdelphij 1038147899Ssam case LMP_CTYPE_SERVICE_CONFIG_CPSA: 1039327234Semaste if (obj_tlen != 16) { 1040327234Semaste ND_PRINT((ndo, " (not correct for object)")); 1041327234Semaste break; 1042327234Semaste } 1043276788Sdelphij 1044327234Semaste link_type = EXTRACT_8BITS(obj_tptr); 1045276788Sdelphij 1046276788Sdelphij ND_PRINT((ndo, "\n\t Link Type: %s (%u)", 1047147899Ssam tok2str(lmp_sd_service_config_cpsa_link_type_values, 1048147899Ssam "Unknown", link_type), 1049276788Sdelphij link_type)); 1050276788Sdelphij 1051327234Semaste switch (link_type) { 1052327234Semaste case LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SDH: 1053276788Sdelphij ND_PRINT((ndo, "\n\t Signal Type: %s (%u)", 1054147899Ssam tok2str(lmp_sd_service_config_cpsa_signal_type_sdh_values, 1055147899Ssam "Unknown", 1056356341Scy EXTRACT_8BITS(obj_tptr + 1)), 1057356341Scy EXTRACT_8BITS(obj_tptr + 1))); 1058327234Semaste break; 1059276788Sdelphij 1060327234Semaste case LMP_SD_SERVICE_CONFIG_CPSA_LINK_TYPE_SONET: 1061276788Sdelphij ND_PRINT((ndo, "\n\t Signal Type: %s (%u)", 1062147899Ssam tok2str(lmp_sd_service_config_cpsa_signal_type_sonet_values, 1063147899Ssam "Unknown", 1064356341Scy EXTRACT_8BITS(obj_tptr + 1)), 1065356341Scy EXTRACT_8BITS(obj_tptr + 1))); 1066327234Semaste break; 1067147899Ssam } 1068276788Sdelphij 1069276788Sdelphij ND_PRINT((ndo, "\n\t Transparency: %s", 1070147899Ssam bittok2str(lmp_obj_service_config_cpsa_tp_flag_values, 1071147899Ssam "none", 1072356341Scy EXTRACT_8BITS(obj_tptr + 2)))); 1073276788Sdelphij 1074276788Sdelphij ND_PRINT((ndo, "\n\t Contiguous Concatenation Types: %s", 1075147899Ssam bittok2str(lmp_obj_service_config_cpsa_cct_flag_values, 1076147899Ssam "none", 1077356341Scy EXTRACT_8BITS(obj_tptr + 3)))); 1078276788Sdelphij 1079276788Sdelphij ND_PRINT((ndo, "\n\t Minimum NCC: %u", 1080276788Sdelphij EXTRACT_16BITS(obj_tptr+4))); 1081276788Sdelphij 1082276788Sdelphij ND_PRINT((ndo, "\n\t Maximum NCC: %u", 1083276788Sdelphij EXTRACT_16BITS(obj_tptr+6))); 1084276788Sdelphij 1085276788Sdelphij ND_PRINT((ndo, "\n\t Minimum NVC:%u", 1086276788Sdelphij EXTRACT_16BITS(obj_tptr+8))); 1087276788Sdelphij 1088276788Sdelphij ND_PRINT((ndo, "\n\t Maximum NVC:%u", 1089276788Sdelphij EXTRACT_16BITS(obj_tptr+10))); 1090276788Sdelphij 1091276788Sdelphij ND_PRINT((ndo, "\n\t Local Interface ID: %s (0x%08x)", 1092276788Sdelphij ipaddr_string(ndo, obj_tptr+12), 1093276788Sdelphij EXTRACT_32BITS(obj_tptr+12))); 1094276788Sdelphij 1095147899Ssam break; 1096276788Sdelphij 1097147899Ssam case LMP_CTYPE_SERVICE_CONFIG_TRANSPARENCY_TCM: 1098327234Semaste if (obj_tlen != 8) { 1099327234Semaste ND_PRINT((ndo, " (not correct for object)")); 1100327234Semaste break; 1101327234Semaste } 1102276788Sdelphij 1103276788Sdelphij ND_PRINT((ndo, "\n\t Transparency Flags: %s", 1104147899Ssam bittok2str( 1105147899Ssam lmp_obj_service_config_nsa_transparency_flag_values, 1106147899Ssam "none", 1107276788Sdelphij EXTRACT_32BITS(obj_tptr)))); 1108147899Ssam 1109276788Sdelphij ND_PRINT((ndo, "\n\t TCM Monitoring Flags: %s", 1110147899Ssam bittok2str( 1111147899Ssam lmp_obj_service_config_nsa_tcm_flag_values, 1112147899Ssam "none", 1113356341Scy EXTRACT_8BITS(obj_tptr + 7)))); 1114276788Sdelphij 1115147899Ssam break; 1116276788Sdelphij 1117147899Ssam case LMP_CTYPE_SERVICE_CONFIG_NETWORK_DIVERSITY: 1118327234Semaste if (obj_tlen != 4) { 1119327234Semaste ND_PRINT((ndo, " (not correct for object)")); 1120327234Semaste break; 1121327234Semaste } 1122276788Sdelphij 1123276788Sdelphij ND_PRINT((ndo, "\n\t Diversity: Flags: %s", 1124147899Ssam bittok2str( 1125147899Ssam lmp_obj_service_config_nsa_network_diversity_flag_values, 1126147899Ssam "none", 1127356341Scy EXTRACT_8BITS(obj_tptr + 3)))); 1128147899Ssam break; 1129147899Ssam 1130147899Ssam default: 1131147899Ssam hexdump = TRUE; 1132313537Sglebius } 1133147899Ssam 1134147899Ssam break; 1135147899Ssam 1136146773Ssam default: 1137276788Sdelphij if (ndo->ndo_vflag <= 1) 1138276788Sdelphij print_unknown_data(ndo,obj_tptr,"\n\t ",obj_tlen); 1139146773Ssam break; 1140146773Ssam } 1141146773Ssam /* do we want to see an additionally hexdump ? */ 1142276788Sdelphij if (ndo->ndo_vflag > 1 || hexdump==TRUE) 1143276788Sdelphij print_unknown_data(ndo,tptr+sizeof(struct lmp_object_header),"\n\t ", 1144146773Ssam lmp_obj_len-sizeof(struct lmp_object_header)); 1145146773Ssam 1146146773Ssam tptr+=lmp_obj_len; 1147146773Ssam tlen-=lmp_obj_len; 1148146773Ssam } 1149146773Ssam return; 1150146773Ssamtrunc: 1151356341Scy ND_PRINT((ndo, "%s", tstr)); 1152146773Ssam} 1153276788Sdelphij/* 1154276788Sdelphij * Local Variables: 1155276788Sdelphij * c-style: whitesmith 1156276788Sdelphij * c-basic-offset: 8 1157276788Sdelphij * End: 1158276788Sdelphij */ 1159