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 */
32 * CLNP: ISO 8473 (respective ITU version is at http://www.itu.int/rec/T-REC-X.233/en/)
41 #include "netdissect-stdinc.h"
45 #include "netdissect.h"
46 #include "addrtoname.h"
51 #include "signature.h"
55 * IS-IS is defined in ISO 10589. Look there for protocol definitions.
58 #define SYSTEM_ID_LEN MAC_ADDR_LEN
59 #define NODE_ID_LEN (SYSTEM_ID_LEN+1)
60 #define LSP_ID_LEN (SYSTEM_ID_LEN+2)
62 #define ISIS_VERSION 1
63 #define ESIS_VERSION 1
64 #define CLNP_VERSION 1
66 #define ISIS_PDU_TYPE_MASK 0x1F
67 #define ESIS_PDU_TYPE_MASK 0x1F
68 #define CLNP_PDU_TYPE_MASK 0x1F
69 #define CLNP_FLAG_MASK 0xE0
70 #define ISIS_LAN_PRIORITY_MASK 0x7F
72 #define ISIS_PDU_L1_LAN_IIH 15
73 #define ISIS_PDU_L2_LAN_IIH 16
74 #define ISIS_PDU_PTP_IIH 17
75 #define ISIS_PDU_L1_LSP 18
76 #define ISIS_PDU_L2_LSP 20
77 #define ISIS_PDU_L1_CSNP 24
78 #define ISIS_PDU_L2_CSNP 25
79 #define ISIS_PDU_L1_PSNP 26
80 #define ISIS_PDU_L2_PSNP 27
82 static const struct tok isis_pdu_values
[] = {
83 { ISIS_PDU_L1_LAN_IIH
, "L1 Lan IIH"},
84 { ISIS_PDU_L2_LAN_IIH
, "L2 Lan IIH"},
85 { ISIS_PDU_PTP_IIH
, "p2p IIH"},
86 { ISIS_PDU_L1_LSP
, "L1 LSP"},
87 { ISIS_PDU_L2_LSP
, "L2 LSP"},
88 { ISIS_PDU_L1_CSNP
, "L1 CSNP"},
89 { ISIS_PDU_L2_CSNP
, "L2 CSNP"},
90 { ISIS_PDU_L1_PSNP
, "L1 PSNP"},
91 { ISIS_PDU_L2_PSNP
, "L2 PSNP"},
96 * A TLV is a tuple of a type, length and a value and is normally used for
97 * encoding information in all sorts of places. This is an enumeration of
98 * the well known types.
100 * list taken from rfc3359 plus some memory from veterans ;-)
103 #define ISIS_TLV_AREA_ADDR 1 /* iso10589 */
104 #define ISIS_TLV_IS_REACH 2 /* iso10589 */
105 #define ISIS_TLV_ESNEIGH 3 /* iso10589 */
106 #define ISIS_TLV_PART_DIS 4 /* iso10589 */
107 #define ISIS_TLV_PREFIX_NEIGH 5 /* iso10589 */
108 #define ISIS_TLV_ISNEIGH 6 /* iso10589 */
109 #define ISIS_TLV_ISNEIGH_VARLEN 7 /* iso10589 */
110 #define ISIS_TLV_PADDING 8 /* iso10589 */
111 #define ISIS_TLV_LSP 9 /* iso10589 */
112 #define ISIS_TLV_AUTH 10 /* iso10589, rfc3567 */
113 #define ISIS_TLV_CHECKSUM 12 /* rfc3358 */
114 #define ISIS_TLV_CHECKSUM_MINLEN 2
115 #define ISIS_TLV_POI 13 /* rfc6232 */
116 #define ISIS_TLV_LSP_BUFFERSIZE 14 /* iso10589 rev2 */
117 #define ISIS_TLV_LSP_BUFFERSIZE_MINLEN 2
118 #define ISIS_TLV_EXT_IS_REACH 22 /* rfc5305 */
119 #define ISIS_TLV_IS_ALIAS_ID 24 /* rfc5311 */
120 #define ISIS_TLV_DECNET_PHASE4 42
121 #define ISIS_TLV_LUCENT_PRIVATE 66
122 #define ISIS_TLV_INT_IP_REACH 128 /* rfc1195, rfc2966 */
123 #define ISIS_TLV_PROTOCOLS 129 /* rfc1195 */
124 #define ISIS_TLV_EXT_IP_REACH 130 /* rfc1195, rfc2966 */
125 #define ISIS_TLV_IDRP_INFO 131 /* rfc1195 */
126 #define ISIS_TLV_IDRP_INFO_MINLEN 1
127 #define ISIS_TLV_IPADDR 132 /* rfc1195 */
128 #define ISIS_TLV_IPAUTH 133 /* rfc1195 */
129 #define ISIS_TLV_TE_ROUTER_ID 134 /* rfc5305 */
130 #define ISIS_TLV_EXTD_IP_REACH 135 /* rfc5305 */
131 #define ISIS_TLV_HOSTNAME 137 /* rfc2763 */
132 #define ISIS_TLV_SHARED_RISK_GROUP 138 /* draft-ietf-isis-gmpls-extensions */
133 #define ISIS_TLV_MT_PORT_CAP 143 /* rfc6165 */
134 #define ISIS_TLV_MT_CAPABILITY 144 /* rfc6329 */
135 #define ISIS_TLV_NORTEL_PRIVATE1 176
136 #define ISIS_TLV_NORTEL_PRIVATE2 177
137 #define ISIS_TLV_RESTART_SIGNALING 211 /* rfc3847 */
138 #define ISIS_TLV_RESTART_SIGNALING_FLAGLEN 1
139 #define ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN 2
140 #define ISIS_TLV_MT_IS_REACH 222 /* draft-ietf-isis-wg-multi-topology-05 */
141 #define ISIS_TLV_MT_SUPPORTED 229 /* draft-ietf-isis-wg-multi-topology-05 */
142 #define ISIS_TLV_MT_SUPPORTED_MINLEN 2
143 #define ISIS_TLV_IP6ADDR 232 /* draft-ietf-isis-ipv6-02 */
144 #define ISIS_TLV_MT_IP_REACH 235 /* draft-ietf-isis-wg-multi-topology-05 */
145 #define ISIS_TLV_IP6_REACH 236 /* draft-ietf-isis-ipv6-02 */
146 #define ISIS_TLV_MT_IP6_REACH 237 /* draft-ietf-isis-wg-multi-topology-05 */
147 #define ISIS_TLV_PTP_ADJ 240 /* rfc3373 */
148 #define ISIS_TLV_IIH_SEQNR 241 /* draft-shen-isis-iih-sequence-00 */
149 #define ISIS_TLV_IIH_SEQNR_MINLEN 4
150 #define ISIS_TLV_VENDOR_PRIVATE 250 /* draft-ietf-isis-experimental-tlv-01 */
151 #define ISIS_TLV_VENDOR_PRIVATE_MINLEN 3
153 static const struct tok isis_tlv_values
[] = {
154 { ISIS_TLV_AREA_ADDR
, "Area address(es)"},
155 { ISIS_TLV_IS_REACH
, "IS Reachability"},
156 { ISIS_TLV_ESNEIGH
, "ES Neighbor(s)"},
157 { ISIS_TLV_PART_DIS
, "Partition DIS"},
158 { ISIS_TLV_PREFIX_NEIGH
, "Prefix Neighbors"},
159 { ISIS_TLV_ISNEIGH
, "IS Neighbor(s)"},
160 { ISIS_TLV_ISNEIGH_VARLEN
, "IS Neighbor(s) (variable length)"},
161 { ISIS_TLV_PADDING
, "Padding"},
162 { ISIS_TLV_LSP
, "LSP entries"},
163 { ISIS_TLV_AUTH
, "Authentication"},
164 { ISIS_TLV_CHECKSUM
, "Checksum"},
165 { ISIS_TLV_POI
, "Purge Originator Identifier"},
166 { ISIS_TLV_LSP_BUFFERSIZE
, "LSP Buffersize"},
167 { ISIS_TLV_EXT_IS_REACH
, "Extended IS Reachability"},
168 { ISIS_TLV_IS_ALIAS_ID
, "IS Alias ID"},
169 { ISIS_TLV_DECNET_PHASE4
, "DECnet Phase IV"},
170 { ISIS_TLV_LUCENT_PRIVATE
, "Lucent Proprietary"},
171 { ISIS_TLV_INT_IP_REACH
, "IPv4 Internal Reachability"},
172 { ISIS_TLV_PROTOCOLS
, "Protocols supported"},
173 { ISIS_TLV_EXT_IP_REACH
, "IPv4 External Reachability"},
174 { ISIS_TLV_IDRP_INFO
, "Inter-Domain Information Type"},
175 { ISIS_TLV_IPADDR
, "IPv4 Interface address(es)"},
176 { ISIS_TLV_IPAUTH
, "IPv4 authentication (deprecated)"},
177 { ISIS_TLV_TE_ROUTER_ID
, "Traffic Engineering Router ID"},
178 { ISIS_TLV_EXTD_IP_REACH
, "Extended IPv4 Reachability"},
179 { ISIS_TLV_SHARED_RISK_GROUP
, "Shared Risk Link Group"},
180 { ISIS_TLV_MT_PORT_CAP
, "Multi-Topology-Aware Port Capability"},
181 { ISIS_TLV_MT_CAPABILITY
, "Multi-Topology Capability"},
182 { ISIS_TLV_NORTEL_PRIVATE1
, "Nortel Proprietary"},
183 { ISIS_TLV_NORTEL_PRIVATE2
, "Nortel Proprietary"},
184 { ISIS_TLV_HOSTNAME
, "Hostname"},
185 { ISIS_TLV_RESTART_SIGNALING
, "Restart Signaling"},
186 { ISIS_TLV_MT_IS_REACH
, "Multi Topology IS Reachability"},
187 { ISIS_TLV_MT_SUPPORTED
, "Multi Topology"},
188 { ISIS_TLV_IP6ADDR
, "IPv6 Interface address(es)"},
189 { ISIS_TLV_MT_IP_REACH
, "Multi-Topology IPv4 Reachability"},
190 { ISIS_TLV_IP6_REACH
, "IPv6 reachability"},
191 { ISIS_TLV_MT_IP6_REACH
, "Multi-Topology IP6 Reachability"},
192 { ISIS_TLV_PTP_ADJ
, "Point-to-point Adjacency State"},
193 { ISIS_TLV_IIH_SEQNR
, "Hello PDU Sequence Number"},
194 { ISIS_TLV_VENDOR_PRIVATE
, "Vendor Private"},
198 #define ESIS_OPTION_PROTOCOLS 129
199 #define ESIS_OPTION_QOS_MAINTENANCE 195 /* iso9542 */
200 #define ESIS_OPTION_SECURITY 197 /* iso9542 */
201 #define ESIS_OPTION_ES_CONF_TIME 198 /* iso9542 */
202 #define ESIS_OPTION_PRIORITY 205 /* iso9542 */
203 #define ESIS_OPTION_ADDRESS_MASK 225 /* iso9542 */
204 #define ESIS_OPTION_SNPA_MASK 226 /* iso9542 */
206 static const struct tok esis_option_values
[] = {
207 { ESIS_OPTION_PROTOCOLS
, "Protocols supported"},
208 { ESIS_OPTION_QOS_MAINTENANCE
, "QoS Maintenance" },
209 { ESIS_OPTION_SECURITY
, "Security" },
210 { ESIS_OPTION_ES_CONF_TIME
, "ES Configuration Time" },
211 { ESIS_OPTION_PRIORITY
, "Priority" },
212 { ESIS_OPTION_ADDRESS_MASK
, "Addressk Mask" },
213 { ESIS_OPTION_SNPA_MASK
, "SNPA Mask" },
217 #define CLNP_OPTION_DISCARD_REASON 193
218 #define CLNP_OPTION_QOS_MAINTENANCE 195 /* iso8473 */
219 #define CLNP_OPTION_SECURITY 197 /* iso8473 */
220 #define CLNP_OPTION_SOURCE_ROUTING 200 /* iso8473 */
221 #define CLNP_OPTION_ROUTE_RECORDING 203 /* iso8473 */
222 #define CLNP_OPTION_PADDING 204 /* iso8473 */
223 #define CLNP_OPTION_PRIORITY 205 /* iso8473 */
225 static const struct tok clnp_option_values
[] = {
226 { CLNP_OPTION_DISCARD_REASON
, "Discard Reason"},
227 { CLNP_OPTION_PRIORITY
, "Priority"},
228 { CLNP_OPTION_QOS_MAINTENANCE
, "QoS Maintenance"},
229 { CLNP_OPTION_SECURITY
, "Security"},
230 { CLNP_OPTION_SOURCE_ROUTING
, "Source Routing"},
231 { CLNP_OPTION_ROUTE_RECORDING
, "Route Recording"},
232 { CLNP_OPTION_PADDING
, "Padding"},
236 static const struct tok clnp_option_rfd_class_values
[] = {
239 { 0x9, "Source Routeing"},
241 { 0xb, "PDU Discarded"},
242 { 0xc, "Reassembly"},
246 static const struct tok clnp_option_rfd_general_values
[] = {
247 { 0x0, "Reason not specified"},
248 { 0x1, "Protocol procedure error"},
249 { 0x2, "Incorrect checksum"},
250 { 0x3, "PDU discarded due to congestion"},
251 { 0x4, "Header syntax error (cannot be parsed)"},
252 { 0x5, "Segmentation needed but not permitted"},
253 { 0x6, "Incomplete PDU received"},
254 { 0x7, "Duplicate option"},
258 static const struct tok clnp_option_rfd_address_values
[] = {
259 { 0x0, "Destination address unreachable"},
260 { 0x1, "Destination address unknown"},
264 static const struct tok clnp_option_rfd_source_routeing_values
[] = {
265 { 0x0, "Unspecified source routeing error"},
266 { 0x1, "Syntax error in source routeing field"},
267 { 0x2, "Unknown address in source routeing field"},
268 { 0x3, "Path not acceptable"},
272 static const struct tok clnp_option_rfd_lifetime_values
[] = {
273 { 0x0, "Lifetime expired while data unit in transit"},
274 { 0x1, "Lifetime expired during reassembly"},
278 static const struct tok clnp_option_rfd_pdu_discard_values
[] = {
279 { 0x0, "Unsupported option not specified"},
280 { 0x1, "Unsupported protocol version"},
281 { 0x2, "Unsupported security option"},
282 { 0x3, "Unsupported source routeing option"},
283 { 0x4, "Unsupported recording of route option"},
287 static const struct tok clnp_option_rfd_reassembly_values
[] = {
288 { 0x0, "Reassembly interference"},
292 /* array of 16 error-classes */
293 static const struct tok
*clnp_option_rfd_error_class
[] = {
294 clnp_option_rfd_general_values
,
302 clnp_option_rfd_address_values
,
303 clnp_option_rfd_source_routeing_values
,
304 clnp_option_rfd_lifetime_values
,
305 clnp_option_rfd_pdu_discard_values
,
306 clnp_option_rfd_reassembly_values
,
312 #define CLNP_OPTION_OPTION_QOS_MASK 0x3f
313 #define CLNP_OPTION_SCOPE_MASK 0xc0
314 #define CLNP_OPTION_SCOPE_SA_SPEC 0x40
315 #define CLNP_OPTION_SCOPE_DA_SPEC 0x80
316 #define CLNP_OPTION_SCOPE_GLOBAL 0xc0
318 static const struct tok clnp_option_scope_values
[] = {
319 { CLNP_OPTION_SCOPE_SA_SPEC
, "Source Address Specific"},
320 { CLNP_OPTION_SCOPE_DA_SPEC
, "Destination Address Specific"},
321 { CLNP_OPTION_SCOPE_GLOBAL
, "Globally unique"},
325 static const struct tok clnp_option_sr_rr_values
[] = {
331 static const struct tok clnp_option_sr_rr_string_values
[] = {
332 { CLNP_OPTION_SOURCE_ROUTING
, "source routing"},
333 { CLNP_OPTION_ROUTE_RECORDING
, "recording of route in progress"},
337 static const struct tok clnp_option_qos_global_values
[] = {
339 { 0x10, "sequencing vs. delay"},
340 { 0x08, "congested"},
341 { 0x04, "delay vs. cost"},
342 { 0x02, "error vs. delay"},
343 { 0x01, "error vs. cost"},
347 #define ISIS_SUBTLV_EXT_IS_REACH_ADMIN_GROUP 3 /* rfc5305 */
348 #define ISIS_SUBTLV_EXT_IS_REACH_LINK_LOCAL_REMOTE_ID 4 /* rfc4205 */
349 #define ISIS_SUBTLV_EXT_IS_REACH_LINK_REMOTE_ID 5 /* rfc5305 */
350 #define ISIS_SUBTLV_EXT_IS_REACH_IPV4_INTF_ADDR 6 /* rfc5305 */
351 #define ISIS_SUBTLV_EXT_IS_REACH_IPV4_NEIGHBOR_ADDR 8 /* rfc5305 */
352 #define ISIS_SUBTLV_EXT_IS_REACH_MAX_LINK_BW 9 /* rfc5305 */
353 #define ISIS_SUBTLV_EXT_IS_REACH_RESERVABLE_BW 10 /* rfc5305 */
354 #define ISIS_SUBTLV_EXT_IS_REACH_UNRESERVED_BW 11 /* rfc4124 */
355 #define ISIS_SUBTLV_EXT_IS_REACH_BW_CONSTRAINTS_OLD 12 /* draft-ietf-tewg-diff-te-proto-06 */
356 #define ISIS_SUBTLV_EXT_IS_REACH_TE_METRIC 18 /* rfc5305 */
357 #define ISIS_SUBTLV_EXT_IS_REACH_LINK_ATTRIBUTE 19 /* draft-ietf-isis-link-attr-01 */
358 #define ISIS_SUBTLV_EXT_IS_REACH_LINK_PROTECTION_TYPE 20 /* rfc4205 */
359 #define ISIS_SUBTLV_EXT_IS_REACH_INTF_SW_CAP_DESCR 21 /* rfc4205 */
360 #define ISIS_SUBTLV_EXT_IS_REACH_BW_CONSTRAINTS 22 /* rfc4124 */
362 #define ISIS_SUBTLV_SPB_METRIC 29 /* rfc6329 */
364 static const struct tok isis_ext_is_reach_subtlv_values
[] = {
365 { ISIS_SUBTLV_EXT_IS_REACH_ADMIN_GROUP
, "Administrative groups" },
366 { ISIS_SUBTLV_EXT_IS_REACH_LINK_LOCAL_REMOTE_ID
, "Link Local/Remote Identifier" },
367 { ISIS_SUBTLV_EXT_IS_REACH_LINK_REMOTE_ID
, "Link Remote Identifier" },
368 { ISIS_SUBTLV_EXT_IS_REACH_IPV4_INTF_ADDR
, "IPv4 interface address" },
369 { ISIS_SUBTLV_EXT_IS_REACH_IPV4_NEIGHBOR_ADDR
, "IPv4 neighbor address" },
370 { ISIS_SUBTLV_EXT_IS_REACH_MAX_LINK_BW
, "Maximum link bandwidth" },
371 { ISIS_SUBTLV_EXT_IS_REACH_RESERVABLE_BW
, "Reservable link bandwidth" },
372 { ISIS_SUBTLV_EXT_IS_REACH_UNRESERVED_BW
, "Unreserved bandwidth" },
373 { ISIS_SUBTLV_EXT_IS_REACH_TE_METRIC
, "Traffic Engineering Metric" },
374 { ISIS_SUBTLV_EXT_IS_REACH_LINK_ATTRIBUTE
, "Link Attribute" },
375 { ISIS_SUBTLV_EXT_IS_REACH_LINK_PROTECTION_TYPE
, "Link Protection Type" },
376 { ISIS_SUBTLV_EXT_IS_REACH_INTF_SW_CAP_DESCR
, "Interface Switching Capability" },
377 { ISIS_SUBTLV_EXT_IS_REACH_BW_CONSTRAINTS_OLD
, "Bandwidth Constraints (old)" },
378 { ISIS_SUBTLV_EXT_IS_REACH_BW_CONSTRAINTS
, "Bandwidth Constraints" },
379 { ISIS_SUBTLV_SPB_METRIC
, "SPB Metric" },
380 { 250, "Reserved for cisco specific extensions" },
381 { 251, "Reserved for cisco specific extensions" },
382 { 252, "Reserved for cisco specific extensions" },
383 { 253, "Reserved for cisco specific extensions" },
384 { 254, "Reserved for cisco specific extensions" },
385 { 255, "Reserved for future expansion" },
389 #define ISIS_SUBTLV_EXTD_IP_REACH_ADMIN_TAG32 1 /* draft-ietf-isis-admin-tags-01 */
390 #define ISIS_SUBTLV_EXTD_IP_REACH_ADMIN_TAG64 2 /* draft-ietf-isis-admin-tags-01 */
391 #define ISIS_SUBTLV_EXTD_IP_REACH_MGMT_PREFIX_COLOR 117 /* draft-ietf-isis-wg-multi-topology-05 */
393 static const struct tok isis_ext_ip_reach_subtlv_values
[] = {
394 { ISIS_SUBTLV_EXTD_IP_REACH_ADMIN_TAG32
, "32-Bit Administrative tag" },
395 { ISIS_SUBTLV_EXTD_IP_REACH_ADMIN_TAG64
, "64-Bit Administrative tag" },
396 { ISIS_SUBTLV_EXTD_IP_REACH_MGMT_PREFIX_COLOR
, "Management Prefix Color" },
400 static const struct tok isis_subtlv_link_attribute_values
[] = {
401 { 0x01, "Local Protection Available" },
402 { 0x02, "Link excluded from local protection path" },
403 { 0x04, "Local maintenance required"},
407 #define ISIS_SUBTLV_AUTH_SIMPLE 1
408 #define ISIS_SUBTLV_AUTH_GENERIC 3 /* rfc 5310 */
409 #define ISIS_SUBTLV_AUTH_MD5 54
410 #define ISIS_SUBTLV_AUTH_MD5_LEN 16
411 #define ISIS_SUBTLV_AUTH_PRIVATE 255
413 static const struct tok isis_subtlv_auth_values
[] = {
414 { ISIS_SUBTLV_AUTH_SIMPLE
, "simple text password"},
415 { ISIS_SUBTLV_AUTH_GENERIC
, "Generic Crypto key-id"},
416 { ISIS_SUBTLV_AUTH_MD5
, "HMAC-MD5 password"},
417 { ISIS_SUBTLV_AUTH_PRIVATE
, "Routing Domain private password"},
421 #define ISIS_SUBTLV_IDRP_RES 0
422 #define ISIS_SUBTLV_IDRP_LOCAL 1
423 #define ISIS_SUBTLV_IDRP_ASN 2
425 static const struct tok isis_subtlv_idrp_values
[] = {
426 { ISIS_SUBTLV_IDRP_RES
, "Reserved"},
427 { ISIS_SUBTLV_IDRP_LOCAL
, "Routing-Domain Specific"},
428 { ISIS_SUBTLV_IDRP_ASN
, "AS Number Tag"},
432 #define ISIS_SUBTLV_SPB_MCID 4
433 #define ISIS_SUBTLV_SPB_DIGEST 5
434 #define ISIS_SUBTLV_SPB_BVID 6
436 #define ISIS_SUBTLV_SPB_INSTANCE 1
437 #define ISIS_SUBTLV_SPBM_SI 3
439 #define ISIS_SPB_MCID_LEN 51
440 #define ISIS_SUBTLV_SPB_MCID_MIN_LEN 102
441 #define ISIS_SUBTLV_SPB_DIGEST_MIN_LEN 33
442 #define ISIS_SUBTLV_SPB_BVID_MIN_LEN 6
443 #define ISIS_SUBTLV_SPB_INSTANCE_MIN_LEN 19
444 #define ISIS_SUBTLV_SPB_INSTANCE_VLAN_TUPLE_LEN 8
446 static const struct tok isis_mt_port_cap_subtlv_values
[] = {
447 { ISIS_SUBTLV_SPB_MCID
, "SPB MCID" },
448 { ISIS_SUBTLV_SPB_DIGEST
, "SPB Digest" },
449 { ISIS_SUBTLV_SPB_BVID
, "SPB BVID" },
453 static const struct tok isis_mt_capability_subtlv_values
[] = {
454 { ISIS_SUBTLV_SPB_INSTANCE
, "SPB Instance" },
455 { ISIS_SUBTLV_SPBM_SI
, "SPBM Service Identifier and Unicast Address" },
459 struct isis_spb_mcid
{
460 nd_uint8_t format_id
;
462 nd_uint16_t revision_lvl
;
466 struct isis_subtlv_spb_mcid
{
467 struct isis_spb_mcid mcid
;
468 struct isis_spb_mcid aux_mcid
;
471 struct isis_subtlv_spb_instance
{
472 nd_byte cist_root_id
[8];
473 nd_uint32_t cist_external_root_path_cost
;
474 nd_uint16_t bridge_priority
;
475 nd_uint32_t spsourceid
;
476 nd_uint8_t no_of_trees
;
479 #define CLNP_SEGMENT_PART 0x80
480 #define CLNP_MORE_SEGMENTS 0x40
481 #define CLNP_REQUEST_ER 0x20
483 static const struct tok clnp_flag_values
[] = {
484 { CLNP_SEGMENT_PART
, "Segmentation permitted"},
485 { CLNP_MORE_SEGMENTS
, "more Segments"},
486 { CLNP_REQUEST_ER
, "request Error Report"},
490 #define ISIS_MASK_LSP_OL_BIT(x) (EXTRACT_U_1(x)&0x4)
491 #define ISIS_MASK_LSP_ISTYPE_BITS(x) (EXTRACT_U_1(x)&0x3)
492 #define ISIS_MASK_LSP_PARTITION_BIT(x) (EXTRACT_U_1(x)&0x80)
493 #define ISIS_MASK_LSP_ATT_BITS(x) (EXTRACT_U_1(x)&0x78)
494 #define ISIS_MASK_LSP_ATT_ERROR_BIT(x) (EXTRACT_U_1(x)&0x40)
495 #define ISIS_MASK_LSP_ATT_EXPENSE_BIT(x) (EXTRACT_U_1(x)&0x20)
496 #define ISIS_MASK_LSP_ATT_DELAY_BIT(x) (EXTRACT_U_1(x)&0x10)
497 #define ISIS_MASK_LSP_ATT_DEFAULT_BIT(x) (EXTRACT_U_1(x)&0x8)
499 #define ISIS_MASK_MTID(x) ((x)&0x0fff)
500 #define ISIS_MASK_MTFLAGS(x) ((x)&0xf000)
502 static const struct tok isis_mt_flag_values
[] = {
503 { 0x4000, "ATT bit set"},
504 { 0x8000, "Overload bit set"},
508 #define ISIS_MASK_TLV_EXTD_IP_UPDOWN(x) ((x)&0x80)
509 #define ISIS_MASK_TLV_EXTD_IP_SUBTLV(x) ((x)&0x40)
511 #define ISIS_MASK_TLV_EXTD_IP6_IE(x) ((x)&0x40)
512 #define ISIS_MASK_TLV_EXTD_IP6_SUBTLV(x) ((x)&0x20)
514 #define ISIS_LSP_TLV_METRIC_SUPPORTED(x) (EXTRACT_U_1(x)&0x80)
515 #define ISIS_LSP_TLV_METRIC_IE(x) (EXTRACT_U_1(x)&0x40)
516 #define ISIS_LSP_TLV_METRIC_UPDOWN(x) (EXTRACT_U_1(x)&0x80)
517 #define ISIS_LSP_TLV_METRIC_VALUE(x) (EXTRACT_U_1(x)&0x3f)
519 #define ISIS_MASK_TLV_SHARED_RISK_GROUP(x) ((x)&0x1)
521 static const struct tok isis_mt_values
[] = {
522 { 0, "IPv4 unicast"},
523 { 1, "In-Band Management"},
524 { 2, "IPv6 unicast"},
526 { 4095, "Development, Experimental or Proprietary"},
530 static const struct tok isis_iih_circuit_type_values
[] = {
531 { 1, "Level 1 only"},
532 { 2, "Level 2 only"},
533 { 3, "Level 1, Level 2"},
537 #define ISIS_LSP_TYPE_UNUSED0 0
538 #define ISIS_LSP_TYPE_LEVEL_1 1
539 #define ISIS_LSP_TYPE_UNUSED2 2
540 #define ISIS_LSP_TYPE_LEVEL_2 3
542 static const struct tok isis_lsp_istype_values
[] = {
543 { ISIS_LSP_TYPE_UNUSED0
, "Unused 0x0 (invalid)"},
544 { ISIS_LSP_TYPE_LEVEL_1
, "L1 IS"},
545 { ISIS_LSP_TYPE_UNUSED2
, "Unused 0x2 (invalid)"},
546 { ISIS_LSP_TYPE_LEVEL_2
, "L2 IS"},
551 * Katz's point to point adjacency TLV uses codes to tell us the state of
552 * the remote adjacency. Enumerate them.
555 #define ISIS_PTP_ADJ_UP 0
556 #define ISIS_PTP_ADJ_INIT 1
557 #define ISIS_PTP_ADJ_DOWN 2
559 static const struct tok isis_ptp_adjancey_values
[] = {
560 { ISIS_PTP_ADJ_UP
, "Up" },
561 { ISIS_PTP_ADJ_INIT
, "Initializing" },
562 { ISIS_PTP_ADJ_DOWN
, "Down" },
566 struct isis_tlv_ptp_adj
{
567 nd_uint8_t adjacency_state
;
568 nd_uint32_t extd_local_circuit_id
;
569 nd_byte neighbor_sysid
[SYSTEM_ID_LEN
];
570 nd_uint32_t neighbor_extd_local_circuit_id
;
573 static void osi_print_cksum(netdissect_options
*, const uint8_t *pptr
,
574 uint16_t checksum
, int checksum_offset
, u_int length
);
575 static int clnp_print(netdissect_options
*, const uint8_t *, u_int
);
576 static void esis_print(netdissect_options
*, const uint8_t *, u_int
);
577 static int isis_print(netdissect_options
*, const uint8_t *, u_int
);
579 struct isis_metric_block
{
580 nd_uint8_t metric_default
;
581 nd_uint8_t metric_delay
;
582 nd_uint8_t metric_expense
;
583 nd_uint8_t metric_error
;
586 struct isis_tlv_is_reach
{
587 struct isis_metric_block isis_metric_block
;
588 nd_byte neighbor_nodeid
[NODE_ID_LEN
];
591 struct isis_tlv_es_reach
{
592 struct isis_metric_block isis_metric_block
;
593 nd_byte neighbor_sysid
[SYSTEM_ID_LEN
];
596 struct isis_tlv_ip_reach
{
597 struct isis_metric_block isis_metric_block
;
602 static const struct tok isis_is_reach_virtual_values
[] = {
603 { 0, "IsNotVirtual"},
608 static const struct tok isis_restart_flag_values
[] = {
609 { 0x1, "Restart Request"},
610 { 0x2, "Restart Acknowledgement"},
611 { 0x4, "Suppress adjacency advertisement"},
615 struct isis_common_header
{
617 nd_uint8_t fixed_len
;
618 nd_uint8_t version
; /* Protocol version */
619 nd_uint8_t id_length
;
620 nd_uint8_t pdu_type
; /* 3 MSbits are reserved */
621 nd_uint8_t pdu_version
; /* Packet format version */
626 struct isis_iih_lan_header
{
627 nd_uint8_t circuit_type
;
628 nd_byte source_id
[SYSTEM_ID_LEN
];
629 nd_uint16_t holding_time
;
632 nd_byte lan_id
[NODE_ID_LEN
];
635 struct isis_iih_ptp_header
{
636 nd_uint8_t circuit_type
;
637 nd_byte source_id
[SYSTEM_ID_LEN
];
638 nd_uint16_t holding_time
;
640 nd_uint8_t circuit_id
;
643 struct isis_lsp_header
{
645 nd_uint16_t remaining_lifetime
;
646 nd_byte lsp_id
[LSP_ID_LEN
];
647 nd_uint32_t sequence_number
;
648 nd_uint16_t checksum
;
649 nd_uint8_t typeblock
;
652 struct isis_csnp_header
{
654 nd_byte source_id
[NODE_ID_LEN
];
655 nd_byte start_lsp_id
[LSP_ID_LEN
];
656 nd_byte end_lsp_id
[LSP_ID_LEN
];
659 struct isis_psnp_header
{
661 nd_byte source_id
[NODE_ID_LEN
];
664 struct isis_tlv_lsp
{
665 nd_uint16_t remaining_lifetime
;
666 nd_byte lsp_id
[LSP_ID_LEN
];
667 nd_uint32_t sequence_number
;
668 nd_uint16_t checksum
;
671 #define ISIS_COMMON_HEADER_SIZE (sizeof(struct isis_common_header))
672 #define ISIS_IIH_LAN_HEADER_SIZE (sizeof(struct isis_iih_lan_header))
673 #define ISIS_IIH_PTP_HEADER_SIZE (sizeof(struct isis_iih_ptp_header))
674 #define ISIS_LSP_HEADER_SIZE (sizeof(struct isis_lsp_header))
675 #define ISIS_CSNP_HEADER_SIZE (sizeof(struct isis_csnp_header))
676 #define ISIS_PSNP_HEADER_SIZE (sizeof(struct isis_psnp_header))
679 isoclns_print(netdissect_options
*ndo
, const u_char
*p
, u_int length
)
681 ndo
->ndo_protocol
= "isoclns";
682 ND_TCHECK_1(p
); /* enough bytes on the wire ? */
685 ND_PRINT("OSI NLPID %s (0x%02x): ", tok2str(nlpid_values
, "Unknown", EXTRACT_U_1(p
)), EXTRACT_U_1(p
));
687 switch (EXTRACT_U_1(p
)) {
690 if (!clnp_print(ndo
, p
, length
))
691 print_unknown_data(ndo
, p
, "\n\t", length
);
695 esis_print(ndo
, p
, length
);
699 if (!isis_print(ndo
, p
, length
))
700 print_unknown_data(ndo
, p
, "\n\t", length
);
704 ND_PRINT("%slength: %u", ndo
->ndo_eflag
? "" : ", ", length
);
708 q933_print(ndo
, p
+ 1, length
- 1);
712 ip_print(ndo
, p
+ 1, length
- 1);
716 ip6_print(ndo
, p
+ 1, length
- 1);
720 ppp_print(ndo
, p
+ 1, length
- 1);
725 ND_PRINT("OSI NLPID 0x%02x unknown", EXTRACT_U_1(p
));
726 ND_PRINT("%slength: %u", ndo
->ndo_eflag
? "" : ", ", length
);
728 print_unknown_data(ndo
, p
, "\n\t", length
);
736 #define CLNP_PDU_ER 1
737 #define CLNP_PDU_DT 28
738 #define CLNP_PDU_MD 29
739 #define CLNP_PDU_ERQ 30
740 #define CLNP_PDU_ERP 31
742 static const struct tok clnp_pdu_values
[] = {
743 { CLNP_PDU_ER
, "Error Report"},
744 { CLNP_PDU_MD
, "MD"},
745 { CLNP_PDU_DT
, "Data"},
746 { CLNP_PDU_ERQ
, "Echo Request"},
747 { CLNP_PDU_ERP
, "Echo Response"},
751 struct clnp_header_t
{
753 nd_uint8_t length_indicator
;
755 nd_uint8_t lifetime
; /* units of 500ms */
757 nd_uint16_t segment_length
;
761 struct clnp_segment_header_t
{
762 nd_uint16_t data_unit_id
;
763 nd_uint16_t segment_offset
;
764 nd_uint16_t total_length
;
769 * Decode CLNP packets. Return 0 on error.
773 clnp_print(netdissect_options
*ndo
,
774 const uint8_t *pptr
, u_int length
)
776 const uint8_t *optr
,*source_address
,*dest_address
;
777 u_int li
,li_remaining
,tlen
,nsap_offset
,source_address_length
,dest_address_length
, clnp_pdu_type
, clnp_flags
;
778 const struct clnp_header_t
*clnp_header
;
779 const struct clnp_segment_header_t
*clnp_segment_header
;
780 uint8_t rfd_error
,rfd_error_major
,rfd_error_minor
;
782 ndo
->ndo_protocol
= "clnp";
783 clnp_header
= (const struct clnp_header_t
*) pptr
;
784 ND_TCHECK_SIZE(clnp_header
);
786 li
= EXTRACT_U_1(clnp_header
->length_indicator
);
794 * Sanity checking of the header.
797 if (EXTRACT_U_1(clnp_header
->version
) != CLNP_VERSION
) {
798 ND_PRINT("version %u packet not supported", EXTRACT_U_1(clnp_header
->version
));
803 ND_PRINT(" length indicator(%u) > PDU size (%u)!", li
, length
);
807 if (li
< sizeof(struct clnp_header_t
)) {
808 ND_PRINT(" length indicator %u < min PDU size:", li
);
809 while (pptr
< ndo
->ndo_snapend
) {
810 ND_PRINT("%02X", EXTRACT_U_1(pptr
));
816 /* FIXME further header sanity checking */
818 clnp_pdu_type
= EXTRACT_U_1(clnp_header
->type
) & CLNP_PDU_TYPE_MASK
;
819 clnp_flags
= EXTRACT_U_1(clnp_header
->type
) & CLNP_FLAG_MASK
;
821 pptr
+= sizeof(struct clnp_header_t
);
822 li_remaining
-= sizeof(struct clnp_header_t
);
824 if (li_remaining
< 1) {
825 ND_PRINT("li < size of fixed part of CLNP header and addresses");
829 dest_address_length
= EXTRACT_U_1(pptr
);
832 if (li_remaining
< dest_address_length
) {
833 ND_PRINT("li < size of fixed part of CLNP header and addresses");
836 ND_TCHECK_LEN(pptr
, dest_address_length
);
838 pptr
+= dest_address_length
;
839 li_remaining
-= dest_address_length
;
841 if (li_remaining
< 1) {
842 ND_PRINT("li < size of fixed part of CLNP header and addresses");
846 source_address_length
= EXTRACT_U_1(pptr
);
849 if (li_remaining
< source_address_length
) {
850 ND_PRINT("li < size of fixed part of CLNP header and addresses");
853 ND_TCHECK_LEN(pptr
, source_address_length
);
854 source_address
= pptr
;
855 pptr
+= source_address_length
;
856 li_remaining
-= source_address_length
;
858 if (ndo
->ndo_vflag
< 1) {
859 ND_PRINT("%s%s > %s, %s, length %u",
860 ndo
->ndo_eflag
? "" : ", ",
861 isonsap_string(ndo
, source_address
, source_address_length
),
862 isonsap_string(ndo
, dest_address
, dest_address_length
),
863 tok2str(clnp_pdu_values
,"unknown (%u)",clnp_pdu_type
),
867 ND_PRINT("%slength %u", ndo
->ndo_eflag
? "" : ", ", length
);
869 ND_PRINT("\n\t%s PDU, hlen: %u, v: %u, lifetime: %u.%us, Segment PDU length: %u, checksum: 0x%04x",
870 tok2str(clnp_pdu_values
, "unknown (%u)",clnp_pdu_type
),
871 EXTRACT_U_1(clnp_header
->length_indicator
),
872 EXTRACT_U_1(clnp_header
->version
),
873 EXTRACT_U_1(clnp_header
->lifetime
)/2,
874 (EXTRACT_U_1(clnp_header
->lifetime
)%2)*5,
875 EXTRACT_BE_U_2(clnp_header
->segment_length
),
876 EXTRACT_BE_U_2(clnp_header
->cksum
));
878 osi_print_cksum(ndo
, optr
, EXTRACT_BE_U_2(clnp_header
->cksum
), 7,
879 EXTRACT_U_1(clnp_header
->length_indicator
));
881 ND_PRINT("\n\tFlags [%s]",
882 bittok2str(clnp_flag_values
, "none", clnp_flags
));
884 ND_PRINT("\n\tsource address (length %u): %s\n\tdest address (length %u): %s",
885 source_address_length
,
886 isonsap_string(ndo
, source_address
, source_address_length
),
888 isonsap_string(ndo
, dest_address
, dest_address_length
));
890 if (clnp_flags
& CLNP_SEGMENT_PART
) {
891 if (li_remaining
< sizeof(struct clnp_segment_header_t
)) {
892 ND_PRINT("li < size of fixed part of CLNP header, addresses, and segment part");
895 clnp_segment_header
= (const struct clnp_segment_header_t
*) pptr
;
896 ND_TCHECK_SIZE(clnp_segment_header
);
897 ND_PRINT("\n\tData Unit ID: 0x%04x, Segment Offset: %u, Total PDU Length: %u",
898 EXTRACT_BE_U_2(clnp_segment_header
->data_unit_id
),
899 EXTRACT_BE_U_2(clnp_segment_header
->segment_offset
),
900 EXTRACT_BE_U_2(clnp_segment_header
->total_length
));
901 pptr
+=sizeof(struct clnp_segment_header_t
);
902 li_remaining
-=sizeof(struct clnp_segment_header_t
);
905 /* now walk the options */
906 while (li_remaining
!= 0) {
910 if (li_remaining
< 2) {
911 ND_PRINT(", bad opts/li");
915 op
= EXTRACT_U_1(pptr
);
916 opli
= EXTRACT_U_1(pptr
+ 1);
919 if (opli
> li_remaining
) {
920 ND_PRINT(", opt (%u) too long", op
);
923 ND_TCHECK_LEN(pptr
, opli
);
924 li_remaining
-= opli
;
928 ND_PRINT("\n\t %s Option #%u, length %u, value: ",
929 tok2str(clnp_option_values
,"Unknown",op
),
934 * We've already checked that the entire option is present
935 * in the captured packet with the ND_TCHECK_LEN() call.
936 * Therefore, we don't need to do ND_TCHECK()/ND_TCHECK_LEN()
938 * We do, however, need to check tlen, to make sure we
939 * don't run past the end of the option.
944 case CLNP_OPTION_ROUTE_RECORDING
: /* those two options share the format */
945 case CLNP_OPTION_SOURCE_ROUTING
:
947 ND_PRINT(", bad opt len");
951 tok2str(clnp_option_sr_rr_values
,"Unknown",EXTRACT_U_1(tptr
)),
952 tok2str(clnp_option_sr_rr_string_values
, "Unknown Option %u", op
));
953 nsap_offset
=EXTRACT_U_1(tptr
+ 1);
954 if (nsap_offset
== 0) {
955 ND_PRINT(" Bad NSAP offset (0)");
958 nsap_offset
-=1; /* offset to nsap list */
959 if (nsap_offset
> tlen
) {
960 ND_PRINT(" Bad NSAP offset (past end of option)");
966 source_address_length
=EXTRACT_U_1(tptr
);
967 if (tlen
< source_address_length
+1) {
968 ND_PRINT("\n\t NSAP address goes past end of option");
971 if (source_address_length
> 0) {
972 source_address
=(tptr
+1);
973 ND_TCHECK_LEN(source_address
,
974 source_address_length
);
975 ND_PRINT("\n\t NSAP address (length %u): %s",
976 source_address_length
,
977 isonsap_string(ndo
, source_address
, source_address_length
));
979 tlen
-=source_address_length
+1;
983 case CLNP_OPTION_PRIORITY
:
985 ND_PRINT(", bad opt len");
988 ND_PRINT("0x%1x", EXTRACT_U_1(tptr
)&0x0f);
991 case CLNP_OPTION_QOS_MAINTENANCE
:
993 ND_PRINT(", bad opt len");
996 ND_PRINT("\n\t Format Code: %s",
997 tok2str(clnp_option_scope_values
, "Reserved", EXTRACT_U_1(tptr
) & CLNP_OPTION_SCOPE_MASK
));
999 if ((EXTRACT_U_1(tptr
)&CLNP_OPTION_SCOPE_MASK
) == CLNP_OPTION_SCOPE_GLOBAL
)
1000 ND_PRINT("\n\t QoS Flags [%s]",
1001 bittok2str(clnp_option_qos_global_values
,
1003 EXTRACT_U_1(tptr
)&CLNP_OPTION_OPTION_QOS_MASK
));
1006 case CLNP_OPTION_SECURITY
:
1008 ND_PRINT(", bad opt len");
1011 ND_PRINT("\n\t Format Code: %s, Security-Level %u",
1012 tok2str(clnp_option_scope_values
,"Reserved",EXTRACT_U_1(tptr
)&CLNP_OPTION_SCOPE_MASK
),
1013 EXTRACT_U_1(tptr
+ 1));
1016 case CLNP_OPTION_DISCARD_REASON
:
1018 ND_PRINT(", bad opt len");
1021 rfd_error
= EXTRACT_U_1(tptr
);
1022 rfd_error_major
= (rfd_error
&0xf0) >> 4;
1023 rfd_error_minor
= rfd_error
&0x0f;
1024 ND_PRINT("\n\t Class: %s Error (0x%01x), %s (0x%01x)",
1025 tok2str(clnp_option_rfd_class_values
,"Unknown",rfd_error_major
),
1027 tok2str(clnp_option_rfd_error_class
[rfd_error_major
],"Unknown",rfd_error_minor
),
1031 case CLNP_OPTION_PADDING
:
1032 ND_PRINT("padding data");
1036 * FIXME those are the defined Options that lack a decoder
1037 * you are welcome to contribute code ;-)
1041 print_unknown_data(ndo
, tptr
, "\n\t ", opli
);
1044 if (ndo
->ndo_vflag
> 1)
1045 print_unknown_data(ndo
, pptr
, "\n\t ", opli
);
1049 switch (clnp_pdu_type
) {
1051 case CLNP_PDU_ER
: /* fall through */
1054 if (EXTRACT_U_1(pptr
) == NLPID_CLNP
) {
1055 ND_PRINT("\n\t-----original packet-----\n\t");
1056 /* FIXME recursion protection */
1057 clnp_print(ndo
, pptr
, length
- li
);
1061 /* The cases above break from the switch block if they see and print
1062 * a CLNP header in the Data part. For an Error Report PDU this is
1063 * described in Section 7.9.6 of ITU X.233 (1997 E), also known as
1064 * ISO/IEC 8473-1:1998(E). It is not clear why in this code the same
1065 * applies to an Echo Response PDU, as the standard does not specify
1066 * the contents -- could be a proprietary extension or a bug. In either
1067 * case, if the Data part does not contain a CLNP header, its structure
1068 * is considered unknown and the decoding falls through to print the
1078 /* dump the PDU specific data */
1079 if (length
-(pptr
-optr
) > 0) {
1080 ND_PRINT("\n\t undecoded non-header data, length %u", length
-li
);
1081 print_unknown_data(ndo
, pptr
, "\n\t ", length
- (int)(pptr
- optr
));
1088 nd_print_trunc(ndo
);
1094 #define ESIS_PDU_REDIRECT 6
1095 #define ESIS_PDU_ESH 2
1096 #define ESIS_PDU_ISH 4
1098 static const struct tok esis_pdu_values
[] = {
1099 { ESIS_PDU_REDIRECT
, "redirect"},
1100 { ESIS_PDU_ESH
, "ESH"},
1101 { ESIS_PDU_ISH
, "ISH"},
1105 struct esis_header_t
{
1107 nd_uint8_t length_indicator
;
1111 nd_uint16_t holdtime
;
1116 esis_print(netdissect_options
*ndo
,
1117 const uint8_t *pptr
, u_int length
)
1119 const uint8_t *optr
;
1120 u_int li
, version
, esis_pdu_type
, source_address_length
, source_address_number
;
1121 const struct esis_header_t
*esis_header
;
1123 ndo
->ndo_protocol
= "esis";
1124 if (!ndo
->ndo_eflag
)
1128 ND_PRINT(ndo
->ndo_qflag
? "bad pkt!" : "no header at all!");
1132 esis_header
= (const struct esis_header_t
*) pptr
;
1133 ND_TCHECK_SIZE(esis_header
);
1134 li
= EXTRACT_U_1(esis_header
->length_indicator
);
1138 * Sanity checking of the header.
1141 if (EXTRACT_U_1(esis_header
->nlpid
) != NLPID_ESIS
) {
1142 ND_PRINT(" nlpid 0x%02x packet not supported", EXTRACT_U_1(esis_header
->nlpid
));
1146 version
= EXTRACT_U_1(esis_header
->version
);
1147 if (version
!= ESIS_VERSION
) {
1148 ND_PRINT(" version %u packet not supported", version
);
1153 ND_PRINT(" length indicator(%u) > PDU size (%u)!", li
, length
);
1157 if (li
< sizeof(struct esis_header_t
) + 2) {
1158 ND_PRINT(" length indicator %u < min PDU size:", li
);
1159 while (pptr
< ndo
->ndo_snapend
) {
1160 ND_PRINT("%02X", EXTRACT_U_1(pptr
));
1166 esis_pdu_type
= EXTRACT_U_1(esis_header
->type
) & ESIS_PDU_TYPE_MASK
;
1168 if (ndo
->ndo_vflag
< 1) {
1169 ND_PRINT("%s%s, length %u",
1170 ndo
->ndo_eflag
? "" : ", ",
1171 tok2str(esis_pdu_values
,"unknown type (%u)",esis_pdu_type
),
1175 ND_PRINT("%slength %u\n\t%s (%u)",
1176 ndo
->ndo_eflag
? "" : ", ",
1178 tok2str(esis_pdu_values
,"unknown type: %u", esis_pdu_type
),
1181 ND_PRINT(", v: %u%s", version
, version
== ESIS_VERSION
? "" : "unsupported" );
1182 ND_PRINT(", checksum: 0x%04x", EXTRACT_BE_U_2(esis_header
->cksum
));
1184 osi_print_cksum(ndo
, pptr
, EXTRACT_BE_U_2(esis_header
->cksum
), 7,
1187 ND_PRINT(", holding time: %us, length indicator: %u",
1188 EXTRACT_BE_U_2(esis_header
->holdtime
), li
);
1190 if (ndo
->ndo_vflag
> 1)
1191 print_unknown_data(ndo
, optr
, "\n\t", sizeof(struct esis_header_t
));
1193 pptr
+= sizeof(struct esis_header_t
);
1194 li
-= sizeof(struct esis_header_t
);
1196 switch (esis_pdu_type
) {
1197 case ESIS_PDU_REDIRECT
: {
1198 const uint8_t *dst
, *snpa
, *neta
;
1199 u_int dstl
, snpal
, netal
;
1203 ND_PRINT(", bad redirect/li");
1206 dstl
= EXTRACT_U_1(pptr
);
1209 ND_TCHECK_LEN(pptr
, dstl
);
1211 ND_PRINT(", bad redirect/li");
1217 ND_PRINT("\n\t %s", isonsap_string(ndo
, dst
, dstl
));
1221 ND_PRINT(", bad redirect/li");
1224 snpal
= EXTRACT_U_1(pptr
);
1227 ND_TCHECK_LEN(pptr
, snpal
);
1229 ND_PRINT(", bad redirect/li");
1237 ND_PRINT(", bad redirect/li");
1240 netal
= EXTRACT_U_1(pptr
);
1242 ND_TCHECK_LEN(pptr
, netal
);
1244 ND_PRINT(", bad redirect/li");
1252 ND_PRINT("\n\t SNPA (length: %u): %s",
1254 etheraddr_string(ndo
, snpa
));
1256 ND_PRINT("\n\t SNPA (length: %u): %s",
1258 linkaddr_string(ndo
, snpa
, LINKADDR_OTHER
, snpal
));
1260 ND_PRINT("\n\t NET (length: %u) %s",
1262 isonsap_string(ndo
, neta
, netal
));
1269 ND_PRINT(", bad esh/li");
1272 source_address_number
= EXTRACT_U_1(pptr
);
1276 ND_PRINT("\n\t Number of Source Addresses: %u", source_address_number
);
1278 while (source_address_number
> 0) {
1281 ND_PRINT(", bad esh/li");
1284 source_address_length
= EXTRACT_U_1(pptr
);
1288 ND_TCHECK_LEN(pptr
, source_address_length
);
1289 if (li
< source_address_length
) {
1290 ND_PRINT(", bad esh/li");
1293 ND_PRINT("\n\t NET (length: %u): %s",
1294 source_address_length
,
1295 isonsap_string(ndo
, pptr
, source_address_length
));
1296 pptr
+= source_address_length
;
1297 li
-= source_address_length
;
1298 source_address_number
--;
1303 case ESIS_PDU_ISH
: {
1306 ND_PRINT(", bad ish/li");
1309 source_address_length
= EXTRACT_U_1(pptr
);
1312 ND_TCHECK_LEN(pptr
, source_address_length
);
1313 if (li
< source_address_length
) {
1314 ND_PRINT(", bad ish/li");
1317 ND_PRINT("\n\t NET (length: %u): %s", source_address_length
, isonsap_string(ndo
, pptr
, source_address_length
));
1318 pptr
+= source_address_length
;
1319 li
-= source_address_length
;
1324 if (ndo
->ndo_vflag
<= 1) {
1325 if (pptr
< ndo
->ndo_snapend
)
1326 print_unknown_data(ndo
, pptr
, "\n\t ", (int)(ndo
->ndo_snapend
- pptr
));
1331 /* now walk the options */
1334 const uint8_t *tptr
;
1337 ND_PRINT(", bad opts/li");
1341 op
= EXTRACT_U_1(pptr
);
1342 opli
= EXTRACT_U_1(pptr
+ 1);
1346 ND_PRINT(", opt (%u) too long", op
);
1352 ND_PRINT("\n\t %s Option #%u, length %u, value: ",
1353 tok2str(esis_option_values
,"Unknown",op
),
1359 case ESIS_OPTION_ES_CONF_TIME
:
1362 ND_PRINT("%us", EXTRACT_BE_U_2(tptr
));
1364 ND_PRINT("(bad length)");
1367 case ESIS_OPTION_PROTOCOLS
:
1370 ND_PRINT("%s (0x%02x)",
1371 tok2str(nlpid_values
,
1375 if (opli
>1) /* further NPLIDs ? - put comma */
1383 * FIXME those are the defined Options that lack a decoder
1384 * you are welcome to contribute code ;-)
1387 case ESIS_OPTION_QOS_MAINTENANCE
:
1388 case ESIS_OPTION_SECURITY
:
1389 case ESIS_OPTION_PRIORITY
:
1390 case ESIS_OPTION_ADDRESS_MASK
:
1391 case ESIS_OPTION_SNPA_MASK
:
1394 print_unknown_data(ndo
, tptr
, "\n\t ", opli
);
1397 if (ndo
->ndo_vflag
> 1)
1398 print_unknown_data(ndo
, pptr
, "\n\t ", opli
);
1404 nd_print_trunc(ndo
);
1408 isis_print_mcid(netdissect_options
*ndo
,
1409 const struct isis_spb_mcid
*mcid
)
1413 ND_TCHECK_SIZE(mcid
);
1414 ND_PRINT("ID: %u, Name: ", EXTRACT_U_1(mcid
->format_id
));
1416 if (nd_printzp(ndo
, mcid
->name
, 32, ndo
->ndo_snapend
))
1419 ND_PRINT("\n\t Lvl: %u", EXTRACT_BE_U_2(mcid
->revision_lvl
));
1421 ND_PRINT(", Digest: ");
1424 ND_PRINT("%.2x ", mcid
->digest
[i
]);
1428 nd_print_trunc(ndo
);
1432 isis_print_mt_port_cap_subtlv(netdissect_options
*ndo
,
1433 const uint8_t *tptr
, u_int len
)
1435 u_int stlv_type
, stlv_len
;
1436 const struct isis_subtlv_spb_mcid
*subtlv_spb_mcid
;
1442 stlv_type
= EXTRACT_U_1(tptr
);
1443 stlv_len
= EXTRACT_U_1(tptr
+ 1);
1445 /* first lets see if we know the subTLVs name*/
1446 ND_PRINT("\n\t %s subTLV #%u, length: %u",
1447 tok2str(isis_mt_port_cap_subtlv_values
, "unknown", stlv_type
),
1452 /*len -= TLV_TYPE_LEN_OFFSET;*/
1455 /* Make sure the subTLV fits within the space left */
1458 /* Make sure the entire subTLV is in the captured data */
1459 ND_TCHECK_LEN(tptr
, stlv_len
);
1463 case ISIS_SUBTLV_SPB_MCID
:
1465 if (stlv_len
< ISIS_SUBTLV_SPB_MCID_MIN_LEN
)
1468 subtlv_spb_mcid
= (const struct isis_subtlv_spb_mcid
*)tptr
;
1470 ND_PRINT("\n\t MCID: ");
1471 isis_print_mcid(ndo
, &(subtlv_spb_mcid
->mcid
));
1473 /*tptr += SPB_MCID_MIN_LEN;
1474 len -= SPB_MCID_MIN_LEN; */
1476 ND_PRINT("\n\t AUX-MCID: ");
1477 isis_print_mcid(ndo
, &(subtlv_spb_mcid
->aux_mcid
));
1479 /*tptr += SPB_MCID_MIN_LEN;
1480 len -= SPB_MCID_MIN_LEN; */
1481 tptr
= tptr
+ ISIS_SUBTLV_SPB_MCID_MIN_LEN
;
1482 len
= len
- ISIS_SUBTLV_SPB_MCID_MIN_LEN
;
1483 stlv_len
= stlv_len
- ISIS_SUBTLV_SPB_MCID_MIN_LEN
;
1488 case ISIS_SUBTLV_SPB_DIGEST
:
1490 if (stlv_len
< ISIS_SUBTLV_SPB_DIGEST_MIN_LEN
)
1493 ND_PRINT("\n\t RES: %u V: %u A: %u D: %u",
1494 (EXTRACT_U_1(tptr
) >> 5),
1495 ((EXTRACT_U_1(tptr
) >> 4) & 0x01),
1496 ((EXTRACT_U_1(tptr
) >> 2) & 0x03),
1497 (EXTRACT_U_1(tptr
) & 0x03));
1501 ND_PRINT("\n\t Digest: ");
1505 ND_PRINT("%08x ", EXTRACT_BE_U_4(tptr
));
1506 if (i
%4 == 0 && i
!= 8)
1511 len
= len
- ISIS_SUBTLV_SPB_DIGEST_MIN_LEN
;
1512 stlv_len
= stlv_len
- ISIS_SUBTLV_SPB_DIGEST_MIN_LEN
;
1517 case ISIS_SUBTLV_SPB_BVID
:
1519 while (stlv_len
>= ISIS_SUBTLV_SPB_BVID_MIN_LEN
)
1521 ND_PRINT("\n\t ECT: %08x",
1522 EXTRACT_BE_U_4(tptr
));
1526 ND_PRINT(" BVID: %u, U:%01x M:%01x ",
1527 (EXTRACT_BE_U_2(tptr
) >> 4) ,
1528 (EXTRACT_BE_U_2(tptr
) >> 3) & 0x01,
1529 (EXTRACT_BE_U_2(tptr
) >> 2) & 0x01);
1532 len
= len
- ISIS_SUBTLV_SPB_BVID_MIN_LEN
;
1533 stlv_len
= stlv_len
- ISIS_SUBTLV_SPB_BVID_MIN_LEN
;
1549 nd_print_trunc(ndo
);
1554 isis_print_mt_capability_subtlv(netdissect_options
*ndo
,
1555 const uint8_t *tptr
, u_int len
)
1557 u_int stlv_type
, stlv_len
, tmp
;
1562 stlv_type
= EXTRACT_U_1(tptr
);
1563 stlv_len
= EXTRACT_U_1(tptr
+ 1);
1567 /* first lets see if we know the subTLVs name*/
1568 ND_PRINT("\n\t %s subTLV #%u, length: %u",
1569 tok2str(isis_mt_capability_subtlv_values
, "unknown", stlv_type
),
1573 /* Make sure the subTLV fits within the space left */
1576 /* Make sure the entire subTLV is in the captured data */
1577 ND_TCHECK_LEN(tptr
, stlv_len
);
1581 case ISIS_SUBTLV_SPB_INSTANCE
:
1582 if (stlv_len
< ISIS_SUBTLV_SPB_INSTANCE_MIN_LEN
)
1585 ND_PRINT("\n\t CIST Root-ID: %08x", EXTRACT_BE_U_4(tptr
));
1587 ND_PRINT(" %08x", EXTRACT_BE_U_4(tptr
));
1589 ND_PRINT(", Path Cost: %08x", EXTRACT_BE_U_4(tptr
));
1591 ND_PRINT(", Prio: %u", EXTRACT_BE_U_2(tptr
));
1593 ND_PRINT("\n\t RES: %u",
1594 EXTRACT_BE_U_2(tptr
) >> 5);
1596 (EXTRACT_BE_U_2(tptr
) >> 4) & 0x0001);
1597 ND_PRINT(", SPSource-ID: %u",
1598 (EXTRACT_BE_U_4(tptr
) & 0x000fffff));
1600 ND_PRINT(", No of Trees: %x", EXTRACT_U_1(tptr
));
1602 tmp
= EXTRACT_U_1(tptr
);
1605 len
= len
- ISIS_SUBTLV_SPB_INSTANCE_MIN_LEN
;
1606 stlv_len
= stlv_len
- ISIS_SUBTLV_SPB_INSTANCE_MIN_LEN
;
1610 if (stlv_len
< ISIS_SUBTLV_SPB_INSTANCE_VLAN_TUPLE_LEN
)
1613 ND_PRINT("\n\t U:%u, M:%u, A:%u, RES:%u",
1614 EXTRACT_U_1(tptr
) >> 7,
1615 (EXTRACT_U_1(tptr
) >> 6) & 0x01,
1616 (EXTRACT_U_1(tptr
) >> 5) & 0x01,
1617 (EXTRACT_U_1(tptr
) & 0x1f));
1621 ND_PRINT(", ECT: %08x", EXTRACT_BE_U_4(tptr
));
1625 ND_PRINT(", BVID: %u, SPVID: %u",
1626 (EXTRACT_BE_U_3(tptr
) >> 12) & 0x000fff,
1627 EXTRACT_BE_U_3(tptr
) & 0x000fff);
1630 len
= len
- ISIS_SUBTLV_SPB_INSTANCE_VLAN_TUPLE_LEN
;
1631 stlv_len
= stlv_len
- ISIS_SUBTLV_SPB_INSTANCE_VLAN_TUPLE_LEN
;
1637 case ISIS_SUBTLV_SPBM_SI
:
1641 ND_PRINT("\n\t BMAC: %08x", EXTRACT_BE_U_4(tptr
));
1643 ND_PRINT("%04x", EXTRACT_BE_U_2(tptr
));
1646 ND_PRINT(", RES: %u, VID: %u", EXTRACT_BE_U_2(tptr
) >> 12,
1647 (EXTRACT_BE_U_2(tptr
)) & 0x0fff);
1651 stlv_len
= stlv_len
- 8;
1653 while (stlv_len
>= 4) {
1655 ND_PRINT("\n\t T: %u, R: %u, RES: %u, ISID: %u",
1656 (EXTRACT_BE_U_4(tptr
) >> 31),
1657 (EXTRACT_BE_U_4(tptr
) >> 30) & 0x01,
1658 (EXTRACT_BE_U_4(tptr
) >> 24) & 0x03f,
1659 (EXTRACT_BE_U_4(tptr
)) & 0x0ffffff);
1663 stlv_len
= stlv_len
- 4;
1677 nd_print_trunc(ndo
);
1681 /* shared routine for printing system, node and lsp-ids */
1683 isis_print_id(const uint8_t *cp
, u_int id_len
)
1686 static char id
[sizeof("xxxx.xxxx.xxxx.yy-zz")];
1690 sysid_len
= SYSTEM_ID_LEN
;
1691 if (sysid_len
> id_len
)
1693 for (i
= 1; i
<= sysid_len
; i
++) {
1694 nd_snprintf(pos
, sizeof(id
) - (pos
- id
), "%02x", EXTRACT_U_1(cp
));
1697 if (i
== 2 || i
== 4)
1700 if (id_len
>= NODE_ID_LEN
) {
1701 nd_snprintf(pos
, sizeof(id
) - (pos
- id
), ".%02x", EXTRACT_U_1(cp
));
1705 if (id_len
== LSP_ID_LEN
)
1706 nd_snprintf(pos
, sizeof(id
) - (pos
- id
), "-%02x", EXTRACT_U_1(cp
));
1710 /* print the 4-byte metric block which is common found in the old-style TLVs */
1712 isis_print_metric_block(netdissect_options
*ndo
,
1713 const struct isis_metric_block
*isis_metric_block
)
1715 ND_PRINT(", Default Metric: %u, %s",
1716 ISIS_LSP_TLV_METRIC_VALUE(isis_metric_block
->metric_default
),
1717 ISIS_LSP_TLV_METRIC_IE(isis_metric_block
->metric_default
) ? "External" : "Internal");
1718 if (!ISIS_LSP_TLV_METRIC_SUPPORTED(isis_metric_block
->metric_delay
))
1719 ND_PRINT("\n\t\t Delay Metric: %u, %s",
1720 ISIS_LSP_TLV_METRIC_VALUE(isis_metric_block
->metric_delay
),
1721 ISIS_LSP_TLV_METRIC_IE(isis_metric_block
->metric_delay
) ? "External" : "Internal");
1722 if (!ISIS_LSP_TLV_METRIC_SUPPORTED(isis_metric_block
->metric_expense
))
1723 ND_PRINT("\n\t\t Expense Metric: %u, %s",
1724 ISIS_LSP_TLV_METRIC_VALUE(isis_metric_block
->metric_expense
),
1725 ISIS_LSP_TLV_METRIC_IE(isis_metric_block
->metric_expense
) ? "External" : "Internal");
1726 if (!ISIS_LSP_TLV_METRIC_SUPPORTED(isis_metric_block
->metric_error
))
1727 ND_PRINT("\n\t\t Error Metric: %u, %s",
1728 ISIS_LSP_TLV_METRIC_VALUE(isis_metric_block
->metric_error
),
1729 ISIS_LSP_TLV_METRIC_IE(isis_metric_block
->metric_error
) ? "External" : "Internal");
1731 return(1); /* everything is ok */
1735 isis_print_tlv_ip_reach(netdissect_options
*ndo
,
1736 const uint8_t *cp
, const char *ident
, u_int length
)
1739 const struct isis_tlv_ip_reach
*tlv_ip_reach
;
1741 tlv_ip_reach
= (const struct isis_tlv_ip_reach
*)cp
;
1743 while (length
> 0) {
1744 if ((size_t)length
< sizeof(*tlv_ip_reach
)) {
1745 ND_PRINT("short IPv4 Reachability (%u vs %lu)",
1747 (unsigned long)sizeof(*tlv_ip_reach
));
1751 if (!ND_TTEST_SIZE(tlv_ip_reach
))
1754 prefix_len
= mask2plen(EXTRACT_IPV4_TO_HOST_ORDER(tlv_ip_reach
->mask
));
1756 if (prefix_len
== -1)
1757 ND_PRINT("%sIPv4 prefix: %s mask %s",
1759 ipaddr_string(ndo
, (tlv_ip_reach
->prefix
)),
1760 ipaddr_string(ndo
, (tlv_ip_reach
->mask
)));
1762 ND_PRINT("%sIPv4 prefix: %15s/%u",
1764 ipaddr_string(ndo
, (tlv_ip_reach
->prefix
)),
1767 ND_PRINT(", Distribution: %s, Metric: %u, %s",
1768 ISIS_LSP_TLV_METRIC_UPDOWN(tlv_ip_reach
->isis_metric_block
.metric_default
) ? "down" : "up",
1769 ISIS_LSP_TLV_METRIC_VALUE(tlv_ip_reach
->isis_metric_block
.metric_default
),
1770 ISIS_LSP_TLV_METRIC_IE(tlv_ip_reach
->isis_metric_block
.metric_default
) ? "External" : "Internal");
1772 if (!ISIS_LSP_TLV_METRIC_SUPPORTED(tlv_ip_reach
->isis_metric_block
.metric_delay
))
1773 ND_PRINT("%s Delay Metric: %u, %s",
1775 ISIS_LSP_TLV_METRIC_VALUE(tlv_ip_reach
->isis_metric_block
.metric_delay
),
1776 ISIS_LSP_TLV_METRIC_IE(tlv_ip_reach
->isis_metric_block
.metric_delay
) ? "External" : "Internal");
1778 if (!ISIS_LSP_TLV_METRIC_SUPPORTED(tlv_ip_reach
->isis_metric_block
.metric_expense
))
1779 ND_PRINT("%s Expense Metric: %u, %s",
1781 ISIS_LSP_TLV_METRIC_VALUE(tlv_ip_reach
->isis_metric_block
.metric_expense
),
1782 ISIS_LSP_TLV_METRIC_IE(tlv_ip_reach
->isis_metric_block
.metric_expense
) ? "External" : "Internal");
1784 if (!ISIS_LSP_TLV_METRIC_SUPPORTED(tlv_ip_reach
->isis_metric_block
.metric_error
))
1785 ND_PRINT("%s Error Metric: %u, %s",
1787 ISIS_LSP_TLV_METRIC_VALUE(tlv_ip_reach
->isis_metric_block
.metric_error
),
1788 ISIS_LSP_TLV_METRIC_IE(tlv_ip_reach
->isis_metric_block
.metric_error
) ? "External" : "Internal");
1790 length
-= sizeof(struct isis_tlv_ip_reach
);
1797 * this is the common IP-REACH subTLV decoder it is called
1798 * from various EXTD-IP REACH TLVs (135,235,236,237)
1802 isis_print_ip_reach_subtlv(netdissect_options
*ndo
,
1803 const uint8_t *tptr
, u_int subt
, u_int subl
,
1806 /* first lets see if we know the subTLVs name*/
1807 ND_PRINT("%s%s subTLV #%u, length: %u",
1808 ident
, tok2str(isis_ext_ip_reach_subtlv_values
, "unknown", subt
),
1811 ND_TCHECK_LEN(tptr
, subl
);
1814 case ISIS_SUBTLV_EXTD_IP_REACH_MGMT_PREFIX_COLOR
: /* fall through */
1815 case ISIS_SUBTLV_EXTD_IP_REACH_ADMIN_TAG32
:
1817 ND_PRINT(", 0x%08x (=%u)",
1818 EXTRACT_BE_U_4(tptr
),
1819 EXTRACT_BE_U_4(tptr
));
1824 case ISIS_SUBTLV_EXTD_IP_REACH_ADMIN_TAG64
:
1826 ND_PRINT(", 0x%08x%08x",
1827 EXTRACT_BE_U_4(tptr
),
1828 EXTRACT_BE_U_4(tptr
+ 4));
1834 if (!print_unknown_data(ndo
, tptr
, "\n\t\t ", subl
))
1841 nd_print_trunc(ndo
);
1846 * this is the common IS-REACH decoder it is called
1847 * from various EXTD-IS REACH style TLVs (22,24,222)
1851 isis_print_ext_is_reach(netdissect_options
*ndo
,
1852 const uint8_t *tptr
, const char *ident
, u_int tlv_type
,
1853 u_int tlv_remaining
)
1855 char ident_buffer
[20];
1856 u_int subtlv_type
,subtlv_len
,subtlv_sum_len
;
1857 int proc_bytes
= 0; /* how many bytes did we process ? */
1858 u_int te_class
,priority_level
,gmpls_switch_cap
;
1859 union { /* int to float conversion buffer for several subTLVs */
1864 if (!ND_TTEST_LEN(tptr
, NODE_ID_LEN
))
1866 if (tlv_remaining
< NODE_ID_LEN
)
1869 ND_PRINT("%sIS Neighbor: %s", ident
, isis_print_id(tptr
, NODE_ID_LEN
));
1871 tlv_remaining
-=NODE_ID_LEN
;
1873 if (tlv_type
!= ISIS_TLV_IS_ALIAS_ID
) { /* the Alias TLV Metric field is implicit 0 */
1874 if (!ND_TTEST_3(tptr
)) /* and is therefore skipped */
1876 if (tlv_remaining
< 3)
1878 ND_PRINT(", Metric: %u", EXTRACT_BE_U_3(tptr
));
1883 if (!ND_TTEST_1(tptr
))
1885 if (tlv_remaining
< 1)
1887 subtlv_sum_len
=EXTRACT_U_1(tptr
); /* read out subTLV length */
1890 proc_bytes
=NODE_ID_LEN
+3+1;
1891 ND_PRINT(", %ssub-TLVs present",subtlv_sum_len
? "" : "no ");
1892 if (subtlv_sum_len
) {
1893 ND_PRINT(" (%u)", subtlv_sum_len
);
1894 /* prepend the indent string */
1895 nd_snprintf(ident_buffer
, sizeof(ident_buffer
), "%s ",ident
);
1896 ident
= ident_buffer
;
1897 while (subtlv_sum_len
!= 0) {
1898 if (!ND_TTEST_2(tptr
))
1900 if (tlv_remaining
< 2) {
1901 ND_PRINT("%sRemaining data in TLV shorter than a subTLV header",ident
);
1902 proc_bytes
+= tlv_remaining
;
1905 if (subtlv_sum_len
< 2) {
1906 ND_PRINT("%sRemaining data in subTLVs shorter than a subTLV header",ident
);
1907 proc_bytes
+= subtlv_sum_len
;
1910 subtlv_type
=EXTRACT_U_1(tptr
);
1911 subtlv_len
=EXTRACT_U_1(tptr
+ 1);
1914 subtlv_sum_len
-= 2;
1916 ND_PRINT("%s%s subTLV #%u, length: %u",
1917 ident
, tok2str(isis_ext_is_reach_subtlv_values
, "unknown", subtlv_type
),
1918 subtlv_type
, subtlv_len
);
1920 if (subtlv_sum_len
< subtlv_len
) {
1921 ND_PRINT(" (remaining data in subTLVs shorter than the current subTLV)");
1922 proc_bytes
+= subtlv_sum_len
;
1926 if (tlv_remaining
< subtlv_len
) {
1927 ND_PRINT(" (> remaining tlv length)");
1928 proc_bytes
+= tlv_remaining
;
1932 ND_TCHECK_LEN(tptr
, subtlv_len
);
1934 switch(subtlv_type
) {
1935 case ISIS_SUBTLV_EXT_IS_REACH_ADMIN_GROUP
:
1936 case ISIS_SUBTLV_EXT_IS_REACH_LINK_LOCAL_REMOTE_ID
:
1937 case ISIS_SUBTLV_EXT_IS_REACH_LINK_REMOTE_ID
:
1938 if (subtlv_len
>= 4) {
1939 ND_PRINT(", 0x%08x", EXTRACT_BE_U_4(tptr
));
1940 if (subtlv_len
== 8) /* rfc4205 */
1941 ND_PRINT(", 0x%08x", EXTRACT_BE_U_4(tptr
+ 4));
1944 case ISIS_SUBTLV_EXT_IS_REACH_IPV4_INTF_ADDR
:
1945 case ISIS_SUBTLV_EXT_IS_REACH_IPV4_NEIGHBOR_ADDR
:
1946 if (subtlv_len
>= sizeof(nd_ipv4
))
1947 ND_PRINT(", %s", ipaddr_string(ndo
, tptr
));
1949 case ISIS_SUBTLV_EXT_IS_REACH_MAX_LINK_BW
:
1950 case ISIS_SUBTLV_EXT_IS_REACH_RESERVABLE_BW
:
1951 if (subtlv_len
>= 4) {
1952 bw
.i
= EXTRACT_BE_U_4(tptr
);
1953 ND_PRINT(", %.3f Mbps", bw
.f
* 8 / 1000000);
1956 case ISIS_SUBTLV_EXT_IS_REACH_UNRESERVED_BW
:
1957 if (subtlv_len
>= 32) {
1958 for (te_class
= 0; te_class
< 8; te_class
++) {
1959 bw
.i
= EXTRACT_BE_U_4(tptr
);
1960 ND_PRINT("%s TE-Class %u: %.3f Mbps",
1963 bw
.f
* 8 / 1000000);
1966 subtlv_sum_len
-= 4;
1971 case ISIS_SUBTLV_EXT_IS_REACH_BW_CONSTRAINTS
: /* fall through */
1972 case ISIS_SUBTLV_EXT_IS_REACH_BW_CONSTRAINTS_OLD
:
1973 if (subtlv_len
== 0)
1975 ND_PRINT("%sBandwidth Constraints Model ID: %s (%u)",
1977 tok2str(diffserv_te_bc_values
, "unknown", EXTRACT_U_1(tptr
)),
1983 /* decode BCs until the subTLV ends */
1984 for (te_class
= 0; subtlv_len
!= 0; te_class
++) {
1987 bw
.i
= EXTRACT_BE_U_4(tptr
);
1988 ND_PRINT("%s Bandwidth constraint CT%u: %.3f Mbps",
1991 bw
.f
* 8 / 1000000);
1994 subtlv_sum_len
-= 4;
1998 case ISIS_SUBTLV_EXT_IS_REACH_TE_METRIC
:
1999 if (subtlv_len
>= 3)
2000 ND_PRINT(", %u", EXTRACT_BE_U_3(tptr
));
2002 case ISIS_SUBTLV_EXT_IS_REACH_LINK_ATTRIBUTE
:
2003 if (subtlv_len
== 2) {
2004 ND_PRINT(", [ %s ] (0x%04x)",
2005 bittok2str(isis_subtlv_link_attribute_values
,
2007 EXTRACT_BE_U_2(tptr
)),
2008 EXTRACT_BE_U_2(tptr
));
2011 case ISIS_SUBTLV_EXT_IS_REACH_LINK_PROTECTION_TYPE
:
2012 if (subtlv_len
>= 2) {
2013 ND_PRINT(", %s, Priority %u",
2014 bittok2str(gmpls_link_prot_values
, "none", EXTRACT_U_1(tptr
)),
2015 EXTRACT_U_1(tptr
+ 1));
2018 case ISIS_SUBTLV_SPB_METRIC
:
2019 if (subtlv_len
>= 6) {
2020 ND_PRINT(", LM: %u", EXTRACT_BE_U_3(tptr
));
2023 subtlv_sum_len
-= 3;
2025 ND_PRINT(", P: %u", EXTRACT_U_1(tptr
));
2030 ND_PRINT(", P-ID: %u", EXTRACT_BE_U_2(tptr
));
2033 case ISIS_SUBTLV_EXT_IS_REACH_INTF_SW_CAP_DESCR
:
2034 if (subtlv_len
>= 36) {
2035 gmpls_switch_cap
= EXTRACT_U_1(tptr
);
2036 ND_PRINT("%s Interface Switching Capability:%s",
2038 tok2str(gmpls_switch_cap_values
, "Unknown", gmpls_switch_cap
));
2039 ND_PRINT(", LSP Encoding: %s",
2040 tok2str(gmpls_encoding_values
, "Unknown", EXTRACT_U_1((tptr
+ 1))));
2043 subtlv_sum_len
-= 4;
2045 ND_PRINT("%s Max LSP Bandwidth:", ident
);
2046 for (priority_level
= 0; priority_level
< 8; priority_level
++) {
2047 bw
.i
= EXTRACT_BE_U_4(tptr
);
2048 ND_PRINT("%s priority level %u: %.3f Mbps",
2051 bw
.f
* 8 / 1000000);
2054 subtlv_sum_len
-= 4;
2057 switch (gmpls_switch_cap
) {
2064 bw
.i
= EXTRACT_BE_U_4(tptr
);
2065 ND_PRINT("%s Min LSP Bandwidth: %.3f Mbps", ident
, bw
.f
* 8 / 1000000);
2066 ND_PRINT("%s Interface MTU: %u", ident
, EXTRACT_BE_U_2(tptr
+ 4));
2071 bw
.i
= EXTRACT_BE_U_4(tptr
);
2072 ND_PRINT("%s Min LSP Bandwidth: %.3f Mbps", ident
, bw
.f
* 8 / 1000000);
2073 ND_PRINT("%s Indication %s", ident
,
2074 tok2str(gmpls_switch_cap_tsc_indication_values
, "Unknown (%u)", EXTRACT_U_1((tptr
+ 4))));
2077 /* there is some optional stuff left to decode but this is as of yet
2078 not specified so just lets hexdump what is left */
2079 if (subtlv_len
!= 0) {
2080 if (!print_unknown_data(ndo
, tptr
, "\n\t\t ", subtlv_len
))
2087 if (!print_unknown_data(ndo
, tptr
, "\n\t\t ", subtlv_len
))
2093 tlv_remaining
-= subtlv_len
;
2094 subtlv_sum_len
-= subtlv_len
;
2095 proc_bytes
+= subtlv_len
;
2105 * this is the common Multi Topology ID decoder
2106 * it is called from various MT-TLVs (222,229,235,237)
2110 isis_print_mtid(netdissect_options
*ndo
,
2111 const uint8_t *tptr
, const char *ident
)
2113 if (!ND_TTEST_2(tptr
))
2118 tok2str(isis_mt_values
,
2119 "Reserved for IETF Consensus",
2120 ISIS_MASK_MTID(EXTRACT_BE_U_2(tptr
))));
2122 ND_PRINT(" Topology (0x%03x), Flags: [%s]",
2123 ISIS_MASK_MTID(EXTRACT_BE_U_2(tptr
)),
2124 bittok2str(isis_mt_flag_values
, "none",ISIS_MASK_MTFLAGS(EXTRACT_BE_U_2(tptr
))));
2130 * this is the common extended IP reach decoder
2131 * it is called from TLVs (135,235,236,237)
2132 * we process the TLV and optional subTLVs and return
2133 * the amount of processed bytes
2137 isis_print_extd_ip_reach(netdissect_options
*ndo
,
2138 const uint8_t *tptr
, const char *ident
, uint16_t afi
)
2140 char ident_buffer
[20];
2141 uint8_t prefix
[sizeof(nd_ipv6
)]; /* shared copy buffer for IPv4 and IPv6 prefixes */
2142 u_int metric
, status_byte
, bit_length
, byte_length
, sublen
, processed
, subtlvtype
, subtlvlen
;
2144 if (!ND_TTEST_4(tptr
))
2146 metric
= EXTRACT_BE_U_4(tptr
);
2150 if (afi
== AF_INET
) {
2151 if (!ND_TTEST_1(tptr
)) /* fetch status byte */
2153 status_byte
=EXTRACT_U_1(tptr
);
2155 bit_length
= status_byte
&0x3f;
2156 if (bit_length
> 32) {
2157 ND_PRINT("%sIPv4 prefix: bad bit length %u",
2163 } else if (afi
== AF_INET6
) {
2164 if (!ND_TTEST_2(tptr
)) /* fetch status & prefix_len byte */
2166 status_byte
=EXTRACT_U_1(tptr
);
2167 bit_length
=EXTRACT_U_1(tptr
+ 1);
2168 if (bit_length
> 128) {
2169 ND_PRINT("%sIPv6 prefix: bad bit length %u",
2177 return (0); /* somebody is fooling us */
2179 byte_length
= (bit_length
+ 7) / 8; /* prefix has variable length encoding */
2181 if (!ND_TTEST_LEN(tptr
, byte_length
))
2183 memset(prefix
, 0, sizeof(prefix
)); /* clear the copy buffer */
2184 memcpy(prefix
,tptr
,byte_length
); /* copy as much as is stored in the TLV */
2186 processed
+=byte_length
;
2189 ND_PRINT("%sIPv4 prefix: %15s/%u",
2191 ipaddr_string(ndo
, prefix
),
2193 else if (afi
== AF_INET6
)
2194 ND_PRINT("%sIPv6 prefix: %s/%u",
2196 ip6addr_string(ndo
, prefix
),
2199 ND_PRINT(", Distribution: %s, Metric: %u",
2200 ISIS_MASK_TLV_EXTD_IP_UPDOWN(status_byte
) ? "down" : "up",
2203 if (afi
== AF_INET
&& ISIS_MASK_TLV_EXTD_IP_SUBTLV(status_byte
))
2204 ND_PRINT(", sub-TLVs present");
2205 else if (afi
== AF_INET6
)
2207 ISIS_MASK_TLV_EXTD_IP6_IE(status_byte
) ? "External" : "Internal",
2208 ISIS_MASK_TLV_EXTD_IP6_SUBTLV(status_byte
) ? ", sub-TLVs present" : "");
2210 if ((afi
== AF_INET
&& ISIS_MASK_TLV_EXTD_IP_SUBTLV(status_byte
))
2211 || (afi
== AF_INET6
&& ISIS_MASK_TLV_EXTD_IP6_SUBTLV(status_byte
))
2213 /* assume that one prefix can hold more
2214 than one subTLV - therefore the first byte must reflect
2215 the aggregate bytecount of the subTLVs for this prefix
2217 if (!ND_TTEST_1(tptr
))
2219 sublen
=EXTRACT_U_1(tptr
);
2221 processed
+=sublen
+1;
2222 ND_PRINT(" (%u)", sublen
); /* print out subTLV length */
2225 if (!ND_TTEST_2(tptr
))
2227 subtlvtype
=EXTRACT_U_1(tptr
);
2228 subtlvlen
=EXTRACT_U_1(tptr
+ 1);
2230 /* prepend the indent string */
2231 nd_snprintf(ident_buffer
, sizeof(ident_buffer
), "%s ",ident
);
2232 if (!isis_print_ip_reach_subtlv(ndo
, tptr
, subtlvtype
, subtlvlen
, ident_buffer
))
2235 sublen
-=(subtlvlen
+2);
2242 * Clear checksum and lifetime prior to signature verification.
2245 isis_clear_checksum_lifetime(void *header
)
2247 struct isis_lsp_header
*header_lsp
= (struct isis_lsp_header
*) header
;
2249 header_lsp
->checksum
[0] = 0;
2250 header_lsp
->checksum
[1] = 0;
2251 header_lsp
->remaining_lifetime
[0] = 0;
2252 header_lsp
->remaining_lifetime
[1] = 0;
2257 * Decode IS-IS packets. Return 0 on error.
2261 isis_print(netdissect_options
*ndo
,
2262 const uint8_t *p
, u_int length
)
2264 const struct isis_common_header
*isis_header
;
2266 const struct isis_iih_lan_header
*header_iih_lan
;
2267 const struct isis_iih_ptp_header
*header_iih_ptp
;
2268 const struct isis_lsp_header
*header_lsp
;
2269 const struct isis_csnp_header
*header_csnp
;
2270 const struct isis_psnp_header
*header_psnp
;
2272 const struct isis_tlv_lsp
*tlv_lsp
;
2273 const struct isis_tlv_ptp_adj
*tlv_ptp_adj
;
2274 const struct isis_tlv_is_reach
*tlv_is_reach
;
2275 const struct isis_tlv_es_reach
*tlv_es_reach
;
2277 uint8_t version
, pdu_version
, fixed_len
;
2278 uint8_t pdu_type
, pdu_max_area
, max_area
, pdu_id_length
, id_length
, tlv_type
, tlv_len
, tmp
, alen
, lan_alen
, prefix_len
;
2279 u_int ext_is_len
, ext_ip_len
, mt_len
;
2280 uint8_t isis_subtlv_idrp
;
2281 const uint8_t *optr
, *pptr
, *tptr
;
2283 u_short pdu_len
, key_id
;
2287 ndo
->ndo_protocol
= "isis";
2289 optr
= p
; /* initialize the _o_riginal pointer to the packet start -
2290 need it for parsing the checksum TLV and authentication
2292 isis_header
= (const struct isis_common_header
*)p
;
2293 ND_TCHECK_SIZE(isis_header
);
2294 if (length
< ISIS_COMMON_HEADER_SIZE
)
2296 pptr
= p
+(ISIS_COMMON_HEADER_SIZE
);
2297 header_iih_lan
= (const struct isis_iih_lan_header
*)pptr
;
2298 header_iih_ptp
= (const struct isis_iih_ptp_header
*)pptr
;
2299 header_lsp
= (const struct isis_lsp_header
*)pptr
;
2300 header_csnp
= (const struct isis_csnp_header
*)pptr
;
2301 header_psnp
= (const struct isis_psnp_header
*)pptr
;
2303 if (!ndo
->ndo_eflag
)
2307 * Sanity checking of the header.
2310 version
= EXTRACT_U_1(isis_header
->version
);
2311 if (version
!= ISIS_VERSION
) {
2312 ND_PRINT("version %u packet not supported", version
);
2316 pdu_id_length
= EXTRACT_U_1(isis_header
->id_length
);
2317 if ((pdu_id_length
!= SYSTEM_ID_LEN
) && (pdu_id_length
!= 0)) {
2318 ND_PRINT("system ID length of %u is not supported",
2323 pdu_version
= EXTRACT_U_1(isis_header
->pdu_version
);
2324 if (pdu_version
!= ISIS_VERSION
) {
2325 ND_PRINT("version %u packet not supported", pdu_version
);
2329 fixed_len
= EXTRACT_U_1(isis_header
->fixed_len
);
2330 if (length
< fixed_len
) {
2331 ND_PRINT("fixed header length %u > packet length %u", fixed_len
, length
);
2335 if (fixed_len
< ISIS_COMMON_HEADER_SIZE
) {
2336 ND_PRINT("fixed header length %u < minimum header size %u", fixed_len
, (u_int
)ISIS_COMMON_HEADER_SIZE
);
2340 pdu_max_area
= EXTRACT_U_1(isis_header
->max_area
);
2341 switch(pdu_max_area
) {
2343 max_area
= 3; /* silly shit */
2346 ND_PRINT("bad packet -- 255 areas");
2349 max_area
= pdu_max_area
;
2353 switch(pdu_id_length
) {
2355 id_length
= 6; /* silly shit again */
2357 case 1: /* 1-8 are valid sys-ID lengths */
2365 id_length
= pdu_id_length
;
2368 id_length
= 0; /* entirely useless */
2371 id_length
= pdu_id_length
;
2375 /* toss any non 6-byte sys-ID len PDUs */
2376 if (id_length
!= 6 ) {
2377 ND_PRINT("bad packet -- illegal sys-ID length (%u)", id_length
);
2381 pdu_type
= EXTRACT_U_1(isis_header
->pdu_type
);
2383 /* in non-verbose mode print the basic PDU Type plus PDU specific brief information*/
2384 if (ndo
->ndo_vflag
== 0) {
2386 ndo
->ndo_eflag
? "" : ", ",
2387 tok2str(isis_pdu_values
, "unknown PDU-Type %u", pdu_type
));
2389 /* ok they seem to want to know everything - lets fully decode it */
2390 ND_PRINT("%slength %u", ndo
->ndo_eflag
? "" : ", ", length
);
2392 ND_PRINT("\n\t%s, hlen: %u, v: %u, pdu-v: %u, sys-id-len: %u (%u), max-area: %u (%u)",
2393 tok2str(isis_pdu_values
,
2404 if (ndo
->ndo_vflag
> 1) {
2405 if (!print_unknown_data(ndo
, optr
, "\n\t", 8)) /* provide the _o_riginal pointer */
2406 return (0); /* for optionally debugging the common header */
2412 case ISIS_PDU_L1_LAN_IIH
:
2413 case ISIS_PDU_L2_LAN_IIH
:
2414 if (fixed_len
!= (ISIS_COMMON_HEADER_SIZE
+ISIS_IIH_LAN_HEADER_SIZE
)) {
2415 ND_PRINT(", bogus fixed header length %u should be %lu",
2416 fixed_len
, (unsigned long)(ISIS_COMMON_HEADER_SIZE
+ISIS_IIH_LAN_HEADER_SIZE
));
2419 ND_TCHECK_SIZE(header_iih_lan
);
2420 if (length
< ISIS_COMMON_HEADER_SIZE
+ISIS_IIH_LAN_HEADER_SIZE
)
2422 if (ndo
->ndo_vflag
== 0) {
2423 ND_PRINT(", src-id %s",
2424 isis_print_id(header_iih_lan
->source_id
, SYSTEM_ID_LEN
));
2425 ND_PRINT(", lan-id %s, prio %u",
2426 isis_print_id(header_iih_lan
->lan_id
,NODE_ID_LEN
),
2427 EXTRACT_U_1(header_iih_lan
->priority
));
2428 ND_PRINT(", length %u", length
);
2431 pdu_len
=EXTRACT_BE_U_2(header_iih_lan
->pdu_len
);
2432 if (packet_len
>pdu_len
) {
2433 packet_len
=pdu_len
; /* do TLV decoding as long as it makes sense */
2437 ND_PRINT("\n\t source-id: %s, holding time: %us, Flags: [%s]",
2438 isis_print_id(header_iih_lan
->source_id
,SYSTEM_ID_LEN
),
2439 EXTRACT_BE_U_2(header_iih_lan
->holding_time
),
2440 tok2str(isis_iih_circuit_type_values
,
2441 "unknown circuit type 0x%02x",
2442 EXTRACT_U_1(header_iih_lan
->circuit_type
)));
2444 ND_PRINT("\n\t lan-id: %s, Priority: %u, PDU length: %u",
2445 isis_print_id(header_iih_lan
->lan_id
, NODE_ID_LEN
),
2446 EXTRACT_U_1(header_iih_lan
->priority
) & ISIS_LAN_PRIORITY_MASK
,
2449 if (ndo
->ndo_vflag
> 1) {
2450 if (!print_unknown_data(ndo
, pptr
, "\n\t ", ISIS_IIH_LAN_HEADER_SIZE
))
2454 packet_len
-= (ISIS_COMMON_HEADER_SIZE
+ISIS_IIH_LAN_HEADER_SIZE
);
2455 pptr
= p
+ (ISIS_COMMON_HEADER_SIZE
+ISIS_IIH_LAN_HEADER_SIZE
);
2458 case ISIS_PDU_PTP_IIH
:
2459 if (fixed_len
!= (ISIS_COMMON_HEADER_SIZE
+ISIS_IIH_PTP_HEADER_SIZE
)) {
2460 ND_PRINT(", bogus fixed header length %u should be %lu",
2461 fixed_len
, (unsigned long)(ISIS_COMMON_HEADER_SIZE
+ISIS_IIH_PTP_HEADER_SIZE
));
2464 ND_TCHECK_SIZE(header_iih_ptp
);
2465 if (length
< ISIS_COMMON_HEADER_SIZE
+ISIS_IIH_PTP_HEADER_SIZE
)
2467 if (ndo
->ndo_vflag
== 0) {
2468 ND_PRINT(", src-id %s", isis_print_id(header_iih_ptp
->source_id
, SYSTEM_ID_LEN
));
2469 ND_PRINT(", length %u", length
);
2472 pdu_len
=EXTRACT_BE_U_2(header_iih_ptp
->pdu_len
);
2473 if (packet_len
>pdu_len
) {
2474 packet_len
=pdu_len
; /* do TLV decoding as long as it makes sense */
2478 ND_PRINT("\n\t source-id: %s, holding time: %us, Flags: [%s]",
2479 isis_print_id(header_iih_ptp
->source_id
,SYSTEM_ID_LEN
),
2480 EXTRACT_BE_U_2(header_iih_ptp
->holding_time
),
2481 tok2str(isis_iih_circuit_type_values
,
2482 "unknown circuit type 0x%02x",
2483 EXTRACT_U_1(header_iih_ptp
->circuit_type
)));
2485 ND_PRINT("\n\t circuit-id: 0x%02x, PDU length: %u",
2486 EXTRACT_U_1(header_iih_ptp
->circuit_id
),
2489 if (ndo
->ndo_vflag
> 1) {
2490 if (!print_unknown_data(ndo
, pptr
, "\n\t ", ISIS_IIH_PTP_HEADER_SIZE
))
2494 packet_len
-= (ISIS_COMMON_HEADER_SIZE
+ISIS_IIH_PTP_HEADER_SIZE
);
2495 pptr
= p
+ (ISIS_COMMON_HEADER_SIZE
+ISIS_IIH_PTP_HEADER_SIZE
);
2498 case ISIS_PDU_L1_LSP
:
2499 case ISIS_PDU_L2_LSP
:
2500 if (fixed_len
!= (ISIS_COMMON_HEADER_SIZE
+ISIS_LSP_HEADER_SIZE
)) {
2501 ND_PRINT(", bogus fixed header length %u should be %lu",
2502 fixed_len
, (unsigned long)ISIS_LSP_HEADER_SIZE
);
2505 ND_TCHECK_SIZE(header_lsp
);
2506 if (length
< ISIS_COMMON_HEADER_SIZE
+ISIS_LSP_HEADER_SIZE
)
2508 if (ndo
->ndo_vflag
== 0) {
2509 ND_PRINT(", lsp-id %s, seq 0x%08x, lifetime %5us",
2510 isis_print_id(header_lsp
->lsp_id
, LSP_ID_LEN
),
2511 EXTRACT_BE_U_4(header_lsp
->sequence_number
),
2512 EXTRACT_BE_U_2(header_lsp
->remaining_lifetime
));
2513 ND_PRINT(", length %u", length
);
2516 pdu_len
=EXTRACT_BE_U_2(header_lsp
->pdu_len
);
2517 if (packet_len
>pdu_len
) {
2518 packet_len
=pdu_len
; /* do TLV decoding as long as it makes sense */
2522 ND_PRINT("\n\t lsp-id: %s, seq: 0x%08x, lifetime: %5us\n\t chksum: 0x%04x",
2523 isis_print_id(header_lsp
->lsp_id
, LSP_ID_LEN
),
2524 EXTRACT_BE_U_4(header_lsp
->sequence_number
),
2525 EXTRACT_BE_U_2(header_lsp
->remaining_lifetime
),
2526 EXTRACT_BE_U_2(header_lsp
->checksum
));
2528 osi_print_cksum(ndo
, (const uint8_t *)header_lsp
->lsp_id
,
2529 EXTRACT_BE_U_2(header_lsp
->checksum
),
2532 ND_PRINT(", PDU length: %u, Flags: [ %s",
2534 ISIS_MASK_LSP_OL_BIT(header_lsp
->typeblock
) ? "Overload bit set, " : "");
2536 if (ISIS_MASK_LSP_ATT_BITS(header_lsp
->typeblock
)) {
2537 ND_PRINT("%s", ISIS_MASK_LSP_ATT_DEFAULT_BIT(header_lsp
->typeblock
) ? "default " : "");
2538 ND_PRINT("%s", ISIS_MASK_LSP_ATT_DELAY_BIT(header_lsp
->typeblock
) ? "delay " : "");
2539 ND_PRINT("%s", ISIS_MASK_LSP_ATT_EXPENSE_BIT(header_lsp
->typeblock
) ? "expense " : "");
2540 ND_PRINT("%s", ISIS_MASK_LSP_ATT_ERROR_BIT(header_lsp
->typeblock
) ? "error " : "");
2541 ND_PRINT("ATT bit set, ");
2543 ND_PRINT("%s", ISIS_MASK_LSP_PARTITION_BIT(header_lsp
->typeblock
) ? "P bit set, " : "");
2544 ND_PRINT("%s ]", tok2str(isis_lsp_istype_values
, "Unknown(0x%x)",
2545 ISIS_MASK_LSP_ISTYPE_BITS(header_lsp
->typeblock
)));
2547 if (ndo
->ndo_vflag
> 1) {
2548 if (!print_unknown_data(ndo
, pptr
, "\n\t ", ISIS_LSP_HEADER_SIZE
))
2552 packet_len
-= (ISIS_COMMON_HEADER_SIZE
+ISIS_LSP_HEADER_SIZE
);
2553 pptr
= p
+ (ISIS_COMMON_HEADER_SIZE
+ISIS_LSP_HEADER_SIZE
);
2556 case ISIS_PDU_L1_CSNP
:
2557 case ISIS_PDU_L2_CSNP
:
2558 if (fixed_len
!= (ISIS_COMMON_HEADER_SIZE
+ISIS_CSNP_HEADER_SIZE
)) {
2559 ND_PRINT(", bogus fixed header length %u should be %lu",
2560 fixed_len
, (unsigned long)(ISIS_COMMON_HEADER_SIZE
+ISIS_CSNP_HEADER_SIZE
));
2563 ND_TCHECK_SIZE(header_csnp
);
2564 if (length
< ISIS_COMMON_HEADER_SIZE
+ISIS_CSNP_HEADER_SIZE
)
2566 if (ndo
->ndo_vflag
== 0) {
2567 ND_PRINT(", src-id %s", isis_print_id(header_csnp
->source_id
, NODE_ID_LEN
));
2568 ND_PRINT(", length %u", length
);
2571 pdu_len
=EXTRACT_BE_U_2(header_csnp
->pdu_len
);
2572 if (packet_len
>pdu_len
) {
2573 packet_len
=pdu_len
; /* do TLV decoding as long as it makes sense */
2577 ND_PRINT("\n\t source-id: %s, PDU length: %u",
2578 isis_print_id(header_csnp
->source_id
, NODE_ID_LEN
),
2580 ND_PRINT("\n\t start lsp-id: %s",
2581 isis_print_id(header_csnp
->start_lsp_id
, LSP_ID_LEN
));
2582 ND_PRINT("\n\t end lsp-id: %s",
2583 isis_print_id(header_csnp
->end_lsp_id
, LSP_ID_LEN
));
2585 if (ndo
->ndo_vflag
> 1) {
2586 if (!print_unknown_data(ndo
, pptr
, "\n\t ", ISIS_CSNP_HEADER_SIZE
))
2590 packet_len
-= (ISIS_COMMON_HEADER_SIZE
+ISIS_CSNP_HEADER_SIZE
);
2591 pptr
= p
+ (ISIS_COMMON_HEADER_SIZE
+ISIS_CSNP_HEADER_SIZE
);
2594 case ISIS_PDU_L1_PSNP
:
2595 case ISIS_PDU_L2_PSNP
:
2596 if (fixed_len
!= (ISIS_COMMON_HEADER_SIZE
+ISIS_PSNP_HEADER_SIZE
)) {
2597 ND_PRINT("- bogus fixed header length %u should be %lu",
2598 fixed_len
, (unsigned long)(ISIS_COMMON_HEADER_SIZE
+ISIS_PSNP_HEADER_SIZE
));
2601 ND_TCHECK_SIZE(header_psnp
);
2602 if (length
< ISIS_COMMON_HEADER_SIZE
+ISIS_PSNP_HEADER_SIZE
)
2604 if (ndo
->ndo_vflag
== 0) {
2605 ND_PRINT(", src-id %s", isis_print_id(header_psnp
->source_id
, NODE_ID_LEN
));
2606 ND_PRINT(", length %u", length
);
2609 pdu_len
=EXTRACT_BE_U_2(header_psnp
->pdu_len
);
2610 if (packet_len
>pdu_len
) {
2611 packet_len
=pdu_len
; /* do TLV decoding as long as it makes sense */
2615 ND_PRINT("\n\t source-id: %s, PDU length: %u",
2616 isis_print_id(header_psnp
->source_id
, NODE_ID_LEN
),
2619 if (ndo
->ndo_vflag
> 1) {
2620 if (!print_unknown_data(ndo
, pptr
, "\n\t ", ISIS_PSNP_HEADER_SIZE
))
2624 packet_len
-= (ISIS_COMMON_HEADER_SIZE
+ISIS_PSNP_HEADER_SIZE
);
2625 pptr
= p
+ (ISIS_COMMON_HEADER_SIZE
+ISIS_PSNP_HEADER_SIZE
);
2629 if (ndo
->ndo_vflag
== 0) {
2630 ND_PRINT(", length %u", length
);
2633 (void)print_unknown_data(ndo
, pptr
, "\n\t ", length
);
2638 * Now print the TLV's.
2641 while (packet_len
> 0) {
2645 tlv_type
= EXTRACT_U_1(pptr
);
2646 tlv_len
= EXTRACT_U_1(pptr
+ 1);
2649 tmp
=tlv_len
; /* copy temporary len & pointer to packet data */
2652 /* first lets see if we know the TLVs name*/
2653 ND_PRINT("\n\t %s TLV #%u, length: %u",
2654 tok2str(isis_tlv_values
,
2660 if (tlv_len
== 0) /* something is invalid */
2663 if (packet_len
< tlv_len
)
2666 /* now check if we have a decoder otherwise do a hexdump at the end*/
2668 case ISIS_TLV_AREA_ADDR
:
2670 alen
= EXTRACT_U_1(tptr
);
2672 while (tmp
&& alen
< tmp
) {
2673 ND_TCHECK_LEN(tptr
, alen
);
2674 ND_PRINT("\n\t Area address (length: %u): %s",
2676 isonsap_string(ndo
, tptr
, alen
));
2679 if (tmp
==0) /* if this is the last area address do not attempt a boundary check */
2682 alen
= EXTRACT_U_1(tptr
);
2686 case ISIS_TLV_ISNEIGH
:
2687 while (tmp
>= MAC_ADDR_LEN
) {
2688 ND_TCHECK_LEN(tptr
, MAC_ADDR_LEN
);
2689 ND_PRINT("\n\t SNPA: %s", isis_print_id(tptr
, MAC_ADDR_LEN
));
2690 tmp
-= MAC_ADDR_LEN
;
2691 tptr
+= MAC_ADDR_LEN
;
2695 case ISIS_TLV_ISNEIGH_VARLEN
:
2696 if (!ND_TTEST_1(tptr
) || tmp
< 3) /* min. TLV length */
2698 lan_alen
= EXTRACT_U_1(tptr
); /* LAN address length */
2700 if (lan_alen
== 0) {
2701 ND_PRINT("\n\t LAN address length 0 bytes");
2702 nd_print_invalid(ndo
);
2706 ND_PRINT("\n\t LAN address length %u bytes ", lan_alen
);
2707 while (tmp
>= lan_alen
) {
2708 ND_TCHECK_LEN(tptr
, lan_alen
);
2709 ND_PRINT("\n\t\tIS Neighbor: %s", isis_print_id(tptr
, lan_alen
));
2715 case ISIS_TLV_PADDING
:
2718 case ISIS_TLV_MT_IS_REACH
:
2719 mt_len
= isis_print_mtid(ndo
, tptr
, "\n\t ");
2720 if (mt_len
== 0) /* did something go wrong ? */
2724 while (tmp
>= 2+NODE_ID_LEN
+3+1) {
2725 ext_is_len
= isis_print_ext_is_reach(ndo
, tptr
, "\n\t ", tlv_type
, tmp
);
2726 if (ext_is_len
== 0) /* did something go wrong ? */
2734 case ISIS_TLV_IS_ALIAS_ID
:
2735 while (tmp
>= NODE_ID_LEN
+1) { /* is it worth attempting a decode ? */
2736 ext_is_len
= isis_print_ext_is_reach(ndo
, tptr
, "\n\t ", tlv_type
, tmp
);
2737 if (ext_is_len
== 0) /* did something go wrong ? */
2744 case ISIS_TLV_EXT_IS_REACH
:
2745 while (tmp
>= NODE_ID_LEN
+3+1) { /* is it worth attempting a decode ? */
2746 ext_is_len
= isis_print_ext_is_reach(ndo
, tptr
, "\n\t ", tlv_type
, tmp
);
2747 if (ext_is_len
== 0) /* did something go wrong ? */
2753 case ISIS_TLV_IS_REACH
:
2754 ND_TCHECK_1(tptr
); /* check if there is one byte left to read out the virtual flag */
2756 tok2str(isis_is_reach_virtual_values
,
2757 "bogus virtual flag 0x%02x",
2758 EXTRACT_U_1(tptr
)));
2760 tlv_is_reach
= (const struct isis_tlv_is_reach
*)tptr
;
2761 while (tmp
>= sizeof(struct isis_tlv_is_reach
)) {
2762 ND_TCHECK_SIZE(tlv_is_reach
);
2763 ND_PRINT("\n\t IS Neighbor: %s",
2764 isis_print_id(tlv_is_reach
->neighbor_nodeid
, NODE_ID_LEN
));
2765 isis_print_metric_block(ndo
, &tlv_is_reach
->isis_metric_block
);
2766 tmp
-= sizeof(struct isis_tlv_is_reach
);
2771 case ISIS_TLV_ESNEIGH
:
2772 tlv_es_reach
= (const struct isis_tlv_es_reach
*)tptr
;
2773 while (tmp
>= sizeof(struct isis_tlv_es_reach
)) {
2774 ND_TCHECK_SIZE(tlv_es_reach
);
2775 ND_PRINT("\n\t ES Neighbor: %s",
2776 isis_print_id(tlv_es_reach
->neighbor_sysid
, SYSTEM_ID_LEN
));
2777 isis_print_metric_block(ndo
, &tlv_es_reach
->isis_metric_block
);
2778 tmp
-= sizeof(struct isis_tlv_es_reach
);
2783 /* those two TLVs share the same format */
2784 case ISIS_TLV_INT_IP_REACH
:
2785 case ISIS_TLV_EXT_IP_REACH
:
2786 if (!isis_print_tlv_ip_reach(ndo
, pptr
, "\n\t ", tlv_len
))
2790 case ISIS_TLV_EXTD_IP_REACH
:
2792 ext_ip_len
= isis_print_extd_ip_reach(ndo
, tptr
, "\n\t ", AF_INET
);
2793 if (ext_ip_len
== 0) /* did something go wrong ? */
2800 case ISIS_TLV_MT_IP_REACH
:
2801 mt_len
= isis_print_mtid(ndo
, tptr
, "\n\t ");
2802 if (mt_len
== 0) { /* did something go wrong ? */
2809 ext_ip_len
= isis_print_extd_ip_reach(ndo
, tptr
, "\n\t ", AF_INET
);
2810 if (ext_ip_len
== 0) /* did something go wrong ? */
2817 case ISIS_TLV_IP6_REACH
:
2819 ext_ip_len
= isis_print_extd_ip_reach(ndo
, tptr
, "\n\t ", AF_INET6
);
2820 if (ext_ip_len
== 0) /* did something go wrong ? */
2827 case ISIS_TLV_MT_IP6_REACH
:
2828 mt_len
= isis_print_mtid(ndo
, tptr
, "\n\t ");
2829 if (mt_len
== 0) { /* did something go wrong ? */
2836 ext_ip_len
= isis_print_extd_ip_reach(ndo
, tptr
, "\n\t ", AF_INET6
);
2837 if (ext_ip_len
== 0) /* did something go wrong ? */
2844 case ISIS_TLV_IP6ADDR
:
2845 while (tmp
>=sizeof(nd_ipv6
)) {
2846 ND_TCHECK_LEN(tptr
, sizeof(nd_ipv6
));
2848 ND_PRINT("\n\t IPv6 interface address: %s",
2849 ip6addr_string(ndo
, tptr
));
2851 tptr
+= sizeof(nd_ipv6
);
2852 tmp
-= sizeof(nd_ipv6
);
2858 ND_PRINT("\n\t %s: ",
2859 tok2str(isis_subtlv_auth_values
,
2860 "unknown Authentication type 0x%02x",
2861 EXTRACT_U_1(tptr
)));
2863 switch (EXTRACT_U_1(tptr
)) {
2864 case ISIS_SUBTLV_AUTH_SIMPLE
:
2865 if (nd_printzp(ndo
, tptr
+ 1, tlv_len
- 1, ndo
->ndo_snapend
))
2868 case ISIS_SUBTLV_AUTH_MD5
:
2869 for(i
=1;i
<tlv_len
;i
++) {
2870 ND_TCHECK_1(tptr
+ i
);
2871 ND_PRINT("%02x", EXTRACT_U_1(tptr
+ i
));
2873 if (tlv_len
!= ISIS_SUBTLV_AUTH_MD5_LEN
+1)
2874 ND_PRINT(", (invalid subTLV) ");
2876 sigcheck
= signature_verify(ndo
, optr
, length
, tptr
+ 1,
2877 isis_clear_checksum_lifetime
,
2879 ND_PRINT(" (%s)", tok2str(signature_check_values
, "Unknown", sigcheck
));
2882 case ISIS_SUBTLV_AUTH_GENERIC
:
2883 ND_TCHECK_2(tptr
+ 1);
2884 key_id
= EXTRACT_BE_U_2(tptr
+ 1);
2885 ND_PRINT("%u, password: ", key_id
);
2886 for(i
=1 + sizeof(uint16_t);i
<tlv_len
;i
++) {
2887 ND_TCHECK_1(tptr
+ i
);
2888 ND_PRINT("%02x", EXTRACT_U_1(tptr
+ i
));
2891 case ISIS_SUBTLV_AUTH_PRIVATE
:
2893 if (!print_unknown_data(ndo
, tptr
+ 1, "\n\t\t ", tlv_len
- 1))
2899 case ISIS_TLV_PTP_ADJ
:
2900 tlv_ptp_adj
= (const struct isis_tlv_ptp_adj
*)tptr
;
2903 ND_PRINT("\n\t Adjacency State: %s (%u)",
2904 tok2str(isis_ptp_adjancey_values
, "unknown", EXTRACT_U_1(tptr
)),
2908 if(tmp
>sizeof(tlv_ptp_adj
->extd_local_circuit_id
)) {
2909 ND_TCHECK_4(tlv_ptp_adj
->extd_local_circuit_id
);
2910 ND_PRINT("\n\t Extended Local circuit-ID: 0x%08x",
2911 EXTRACT_BE_U_4(tlv_ptp_adj
->extd_local_circuit_id
));
2912 tmp
-=sizeof(tlv_ptp_adj
->extd_local_circuit_id
);
2914 if(tmp
>=SYSTEM_ID_LEN
) {
2915 ND_TCHECK_LEN(tlv_ptp_adj
->neighbor_sysid
, SYSTEM_ID_LEN
);
2916 ND_PRINT("\n\t Neighbor System-ID: %s",
2917 isis_print_id(tlv_ptp_adj
->neighbor_sysid
, SYSTEM_ID_LEN
));
2920 if(tmp
>=sizeof(tlv_ptp_adj
->neighbor_extd_local_circuit_id
)) {
2921 ND_TCHECK_4(tlv_ptp_adj
->neighbor_extd_local_circuit_id
);
2922 ND_PRINT("\n\t Neighbor Extended Local circuit-ID: 0x%08x",
2923 EXTRACT_BE_U_4(tlv_ptp_adj
->neighbor_extd_local_circuit_id
));
2927 case ISIS_TLV_PROTOCOLS
:
2928 ND_PRINT("\n\t NLPID(s): ");
2931 ND_PRINT("%s (0x%02x)",
2932 tok2str(nlpid_values
,
2936 if (tmp
>1) /* further NPLIDs ? - put comma */
2943 case ISIS_TLV_MT_PORT_CAP
:
2947 ND_PRINT("\n\t RES: %u, MTID(s): %u",
2948 (EXTRACT_BE_U_2(tptr
) >> 12),
2949 (EXTRACT_BE_U_2(tptr
) & 0x0fff));
2955 isis_print_mt_port_cap_subtlv(ndo
, tptr
, tmp
);
2960 case ISIS_TLV_MT_CAPABILITY
:
2964 ND_PRINT("\n\t O: %u, RES: %u, MTID(s): %u",
2965 (EXTRACT_BE_U_2(tptr
) >> 15) & 0x01,
2966 (EXTRACT_BE_U_2(tptr
) >> 12) & 0x07,
2967 EXTRACT_BE_U_2(tptr
) & 0x0fff);
2973 isis_print_mt_capability_subtlv(ndo
, tptr
, tmp
);
2977 case ISIS_TLV_TE_ROUTER_ID
:
2978 ND_TCHECK_LEN(pptr
, sizeof(nd_ipv4
));
2979 ND_PRINT("\n\t Traffic Engineering Router ID: %s", ipaddr_string(ndo
, pptr
));
2982 case ISIS_TLV_IPADDR
:
2983 while (tmp
>=sizeof(nd_ipv4
)) {
2984 ND_TCHECK_LEN(tptr
, sizeof(nd_ipv4
));
2985 ND_PRINT("\n\t IPv4 interface address: %s", ipaddr_string(ndo
, tptr
));
2986 tptr
+= sizeof(nd_ipv4
);
2987 tmp
-= sizeof(nd_ipv4
);
2991 case ISIS_TLV_HOSTNAME
:
2992 ND_PRINT("\n\t Hostname: ");
2993 if (nd_printzp(ndo
, tptr
, tmp
, ndo
->ndo_snapend
))
2997 case ISIS_TLV_SHARED_RISK_GROUP
:
2998 if (tmp
< NODE_ID_LEN
)
3000 ND_TCHECK_LEN(tptr
, NODE_ID_LEN
);
3001 ND_PRINT("\n\t IS Neighbor: %s", isis_print_id(tptr
, NODE_ID_LEN
));
3008 ND_PRINT(", Flags: [%s]", ISIS_MASK_TLV_SHARED_RISK_GROUP(EXTRACT_U_1(tptr
)) ? "numbered" : "unnumbered");
3012 if (tmp
< sizeof(nd_ipv4
))
3014 ND_TCHECK_LEN(tptr
, sizeof(nd_ipv4
));
3015 ND_PRINT("\n\t IPv4 interface address: %s", ipaddr_string(ndo
, tptr
));
3016 tptr
+=sizeof(nd_ipv4
);
3017 tmp
-=sizeof(nd_ipv4
);
3019 if (tmp
< sizeof(nd_ipv4
))
3021 ND_TCHECK_LEN(tptr
, sizeof(nd_ipv4
));
3022 ND_PRINT("\n\t IPv4 neighbor address: %s", ipaddr_string(ndo
, tptr
));
3023 tptr
+=sizeof(nd_ipv4
);
3024 tmp
-=sizeof(nd_ipv4
);
3028 ND_PRINT("\n\t Link-ID: 0x%08x", EXTRACT_BE_U_4(tptr
));
3035 tlv_lsp
= (const struct isis_tlv_lsp
*)tptr
;
3036 while(tmp
>=sizeof(struct isis_tlv_lsp
)) {
3037 ND_TCHECK_1(tlv_lsp
->lsp_id
+ LSP_ID_LEN
- 1);
3038 ND_PRINT("\n\t lsp-id: %s",
3039 isis_print_id(tlv_lsp
->lsp_id
, LSP_ID_LEN
));
3040 ND_TCHECK_4(tlv_lsp
->sequence_number
);
3041 ND_PRINT(", seq: 0x%08x", EXTRACT_BE_U_4(tlv_lsp
->sequence_number
));
3042 ND_TCHECK_2(tlv_lsp
->remaining_lifetime
);
3043 ND_PRINT(", lifetime: %5ds", EXTRACT_BE_U_2(tlv_lsp
->remaining_lifetime
));
3044 ND_TCHECK_2(tlv_lsp
->checksum
);
3045 ND_PRINT(", chksum: 0x%04x", EXTRACT_BE_U_2(tlv_lsp
->checksum
));
3046 tmp
-=sizeof(struct isis_tlv_lsp
);
3051 case ISIS_TLV_CHECKSUM
:
3052 if (tmp
< ISIS_TLV_CHECKSUM_MINLEN
)
3054 ND_TCHECK_LEN(tptr
, ISIS_TLV_CHECKSUM_MINLEN
);
3055 ND_PRINT("\n\t checksum: 0x%04x ", EXTRACT_BE_U_2(tptr
));
3056 /* do not attempt to verify the checksum if it is zero
3057 * most likely a HMAC-MD5 TLV is also present and
3058 * to avoid conflicts the checksum TLV is zeroed.
3059 * see rfc3358 for details
3061 osi_print_cksum(ndo
, optr
, EXTRACT_BE_U_2(tptr
), (int)(tptr
-optr
),
3066 if (tlv_len
>= SYSTEM_ID_LEN
+ 1) {
3067 ND_TCHECK_LEN(tptr
, SYSTEM_ID_LEN
+ 1);
3068 ND_PRINT("\n\t Purge Originator System-ID: %s",
3069 isis_print_id(tptr
+ 1, SYSTEM_ID_LEN
));
3072 if (tlv_len
== 2 * SYSTEM_ID_LEN
+ 1) {
3073 ND_TCHECK_LEN(tptr
, 2 * SYSTEM_ID_LEN
+ 1);
3074 ND_PRINT("\n\t Received from System-ID: %s",
3075 isis_print_id(tptr
+ SYSTEM_ID_LEN
+ 1, SYSTEM_ID_LEN
));
3079 case ISIS_TLV_MT_SUPPORTED
:
3080 if (tmp
< ISIS_TLV_MT_SUPPORTED_MINLEN
)
3083 /* length can only be a multiple of 2, otherwise there is
3084 something broken -> so decode down until length is 1 */
3086 mt_len
= isis_print_mtid(ndo
, tptr
, "\n\t ");
3087 if (mt_len
== 0) /* did something go wrong ? */
3092 ND_PRINT("\n\t invalid MT-ID");
3098 case ISIS_TLV_RESTART_SIGNALING
:
3099 /* first attempt to decode the flags */
3100 if (tmp
< ISIS_TLV_RESTART_SIGNALING_FLAGLEN
)
3102 ND_TCHECK_LEN(tptr
, ISIS_TLV_RESTART_SIGNALING_FLAGLEN
);
3103 ND_PRINT("\n\t Flags [%s]",
3104 bittok2str(isis_restart_flag_values
, "none", EXTRACT_U_1(tptr
)));
3105 tptr
+=ISIS_TLV_RESTART_SIGNALING_FLAGLEN
;
3106 tmp
-=ISIS_TLV_RESTART_SIGNALING_FLAGLEN
;
3108 /* is there anything other than the flags field? */
3112 if (tmp
< ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN
)
3114 ND_TCHECK_LEN(tptr
, ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN
);
3116 ND_PRINT(", Remaining holding time %us", EXTRACT_BE_U_2(tptr
));
3117 tptr
+=ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN
;
3118 tmp
-=ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN
;
3120 /* is there an additional sysid field present ?*/
3121 if (tmp
== SYSTEM_ID_LEN
) {
3122 ND_TCHECK_LEN(tptr
, SYSTEM_ID_LEN
);
3123 ND_PRINT(", for %s", isis_print_id(tptr
,SYSTEM_ID_LEN
));
3127 case ISIS_TLV_IDRP_INFO
:
3128 if (tmp
< ISIS_TLV_IDRP_INFO_MINLEN
)
3130 ND_TCHECK_LEN(tptr
, ISIS_TLV_IDRP_INFO_MINLEN
);
3131 ND_PRINT("\n\t Inter-Domain Information Type: %s",
3132 tok2str(isis_subtlv_idrp_values
,
3134 EXTRACT_U_1(tptr
)));
3135 isis_subtlv_idrp
= EXTRACT_U_1(tptr
);
3137 switch (isis_subtlv_idrp
) {
3138 case ISIS_SUBTLV_IDRP_ASN
:
3139 ND_TCHECK_2(tptr
); /* fetch AS number */
3140 ND_PRINT("AS Number: %u", EXTRACT_BE_U_2(tptr
));
3142 case ISIS_SUBTLV_IDRP_LOCAL
:
3143 case ISIS_SUBTLV_IDRP_RES
:
3145 if (!print_unknown_data(ndo
, tptr
, "\n\t ", tlv_len
- 1))
3151 case ISIS_TLV_LSP_BUFFERSIZE
:
3152 if (tmp
< ISIS_TLV_LSP_BUFFERSIZE_MINLEN
)
3154 ND_TCHECK_LEN(tptr
, ISIS_TLV_LSP_BUFFERSIZE_MINLEN
);
3155 ND_PRINT("\n\t LSP Buffersize: %u", EXTRACT_BE_U_2(tptr
));
3158 case ISIS_TLV_PART_DIS
:
3159 while (tmp
>= SYSTEM_ID_LEN
) {
3160 ND_TCHECK_LEN(tptr
, SYSTEM_ID_LEN
);
3161 ND_PRINT("\n\t %s", isis_print_id(tptr
, SYSTEM_ID_LEN
));
3162 tptr
+=SYSTEM_ID_LEN
;
3167 case ISIS_TLV_PREFIX_NEIGH
:
3168 if (tmp
< sizeof(struct isis_metric_block
))
3170 ND_TCHECK_LEN(tptr
, sizeof(struct isis_metric_block
));
3171 ND_PRINT("\n\t Metric Block");
3172 isis_print_metric_block(ndo
, (const struct isis_metric_block
*)tptr
);
3173 tptr
+=sizeof(struct isis_metric_block
);
3174 tmp
-=sizeof(struct isis_metric_block
);
3178 prefix_len
=EXTRACT_U_1(tptr
); /* read out prefix length in semioctets*/
3180 if (prefix_len
< 2) {
3181 ND_PRINT("\n\t\tAddress: prefix length %u < 2", prefix_len
);
3185 if (tmp
< prefix_len
/2)
3187 ND_TCHECK_LEN(tptr
, prefix_len
/ 2);
3188 ND_PRINT("\n\t\tAddress: %s/%u",
3189 isonsap_string(ndo
, tptr
, prefix_len
/ 2), prefix_len
* 4);
3195 case ISIS_TLV_IIH_SEQNR
:
3196 if (tmp
< ISIS_TLV_IIH_SEQNR_MINLEN
)
3198 ND_TCHECK_LEN(tptr
, ISIS_TLV_IIH_SEQNR_MINLEN
); /* check if four bytes are on the wire */
3199 ND_PRINT("\n\t Sequence number: %u", EXTRACT_BE_U_4(tptr
));
3202 case ISIS_TLV_VENDOR_PRIVATE
:
3203 if (tmp
< ISIS_TLV_VENDOR_PRIVATE_MINLEN
)
3205 ND_TCHECK_LEN(tptr
, ISIS_TLV_VENDOR_PRIVATE_MINLEN
); /* check if enough byte for a full oui */
3206 vendor_id
= EXTRACT_BE_U_3(tptr
);
3207 ND_PRINT("\n\t Vendor: %s (%u)",
3208 tok2str(oui_values
, "Unknown", vendor_id
),
3212 if (tmp
> 0) /* hexdump the rest */
3213 if (!print_unknown_data(ndo
, tptr
, "\n\t\t", tmp
))
3217 * FIXME those are the defined TLVs that lack a decoder
3218 * you are welcome to contribute code ;-)
3221 case ISIS_TLV_DECNET_PHASE4
:
3222 case ISIS_TLV_LUCENT_PRIVATE
:
3223 case ISIS_TLV_IPAUTH
:
3224 case ISIS_TLV_NORTEL_PRIVATE1
:
3225 case ISIS_TLV_NORTEL_PRIVATE2
:
3228 if (ndo
->ndo_vflag
<= 1) {
3229 if (!print_unknown_data(ndo
, pptr
, "\n\t\t", tlv_len
))
3234 /* do we want to see an additionally hexdump ? */
3235 if (ndo
->ndo_vflag
> 1) {
3236 if (!print_unknown_data(ndo
, pptr
, "\n\t ", tlv_len
))
3241 packet_len
-= tlv_len
;
3244 if (packet_len
!= 0) {
3245 ND_PRINT("\n\t %u straggler bytes", packet_len
);
3250 nd_print_trunc(ndo
);
3255 osi_print_cksum(netdissect_options
*ndo
, const uint8_t *pptr
,
3256 uint16_t checksum
, int checksum_offset
, u_int length
)
3258 uint16_t calculated_checksum
;
3260 /* do not attempt to verify the checksum if it is zero,
3261 * if the offset is nonsense,
3262 * or the base pointer is not sane
3265 || checksum_offset
< 0
3266 || !ND_TTEST_2(pptr
+ checksum_offset
)
3267 || (u_int
)checksum_offset
> length
3268 || !ND_TTEST_LEN(pptr
, length
)) {
3269 ND_PRINT(" (unverified)");
3272 printf("\nosi_print_cksum: %p %d %u\n", pptr
, checksum_offset
, length
);
3274 calculated_checksum
= create_osi_cksum(pptr
, checksum_offset
, length
);
3275 if (checksum
== calculated_checksum
) {
3276 ND_PRINT(" (correct)");
3278 ND_PRINT(" (incorrect should be 0x%04x)", calculated_checksum
);