2 * Copyright (c) 1992, 1993, 1994, 1995, 1996
3 * The Regents of the University of California. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that: (1) source code distributions
7 * retain the above copyright notice and this paragraph in its entirety, (2)
8 * distributions including binary code include the above copyright notice and
9 * this paragraph in its entirety in the documentation or other materials
10 * provided with the distribution, and (3) all advertising materials mentioning
11 * features or use of this software display the following acknowledgement:
12 * ``This product includes software developed by the University of California,
13 * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
14 * the University nor the names of its contributors may be used to endorse
15 * or promote products derived from this software without specific prior
17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21 * Original code by Matt Thomas, Digital Equipment Corporation
23 * Extensively modified by Hannes Gredler (hannes@juniper.net) for more
24 * complete IS-IS & CLNP support.
28 static const char rcsid
[] _U_
=
29 "@(#) $Header: /tcpdump/master/tcpdump/print-isoclns.c,v 1.158 2006-04-14 07:12:46 hannes Exp $ (LBL)";
36 #include <tcpdump-stdinc.h>
41 #include "interface.h"
42 #include "addrtoname.h"
43 #include "ethertype.h"
51 * IS-IS is defined in ISO 10589. Look there for protocol definitions.
54 #define SYSTEM_ID_LEN ETHER_ADDR_LEN
55 #define NODE_ID_LEN SYSTEM_ID_LEN+1
56 #define LSP_ID_LEN SYSTEM_ID_LEN+2
58 #define ISIS_VERSION 1
59 #define ESIS_VERSION 1
60 #define CLNP_VERSION 1
62 #define ISIS_PDU_TYPE_MASK 0x1F
63 #define ESIS_PDU_TYPE_MASK 0x1F
64 #define CLNP_PDU_TYPE_MASK 0x1F
65 #define CLNP_FLAG_MASK 0xE0
66 #define ISIS_LAN_PRIORITY_MASK 0x7F
68 #define ISIS_PDU_L1_LAN_IIH 15
69 #define ISIS_PDU_L2_LAN_IIH 16
70 #define ISIS_PDU_PTP_IIH 17
71 #define ISIS_PDU_L1_LSP 18
72 #define ISIS_PDU_L2_LSP 20
73 #define ISIS_PDU_L1_CSNP 24
74 #define ISIS_PDU_L2_CSNP 25
75 #define ISIS_PDU_L1_PSNP 26
76 #define ISIS_PDU_L2_PSNP 27
78 static struct tok isis_pdu_values
[] = {
79 { ISIS_PDU_L1_LAN_IIH
, "L1 Lan IIH"},
80 { ISIS_PDU_L2_LAN_IIH
, "L2 Lan IIH"},
81 { ISIS_PDU_PTP_IIH
, "p2p IIH"},
82 { ISIS_PDU_L1_LSP
, "L1 LSP"},
83 { ISIS_PDU_L2_LSP
, "L2 LSP"},
84 { ISIS_PDU_L1_CSNP
, "L1 CSNP"},
85 { ISIS_PDU_L2_CSNP
, "L2 CSNP"},
86 { ISIS_PDU_L1_PSNP
, "L1 PSNP"},
87 { ISIS_PDU_L2_PSNP
, "L2 PSNP"},
92 * A TLV is a tuple of a type, length and a value and is normally used for
93 * encoding information in all sorts of places. This is an enumeration of
94 * the well known types.
96 * list taken from rfc3359 plus some memory from veterans ;-)
99 #define ISIS_TLV_AREA_ADDR 1 /* iso10589 */
100 #define ISIS_TLV_IS_REACH 2 /* iso10589 */
101 #define ISIS_TLV_ESNEIGH 3 /* iso10589 */
102 #define ISIS_TLV_PART_DIS 4 /* iso10589 */
103 #define ISIS_TLV_PREFIX_NEIGH 5 /* iso10589 */
104 #define ISIS_TLV_ISNEIGH 6 /* iso10589 */
105 #define ISIS_TLV_ISNEIGH_VARLEN 7 /* iso10589 */
106 #define ISIS_TLV_PADDING 8 /* iso10589 */
107 #define ISIS_TLV_LSP 9 /* iso10589 */
108 #define ISIS_TLV_AUTH 10 /* iso10589, rfc3567 */
109 #define ISIS_TLV_CHECKSUM 12 /* rfc3358 */
110 #define ISIS_TLV_CHECKSUM_MINLEN 2
111 #define ISIS_TLV_LSP_BUFFERSIZE 14 /* iso10589 rev2 */
112 #define ISIS_TLV_LSP_BUFFERSIZE_MINLEN 2
113 #define ISIS_TLV_EXT_IS_REACH 22 /* draft-ietf-isis-traffic-05 */
114 #define ISIS_TLV_IS_ALIAS_ID 24 /* draft-ietf-isis-ext-lsp-frags-02 */
115 #define ISIS_TLV_DECNET_PHASE4 42
116 #define ISIS_TLV_LUCENT_PRIVATE 66
117 #define ISIS_TLV_INT_IP_REACH 128 /* rfc1195, rfc2966 */
118 #define ISIS_TLV_PROTOCOLS 129 /* rfc1195 */
119 #define ISIS_TLV_EXT_IP_REACH 130 /* rfc1195, rfc2966 */
120 #define ISIS_TLV_IDRP_INFO 131 /* rfc1195 */
121 #define ISIS_TLV_IDRP_INFO_MINLEN 1
122 #define ISIS_TLV_IPADDR 132 /* rfc1195 */
123 #define ISIS_TLV_IPAUTH 133 /* rfc1195 */
124 #define ISIS_TLV_TE_ROUTER_ID 134 /* draft-ietf-isis-traffic-05 */
125 #define ISIS_TLV_EXTD_IP_REACH 135 /* draft-ietf-isis-traffic-05 */
126 #define ISIS_TLV_HOSTNAME 137 /* rfc2763 */
127 #define ISIS_TLV_SHARED_RISK_GROUP 138 /* draft-ietf-isis-gmpls-extensions */
128 #define ISIS_TLV_NORTEL_PRIVATE1 176
129 #define ISIS_TLV_NORTEL_PRIVATE2 177
130 #define ISIS_TLV_RESTART_SIGNALING 211 /* rfc3847 */
131 #define ISIS_TLV_RESTART_SIGNALING_FLAGLEN 1
132 #define ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN 2
133 #define ISIS_TLV_MT_IS_REACH 222 /* draft-ietf-isis-wg-multi-topology-05 */
134 #define ISIS_TLV_MT_SUPPORTED 229 /* draft-ietf-isis-wg-multi-topology-05 */
135 #define ISIS_TLV_MT_SUPPORTED_MINLEN 2
136 #define ISIS_TLV_IP6ADDR 232 /* draft-ietf-isis-ipv6-02 */
137 #define ISIS_TLV_MT_IP_REACH 235 /* draft-ietf-isis-wg-multi-topology-05 */
138 #define ISIS_TLV_IP6_REACH 236 /* draft-ietf-isis-ipv6-02 */
139 #define ISIS_TLV_MT_IP6_REACH 237 /* draft-ietf-isis-wg-multi-topology-05 */
140 #define ISIS_TLV_PTP_ADJ 240 /* rfc3373 */
141 #define ISIS_TLV_IIH_SEQNR 241 /* draft-shen-isis-iih-sequence-00 */
142 #define ISIS_TLV_IIH_SEQNR_MINLEN 4
143 #define ISIS_TLV_VENDOR_PRIVATE 250 /* draft-ietf-isis-experimental-tlv-01 */
144 #define ISIS_TLV_VENDOR_PRIVATE_MINLEN 3
146 static struct tok isis_tlv_values
[] = {
147 { ISIS_TLV_AREA_ADDR
, "Area address(es)"},
148 { ISIS_TLV_IS_REACH
, "IS Reachability"},
149 { ISIS_TLV_ESNEIGH
, "ES Neighbor(s)"},
150 { ISIS_TLV_PART_DIS
, "Partition DIS"},
151 { ISIS_TLV_PREFIX_NEIGH
, "Prefix Neighbors"},
152 { ISIS_TLV_ISNEIGH
, "IS Neighbor(s)"},
153 { ISIS_TLV_ISNEIGH_VARLEN
, "IS Neighbor(s) (variable length)"},
154 { ISIS_TLV_PADDING
, "Padding"},
155 { ISIS_TLV_LSP
, "LSP entries"},
156 { ISIS_TLV_AUTH
, "Authentication"},
157 { ISIS_TLV_CHECKSUM
, "Checksum"},
158 { ISIS_TLV_LSP_BUFFERSIZE
, "LSP Buffersize"},
159 { ISIS_TLV_EXT_IS_REACH
, "Extended IS Reachability"},
160 { ISIS_TLV_IS_ALIAS_ID
, "IS Alias ID"},
161 { ISIS_TLV_DECNET_PHASE4
, "DECnet Phase IV"},
162 { ISIS_TLV_LUCENT_PRIVATE
, "Lucent Proprietary"},
163 { ISIS_TLV_INT_IP_REACH
, "IPv4 Internal Reachability"},
164 { ISIS_TLV_PROTOCOLS
, "Protocols supported"},
165 { ISIS_TLV_EXT_IP_REACH
, "IPv4 External Reachability"},
166 { ISIS_TLV_IDRP_INFO
, "Inter-Domain Information Type"},
167 { ISIS_TLV_IPADDR
, "IPv4 Interface address(es)"},
168 { ISIS_TLV_IPAUTH
, "IPv4 authentication (deprecated)"},
169 { ISIS_TLV_TE_ROUTER_ID
, "Traffic Engineering Router ID"},
170 { ISIS_TLV_EXTD_IP_REACH
, "Extended IPv4 Reachability"},
171 { ISIS_TLV_SHARED_RISK_GROUP
, "Shared Risk Link Group"},
172 { ISIS_TLV_NORTEL_PRIVATE1
, "Nortel Proprietary"},
173 { ISIS_TLV_NORTEL_PRIVATE2
, "Nortel Proprietary"},
174 { ISIS_TLV_HOSTNAME
, "Hostname"},
175 { ISIS_TLV_RESTART_SIGNALING
, "Restart Signaling"},
176 { ISIS_TLV_MT_IS_REACH
, "Multi Topology IS Reachability"},
177 { ISIS_TLV_MT_SUPPORTED
, "Multi Topology"},
178 { ISIS_TLV_IP6ADDR
, "IPv6 Interface address(es)"},
179 { ISIS_TLV_MT_IP_REACH
, "Multi-Topology IPv4 Reachability"},
180 { ISIS_TLV_IP6_REACH
, "IPv6 reachability"},
181 { ISIS_TLV_MT_IP6_REACH
, "Multi-Topology IP6 Reachability"},
182 { ISIS_TLV_PTP_ADJ
, "Point-to-point Adjacency State"},
183 { ISIS_TLV_IIH_SEQNR
, "Hello PDU Sequence Number"},
184 { ISIS_TLV_VENDOR_PRIVATE
, "Vendor Private"},
188 #define ESIS_OPTION_PROTOCOLS 129
189 #define ESIS_OPTION_QOS_MAINTENANCE 195 /* iso9542 */
190 #define ESIS_OPTION_SECURITY 197 /* iso9542 */
191 #define ESIS_OPTION_ES_CONF_TIME 198 /* iso9542 */
192 #define ESIS_OPTION_PRIORITY 205 /* iso9542 */
193 #define ESIS_OPTION_ADDRESS_MASK 225 /* iso9542 */
194 #define ESIS_OPTION_SNPA_MASK 226 /* iso9542 */
196 static struct tok esis_option_values
[] = {
197 { ESIS_OPTION_PROTOCOLS
, "Protocols supported"},
198 { ESIS_OPTION_QOS_MAINTENANCE
, "QoS Maintenance" },
199 { ESIS_OPTION_SECURITY
, "Security" },
200 { ESIS_OPTION_ES_CONF_TIME
, "ES Configuration Time" },
201 { ESIS_OPTION_PRIORITY
, "Priority" },
202 { ESIS_OPTION_ADDRESS_MASK
, "Addressk Mask" },
203 { ESIS_OPTION_SNPA_MASK
, "SNPA Mask" },
207 #define CLNP_OPTION_DISCARD_REASON 193
208 #define CLNP_OPTION_QOS_MAINTENANCE 195 /* iso8473 */
209 #define CLNP_OPTION_SECURITY 197 /* iso8473 */
210 #define CLNP_OPTION_SOURCE_ROUTING 200 /* iso8473 */
211 #define CLNP_OPTION_ROUTE_RECORDING 203 /* iso8473 */
212 #define CLNP_OPTION_PADDING 204 /* iso8473 */
213 #define CLNP_OPTION_PRIORITY 205 /* iso8473 */
215 static struct tok clnp_option_values
[] = {
216 { CLNP_OPTION_DISCARD_REASON
, "Discard Reason"},
217 { CLNP_OPTION_PRIORITY
, "Priority"},
218 { CLNP_OPTION_QOS_MAINTENANCE
, "QoS Maintenance"},
219 { CLNP_OPTION_SECURITY
, "Security"},
220 { CLNP_OPTION_SOURCE_ROUTING
, "Source Routing"},
221 { CLNP_OPTION_ROUTE_RECORDING
, "Route Recording"},
222 { CLNP_OPTION_PADDING
, "Padding"},
226 static struct tok clnp_option_rfd_class_values
[] = {
229 { 0x9, "Source Routeing"},
231 { 0xb, "PDU Discarded"},
232 { 0xc, "Reassembly"},
236 static struct tok clnp_option_rfd_general_values
[] = {
237 { 0x0, "Reason not specified"},
238 { 0x1, "Protocol procedure error"},
239 { 0x2, "Incorrect checksum"},
240 { 0x3, "PDU discarded due to congestion"},
241 { 0x4, "Header syntax error (cannot be parsed)"},
242 { 0x5, "Segmentation needed but not permitted"},
243 { 0x6, "Incomplete PDU received"},
244 { 0x7, "Duplicate option"},
248 static struct tok clnp_option_rfd_address_values
[] = {
249 { 0x0, "Destination address unreachable"},
250 { 0x1, "Destination address unknown"},
254 static struct tok clnp_option_rfd_source_routeing_values
[] = {
255 { 0x0, "Unspecified source routeing error"},
256 { 0x1, "Syntax error in source routeing field"},
257 { 0x2, "Unknown address in source routeing field"},
258 { 0x3, "Path not acceptable"},
262 static struct tok clnp_option_rfd_lifetime_values
[] = {
263 { 0x0, "Lifetime expired while data unit in transit"},
264 { 0x1, "Lifetime expired during reassembly"},
268 static struct tok clnp_option_rfd_pdu_discard_values
[] = {
269 { 0x0, "Unsupported option not specified"},
270 { 0x1, "Unsupported protocol version"},
271 { 0x2, "Unsupported security option"},
272 { 0x3, "Unsupported source routeing option"},
273 { 0x4, "Unsupported recording of route option"},
277 static struct tok clnp_option_rfd_reassembly_values
[] = {
278 { 0x0, "Reassembly interference"},
282 /* array of 16 error-classes */
283 static struct tok
*clnp_option_rfd_error_class
[] = {
284 clnp_option_rfd_general_values
,
292 clnp_option_rfd_address_values
,
293 clnp_option_rfd_source_routeing_values
,
294 clnp_option_rfd_lifetime_values
,
295 clnp_option_rfd_pdu_discard_values
,
296 clnp_option_rfd_reassembly_values
,
302 #define CLNP_OPTION_OPTION_QOS_MASK 0x3f
303 #define CLNP_OPTION_SCOPE_MASK 0xc0
304 #define CLNP_OPTION_SCOPE_SA_SPEC 0x40
305 #define CLNP_OPTION_SCOPE_DA_SPEC 0x80
306 #define CLNP_OPTION_SCOPE_GLOBAL 0xc0
308 static struct tok clnp_option_scope_values
[] = {
309 { CLNP_OPTION_SCOPE_SA_SPEC
, "Source Address Specific"},
310 { CLNP_OPTION_SCOPE_DA_SPEC
, "Destination Address Specific"},
311 { CLNP_OPTION_SCOPE_GLOBAL
, "Globally unique"},
315 static struct tok clnp_option_sr_rr_values
[] = {
321 static struct tok clnp_option_sr_rr_string_values
[] = {
322 { CLNP_OPTION_SOURCE_ROUTING
, "source routing"},
323 { CLNP_OPTION_ROUTE_RECORDING
, "recording of route in progress"},
327 static struct tok clnp_option_qos_global_values
[] = {
329 { 0x10, "sequencing vs. delay"},
330 { 0x08, "congested"},
331 { 0x04, "delay vs. cost"},
332 { 0x02, "error vs. delay"},
333 { 0x01, "error vs. cost"},
337 #define ISIS_SUBTLV_EXT_IS_REACH_ADMIN_GROUP 3 /* draft-ietf-isis-traffic-05 */
338 #define ISIS_SUBTLV_EXT_IS_REACH_LINK_LOCAL_REMOTE_ID 4 /* rfc4205 */
339 #define ISIS_SUBTLV_EXT_IS_REACH_LINK_REMOTE_ID 5 /* draft-ietf-isis-traffic-05 */
340 #define ISIS_SUBTLV_EXT_IS_REACH_IPV4_INTF_ADDR 6 /* draft-ietf-isis-traffic-05 */
341 #define ISIS_SUBTLV_EXT_IS_REACH_IPV4_NEIGHBOR_ADDR 8 /* draft-ietf-isis-traffic-05 */
342 #define ISIS_SUBTLV_EXT_IS_REACH_MAX_LINK_BW 9 /* draft-ietf-isis-traffic-05 */
343 #define ISIS_SUBTLV_EXT_IS_REACH_RESERVABLE_BW 10 /* draft-ietf-isis-traffic-05 */
344 #define ISIS_SUBTLV_EXT_IS_REACH_UNRESERVED_BW 11 /* rfc4124 */
345 #define ISIS_SUBTLV_EXT_IS_REACH_BW_CONSTRAINTS_OLD 12 /* draft-ietf-tewg-diff-te-proto-06 */
346 #define ISIS_SUBTLV_EXT_IS_REACH_TE_METRIC 18 /* draft-ietf-isis-traffic-05 */
347 #define ISIS_SUBTLV_EXT_IS_REACH_LINK_ATTRIBUTE 19 /* draft-ietf-isis-link-attr-01 */
348 #define ISIS_SUBTLV_EXT_IS_REACH_LINK_PROTECTION_TYPE 20 /* rfc4205 */
349 #define ISIS_SUBTLV_EXT_IS_REACH_INTF_SW_CAP_DESCR 21 /* rfc4205 */
350 #define ISIS_SUBTLV_EXT_IS_REACH_BW_CONSTRAINTS 22 /* rfc4124 */
352 static struct tok isis_ext_is_reach_subtlv_values
[] = {
353 { ISIS_SUBTLV_EXT_IS_REACH_ADMIN_GROUP
, "Administrative groups" },
354 { ISIS_SUBTLV_EXT_IS_REACH_LINK_LOCAL_REMOTE_ID
, "Link Local/Remote Identifier" },
355 { ISIS_SUBTLV_EXT_IS_REACH_LINK_REMOTE_ID
, "Link Remote Identifier" },
356 { ISIS_SUBTLV_EXT_IS_REACH_IPV4_INTF_ADDR
, "IPv4 interface address" },
357 { ISIS_SUBTLV_EXT_IS_REACH_IPV4_NEIGHBOR_ADDR
, "IPv4 neighbor address" },
358 { ISIS_SUBTLV_EXT_IS_REACH_MAX_LINK_BW
, "Maximum link bandwidth" },
359 { ISIS_SUBTLV_EXT_IS_REACH_RESERVABLE_BW
, "Reservable link bandwidth" },
360 { ISIS_SUBTLV_EXT_IS_REACH_UNRESERVED_BW
, "Unreserved bandwidth" },
361 { ISIS_SUBTLV_EXT_IS_REACH_TE_METRIC
, "Traffic Engineering Metric" },
362 { ISIS_SUBTLV_EXT_IS_REACH_LINK_ATTRIBUTE
, "Link Attribute" },
363 { ISIS_SUBTLV_EXT_IS_REACH_LINK_PROTECTION_TYPE
, "Link Protection Type" },
364 { ISIS_SUBTLV_EXT_IS_REACH_INTF_SW_CAP_DESCR
, "Interface Switching Capability" },
365 { ISIS_SUBTLV_EXT_IS_REACH_BW_CONSTRAINTS_OLD
, "Bandwidth Constraints (old)" },
366 { ISIS_SUBTLV_EXT_IS_REACH_BW_CONSTRAINTS
, "Bandwidth Constraints" },
367 { 250, "Reserved for cisco specific extensions" },
368 { 251, "Reserved for cisco specific extensions" },
369 { 252, "Reserved for cisco specific extensions" },
370 { 253, "Reserved for cisco specific extensions" },
371 { 254, "Reserved for cisco specific extensions" },
372 { 255, "Reserved for future expansion" },
376 #define ISIS_SUBTLV_EXTD_IP_REACH_ADMIN_TAG32 1 /* draft-ietf-isis-admin-tags-01 */
377 #define ISIS_SUBTLV_EXTD_IP_REACH_ADMIN_TAG64 2 /* draft-ietf-isis-admin-tags-01 */
378 #define ISIS_SUBTLV_EXTD_IP_REACH_MGMT_PREFIX_COLOR 117 /* draft-ietf-isis-wg-multi-topology-05 */
380 static struct tok isis_ext_ip_reach_subtlv_values
[] = {
381 { ISIS_SUBTLV_EXTD_IP_REACH_ADMIN_TAG32
, "32-Bit Administrative tag" },
382 { ISIS_SUBTLV_EXTD_IP_REACH_ADMIN_TAG64
, "64-Bit Administrative tag" },
383 { ISIS_SUBTLV_EXTD_IP_REACH_MGMT_PREFIX_COLOR
, "Management Prefix Color" },
387 static struct tok isis_subtlv_link_attribute_values
[] = {
388 { 0x01, "Local Protection Available" },
389 { 0x02, "Link excluded from local protection path" },
390 { 0x04, "Local maintenance required"},
394 #define ISIS_SUBTLV_AUTH_SIMPLE 1
395 #define ISIS_SUBTLV_AUTH_MD5 54
396 #define ISIS_SUBTLV_AUTH_MD5_LEN 16
397 #define ISIS_SUBTLV_AUTH_PRIVATE 255
399 static struct tok isis_subtlv_auth_values
[] = {
400 { ISIS_SUBTLV_AUTH_SIMPLE
, "simple text password"},
401 { ISIS_SUBTLV_AUTH_MD5
, "HMAC-MD5 password"},
402 { ISIS_SUBTLV_AUTH_PRIVATE
, "Routing Domain private password"},
406 #define ISIS_SUBTLV_IDRP_RES 0
407 #define ISIS_SUBTLV_IDRP_LOCAL 1
408 #define ISIS_SUBTLV_IDRP_ASN 2
410 static struct tok isis_subtlv_idrp_values
[] = {
411 { ISIS_SUBTLV_IDRP_RES
, "Reserved"},
412 { ISIS_SUBTLV_IDRP_LOCAL
, "Routing-Domain Specific"},
413 { ISIS_SUBTLV_IDRP_ASN
, "AS Number Tag"},
417 #define CLNP_SEGMENT_PART 0x80
418 #define CLNP_MORE_SEGMENTS 0x40
419 #define CLNP_REQUEST_ER 0x20
421 static struct tok clnp_flag_values
[] = {
422 { CLNP_SEGMENT_PART
, "Segmentation permitted"},
423 { CLNP_MORE_SEGMENTS
, "more Segments"},
424 { CLNP_REQUEST_ER
, "request Error Report"},
428 #define ISIS_MASK_LSP_OL_BIT(x) ((x)&0x4)
429 #define ISIS_MASK_LSP_ISTYPE_BITS(x) ((x)&0x3)
430 #define ISIS_MASK_LSP_PARTITION_BIT(x) ((x)&0x80)
431 #define ISIS_MASK_LSP_ATT_BITS(x) ((x)&0x78)
432 #define ISIS_MASK_LSP_ATT_ERROR_BIT(x) ((x)&0x40)
433 #define ISIS_MASK_LSP_ATT_EXPENSE_BIT(x) ((x)&0x20)
434 #define ISIS_MASK_LSP_ATT_DELAY_BIT(x) ((x)&0x10)
435 #define ISIS_MASK_LSP_ATT_DEFAULT_BIT(x) ((x)&0x8)
437 #define ISIS_MASK_MTID(x) ((x)&0x0fff)
438 #define ISIS_MASK_MTFLAGS(x) ((x)&0xf000)
440 static struct tok isis_mt_flag_values
[] = {
441 { 0x4000, "sub-TLVs present"},
442 { 0x8000, "ATT bit set"},
446 #define ISIS_MASK_TLV_EXTD_IP_UPDOWN(x) ((x)&0x80)
447 #define ISIS_MASK_TLV_EXTD_IP_SUBTLV(x) ((x)&0x40)
449 #define ISIS_MASK_TLV_EXTD_IP6_IE(x) ((x)&0x40)
450 #define ISIS_MASK_TLV_EXTD_IP6_SUBTLV(x) ((x)&0x20)
452 #define ISIS_LSP_TLV_METRIC_SUPPORTED(x) ((x)&0x80)
453 #define ISIS_LSP_TLV_METRIC_IE(x) ((x)&0x40)
454 #define ISIS_LSP_TLV_METRIC_UPDOWN(x) ((x)&0x80)
455 #define ISIS_LSP_TLV_METRIC_VALUE(x) ((x)&0x3f)
457 #define ISIS_MASK_TLV_SHARED_RISK_GROUP(x) ((x)&0x1)
459 static struct tok isis_mt_values
[] = {
460 { 0, "IPv4 unicast"},
461 { 1, "In-Band Management"},
462 { 2, "IPv6 unicast"},
464 { 4095, "Development, Experimental or Proprietary"},
468 static struct tok isis_iih_circuit_type_values
[] = {
469 { 1, "Level 1 only"},
470 { 2, "Level 2 only"},
471 { 3, "Level 1, Level 2"},
475 #define ISIS_LSP_TYPE_UNUSED0 0
476 #define ISIS_LSP_TYPE_LEVEL_1 1
477 #define ISIS_LSP_TYPE_UNUSED2 2
478 #define ISIS_LSP_TYPE_LEVEL_2 3
480 static struct tok isis_lsp_istype_values
[] = {
481 { ISIS_LSP_TYPE_UNUSED0
, "Unused 0x0 (invalid)"},
482 { ISIS_LSP_TYPE_LEVEL_1
, "L1 IS"},
483 { ISIS_LSP_TYPE_UNUSED2
, "Unused 0x2 (invalid)"},
484 { ISIS_LSP_TYPE_LEVEL_2
, "L1L2 IS"},
489 * Katz's point to point adjacency TLV uses codes to tell us the state of
490 * the remote adjacency. Enumerate them.
493 #define ISIS_PTP_ADJ_UP 0
494 #define ISIS_PTP_ADJ_INIT 1
495 #define ISIS_PTP_ADJ_DOWN 2
497 static struct tok isis_ptp_adjancey_values
[] = {
498 { ISIS_PTP_ADJ_UP
, "Up" },
499 { ISIS_PTP_ADJ_INIT
, "Initializing" },
500 { ISIS_PTP_ADJ_DOWN
, "Down" },
504 struct isis_tlv_ptp_adj
{
505 u_int8_t adjacency_state
;
506 u_int8_t extd_local_circuit_id
[4];
507 u_int8_t neighbor_sysid
[SYSTEM_ID_LEN
];
508 u_int8_t neighbor_extd_local_circuit_id
[4];
511 static int osi_cksum(const u_int8_t
*, u_int
);
512 static int clnp_print(const u_int8_t
*, u_int
);
513 static void esis_print(const u_int8_t
*, u_int
);
514 static int isis_print(const u_int8_t
*, u_int
);
516 struct isis_metric_block
{
517 u_int8_t metric_default
;
518 u_int8_t metric_delay
;
519 u_int8_t metric_expense
;
520 u_int8_t metric_error
;
523 struct isis_tlv_is_reach
{
524 struct isis_metric_block isis_metric_block
;
525 u_int8_t neighbor_nodeid
[NODE_ID_LEN
];
528 struct isis_tlv_es_reach
{
529 struct isis_metric_block isis_metric_block
;
530 u_int8_t neighbor_sysid
[SYSTEM_ID_LEN
];
533 struct isis_tlv_ip_reach
{
534 struct isis_metric_block isis_metric_block
;
539 static struct tok isis_is_reach_virtual_values
[] = {
540 { 0, "IsNotVirtual"},
545 static struct tok isis_restart_flag_values
[] = {
546 { 0x1, "Restart Request"},
547 { 0x2, "Restart Acknowledgement"},
548 { 0x4, "Suppress adjacency advertisement"},
552 struct isis_common_header
{
555 u_int8_t version
; /* Protocol version */
557 u_int8_t pdu_type
; /* 3 MSbits are reserved */
558 u_int8_t pdu_version
; /* Packet format version */
563 struct isis_iih_lan_header
{
564 u_int8_t circuit_type
;
565 u_int8_t source_id
[SYSTEM_ID_LEN
];
566 u_int8_t holding_time
[2];
569 u_int8_t lan_id
[NODE_ID_LEN
];
572 struct isis_iih_ptp_header
{
573 u_int8_t circuit_type
;
574 u_int8_t source_id
[SYSTEM_ID_LEN
];
575 u_int8_t holding_time
[2];
580 struct isis_lsp_header
{
582 u_int8_t remaining_lifetime
[2];
583 u_int8_t lsp_id
[LSP_ID_LEN
];
584 u_int8_t sequence_number
[4];
585 u_int8_t checksum
[2];
589 struct isis_csnp_header
{
591 u_int8_t source_id
[NODE_ID_LEN
];
592 u_int8_t start_lsp_id
[LSP_ID_LEN
];
593 u_int8_t end_lsp_id
[LSP_ID_LEN
];
596 struct isis_psnp_header
{
598 u_int8_t source_id
[NODE_ID_LEN
];
601 struct isis_tlv_lsp
{
602 u_int8_t remaining_lifetime
[2];
603 u_int8_t lsp_id
[LSP_ID_LEN
];
604 u_int8_t sequence_number
[4];
605 u_int8_t checksum
[2];
608 #define ISIS_COMMON_HEADER_SIZE (sizeof(struct isis_common_header))
609 #define ISIS_IIH_LAN_HEADER_SIZE (sizeof(struct isis_iih_lan_header))
610 #define ISIS_IIH_PTP_HEADER_SIZE (sizeof(struct isis_iih_ptp_header))
611 #define ISIS_LSP_HEADER_SIZE (sizeof(struct isis_lsp_header))
612 #define ISIS_CSNP_HEADER_SIZE (sizeof(struct isis_csnp_header))
613 #define ISIS_PSNP_HEADER_SIZE (sizeof(struct isis_psnp_header))
615 void isoclns_print(const u_int8_t
*p
, u_int length
, u_int caplen
)
617 const struct isis_common_header
*header
;
619 header
= (const struct isis_common_header
*)p
;
621 if (caplen
<= 1) { /* enough bytes on the wire ? */
627 printf("OSI NLPID %s (0x%02x): ",
628 tok2str(nlpid_values
,"Unknown",*p
),
634 if (!clnp_print(p
, length
))
635 print_unknown_data(p
,"\n\t",caplen
);
639 esis_print(p
, length
);
643 if (!isis_print(p
, length
))
644 print_unknown_data(p
,"\n\t",caplen
);
648 (void)printf("%slength: %u",
654 q933_print(p
+1, length
-1);
658 ip_print(gndo
, p
+1, length
-1);
663 ip6_print(p
+1, length
-1);
668 ppp_print(p
+1, length
-1);
673 printf("OSI NLPID 0x%02x unknown",*p
);
674 (void)printf("%slength: %u",
678 print_unknown_data(p
,"\n\t",caplen
);
683 #define CLNP_PDU_ER 1
684 #define CLNP_PDU_DT 28
685 #define CLNP_PDU_MD 29
686 #define CLNP_PDU_ERQ 30
687 #define CLNP_PDU_ERP 31
689 static struct tok clnp_pdu_values
[] = {
690 { CLNP_PDU_ER
, "Error Report"},
691 { CLNP_PDU_MD
, "MD"},
692 { CLNP_PDU_DT
, "Data"},
693 { CLNP_PDU_ERQ
, "Echo Request"},
694 { CLNP_PDU_ERP
, "Echo Response"},
698 struct clnp_header_t
{
700 u_int8_t length_indicator
;
702 u_int8_t lifetime
; /* units of 500ms */
704 u_int8_t segment_length
[2];
708 struct clnp_segment_header_t
{
709 u_int8_t data_unit_id
[2];
710 u_int8_t segment_offset
[2];
711 u_int8_t total_length
[2];
716 * Decode CLNP packets. Return 0 on error.
719 static int clnp_print (const u_int8_t
*pptr
, u_int length
)
721 const u_int8_t
*optr
,*source_address
,*dest_address
;
722 u_int li
,tlen
,nsap_offset
,source_address_length
,dest_address_length
, clnp_pdu_type
, clnp_flags
;
723 const struct clnp_header_t
*clnp_header
;
724 const struct clnp_segment_header_t
*clnp_segment_header
;
725 u_int8_t rfd_error_major
,rfd_error_minor
;
727 clnp_header
= (const struct clnp_header_t
*) pptr
;
728 TCHECK(*clnp_header
);
730 li
= clnp_header
->length_indicator
;
737 * Sanity checking of the header.
740 if (clnp_header
->version
!= CLNP_VERSION
) {
741 printf("version %d packet not supported", clnp_header
->version
);
745 /* FIXME further header sanity checking */
747 clnp_pdu_type
= clnp_header
->type
& CLNP_PDU_TYPE_MASK
;
748 clnp_flags
= clnp_header
->type
& CLNP_FLAG_MASK
;
750 pptr
+= sizeof(struct clnp_header_t
);
751 li
-= sizeof(struct clnp_header_t
);
752 dest_address_length
= *pptr
;
753 dest_address
= pptr
+ 1;
755 pptr
+= (1 + dest_address_length
);
756 li
-= (1 + dest_address_length
);
757 source_address_length
= *pptr
;
758 source_address
= pptr
+1;
760 pptr
+= (1 + source_address_length
);
761 li
-= (1 + source_address_length
);
764 printf("%s%s > %s, %s, length %u",
766 isonsap_string(source_address
, source_address_length
),
767 isonsap_string(dest_address
, dest_address_length
),
768 tok2str(clnp_pdu_values
,"unknown (%u)",clnp_pdu_type
),
772 printf("%slength %u",eflag
? "" : ", ",length
);
774 printf("\n\t%s PDU, hlen: %u, v: %u, lifetime: %u.%us, Segment PDU length: %u, checksum: 0x%04x ",
775 tok2str(clnp_pdu_values
, "unknown (%u)",clnp_pdu_type
),
776 clnp_header
->length_indicator
,
777 clnp_header
->version
,
778 clnp_header
->lifetime
/2,
779 (clnp_header
->lifetime
%2)*5,
780 EXTRACT_16BITS(clnp_header
->segment_length
),
781 EXTRACT_16BITS(clnp_header
->cksum
));
783 /* do not attempt to verify the checksum if it is zero */
784 if (EXTRACT_16BITS(clnp_header
->cksum
) == 0)
785 printf("(unverified)");
786 else printf("(%s)", osi_cksum(optr
, clnp_header
->length_indicator
) ? "incorrect" : "correct");
788 printf("\n\tFlags [%s]",
789 bittok2str(clnp_flag_values
,"none",clnp_flags
));
791 printf("\n\tsource address (length %u): %s\n\tdest address (length %u): %s",
792 source_address_length
,
793 isonsap_string(source_address
, source_address_length
),
795 isonsap_string(dest_address
,dest_address_length
));
797 if (clnp_flags
& CLNP_SEGMENT_PART
) {
798 clnp_segment_header
= (const struct clnp_segment_header_t
*) pptr
;
799 TCHECK(*clnp_segment_header
);
800 printf("\n\tData Unit ID: 0x%04x, Segment Offset: %u, Total PDU Length: %u",
801 EXTRACT_16BITS(clnp_segment_header
->data_unit_id
),
802 EXTRACT_16BITS(clnp_segment_header
->segment_offset
),
803 EXTRACT_16BITS(clnp_segment_header
->total_length
));
804 pptr
+=sizeof(const struct clnp_segment_header_t
);
805 li
-=sizeof(const struct clnp_segment_header_t
);
808 /* now walk the options */
811 const u_int8_t
*tptr
;
815 printf(", bad opts/li");
821 TCHECK2(*pptr
, opli
);
823 printf(", opt (%d) too long", op
);
830 printf("\n\t %s Option #%u, length %u, value: ",
831 tok2str(clnp_option_values
,"Unknown",op
),
838 case CLNP_OPTION_ROUTE_RECORDING
: /* those two options share the format */
839 case CLNP_OPTION_SOURCE_ROUTING
:
841 tok2str(clnp_option_sr_rr_values
,"Unknown",*tptr
),
842 tok2str(clnp_option_sr_rr_string_values
,"Unknown Option %u",op
));
843 nsap_offset
=*(tptr
+1);
844 if (nsap_offset
== 0) {
845 printf(" Bad NSAP offset (0)");
848 nsap_offset
-=1; /* offset to nsap list */
849 if (nsap_offset
> tlen
) {
850 printf(" Bad NSAP offset (past end of option)");
856 source_address_length
=*tptr
;
857 if (tlen
< source_address_length
+1) {
858 printf("\n\t NSAP address goes past end of option");
861 if (source_address_length
> 0) {
862 source_address
=(tptr
+1);
863 TCHECK2(*source_address
, source_address_length
);
864 printf("\n\t NSAP address (length %u): %s",
865 source_address_length
,
866 isonsap_string(source_address
, source_address_length
));
868 tlen
-=source_address_length
+1;
872 case CLNP_OPTION_PRIORITY
:
873 printf("0x%1x", *tptr
&0x0f);
876 case CLNP_OPTION_QOS_MAINTENANCE
:
877 printf("\n\t Format Code: %s",
878 tok2str(clnp_option_scope_values
,"Reserved",*tptr
&CLNP_OPTION_SCOPE_MASK
));
880 if ((*tptr
&CLNP_OPTION_SCOPE_MASK
) == CLNP_OPTION_SCOPE_GLOBAL
)
881 printf("\n\t QoS Flags [%s]",
882 bittok2str(clnp_option_qos_global_values
,
884 *tptr
&CLNP_OPTION_OPTION_QOS_MASK
));
887 case CLNP_OPTION_SECURITY
:
888 printf("\n\t Format Code: %s, Security-Level %u",
889 tok2str(clnp_option_scope_values
,"Reserved",*tptr
&CLNP_OPTION_SCOPE_MASK
),
893 case CLNP_OPTION_DISCARD_REASON
:
894 rfd_error_major
= (*tptr
&0xf0) >> 4;
895 rfd_error_minor
= *tptr
&0x0f;
896 printf("\n\t Class: %s Error (0x%01x), %s (0x%01x)",
897 tok2str(clnp_option_rfd_class_values
,"Unknown",rfd_error_major
),
899 tok2str(clnp_option_rfd_error_class
[rfd_error_major
],"Unknown",rfd_error_minor
),
903 case CLNP_OPTION_PADDING
:
904 printf("padding data");
908 * FIXME those are the defined Options that lack a decoder
909 * you are welcome to contribute code ;-)
913 print_unknown_data(tptr
,"\n\t ",opli
);
917 print_unknown_data(pptr
,"\n\t ",opli
);
921 switch (clnp_pdu_type
) {
923 case CLNP_PDU_ER
: /* fall through */
926 if (*(pptr
) == NLPID_CLNP
) {
927 printf("\n\t-----original packet-----\n\t");
928 /* FIXME recursion protection */
929 clnp_print(pptr
, length
-clnp_header
->length_indicator
);
938 /* dump the PDU specific data */
939 if (length
-(pptr
-optr
) > 0) {
940 printf("\n\t undecoded non-header data, length %u",length
-clnp_header
->length_indicator
);
941 print_unknown_data(pptr
,"\n\t ",length
-(pptr
-optr
));
948 fputs("[|clnp]", stdout
);
954 #define ESIS_PDU_REDIRECT 6
955 #define ESIS_PDU_ESH 2
956 #define ESIS_PDU_ISH 4
958 static struct tok esis_pdu_values
[] = {
959 { ESIS_PDU_REDIRECT
, "redirect"},
960 { ESIS_PDU_ESH
, "ESH"},
961 { ESIS_PDU_ISH
, "ISH"},
965 struct esis_header_t
{
967 u_int8_t length_indicator
;
971 u_int8_t holdtime
[2];
976 esis_print(const u_int8_t
*pptr
, u_int length
)
978 const u_int8_t
*optr
;
979 u_int li
,esis_pdu_type
,source_address_length
, source_address_number
;
980 const struct esis_header_t
*esis_header
;
989 printf("no header at all!");
993 esis_header
= (const struct esis_header_t
*) pptr
;
994 TCHECK(*esis_header
);
995 li
= esis_header
->length_indicator
;
999 * Sanity checking of the header.
1002 if (esis_header
->nlpid
!= NLPID_ESIS
) {
1003 printf(" nlpid 0x%02x packet not supported", esis_header
->nlpid
);
1007 if (esis_header
->version
!= ESIS_VERSION
) {
1008 printf(" version %d packet not supported", esis_header
->version
);
1013 printf(" length indicator(%d) > PDU size (%d)!", li
, length
);
1017 if (li
< sizeof(struct esis_header_t
) + 2) {
1018 printf(" length indicator < min PDU size %d:", li
);
1019 while (--length
!= 0)
1020 printf("%02X", *pptr
++);
1024 esis_pdu_type
= esis_header
->type
& ESIS_PDU_TYPE_MASK
;
1027 printf("%s%s, length %u",
1029 tok2str(esis_pdu_values
,"unknown type (%u)",esis_pdu_type
),
1033 printf("%slength %u\n\t%s (%u)",
1036 tok2str(esis_pdu_values
,"unknown type: %u", esis_pdu_type
),
1039 printf(", v: %u%s", esis_header
->version
, esis_header
->version
== ESIS_VERSION
? "" : "unsupported" );
1040 printf(", checksum: 0x%04x ", EXTRACT_16BITS(esis_header
->cksum
));
1041 /* do not attempt to verify the checksum if it is zero */
1042 if (EXTRACT_16BITS(esis_header
->cksum
) == 0)
1043 printf("(unverified)");
1045 printf("(%s)", osi_cksum(pptr
, li
) ? "incorrect" : "correct");
1047 printf(", holding time: %us, length indicator: %u",EXTRACT_16BITS(esis_header
->holdtime
),li
);
1050 print_unknown_data(optr
,"\n\t",sizeof(struct esis_header_t
));
1052 pptr
+= sizeof(struct esis_header_t
);
1053 li
-= sizeof(struct esis_header_t
);
1055 switch (esis_pdu_type
) {
1056 case ESIS_PDU_REDIRECT
: {
1057 const u_int8_t
*dst
, *snpa
, *neta
;
1058 u_int dstl
, snpal
, netal
;
1062 printf(", bad redirect/li");
1068 TCHECK2(*pptr
, dstl
);
1070 printf(", bad redirect/li");
1076 printf("\n\t %s", isonsap_string(dst
,dstl
));
1080 printf(", bad redirect/li");
1086 TCHECK2(*pptr
, snpal
);
1088 printf(", bad redirect/li");
1096 printf(", bad redirect/li");
1101 TCHECK2(*pptr
, netal
);
1103 printf(", bad redirect/li");
1111 printf("\n\t %s", etheraddr_string(snpa
));
1113 printf("\n\t %s", isonsap_string(neta
,netal
));
1120 printf(", bad esh/li");
1123 source_address_number
= *pptr
;
1127 printf("\n\t Number of Source Addresses: %u", source_address_number
);
1129 while (source_address_number
> 0) {
1132 printf(", bad esh/li");
1135 source_address_length
= *pptr
;
1139 TCHECK2(*pptr
, source_address_length
);
1140 if (li
< source_address_length
) {
1141 printf(", bad esh/li");
1144 printf("\n\t NET (length: %u): %s",
1145 source_address_length
,
1146 isonsap_string(pptr
,source_address_length
));
1147 pptr
+= source_address_length
;
1148 li
-= source_address_length
;
1149 source_address_number
--;
1154 case ESIS_PDU_ISH
: {
1157 printf(", bad ish/li");
1160 source_address_length
= *pptr
;
1163 TCHECK2(*pptr
, source_address_length
);
1164 if (li
< source_address_length
) {
1165 printf(", bad ish/li");
1168 printf("\n\t NET (length: %u): %s", source_address_length
, isonsap_string(pptr
, source_address_length
));
1169 pptr
+= source_address_length
;
1170 li
-= source_address_length
;
1177 print_unknown_data(pptr
,"\n\t ",snapend
-pptr
);
1182 /* now walk the options */
1185 const u_int8_t
*tptr
;
1189 printf(", bad opts/li");
1196 printf(", opt (%d) too long", op
);
1202 printf("\n\t %s Option #%u, length %u, value: ",
1203 tok2str(esis_option_values
,"Unknown",op
),
1209 case ESIS_OPTION_ES_CONF_TIME
:
1211 printf("%us", EXTRACT_16BITS(tptr
));
1214 case ESIS_OPTION_PROTOCOLS
:
1217 printf("%s (0x%02x)",
1218 tok2str(nlpid_values
,
1222 if (opli
>1) /* further NPLIDs ? - put comma */
1230 * FIXME those are the defined Options that lack a decoder
1231 * you are welcome to contribute code ;-)
1234 case ESIS_OPTION_QOS_MAINTENANCE
:
1235 case ESIS_OPTION_SECURITY
:
1236 case ESIS_OPTION_PRIORITY
:
1237 case ESIS_OPTION_ADDRESS_MASK
:
1238 case ESIS_OPTION_SNPA_MASK
:
1241 print_unknown_data(tptr
,"\n\t ",opli
);
1245 print_unknown_data(pptr
,"\n\t ",opli
);
1252 /* shared routine for printing system, node and lsp-ids */
1254 isis_print_id(const u_int8_t
*cp
, int id_len
)
1257 static char id
[sizeof("xxxx.xxxx.xxxx.yy-zz")];
1260 for (i
= 1; i
<= SYSTEM_ID_LEN
; i
++) {
1261 snprintf(pos
, sizeof(id
) - (pos
- id
), "%02x", *cp
++);
1263 if (i
== 2 || i
== 4)
1266 if (id_len
>= NODE_ID_LEN
) {
1267 snprintf(pos
, sizeof(id
) - (pos
- id
), ".%02x", *cp
++);
1270 if (id_len
== LSP_ID_LEN
)
1271 snprintf(pos
, sizeof(id
) - (pos
- id
), "-%02x", *cp
);
1275 /* print the 4-byte metric block which is common found in the old-style TLVs */
1277 isis_print_metric_block (const struct isis_metric_block
*isis_metric_block
)
1279 printf(", Default Metric: %d, %s",
1280 ISIS_LSP_TLV_METRIC_VALUE(isis_metric_block
->metric_default
),
1281 ISIS_LSP_TLV_METRIC_IE(isis_metric_block
->metric_default
) ? "External" : "Internal");
1282 if (!ISIS_LSP_TLV_METRIC_SUPPORTED(isis_metric_block
->metric_delay
))
1283 printf("\n\t\t Delay Metric: %d, %s",
1284 ISIS_LSP_TLV_METRIC_VALUE(isis_metric_block
->metric_delay
),
1285 ISIS_LSP_TLV_METRIC_IE(isis_metric_block
->metric_delay
) ? "External" : "Internal");
1286 if (!ISIS_LSP_TLV_METRIC_SUPPORTED(isis_metric_block
->metric_expense
))
1287 printf("\n\t\t Expense Metric: %d, %s",
1288 ISIS_LSP_TLV_METRIC_VALUE(isis_metric_block
->metric_expense
),
1289 ISIS_LSP_TLV_METRIC_IE(isis_metric_block
->metric_expense
) ? "External" : "Internal");
1290 if (!ISIS_LSP_TLV_METRIC_SUPPORTED(isis_metric_block
->metric_error
))
1291 printf("\n\t\t Error Metric: %d, %s",
1292 ISIS_LSP_TLV_METRIC_VALUE(isis_metric_block
->metric_error
),
1293 ISIS_LSP_TLV_METRIC_IE(isis_metric_block
->metric_error
) ? "External" : "Internal");
1295 return(1); /* everything is ok */
1299 isis_print_tlv_ip_reach (const u_int8_t
*cp
, const char *ident
, int length
)
1302 const struct isis_tlv_ip_reach
*tlv_ip_reach
;
1304 tlv_ip_reach
= (const struct isis_tlv_ip_reach
*)cp
;
1306 while (length
> 0) {
1307 if ((size_t)length
< sizeof(*tlv_ip_reach
)) {
1308 printf("short IPv4 Reachability (%d vs %lu)",
1310 (unsigned long)sizeof(*tlv_ip_reach
));
1314 if (!TTEST(*tlv_ip_reach
))
1317 prefix_len
= mask2plen(EXTRACT_32BITS(tlv_ip_reach
->mask
));
1319 if (prefix_len
== -1)
1320 printf("%sIPv4 prefix: %s mask %s",
1322 ipaddr_string((tlv_ip_reach
->prefix
)),
1323 ipaddr_string((tlv_ip_reach
->mask
)));
1325 printf("%sIPv4 prefix: %15s/%u",
1327 ipaddr_string((tlv_ip_reach
->prefix
)),
1330 printf(", Distribution: %s, Metric: %u, %s",
1331 ISIS_LSP_TLV_METRIC_UPDOWN(tlv_ip_reach
->isis_metric_block
.metric_default
) ? "down" : "up",
1332 ISIS_LSP_TLV_METRIC_VALUE(tlv_ip_reach
->isis_metric_block
.metric_default
),
1333 ISIS_LSP_TLV_METRIC_IE(tlv_ip_reach
->isis_metric_block
.metric_default
) ? "External" : "Internal");
1335 if (!ISIS_LSP_TLV_METRIC_SUPPORTED(tlv_ip_reach
->isis_metric_block
.metric_delay
))
1336 printf("%s Delay Metric: %u, %s",
1338 ISIS_LSP_TLV_METRIC_VALUE(tlv_ip_reach
->isis_metric_block
.metric_delay
),
1339 ISIS_LSP_TLV_METRIC_IE(tlv_ip_reach
->isis_metric_block
.metric_delay
) ? "External" : "Internal");
1341 if (!ISIS_LSP_TLV_METRIC_SUPPORTED(tlv_ip_reach
->isis_metric_block
.metric_expense
))
1342 printf("%s Expense Metric: %u, %s",
1344 ISIS_LSP_TLV_METRIC_VALUE(tlv_ip_reach
->isis_metric_block
.metric_expense
),
1345 ISIS_LSP_TLV_METRIC_IE(tlv_ip_reach
->isis_metric_block
.metric_expense
) ? "External" : "Internal");
1347 if (!ISIS_LSP_TLV_METRIC_SUPPORTED(tlv_ip_reach
->isis_metric_block
.metric_error
))
1348 printf("%s Error Metric: %u, %s",
1350 ISIS_LSP_TLV_METRIC_VALUE(tlv_ip_reach
->isis_metric_block
.metric_error
),
1351 ISIS_LSP_TLV_METRIC_IE(tlv_ip_reach
->isis_metric_block
.metric_error
) ? "External" : "Internal");
1353 length
-= sizeof(struct isis_tlv_ip_reach
);
1360 * this is the common IP-REACH subTLV decoder it is called
1361 * from various EXTD-IP REACH TLVs (135,235,236,237)
1365 isis_print_ip_reach_subtlv (const u_int8_t
*tptr
,int subt
,int subl
,const char *ident
) {
1367 /* first lets see if we know the subTLVs name*/
1368 printf("%s%s subTLV #%u, length: %u",
1370 tok2str(isis_ext_ip_reach_subtlv_values
,
1376 if (!TTEST2(*tptr
,subl
))
1380 case ISIS_SUBTLV_EXTD_IP_REACH_MGMT_PREFIX_COLOR
: /* fall through */
1381 case ISIS_SUBTLV_EXTD_IP_REACH_ADMIN_TAG32
:
1383 printf(", 0x%08x (=%u)",
1384 EXTRACT_32BITS(tptr
),
1385 EXTRACT_32BITS(tptr
));
1390 case ISIS_SUBTLV_EXTD_IP_REACH_ADMIN_TAG64
:
1392 printf(", 0x%08x%08x",
1393 EXTRACT_32BITS(tptr
),
1394 EXTRACT_32BITS(tptr
+4));
1400 if(!print_unknown_data(tptr
,"\n\t\t ",
1408 printf("%spacket exceeded snapshot",ident
);
1413 * this is the common IS-REACH subTLV decoder it is called
1414 * from isis_print_ext_is_reach()
1418 isis_print_is_reach_subtlv (const u_int8_t
*tptr
,u_int subt
,u_int subl
,const char *ident
) {
1420 u_int te_class
,priority_level
,gmpls_switch_cap
;
1421 union { /* int to float conversion buffer for several subTLVs */
1426 /* first lets see if we know the subTLVs name*/
1427 printf("%s%s subTLV #%u, length: %u",
1429 tok2str(isis_ext_is_reach_subtlv_values
,
1435 if (!TTEST2(*tptr
,subl
))
1439 case ISIS_SUBTLV_EXT_IS_REACH_ADMIN_GROUP
:
1440 case ISIS_SUBTLV_EXT_IS_REACH_LINK_LOCAL_REMOTE_ID
:
1441 case ISIS_SUBTLV_EXT_IS_REACH_LINK_REMOTE_ID
:
1443 printf(", 0x%08x", EXTRACT_32BITS(tptr
));
1444 if (subl
== 8) /* rfc4205 */
1445 printf(", 0x%08x", EXTRACT_32BITS(tptr
+4));
1448 case ISIS_SUBTLV_EXT_IS_REACH_IPV4_INTF_ADDR
:
1449 case ISIS_SUBTLV_EXT_IS_REACH_IPV4_NEIGHBOR_ADDR
:
1450 if (subl
>= sizeof(struct in_addr
))
1451 printf(", %s", ipaddr_string(tptr
));
1453 case ISIS_SUBTLV_EXT_IS_REACH_MAX_LINK_BW
:
1454 case ISIS_SUBTLV_EXT_IS_REACH_RESERVABLE_BW
:
1456 bw
.i
= EXTRACT_32BITS(tptr
);
1457 printf(", %.3f Mbps", bw
.f
*8/1000000 );
1460 case ISIS_SUBTLV_EXT_IS_REACH_UNRESERVED_BW
:
1462 for (te_class
= 0; te_class
< 8; te_class
++) {
1463 bw
.i
= EXTRACT_32BITS(tptr
);
1464 printf("%s TE-Class %u: %.3f Mbps",
1472 case ISIS_SUBTLV_EXT_IS_REACH_BW_CONSTRAINTS
: /* fall through */
1473 case ISIS_SUBTLV_EXT_IS_REACH_BW_CONSTRAINTS_OLD
:
1474 printf("%sBandwidth Constraints Model ID: %s (%u)",
1476 tok2str(diffserv_te_bc_values
, "unknown", *tptr
),
1479 /* decode BCs until the subTLV ends */
1480 for (te_class
= 0; te_class
< (subl
-1)/4; te_class
++) {
1481 bw
.i
= EXTRACT_32BITS(tptr
);
1482 printf("%s Bandwidth constraint CT%u: %.3f Mbps",
1489 case ISIS_SUBTLV_EXT_IS_REACH_TE_METRIC
:
1491 printf(", %u", EXTRACT_24BITS(tptr
));
1493 case ISIS_SUBTLV_EXT_IS_REACH_LINK_ATTRIBUTE
:
1495 printf(", [ %s ] (0x%04x)",
1496 bittok2str(isis_subtlv_link_attribute_values
,
1498 EXTRACT_16BITS(tptr
)),
1499 EXTRACT_16BITS(tptr
));
1502 case ISIS_SUBTLV_EXT_IS_REACH_LINK_PROTECTION_TYPE
:
1504 printf(", %s, Priority %u",
1505 bittok2str(gmpls_link_prot_values
, "none", *tptr
),
1509 case ISIS_SUBTLV_EXT_IS_REACH_INTF_SW_CAP_DESCR
:
1511 gmpls_switch_cap
= *tptr
;
1512 printf("%s Interface Switching Capability:%s",
1514 tok2str(gmpls_switch_cap_values
, "Unknown", gmpls_switch_cap
));
1515 printf(", LSP Encoding: %s",
1516 tok2str(gmpls_encoding_values
, "Unknown", *(tptr
+1)));
1518 printf("%s Max LSP Bandwidth:",ident
);
1519 for (priority_level
= 0; priority_level
< 8; priority_level
++) {
1520 bw
.i
= EXTRACT_32BITS(tptr
);
1521 printf("%s priority level %d: %.3f Mbps",
1528 switch (gmpls_switch_cap
) {
1533 bw
.i
= EXTRACT_32BITS(tptr
);
1534 printf("%s Min LSP Bandwidth: %.3f Mbps", ident
, bw
.f
*8/1000000);
1535 printf("%s Interface MTU: %u", ident
, EXTRACT_16BITS(tptr
+4));
1538 bw
.i
= EXTRACT_32BITS(tptr
);
1539 printf("%s Min LSP Bandwidth: %.3f Mbps", ident
, bw
.f
*8/1000000);
1540 printf("%s Indication %s", ident
,
1541 tok2str(gmpls_switch_cap_tsc_indication_values
, "Unknown (%u)", *(tptr
+4)));
1544 /* there is some optional stuff left to decode but this is as of yet
1545 not specified so just lets hexdump what is left */
1547 if(!print_unknown_data(tptr
,"\n\t\t ",
1555 if(!print_unknown_data(tptr
,"\n\t\t ",
1563 printf("%spacket exceeded snapshot",ident
);
1569 * this is the common IS-REACH decoder it is called
1570 * from various EXTD-IS REACH style TLVs (22,24,222)
1574 isis_print_ext_is_reach (const u_int8_t
*tptr
,const char *ident
, int tlv_type
) {
1576 char ident_buffer
[20];
1577 int subtlv_type
,subtlv_len
,subtlv_sum_len
;
1578 int proc_bytes
= 0; /* how many bytes did we process ? */
1580 if (!TTEST2(*tptr
, NODE_ID_LEN
))
1583 printf("%sIS Neighbor: %s", ident
, isis_print_id(tptr
, NODE_ID_LEN
));
1584 tptr
+=(NODE_ID_LEN
);
1586 if (tlv_type
!= ISIS_TLV_IS_ALIAS_ID
) { /* the Alias TLV Metric field is implicit 0 */
1587 if (!TTEST2(*tptr
, 3)) /* and is therefore skipped */
1589 printf(", Metric: %d",EXTRACT_24BITS(tptr
));
1593 if (!TTEST2(*tptr
, 1))
1595 subtlv_sum_len
=*(tptr
++); /* read out subTLV length */
1596 proc_bytes
=NODE_ID_LEN
+3+1;
1597 printf(", %ssub-TLVs present",subtlv_sum_len
? "" : "no ");
1598 if (subtlv_sum_len
) {
1599 printf(" (%u)",subtlv_sum_len
);
1600 while (subtlv_sum_len
>0) {
1601 if (!TTEST2(*tptr
,2))
1603 subtlv_type
=*(tptr
++);
1604 subtlv_len
=*(tptr
++);
1605 /* prepend the ident string */
1606 snprintf(ident_buffer
, sizeof(ident_buffer
), "%s ",ident
);
1607 if(!isis_print_is_reach_subtlv(tptr
,subtlv_type
,subtlv_len
,ident_buffer
))
1610 subtlv_sum_len
-=(subtlv_len
+2);
1611 proc_bytes
+=(subtlv_len
+2);
1618 * this is the common Multi Topology ID decoder
1619 * it is called from various MT-TLVs (222,229,235,237)
1623 isis_print_mtid (const u_int8_t
*tptr
,const char *ident
) {
1625 if (!TTEST2(*tptr
, 2))
1630 tok2str(isis_mt_values
,
1631 "Reserved for IETF Consensus",
1632 ISIS_MASK_MTID(EXTRACT_16BITS(tptr
))));
1634 printf(" Topology (0x%03x), Flags: [%s]",
1635 ISIS_MASK_MTID(EXTRACT_16BITS(tptr
)),
1636 bittok2str(isis_mt_flag_values
, "none",ISIS_MASK_MTFLAGS(EXTRACT_16BITS(tptr
))));
1642 * this is the common extended IP reach decoder
1643 * it is called from TLVs (135,235,236,237)
1644 * we process the TLV and optional subTLVs and return
1645 * the amount of processed bytes
1649 isis_print_extd_ip_reach (const u_int8_t
*tptr
, const char *ident
, u_int16_t afi
) {
1651 char ident_buffer
[20];
1653 u_int8_t prefix
[sizeof(struct in6_addr
)]; /* shared copy buffer for IPv4 and IPv6 prefixes */
1655 u_int8_t prefix
[sizeof(struct in_addr
)]; /* shared copy buffer for IPv4 prefixes */
1657 u_int metric
, status_byte
, bit_length
, byte_length
, sublen
, processed
, subtlvtype
, subtlvlen
;
1659 if (!TTEST2(*tptr
, 4))
1661 metric
= EXTRACT_32BITS(tptr
);
1665 if (afi
== AF_INET
) {
1666 if (!TTEST2(*tptr
, 1)) /* fetch status byte */
1668 status_byte
=*(tptr
++);
1669 bit_length
= status_byte
&0x3f;
1670 if (bit_length
> 32) {
1671 printf("%sIPv4 prefix: bad bit length %u",
1678 } else if (afi
== AF_INET6
) {
1679 if (!TTEST2(*tptr
, 1)) /* fetch status & prefix_len byte */
1681 status_byte
=*(tptr
++);
1682 bit_length
=*(tptr
++);
1683 if (bit_length
> 128) {
1684 printf("%sIPv6 prefix: bad bit length %u",
1692 return (0); /* somebody is fooling us */
1694 byte_length
= (bit_length
+ 7) / 8; /* prefix has variable length encoding */
1696 if (!TTEST2(*tptr
, byte_length
))
1698 memset(prefix
, 0, sizeof prefix
); /* clear the copy buffer */
1699 memcpy(prefix
,tptr
,byte_length
); /* copy as much as is stored in the TLV */
1701 processed
+=byte_length
;
1704 printf("%sIPv4 prefix: %15s/%u",
1706 ipaddr_string(prefix
),
1709 if (afi
== AF_INET6
)
1710 printf("%sIPv6 prefix: %s/%u",
1712 ip6addr_string(prefix
),
1716 printf(", Distribution: %s, Metric: %u",
1717 ISIS_MASK_TLV_EXTD_IP_UPDOWN(status_byte
) ? "down" : "up",
1720 if (afi
== AF_INET
&& ISIS_MASK_TLV_EXTD_IP_SUBTLV(status_byte
))
1721 printf(", sub-TLVs present");
1723 if (afi
== AF_INET6
)
1725 ISIS_MASK_TLV_EXTD_IP6_IE(status_byte
) ? "External" : "Internal",
1726 ISIS_MASK_TLV_EXTD_IP6_SUBTLV(status_byte
) ? ", sub-TLVs present" : "");
1729 if ((ISIS_MASK_TLV_EXTD_IP_SUBTLV(status_byte
) && afi
== AF_INET
) ||
1730 (ISIS_MASK_TLV_EXTD_IP6_SUBTLV(status_byte
) && afi
== AF_INET6
)) {
1731 /* assume that one prefix can hold more
1732 than one subTLV - therefore the first byte must reflect
1733 the aggregate bytecount of the subTLVs for this prefix
1735 if (!TTEST2(*tptr
, 1))
1738 processed
+=sublen
+1;
1739 printf(" (%u)",sublen
); /* print out subTLV length */
1742 if (!TTEST2(*tptr
,2))
1744 subtlvtype
=*(tptr
++);
1745 subtlvlen
=*(tptr
++);
1746 /* prepend the ident string */
1747 snprintf(ident_buffer
, sizeof(ident_buffer
), "%s ",ident
);
1748 if(!isis_print_ip_reach_subtlv(tptr
,subtlvtype
,subtlvlen
,ident_buffer
))
1751 sublen
-=(subtlvlen
+2);
1759 * Decode IS-IS packets. Return 0 on error.
1762 static int isis_print (const u_int8_t
*p
, u_int length
)
1764 const struct isis_common_header
*isis_header
;
1766 const struct isis_iih_lan_header
*header_iih_lan
;
1767 const struct isis_iih_ptp_header
*header_iih_ptp
;
1768 const struct isis_lsp_header
*header_lsp
;
1769 const struct isis_csnp_header
*header_csnp
;
1770 const struct isis_psnp_header
*header_psnp
;
1772 const struct isis_tlv_lsp
*tlv_lsp
;
1773 const struct isis_tlv_ptp_adj
*tlv_ptp_adj
;
1774 const struct isis_tlv_is_reach
*tlv_is_reach
;
1775 const struct isis_tlv_es_reach
*tlv_es_reach
;
1777 u_int8_t pdu_type
, max_area
, id_length
, tlv_type
, tlv_len
, tmp
, alen
, lan_alen
, prefix_len
;
1778 u_int8_t ext_is_len
, ext_ip_len
, mt_len
;
1779 const u_int8_t
*optr
, *pptr
, *tptr
;
1780 u_short packet_len
,pdu_len
;
1784 optr
= p
; /* initialize the _o_riginal pointer to the packet start -
1785 need it for parsing the checksum TLV */
1786 isis_header
= (const struct isis_common_header
*)p
;
1787 TCHECK(*isis_header
);
1788 pptr
= p
+(ISIS_COMMON_HEADER_SIZE
);
1789 header_iih_lan
= (const struct isis_iih_lan_header
*)pptr
;
1790 header_iih_ptp
= (const struct isis_iih_ptp_header
*)pptr
;
1791 header_lsp
= (const struct isis_lsp_header
*)pptr
;
1792 header_csnp
= (const struct isis_csnp_header
*)pptr
;
1793 header_psnp
= (const struct isis_psnp_header
*)pptr
;
1799 * Sanity checking of the header.
1802 if (isis_header
->version
!= ISIS_VERSION
) {
1803 printf("version %d packet not supported", isis_header
->version
);
1807 if ((isis_header
->id_length
!= SYSTEM_ID_LEN
) && (isis_header
->id_length
!= 0)) {
1808 printf("system ID length of %d is not supported",
1809 isis_header
->id_length
);
1813 if (isis_header
->pdu_version
!= ISIS_VERSION
) {
1814 printf("version %d packet not supported", isis_header
->pdu_version
);
1818 max_area
= isis_header
->max_area
;
1821 max_area
= 3; /* silly shit */
1824 printf("bad packet -- 255 areas");
1830 id_length
= isis_header
->id_length
;
1833 id_length
= 6; /* silly shit again */
1835 case 1: /* 1-8 are valid sys-ID lenghts */
1845 id_length
= 0; /* entirely useless */
1851 /* toss any non 6-byte sys-ID len PDUs */
1852 if (id_length
!= 6 ) {
1853 printf("bad packet -- illegal sys-ID length (%u)", id_length
);
1857 pdu_type
=isis_header
->pdu_type
;
1859 /* in non-verbose mode print the basic PDU Type plus PDU specific brief information*/
1863 tok2str(isis_pdu_values
,"unknown PDU-Type %u",pdu_type
));
1867 case ISIS_PDU_L1_LAN_IIH
:
1868 case ISIS_PDU_L2_LAN_IIH
:
1869 printf(", src-id %s",
1870 isis_print_id(header_iih_lan
->source_id
,SYSTEM_ID_LEN
));
1871 printf(", lan-id %s, prio %u",
1872 isis_print_id(header_iih_lan
->lan_id
,NODE_ID_LEN
),
1873 header_iih_lan
->priority
);
1875 case ISIS_PDU_PTP_IIH
:
1876 printf(", src-id %s", isis_print_id(header_iih_ptp
->source_id
,SYSTEM_ID_LEN
));
1878 case ISIS_PDU_L1_LSP
:
1879 case ISIS_PDU_L2_LSP
:
1880 printf(", lsp-id %s, seq 0x%08x, lifetime %5us",
1881 isis_print_id(header_lsp
->lsp_id
, LSP_ID_LEN
),
1882 EXTRACT_32BITS(header_lsp
->sequence_number
),
1883 EXTRACT_16BITS(header_lsp
->remaining_lifetime
));
1885 case ISIS_PDU_L1_CSNP
:
1886 case ISIS_PDU_L2_CSNP
:
1887 printf(", src-id %s", isis_print_id(header_csnp
->source_id
,NODE_ID_LEN
));
1889 case ISIS_PDU_L1_PSNP
:
1890 case ISIS_PDU_L2_PSNP
:
1891 printf(", src-id %s", isis_print_id(header_psnp
->source_id
,NODE_ID_LEN
));
1895 printf(", length %u", length
);
1900 /* ok they seem to want to know everything - lets fully decode it */
1901 printf("%slength %u", eflag
? "" : ", ",length
);
1903 printf("\n\t%s, hlen: %u, v: %u, pdu-v: %u, sys-id-len: %u (%u), max-area: %u (%u)",
1904 tok2str(isis_pdu_values
,
1907 isis_header
->fixed_len
,
1908 isis_header
->version
,
1909 isis_header
->pdu_version
,
1911 isis_header
->id_length
,
1913 isis_header
->max_area
);
1916 if(!print_unknown_data(optr
,"\n\t",8)) /* provide the _o_riginal pointer */
1917 return(0); /* for optionally debugging the common header */
1922 case ISIS_PDU_L1_LAN_IIH
:
1923 case ISIS_PDU_L2_LAN_IIH
:
1924 if (isis_header
->fixed_len
!= (ISIS_COMMON_HEADER_SIZE
+ISIS_IIH_LAN_HEADER_SIZE
)) {
1925 printf(", bogus fixed header length %u should be %lu",
1926 isis_header
->fixed_len
, (unsigned long)ISIS_IIH_LAN_HEADER_SIZE
);
1930 pdu_len
=EXTRACT_16BITS(header_iih_lan
->pdu_len
);
1931 if (packet_len
>pdu_len
) {
1932 packet_len
=pdu_len
; /* do TLV decoding as long as it makes sense */
1936 TCHECK(*header_iih_lan
);
1937 printf("\n\t source-id: %s, holding time: %us, Flags: [%s]",
1938 isis_print_id(header_iih_lan
->source_id
,SYSTEM_ID_LEN
),
1939 EXTRACT_16BITS(header_iih_lan
->holding_time
),
1940 tok2str(isis_iih_circuit_type_values
,
1941 "unknown circuit type 0x%02x",
1942 header_iih_lan
->circuit_type
));
1944 printf("\n\t lan-id: %s, Priority: %u, PDU length: %u",
1945 isis_print_id(header_iih_lan
->lan_id
, NODE_ID_LEN
),
1946 (header_iih_lan
->priority
) & ISIS_LAN_PRIORITY_MASK
,
1950 if(!print_unknown_data(pptr
,"\n\t ",ISIS_IIH_LAN_HEADER_SIZE
))
1954 packet_len
-= (ISIS_COMMON_HEADER_SIZE
+ISIS_IIH_LAN_HEADER_SIZE
);
1955 pptr
= p
+ (ISIS_COMMON_HEADER_SIZE
+ISIS_IIH_LAN_HEADER_SIZE
);
1958 case ISIS_PDU_PTP_IIH
:
1959 if (isis_header
->fixed_len
!= (ISIS_COMMON_HEADER_SIZE
+ISIS_IIH_PTP_HEADER_SIZE
)) {
1960 printf(", bogus fixed header length %u should be %lu",
1961 isis_header
->fixed_len
, (unsigned long)ISIS_IIH_PTP_HEADER_SIZE
);
1965 pdu_len
=EXTRACT_16BITS(header_iih_ptp
->pdu_len
);
1966 if (packet_len
>pdu_len
) {
1967 packet_len
=pdu_len
; /* do TLV decoding as long as it makes sense */
1971 TCHECK(*header_iih_ptp
);
1972 printf("\n\t source-id: %s, holding time: %us, Flags: [%s]",
1973 isis_print_id(header_iih_ptp
->source_id
,SYSTEM_ID_LEN
),
1974 EXTRACT_16BITS(header_iih_ptp
->holding_time
),
1975 tok2str(isis_iih_circuit_type_values
,
1976 "unknown circuit type 0x%02x",
1977 header_iih_ptp
->circuit_type
));
1979 printf("\n\t circuit-id: 0x%02x, PDU length: %u",
1980 header_iih_ptp
->circuit_id
,
1984 if(!print_unknown_data(pptr
,"\n\t ",ISIS_IIH_PTP_HEADER_SIZE
))
1988 packet_len
-= (ISIS_COMMON_HEADER_SIZE
+ISIS_IIH_PTP_HEADER_SIZE
);
1989 pptr
= p
+ (ISIS_COMMON_HEADER_SIZE
+ISIS_IIH_PTP_HEADER_SIZE
);
1992 case ISIS_PDU_L1_LSP
:
1993 case ISIS_PDU_L2_LSP
:
1994 if (isis_header
->fixed_len
!= (ISIS_COMMON_HEADER_SIZE
+ISIS_LSP_HEADER_SIZE
)) {
1995 printf(", bogus fixed header length %u should be %lu",
1996 isis_header
->fixed_len
, (unsigned long)ISIS_LSP_HEADER_SIZE
);
2000 pdu_len
=EXTRACT_16BITS(header_lsp
->pdu_len
);
2001 if (packet_len
>pdu_len
) {
2002 packet_len
=pdu_len
; /* do TLV decoding as long as it makes sense */
2006 TCHECK(*header_lsp
);
2007 printf("\n\t lsp-id: %s, seq: 0x%08x, lifetime: %5us\n\t chksum: 0x%04x",
2008 isis_print_id(header_lsp
->lsp_id
, LSP_ID_LEN
),
2009 EXTRACT_32BITS(header_lsp
->sequence_number
),
2010 EXTRACT_16BITS(header_lsp
->remaining_lifetime
),
2011 EXTRACT_16BITS(header_lsp
->checksum
));
2013 /* if this is a purge do not attempt to verify the checksum */
2014 if ( EXTRACT_16BITS(header_lsp
->remaining_lifetime
) == 0 &&
2015 EXTRACT_16BITS(header_lsp
->checksum
) == 0)
2016 printf(" (purged)");
2018 /* verify the checksum -
2019 * checking starts at the lsp-id field at byte position [12]
2020 * hence the length needs to be reduced by 12 bytes */
2021 printf(" (%s)", (osi_cksum((u_int8_t
*)header_lsp
->lsp_id
, length
-12)) ? "incorrect" : "correct");
2023 printf(", PDU length: %u, Flags: [ %s",
2025 ISIS_MASK_LSP_OL_BIT(header_lsp
->typeblock
) ? "Overload bit set, " : "");
2027 if (ISIS_MASK_LSP_ATT_BITS(header_lsp
->typeblock
)) {
2028 printf("%s", ISIS_MASK_LSP_ATT_DEFAULT_BIT(header_lsp
->typeblock
) ? "default " : "");
2029 printf("%s", ISIS_MASK_LSP_ATT_DELAY_BIT(header_lsp
->typeblock
) ? "delay " : "");
2030 printf("%s", ISIS_MASK_LSP_ATT_EXPENSE_BIT(header_lsp
->typeblock
) ? "expense " : "");
2031 printf("%s", ISIS_MASK_LSP_ATT_ERROR_BIT(header_lsp
->typeblock
) ? "error " : "");
2032 printf("ATT bit set, ");
2034 printf("%s", ISIS_MASK_LSP_PARTITION_BIT(header_lsp
->typeblock
) ? "P bit set, " : "");
2035 printf("%s ]", tok2str(isis_lsp_istype_values
,"Unknown(0x%x)",ISIS_MASK_LSP_ISTYPE_BITS(header_lsp
->typeblock
)));
2038 if(!print_unknown_data(pptr
,"\n\t ",ISIS_LSP_HEADER_SIZE
))
2042 packet_len
-= (ISIS_COMMON_HEADER_SIZE
+ISIS_LSP_HEADER_SIZE
);
2043 pptr
= p
+ (ISIS_COMMON_HEADER_SIZE
+ISIS_LSP_HEADER_SIZE
);
2046 case ISIS_PDU_L1_CSNP
:
2047 case ISIS_PDU_L2_CSNP
:
2048 if (isis_header
->fixed_len
!= (ISIS_COMMON_HEADER_SIZE
+ISIS_CSNP_HEADER_SIZE
)) {
2049 printf(", bogus fixed header length %u should be %lu",
2050 isis_header
->fixed_len
, (unsigned long)ISIS_CSNP_HEADER_SIZE
);
2054 pdu_len
=EXTRACT_16BITS(header_csnp
->pdu_len
);
2055 if (packet_len
>pdu_len
) {
2056 packet_len
=pdu_len
; /* do TLV decoding as long as it makes sense */
2060 TCHECK(*header_csnp
);
2061 printf("\n\t source-id: %s, PDU length: %u",
2062 isis_print_id(header_csnp
->source_id
, NODE_ID_LEN
),
2064 printf("\n\t start lsp-id: %s",
2065 isis_print_id(header_csnp
->start_lsp_id
, LSP_ID_LEN
));
2066 printf("\n\t end lsp-id: %s",
2067 isis_print_id(header_csnp
->end_lsp_id
, LSP_ID_LEN
));
2070 if(!print_unknown_data(pptr
,"\n\t ",ISIS_CSNP_HEADER_SIZE
))
2074 packet_len
-= (ISIS_COMMON_HEADER_SIZE
+ISIS_CSNP_HEADER_SIZE
);
2075 pptr
= p
+ (ISIS_COMMON_HEADER_SIZE
+ISIS_CSNP_HEADER_SIZE
);
2078 case ISIS_PDU_L1_PSNP
:
2079 case ISIS_PDU_L2_PSNP
:
2080 if (isis_header
->fixed_len
!= (ISIS_COMMON_HEADER_SIZE
+ISIS_PSNP_HEADER_SIZE
)) {
2081 printf("- bogus fixed header length %u should be %lu",
2082 isis_header
->fixed_len
, (unsigned long)ISIS_PSNP_HEADER_SIZE
);
2086 pdu_len
=EXTRACT_16BITS(header_psnp
->pdu_len
);
2087 if (packet_len
>pdu_len
) {
2088 packet_len
=pdu_len
; /* do TLV decoding as long as it makes sense */
2092 TCHECK(*header_psnp
);
2093 printf("\n\t source-id: %s, PDU length: %u",
2094 isis_print_id(header_psnp
->source_id
, NODE_ID_LEN
),
2098 if(!print_unknown_data(pptr
,"\n\t ",ISIS_PSNP_HEADER_SIZE
))
2102 packet_len
-= (ISIS_COMMON_HEADER_SIZE
+ISIS_PSNP_HEADER_SIZE
);
2103 pptr
= p
+ (ISIS_COMMON_HEADER_SIZE
+ISIS_PSNP_HEADER_SIZE
);
2107 if(!print_unknown_data(pptr
,"\n\t ",length
))
2113 * Now print the TLV's.
2116 while (packet_len
>= 2) {
2117 if (pptr
== snapend
) {
2121 if (!TTEST2(*pptr
, 2)) {
2122 printf("\n\t\t packet exceeded snapshot (%ld) bytes",
2123 (long)(pptr
-snapend
));
2128 tmp
=tlv_len
; /* copy temporary len & pointer to packet data */
2131 if (tlv_len
> packet_len
) {
2135 /* first lets see if we know the TLVs name*/
2136 printf("\n\t %s TLV #%u, length: %u",
2137 tok2str(isis_tlv_values
,
2143 if (tlv_len
== 0) /* something is malformed */
2146 /* now check if we have a decoder otherwise do a hexdump at the end*/
2148 case ISIS_TLV_AREA_ADDR
:
2149 if (!TTEST2(*tptr
, 1))
2152 while (tmp
&& alen
< tmp
) {
2153 printf("\n\t Area address (length: %u): %s",
2155 isonsap_string(tptr
,alen
));
2158 if (tmp
==0) /* if this is the last area address do not attemt a boundary check */
2160 if (!TTEST2(*tptr
, 1))
2165 case ISIS_TLV_ISNEIGH
:
2166 while (tmp
>= ETHER_ADDR_LEN
) {
2167 if (!TTEST2(*tptr
, ETHER_ADDR_LEN
))
2169 printf("\n\t SNPA: %s",isis_print_id(tptr
,ETHER_ADDR_LEN
));
2170 tmp
-= ETHER_ADDR_LEN
;
2171 tptr
+= ETHER_ADDR_LEN
;
2175 case ISIS_TLV_ISNEIGH_VARLEN
:
2176 if (!TTEST2(*tptr
, 1) || tmp
< 3) /* min. TLV length */
2178 lan_alen
= *tptr
++; /* LAN address length */
2179 if (lan_alen
== 0) {
2180 printf("\n\t LAN address length 0 bytes (invalid)");
2184 printf("\n\t LAN address length %u bytes ",lan_alen
);
2185 while (tmp
>= lan_alen
) {
2186 if (!TTEST2(*tptr
, lan_alen
))
2188 printf("\n\t\tIS Neighbor: %s",isis_print_id(tptr
,lan_alen
));
2194 case ISIS_TLV_PADDING
:
2197 case ISIS_TLV_MT_IS_REACH
:
2198 while (tmp
>= 2+NODE_ID_LEN
+3+1) {
2199 mt_len
= isis_print_mtid(tptr
, "\n\t ");
2200 if (mt_len
== 0) /* did something go wrong ? */
2205 ext_is_len
= isis_print_ext_is_reach(tptr
,"\n\t ",tlv_type
);
2206 if (ext_is_len
== 0) /* did something go wrong ? */
2214 case ISIS_TLV_IS_ALIAS_ID
:
2215 while (tmp
>= NODE_ID_LEN
+1) { /* is it worth attempting a decode ? */
2216 ext_is_len
= isis_print_ext_is_reach(tptr
,"\n\t ",tlv_type
);
2217 if (ext_is_len
== 0) /* did something go wrong ? */
2224 case ISIS_TLV_EXT_IS_REACH
:
2225 while (tmp
>= NODE_ID_LEN
+3+1) { /* is it worth attempting a decode ? */
2226 ext_is_len
= isis_print_ext_is_reach(tptr
,"\n\t ",tlv_type
);
2227 if (ext_is_len
== 0) /* did something go wrong ? */
2233 case ISIS_TLV_IS_REACH
:
2234 if (!TTEST2(*tptr
,1)) /* check if there is one byte left to read out the virtual flag */
2237 tok2str(isis_is_reach_virtual_values
,
2238 "bogus virtual flag 0x%02x",
2240 tlv_is_reach
= (const struct isis_tlv_is_reach
*)tptr
;
2241 while (tmp
>= sizeof(struct isis_tlv_is_reach
)) {
2242 if (!TTEST(*tlv_is_reach
))
2244 printf("\n\t IS Neighbor: %s",
2245 isis_print_id(tlv_is_reach
->neighbor_nodeid
, NODE_ID_LEN
));
2246 isis_print_metric_block(&tlv_is_reach
->isis_metric_block
);
2247 tmp
-= sizeof(struct isis_tlv_is_reach
);
2252 case ISIS_TLV_ESNEIGH
:
2253 tlv_es_reach
= (const struct isis_tlv_es_reach
*)tptr
;
2254 while (tmp
>= sizeof(struct isis_tlv_es_reach
)) {
2255 if (!TTEST(*tlv_es_reach
))
2257 printf("\n\t ES Neighbor: %s",
2258 isis_print_id(tlv_es_reach
->neighbor_sysid
,SYSTEM_ID_LEN
));
2259 isis_print_metric_block(&tlv_es_reach
->isis_metric_block
);
2260 tmp
-= sizeof(struct isis_tlv_es_reach
);
2265 /* those two TLVs share the same format */
2266 case ISIS_TLV_INT_IP_REACH
:
2267 case ISIS_TLV_EXT_IP_REACH
:
2268 if (!isis_print_tlv_ip_reach(pptr
, "\n\t ", tlv_len
))
2272 case ISIS_TLV_EXTD_IP_REACH
:
2274 ext_ip_len
= isis_print_extd_ip_reach(tptr
, "\n\t ", AF_INET
);
2275 if (ext_ip_len
== 0) /* did something go wrong ? */
2282 case ISIS_TLV_MT_IP_REACH
:
2284 mt_len
= isis_print_mtid(tptr
, "\n\t ");
2285 if (mt_len
== 0) /* did something go wrong ? */
2290 ext_ip_len
= isis_print_extd_ip_reach(tptr
, "\n\t ", AF_INET
);
2291 if (ext_ip_len
== 0) /* did something go wrong ? */
2299 case ISIS_TLV_IP6_REACH
:
2301 ext_ip_len
= isis_print_extd_ip_reach(tptr
, "\n\t ", AF_INET6
);
2302 if (ext_ip_len
== 0) /* did something go wrong ? */
2309 case ISIS_TLV_MT_IP6_REACH
:
2311 mt_len
= isis_print_mtid(tptr
, "\n\t ");
2312 if (mt_len
== 0) /* did something go wrong ? */
2317 ext_ip_len
= isis_print_extd_ip_reach(tptr
, "\n\t ", AF_INET6
);
2318 if (ext_ip_len
== 0) /* did something go wrong ? */
2325 case ISIS_TLV_IP6ADDR
:
2326 while (tmp
>=sizeof(struct in6_addr
)) {
2327 if (!TTEST2(*tptr
, sizeof(struct in6_addr
)))
2330 printf("\n\t IPv6 interface address: %s",
2331 ip6addr_string(tptr
));
2333 tptr
+= sizeof(struct in6_addr
);
2334 tmp
-= sizeof(struct in6_addr
);
2339 if (!TTEST2(*tptr
, 1))
2343 tok2str(isis_subtlv_auth_values
,
2344 "unknown Authentication type 0x%02x",
2348 case ISIS_SUBTLV_AUTH_SIMPLE
:
2349 for(i
=1;i
<tlv_len
;i
++) {
2350 if (!TTEST2(*(tptr
+i
), 1))
2352 printf("%c",*(tptr
+i
));
2355 case ISIS_SUBTLV_AUTH_MD5
:
2356 for(i
=1;i
<tlv_len
;i
++) {
2357 if (!TTEST2(*(tptr
+i
), 1))
2359 printf("%02x",*(tptr
+i
));
2361 if (tlv_len
!= ISIS_SUBTLV_AUTH_MD5_LEN
+1)
2362 printf(", (malformed subTLV) ");
2364 case ISIS_SUBTLV_AUTH_PRIVATE
:
2366 if(!print_unknown_data(tptr
+1,"\n\t\t ",tlv_len
-1))
2372 case ISIS_TLV_PTP_ADJ
:
2373 tlv_ptp_adj
= (const struct isis_tlv_ptp_adj
*)tptr
;
2375 if (!TTEST2(*tptr
, 1))
2377 printf("\n\t Adjacency State: %s (%u)",
2378 tok2str(isis_ptp_adjancey_values
, "unknown", *tptr
),
2382 if(tmp
>sizeof(tlv_ptp_adj
->extd_local_circuit_id
)) {
2383 if (!TTEST2(tlv_ptp_adj
->extd_local_circuit_id
,
2384 sizeof(tlv_ptp_adj
->extd_local_circuit_id
)))
2386 printf("\n\t Extended Local circuit-ID: 0x%08x",
2387 EXTRACT_32BITS(tlv_ptp_adj
->extd_local_circuit_id
));
2388 tmp
-=sizeof(tlv_ptp_adj
->extd_local_circuit_id
);
2390 if(tmp
>=SYSTEM_ID_LEN
) {
2391 if (!TTEST2(tlv_ptp_adj
->neighbor_sysid
, SYSTEM_ID_LEN
))
2393 printf("\n\t Neighbor System-ID: %s",
2394 isis_print_id(tlv_ptp_adj
->neighbor_sysid
,SYSTEM_ID_LEN
));
2397 if(tmp
>=sizeof(tlv_ptp_adj
->neighbor_extd_local_circuit_id
)) {
2398 if (!TTEST2(tlv_ptp_adj
->neighbor_extd_local_circuit_id
,
2399 sizeof(tlv_ptp_adj
->neighbor_extd_local_circuit_id
)))
2401 printf("\n\t Neighbor Extended Local circuit-ID: 0x%08x",
2402 EXTRACT_32BITS(tlv_ptp_adj
->neighbor_extd_local_circuit_id
));
2406 case ISIS_TLV_PROTOCOLS
:
2407 printf("\n\t NLPID(s): ");
2409 if (!TTEST2(*(tptr
), 1))
2411 printf("%s (0x%02x)",
2412 tok2str(nlpid_values
,
2416 if (tmp
>1) /* further NPLIDs ? - put comma */
2423 case ISIS_TLV_TE_ROUTER_ID
:
2424 if (!TTEST2(*pptr
, sizeof(struct in_addr
)))
2426 printf("\n\t Traffic Engineering Router ID: %s", ipaddr_string(pptr
));
2429 case ISIS_TLV_IPADDR
:
2430 while (tmp
>=sizeof(struct in_addr
)) {
2431 if (!TTEST2(*tptr
, sizeof(struct in_addr
)))
2433 printf("\n\t IPv4 interface address: %s", ipaddr_string(tptr
));
2434 tptr
+= sizeof(struct in_addr
);
2435 tmp
-= sizeof(struct in_addr
);
2439 case ISIS_TLV_HOSTNAME
:
2440 printf("\n\t Hostname: ");
2442 if (!TTEST2(*tptr
, 1))
2444 printf("%c",*tptr
++);
2449 case ISIS_TLV_SHARED_RISK_GROUP
:
2450 if (tmp
< NODE_ID_LEN
)
2452 if (!TTEST2(*tptr
, NODE_ID_LEN
))
2454 printf("\n\t IS Neighbor: %s", isis_print_id(tptr
, NODE_ID_LEN
));
2455 tptr
+=(NODE_ID_LEN
);
2460 if (!TTEST2(*tptr
, 1))
2462 printf(", Flags: [%s]", ISIS_MASK_TLV_SHARED_RISK_GROUP(*tptr
++) ? "numbered" : "unnumbered");
2465 if (tmp
< sizeof(struct in_addr
))
2467 if (!TTEST2(*tptr
,sizeof(struct in_addr
)))
2469 printf("\n\t IPv4 interface address: %s", ipaddr_string(tptr
));
2470 tptr
+=sizeof(struct in_addr
);
2471 tmp
-=sizeof(struct in_addr
);
2473 if (tmp
< sizeof(struct in_addr
))
2475 if (!TTEST2(*tptr
,sizeof(struct in_addr
)))
2477 printf("\n\t IPv4 neighbor address: %s", ipaddr_string(tptr
));
2478 tptr
+=sizeof(struct in_addr
);
2479 tmp
-=sizeof(struct in_addr
);
2482 if (!TTEST2(*tptr
, 4))
2484 printf("\n\t Link-ID: 0x%08x", EXTRACT_32BITS(tptr
));
2491 tlv_lsp
= (const struct isis_tlv_lsp
*)tptr
;
2492 while(tmp
>=sizeof(struct isis_tlv_lsp
)) {
2493 if (!TTEST((tlv_lsp
->lsp_id
)[LSP_ID_LEN
-1]))
2495 printf("\n\t lsp-id: %s",
2496 isis_print_id(tlv_lsp
->lsp_id
, LSP_ID_LEN
));
2497 if (!TTEST2(tlv_lsp
->sequence_number
, 4))
2499 printf(", seq: 0x%08x",EXTRACT_32BITS(tlv_lsp
->sequence_number
));
2500 if (!TTEST2(tlv_lsp
->remaining_lifetime
, 2))
2502 printf(", lifetime: %5ds",EXTRACT_16BITS(tlv_lsp
->remaining_lifetime
));
2503 if (!TTEST2(tlv_lsp
->checksum
, 2))
2505 printf(", chksum: 0x%04x",EXTRACT_16BITS(tlv_lsp
->checksum
));
2506 tmp
-=sizeof(struct isis_tlv_lsp
);
2511 case ISIS_TLV_CHECKSUM
:
2512 if (tmp
< ISIS_TLV_CHECKSUM_MINLEN
)
2514 if (!TTEST2(*tptr
, ISIS_TLV_CHECKSUM_MINLEN
))
2516 printf("\n\t checksum: 0x%04x ", EXTRACT_16BITS(tptr
));
2517 /* do not attempt to verify the checksum if it is zero
2518 * most likely a HMAC-MD5 TLV is also present and
2519 * to avoid conflicts the checksum TLV is zeroed.
2520 * see rfc3358 for details
2522 if (EXTRACT_16BITS(tptr
) == 0)
2523 printf("(unverified)");
2524 else printf("(%s)", osi_cksum(optr
, length
) ? "incorrect" : "correct");
2527 case ISIS_TLV_MT_SUPPORTED
:
2528 if (tmp
< ISIS_TLV_MT_SUPPORTED_MINLEN
)
2531 /* length can only be a multiple of 2, otherwise there is
2532 something broken -> so decode down until length is 1 */
2534 mt_len
= isis_print_mtid(tptr
, "\n\t ");
2535 if (mt_len
== 0) /* did something go wrong ? */
2540 printf("\n\t malformed MT-ID");
2546 case ISIS_TLV_RESTART_SIGNALING
:
2547 /* first attempt to decode the flags */
2548 if (tmp
< ISIS_TLV_RESTART_SIGNALING_FLAGLEN
)
2550 if (!TTEST2(*tptr
, ISIS_TLV_RESTART_SIGNALING_FLAGLEN
))
2552 printf("\n\t Flags [%s]",
2553 bittok2str(isis_restart_flag_values
, "none", *tptr
));
2554 tptr
+=ISIS_TLV_RESTART_SIGNALING_FLAGLEN
;
2555 tmp
-=ISIS_TLV_RESTART_SIGNALING_FLAGLEN
;
2557 /* is there anything other than the flags field? */
2561 if (tmp
< ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN
)
2563 if (!TTEST2(*tptr
, ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN
))
2566 printf(", Remaining holding time %us", EXTRACT_16BITS(tptr
));
2567 tptr
+=ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN
;
2568 tmp
-=ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN
;
2570 /* is there an additional sysid field present ?*/
2571 if (tmp
== SYSTEM_ID_LEN
) {
2572 if (!TTEST2(*tptr
, SYSTEM_ID_LEN
))
2574 printf(", for %s",isis_print_id(tptr
,SYSTEM_ID_LEN
));
2578 case ISIS_TLV_IDRP_INFO
:
2579 if (tmp
< ISIS_TLV_IDRP_INFO_MINLEN
)
2581 if (!TTEST2(*tptr
, ISIS_TLV_IDRP_INFO_MINLEN
))
2583 printf("\n\t Inter-Domain Information Type: %s",
2584 tok2str(isis_subtlv_idrp_values
,
2588 case ISIS_SUBTLV_IDRP_ASN
:
2589 if (!TTEST2(*tptr
, 2)) /* fetch AS number */
2591 printf("AS Number: %u",EXTRACT_16BITS(tptr
));
2593 case ISIS_SUBTLV_IDRP_LOCAL
:
2594 case ISIS_SUBTLV_IDRP_RES
:
2596 if(!print_unknown_data(tptr
,"\n\t ",tlv_len
-1))
2602 case ISIS_TLV_LSP_BUFFERSIZE
:
2603 if (tmp
< ISIS_TLV_LSP_BUFFERSIZE_MINLEN
)
2605 if (!TTEST2(*tptr
, ISIS_TLV_LSP_BUFFERSIZE_MINLEN
))
2607 printf("\n\t LSP Buffersize: %u",EXTRACT_16BITS(tptr
));
2610 case ISIS_TLV_PART_DIS
:
2611 while (tmp
>= SYSTEM_ID_LEN
) {
2612 if (!TTEST2(*tptr
, SYSTEM_ID_LEN
))
2614 printf("\n\t %s",isis_print_id(tptr
,SYSTEM_ID_LEN
));
2615 tptr
+=SYSTEM_ID_LEN
;
2620 case ISIS_TLV_PREFIX_NEIGH
:
2621 if (tmp
< sizeof(struct isis_metric_block
))
2623 if (!TTEST2(*tptr
, sizeof(struct isis_metric_block
)))
2625 printf("\n\t Metric Block");
2626 isis_print_metric_block((const struct isis_metric_block
*)tptr
);
2627 tptr
+=sizeof(struct isis_metric_block
);
2628 tmp
-=sizeof(struct isis_metric_block
);
2631 if (!TTEST2(*tptr
, 1))
2633 prefix_len
=*tptr
++; /* read out prefix length in semioctets*/
2634 if (prefix_len
< 2) {
2635 printf("\n\t\tAddress: prefix length %u < 2", prefix_len
);
2639 if (tmp
< prefix_len
/2)
2641 if (!TTEST2(*tptr
, prefix_len
/2))
2643 printf("\n\t\tAddress: %s/%u",
2644 isonsap_string(tptr
,prefix_len
/2),
2651 case ISIS_TLV_IIH_SEQNR
:
2652 if (tmp
< ISIS_TLV_IIH_SEQNR_MINLEN
)
2654 if (!TTEST2(*tptr
, ISIS_TLV_IIH_SEQNR_MINLEN
)) /* check if four bytes are on the wire */
2656 printf("\n\t Sequence number: %u", EXTRACT_32BITS(tptr
) );
2659 case ISIS_TLV_VENDOR_PRIVATE
:
2660 if (tmp
< ISIS_TLV_VENDOR_PRIVATE_MINLEN
)
2662 if (!TTEST2(*tptr
, ISIS_TLV_VENDOR_PRIVATE_MINLEN
)) /* check if enough byte for a full oui */
2664 vendor_id
= EXTRACT_24BITS(tptr
);
2665 printf("\n\t Vendor: %s (%u)",
2666 tok2str(oui_values
,"Unknown",vendor_id
),
2670 if (tmp
> 0) /* hexdump the rest */
2671 if(!print_unknown_data(tptr
,"\n\t\t",tmp
))
2675 * FIXME those are the defined TLVs that lack a decoder
2676 * you are welcome to contribute code ;-)
2679 case ISIS_TLV_DECNET_PHASE4
:
2680 case ISIS_TLV_LUCENT_PRIVATE
:
2681 case ISIS_TLV_IPAUTH
:
2682 case ISIS_TLV_NORTEL_PRIVATE1
:
2683 case ISIS_TLV_NORTEL_PRIVATE2
:
2687 if(!print_unknown_data(pptr
,"\n\t\t",tlv_len
))
2692 /* do we want to see an additionally hexdump ? */
2694 if(!print_unknown_data(pptr
,"\n\t ",tlv_len
))
2699 packet_len
-= tlv_len
;
2702 if (packet_len
!= 0) {
2703 printf("\n\t %u straggler bytes", packet_len
);
2708 fputs("[|isis]", stdout
);
2712 printf("\n\t\t packet exceeded snapshot");
2717 * Verify the checksum. See 8473-1, Appendix C, section C.4.
2721 osi_cksum(const u_int8_t
*tptr
, u_int len
)
2723 int32_t c0
= 0, c1
= 0;
2725 while ((int)--len
>= 0) {
2737 * c-style: whitesmith