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@gredler.at) for more
24 * complete IS-IS & CLNP support.
27 /* \summary: ISO CLNS, ESIS, and ISIS printer */
33 #include <netdissect-stdinc.h>
37 #include "netdissect.h"
38 #include "addrtoname.h"
43 #include "signature.h"
45 static const char tstr
[] = " [|isis]";
48 * IS-IS is defined in ISO 10589. Look there for protocol definitions.
51 #define SYSTEM_ID_LEN MAC_ADDR_LEN
52 #define NODE_ID_LEN (SYSTEM_ID_LEN+1)
53 #define LSP_ID_LEN (SYSTEM_ID_LEN+2)
55 #define ISIS_VERSION 1
56 #define ESIS_VERSION 1
57 #define CLNP_VERSION 1
59 #define ISIS_PDU_TYPE_MASK 0x1F
60 #define ESIS_PDU_TYPE_MASK 0x1F
61 #define CLNP_PDU_TYPE_MASK 0x1F
62 #define CLNP_FLAG_MASK 0xE0
63 #define ISIS_LAN_PRIORITY_MASK 0x7F
65 #define ISIS_PDU_L1_LAN_IIH 15
66 #define ISIS_PDU_L2_LAN_IIH 16
67 #define ISIS_PDU_PTP_IIH 17
68 #define ISIS_PDU_L1_LSP 18
69 #define ISIS_PDU_L2_LSP 20
70 #define ISIS_PDU_L1_CSNP 24
71 #define ISIS_PDU_L2_CSNP 25
72 #define ISIS_PDU_L1_PSNP 26
73 #define ISIS_PDU_L2_PSNP 27
75 static const struct tok isis_pdu_values
[] = {
76 { ISIS_PDU_L1_LAN_IIH
, "L1 Lan IIH"},
77 { ISIS_PDU_L2_LAN_IIH
, "L2 Lan IIH"},
78 { ISIS_PDU_PTP_IIH
, "p2p IIH"},
79 { ISIS_PDU_L1_LSP
, "L1 LSP"},
80 { ISIS_PDU_L2_LSP
, "L2 LSP"},
81 { ISIS_PDU_L1_CSNP
, "L1 CSNP"},
82 { ISIS_PDU_L2_CSNP
, "L2 CSNP"},
83 { ISIS_PDU_L1_PSNP
, "L1 PSNP"},
84 { ISIS_PDU_L2_PSNP
, "L2 PSNP"},
89 * A TLV is a tuple of a type, length and a value and is normally used for
90 * encoding information in all sorts of places. This is an enumeration of
91 * the well known types.
93 * list taken from rfc3359 plus some memory from veterans ;-)
96 #define ISIS_TLV_AREA_ADDR 1 /* iso10589 */
97 #define ISIS_TLV_IS_REACH 2 /* iso10589 */
98 #define ISIS_TLV_ESNEIGH 3 /* iso10589 */
99 #define ISIS_TLV_PART_DIS 4 /* iso10589 */
100 #define ISIS_TLV_PREFIX_NEIGH 5 /* iso10589 */
101 #define ISIS_TLV_ISNEIGH 6 /* iso10589 */
102 #define ISIS_TLV_ISNEIGH_VARLEN 7 /* iso10589 */
103 #define ISIS_TLV_PADDING 8 /* iso10589 */
104 #define ISIS_TLV_LSP 9 /* iso10589 */
105 #define ISIS_TLV_AUTH 10 /* iso10589, rfc3567 */
106 #define ISIS_TLV_CHECKSUM 12 /* rfc3358 */
107 #define ISIS_TLV_CHECKSUM_MINLEN 2
108 #define ISIS_TLV_POI 13 /* rfc6232 */
109 #define ISIS_TLV_LSP_BUFFERSIZE 14 /* iso10589 rev2 */
110 #define ISIS_TLV_LSP_BUFFERSIZE_MINLEN 2
111 #define ISIS_TLV_EXT_IS_REACH 22 /* rfc5305 */
112 #define ISIS_TLV_IS_ALIAS_ID 24 /* draft-ietf-isis-ext-lsp-frags-02 */
113 #define ISIS_TLV_DECNET_PHASE4 42
114 #define ISIS_TLV_LUCENT_PRIVATE 66
115 #define ISIS_TLV_INT_IP_REACH 128 /* rfc1195, rfc2966 */
116 #define ISIS_TLV_PROTOCOLS 129 /* rfc1195 */
117 #define ISIS_TLV_EXT_IP_REACH 130 /* rfc1195, rfc2966 */
118 #define ISIS_TLV_IDRP_INFO 131 /* rfc1195 */
119 #define ISIS_TLV_IDRP_INFO_MINLEN 1
120 #define ISIS_TLV_IPADDR 132 /* rfc1195 */
121 #define ISIS_TLV_IPAUTH 133 /* rfc1195 */
122 #define ISIS_TLV_TE_ROUTER_ID 134 /* rfc5305 */
123 #define ISIS_TLV_EXTD_IP_REACH 135 /* rfc5305 */
124 #define ISIS_TLV_HOSTNAME 137 /* rfc2763 */
125 #define ISIS_TLV_SHARED_RISK_GROUP 138 /* draft-ietf-isis-gmpls-extensions */
126 #define ISIS_TLV_MT_PORT_CAP 143 /* rfc6165 */
127 #define ISIS_TLV_MT_CAPABILITY 144 /* rfc6329 */
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 const 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_POI
, "Purge Originator Identifier"},
159 { ISIS_TLV_LSP_BUFFERSIZE
, "LSP Buffersize"},
160 { ISIS_TLV_EXT_IS_REACH
, "Extended IS Reachability"},
161 { ISIS_TLV_IS_ALIAS_ID
, "IS Alias ID"},
162 { ISIS_TLV_DECNET_PHASE4
, "DECnet Phase IV"},
163 { ISIS_TLV_LUCENT_PRIVATE
, "Lucent Proprietary"},
164 { ISIS_TLV_INT_IP_REACH
, "IPv4 Internal Reachability"},
165 { ISIS_TLV_PROTOCOLS
, "Protocols supported"},
166 { ISIS_TLV_EXT_IP_REACH
, "IPv4 External Reachability"},
167 { ISIS_TLV_IDRP_INFO
, "Inter-Domain Information Type"},
168 { ISIS_TLV_IPADDR
, "IPv4 Interface address(es)"},
169 { ISIS_TLV_IPAUTH
, "IPv4 authentication (deprecated)"},
170 { ISIS_TLV_TE_ROUTER_ID
, "Traffic Engineering Router ID"},
171 { ISIS_TLV_EXTD_IP_REACH
, "Extended IPv4 Reachability"},
172 { ISIS_TLV_SHARED_RISK_GROUP
, "Shared Risk Link Group"},
173 { ISIS_TLV_MT_PORT_CAP
, "Multi-Topology-Aware Port Capability"},
174 { ISIS_TLV_MT_CAPABILITY
, "Multi-Topology Capability"},
175 { ISIS_TLV_NORTEL_PRIVATE1
, "Nortel Proprietary"},
176 { ISIS_TLV_NORTEL_PRIVATE2
, "Nortel Proprietary"},
177 { ISIS_TLV_HOSTNAME
, "Hostname"},
178 { ISIS_TLV_RESTART_SIGNALING
, "Restart Signaling"},
179 { ISIS_TLV_MT_IS_REACH
, "Multi Topology IS Reachability"},
180 { ISIS_TLV_MT_SUPPORTED
, "Multi Topology"},
181 { ISIS_TLV_IP6ADDR
, "IPv6 Interface address(es)"},
182 { ISIS_TLV_MT_IP_REACH
, "Multi-Topology IPv4 Reachability"},
183 { ISIS_TLV_IP6_REACH
, "IPv6 reachability"},
184 { ISIS_TLV_MT_IP6_REACH
, "Multi-Topology IP6 Reachability"},
185 { ISIS_TLV_PTP_ADJ
, "Point-to-point Adjacency State"},
186 { ISIS_TLV_IIH_SEQNR
, "Hello PDU Sequence Number"},
187 { ISIS_TLV_VENDOR_PRIVATE
, "Vendor Private"},
191 #define ESIS_OPTION_PROTOCOLS 129
192 #define ESIS_OPTION_QOS_MAINTENANCE 195 /* iso9542 */
193 #define ESIS_OPTION_SECURITY 197 /* iso9542 */
194 #define ESIS_OPTION_ES_CONF_TIME 198 /* iso9542 */
195 #define ESIS_OPTION_PRIORITY 205 /* iso9542 */
196 #define ESIS_OPTION_ADDRESS_MASK 225 /* iso9542 */
197 #define ESIS_OPTION_SNPA_MASK 226 /* iso9542 */
199 static const struct tok esis_option_values
[] = {
200 { ESIS_OPTION_PROTOCOLS
, "Protocols supported"},
201 { ESIS_OPTION_QOS_MAINTENANCE
, "QoS Maintenance" },
202 { ESIS_OPTION_SECURITY
, "Security" },
203 { ESIS_OPTION_ES_CONF_TIME
, "ES Configuration Time" },
204 { ESIS_OPTION_PRIORITY
, "Priority" },
205 { ESIS_OPTION_ADDRESS_MASK
, "Addressk Mask" },
206 { ESIS_OPTION_SNPA_MASK
, "SNPA Mask" },
210 #define CLNP_OPTION_DISCARD_REASON 193
211 #define CLNP_OPTION_QOS_MAINTENANCE 195 /* iso8473 */
212 #define CLNP_OPTION_SECURITY 197 /* iso8473 */
213 #define CLNP_OPTION_SOURCE_ROUTING 200 /* iso8473 */
214 #define CLNP_OPTION_ROUTE_RECORDING 203 /* iso8473 */
215 #define CLNP_OPTION_PADDING 204 /* iso8473 */
216 #define CLNP_OPTION_PRIORITY 205 /* iso8473 */
218 static const struct tok clnp_option_values
[] = {
219 { CLNP_OPTION_DISCARD_REASON
, "Discard Reason"},
220 { CLNP_OPTION_PRIORITY
, "Priority"},
221 { CLNP_OPTION_QOS_MAINTENANCE
, "QoS Maintenance"},
222 { CLNP_OPTION_SECURITY
, "Security"},
223 { CLNP_OPTION_SOURCE_ROUTING
, "Source Routing"},
224 { CLNP_OPTION_ROUTE_RECORDING
, "Route Recording"},
225 { CLNP_OPTION_PADDING
, "Padding"},
229 static const struct tok clnp_option_rfd_class_values
[] = {
232 { 0x9, "Source Routeing"},
234 { 0xb, "PDU Discarded"},
235 { 0xc, "Reassembly"},
239 static const struct tok clnp_option_rfd_general_values
[] = {
240 { 0x0, "Reason not specified"},
241 { 0x1, "Protocol procedure error"},
242 { 0x2, "Incorrect checksum"},
243 { 0x3, "PDU discarded due to congestion"},
244 { 0x4, "Header syntax error (cannot be parsed)"},
245 { 0x5, "Segmentation needed but not permitted"},
246 { 0x6, "Incomplete PDU received"},
247 { 0x7, "Duplicate option"},
251 static const struct tok clnp_option_rfd_address_values
[] = {
252 { 0x0, "Destination address unreachable"},
253 { 0x1, "Destination address unknown"},
257 static const struct tok clnp_option_rfd_source_routeing_values
[] = {
258 { 0x0, "Unspecified source routeing error"},
259 { 0x1, "Syntax error in source routeing field"},
260 { 0x2, "Unknown address in source routeing field"},
261 { 0x3, "Path not acceptable"},
265 static const struct tok clnp_option_rfd_lifetime_values
[] = {
266 { 0x0, "Lifetime expired while data unit in transit"},
267 { 0x1, "Lifetime expired during reassembly"},
271 static const struct tok clnp_option_rfd_pdu_discard_values
[] = {
272 { 0x0, "Unsupported option not specified"},
273 { 0x1, "Unsupported protocol version"},
274 { 0x2, "Unsupported security option"},
275 { 0x3, "Unsupported source routeing option"},
276 { 0x4, "Unsupported recording of route option"},
280 static const struct tok clnp_option_rfd_reassembly_values
[] = {
281 { 0x0, "Reassembly interference"},
285 /* array of 16 error-classes */
286 static const struct tok
*clnp_option_rfd_error_class
[] = {
287 clnp_option_rfd_general_values
,
295 clnp_option_rfd_address_values
,
296 clnp_option_rfd_source_routeing_values
,
297 clnp_option_rfd_lifetime_values
,
298 clnp_option_rfd_pdu_discard_values
,
299 clnp_option_rfd_reassembly_values
,
305 #define CLNP_OPTION_OPTION_QOS_MASK 0x3f
306 #define CLNP_OPTION_SCOPE_MASK 0xc0
307 #define CLNP_OPTION_SCOPE_SA_SPEC 0x40
308 #define CLNP_OPTION_SCOPE_DA_SPEC 0x80
309 #define CLNP_OPTION_SCOPE_GLOBAL 0xc0
311 static const struct tok clnp_option_scope_values
[] = {
312 { CLNP_OPTION_SCOPE_SA_SPEC
, "Source Address Specific"},
313 { CLNP_OPTION_SCOPE_DA_SPEC
, "Destination Address Specific"},
314 { CLNP_OPTION_SCOPE_GLOBAL
, "Globally unique"},
318 static const struct tok clnp_option_sr_rr_values
[] = {
324 static const struct tok clnp_option_sr_rr_string_values
[] = {
325 { CLNP_OPTION_SOURCE_ROUTING
, "source routing"},
326 { CLNP_OPTION_ROUTE_RECORDING
, "recording of route in progress"},
330 static const struct tok clnp_option_qos_global_values
[] = {
332 { 0x10, "sequencing vs. delay"},
333 { 0x08, "congested"},
334 { 0x04, "delay vs. cost"},
335 { 0x02, "error vs. delay"},
336 { 0x01, "error vs. cost"},
340 #define ISIS_SUBTLV_EXT_IS_REACH_ADMIN_GROUP 3 /* rfc5305 */
341 #define ISIS_SUBTLV_EXT_IS_REACH_LINK_LOCAL_REMOTE_ID 4 /* rfc4205 */
342 #define ISIS_SUBTLV_EXT_IS_REACH_LINK_REMOTE_ID 5 /* rfc5305 */
343 #define ISIS_SUBTLV_EXT_IS_REACH_IPV4_INTF_ADDR 6 /* rfc5305 */
344 #define ISIS_SUBTLV_EXT_IS_REACH_IPV4_NEIGHBOR_ADDR 8 /* rfc5305 */
345 #define ISIS_SUBTLV_EXT_IS_REACH_MAX_LINK_BW 9 /* rfc5305 */
346 #define ISIS_SUBTLV_EXT_IS_REACH_RESERVABLE_BW 10 /* rfc5305 */
347 #define ISIS_SUBTLV_EXT_IS_REACH_UNRESERVED_BW 11 /* rfc4124 */
348 #define ISIS_SUBTLV_EXT_IS_REACH_BW_CONSTRAINTS_OLD 12 /* draft-ietf-tewg-diff-te-proto-06 */
349 #define ISIS_SUBTLV_EXT_IS_REACH_TE_METRIC 18 /* rfc5305 */
350 #define ISIS_SUBTLV_EXT_IS_REACH_LINK_ATTRIBUTE 19 /* draft-ietf-isis-link-attr-01 */
351 #define ISIS_SUBTLV_EXT_IS_REACH_LINK_PROTECTION_TYPE 20 /* rfc4205 */
352 #define ISIS_SUBTLV_EXT_IS_REACH_INTF_SW_CAP_DESCR 21 /* rfc4205 */
353 #define ISIS_SUBTLV_EXT_IS_REACH_BW_CONSTRAINTS 22 /* rfc4124 */
355 #define ISIS_SUBTLV_SPB_METRIC 29 /* rfc6329 */
357 static const struct tok isis_ext_is_reach_subtlv_values
[] = {
358 { ISIS_SUBTLV_EXT_IS_REACH_ADMIN_GROUP
, "Administrative groups" },
359 { ISIS_SUBTLV_EXT_IS_REACH_LINK_LOCAL_REMOTE_ID
, "Link Local/Remote Identifier" },
360 { ISIS_SUBTLV_EXT_IS_REACH_LINK_REMOTE_ID
, "Link Remote Identifier" },
361 { ISIS_SUBTLV_EXT_IS_REACH_IPV4_INTF_ADDR
, "IPv4 interface address" },
362 { ISIS_SUBTLV_EXT_IS_REACH_IPV4_NEIGHBOR_ADDR
, "IPv4 neighbor address" },
363 { ISIS_SUBTLV_EXT_IS_REACH_MAX_LINK_BW
, "Maximum link bandwidth" },
364 { ISIS_SUBTLV_EXT_IS_REACH_RESERVABLE_BW
, "Reservable link bandwidth" },
365 { ISIS_SUBTLV_EXT_IS_REACH_UNRESERVED_BW
, "Unreserved bandwidth" },
366 { ISIS_SUBTLV_EXT_IS_REACH_TE_METRIC
, "Traffic Engineering Metric" },
367 { ISIS_SUBTLV_EXT_IS_REACH_LINK_ATTRIBUTE
, "Link Attribute" },
368 { ISIS_SUBTLV_EXT_IS_REACH_LINK_PROTECTION_TYPE
, "Link Protection Type" },
369 { ISIS_SUBTLV_EXT_IS_REACH_INTF_SW_CAP_DESCR
, "Interface Switching Capability" },
370 { ISIS_SUBTLV_EXT_IS_REACH_BW_CONSTRAINTS_OLD
, "Bandwidth Constraints (old)" },
371 { ISIS_SUBTLV_EXT_IS_REACH_BW_CONSTRAINTS
, "Bandwidth Constraints" },
372 { ISIS_SUBTLV_SPB_METRIC
, "SPB Metric" },
373 { 250, "Reserved for cisco specific extensions" },
374 { 251, "Reserved for cisco specific extensions" },
375 { 252, "Reserved for cisco specific extensions" },
376 { 253, "Reserved for cisco specific extensions" },
377 { 254, "Reserved for cisco specific extensions" },
378 { 255, "Reserved for future expansion" },
382 #define ISIS_SUBTLV_EXTD_IP_REACH_ADMIN_TAG32 1 /* draft-ietf-isis-admin-tags-01 */
383 #define ISIS_SUBTLV_EXTD_IP_REACH_ADMIN_TAG64 2 /* draft-ietf-isis-admin-tags-01 */
384 #define ISIS_SUBTLV_EXTD_IP_REACH_MGMT_PREFIX_COLOR 117 /* draft-ietf-isis-wg-multi-topology-05 */
386 static const struct tok isis_ext_ip_reach_subtlv_values
[] = {
387 { ISIS_SUBTLV_EXTD_IP_REACH_ADMIN_TAG32
, "32-Bit Administrative tag" },
388 { ISIS_SUBTLV_EXTD_IP_REACH_ADMIN_TAG64
, "64-Bit Administrative tag" },
389 { ISIS_SUBTLV_EXTD_IP_REACH_MGMT_PREFIX_COLOR
, "Management Prefix Color" },
393 static const struct tok isis_subtlv_link_attribute_values
[] = {
394 { 0x01, "Local Protection Available" },
395 { 0x02, "Link excluded from local protection path" },
396 { 0x04, "Local maintenance required"},
400 #define ISIS_SUBTLV_AUTH_SIMPLE 1
401 #define ISIS_SUBTLV_AUTH_GENERIC 3 /* rfc 5310 */
402 #define ISIS_SUBTLV_AUTH_MD5 54
403 #define ISIS_SUBTLV_AUTH_MD5_LEN 16
404 #define ISIS_SUBTLV_AUTH_PRIVATE 255
406 static const struct tok isis_subtlv_auth_values
[] = {
407 { ISIS_SUBTLV_AUTH_SIMPLE
, "simple text password"},
408 { ISIS_SUBTLV_AUTH_GENERIC
, "Generic Crypto key-id"},
409 { ISIS_SUBTLV_AUTH_MD5
, "HMAC-MD5 password"},
410 { ISIS_SUBTLV_AUTH_PRIVATE
, "Routing Domain private password"},
414 #define ISIS_SUBTLV_IDRP_RES 0
415 #define ISIS_SUBTLV_IDRP_LOCAL 1
416 #define ISIS_SUBTLV_IDRP_ASN 2
418 static const struct tok isis_subtlv_idrp_values
[] = {
419 { ISIS_SUBTLV_IDRP_RES
, "Reserved"},
420 { ISIS_SUBTLV_IDRP_LOCAL
, "Routing-Domain Specific"},
421 { ISIS_SUBTLV_IDRP_ASN
, "AS Number Tag"},
425 #define ISIS_SUBTLV_SPB_MCID 4
426 #define ISIS_SUBTLV_SPB_DIGEST 5
427 #define ISIS_SUBTLV_SPB_BVID 6
429 #define ISIS_SUBTLV_SPB_INSTANCE 1
430 #define ISIS_SUBTLV_SPBM_SI 3
432 #define ISIS_SPB_MCID_LEN 51
433 #define ISIS_SUBTLV_SPB_MCID_MIN_LEN 102
434 #define ISIS_SUBTLV_SPB_DIGEST_MIN_LEN 33
435 #define ISIS_SUBTLV_SPB_BVID_MIN_LEN 6
436 #define ISIS_SUBTLV_SPB_INSTANCE_MIN_LEN 19
437 #define ISIS_SUBTLV_SPB_INSTANCE_VLAN_TUPLE_LEN 8
439 static const struct tok isis_mt_port_cap_subtlv_values
[] = {
440 { ISIS_SUBTLV_SPB_MCID
, "SPB MCID" },
441 { ISIS_SUBTLV_SPB_DIGEST
, "SPB Digest" },
442 { ISIS_SUBTLV_SPB_BVID
, "SPB BVID" },
446 static const struct tok isis_mt_capability_subtlv_values
[] = {
447 { ISIS_SUBTLV_SPB_INSTANCE
, "SPB Instance" },
448 { ISIS_SUBTLV_SPBM_SI
, "SPBM Service Identifier and Unicast Address" },
452 struct isis_spb_mcid
{
455 uint8_t revision_lvl
[2];
459 struct isis_subtlv_spb_mcid
{
460 struct isis_spb_mcid mcid
;
461 struct isis_spb_mcid aux_mcid
;
464 struct isis_subtlv_spb_instance
{
465 uint8_t cist_root_id
[8];
466 uint8_t cist_external_root_path_cost
[4];
467 uint8_t bridge_priority
[2];
468 uint8_t spsourceid
[4];
472 #define CLNP_SEGMENT_PART 0x80
473 #define CLNP_MORE_SEGMENTS 0x40
474 #define CLNP_REQUEST_ER 0x20
476 static const struct tok clnp_flag_values
[] = {
477 { CLNP_SEGMENT_PART
, "Segmentation permitted"},
478 { CLNP_MORE_SEGMENTS
, "more Segments"},
479 { CLNP_REQUEST_ER
, "request Error Report"},
483 #define ISIS_MASK_LSP_OL_BIT(x) ((x)&0x4)
484 #define ISIS_MASK_LSP_ISTYPE_BITS(x) ((x)&0x3)
485 #define ISIS_MASK_LSP_PARTITION_BIT(x) ((x)&0x80)
486 #define ISIS_MASK_LSP_ATT_BITS(x) ((x)&0x78)
487 #define ISIS_MASK_LSP_ATT_ERROR_BIT(x) ((x)&0x40)
488 #define ISIS_MASK_LSP_ATT_EXPENSE_BIT(x) ((x)&0x20)
489 #define ISIS_MASK_LSP_ATT_DELAY_BIT(x) ((x)&0x10)
490 #define ISIS_MASK_LSP_ATT_DEFAULT_BIT(x) ((x)&0x8)
492 #define ISIS_MASK_MTID(x) ((x)&0x0fff)
493 #define ISIS_MASK_MTFLAGS(x) ((x)&0xf000)
495 static const struct tok isis_mt_flag_values
[] = {
496 { 0x4000, "ATT bit set"},
497 { 0x8000, "Overload bit set"},
501 #define ISIS_MASK_TLV_EXTD_IP_UPDOWN(x) ((x)&0x80)
502 #define ISIS_MASK_TLV_EXTD_IP_SUBTLV(x) ((x)&0x40)
504 #define ISIS_MASK_TLV_EXTD_IP6_IE(x) ((x)&0x40)
505 #define ISIS_MASK_TLV_EXTD_IP6_SUBTLV(x) ((x)&0x20)
507 #define ISIS_LSP_TLV_METRIC_SUPPORTED(x) ((x)&0x80)
508 #define ISIS_LSP_TLV_METRIC_IE(x) ((x)&0x40)
509 #define ISIS_LSP_TLV_METRIC_UPDOWN(x) ((x)&0x80)
510 #define ISIS_LSP_TLV_METRIC_VALUE(x) ((x)&0x3f)
512 #define ISIS_MASK_TLV_SHARED_RISK_GROUP(x) ((x)&0x1)
514 static const struct tok isis_mt_values
[] = {
515 { 0, "IPv4 unicast"},
516 { 1, "In-Band Management"},
517 { 2, "IPv6 unicast"},
519 { 4095, "Development, Experimental or Proprietary"},
523 static const struct tok isis_iih_circuit_type_values
[] = {
524 { 1, "Level 1 only"},
525 { 2, "Level 2 only"},
526 { 3, "Level 1, Level 2"},
530 #define ISIS_LSP_TYPE_UNUSED0 0
531 #define ISIS_LSP_TYPE_LEVEL_1 1
532 #define ISIS_LSP_TYPE_UNUSED2 2
533 #define ISIS_LSP_TYPE_LEVEL_2 3
535 static const struct tok isis_lsp_istype_values
[] = {
536 { ISIS_LSP_TYPE_UNUSED0
, "Unused 0x0 (invalid)"},
537 { ISIS_LSP_TYPE_LEVEL_1
, "L1 IS"},
538 { ISIS_LSP_TYPE_UNUSED2
, "Unused 0x2 (invalid)"},
539 { ISIS_LSP_TYPE_LEVEL_2
, "L2 IS"},
544 * Katz's point to point adjacency TLV uses codes to tell us the state of
545 * the remote adjacency. Enumerate them.
548 #define ISIS_PTP_ADJ_UP 0
549 #define ISIS_PTP_ADJ_INIT 1
550 #define ISIS_PTP_ADJ_DOWN 2
552 static const struct tok isis_ptp_adjancey_values
[] = {
553 { ISIS_PTP_ADJ_UP
, "Up" },
554 { ISIS_PTP_ADJ_INIT
, "Initializing" },
555 { ISIS_PTP_ADJ_DOWN
, "Down" },
559 struct isis_tlv_ptp_adj
{
560 uint8_t adjacency_state
;
561 uint8_t extd_local_circuit_id
[4];
562 uint8_t neighbor_sysid
[SYSTEM_ID_LEN
];
563 uint8_t neighbor_extd_local_circuit_id
[4];
566 static void osi_print_cksum(netdissect_options
*, const uint8_t *pptr
,
567 uint16_t checksum
, int checksum_offset
, u_int length
);
568 static int clnp_print(netdissect_options
*, const uint8_t *, u_int
);
569 static void esis_print(netdissect_options
*, const uint8_t *, u_int
);
570 static int isis_print(netdissect_options
*, const uint8_t *, u_int
);
572 struct isis_metric_block
{
573 uint8_t metric_default
;
574 uint8_t metric_delay
;
575 uint8_t metric_expense
;
576 uint8_t metric_error
;
579 struct isis_tlv_is_reach
{
580 struct isis_metric_block isis_metric_block
;
581 uint8_t neighbor_nodeid
[NODE_ID_LEN
];
584 struct isis_tlv_es_reach
{
585 struct isis_metric_block isis_metric_block
;
586 uint8_t neighbor_sysid
[SYSTEM_ID_LEN
];
589 struct isis_tlv_ip_reach
{
590 struct isis_metric_block isis_metric_block
;
595 static const struct tok isis_is_reach_virtual_values
[] = {
596 { 0, "IsNotVirtual"},
601 static const struct tok isis_restart_flag_values
[] = {
602 { 0x1, "Restart Request"},
603 { 0x2, "Restart Acknowledgement"},
604 { 0x4, "Suppress adjacency advertisement"},
608 struct isis_common_header
{
611 uint8_t version
; /* Protocol version */
613 uint8_t pdu_type
; /* 3 MSbits are reserved */
614 uint8_t pdu_version
; /* Packet format version */
619 struct isis_iih_lan_header
{
620 uint8_t circuit_type
;
621 uint8_t source_id
[SYSTEM_ID_LEN
];
622 uint8_t holding_time
[2];
625 uint8_t lan_id
[NODE_ID_LEN
];
628 struct isis_iih_ptp_header
{
629 uint8_t circuit_type
;
630 uint8_t source_id
[SYSTEM_ID_LEN
];
631 uint8_t holding_time
[2];
636 struct isis_lsp_header
{
638 uint8_t remaining_lifetime
[2];
639 uint8_t lsp_id
[LSP_ID_LEN
];
640 uint8_t sequence_number
[4];
645 struct isis_csnp_header
{
647 uint8_t source_id
[NODE_ID_LEN
];
648 uint8_t start_lsp_id
[LSP_ID_LEN
];
649 uint8_t end_lsp_id
[LSP_ID_LEN
];
652 struct isis_psnp_header
{
654 uint8_t source_id
[NODE_ID_LEN
];
657 struct isis_tlv_lsp
{
658 uint8_t remaining_lifetime
[2];
659 uint8_t lsp_id
[LSP_ID_LEN
];
660 uint8_t sequence_number
[4];
664 #define ISIS_COMMON_HEADER_SIZE (sizeof(struct isis_common_header))
665 #define ISIS_IIH_LAN_HEADER_SIZE (sizeof(struct isis_iih_lan_header))
666 #define ISIS_IIH_PTP_HEADER_SIZE (sizeof(struct isis_iih_ptp_header))
667 #define ISIS_LSP_HEADER_SIZE (sizeof(struct isis_lsp_header))
668 #define ISIS_CSNP_HEADER_SIZE (sizeof(struct isis_csnp_header))
669 #define ISIS_PSNP_HEADER_SIZE (sizeof(struct isis_psnp_header))
672 isoclns_print(netdissect_options
*ndo
, const uint8_t *p
, u_int length
)
674 if (!ND_TTEST_1(p
)) { /* enough bytes on the wire ? */
675 ND_PRINT((ndo
, "|OSI"));
680 ND_PRINT((ndo
, "OSI NLPID %s (0x%02x): ", tok2str(nlpid_values
, "Unknown", EXTRACT_U_1(p
)), EXTRACT_U_1(p
)));
682 switch (EXTRACT_U_1(p
)) {
685 if (!clnp_print(ndo
, p
, length
))
686 print_unknown_data(ndo
, p
, "\n\t", length
);
690 esis_print(ndo
, p
, length
);
694 if (!isis_print(ndo
, p
, length
))
695 print_unknown_data(ndo
, p
, "\n\t", length
);
699 ND_PRINT((ndo
, "%slength: %u", ndo
->ndo_eflag
? "" : ", ", length
));
703 q933_print(ndo
, p
+ 1, length
- 1);
707 ip_print(ndo
, p
+ 1, length
- 1);
711 ip6_print(ndo
, p
+ 1, length
- 1);
715 ppp_print(ndo
, p
+ 1, length
- 1);
720 ND_PRINT((ndo
, "OSI NLPID 0x%02x unknown", EXTRACT_U_1(p
)));
721 ND_PRINT((ndo
, "%slength: %u", ndo
->ndo_eflag
? "" : ", ", length
));
723 print_unknown_data(ndo
, p
, "\n\t", length
);
728 #define CLNP_PDU_ER 1
729 #define CLNP_PDU_DT 28
730 #define CLNP_PDU_MD 29
731 #define CLNP_PDU_ERQ 30
732 #define CLNP_PDU_ERP 31
734 static const struct tok clnp_pdu_values
[] = {
735 { CLNP_PDU_ER
, "Error Report"},
736 { CLNP_PDU_MD
, "MD"},
737 { CLNP_PDU_DT
, "Data"},
738 { CLNP_PDU_ERQ
, "Echo Request"},
739 { CLNP_PDU_ERP
, "Echo Response"},
743 struct clnp_header_t
{
745 uint8_t length_indicator
;
747 uint8_t lifetime
; /* units of 500ms */
749 uint8_t segment_length
[2];
753 struct clnp_segment_header_t
{
754 uint8_t data_unit_id
[2];
755 uint8_t segment_offset
[2];
756 uint8_t total_length
[2];
761 * Decode CLNP packets. Return 0 on error.
765 clnp_print(netdissect_options
*ndo
,
766 const uint8_t *pptr
, u_int length
)
768 const uint8_t *optr
,*source_address
,*dest_address
;
769 u_int li
,tlen
,nsap_offset
,source_address_length
,dest_address_length
, clnp_pdu_type
, clnp_flags
;
770 const struct clnp_header_t
*clnp_header
;
771 const struct clnp_segment_header_t
*clnp_segment_header
;
772 uint8_t rfd_error
,rfd_error_major
,rfd_error_minor
;
774 clnp_header
= (const struct clnp_header_t
*) pptr
;
775 ND_TCHECK(*clnp_header
);
777 li
= clnp_header
->length_indicator
;
781 ND_PRINT((ndo
, "CLNP"));
784 * Sanity checking of the header.
787 if (clnp_header
->version
!= CLNP_VERSION
) {
788 ND_PRINT((ndo
, "version %d packet not supported", clnp_header
->version
));
793 ND_PRINT((ndo
, " length indicator(%u) > PDU size (%u)!", li
, length
));
797 if (li
< sizeof(struct clnp_header_t
)) {
798 ND_PRINT((ndo
, " length indicator %u < min PDU size:", li
));
799 while (pptr
< ndo
->ndo_snapend
) {
800 ND_PRINT((ndo
, "%02X", EXTRACT_U_1(pptr
)));
806 /* FIXME further header sanity checking */
808 clnp_pdu_type
= clnp_header
->type
& CLNP_PDU_TYPE_MASK
;
809 clnp_flags
= clnp_header
->type
& CLNP_FLAG_MASK
;
811 pptr
+= sizeof(struct clnp_header_t
);
812 li
-= sizeof(struct clnp_header_t
);
815 ND_PRINT((ndo
, "li < size of fixed part of CLNP header and addresses"));
819 dest_address_length
= EXTRACT_U_1(pptr
);
822 if (li
< dest_address_length
) {
823 ND_PRINT((ndo
, "li < size of fixed part of CLNP header and addresses"));
826 ND_TCHECK_LEN(pptr
, dest_address_length
);
828 pptr
+= dest_address_length
;
829 li
-= dest_address_length
;
832 ND_PRINT((ndo
, "li < size of fixed part of CLNP header and addresses"));
836 source_address_length
= EXTRACT_U_1(pptr
);
839 if (li
< source_address_length
) {
840 ND_PRINT((ndo
, "li < size of fixed part of CLNP header and addresses"));
843 ND_TCHECK_LEN(pptr
, source_address_length
);
844 source_address
= pptr
;
845 pptr
+= source_address_length
;
846 li
-= source_address_length
;
848 if (ndo
->ndo_vflag
< 1) {
849 ND_PRINT((ndo
, "%s%s > %s, %s, length %u",
850 ndo
->ndo_eflag
? "" : ", ",
851 isonsap_string(ndo
, source_address
, source_address_length
),
852 isonsap_string(ndo
, dest_address
, dest_address_length
),
853 tok2str(clnp_pdu_values
,"unknown (%u)",clnp_pdu_type
),
857 ND_PRINT((ndo
, "%slength %u", ndo
->ndo_eflag
? "" : ", ", length
));
859 ND_PRINT((ndo
, "\n\t%s PDU, hlen: %u, v: %u, lifetime: %u.%us, Segment PDU length: %u, checksum: 0x%04x",
860 tok2str(clnp_pdu_values
, "unknown (%u)",clnp_pdu_type
),
861 clnp_header
->length_indicator
,
862 clnp_header
->version
,
863 clnp_header
->lifetime
/2,
864 (clnp_header
->lifetime
%2)*5,
865 EXTRACT_BE_U_2(clnp_header
->segment_length
),
866 EXTRACT_BE_U_2(clnp_header
->cksum
)));
868 osi_print_cksum(ndo
, optr
, EXTRACT_BE_U_2(clnp_header
->cksum
), 7,
869 clnp_header
->length_indicator
);
871 ND_PRINT((ndo
, "\n\tFlags [%s]",
872 bittok2str(clnp_flag_values
, "none", clnp_flags
)));
874 ND_PRINT((ndo
, "\n\tsource address (length %u): %s\n\tdest address (length %u): %s",
875 source_address_length
,
876 isonsap_string(ndo
, source_address
, source_address_length
),
878 isonsap_string(ndo
, dest_address
, dest_address_length
)));
880 if (clnp_flags
& CLNP_SEGMENT_PART
) {
881 if (li
< sizeof(struct clnp_segment_header_t
)) {
882 ND_PRINT((ndo
, "li < size of fixed part of CLNP header, addresses, and segment part"));
885 clnp_segment_header
= (const struct clnp_segment_header_t
*) pptr
;
886 ND_TCHECK(*clnp_segment_header
);
887 ND_PRINT((ndo
, "\n\tData Unit ID: 0x%04x, Segment Offset: %u, Total PDU Length: %u",
888 EXTRACT_BE_U_2(clnp_segment_header
->data_unit_id
),
889 EXTRACT_BE_U_2(clnp_segment_header
->segment_offset
),
890 EXTRACT_BE_U_2(clnp_segment_header
->total_length
)));
891 pptr
+=sizeof(struct clnp_segment_header_t
);
892 li
-=sizeof(struct clnp_segment_header_t
);
895 /* now walk the options */
901 ND_PRINT((ndo
, ", bad opts/li"));
905 op
= EXTRACT_U_1(pptr
);
906 opli
= EXTRACT_U_1(pptr
+ 1);
910 ND_PRINT((ndo
, ", opt (%d) too long", op
));
913 ND_TCHECK_LEN(pptr
, opli
);
918 ND_PRINT((ndo
, "\n\t %s Option #%u, length %u, value: ",
919 tok2str(clnp_option_values
,"Unknown",op
),
924 * We've already checked that the entire option is present
925 * in the captured packet with the ND_TCHECK_LEN() call.
926 * Therefore, we don't need to do ND_TCHECK()/ND_TCHECK_LEN()
928 * We do, however, need to check tlen, to make sure we
929 * don't run past the end of the option.
934 case CLNP_OPTION_ROUTE_RECORDING
: /* those two options share the format */
935 case CLNP_OPTION_SOURCE_ROUTING
:
937 ND_PRINT((ndo
, ", bad opt len"));
940 ND_PRINT((ndo
, "%s %s",
941 tok2str(clnp_option_sr_rr_values
,"Unknown",EXTRACT_U_1(tptr
)),
942 tok2str(clnp_option_sr_rr_string_values
, "Unknown Option %u", op
)));
943 nsap_offset
=EXTRACT_U_1(tptr
+ 1);
944 if (nsap_offset
== 0) {
945 ND_PRINT((ndo
, " Bad NSAP offset (0)"));
948 nsap_offset
-=1; /* offset to nsap list */
949 if (nsap_offset
> tlen
) {
950 ND_PRINT((ndo
, " Bad NSAP offset (past end of option)"));
956 source_address_length
=EXTRACT_U_1(tptr
);
957 if (tlen
< source_address_length
+1) {
958 ND_PRINT((ndo
, "\n\t NSAP address goes past end of option"));
961 if (source_address_length
> 0) {
962 source_address
=(tptr
+1);
963 ND_TCHECK_LEN(source_address
,
964 source_address_length
);
965 ND_PRINT((ndo
, "\n\t NSAP address (length %u): %s",
966 source_address_length
,
967 isonsap_string(ndo
, source_address
, source_address_length
)));
969 tlen
-=source_address_length
+1;
973 case CLNP_OPTION_PRIORITY
:
975 ND_PRINT((ndo
, ", bad opt len"));
978 ND_PRINT((ndo
, "0x%1x", EXTRACT_U_1(tptr
)&0x0f));
981 case CLNP_OPTION_QOS_MAINTENANCE
:
983 ND_PRINT((ndo
, ", bad opt len"));
986 ND_PRINT((ndo
, "\n\t Format Code: %s",
987 tok2str(clnp_option_scope_values
, "Reserved", EXTRACT_U_1(tptr
) & CLNP_OPTION_SCOPE_MASK
)));
989 if ((EXTRACT_U_1(tptr
)&CLNP_OPTION_SCOPE_MASK
) == CLNP_OPTION_SCOPE_GLOBAL
)
990 ND_PRINT((ndo
, "\n\t QoS Flags [%s]",
991 bittok2str(clnp_option_qos_global_values
,
993 EXTRACT_U_1(tptr
)&CLNP_OPTION_OPTION_QOS_MASK
)));
996 case CLNP_OPTION_SECURITY
:
998 ND_PRINT((ndo
, ", bad opt len"));
1001 ND_PRINT((ndo
, "\n\t Format Code: %s, Security-Level %u",
1002 tok2str(clnp_option_scope_values
,"Reserved",EXTRACT_U_1(tptr
)&CLNP_OPTION_SCOPE_MASK
),
1003 EXTRACT_U_1(tptr
+ 1)));
1006 case CLNP_OPTION_DISCARD_REASON
:
1008 ND_PRINT((ndo
, ", bad opt len"));
1011 rfd_error
= EXTRACT_U_1(tptr
);
1012 rfd_error_major
= (rfd_error
&0xf0) >> 4;
1013 rfd_error_minor
= rfd_error
&0x0f;
1014 ND_PRINT((ndo
, "\n\t Class: %s Error (0x%01x), %s (0x%01x)",
1015 tok2str(clnp_option_rfd_class_values
,"Unknown",rfd_error_major
),
1017 tok2str(clnp_option_rfd_error_class
[rfd_error_major
],"Unknown",rfd_error_minor
),
1021 case CLNP_OPTION_PADDING
:
1022 ND_PRINT((ndo
, "padding data"));
1026 * FIXME those are the defined Options that lack a decoder
1027 * you are welcome to contribute code ;-)
1031 print_unknown_data(ndo
, tptr
, "\n\t ", opli
);
1034 if (ndo
->ndo_vflag
> 1)
1035 print_unknown_data(ndo
, pptr
, "\n\t ", opli
);
1039 switch (clnp_pdu_type
) {
1041 case CLNP_PDU_ER
: /* fall through */
1044 if (EXTRACT_U_1(pptr
) == NLPID_CLNP
) {
1045 ND_PRINT((ndo
, "\n\t-----original packet-----\n\t"));
1046 /* FIXME recursion protection */
1047 clnp_print(ndo
, pptr
, length
- clnp_header
->length_indicator
);
1056 /* dump the PDU specific data */
1057 if (length
-(pptr
-optr
) > 0) {
1058 ND_PRINT((ndo
, "\n\t undecoded non-header data, length %u", length
-clnp_header
->length_indicator
));
1059 print_unknown_data(ndo
, pptr
, "\n\t ", length
- (pptr
- optr
));
1066 ND_PRINT((ndo
, "[|clnp]"));
1072 #define ESIS_PDU_REDIRECT 6
1073 #define ESIS_PDU_ESH 2
1074 #define ESIS_PDU_ISH 4
1076 static const struct tok esis_pdu_values
[] = {
1077 { ESIS_PDU_REDIRECT
, "redirect"},
1078 { ESIS_PDU_ESH
, "ESH"},
1079 { ESIS_PDU_ISH
, "ISH"},
1083 struct esis_header_t
{
1085 uint8_t length_indicator
;
1089 uint8_t holdtime
[2];
1094 esis_print(netdissect_options
*ndo
,
1095 const uint8_t *pptr
, u_int length
)
1097 const uint8_t *optr
;
1098 u_int li
,esis_pdu_type
,source_address_length
, source_address_number
;
1099 const struct esis_header_t
*esis_header
;
1101 if (!ndo
->ndo_eflag
)
1102 ND_PRINT((ndo
, "ES-IS"));
1105 ND_PRINT((ndo
, ndo
->ndo_qflag
? "bad pkt!" : "no header at all!"));
1109 esis_header
= (const struct esis_header_t
*) pptr
;
1110 ND_TCHECK(*esis_header
);
1111 li
= esis_header
->length_indicator
;
1115 * Sanity checking of the header.
1118 if (esis_header
->nlpid
!= NLPID_ESIS
) {
1119 ND_PRINT((ndo
, " nlpid 0x%02x packet not supported", esis_header
->nlpid
));
1123 if (esis_header
->version
!= ESIS_VERSION
) {
1124 ND_PRINT((ndo
, " version %d packet not supported", esis_header
->version
));
1129 ND_PRINT((ndo
, " length indicator(%u) > PDU size (%u)!", li
, length
));
1133 if (li
< sizeof(struct esis_header_t
) + 2) {
1134 ND_PRINT((ndo
, " length indicator %u < min PDU size:", li
));
1135 while (pptr
< ndo
->ndo_snapend
) {
1136 ND_PRINT((ndo
, "%02X", EXTRACT_U_1(pptr
)));
1142 esis_pdu_type
= esis_header
->type
& ESIS_PDU_TYPE_MASK
;
1144 if (ndo
->ndo_vflag
< 1) {
1145 ND_PRINT((ndo
, "%s%s, length %u",
1146 ndo
->ndo_eflag
? "" : ", ",
1147 tok2str(esis_pdu_values
,"unknown type (%u)",esis_pdu_type
),
1151 ND_PRINT((ndo
, "%slength %u\n\t%s (%u)",
1152 ndo
->ndo_eflag
? "" : ", ",
1154 tok2str(esis_pdu_values
,"unknown type: %u", esis_pdu_type
),
1157 ND_PRINT((ndo
, ", v: %u%s", esis_header
->version
, esis_header
->version
== ESIS_VERSION
? "" : "unsupported" ));
1158 ND_PRINT((ndo
, ", checksum: 0x%04x", EXTRACT_BE_U_2(esis_header
->cksum
)));
1160 osi_print_cksum(ndo
, pptr
, EXTRACT_BE_U_2(esis_header
->cksum
), 7,
1163 ND_PRINT((ndo
, ", holding time: %us, length indicator: %u",
1164 EXTRACT_BE_U_2(esis_header
->holdtime
), li
));
1166 if (ndo
->ndo_vflag
> 1)
1167 print_unknown_data(ndo
, optr
, "\n\t", sizeof(struct esis_header_t
));
1169 pptr
+= sizeof(struct esis_header_t
);
1170 li
-= sizeof(struct esis_header_t
);
1172 switch (esis_pdu_type
) {
1173 case ESIS_PDU_REDIRECT
: {
1174 const uint8_t *dst
, *snpa
, *neta
;
1175 u_int dstl
, snpal
, netal
;
1179 ND_PRINT((ndo
, ", bad redirect/li"));
1182 dstl
= EXTRACT_U_1(pptr
);
1185 ND_TCHECK_LEN(pptr
, dstl
);
1187 ND_PRINT((ndo
, ", bad redirect/li"));
1193 ND_PRINT((ndo
, "\n\t %s", isonsap_string(ndo
, dst
, dstl
)));
1197 ND_PRINT((ndo
, ", bad redirect/li"));
1200 snpal
= EXTRACT_U_1(pptr
);
1203 ND_TCHECK_LEN(pptr
, snpal
);
1205 ND_PRINT((ndo
, ", bad redirect/li"));
1213 ND_PRINT((ndo
, ", bad redirect/li"));
1216 netal
= EXTRACT_U_1(pptr
);
1218 ND_TCHECK_LEN(pptr
, netal
);
1220 ND_PRINT((ndo
, ", bad redirect/li"));
1228 ND_PRINT((ndo
, "\n\t SNPA (length: %u): %s",
1230 etheraddr_string(ndo
, snpa
)));
1232 ND_PRINT((ndo
, "\n\t SNPA (length: %u): %s",
1234 linkaddr_string(ndo
, snpa
, LINKADDR_OTHER
, snpal
)));
1236 ND_PRINT((ndo
, "\n\t NET (length: %u) %s",
1238 isonsap_string(ndo
, neta
, netal
)));
1245 ND_PRINT((ndo
, ", bad esh/li"));
1248 source_address_number
= EXTRACT_U_1(pptr
);
1252 ND_PRINT((ndo
, "\n\t Number of Source Addresses: %u", source_address_number
));
1254 while (source_address_number
> 0) {
1257 ND_PRINT((ndo
, ", bad esh/li"));
1260 source_address_length
= EXTRACT_U_1(pptr
);
1264 ND_TCHECK_LEN(pptr
, source_address_length
);
1265 if (li
< source_address_length
) {
1266 ND_PRINT((ndo
, ", bad esh/li"));
1269 ND_PRINT((ndo
, "\n\t NET (length: %u): %s",
1270 source_address_length
,
1271 isonsap_string(ndo
, pptr
, source_address_length
)));
1272 pptr
+= source_address_length
;
1273 li
-= source_address_length
;
1274 source_address_number
--;
1279 case ESIS_PDU_ISH
: {
1282 ND_PRINT((ndo
, ", bad ish/li"));
1285 source_address_length
= EXTRACT_U_1(pptr
);
1288 ND_TCHECK_LEN(pptr
, source_address_length
);
1289 if (li
< source_address_length
) {
1290 ND_PRINT((ndo
, ", bad ish/li"));
1293 ND_PRINT((ndo
, "\n\t NET (length: %u): %s", source_address_length
, isonsap_string(ndo
, pptr
, source_address_length
)));
1294 pptr
+= source_address_length
;
1295 li
-= source_address_length
;
1300 if (ndo
->ndo_vflag
<= 1) {
1301 if (pptr
< ndo
->ndo_snapend
)
1302 print_unknown_data(ndo
, pptr
, "\n\t ", ndo
->ndo_snapend
- pptr
);
1307 /* now walk the options */
1310 const uint8_t *tptr
;
1313 ND_PRINT((ndo
, ", bad opts/li"));
1317 op
= EXTRACT_U_1(pptr
);
1318 opli
= EXTRACT_U_1(pptr
+ 1);
1322 ND_PRINT((ndo
, ", opt (%d) too long", op
));
1328 ND_PRINT((ndo
, "\n\t %s Option #%u, length %u, value: ",
1329 tok2str(esis_option_values
,"Unknown",op
),
1335 case ESIS_OPTION_ES_CONF_TIME
:
1338 ND_PRINT((ndo
, "%us", EXTRACT_BE_U_2(tptr
)));
1340 ND_PRINT((ndo
, "(bad length)"));
1343 case ESIS_OPTION_PROTOCOLS
:
1346 ND_PRINT((ndo
, "%s (0x%02x)",
1347 tok2str(nlpid_values
,
1350 EXTRACT_U_1(tptr
)));
1351 if (opli
>1) /* further NPLIDs ? - put comma */
1352 ND_PRINT((ndo
, ", "));
1359 * FIXME those are the defined Options that lack a decoder
1360 * you are welcome to contribute code ;-)
1363 case ESIS_OPTION_QOS_MAINTENANCE
:
1364 case ESIS_OPTION_SECURITY
:
1365 case ESIS_OPTION_PRIORITY
:
1366 case ESIS_OPTION_ADDRESS_MASK
:
1367 case ESIS_OPTION_SNPA_MASK
:
1370 print_unknown_data(ndo
, tptr
, "\n\t ", opli
);
1373 if (ndo
->ndo_vflag
> 1)
1374 print_unknown_data(ndo
, pptr
, "\n\t ", opli
);
1378 ND_PRINT((ndo
, "[|esis]"));
1382 isis_print_mcid(netdissect_options
*ndo
,
1383 const struct isis_spb_mcid
*mcid
)
1388 ND_PRINT((ndo
, "ID: %d, Name: ", mcid
->format_id
));
1390 if (fn_printzp(ndo
, mcid
->name
, 32, ndo
->ndo_snapend
))
1393 ND_PRINT((ndo
, "\n\t Lvl: %d", EXTRACT_BE_U_2(mcid
->revision_lvl
)));
1395 ND_PRINT((ndo
, ", Digest: "));
1398 ND_PRINT((ndo
, "%.2x ", mcid
->digest
[i
]));
1401 ND_PRINT((ndo
, "%s", tstr
));
1405 isis_print_mt_port_cap_subtlv(netdissect_options
*ndo
,
1406 const uint8_t *tptr
, int len
)
1408 int stlv_type
, stlv_len
;
1409 const struct isis_subtlv_spb_mcid
*subtlv_spb_mcid
;
1415 stlv_type
= EXTRACT_U_1(tptr
);
1416 stlv_len
= EXTRACT_U_1(tptr
+ 1);
1418 /* first lets see if we know the subTLVs name*/
1419 ND_PRINT((ndo
, "\n\t %s subTLV #%u, length: %u",
1420 tok2str(isis_mt_port_cap_subtlv_values
, "unknown", stlv_type
),
1425 /*len -= TLV_TYPE_LEN_OFFSET;*/
1428 /* Make sure the subTLV fits within the space left */
1431 /* Make sure the entire subTLV is in the captured data */
1432 ND_TCHECK_LEN(tptr
, stlv_len
);
1436 case ISIS_SUBTLV_SPB_MCID
:
1438 if (stlv_len
< ISIS_SUBTLV_SPB_MCID_MIN_LEN
)
1441 subtlv_spb_mcid
= (const struct isis_subtlv_spb_mcid
*)tptr
;
1443 ND_PRINT((ndo
, "\n\t MCID: "));
1444 isis_print_mcid(ndo
, &(subtlv_spb_mcid
->mcid
));
1446 /*tptr += SPB_MCID_MIN_LEN;
1447 len -= SPB_MCID_MIN_LEN; */
1449 ND_PRINT((ndo
, "\n\t AUX-MCID: "));
1450 isis_print_mcid(ndo
, &(subtlv_spb_mcid
->aux_mcid
));
1452 /*tptr += SPB_MCID_MIN_LEN;
1453 len -= SPB_MCID_MIN_LEN; */
1454 tptr
= tptr
+ ISIS_SUBTLV_SPB_MCID_MIN_LEN
;
1455 len
= len
- ISIS_SUBTLV_SPB_MCID_MIN_LEN
;
1456 stlv_len
= stlv_len
- ISIS_SUBTLV_SPB_MCID_MIN_LEN
;
1461 case ISIS_SUBTLV_SPB_DIGEST
:
1463 if (stlv_len
< ISIS_SUBTLV_SPB_DIGEST_MIN_LEN
)
1466 ND_PRINT((ndo
, "\n\t RES: %d V: %d A: %d D: %d",
1467 (EXTRACT_U_1(tptr
) >> 5),
1468 ((EXTRACT_U_1(tptr
) >> 4) & 0x01),
1469 ((EXTRACT_U_1(tptr
) >> 2) & 0x03),
1470 (EXTRACT_U_1(tptr
) & 0x03)));
1474 ND_PRINT((ndo
, "\n\t Digest: "));
1478 ND_PRINT((ndo
, "%08x ", EXTRACT_BE_U_4(tptr
)));
1479 if (i
%4 == 0 && i
!= 8)
1480 ND_PRINT((ndo
, "\n\t "));
1484 len
= len
- ISIS_SUBTLV_SPB_DIGEST_MIN_LEN
;
1485 stlv_len
= stlv_len
- ISIS_SUBTLV_SPB_DIGEST_MIN_LEN
;
1490 case ISIS_SUBTLV_SPB_BVID
:
1492 while (stlv_len
>= ISIS_SUBTLV_SPB_BVID_MIN_LEN
)
1494 ND_PRINT((ndo
, "\n\t ECT: %08x",
1495 EXTRACT_BE_U_4(tptr
)));
1499 ND_PRINT((ndo
, " BVID: %d, U:%01x M:%01x ",
1500 (EXTRACT_BE_U_2(tptr
) >> 4) ,
1501 (EXTRACT_BE_U_2(tptr
) >> 3) & 0x01,
1502 (EXTRACT_BE_U_2(tptr
) >> 2) & 0x01));
1505 len
= len
- ISIS_SUBTLV_SPB_BVID_MIN_LEN
;
1506 stlv_len
= stlv_len
- ISIS_SUBTLV_SPB_BVID_MIN_LEN
;
1522 ND_PRINT((ndo
, "\n\t\t"));
1523 ND_PRINT((ndo
, "%s", tstr
));
1528 isis_print_mt_capability_subtlv(netdissect_options
*ndo
,
1529 const uint8_t *tptr
, int len
)
1531 int stlv_type
, stlv_len
, tmp
;
1536 stlv_type
= EXTRACT_U_1(tptr
);
1537 stlv_len
= EXTRACT_U_1(tptr
+ 1);
1541 /* first lets see if we know the subTLVs name*/
1542 ND_PRINT((ndo
, "\n\t %s subTLV #%u, length: %u",
1543 tok2str(isis_mt_capability_subtlv_values
, "unknown", stlv_type
),
1547 /* Make sure the subTLV fits within the space left */
1550 /* Make sure the entire subTLV is in the captured data */
1551 ND_TCHECK_LEN(tptr
, stlv_len
);
1555 case ISIS_SUBTLV_SPB_INSTANCE
:
1556 if (stlv_len
< ISIS_SUBTLV_SPB_INSTANCE_MIN_LEN
)
1559 ND_PRINT((ndo
, "\n\t CIST Root-ID: %08x", EXTRACT_BE_U_4(tptr
)));
1561 ND_PRINT((ndo
, " %08x", EXTRACT_BE_U_4(tptr
)));
1563 ND_PRINT((ndo
, ", Path Cost: %08x", EXTRACT_BE_U_4(tptr
)));
1565 ND_PRINT((ndo
, ", Prio: %d", EXTRACT_BE_U_2(tptr
)));
1567 ND_PRINT((ndo
, "\n\t RES: %d",
1568 EXTRACT_BE_U_2(tptr
) >> 5));
1569 ND_PRINT((ndo
, ", V: %d",
1570 (EXTRACT_BE_U_2(tptr
) >> 4) & 0x0001));
1571 ND_PRINT((ndo
, ", SPSource-ID: %d",
1572 (EXTRACT_BE_U_4(tptr
) & 0x000fffff)));
1574 ND_PRINT((ndo
, ", No of Trees: %x", EXTRACT_U_1(tptr
)));
1576 tmp
= EXTRACT_U_1(tptr
);
1579 len
= len
- ISIS_SUBTLV_SPB_INSTANCE_MIN_LEN
;
1580 stlv_len
= stlv_len
- ISIS_SUBTLV_SPB_INSTANCE_MIN_LEN
;
1584 if (stlv_len
< ISIS_SUBTLV_SPB_INSTANCE_VLAN_TUPLE_LEN
)
1587 ND_PRINT((ndo
, "\n\t U:%d, M:%d, A:%d, RES:%d",
1588 EXTRACT_U_1(tptr
) >> 7,
1589 (EXTRACT_U_1(tptr
) >> 6) & 0x01,
1590 (EXTRACT_U_1(tptr
) >> 5) & 0x01,
1591 (EXTRACT_U_1(tptr
) & 0x1f)));
1595 ND_PRINT((ndo
, ", ECT: %08x", EXTRACT_BE_U_4(tptr
)));
1599 ND_PRINT((ndo
, ", BVID: %d, SPVID: %d",
1600 (EXTRACT_BE_U_3(tptr
) >> 12) & 0x000fff,
1601 EXTRACT_BE_U_3(tptr
) & 0x000fff));
1604 len
= len
- ISIS_SUBTLV_SPB_INSTANCE_VLAN_TUPLE_LEN
;
1605 stlv_len
= stlv_len
- ISIS_SUBTLV_SPB_INSTANCE_VLAN_TUPLE_LEN
;
1611 case ISIS_SUBTLV_SPBM_SI
:
1615 ND_PRINT((ndo
, "\n\t BMAC: %08x", EXTRACT_BE_U_4(tptr
)));
1617 ND_PRINT((ndo
, "%04x", EXTRACT_BE_U_2(tptr
)));
1620 ND_PRINT((ndo
, ", RES: %d, VID: %d", EXTRACT_BE_U_2(tptr
) >> 12,
1621 (EXTRACT_BE_U_2(tptr
)) & 0x0fff));
1625 stlv_len
= stlv_len
- 8;
1627 while (stlv_len
>= 4) {
1629 ND_PRINT((ndo
, "\n\t T: %d, R: %d, RES: %d, ISID: %d",
1630 (EXTRACT_BE_U_4(tptr
) >> 31),
1631 (EXTRACT_BE_U_4(tptr
) >> 30) & 0x01,
1632 (EXTRACT_BE_U_4(tptr
) >> 24) & 0x03f,
1633 (EXTRACT_BE_U_4(tptr
)) & 0x0ffffff));
1637 stlv_len
= stlv_len
- 4;
1651 ND_PRINT((ndo
, "\n\t\t"));
1652 ND_PRINT((ndo
, "%s", tstr
));
1656 /* shared routine for printing system, node and lsp-ids */
1658 isis_print_id(const uint8_t *cp
, int id_len
)
1661 static char id
[sizeof("xxxx.xxxx.xxxx.yy-zz")];
1665 sysid_len
= SYSTEM_ID_LEN
;
1666 if (sysid_len
> id_len
)
1668 for (i
= 1; i
<= sysid_len
; i
++) {
1669 snprintf(pos
, sizeof(id
) - (pos
- id
), "%02x", EXTRACT_U_1(cp
));
1672 if (i
== 2 || i
== 4)
1675 if (id_len
>= NODE_ID_LEN
) {
1676 snprintf(pos
, sizeof(id
) - (pos
- id
), ".%02x", EXTRACT_U_1(cp
));
1680 if (id_len
== LSP_ID_LEN
)
1681 snprintf(pos
, sizeof(id
) - (pos
- id
), "-%02x", EXTRACT_U_1(cp
));
1685 /* print the 4-byte metric block which is common found in the old-style TLVs */
1687 isis_print_metric_block(netdissect_options
*ndo
,
1688 const struct isis_metric_block
*isis_metric_block
)
1690 ND_PRINT((ndo
, ", Default Metric: %d, %s",
1691 ISIS_LSP_TLV_METRIC_VALUE(isis_metric_block
->metric_default
),
1692 ISIS_LSP_TLV_METRIC_IE(isis_metric_block
->metric_default
) ? "External" : "Internal"));
1693 if (!ISIS_LSP_TLV_METRIC_SUPPORTED(isis_metric_block
->metric_delay
))
1694 ND_PRINT((ndo
, "\n\t\t Delay Metric: %d, %s",
1695 ISIS_LSP_TLV_METRIC_VALUE(isis_metric_block
->metric_delay
),
1696 ISIS_LSP_TLV_METRIC_IE(isis_metric_block
->metric_delay
) ? "External" : "Internal"));
1697 if (!ISIS_LSP_TLV_METRIC_SUPPORTED(isis_metric_block
->metric_expense
))
1698 ND_PRINT((ndo
, "\n\t\t Expense Metric: %d, %s",
1699 ISIS_LSP_TLV_METRIC_VALUE(isis_metric_block
->metric_expense
),
1700 ISIS_LSP_TLV_METRIC_IE(isis_metric_block
->metric_expense
) ? "External" : "Internal"));
1701 if (!ISIS_LSP_TLV_METRIC_SUPPORTED(isis_metric_block
->metric_error
))
1702 ND_PRINT((ndo
, "\n\t\t Error Metric: %d, %s",
1703 ISIS_LSP_TLV_METRIC_VALUE(isis_metric_block
->metric_error
),
1704 ISIS_LSP_TLV_METRIC_IE(isis_metric_block
->metric_error
) ? "External" : "Internal"));
1706 return(1); /* everything is ok */
1710 isis_print_tlv_ip_reach(netdissect_options
*ndo
,
1711 const uint8_t *cp
, const char *ident
, int length
)
1714 const struct isis_tlv_ip_reach
*tlv_ip_reach
;
1716 tlv_ip_reach
= (const struct isis_tlv_ip_reach
*)cp
;
1718 while (length
> 0) {
1719 if ((size_t)length
< sizeof(*tlv_ip_reach
)) {
1720 ND_PRINT((ndo
, "short IPv4 Reachability (%d vs %lu)",
1722 (unsigned long)sizeof(*tlv_ip_reach
)));
1726 if (!ND_TTEST(*tlv_ip_reach
))
1729 prefix_len
= mask2plen(EXTRACT_BE_U_4(tlv_ip_reach
->mask
));
1731 if (prefix_len
== -1)
1732 ND_PRINT((ndo
, "%sIPv4 prefix: %s mask %s",
1734 ipaddr_string(ndo
, (tlv_ip_reach
->prefix
)),
1735 ipaddr_string(ndo
, (tlv_ip_reach
->mask
))));
1737 ND_PRINT((ndo
, "%sIPv4 prefix: %15s/%u",
1739 ipaddr_string(ndo
, (tlv_ip_reach
->prefix
)),
1742 ND_PRINT((ndo
, ", Distribution: %s, Metric: %u, %s",
1743 ISIS_LSP_TLV_METRIC_UPDOWN(tlv_ip_reach
->isis_metric_block
.metric_default
) ? "down" : "up",
1744 ISIS_LSP_TLV_METRIC_VALUE(tlv_ip_reach
->isis_metric_block
.metric_default
),
1745 ISIS_LSP_TLV_METRIC_IE(tlv_ip_reach
->isis_metric_block
.metric_default
) ? "External" : "Internal"));
1747 if (!ISIS_LSP_TLV_METRIC_SUPPORTED(tlv_ip_reach
->isis_metric_block
.metric_delay
))
1748 ND_PRINT((ndo
, "%s Delay Metric: %u, %s",
1750 ISIS_LSP_TLV_METRIC_VALUE(tlv_ip_reach
->isis_metric_block
.metric_delay
),
1751 ISIS_LSP_TLV_METRIC_IE(tlv_ip_reach
->isis_metric_block
.metric_delay
) ? "External" : "Internal"));
1753 if (!ISIS_LSP_TLV_METRIC_SUPPORTED(tlv_ip_reach
->isis_metric_block
.metric_expense
))
1754 ND_PRINT((ndo
, "%s Expense Metric: %u, %s",
1756 ISIS_LSP_TLV_METRIC_VALUE(tlv_ip_reach
->isis_metric_block
.metric_expense
),
1757 ISIS_LSP_TLV_METRIC_IE(tlv_ip_reach
->isis_metric_block
.metric_expense
) ? "External" : "Internal"));
1759 if (!ISIS_LSP_TLV_METRIC_SUPPORTED(tlv_ip_reach
->isis_metric_block
.metric_error
))
1760 ND_PRINT((ndo
, "%s Error Metric: %u, %s",
1762 ISIS_LSP_TLV_METRIC_VALUE(tlv_ip_reach
->isis_metric_block
.metric_error
),
1763 ISIS_LSP_TLV_METRIC_IE(tlv_ip_reach
->isis_metric_block
.metric_error
) ? "External" : "Internal"));
1765 length
-= sizeof(struct isis_tlv_ip_reach
);
1772 * this is the common IP-REACH subTLV decoder it is called
1773 * from various EXTD-IP REACH TLVs (135,235,236,237)
1777 isis_print_ip_reach_subtlv(netdissect_options
*ndo
,
1778 const uint8_t *tptr
, int subt
, int subl
,
1781 /* first lets see if we know the subTLVs name*/
1782 ND_PRINT((ndo
, "%s%s subTLV #%u, length: %u",
1783 ident
, tok2str(isis_ext_ip_reach_subtlv_values
, "unknown", subt
),
1786 ND_TCHECK_LEN(tptr
, subl
);
1789 case ISIS_SUBTLV_EXTD_IP_REACH_MGMT_PREFIX_COLOR
: /* fall through */
1790 case ISIS_SUBTLV_EXTD_IP_REACH_ADMIN_TAG32
:
1792 ND_PRINT((ndo
, ", 0x%08x (=%u)",
1793 EXTRACT_BE_U_4(tptr
),
1794 EXTRACT_BE_U_4(tptr
)));
1799 case ISIS_SUBTLV_EXTD_IP_REACH_ADMIN_TAG64
:
1801 ND_PRINT((ndo
, ", 0x%08x%08x",
1802 EXTRACT_BE_U_4(tptr
),
1803 EXTRACT_BE_U_4(tptr
+ 4)));
1809 if (!print_unknown_data(ndo
, tptr
, "\n\t\t ", subl
))
1816 ND_PRINT((ndo
, "%s", ident
));
1817 ND_PRINT((ndo
, "%s", tstr
));
1822 * this is the common IS-REACH subTLV decoder it is called
1823 * from isis_print_ext_is_reach()
1827 isis_print_is_reach_subtlv(netdissect_options
*ndo
,
1828 const uint8_t *tptr
, u_int subt
, u_int subl
,
1831 u_int te_class
,priority_level
,gmpls_switch_cap
;
1832 union { /* int to float conversion buffer for several subTLVs */
1837 /* first lets see if we know the subTLVs name*/
1838 ND_PRINT((ndo
, "%s%s subTLV #%u, length: %u",
1839 ident
, tok2str(isis_ext_is_reach_subtlv_values
, "unknown", subt
),
1842 ND_TCHECK_LEN(tptr
, subl
);
1845 case ISIS_SUBTLV_EXT_IS_REACH_ADMIN_GROUP
:
1846 case ISIS_SUBTLV_EXT_IS_REACH_LINK_LOCAL_REMOTE_ID
:
1847 case ISIS_SUBTLV_EXT_IS_REACH_LINK_REMOTE_ID
:
1849 ND_PRINT((ndo
, ", 0x%08x", EXTRACT_BE_U_4(tptr
)));
1850 if (subl
== 8) /* rfc4205 */
1851 ND_PRINT((ndo
, ", 0x%08x", EXTRACT_BE_U_4(tptr
+ 4)));
1854 case ISIS_SUBTLV_EXT_IS_REACH_IPV4_INTF_ADDR
:
1855 case ISIS_SUBTLV_EXT_IS_REACH_IPV4_NEIGHBOR_ADDR
:
1856 if (subl
>= sizeof(struct in_addr
))
1857 ND_PRINT((ndo
, ", %s", ipaddr_string(ndo
, tptr
)));
1859 case ISIS_SUBTLV_EXT_IS_REACH_MAX_LINK_BW
:
1860 case ISIS_SUBTLV_EXT_IS_REACH_RESERVABLE_BW
:
1862 bw
.i
= EXTRACT_BE_U_4(tptr
);
1863 ND_PRINT((ndo
, ", %.3f Mbps", bw
.f
* 8 / 1000000));
1866 case ISIS_SUBTLV_EXT_IS_REACH_UNRESERVED_BW
:
1868 for (te_class
= 0; te_class
< 8; te_class
++) {
1869 bw
.i
= EXTRACT_BE_U_4(tptr
);
1870 ND_PRINT((ndo
, "%s TE-Class %u: %.3f Mbps",
1873 bw
.f
* 8 / 1000000));
1878 case ISIS_SUBTLV_EXT_IS_REACH_BW_CONSTRAINTS
: /* fall through */
1879 case ISIS_SUBTLV_EXT_IS_REACH_BW_CONSTRAINTS_OLD
:
1882 ND_PRINT((ndo
, "%sBandwidth Constraints Model ID: %s (%u)",
1884 tok2str(diffserv_te_bc_values
, "unknown", EXTRACT_U_1(tptr
)),
1885 EXTRACT_U_1(tptr
)));
1887 /* decode BCs until the subTLV ends */
1888 for (te_class
= 0; te_class
< (subl
-1)/4; te_class
++) {
1889 bw
.i
= EXTRACT_BE_U_4(tptr
);
1890 ND_PRINT((ndo
, "%s Bandwidth constraint CT%u: %.3f Mbps",
1893 bw
.f
* 8 / 1000000));
1897 case ISIS_SUBTLV_EXT_IS_REACH_TE_METRIC
:
1899 ND_PRINT((ndo
, ", %u", EXTRACT_BE_U_3(tptr
)));
1901 case ISIS_SUBTLV_EXT_IS_REACH_LINK_ATTRIBUTE
:
1903 ND_PRINT((ndo
, ", [ %s ] (0x%04x)",
1904 bittok2str(isis_subtlv_link_attribute_values
,
1906 EXTRACT_BE_U_2(tptr
)),
1907 EXTRACT_BE_U_2(tptr
)));
1910 case ISIS_SUBTLV_EXT_IS_REACH_LINK_PROTECTION_TYPE
:
1912 ND_PRINT((ndo
, ", %s, Priority %u",
1913 bittok2str(gmpls_link_prot_values
, "none", EXTRACT_U_1(tptr
)),
1914 EXTRACT_U_1(tptr
+ 1)));
1917 case ISIS_SUBTLV_SPB_METRIC
:
1919 ND_PRINT((ndo
, ", LM: %u", EXTRACT_BE_U_3(tptr
)));
1921 ND_PRINT((ndo
, ", P: %u", EXTRACT_U_1(tptr
)));
1923 ND_PRINT((ndo
, ", P-ID: %u", EXTRACT_BE_U_2(tptr
)));
1926 case ISIS_SUBTLV_EXT_IS_REACH_INTF_SW_CAP_DESCR
:
1928 gmpls_switch_cap
= EXTRACT_U_1(tptr
);
1929 ND_PRINT((ndo
, "%s Interface Switching Capability:%s",
1931 tok2str(gmpls_switch_cap_values
, "Unknown", gmpls_switch_cap
)));
1932 ND_PRINT((ndo
, ", LSP Encoding: %s",
1933 tok2str(gmpls_encoding_values
, "Unknown", EXTRACT_U_1((tptr
+ 1)))));
1935 ND_PRINT((ndo
, "%s Max LSP Bandwidth:", ident
));
1936 for (priority_level
= 0; priority_level
< 8; priority_level
++) {
1937 bw
.i
= EXTRACT_BE_U_4(tptr
);
1938 ND_PRINT((ndo
, "%s priority level %d: %.3f Mbps",
1941 bw
.f
* 8 / 1000000));
1945 switch (gmpls_switch_cap
) {
1952 bw
.i
= EXTRACT_BE_U_4(tptr
);
1953 ND_PRINT((ndo
, "%s Min LSP Bandwidth: %.3f Mbps", ident
, bw
.f
* 8 / 1000000));
1954 ND_PRINT((ndo
, "%s Interface MTU: %u", ident
, EXTRACT_BE_U_2(tptr
+ 4)));
1959 bw
.i
= EXTRACT_BE_U_4(tptr
);
1960 ND_PRINT((ndo
, "%s Min LSP Bandwidth: %.3f Mbps", ident
, bw
.f
* 8 / 1000000));
1961 ND_PRINT((ndo
, "%s Indication %s", ident
,
1962 tok2str(gmpls_switch_cap_tsc_indication_values
, "Unknown (%u)", EXTRACT_U_1((tptr
+ 4)))));
1965 /* there is some optional stuff left to decode but this is as of yet
1966 not specified so just lets hexdump what is left */
1968 if (!print_unknown_data(ndo
, tptr
, "\n\t\t ", subl
))
1975 if (!print_unknown_data(ndo
, tptr
, "\n\t\t ", subl
))
1986 * this is the common IS-REACH decoder it is called
1987 * from various EXTD-IS REACH style TLVs (22,24,222)
1991 isis_print_ext_is_reach(netdissect_options
*ndo
,
1992 const uint8_t *tptr
, const char *ident
, int tlv_type
)
1994 char ident_buffer
[20];
1995 int subtlv_type
,subtlv_len
,subtlv_sum_len
;
1996 int proc_bytes
= 0; /* how many bytes did we process ? */
1998 if (!ND_TTEST_LEN(tptr
, NODE_ID_LEN
))
2001 ND_PRINT((ndo
, "%sIS Neighbor: %s", ident
, isis_print_id(tptr
, NODE_ID_LEN
)));
2004 if (tlv_type
!= ISIS_TLV_IS_ALIAS_ID
) { /* the Alias TLV Metric field is implicit 0 */
2005 if (!ND_TTEST_3(tptr
)) /* and is therefore skipped */
2007 ND_PRINT((ndo
, ", Metric: %d", EXTRACT_BE_U_3(tptr
)));
2011 if (!ND_TTEST_1(tptr
))
2013 subtlv_sum_len
=EXTRACT_U_1(tptr
); /* read out subTLV length */
2015 proc_bytes
=NODE_ID_LEN
+3+1;
2016 ND_PRINT((ndo
, ", %ssub-TLVs present",subtlv_sum_len
? "" : "no "));
2017 if (subtlv_sum_len
) {
2018 ND_PRINT((ndo
, " (%u)", subtlv_sum_len
));
2019 while (subtlv_sum_len
>0) {
2020 if (!ND_TTEST_2(tptr
))
2022 subtlv_type
=EXTRACT_U_1(tptr
);
2023 subtlv_len
=EXTRACT_U_1(tptr
+ 1);
2025 /* prepend the indent string */
2026 snprintf(ident_buffer
, sizeof(ident_buffer
), "%s ",ident
);
2027 if (!isis_print_is_reach_subtlv(ndo
, tptr
, subtlv_type
, subtlv_len
, ident_buffer
))
2030 subtlv_sum_len
-=(subtlv_len
+2);
2031 proc_bytes
+=(subtlv_len
+2);
2038 * this is the common Multi Topology ID decoder
2039 * it is called from various MT-TLVs (222,229,235,237)
2043 isis_print_mtid(netdissect_options
*ndo
,
2044 const uint8_t *tptr
, const char *ident
)
2046 if (!ND_TTEST_2(tptr
))
2049 ND_PRINT((ndo
, "%s%s",
2051 tok2str(isis_mt_values
,
2052 "Reserved for IETF Consensus",
2053 ISIS_MASK_MTID(EXTRACT_BE_U_2(tptr
)))));
2055 ND_PRINT((ndo
, " Topology (0x%03x), Flags: [%s]",
2056 ISIS_MASK_MTID(EXTRACT_BE_U_2(tptr
)),
2057 bittok2str(isis_mt_flag_values
, "none",ISIS_MASK_MTFLAGS(EXTRACT_BE_U_2(tptr
)))));
2063 * this is the common extended IP reach decoder
2064 * it is called from TLVs (135,235,236,237)
2065 * we process the TLV and optional subTLVs and return
2066 * the amount of processed bytes
2070 isis_print_extd_ip_reach(netdissect_options
*ndo
,
2071 const uint8_t *tptr
, const char *ident
, uint16_t afi
)
2073 char ident_buffer
[20];
2074 uint8_t prefix
[sizeof(struct in6_addr
)]; /* shared copy buffer for IPv4 and IPv6 prefixes */
2075 u_int metric
, status_byte
, bit_length
, byte_length
, sublen
, processed
, subtlvtype
, subtlvlen
;
2077 if (!ND_TTEST_4(tptr
))
2079 metric
= EXTRACT_BE_U_4(tptr
);
2083 if (afi
== AF_INET
) {
2084 if (!ND_TTEST_1(tptr
)) /* fetch status byte */
2086 status_byte
=EXTRACT_U_1(tptr
);
2088 bit_length
= status_byte
&0x3f;
2089 if (bit_length
> 32) {
2090 ND_PRINT((ndo
, "%sIPv4 prefix: bad bit length %u",
2096 } else if (afi
== AF_INET6
) {
2097 if (!ND_TTEST_2(tptr
)) /* fetch status & prefix_len byte */
2099 status_byte
=EXTRACT_U_1(tptr
);
2100 bit_length
=EXTRACT_U_1(tptr
+ 1);
2101 if (bit_length
> 128) {
2102 ND_PRINT((ndo
, "%sIPv6 prefix: bad bit length %u",
2110 return (0); /* somebody is fooling us */
2112 byte_length
= (bit_length
+ 7) / 8; /* prefix has variable length encoding */
2114 if (!ND_TTEST_LEN(tptr
, byte_length
))
2116 memset(prefix
, 0, sizeof prefix
); /* clear the copy buffer */
2117 memcpy(prefix
,tptr
,byte_length
); /* copy as much as is stored in the TLV */
2119 processed
+=byte_length
;
2122 ND_PRINT((ndo
, "%sIPv4 prefix: %15s/%u",
2124 ipaddr_string(ndo
, prefix
),
2126 else if (afi
== AF_INET6
)
2127 ND_PRINT((ndo
, "%sIPv6 prefix: %s/%u",
2129 ip6addr_string(ndo
, prefix
),
2132 ND_PRINT((ndo
, ", Distribution: %s, Metric: %u",
2133 ISIS_MASK_TLV_EXTD_IP_UPDOWN(status_byte
) ? "down" : "up",
2136 if (afi
== AF_INET
&& ISIS_MASK_TLV_EXTD_IP_SUBTLV(status_byte
))
2137 ND_PRINT((ndo
, ", sub-TLVs present"));
2138 else if (afi
== AF_INET6
)
2139 ND_PRINT((ndo
, ", %s%s",
2140 ISIS_MASK_TLV_EXTD_IP6_IE(status_byte
) ? "External" : "Internal",
2141 ISIS_MASK_TLV_EXTD_IP6_SUBTLV(status_byte
) ? ", sub-TLVs present" : ""));
2143 if ((afi
== AF_INET
&& ISIS_MASK_TLV_EXTD_IP_SUBTLV(status_byte
))
2144 || (afi
== AF_INET6
&& ISIS_MASK_TLV_EXTD_IP6_SUBTLV(status_byte
))
2146 /* assume that one prefix can hold more
2147 than one subTLV - therefore the first byte must reflect
2148 the aggregate bytecount of the subTLVs for this prefix
2150 if (!ND_TTEST_1(tptr
))
2152 sublen
=EXTRACT_U_1(tptr
);
2154 processed
+=sublen
+1;
2155 ND_PRINT((ndo
, " (%u)", sublen
)); /* print out subTLV length */
2158 if (!ND_TTEST_2(tptr
))
2160 subtlvtype
=EXTRACT_U_1(tptr
);
2161 subtlvlen
=EXTRACT_U_1(tptr
+ 1);
2163 /* prepend the indent string */
2164 snprintf(ident_buffer
, sizeof(ident_buffer
), "%s ",ident
);
2165 if (!isis_print_ip_reach_subtlv(ndo
, tptr
, subtlvtype
, subtlvlen
, ident_buffer
))
2168 sublen
-=(subtlvlen
+2);
2175 * Clear checksum and lifetime prior to signature verification.
2178 isis_clear_checksum_lifetime(void *header
)
2180 struct isis_lsp_header
*header_lsp
= (struct isis_lsp_header
*) header
;
2182 header_lsp
->checksum
[0] = 0;
2183 header_lsp
->checksum
[1] = 0;
2184 header_lsp
->remaining_lifetime
[0] = 0;
2185 header_lsp
->remaining_lifetime
[1] = 0;
2190 * Decode IS-IS packets. Return 0 on error.
2194 isis_print(netdissect_options
*ndo
,
2195 const uint8_t *p
, u_int length
)
2197 const struct isis_common_header
*isis_header
;
2199 const struct isis_iih_lan_header
*header_iih_lan
;
2200 const struct isis_iih_ptp_header
*header_iih_ptp
;
2201 const struct isis_lsp_header
*header_lsp
;
2202 const struct isis_csnp_header
*header_csnp
;
2203 const struct isis_psnp_header
*header_psnp
;
2205 const struct isis_tlv_lsp
*tlv_lsp
;
2206 const struct isis_tlv_ptp_adj
*tlv_ptp_adj
;
2207 const struct isis_tlv_is_reach
*tlv_is_reach
;
2208 const struct isis_tlv_es_reach
*tlv_es_reach
;
2210 uint8_t pdu_type
, max_area
, id_length
, tlv_type
, tlv_len
, tmp
, alen
, lan_alen
, prefix_len
;
2211 uint8_t ext_is_len
, ext_ip_len
, mt_len
;
2212 uint8_t isis_subtlv_idrp
;
2213 const uint8_t *optr
, *pptr
, *tptr
;
2214 u_short packet_len
,pdu_len
, key_id
;
2219 optr
= p
; /* initialize the _o_riginal pointer to the packet start -
2220 need it for parsing the checksum TLV and authentication
2222 isis_header
= (const struct isis_common_header
*)p
;
2223 ND_TCHECK(*isis_header
);
2224 if (length
< ISIS_COMMON_HEADER_SIZE
)
2226 pptr
= p
+(ISIS_COMMON_HEADER_SIZE
);
2227 header_iih_lan
= (const struct isis_iih_lan_header
*)pptr
;
2228 header_iih_ptp
= (const struct isis_iih_ptp_header
*)pptr
;
2229 header_lsp
= (const struct isis_lsp_header
*)pptr
;
2230 header_csnp
= (const struct isis_csnp_header
*)pptr
;
2231 header_psnp
= (const struct isis_psnp_header
*)pptr
;
2233 if (!ndo
->ndo_eflag
)
2234 ND_PRINT((ndo
, "IS-IS"));
2237 * Sanity checking of the header.
2240 if (isis_header
->version
!= ISIS_VERSION
) {
2241 ND_PRINT((ndo
, "version %d packet not supported", isis_header
->version
));
2245 if ((isis_header
->id_length
!= SYSTEM_ID_LEN
) && (isis_header
->id_length
!= 0)) {
2246 ND_PRINT((ndo
, "system ID length of %d is not supported",
2247 isis_header
->id_length
));
2251 if (isis_header
->pdu_version
!= ISIS_VERSION
) {
2252 ND_PRINT((ndo
, "version %d packet not supported", isis_header
->pdu_version
));
2256 if (length
< isis_header
->fixed_len
) {
2257 ND_PRINT((ndo
, "fixed header length %u > packet length %u", isis_header
->fixed_len
, length
));
2261 if (isis_header
->fixed_len
< ISIS_COMMON_HEADER_SIZE
) {
2262 ND_PRINT((ndo
, "fixed header length %u < minimum header size %u", isis_header
->fixed_len
, (u_int
)ISIS_COMMON_HEADER_SIZE
));
2266 max_area
= isis_header
->max_area
;
2269 max_area
= 3; /* silly shit */
2272 ND_PRINT((ndo
, "bad packet -- 255 areas"));
2278 id_length
= isis_header
->id_length
;
2281 id_length
= 6; /* silly shit again */
2283 case 1: /* 1-8 are valid sys-ID lenghts */
2293 id_length
= 0; /* entirely useless */
2299 /* toss any non 6-byte sys-ID len PDUs */
2300 if (id_length
!= 6 ) {
2301 ND_PRINT((ndo
, "bad packet -- illegal sys-ID length (%u)", id_length
));
2305 pdu_type
=isis_header
->pdu_type
;
2307 /* in non-verbose mode print the basic PDU Type plus PDU specific brief information*/
2308 if (ndo
->ndo_vflag
== 0) {
2309 ND_PRINT((ndo
, "%s%s",
2310 ndo
->ndo_eflag
? "" : ", ",
2311 tok2str(isis_pdu_values
, "unknown PDU-Type %u", pdu_type
)));
2313 /* ok they seem to want to know everything - lets fully decode it */
2314 ND_PRINT((ndo
, "%slength %u", ndo
->ndo_eflag
? "" : ", ", length
));
2316 ND_PRINT((ndo
, "\n\t%s, hlen: %u, v: %u, pdu-v: %u, sys-id-len: %u (%u), max-area: %u (%u)",
2317 tok2str(isis_pdu_values
,
2320 isis_header
->fixed_len
,
2321 isis_header
->version
,
2322 isis_header
->pdu_version
,
2324 isis_header
->id_length
,
2326 isis_header
->max_area
));
2328 if (ndo
->ndo_vflag
> 1) {
2329 if (!print_unknown_data(ndo
, optr
, "\n\t", 8)) /* provide the _o_riginal pointer */
2330 return (0); /* for optionally debugging the common header */
2336 case ISIS_PDU_L1_LAN_IIH
:
2337 case ISIS_PDU_L2_LAN_IIH
:
2338 if (isis_header
->fixed_len
!= (ISIS_COMMON_HEADER_SIZE
+ISIS_IIH_LAN_HEADER_SIZE
)) {
2339 ND_PRINT((ndo
, ", bogus fixed header length %u should be %lu",
2340 isis_header
->fixed_len
, (unsigned long)(ISIS_COMMON_HEADER_SIZE
+ISIS_IIH_LAN_HEADER_SIZE
)));
2343 ND_TCHECK(*header_iih_lan
);
2344 if (length
< ISIS_COMMON_HEADER_SIZE
+ISIS_IIH_LAN_HEADER_SIZE
)
2346 if (ndo
->ndo_vflag
== 0) {
2347 ND_PRINT((ndo
, ", src-id %s",
2348 isis_print_id(header_iih_lan
->source_id
, SYSTEM_ID_LEN
)));
2349 ND_PRINT((ndo
, ", lan-id %s, prio %u",
2350 isis_print_id(header_iih_lan
->lan_id
,NODE_ID_LEN
),
2351 header_iih_lan
->priority
));
2352 ND_PRINT((ndo
, ", length %u", length
));
2355 pdu_len
=EXTRACT_BE_U_2(header_iih_lan
->pdu_len
);
2356 if (packet_len
>pdu_len
) {
2357 packet_len
=pdu_len
; /* do TLV decoding as long as it makes sense */
2361 ND_PRINT((ndo
, "\n\t source-id: %s, holding time: %us, Flags: [%s]",
2362 isis_print_id(header_iih_lan
->source_id
,SYSTEM_ID_LEN
),
2363 EXTRACT_BE_U_2(header_iih_lan
->holding_time
),
2364 tok2str(isis_iih_circuit_type_values
,
2365 "unknown circuit type 0x%02x",
2366 header_iih_lan
->circuit_type
)));
2368 ND_PRINT((ndo
, "\n\t lan-id: %s, Priority: %u, PDU length: %u",
2369 isis_print_id(header_iih_lan
->lan_id
, NODE_ID_LEN
),
2370 (header_iih_lan
->priority
) & ISIS_LAN_PRIORITY_MASK
,
2373 if (ndo
->ndo_vflag
> 1) {
2374 if (!print_unknown_data(ndo
, pptr
, "\n\t ", ISIS_IIH_LAN_HEADER_SIZE
))
2378 packet_len
-= (ISIS_COMMON_HEADER_SIZE
+ISIS_IIH_LAN_HEADER_SIZE
);
2379 pptr
= p
+ (ISIS_COMMON_HEADER_SIZE
+ISIS_IIH_LAN_HEADER_SIZE
);
2382 case ISIS_PDU_PTP_IIH
:
2383 if (isis_header
->fixed_len
!= (ISIS_COMMON_HEADER_SIZE
+ISIS_IIH_PTP_HEADER_SIZE
)) {
2384 ND_PRINT((ndo
, ", bogus fixed header length %u should be %lu",
2385 isis_header
->fixed_len
, (unsigned long)(ISIS_COMMON_HEADER_SIZE
+ISIS_IIH_PTP_HEADER_SIZE
)));
2388 ND_TCHECK(*header_iih_ptp
);
2389 if (length
< ISIS_COMMON_HEADER_SIZE
+ISIS_IIH_PTP_HEADER_SIZE
)
2391 if (ndo
->ndo_vflag
== 0) {
2392 ND_PRINT((ndo
, ", src-id %s", isis_print_id(header_iih_ptp
->source_id
, SYSTEM_ID_LEN
)));
2393 ND_PRINT((ndo
, ", length %u", length
));
2396 pdu_len
=EXTRACT_BE_U_2(header_iih_ptp
->pdu_len
);
2397 if (packet_len
>pdu_len
) {
2398 packet_len
=pdu_len
; /* do TLV decoding as long as it makes sense */
2402 ND_PRINT((ndo
, "\n\t source-id: %s, holding time: %us, Flags: [%s]",
2403 isis_print_id(header_iih_ptp
->source_id
,SYSTEM_ID_LEN
),
2404 EXTRACT_BE_U_2(header_iih_ptp
->holding_time
),
2405 tok2str(isis_iih_circuit_type_values
,
2406 "unknown circuit type 0x%02x",
2407 header_iih_ptp
->circuit_type
)));
2409 ND_PRINT((ndo
, "\n\t circuit-id: 0x%02x, PDU length: %u",
2410 header_iih_ptp
->circuit_id
,
2413 if (ndo
->ndo_vflag
> 1) {
2414 if (!print_unknown_data(ndo
, pptr
, "\n\t ", ISIS_IIH_PTP_HEADER_SIZE
))
2418 packet_len
-= (ISIS_COMMON_HEADER_SIZE
+ISIS_IIH_PTP_HEADER_SIZE
);
2419 pptr
= p
+ (ISIS_COMMON_HEADER_SIZE
+ISIS_IIH_PTP_HEADER_SIZE
);
2422 case ISIS_PDU_L1_LSP
:
2423 case ISIS_PDU_L2_LSP
:
2424 if (isis_header
->fixed_len
!= (ISIS_COMMON_HEADER_SIZE
+ISIS_LSP_HEADER_SIZE
)) {
2425 ND_PRINT((ndo
, ", bogus fixed header length %u should be %lu",
2426 isis_header
->fixed_len
, (unsigned long)ISIS_LSP_HEADER_SIZE
));
2429 ND_TCHECK(*header_lsp
);
2430 if (length
< ISIS_COMMON_HEADER_SIZE
+ISIS_LSP_HEADER_SIZE
)
2432 if (ndo
->ndo_vflag
== 0) {
2433 ND_PRINT((ndo
, ", lsp-id %s, seq 0x%08x, lifetime %5us",
2434 isis_print_id(header_lsp
->lsp_id
, LSP_ID_LEN
),
2435 EXTRACT_BE_U_4(header_lsp
->sequence_number
),
2436 EXTRACT_BE_U_2(header_lsp
->remaining_lifetime
)));
2437 ND_PRINT((ndo
, ", length %u", length
));
2440 pdu_len
=EXTRACT_BE_U_2(header_lsp
->pdu_len
);
2441 if (packet_len
>pdu_len
) {
2442 packet_len
=pdu_len
; /* do TLV decoding as long as it makes sense */
2446 ND_PRINT((ndo
, "\n\t lsp-id: %s, seq: 0x%08x, lifetime: %5us\n\t chksum: 0x%04x",
2447 isis_print_id(header_lsp
->lsp_id
, LSP_ID_LEN
),
2448 EXTRACT_BE_U_4(header_lsp
->sequence_number
),
2449 EXTRACT_BE_U_2(header_lsp
->remaining_lifetime
),
2450 EXTRACT_BE_U_2(header_lsp
->checksum
)));
2452 osi_print_cksum(ndo
, (const uint8_t *)header_lsp
->lsp_id
,
2453 EXTRACT_BE_U_2(header_lsp
->checksum
),
2456 ND_PRINT((ndo
, ", PDU length: %u, Flags: [ %s",
2458 ISIS_MASK_LSP_OL_BIT(header_lsp
->typeblock
) ? "Overload bit set, " : ""));
2460 if (ISIS_MASK_LSP_ATT_BITS(header_lsp
->typeblock
)) {
2461 ND_PRINT((ndo
, "%s", ISIS_MASK_LSP_ATT_DEFAULT_BIT(header_lsp
->typeblock
) ? "default " : ""));
2462 ND_PRINT((ndo
, "%s", ISIS_MASK_LSP_ATT_DELAY_BIT(header_lsp
->typeblock
) ? "delay " : ""));
2463 ND_PRINT((ndo
, "%s", ISIS_MASK_LSP_ATT_EXPENSE_BIT(header_lsp
->typeblock
) ? "expense " : ""));
2464 ND_PRINT((ndo
, "%s", ISIS_MASK_LSP_ATT_ERROR_BIT(header_lsp
->typeblock
) ? "error " : ""));
2465 ND_PRINT((ndo
, "ATT bit set, "));
2467 ND_PRINT((ndo
, "%s", ISIS_MASK_LSP_PARTITION_BIT(header_lsp
->typeblock
) ? "P bit set, " : ""));
2468 ND_PRINT((ndo
, "%s ]", tok2str(isis_lsp_istype_values
, "Unknown(0x%x)",
2469 ISIS_MASK_LSP_ISTYPE_BITS(header_lsp
->typeblock
))));
2471 if (ndo
->ndo_vflag
> 1) {
2472 if (!print_unknown_data(ndo
, pptr
, "\n\t ", ISIS_LSP_HEADER_SIZE
))
2476 packet_len
-= (ISIS_COMMON_HEADER_SIZE
+ISIS_LSP_HEADER_SIZE
);
2477 pptr
= p
+ (ISIS_COMMON_HEADER_SIZE
+ISIS_LSP_HEADER_SIZE
);
2480 case ISIS_PDU_L1_CSNP
:
2481 case ISIS_PDU_L2_CSNP
:
2482 if (isis_header
->fixed_len
!= (ISIS_COMMON_HEADER_SIZE
+ISIS_CSNP_HEADER_SIZE
)) {
2483 ND_PRINT((ndo
, ", bogus fixed header length %u should be %lu",
2484 isis_header
->fixed_len
, (unsigned long)(ISIS_COMMON_HEADER_SIZE
+ISIS_CSNP_HEADER_SIZE
)));
2487 ND_TCHECK(*header_csnp
);
2488 if (length
< ISIS_COMMON_HEADER_SIZE
+ISIS_CSNP_HEADER_SIZE
)
2490 if (ndo
->ndo_vflag
== 0) {
2491 ND_PRINT((ndo
, ", src-id %s", isis_print_id(header_csnp
->source_id
, NODE_ID_LEN
)));
2492 ND_PRINT((ndo
, ", length %u", length
));
2495 pdu_len
=EXTRACT_BE_U_2(header_csnp
->pdu_len
);
2496 if (packet_len
>pdu_len
) {
2497 packet_len
=pdu_len
; /* do TLV decoding as long as it makes sense */
2501 ND_PRINT((ndo
, "\n\t source-id: %s, PDU length: %u",
2502 isis_print_id(header_csnp
->source_id
, NODE_ID_LEN
),
2504 ND_PRINT((ndo
, "\n\t start lsp-id: %s",
2505 isis_print_id(header_csnp
->start_lsp_id
, LSP_ID_LEN
)));
2506 ND_PRINT((ndo
, "\n\t end lsp-id: %s",
2507 isis_print_id(header_csnp
->end_lsp_id
, LSP_ID_LEN
)));
2509 if (ndo
->ndo_vflag
> 1) {
2510 if (!print_unknown_data(ndo
, pptr
, "\n\t ", ISIS_CSNP_HEADER_SIZE
))
2514 packet_len
-= (ISIS_COMMON_HEADER_SIZE
+ISIS_CSNP_HEADER_SIZE
);
2515 pptr
= p
+ (ISIS_COMMON_HEADER_SIZE
+ISIS_CSNP_HEADER_SIZE
);
2518 case ISIS_PDU_L1_PSNP
:
2519 case ISIS_PDU_L2_PSNP
:
2520 if (isis_header
->fixed_len
!= (ISIS_COMMON_HEADER_SIZE
+ISIS_PSNP_HEADER_SIZE
)) {
2521 ND_PRINT((ndo
, "- bogus fixed header length %u should be %lu",
2522 isis_header
->fixed_len
, (unsigned long)(ISIS_COMMON_HEADER_SIZE
+ISIS_PSNP_HEADER_SIZE
)));
2525 ND_TCHECK(*header_psnp
);
2526 if (length
< ISIS_COMMON_HEADER_SIZE
+ISIS_PSNP_HEADER_SIZE
)
2528 if (ndo
->ndo_vflag
== 0) {
2529 ND_PRINT((ndo
, ", src-id %s", isis_print_id(header_psnp
->source_id
, NODE_ID_LEN
)));
2530 ND_PRINT((ndo
, ", length %u", length
));
2533 pdu_len
=EXTRACT_BE_U_2(header_psnp
->pdu_len
);
2534 if (packet_len
>pdu_len
) {
2535 packet_len
=pdu_len
; /* do TLV decoding as long as it makes sense */
2539 ND_PRINT((ndo
, "\n\t source-id: %s, PDU length: %u",
2540 isis_print_id(header_psnp
->source_id
, NODE_ID_LEN
),
2543 if (ndo
->ndo_vflag
> 1) {
2544 if (!print_unknown_data(ndo
, pptr
, "\n\t ", ISIS_PSNP_HEADER_SIZE
))
2548 packet_len
-= (ISIS_COMMON_HEADER_SIZE
+ISIS_PSNP_HEADER_SIZE
);
2549 pptr
= p
+ (ISIS_COMMON_HEADER_SIZE
+ISIS_PSNP_HEADER_SIZE
);
2553 if (ndo
->ndo_vflag
== 0) {
2554 ND_PRINT((ndo
, ", length %u", length
));
2557 (void)print_unknown_data(ndo
, pptr
, "\n\t ", length
);
2562 * Now print the TLV's.
2565 while (packet_len
> 0) {
2569 tlv_type
= EXTRACT_U_1(pptr
);
2570 tlv_len
= EXTRACT_U_1(pptr
+ 1);
2573 tmp
=tlv_len
; /* copy temporary len & pointer to packet data */
2576 /* first lets see if we know the TLVs name*/
2577 ND_PRINT((ndo
, "\n\t %s TLV #%u, length: %u",
2578 tok2str(isis_tlv_values
,
2584 if (tlv_len
== 0) /* something is invalid */
2587 if (packet_len
< tlv_len
)
2590 /* now check if we have a decoder otherwise do a hexdump at the end*/
2592 case ISIS_TLV_AREA_ADDR
:
2594 alen
= EXTRACT_U_1(tptr
);
2596 while (tmp
&& alen
< tmp
) {
2597 ND_TCHECK_LEN(tptr
, alen
);
2598 ND_PRINT((ndo
, "\n\t Area address (length: %u): %s",
2600 isonsap_string(ndo
, tptr
, alen
)));
2603 if (tmp
==0) /* if this is the last area address do not attemt a boundary check */
2606 alen
= EXTRACT_U_1(tptr
);
2610 case ISIS_TLV_ISNEIGH
:
2611 while (tmp
>= MAC_ADDR_LEN
) {
2612 ND_TCHECK_LEN(tptr
, MAC_ADDR_LEN
);
2613 ND_PRINT((ndo
, "\n\t SNPA: %s", isis_print_id(tptr
, MAC_ADDR_LEN
)));
2614 tmp
-= MAC_ADDR_LEN
;
2615 tptr
+= MAC_ADDR_LEN
;
2619 case ISIS_TLV_ISNEIGH_VARLEN
:
2620 if (!ND_TTEST_1(tptr
) || tmp
< 3) /* min. TLV length */
2622 lan_alen
= EXTRACT_U_1(tptr
); /* LAN address length */
2624 if (lan_alen
== 0) {
2625 ND_PRINT((ndo
, "\n\t LAN address length 0 bytes (invalid)"));
2629 ND_PRINT((ndo
, "\n\t LAN address length %u bytes ", lan_alen
));
2630 while (tmp
>= lan_alen
) {
2631 ND_TCHECK_LEN(tptr
, lan_alen
);
2632 ND_PRINT((ndo
, "\n\t\tIS Neighbor: %s", isis_print_id(tptr
, lan_alen
)));
2638 case ISIS_TLV_PADDING
:
2641 case ISIS_TLV_MT_IS_REACH
:
2642 mt_len
= isis_print_mtid(ndo
, tptr
, "\n\t ");
2643 if (mt_len
== 0) /* did something go wrong ? */
2647 while (tmp
>= 2+NODE_ID_LEN
+3+1) {
2648 ext_is_len
= isis_print_ext_is_reach(ndo
, tptr
, "\n\t ", tlv_type
);
2649 if (ext_is_len
== 0) /* did something go wrong ? */
2657 case ISIS_TLV_IS_ALIAS_ID
:
2658 while (tmp
>= NODE_ID_LEN
+1) { /* is it worth attempting a decode ? */
2659 ext_is_len
= isis_print_ext_is_reach(ndo
, tptr
, "\n\t ", tlv_type
);
2660 if (ext_is_len
== 0) /* did something go wrong ? */
2667 case ISIS_TLV_EXT_IS_REACH
:
2668 while (tmp
>= NODE_ID_LEN
+3+1) { /* is it worth attempting a decode ? */
2669 ext_is_len
= isis_print_ext_is_reach(ndo
, tptr
, "\n\t ", tlv_type
);
2670 if (ext_is_len
== 0) /* did something go wrong ? */
2676 case ISIS_TLV_IS_REACH
:
2677 ND_TCHECK_1(tptr
); /* check if there is one byte left to read out the virtual flag */
2678 ND_PRINT((ndo
, "\n\t %s",
2679 tok2str(isis_is_reach_virtual_values
,
2680 "bogus virtual flag 0x%02x",
2681 EXTRACT_U_1(tptr
))));
2683 tlv_is_reach
= (const struct isis_tlv_is_reach
*)tptr
;
2684 while (tmp
>= sizeof(struct isis_tlv_is_reach
)) {
2685 ND_TCHECK(*tlv_is_reach
);
2686 ND_PRINT((ndo
, "\n\t IS Neighbor: %s",
2687 isis_print_id(tlv_is_reach
->neighbor_nodeid
, NODE_ID_LEN
)));
2688 isis_print_metric_block(ndo
, &tlv_is_reach
->isis_metric_block
);
2689 tmp
-= sizeof(struct isis_tlv_is_reach
);
2694 case ISIS_TLV_ESNEIGH
:
2695 tlv_es_reach
= (const struct isis_tlv_es_reach
*)tptr
;
2696 while (tmp
>= sizeof(struct isis_tlv_es_reach
)) {
2697 ND_TCHECK(*tlv_es_reach
);
2698 ND_PRINT((ndo
, "\n\t ES Neighbor: %s",
2699 isis_print_id(tlv_es_reach
->neighbor_sysid
, SYSTEM_ID_LEN
)));
2700 isis_print_metric_block(ndo
, &tlv_es_reach
->isis_metric_block
);
2701 tmp
-= sizeof(struct isis_tlv_es_reach
);
2706 /* those two TLVs share the same format */
2707 case ISIS_TLV_INT_IP_REACH
:
2708 case ISIS_TLV_EXT_IP_REACH
:
2709 if (!isis_print_tlv_ip_reach(ndo
, pptr
, "\n\t ", tlv_len
))
2713 case ISIS_TLV_EXTD_IP_REACH
:
2715 ext_ip_len
= isis_print_extd_ip_reach(ndo
, tptr
, "\n\t ", AF_INET
);
2716 if (ext_ip_len
== 0) /* did something go wrong ? */
2723 case ISIS_TLV_MT_IP_REACH
:
2724 mt_len
= isis_print_mtid(ndo
, tptr
, "\n\t ");
2725 if (mt_len
== 0) { /* did something go wrong ? */
2732 ext_ip_len
= isis_print_extd_ip_reach(ndo
, tptr
, "\n\t ", AF_INET
);
2733 if (ext_ip_len
== 0) /* did something go wrong ? */
2740 case ISIS_TLV_IP6_REACH
:
2742 ext_ip_len
= isis_print_extd_ip_reach(ndo
, tptr
, "\n\t ", AF_INET6
);
2743 if (ext_ip_len
== 0) /* did something go wrong ? */
2750 case ISIS_TLV_MT_IP6_REACH
:
2751 mt_len
= isis_print_mtid(ndo
, tptr
, "\n\t ");
2752 if (mt_len
== 0) { /* did something go wrong ? */
2759 ext_ip_len
= isis_print_extd_ip_reach(ndo
, tptr
, "\n\t ", AF_INET6
);
2760 if (ext_ip_len
== 0) /* did something go wrong ? */
2767 case ISIS_TLV_IP6ADDR
:
2768 while (tmp
>=sizeof(struct in6_addr
)) {
2769 ND_TCHECK_LEN(tptr
, sizeof(struct in6_addr
));
2771 ND_PRINT((ndo
, "\n\t IPv6 interface address: %s",
2772 ip6addr_string(ndo
, tptr
)));
2774 tptr
+= sizeof(struct in6_addr
);
2775 tmp
-= sizeof(struct in6_addr
);
2781 ND_PRINT((ndo
, "\n\t %s: ",
2782 tok2str(isis_subtlv_auth_values
,
2783 "unknown Authentication type 0x%02x",
2784 EXTRACT_U_1(tptr
))));
2786 switch (EXTRACT_U_1(tptr
)) {
2787 case ISIS_SUBTLV_AUTH_SIMPLE
:
2788 if (fn_printzp(ndo
, tptr
+ 1, tlv_len
- 1, ndo
->ndo_snapend
))
2791 case ISIS_SUBTLV_AUTH_MD5
:
2792 for(i
=1;i
<tlv_len
;i
++) {
2793 ND_TCHECK_1(tptr
+ i
);
2794 ND_PRINT((ndo
, "%02x", EXTRACT_U_1(tptr
+ i
)));
2796 if (tlv_len
!= ISIS_SUBTLV_AUTH_MD5_LEN
+1)
2797 ND_PRINT((ndo
, ", (invalid subTLV) "));
2799 sigcheck
= signature_verify(ndo
, optr
, length
, tptr
+ 1,
2800 isis_clear_checksum_lifetime
,
2802 ND_PRINT((ndo
, " (%s)", tok2str(signature_check_values
, "Unknown", sigcheck
)));
2805 case ISIS_SUBTLV_AUTH_GENERIC
:
2806 ND_TCHECK_2(tptr
+ 1);
2807 key_id
= EXTRACT_BE_U_2(tptr
+ 1);
2808 ND_PRINT((ndo
, "%u, password: ", key_id
));
2809 for(i
=1 + sizeof(uint16_t);i
<tlv_len
;i
++) {
2810 ND_TCHECK_1(tptr
+ i
);
2811 ND_PRINT((ndo
, "%02x", EXTRACT_U_1(tptr
+ i
)));
2814 case ISIS_SUBTLV_AUTH_PRIVATE
:
2816 if (!print_unknown_data(ndo
, tptr
+ 1, "\n\t\t ", tlv_len
- 1))
2822 case ISIS_TLV_PTP_ADJ
:
2823 tlv_ptp_adj
= (const struct isis_tlv_ptp_adj
*)tptr
;
2826 ND_PRINT((ndo
, "\n\t Adjacency State: %s (%u)",
2827 tok2str(isis_ptp_adjancey_values
, "unknown", EXTRACT_U_1(tptr
)),
2828 EXTRACT_U_1(tptr
)));
2831 if(tmp
>sizeof(tlv_ptp_adj
->extd_local_circuit_id
)) {
2832 ND_TCHECK(tlv_ptp_adj
->extd_local_circuit_id
);
2833 ND_PRINT((ndo
, "\n\t Extended Local circuit-ID: 0x%08x",
2834 EXTRACT_BE_U_4(tlv_ptp_adj
->extd_local_circuit_id
)));
2835 tmp
-=sizeof(tlv_ptp_adj
->extd_local_circuit_id
);
2837 if(tmp
>=SYSTEM_ID_LEN
) {
2838 ND_TCHECK_LEN(tlv_ptp_adj
->neighbor_sysid
, SYSTEM_ID_LEN
);
2839 ND_PRINT((ndo
, "\n\t Neighbor System-ID: %s",
2840 isis_print_id(tlv_ptp_adj
->neighbor_sysid
, SYSTEM_ID_LEN
)));
2843 if(tmp
>=sizeof(tlv_ptp_adj
->neighbor_extd_local_circuit_id
)) {
2844 ND_TCHECK(tlv_ptp_adj
->neighbor_extd_local_circuit_id
);
2845 ND_PRINT((ndo
, "\n\t Neighbor Extended Local circuit-ID: 0x%08x",
2846 EXTRACT_BE_U_4(tlv_ptp_adj
->neighbor_extd_local_circuit_id
)));
2850 case ISIS_TLV_PROTOCOLS
:
2851 ND_PRINT((ndo
, "\n\t NLPID(s): "));
2854 ND_PRINT((ndo
, "%s (0x%02x)",
2855 tok2str(nlpid_values
,
2858 EXTRACT_U_1(tptr
)));
2859 if (tmp
>1) /* further NPLIDs ? - put comma */
2860 ND_PRINT((ndo
, ", "));
2866 case ISIS_TLV_MT_PORT_CAP
:
2870 ND_PRINT((ndo
, "\n\t RES: %d, MTID(s): %d",
2871 (EXTRACT_BE_U_2(tptr
) >> 12),
2872 (EXTRACT_BE_U_2(tptr
) & 0x0fff)));
2878 isis_print_mt_port_cap_subtlv(ndo
, tptr
, tmp
);
2883 case ISIS_TLV_MT_CAPABILITY
:
2887 ND_PRINT((ndo
, "\n\t O: %d, RES: %d, MTID(s): %d",
2888 (EXTRACT_BE_U_2(tptr
) >> 15) & 0x01,
2889 (EXTRACT_BE_U_2(tptr
) >> 12) & 0x07,
2890 EXTRACT_BE_U_2(tptr
) & 0x0fff));
2896 isis_print_mt_capability_subtlv(ndo
, tptr
, tmp
);
2900 case ISIS_TLV_TE_ROUTER_ID
:
2901 ND_TCHECK_LEN(pptr
, sizeof(struct in_addr
));
2902 ND_PRINT((ndo
, "\n\t Traffic Engineering Router ID: %s", ipaddr_string(ndo
, pptr
)));
2905 case ISIS_TLV_IPADDR
:
2906 while (tmp
>=sizeof(struct in_addr
)) {
2907 ND_TCHECK_LEN(tptr
, sizeof(struct in_addr
));
2908 ND_PRINT((ndo
, "\n\t IPv4 interface address: %s", ipaddr_string(ndo
, tptr
)));
2909 tptr
+= sizeof(struct in_addr
);
2910 tmp
-= sizeof(struct in_addr
);
2914 case ISIS_TLV_HOSTNAME
:
2915 ND_PRINT((ndo
, "\n\t Hostname: "));
2916 if (fn_printzp(ndo
, tptr
, tmp
, ndo
->ndo_snapend
))
2920 case ISIS_TLV_SHARED_RISK_GROUP
:
2921 if (tmp
< NODE_ID_LEN
)
2923 ND_TCHECK_LEN(tptr
, NODE_ID_LEN
);
2924 ND_PRINT((ndo
, "\n\t IS Neighbor: %s", isis_print_id(tptr
, NODE_ID_LEN
)));
2931 ND_PRINT((ndo
, ", Flags: [%s]", ISIS_MASK_TLV_SHARED_RISK_GROUP(EXTRACT_U_1(tptr
)) ? "numbered" : "unnumbered"));
2935 if (tmp
< sizeof(struct in_addr
))
2937 ND_TCHECK_LEN(tptr
, sizeof(struct in_addr
));
2938 ND_PRINT((ndo
, "\n\t IPv4 interface address: %s", ipaddr_string(ndo
, tptr
)));
2939 tptr
+=sizeof(struct in_addr
);
2940 tmp
-=sizeof(struct in_addr
);
2942 if (tmp
< sizeof(struct in_addr
))
2944 ND_TCHECK_LEN(tptr
, sizeof(struct in_addr
));
2945 ND_PRINT((ndo
, "\n\t IPv4 neighbor address: %s", ipaddr_string(ndo
, tptr
)));
2946 tptr
+=sizeof(struct in_addr
);
2947 tmp
-=sizeof(struct in_addr
);
2951 ND_PRINT((ndo
, "\n\t Link-ID: 0x%08x", EXTRACT_BE_U_4(tptr
)));
2958 tlv_lsp
= (const struct isis_tlv_lsp
*)tptr
;
2959 while(tmp
>=sizeof(struct isis_tlv_lsp
)) {
2960 ND_TCHECK((tlv_lsp
->lsp_id
)[LSP_ID_LEN
-1]);
2961 ND_PRINT((ndo
, "\n\t lsp-id: %s",
2962 isis_print_id(tlv_lsp
->lsp_id
, LSP_ID_LEN
)));
2963 ND_TCHECK_LEN(tlv_lsp
->sequence_number
, 4);
2964 ND_PRINT((ndo
, ", seq: 0x%08x", EXTRACT_BE_U_4(tlv_lsp
->sequence_number
)));
2965 ND_TCHECK_LEN(tlv_lsp
->remaining_lifetime
, 2);
2966 ND_PRINT((ndo
, ", lifetime: %5ds", EXTRACT_BE_U_2(tlv_lsp
->remaining_lifetime
)));
2967 ND_TCHECK_LEN(tlv_lsp
->checksum
, 2);
2968 ND_PRINT((ndo
, ", chksum: 0x%04x", EXTRACT_BE_U_2(tlv_lsp
->checksum
)));
2969 tmp
-=sizeof(struct isis_tlv_lsp
);
2974 case ISIS_TLV_CHECKSUM
:
2975 if (tmp
< ISIS_TLV_CHECKSUM_MINLEN
)
2977 ND_TCHECK_LEN(tptr
, ISIS_TLV_CHECKSUM_MINLEN
);
2978 ND_PRINT((ndo
, "\n\t checksum: 0x%04x ", EXTRACT_BE_U_2(tptr
)));
2979 /* do not attempt to verify the checksum if it is zero
2980 * most likely a HMAC-MD5 TLV is also present and
2981 * to avoid conflicts the checksum TLV is zeroed.
2982 * see rfc3358 for details
2984 osi_print_cksum(ndo
, optr
, EXTRACT_BE_U_2(tptr
), tptr
-optr
,
2989 if (tlv_len
>= SYSTEM_ID_LEN
+ 1) {
2990 ND_TCHECK_LEN(tptr
, SYSTEM_ID_LEN
+ 1);
2991 ND_PRINT((ndo
, "\n\t Purge Originator System-ID: %s",
2992 isis_print_id(tptr
+ 1, SYSTEM_ID_LEN
)));
2995 if (tlv_len
== 2 * SYSTEM_ID_LEN
+ 1) {
2996 ND_TCHECK_LEN(tptr
, 2 * SYSTEM_ID_LEN
+ 1);
2997 ND_PRINT((ndo
, "\n\t Received from System-ID: %s",
2998 isis_print_id(tptr
+ SYSTEM_ID_LEN
+ 1, SYSTEM_ID_LEN
)));
3002 case ISIS_TLV_MT_SUPPORTED
:
3003 if (tmp
< ISIS_TLV_MT_SUPPORTED_MINLEN
)
3006 /* length can only be a multiple of 2, otherwise there is
3007 something broken -> so decode down until length is 1 */
3009 mt_len
= isis_print_mtid(ndo
, tptr
, "\n\t ");
3010 if (mt_len
== 0) /* did something go wrong ? */
3015 ND_PRINT((ndo
, "\n\t invalid MT-ID"));
3021 case ISIS_TLV_RESTART_SIGNALING
:
3022 /* first attempt to decode the flags */
3023 if (tmp
< ISIS_TLV_RESTART_SIGNALING_FLAGLEN
)
3025 ND_TCHECK_LEN(tptr
, ISIS_TLV_RESTART_SIGNALING_FLAGLEN
);
3026 ND_PRINT((ndo
, "\n\t Flags [%s]",
3027 bittok2str(isis_restart_flag_values
, "none", EXTRACT_U_1(tptr
))));
3028 tptr
+=ISIS_TLV_RESTART_SIGNALING_FLAGLEN
;
3029 tmp
-=ISIS_TLV_RESTART_SIGNALING_FLAGLEN
;
3031 /* is there anything other than the flags field? */
3035 if (tmp
< ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN
)
3037 ND_TCHECK_LEN(tptr
, ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN
);
3039 ND_PRINT((ndo
, ", Remaining holding time %us", EXTRACT_BE_U_2(tptr
)));
3040 tptr
+=ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN
;
3041 tmp
-=ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN
;
3043 /* is there an additional sysid field present ?*/
3044 if (tmp
== SYSTEM_ID_LEN
) {
3045 ND_TCHECK_LEN(tptr
, SYSTEM_ID_LEN
);
3046 ND_PRINT((ndo
, ", for %s", isis_print_id(tptr
,SYSTEM_ID_LEN
)));
3050 case ISIS_TLV_IDRP_INFO
:
3051 if (tmp
< ISIS_TLV_IDRP_INFO_MINLEN
)
3053 ND_TCHECK_LEN(tptr
, ISIS_TLV_IDRP_INFO_MINLEN
);
3054 ND_PRINT((ndo
, "\n\t Inter-Domain Information Type: %s",
3055 tok2str(isis_subtlv_idrp_values
,
3057 EXTRACT_U_1(tptr
))));
3058 isis_subtlv_idrp
= EXTRACT_U_1(tptr
);
3060 switch (isis_subtlv_idrp
) {
3061 case ISIS_SUBTLV_IDRP_ASN
:
3062 ND_TCHECK_2(tptr
); /* fetch AS number */
3063 ND_PRINT((ndo
, "AS Number: %u", EXTRACT_BE_U_2(tptr
)));
3065 case ISIS_SUBTLV_IDRP_LOCAL
:
3066 case ISIS_SUBTLV_IDRP_RES
:
3068 if (!print_unknown_data(ndo
, tptr
, "\n\t ", tlv_len
- 1))
3074 case ISIS_TLV_LSP_BUFFERSIZE
:
3075 if (tmp
< ISIS_TLV_LSP_BUFFERSIZE_MINLEN
)
3077 ND_TCHECK_LEN(tptr
, ISIS_TLV_LSP_BUFFERSIZE_MINLEN
);
3078 ND_PRINT((ndo
, "\n\t LSP Buffersize: %u", EXTRACT_BE_U_2(tptr
)));
3081 case ISIS_TLV_PART_DIS
:
3082 while (tmp
>= SYSTEM_ID_LEN
) {
3083 ND_TCHECK_LEN(tptr
, SYSTEM_ID_LEN
);
3084 ND_PRINT((ndo
, "\n\t %s", isis_print_id(tptr
, SYSTEM_ID_LEN
)));
3085 tptr
+=SYSTEM_ID_LEN
;
3090 case ISIS_TLV_PREFIX_NEIGH
:
3091 if (tmp
< sizeof(struct isis_metric_block
))
3093 ND_TCHECK_LEN(tptr
, sizeof(struct isis_metric_block
));
3094 ND_PRINT((ndo
, "\n\t Metric Block"));
3095 isis_print_metric_block(ndo
, (const struct isis_metric_block
*)tptr
);
3096 tptr
+=sizeof(struct isis_metric_block
);
3097 tmp
-=sizeof(struct isis_metric_block
);
3101 prefix_len
=EXTRACT_U_1(tptr
); /* read out prefix length in semioctets*/
3103 if (prefix_len
< 2) {
3104 ND_PRINT((ndo
, "\n\t\tAddress: prefix length %u < 2", prefix_len
));
3108 if (tmp
< prefix_len
/2)
3110 ND_TCHECK_LEN(tptr
, prefix_len
/ 2);
3111 ND_PRINT((ndo
, "\n\t\tAddress: %s/%u",
3112 isonsap_string(ndo
, tptr
, prefix_len
/ 2), prefix_len
* 4));
3118 case ISIS_TLV_IIH_SEQNR
:
3119 if (tmp
< ISIS_TLV_IIH_SEQNR_MINLEN
)
3121 ND_TCHECK_LEN(tptr
, ISIS_TLV_IIH_SEQNR_MINLEN
); /* check if four bytes are on the wire */
3122 ND_PRINT((ndo
, "\n\t Sequence number: %u", EXTRACT_BE_U_4(tptr
)));
3125 case ISIS_TLV_VENDOR_PRIVATE
:
3126 if (tmp
< ISIS_TLV_VENDOR_PRIVATE_MINLEN
)
3128 ND_TCHECK_LEN(tptr
, ISIS_TLV_VENDOR_PRIVATE_MINLEN
); /* check if enough byte for a full oui */
3129 vendor_id
= EXTRACT_BE_U_3(tptr
);
3130 ND_PRINT((ndo
, "\n\t Vendor: %s (%u)",
3131 tok2str(oui_values
, "Unknown", vendor_id
),
3135 if (tmp
> 0) /* hexdump the rest */
3136 if (!print_unknown_data(ndo
, tptr
, "\n\t\t", tmp
))
3140 * FIXME those are the defined TLVs that lack a decoder
3141 * you are welcome to contribute code ;-)
3144 case ISIS_TLV_DECNET_PHASE4
:
3145 case ISIS_TLV_LUCENT_PRIVATE
:
3146 case ISIS_TLV_IPAUTH
:
3147 case ISIS_TLV_NORTEL_PRIVATE1
:
3148 case ISIS_TLV_NORTEL_PRIVATE2
:
3151 if (ndo
->ndo_vflag
<= 1) {
3152 if (!print_unknown_data(ndo
, pptr
, "\n\t\t", tlv_len
))
3157 /* do we want to see an additionally hexdump ? */
3158 if (ndo
->ndo_vflag
> 1) {
3159 if (!print_unknown_data(ndo
, pptr
, "\n\t ", tlv_len
))
3164 packet_len
-= tlv_len
;
3167 if (packet_len
!= 0) {
3168 ND_PRINT((ndo
, "\n\t %u straggler bytes", packet_len
));
3173 ND_PRINT((ndo
, "%s", tstr
));
3177 ND_PRINT((ndo
, "\n\t\t"));
3178 ND_PRINT((ndo
, "%s", tstr
));
3183 osi_print_cksum(netdissect_options
*ndo
, const uint8_t *pptr
,
3184 uint16_t checksum
, int checksum_offset
, u_int length
)
3186 uint16_t calculated_checksum
;
3188 /* do not attempt to verify the checksum if it is zero,
3189 * if the offset is nonsense,
3190 * or the base pointer is not sane
3193 || checksum_offset
< 0
3194 || !ND_TTEST_2(pptr
+ checksum_offset
)
3195 || (u_int
)checksum_offset
> length
3196 || !ND_TTEST_LEN(pptr
, length
)) {
3197 ND_PRINT((ndo
, " (unverified)"));
3200 printf("\nosi_print_cksum: %p %u %u\n", pptr
, checksum_offset
, length
);
3202 calculated_checksum
= create_osi_cksum(pptr
, checksum_offset
, length
);
3203 if (checksum
== calculated_checksum
) {
3204 ND_PRINT((ndo
, " (correct)"));
3206 ND_PRINT((ndo
, " (incorrect should be 0x%04x)", calculated_checksum
));
3213 * c-style: whitesmith