2 * Copyright (c) 1992, 1993, 1994, 1995, 1996
3 * The Regents of the University of California. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that: (1) source code distributions
7 * retain the above copyright notice and this paragraph in its entirety, (2)
8 * distributions including binary code include the above copyright notice and
9 * this paragraph in its entirety in the documentation or other materials
10 * provided with the distribution, and (3) all advertising materials mentioning
11 * features or use of this software display the following acknowledgement:
12 * ``This product includes software developed by the University of California,
13 * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
14 * the University nor the names of its contributors may be used to endorse
15 * or promote products derived from this software without specific prior
17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21 * Original code by Matt Thomas, Digital Equipment Corporation
23 * Extensively modified by Hannes Gredler (hannes@juniper.net) for more
24 * complete IS-IS & CLNP support.
31 #include <tcpdump-stdinc.h>
35 #include "interface.h"
36 #include "addrtoname.h"
42 #include "signature.h"
45 * IS-IS is defined in ISO 10589. Look there for protocol definitions.
48 #define SYSTEM_ID_LEN ETHER_ADDR_LEN
49 #define NODE_ID_LEN SYSTEM_ID_LEN+1
50 #define LSP_ID_LEN SYSTEM_ID_LEN+2
52 #define ISIS_VERSION 1
53 #define ESIS_VERSION 1
54 #define CLNP_VERSION 1
56 #define ISIS_PDU_TYPE_MASK 0x1F
57 #define ESIS_PDU_TYPE_MASK 0x1F
58 #define CLNP_PDU_TYPE_MASK 0x1F
59 #define CLNP_FLAG_MASK 0xE0
60 #define ISIS_LAN_PRIORITY_MASK 0x7F
62 #define ISIS_PDU_L1_LAN_IIH 15
63 #define ISIS_PDU_L2_LAN_IIH 16
64 #define ISIS_PDU_PTP_IIH 17
65 #define ISIS_PDU_L1_LSP 18
66 #define ISIS_PDU_L2_LSP 20
67 #define ISIS_PDU_L1_CSNP 24
68 #define ISIS_PDU_L2_CSNP 25
69 #define ISIS_PDU_L1_PSNP 26
70 #define ISIS_PDU_L2_PSNP 27
72 static const struct tok isis_pdu_values
[] = {
73 { ISIS_PDU_L1_LAN_IIH
, "L1 Lan IIH"},
74 { ISIS_PDU_L2_LAN_IIH
, "L2 Lan IIH"},
75 { ISIS_PDU_PTP_IIH
, "p2p IIH"},
76 { ISIS_PDU_L1_LSP
, "L1 LSP"},
77 { ISIS_PDU_L2_LSP
, "L2 LSP"},
78 { ISIS_PDU_L1_CSNP
, "L1 CSNP"},
79 { ISIS_PDU_L2_CSNP
, "L2 CSNP"},
80 { ISIS_PDU_L1_PSNP
, "L1 PSNP"},
81 { ISIS_PDU_L2_PSNP
, "L2 PSNP"},
86 * A TLV is a tuple of a type, length and a value and is normally used for
87 * encoding information in all sorts of places. This is an enumeration of
88 * the well known types.
90 * list taken from rfc3359 plus some memory from veterans ;-)
93 #define ISIS_TLV_AREA_ADDR 1 /* iso10589 */
94 #define ISIS_TLV_IS_REACH 2 /* iso10589 */
95 #define ISIS_TLV_ESNEIGH 3 /* iso10589 */
96 #define ISIS_TLV_PART_DIS 4 /* iso10589 */
97 #define ISIS_TLV_PREFIX_NEIGH 5 /* iso10589 */
98 #define ISIS_TLV_ISNEIGH 6 /* iso10589 */
99 #define ISIS_TLV_ISNEIGH_VARLEN 7 /* iso10589 */
100 #define ISIS_TLV_PADDING 8 /* iso10589 */
101 #define ISIS_TLV_LSP 9 /* iso10589 */
102 #define ISIS_TLV_AUTH 10 /* iso10589, rfc3567 */
103 #define ISIS_TLV_CHECKSUM 12 /* rfc3358 */
104 #define ISIS_TLV_CHECKSUM_MINLEN 2
105 #define ISIS_TLV_POI 13 /* rfc6232 */
106 #define ISIS_TLV_LSP_BUFFERSIZE 14 /* iso10589 rev2 */
107 #define ISIS_TLV_LSP_BUFFERSIZE_MINLEN 2
108 #define ISIS_TLV_EXT_IS_REACH 22 /* draft-ietf-isis-traffic-05 */
109 #define ISIS_TLV_IS_ALIAS_ID 24 /* draft-ietf-isis-ext-lsp-frags-02 */
110 #define ISIS_TLV_DECNET_PHASE4 42
111 #define ISIS_TLV_LUCENT_PRIVATE 66
112 #define ISIS_TLV_INT_IP_REACH 128 /* rfc1195, rfc2966 */
113 #define ISIS_TLV_PROTOCOLS 129 /* rfc1195 */
114 #define ISIS_TLV_EXT_IP_REACH 130 /* rfc1195, rfc2966 */
115 #define ISIS_TLV_IDRP_INFO 131 /* rfc1195 */
116 #define ISIS_TLV_IDRP_INFO_MINLEN 1
117 #define ISIS_TLV_IPADDR 132 /* rfc1195 */
118 #define ISIS_TLV_IPAUTH 133 /* rfc1195 */
119 #define ISIS_TLV_TE_ROUTER_ID 134 /* draft-ietf-isis-traffic-05 */
120 #define ISIS_TLV_EXTD_IP_REACH 135 /* draft-ietf-isis-traffic-05 */
121 #define ISIS_TLV_HOSTNAME 137 /* rfc2763 */
122 #define ISIS_TLV_SHARED_RISK_GROUP 138 /* draft-ietf-isis-gmpls-extensions */
123 #define ISIS_TLV_MT_PORT_CAP 143 /* rfc6165 */
124 #define ISIS_TLV_MT_CAPABILITY 144 /* rfc6329 */
125 #define ISIS_TLV_NORTEL_PRIVATE1 176
126 #define ISIS_TLV_NORTEL_PRIVATE2 177
127 #define ISIS_TLV_RESTART_SIGNALING 211 /* rfc3847 */
128 #define ISIS_TLV_RESTART_SIGNALING_FLAGLEN 1
129 #define ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN 2
130 #define ISIS_TLV_MT_IS_REACH 222 /* draft-ietf-isis-wg-multi-topology-05 */
131 #define ISIS_TLV_MT_SUPPORTED 229 /* draft-ietf-isis-wg-multi-topology-05 */
132 #define ISIS_TLV_MT_SUPPORTED_MINLEN 2
133 #define ISIS_TLV_IP6ADDR 232 /* draft-ietf-isis-ipv6-02 */
134 #define ISIS_TLV_MT_IP_REACH 235 /* draft-ietf-isis-wg-multi-topology-05 */
135 #define ISIS_TLV_IP6_REACH 236 /* draft-ietf-isis-ipv6-02 */
136 #define ISIS_TLV_MT_IP6_REACH 237 /* draft-ietf-isis-wg-multi-topology-05 */
137 #define ISIS_TLV_PTP_ADJ 240 /* rfc3373 */
138 #define ISIS_TLV_IIH_SEQNR 241 /* draft-shen-isis-iih-sequence-00 */
139 #define ISIS_TLV_IIH_SEQNR_MINLEN 4
140 #define ISIS_TLV_VENDOR_PRIVATE 250 /* draft-ietf-isis-experimental-tlv-01 */
141 #define ISIS_TLV_VENDOR_PRIVATE_MINLEN 3
143 static const struct tok isis_tlv_values
[] = {
144 { ISIS_TLV_AREA_ADDR
, "Area address(es)"},
145 { ISIS_TLV_IS_REACH
, "IS Reachability"},
146 { ISIS_TLV_ESNEIGH
, "ES Neighbor(s)"},
147 { ISIS_TLV_PART_DIS
, "Partition DIS"},
148 { ISIS_TLV_PREFIX_NEIGH
, "Prefix Neighbors"},
149 { ISIS_TLV_ISNEIGH
, "IS Neighbor(s)"},
150 { ISIS_TLV_ISNEIGH_VARLEN
, "IS Neighbor(s) (variable length)"},
151 { ISIS_TLV_PADDING
, "Padding"},
152 { ISIS_TLV_LSP
, "LSP entries"},
153 { ISIS_TLV_AUTH
, "Authentication"},
154 { ISIS_TLV_CHECKSUM
, "Checksum"},
155 { ISIS_TLV_POI
, "Purge Originator Identifier"},
156 { ISIS_TLV_LSP_BUFFERSIZE
, "LSP Buffersize"},
157 { ISIS_TLV_EXT_IS_REACH
, "Extended IS Reachability"},
158 { ISIS_TLV_IS_ALIAS_ID
, "IS Alias ID"},
159 { ISIS_TLV_DECNET_PHASE4
, "DECnet Phase IV"},
160 { ISIS_TLV_LUCENT_PRIVATE
, "Lucent Proprietary"},
161 { ISIS_TLV_INT_IP_REACH
, "IPv4 Internal Reachability"},
162 { ISIS_TLV_PROTOCOLS
, "Protocols supported"},
163 { ISIS_TLV_EXT_IP_REACH
, "IPv4 External Reachability"},
164 { ISIS_TLV_IDRP_INFO
, "Inter-Domain Information Type"},
165 { ISIS_TLV_IPADDR
, "IPv4 Interface address(es)"},
166 { ISIS_TLV_IPAUTH
, "IPv4 authentication (deprecated)"},
167 { ISIS_TLV_TE_ROUTER_ID
, "Traffic Engineering Router ID"},
168 { ISIS_TLV_EXTD_IP_REACH
, "Extended IPv4 Reachability"},
169 { ISIS_TLV_SHARED_RISK_GROUP
, "Shared Risk Link Group"},
170 { ISIS_TLV_MT_PORT_CAP
, "Multi-Topology-Aware Port Capability"},
171 { ISIS_TLV_MT_CAPABILITY
, "Multi-Topology Capability"},
172 { ISIS_TLV_NORTEL_PRIVATE1
, "Nortel Proprietary"},
173 { ISIS_TLV_NORTEL_PRIVATE2
, "Nortel Proprietary"},
174 { ISIS_TLV_HOSTNAME
, "Hostname"},
175 { ISIS_TLV_RESTART_SIGNALING
, "Restart Signaling"},
176 { ISIS_TLV_MT_IS_REACH
, "Multi Topology IS Reachability"},
177 { ISIS_TLV_MT_SUPPORTED
, "Multi Topology"},
178 { ISIS_TLV_IP6ADDR
, "IPv6 Interface address(es)"},
179 { ISIS_TLV_MT_IP_REACH
, "Multi-Topology IPv4 Reachability"},
180 { ISIS_TLV_IP6_REACH
, "IPv6 reachability"},
181 { ISIS_TLV_MT_IP6_REACH
, "Multi-Topology IP6 Reachability"},
182 { ISIS_TLV_PTP_ADJ
, "Point-to-point Adjacency State"},
183 { ISIS_TLV_IIH_SEQNR
, "Hello PDU Sequence Number"},
184 { ISIS_TLV_VENDOR_PRIVATE
, "Vendor Private"},
188 #define ESIS_OPTION_PROTOCOLS 129
189 #define ESIS_OPTION_QOS_MAINTENANCE 195 /* iso9542 */
190 #define ESIS_OPTION_SECURITY 197 /* iso9542 */
191 #define ESIS_OPTION_ES_CONF_TIME 198 /* iso9542 */
192 #define ESIS_OPTION_PRIORITY 205 /* iso9542 */
193 #define ESIS_OPTION_ADDRESS_MASK 225 /* iso9542 */
194 #define ESIS_OPTION_SNPA_MASK 226 /* iso9542 */
196 static const struct tok esis_option_values
[] = {
197 { ESIS_OPTION_PROTOCOLS
, "Protocols supported"},
198 { ESIS_OPTION_QOS_MAINTENANCE
, "QoS Maintenance" },
199 { ESIS_OPTION_SECURITY
, "Security" },
200 { ESIS_OPTION_ES_CONF_TIME
, "ES Configuration Time" },
201 { ESIS_OPTION_PRIORITY
, "Priority" },
202 { ESIS_OPTION_ADDRESS_MASK
, "Addressk Mask" },
203 { ESIS_OPTION_SNPA_MASK
, "SNPA Mask" },
207 #define CLNP_OPTION_DISCARD_REASON 193
208 #define CLNP_OPTION_QOS_MAINTENANCE 195 /* iso8473 */
209 #define CLNP_OPTION_SECURITY 197 /* iso8473 */
210 #define CLNP_OPTION_SOURCE_ROUTING 200 /* iso8473 */
211 #define CLNP_OPTION_ROUTE_RECORDING 203 /* iso8473 */
212 #define CLNP_OPTION_PADDING 204 /* iso8473 */
213 #define CLNP_OPTION_PRIORITY 205 /* iso8473 */
215 static const struct tok clnp_option_values
[] = {
216 { CLNP_OPTION_DISCARD_REASON
, "Discard Reason"},
217 { CLNP_OPTION_PRIORITY
, "Priority"},
218 { CLNP_OPTION_QOS_MAINTENANCE
, "QoS Maintenance"},
219 { CLNP_OPTION_SECURITY
, "Security"},
220 { CLNP_OPTION_SOURCE_ROUTING
, "Source Routing"},
221 { CLNP_OPTION_ROUTE_RECORDING
, "Route Recording"},
222 { CLNP_OPTION_PADDING
, "Padding"},
226 static const struct tok clnp_option_rfd_class_values
[] = {
229 { 0x9, "Source Routeing"},
231 { 0xb, "PDU Discarded"},
232 { 0xc, "Reassembly"},
236 static const struct tok clnp_option_rfd_general_values
[] = {
237 { 0x0, "Reason not specified"},
238 { 0x1, "Protocol procedure error"},
239 { 0x2, "Incorrect checksum"},
240 { 0x3, "PDU discarded due to congestion"},
241 { 0x4, "Header syntax error (cannot be parsed)"},
242 { 0x5, "Segmentation needed but not permitted"},
243 { 0x6, "Incomplete PDU received"},
244 { 0x7, "Duplicate option"},
248 static const struct tok clnp_option_rfd_address_values
[] = {
249 { 0x0, "Destination address unreachable"},
250 { 0x1, "Destination address unknown"},
254 static const struct tok clnp_option_rfd_source_routeing_values
[] = {
255 { 0x0, "Unspecified source routeing error"},
256 { 0x1, "Syntax error in source routeing field"},
257 { 0x2, "Unknown address in source routeing field"},
258 { 0x3, "Path not acceptable"},
262 static const struct tok clnp_option_rfd_lifetime_values
[] = {
263 { 0x0, "Lifetime expired while data unit in transit"},
264 { 0x1, "Lifetime expired during reassembly"},
268 static const struct tok clnp_option_rfd_pdu_discard_values
[] = {
269 { 0x0, "Unsupported option not specified"},
270 { 0x1, "Unsupported protocol version"},
271 { 0x2, "Unsupported security option"},
272 { 0x3, "Unsupported source routeing option"},
273 { 0x4, "Unsupported recording of route option"},
277 static const struct tok clnp_option_rfd_reassembly_values
[] = {
278 { 0x0, "Reassembly interference"},
282 /* array of 16 error-classes */
283 static const struct tok
*clnp_option_rfd_error_class
[] = {
284 clnp_option_rfd_general_values
,
292 clnp_option_rfd_address_values
,
293 clnp_option_rfd_source_routeing_values
,
294 clnp_option_rfd_lifetime_values
,
295 clnp_option_rfd_pdu_discard_values
,
296 clnp_option_rfd_reassembly_values
,
302 #define CLNP_OPTION_OPTION_QOS_MASK 0x3f
303 #define CLNP_OPTION_SCOPE_MASK 0xc0
304 #define CLNP_OPTION_SCOPE_SA_SPEC 0x40
305 #define CLNP_OPTION_SCOPE_DA_SPEC 0x80
306 #define CLNP_OPTION_SCOPE_GLOBAL 0xc0
308 static const struct tok clnp_option_scope_values
[] = {
309 { CLNP_OPTION_SCOPE_SA_SPEC
, "Source Address Specific"},
310 { CLNP_OPTION_SCOPE_DA_SPEC
, "Destination Address Specific"},
311 { CLNP_OPTION_SCOPE_GLOBAL
, "Globally unique"},
315 static const struct tok clnp_option_sr_rr_values
[] = {
321 static const struct tok clnp_option_sr_rr_string_values
[] = {
322 { CLNP_OPTION_SOURCE_ROUTING
, "source routing"},
323 { CLNP_OPTION_ROUTE_RECORDING
, "recording of route in progress"},
327 static const struct tok clnp_option_qos_global_values
[] = {
329 { 0x10, "sequencing vs. delay"},
330 { 0x08, "congested"},
331 { 0x04, "delay vs. cost"},
332 { 0x02, "error vs. delay"},
333 { 0x01, "error vs. cost"},
337 #define ISIS_SUBTLV_EXT_IS_REACH_ADMIN_GROUP 3 /* draft-ietf-isis-traffic-05 */
338 #define ISIS_SUBTLV_EXT_IS_REACH_LINK_LOCAL_REMOTE_ID 4 /* rfc4205 */
339 #define ISIS_SUBTLV_EXT_IS_REACH_LINK_REMOTE_ID 5 /* draft-ietf-isis-traffic-05 */
340 #define ISIS_SUBTLV_EXT_IS_REACH_IPV4_INTF_ADDR 6 /* draft-ietf-isis-traffic-05 */
341 #define ISIS_SUBTLV_EXT_IS_REACH_IPV4_NEIGHBOR_ADDR 8 /* draft-ietf-isis-traffic-05 */
342 #define ISIS_SUBTLV_EXT_IS_REACH_MAX_LINK_BW 9 /* draft-ietf-isis-traffic-05 */
343 #define ISIS_SUBTLV_EXT_IS_REACH_RESERVABLE_BW 10 /* draft-ietf-isis-traffic-05 */
344 #define ISIS_SUBTLV_EXT_IS_REACH_UNRESERVED_BW 11 /* rfc4124 */
345 #define ISIS_SUBTLV_EXT_IS_REACH_BW_CONSTRAINTS_OLD 12 /* draft-ietf-tewg-diff-te-proto-06 */
346 #define ISIS_SUBTLV_EXT_IS_REACH_TE_METRIC 18 /* draft-ietf-isis-traffic-05 */
347 #define ISIS_SUBTLV_EXT_IS_REACH_LINK_ATTRIBUTE 19 /* draft-ietf-isis-link-attr-01 */
348 #define ISIS_SUBTLV_EXT_IS_REACH_LINK_PROTECTION_TYPE 20 /* rfc4205 */
349 #define ISIS_SUBTLV_EXT_IS_REACH_INTF_SW_CAP_DESCR 21 /* rfc4205 */
350 #define ISIS_SUBTLV_EXT_IS_REACH_BW_CONSTRAINTS 22 /* rfc4124 */
352 #define ISIS_SUBTLV_SPB_METRIC 29 /* rfc6329 */
354 static const struct tok isis_ext_is_reach_subtlv_values
[] = {
355 { ISIS_SUBTLV_EXT_IS_REACH_ADMIN_GROUP
, "Administrative groups" },
356 { ISIS_SUBTLV_EXT_IS_REACH_LINK_LOCAL_REMOTE_ID
, "Link Local/Remote Identifier" },
357 { ISIS_SUBTLV_EXT_IS_REACH_LINK_REMOTE_ID
, "Link Remote Identifier" },
358 { ISIS_SUBTLV_EXT_IS_REACH_IPV4_INTF_ADDR
, "IPv4 interface address" },
359 { ISIS_SUBTLV_EXT_IS_REACH_IPV4_NEIGHBOR_ADDR
, "IPv4 neighbor address" },
360 { ISIS_SUBTLV_EXT_IS_REACH_MAX_LINK_BW
, "Maximum link bandwidth" },
361 { ISIS_SUBTLV_EXT_IS_REACH_RESERVABLE_BW
, "Reservable link bandwidth" },
362 { ISIS_SUBTLV_EXT_IS_REACH_UNRESERVED_BW
, "Unreserved bandwidth" },
363 { ISIS_SUBTLV_EXT_IS_REACH_TE_METRIC
, "Traffic Engineering Metric" },
364 { ISIS_SUBTLV_EXT_IS_REACH_LINK_ATTRIBUTE
, "Link Attribute" },
365 { ISIS_SUBTLV_EXT_IS_REACH_LINK_PROTECTION_TYPE
, "Link Protection Type" },
366 { ISIS_SUBTLV_EXT_IS_REACH_INTF_SW_CAP_DESCR
, "Interface Switching Capability" },
367 { ISIS_SUBTLV_EXT_IS_REACH_BW_CONSTRAINTS_OLD
, "Bandwidth Constraints (old)" },
368 { ISIS_SUBTLV_EXT_IS_REACH_BW_CONSTRAINTS
, "Bandwidth Constraints" },
369 { ISIS_SUBTLV_SPB_METRIC
, "SPB Metric" },
370 { 250, "Reserved for cisco specific extensions" },
371 { 251, "Reserved for cisco specific extensions" },
372 { 252, "Reserved for cisco specific extensions" },
373 { 253, "Reserved for cisco specific extensions" },
374 { 254, "Reserved for cisco specific extensions" },
375 { 255, "Reserved for future expansion" },
379 #define ISIS_SUBTLV_EXTD_IP_REACH_ADMIN_TAG32 1 /* draft-ietf-isis-admin-tags-01 */
380 #define ISIS_SUBTLV_EXTD_IP_REACH_ADMIN_TAG64 2 /* draft-ietf-isis-admin-tags-01 */
381 #define ISIS_SUBTLV_EXTD_IP_REACH_MGMT_PREFIX_COLOR 117 /* draft-ietf-isis-wg-multi-topology-05 */
383 static const struct tok isis_ext_ip_reach_subtlv_values
[] = {
384 { ISIS_SUBTLV_EXTD_IP_REACH_ADMIN_TAG32
, "32-Bit Administrative tag" },
385 { ISIS_SUBTLV_EXTD_IP_REACH_ADMIN_TAG64
, "64-Bit Administrative tag" },
386 { ISIS_SUBTLV_EXTD_IP_REACH_MGMT_PREFIX_COLOR
, "Management Prefix Color" },
390 static const struct tok isis_subtlv_link_attribute_values
[] = {
391 { 0x01, "Local Protection Available" },
392 { 0x02, "Link excluded from local protection path" },
393 { 0x04, "Local maintenance required"},
397 #define ISIS_SUBTLV_AUTH_SIMPLE 1
398 #define ISIS_SUBTLV_AUTH_GENERIC 3 /* rfc 5310 */
399 #define ISIS_SUBTLV_AUTH_MD5 54
400 #define ISIS_SUBTLV_AUTH_MD5_LEN 16
401 #define ISIS_SUBTLV_AUTH_PRIVATE 255
403 static const struct tok isis_subtlv_auth_values
[] = {
404 { ISIS_SUBTLV_AUTH_SIMPLE
, "simple text password"},
405 { ISIS_SUBTLV_AUTH_GENERIC
, "Generic Crypto key-id"},
406 { ISIS_SUBTLV_AUTH_MD5
, "HMAC-MD5 password"},
407 { ISIS_SUBTLV_AUTH_PRIVATE
, "Routing Domain private password"},
411 #define ISIS_SUBTLV_IDRP_RES 0
412 #define ISIS_SUBTLV_IDRP_LOCAL 1
413 #define ISIS_SUBTLV_IDRP_ASN 2
415 static const struct tok isis_subtlv_idrp_values
[] = {
416 { ISIS_SUBTLV_IDRP_RES
, "Reserved"},
417 { ISIS_SUBTLV_IDRP_LOCAL
, "Routing-Domain Specific"},
418 { ISIS_SUBTLV_IDRP_ASN
, "AS Number Tag"},
422 #define ISIS_SUBTLV_SPB_MCID 4
423 #define ISIS_SUBTLV_SPB_DIGEST 5
424 #define ISIS_SUBTLV_SPB_BVID 6
426 #define ISIS_SUBTLV_SPB_INSTANCE 1
427 #define ISIS_SUBTLV_SPBM_SI 3
429 #define ISIS_SPB_MCID_LEN 51
430 #define ISIS_SUBTLV_SPB_MCID_MIN_LEN 102
431 #define ISIS_SUBTLV_SPB_DIGEST_MIN_LEN 33
432 #define ISIS_SUBTLV_SPB_BVID_MIN_LEN 6
433 #define ISIS_SUBTLV_SPB_INSTANCE_MIN_LEN 19
434 #define ISIS_SUBTLV_SPB_INSTANCE_VLAN_TUPLE_LEN 8
436 static const struct tok isis_mt_port_cap_subtlv_values
[] = {
437 { ISIS_SUBTLV_SPB_MCID
, "SPB MCID" },
438 { ISIS_SUBTLV_SPB_DIGEST
, "SPB Digest" },
439 { ISIS_SUBTLV_SPB_BVID
, "SPB BVID" },
443 static const struct tok isis_mt_capability_subtlv_values
[] = {
444 { ISIS_SUBTLV_SPB_INSTANCE
, "SPB Instance" },
445 { ISIS_SUBTLV_SPBM_SI
, "SPBM Service Identifier and Unicast Address" },
449 struct isis_spb_mcid
{
452 uint8_t revision_lvl
[2];
456 struct isis_subtlv_spb_mcid
{
457 struct isis_spb_mcid mcid
;
458 struct isis_spb_mcid aux_mcid
;
461 struct isis_subtlv_spb_instance
{
462 uint8_t cist_root_id
[8];
463 uint8_t cist_external_root_path_cost
[4];
464 uint8_t bridge_priority
[2];
465 uint8_t spsourceid
[4];
469 #define CLNP_SEGMENT_PART 0x80
470 #define CLNP_MORE_SEGMENTS 0x40
471 #define CLNP_REQUEST_ER 0x20
473 static const struct tok clnp_flag_values
[] = {
474 { CLNP_SEGMENT_PART
, "Segmentation permitted"},
475 { CLNP_MORE_SEGMENTS
, "more Segments"},
476 { CLNP_REQUEST_ER
, "request Error Report"},
480 #define ISIS_MASK_LSP_OL_BIT(x) ((x)&0x4)
481 #define ISIS_MASK_LSP_ISTYPE_BITS(x) ((x)&0x3)
482 #define ISIS_MASK_LSP_PARTITION_BIT(x) ((x)&0x80)
483 #define ISIS_MASK_LSP_ATT_BITS(x) ((x)&0x78)
484 #define ISIS_MASK_LSP_ATT_ERROR_BIT(x) ((x)&0x40)
485 #define ISIS_MASK_LSP_ATT_EXPENSE_BIT(x) ((x)&0x20)
486 #define ISIS_MASK_LSP_ATT_DELAY_BIT(x) ((x)&0x10)
487 #define ISIS_MASK_LSP_ATT_DEFAULT_BIT(x) ((x)&0x8)
489 #define ISIS_MASK_MTID(x) ((x)&0x0fff)
490 #define ISIS_MASK_MTFLAGS(x) ((x)&0xf000)
492 static const struct tok isis_mt_flag_values
[] = {
493 { 0x4000, "ATT bit set"},
494 { 0x8000, "Overload bit set"},
498 #define ISIS_MASK_TLV_EXTD_IP_UPDOWN(x) ((x)&0x80)
499 #define ISIS_MASK_TLV_EXTD_IP_SUBTLV(x) ((x)&0x40)
501 #define ISIS_MASK_TLV_EXTD_IP6_IE(x) ((x)&0x40)
502 #define ISIS_MASK_TLV_EXTD_IP6_SUBTLV(x) ((x)&0x20)
504 #define ISIS_LSP_TLV_METRIC_SUPPORTED(x) ((x)&0x80)
505 #define ISIS_LSP_TLV_METRIC_IE(x) ((x)&0x40)
506 #define ISIS_LSP_TLV_METRIC_UPDOWN(x) ((x)&0x80)
507 #define ISIS_LSP_TLV_METRIC_VALUE(x) ((x)&0x3f)
509 #define ISIS_MASK_TLV_SHARED_RISK_GROUP(x) ((x)&0x1)
511 static const struct tok isis_mt_values
[] = {
512 { 0, "IPv4 unicast"},
513 { 1, "In-Band Management"},
514 { 2, "IPv6 unicast"},
516 { 4095, "Development, Experimental or Proprietary"},
520 static const struct tok isis_iih_circuit_type_values
[] = {
521 { 1, "Level 1 only"},
522 { 2, "Level 2 only"},
523 { 3, "Level 1, Level 2"},
527 #define ISIS_LSP_TYPE_UNUSED0 0
528 #define ISIS_LSP_TYPE_LEVEL_1 1
529 #define ISIS_LSP_TYPE_UNUSED2 2
530 #define ISIS_LSP_TYPE_LEVEL_2 3
532 static const struct tok isis_lsp_istype_values
[] = {
533 { ISIS_LSP_TYPE_UNUSED0
, "Unused 0x0 (invalid)"},
534 { ISIS_LSP_TYPE_LEVEL_1
, "L1 IS"},
535 { ISIS_LSP_TYPE_UNUSED2
, "Unused 0x2 (invalid)"},
536 { ISIS_LSP_TYPE_LEVEL_2
, "L2 IS"},
541 * Katz's point to point adjacency TLV uses codes to tell us the state of
542 * the remote adjacency. Enumerate them.
545 #define ISIS_PTP_ADJ_UP 0
546 #define ISIS_PTP_ADJ_INIT 1
547 #define ISIS_PTP_ADJ_DOWN 2
549 static const struct tok isis_ptp_adjancey_values
[] = {
550 { ISIS_PTP_ADJ_UP
, "Up" },
551 { ISIS_PTP_ADJ_INIT
, "Initializing" },
552 { ISIS_PTP_ADJ_DOWN
, "Down" },
556 struct isis_tlv_ptp_adj
{
557 uint8_t adjacency_state
;
558 uint8_t extd_local_circuit_id
[4];
559 uint8_t neighbor_sysid
[SYSTEM_ID_LEN
];
560 uint8_t neighbor_extd_local_circuit_id
[4];
563 static void osi_print_cksum(netdissect_options
*, const uint8_t *pptr
,
564 uint16_t checksum
, int checksum_offset
, int length
);
565 static int clnp_print(netdissect_options
*, const uint8_t *, u_int
);
566 static void esis_print(netdissect_options
*, const uint8_t *, u_int
);
567 static int isis_print(netdissect_options
*, const uint8_t *, u_int
);
569 struct isis_metric_block
{
570 uint8_t metric_default
;
571 uint8_t metric_delay
;
572 uint8_t metric_expense
;
573 uint8_t metric_error
;
576 struct isis_tlv_is_reach
{
577 struct isis_metric_block isis_metric_block
;
578 uint8_t neighbor_nodeid
[NODE_ID_LEN
];
581 struct isis_tlv_es_reach
{
582 struct isis_metric_block isis_metric_block
;
583 uint8_t neighbor_sysid
[SYSTEM_ID_LEN
];
586 struct isis_tlv_ip_reach
{
587 struct isis_metric_block isis_metric_block
;
592 static const struct tok isis_is_reach_virtual_values
[] = {
593 { 0, "IsNotVirtual"},
598 static const struct tok isis_restart_flag_values
[] = {
599 { 0x1, "Restart Request"},
600 { 0x2, "Restart Acknowledgement"},
601 { 0x4, "Suppress adjacency advertisement"},
605 struct isis_common_header
{
608 uint8_t version
; /* Protocol version */
610 uint8_t pdu_type
; /* 3 MSbits are reserved */
611 uint8_t pdu_version
; /* Packet format version */
616 struct isis_iih_lan_header
{
617 uint8_t circuit_type
;
618 uint8_t source_id
[SYSTEM_ID_LEN
];
619 uint8_t holding_time
[2];
622 uint8_t lan_id
[NODE_ID_LEN
];
625 struct isis_iih_ptp_header
{
626 uint8_t circuit_type
;
627 uint8_t source_id
[SYSTEM_ID_LEN
];
628 uint8_t holding_time
[2];
633 struct isis_lsp_header
{
635 uint8_t remaining_lifetime
[2];
636 uint8_t lsp_id
[LSP_ID_LEN
];
637 uint8_t sequence_number
[4];
642 struct isis_csnp_header
{
644 uint8_t source_id
[NODE_ID_LEN
];
645 uint8_t start_lsp_id
[LSP_ID_LEN
];
646 uint8_t end_lsp_id
[LSP_ID_LEN
];
649 struct isis_psnp_header
{
651 uint8_t source_id
[NODE_ID_LEN
];
654 struct isis_tlv_lsp
{
655 uint8_t remaining_lifetime
[2];
656 uint8_t lsp_id
[LSP_ID_LEN
];
657 uint8_t sequence_number
[4];
661 #define ISIS_COMMON_HEADER_SIZE (sizeof(struct isis_common_header))
662 #define ISIS_IIH_LAN_HEADER_SIZE (sizeof(struct isis_iih_lan_header))
663 #define ISIS_IIH_PTP_HEADER_SIZE (sizeof(struct isis_iih_ptp_header))
664 #define ISIS_LSP_HEADER_SIZE (sizeof(struct isis_lsp_header))
665 #define ISIS_CSNP_HEADER_SIZE (sizeof(struct isis_csnp_header))
666 #define ISIS_PSNP_HEADER_SIZE (sizeof(struct isis_psnp_header))
668 void isoclns_print(netdissect_options
*ndo
,
669 const uint8_t *p
, u_int length
, u_int caplen
)
671 if (caplen
<= 1) { /* enough bytes on the wire ? */
672 ND_PRINT((ndo
, "|OSI"));
677 ND_PRINT((ndo
, "OSI NLPID %s (0x%02x): ", tok2str(nlpid_values
, "Unknown", *p
), *p
));
682 if (!clnp_print(ndo
, p
, length
))
683 print_unknown_data(ndo
, p
, "\n\t", caplen
);
687 esis_print(ndo
, p
, length
);
691 if (!isis_print(ndo
, p
, length
))
692 print_unknown_data(ndo
, p
, "\n\t", caplen
);
696 ND_PRINT((ndo
, "%slength: %u", ndo
->ndo_eflag
? "" : ", ", length
));
700 q933_print(ndo
, p
+ 1, length
- 1);
704 ip_print(ndo
, p
+ 1, length
- 1);
708 ip6_print(ndo
, p
+ 1, length
- 1);
712 ppp_print(ndo
, p
+ 1, length
- 1);
717 ND_PRINT((ndo
, "OSI NLPID 0x%02x unknown", *p
));
718 ND_PRINT((ndo
, "%slength: %u", ndo
->ndo_eflag
? "" : ", ", length
));
720 print_unknown_data(ndo
, p
, "\n\t", caplen
);
725 #define CLNP_PDU_ER 1
726 #define CLNP_PDU_DT 28
727 #define CLNP_PDU_MD 29
728 #define CLNP_PDU_ERQ 30
729 #define CLNP_PDU_ERP 31
731 static const struct tok clnp_pdu_values
[] = {
732 { CLNP_PDU_ER
, "Error Report"},
733 { CLNP_PDU_MD
, "MD"},
734 { CLNP_PDU_DT
, "Data"},
735 { CLNP_PDU_ERQ
, "Echo Request"},
736 { CLNP_PDU_ERP
, "Echo Response"},
740 struct clnp_header_t
{
742 uint8_t length_indicator
;
744 uint8_t lifetime
; /* units of 500ms */
746 uint8_t segment_length
[2];
750 struct clnp_segment_header_t
{
751 uint8_t data_unit_id
[2];
752 uint8_t segment_offset
[2];
753 uint8_t total_length
[2];
758 * Decode CLNP packets. Return 0 on error.
762 clnp_print(netdissect_options
*ndo
,
763 const uint8_t *pptr
, u_int length
)
765 const uint8_t *optr
,*source_address
,*dest_address
;
766 u_int li
,tlen
,nsap_offset
,source_address_length
,dest_address_length
, clnp_pdu_type
, clnp_flags
;
767 const struct clnp_header_t
*clnp_header
;
768 const struct clnp_segment_header_t
*clnp_segment_header
;
769 uint8_t rfd_error_major
,rfd_error_minor
;
771 clnp_header
= (const struct clnp_header_t
*) pptr
;
772 ND_TCHECK(*clnp_header
);
774 li
= clnp_header
->length_indicator
;
778 ND_PRINT((ndo
, "CLNP"));
781 * Sanity checking of the header.
784 if (clnp_header
->version
!= CLNP_VERSION
) {
785 ND_PRINT((ndo
, "version %d packet not supported", clnp_header
->version
));
789 /* FIXME further header sanity checking */
791 clnp_pdu_type
= clnp_header
->type
& CLNP_PDU_TYPE_MASK
;
792 clnp_flags
= clnp_header
->type
& CLNP_FLAG_MASK
;
794 pptr
+= sizeof(struct clnp_header_t
);
795 li
-= sizeof(struct clnp_header_t
);
796 dest_address_length
= *pptr
;
797 dest_address
= pptr
+ 1;
799 pptr
+= (1 + dest_address_length
);
800 li
-= (1 + dest_address_length
);
801 source_address_length
= *pptr
;
802 source_address
= pptr
+1;
804 pptr
+= (1 + source_address_length
);
805 li
-= (1 + source_address_length
);
807 if (ndo
->ndo_vflag
< 1) {
808 ND_PRINT((ndo
, "%s%s > %s, %s, length %u",
809 ndo
->ndo_eflag
? "" : ", ",
810 isonsap_string(source_address
, source_address_length
),
811 isonsap_string(dest_address
, dest_address_length
),
812 tok2str(clnp_pdu_values
,"unknown (%u)",clnp_pdu_type
),
816 ND_PRINT((ndo
, "%slength %u", ndo
->ndo_eflag
? "" : ", ", length
));
818 ND_PRINT((ndo
, "\n\t%s PDU, hlen: %u, v: %u, lifetime: %u.%us, Segment PDU length: %u, checksum: 0x%04x",
819 tok2str(clnp_pdu_values
, "unknown (%u)",clnp_pdu_type
),
820 clnp_header
->length_indicator
,
821 clnp_header
->version
,
822 clnp_header
->lifetime
/2,
823 (clnp_header
->lifetime
%2)*5,
824 EXTRACT_16BITS(clnp_header
->segment_length
),
825 EXTRACT_16BITS(clnp_header
->cksum
)));
827 osi_print_cksum(ndo
, optr
, EXTRACT_16BITS(clnp_header
->cksum
), 7,
828 clnp_header
->length_indicator
);
830 ND_PRINT((ndo
, "\n\tFlags [%s]",
831 bittok2str(clnp_flag_values
, "none", clnp_flags
)));
833 ND_PRINT((ndo
, "\n\tsource address (length %u): %s\n\tdest address (length %u): %s",
834 source_address_length
,
835 isonsap_string(source_address
, source_address_length
),
837 isonsap_string(dest_address
, dest_address_length
)));
839 if (clnp_flags
& CLNP_SEGMENT_PART
) {
840 clnp_segment_header
= (const struct clnp_segment_header_t
*) pptr
;
841 ND_TCHECK(*clnp_segment_header
);
842 ND_PRINT((ndo
, "\n\tData Unit ID: 0x%04x, Segment Offset: %u, Total PDU Length: %u",
843 EXTRACT_16BITS(clnp_segment_header
->data_unit_id
),
844 EXTRACT_16BITS(clnp_segment_header
->segment_offset
),
845 EXTRACT_16BITS(clnp_segment_header
->total_length
)));
846 pptr
+=sizeof(const struct clnp_segment_header_t
);
847 li
-=sizeof(const struct clnp_segment_header_t
);
850 /* now walk the options */
855 ND_TCHECK2(*pptr
, 2);
857 ND_PRINT((ndo
, ", bad opts/li"));
863 ND_TCHECK2(*pptr
, opli
);
865 ND_PRINT((ndo
, ", opt (%d) too long", op
));
872 ND_PRINT((ndo
, "\n\t %s Option #%u, length %u, value: ",
873 tok2str(clnp_option_values
,"Unknown",op
),
880 case CLNP_OPTION_ROUTE_RECORDING
: /* those two options share the format */
881 case CLNP_OPTION_SOURCE_ROUTING
:
882 ND_PRINT((ndo
, "%s %s",
883 tok2str(clnp_option_sr_rr_values
,"Unknown",*tptr
),
884 tok2str(clnp_option_sr_rr_string_values
, "Unknown Option %u", op
)));
885 nsap_offset
=*(tptr
+1);
886 if (nsap_offset
== 0) {
887 ND_PRINT((ndo
, " Bad NSAP offset (0)"));
890 nsap_offset
-=1; /* offset to nsap list */
891 if (nsap_offset
> tlen
) {
892 ND_PRINT((ndo
, " Bad NSAP offset (past end of option)"));
898 source_address_length
=*tptr
;
899 if (tlen
< source_address_length
+1) {
900 ND_PRINT((ndo
, "\n\t NSAP address goes past end of option"));
903 if (source_address_length
> 0) {
904 source_address
=(tptr
+1);
905 ND_TCHECK2(*source_address
, source_address_length
);
906 ND_PRINT((ndo
, "\n\t NSAP address (length %u): %s",
907 source_address_length
,
908 isonsap_string(source_address
, source_address_length
)));
910 tlen
-=source_address_length
+1;
914 case CLNP_OPTION_PRIORITY
:
915 ND_PRINT((ndo
, "0x%1x", *tptr
&0x0f));
918 case CLNP_OPTION_QOS_MAINTENANCE
:
919 ND_PRINT((ndo
, "\n\t Format Code: %s",
920 tok2str(clnp_option_scope_values
, "Reserved", *tptr
&CLNP_OPTION_SCOPE_MASK
)));
922 if ((*tptr
&CLNP_OPTION_SCOPE_MASK
) == CLNP_OPTION_SCOPE_GLOBAL
)
923 ND_PRINT((ndo
, "\n\t QoS Flags [%s]",
924 bittok2str(clnp_option_qos_global_values
,
926 *tptr
&CLNP_OPTION_OPTION_QOS_MASK
)));
929 case CLNP_OPTION_SECURITY
:
930 ND_PRINT((ndo
, "\n\t Format Code: %s, Security-Level %u",
931 tok2str(clnp_option_scope_values
,"Reserved",*tptr
&CLNP_OPTION_SCOPE_MASK
),
935 case CLNP_OPTION_DISCARD_REASON
:
936 rfd_error_major
= (*tptr
&0xf0) >> 4;
937 rfd_error_minor
= *tptr
&0x0f;
938 ND_PRINT((ndo
, "\n\t Class: %s Error (0x%01x), %s (0x%01x)",
939 tok2str(clnp_option_rfd_class_values
,"Unknown",rfd_error_major
),
941 tok2str(clnp_option_rfd_error_class
[rfd_error_major
],"Unknown",rfd_error_minor
),
945 case CLNP_OPTION_PADDING
:
946 ND_PRINT((ndo
, "padding data"));
950 * FIXME those are the defined Options that lack a decoder
951 * you are welcome to contribute code ;-)
955 print_unknown_data(ndo
, tptr
, "\n\t ", opli
);
958 if (ndo
->ndo_vflag
> 1)
959 print_unknown_data(ndo
, pptr
, "\n\t ", opli
);
963 switch (clnp_pdu_type
) {
965 case CLNP_PDU_ER
: /* fall through */
968 if (*(pptr
) == NLPID_CLNP
) {
969 ND_PRINT((ndo
, "\n\t-----original packet-----\n\t"));
970 /* FIXME recursion protection */
971 clnp_print(ndo
, pptr
, length
- clnp_header
->length_indicator
);
980 /* dump the PDU specific data */
981 if (length
-(pptr
-optr
) > 0) {
982 ND_PRINT((ndo
, "\n\t undecoded non-header data, length %u", length
-clnp_header
->length_indicator
));
983 print_unknown_data(ndo
, pptr
, "\n\t ", length
- (pptr
- optr
));
990 ND_PRINT((ndo
, "[|clnp]"));
996 #define ESIS_PDU_REDIRECT 6
997 #define ESIS_PDU_ESH 2
998 #define ESIS_PDU_ISH 4
1000 static const struct tok esis_pdu_values
[] = {
1001 { ESIS_PDU_REDIRECT
, "redirect"},
1002 { ESIS_PDU_ESH
, "ESH"},
1003 { ESIS_PDU_ISH
, "ISH"},
1007 struct esis_header_t
{
1009 uint8_t length_indicator
;
1013 uint8_t holdtime
[2];
1018 esis_print(netdissect_options
*ndo
,
1019 const uint8_t *pptr
, u_int length
)
1021 const uint8_t *optr
;
1022 u_int li
,esis_pdu_type
,source_address_length
, source_address_number
;
1023 const struct esis_header_t
*esis_header
;
1025 if (!ndo
->ndo_eflag
)
1026 ND_PRINT((ndo
, "ES-IS"));
1029 ND_PRINT((ndo
, ndo
->ndo_qflag
? "bad pkt!" : "no header at all!"));
1033 esis_header
= (const struct esis_header_t
*) pptr
;
1034 ND_TCHECK(*esis_header
);
1035 li
= esis_header
->length_indicator
;
1039 * Sanity checking of the header.
1042 if (esis_header
->nlpid
!= NLPID_ESIS
) {
1043 ND_PRINT((ndo
, " nlpid 0x%02x packet not supported", esis_header
->nlpid
));
1047 if (esis_header
->version
!= ESIS_VERSION
) {
1048 ND_PRINT((ndo
, " version %d packet not supported", esis_header
->version
));
1053 ND_PRINT((ndo
, " length indicator(%d) > PDU size (%d)!", li
, length
));
1057 if (li
< sizeof(struct esis_header_t
) + 2) {
1058 ND_PRINT((ndo
, " length indicator < min PDU size %d:", li
));
1059 while (pptr
< ndo
->ndo_snapend
)
1060 ND_PRINT((ndo
, "%02X", *pptr
++));
1064 esis_pdu_type
= esis_header
->type
& ESIS_PDU_TYPE_MASK
;
1066 if (ndo
->ndo_vflag
< 1) {
1067 ND_PRINT((ndo
, "%s%s, length %u",
1068 ndo
->ndo_eflag
? "" : ", ",
1069 tok2str(esis_pdu_values
,"unknown type (%u)",esis_pdu_type
),
1073 ND_PRINT((ndo
, "%slength %u\n\t%s (%u)",
1074 ndo
->ndo_eflag
? "" : ", ",
1076 tok2str(esis_pdu_values
,"unknown type: %u", esis_pdu_type
),
1079 ND_PRINT((ndo
, ", v: %u%s", esis_header
->version
, esis_header
->version
== ESIS_VERSION
? "" : "unsupported" ));
1080 ND_PRINT((ndo
, ", checksum: 0x%04x", EXTRACT_16BITS(esis_header
->cksum
)));
1082 osi_print_cksum(ndo
, pptr
, EXTRACT_16BITS(esis_header
->cksum
), 7, li
);
1084 ND_PRINT((ndo
, ", holding time: %us, length indicator: %u",
1085 EXTRACT_16BITS(esis_header
->holdtime
), li
));
1087 if (ndo
->ndo_vflag
> 1)
1088 print_unknown_data(ndo
, optr
, "\n\t", sizeof(struct esis_header_t
));
1090 pptr
+= sizeof(struct esis_header_t
);
1091 li
-= sizeof(struct esis_header_t
);
1093 switch (esis_pdu_type
) {
1094 case ESIS_PDU_REDIRECT
: {
1095 const uint8_t *dst
, *snpa
, *neta
;
1096 u_int dstl
, snpal
, netal
;
1100 ND_PRINT((ndo
, ", bad redirect/li"));
1106 ND_TCHECK2(*pptr
, dstl
);
1108 ND_PRINT((ndo
, ", bad redirect/li"));
1114 ND_PRINT((ndo
, "\n\t %s", isonsap_string(dst
, dstl
)));
1118 ND_PRINT((ndo
, ", bad redirect/li"));
1124 ND_TCHECK2(*pptr
, snpal
);
1126 ND_PRINT((ndo
, ", bad redirect/li"));
1134 ND_PRINT((ndo
, ", bad redirect/li"));
1139 ND_TCHECK2(*pptr
, netal
);
1141 ND_PRINT((ndo
, ", bad redirect/li"));
1149 ND_PRINT((ndo
, "\n\t %s", etheraddr_string(ndo
, snpa
)));
1151 ND_PRINT((ndo
, "\n\t %s", isonsap_string(neta
, netal
)));
1158 ND_PRINT((ndo
, ", bad esh/li"));
1161 source_address_number
= *pptr
;
1165 ND_PRINT((ndo
, "\n\t Number of Source Addresses: %u", source_address_number
));
1167 while (source_address_number
> 0) {
1170 ND_PRINT((ndo
, ", bad esh/li"));
1173 source_address_length
= *pptr
;
1177 ND_TCHECK2(*pptr
, source_address_length
);
1178 if (li
< source_address_length
) {
1179 ND_PRINT((ndo
, ", bad esh/li"));
1182 ND_PRINT((ndo
, "\n\t NET (length: %u): %s",
1183 source_address_length
,
1184 isonsap_string(pptr
, source_address_length
)));
1185 pptr
+= source_address_length
;
1186 li
-= source_address_length
;
1187 source_address_number
--;
1192 case ESIS_PDU_ISH
: {
1195 ND_PRINT((ndo
, ", bad ish/li"));
1198 source_address_length
= *pptr
;
1201 ND_TCHECK2(*pptr
, source_address_length
);
1202 if (li
< source_address_length
) {
1203 ND_PRINT((ndo
, ", bad ish/li"));
1206 ND_PRINT((ndo
, "\n\t NET (length: %u): %s", source_address_length
, isonsap_string(pptr
, source_address_length
)));
1207 pptr
+= source_address_length
;
1208 li
-= source_address_length
;
1213 if (ndo
->ndo_vflag
<= 1) {
1214 if (pptr
< ndo
->ndo_snapend
)
1215 print_unknown_data(ndo
, pptr
, "\n\t ", ndo
->ndo_snapend
- pptr
);
1220 /* now walk the options */
1223 const uint8_t *tptr
;
1226 ND_PRINT((ndo
, ", bad opts/li"));
1229 ND_TCHECK2(*pptr
, 2);
1234 ND_PRINT((ndo
, ", opt (%d) too long", op
));
1240 ND_PRINT((ndo
, "\n\t %s Option #%u, length %u, value: ",
1241 tok2str(esis_option_values
,"Unknown",op
),
1247 case ESIS_OPTION_ES_CONF_TIME
:
1249 ND_TCHECK2(*pptr
, 2);
1250 ND_PRINT((ndo
, "%us", EXTRACT_16BITS(tptr
)));
1252 ND_PRINT((ndo
, "(bad length)"));
1255 case ESIS_OPTION_PROTOCOLS
:
1258 ND_PRINT((ndo
, "%s (0x%02x)",
1259 tok2str(nlpid_values
,
1263 if (opli
>1) /* further NPLIDs ? - put comma */
1264 ND_PRINT((ndo
, ", "));
1271 * FIXME those are the defined Options that lack a decoder
1272 * you are welcome to contribute code ;-)
1275 case ESIS_OPTION_QOS_MAINTENANCE
:
1276 case ESIS_OPTION_SECURITY
:
1277 case ESIS_OPTION_PRIORITY
:
1278 case ESIS_OPTION_ADDRESS_MASK
:
1279 case ESIS_OPTION_SNPA_MASK
:
1282 print_unknown_data(ndo
, tptr
, "\n\t ", opli
);
1285 if (ndo
->ndo_vflag
> 1)
1286 print_unknown_data(ndo
, pptr
, "\n\t ", opli
);
1294 isis_print_mcid(netdissect_options
*ndo
,
1295 const struct isis_spb_mcid
*mcid
)
1299 ND_PRINT((ndo
, "ID: %d, Name: ", mcid
->format_id
));
1303 ND_PRINT((ndo
, "%c", mcid
->name
[i
]));
1304 if(mcid
->name
[i
] == '\0')
1308 ND_PRINT((ndo
, "\n\t Lvl: %d", EXTRACT_16BITS(mcid
->revision_lvl
)));
1310 ND_PRINT((ndo
, ", Digest: "));
1313 ND_PRINT((ndo
, "%.2x ", mcid
->digest
[i
]));
1317 isis_print_mt_port_cap_subtlv(netdissect_options
*ndo
,
1318 const uint8_t *tptr
, int len
)
1320 int stlv_type
, stlv_len
;
1321 const struct isis_subtlv_spb_mcid
*subtlv_spb_mcid
;
1326 stlv_type
= *(tptr
++);
1327 stlv_len
= *(tptr
++);
1329 /* first lets see if we know the subTLVs name*/
1330 ND_PRINT((ndo
, "\n\t %s subTLV #%u, length: %u",
1331 tok2str(isis_mt_port_cap_subtlv_values
, "unknown", stlv_type
),
1335 /*len -= TLV_TYPE_LEN_OFFSET;*/
1340 case ISIS_SUBTLV_SPB_MCID
:
1342 if (!ND_TTEST2(*(tptr
), ISIS_SUBTLV_SPB_MCID_MIN_LEN
))
1345 subtlv_spb_mcid
= (const struct isis_subtlv_spb_mcid
*)tptr
;
1347 ND_PRINT((ndo
, "\n\t MCID: "));
1348 isis_print_mcid(ndo
, &(subtlv_spb_mcid
->mcid
));
1350 /*tptr += SPB_MCID_MIN_LEN;
1351 len -= SPB_MCID_MIN_LEN; */
1353 ND_PRINT((ndo
, "\n\t AUX-MCID: "));
1354 isis_print_mcid(ndo
, &(subtlv_spb_mcid
->aux_mcid
));
1356 /*tptr += SPB_MCID_MIN_LEN;
1357 len -= SPB_MCID_MIN_LEN; */
1358 tptr
= tptr
+ sizeof(struct isis_subtlv_spb_mcid
);
1359 len
= len
- sizeof(struct isis_subtlv_spb_mcid
);
1364 case ISIS_SUBTLV_SPB_DIGEST
:
1366 if (!ND_TTEST2(*(tptr
), ISIS_SUBTLV_SPB_DIGEST_MIN_LEN
))
1369 ND_PRINT((ndo
, "\n\t RES: %d V: %d A: %d D: %d",
1370 (*(tptr
) >> 5), (((*tptr
)>> 4) & 0x01),
1371 ((*(tptr
) >> 2) & 0x03), ((*tptr
) & 0x03)));
1375 ND_PRINT((ndo
, "\n\t Digest: "));
1379 ND_PRINT((ndo
, "%08x ", EXTRACT_32BITS(tptr
)));
1380 if (i
%4 == 0 && i
!= 8)
1381 ND_PRINT((ndo
, "\n\t "));
1385 len
= len
- ISIS_SUBTLV_SPB_DIGEST_MIN_LEN
;
1390 case ISIS_SUBTLV_SPB_BVID
:
1392 if (!ND_TTEST2(*(tptr
), stlv_len
))
1397 if (!ND_TTEST2(*(tptr
), ISIS_SUBTLV_SPB_BVID_MIN_LEN
))
1400 ND_PRINT((ndo
, "\n\t ECT: %08x",
1401 EXTRACT_32BITS(tptr
)));
1405 ND_PRINT((ndo
, " BVID: %d, U:%01x M:%01x ",
1406 (EXTRACT_16BITS (tptr
) >> 4) ,
1407 (EXTRACT_16BITS (tptr
) >> 3) & 0x01,
1408 (EXTRACT_16BITS (tptr
) >> 2) & 0x01));
1411 len
= len
- ISIS_SUBTLV_SPB_BVID_MIN_LEN
;
1425 ND_PRINT((ndo
, "\n\t\t packet exceeded snapshot"));
1430 isis_print_mt_capability_subtlv(netdissect_options
*ndo
,
1431 const uint8_t *tptr
, int len
)
1433 int stlv_type
, stlv_len
, tmp
;
1437 stlv_type
= *(tptr
++);
1438 stlv_len
= *(tptr
++);
1440 /* first lets see if we know the subTLVs name*/
1441 ND_PRINT((ndo
, "\n\t %s subTLV #%u, length: %u",
1442 tok2str(isis_mt_capability_subtlv_values
, "unknown", stlv_type
),
1450 case ISIS_SUBTLV_SPB_INSTANCE
:
1452 if (!ND_TTEST2(*(tptr
), ISIS_SUBTLV_SPB_INSTANCE_MIN_LEN
))
1455 ND_PRINT((ndo
, "\n\t CIST Root-ID: %08x", EXTRACT_32BITS(tptr
)));
1457 ND_PRINT((ndo
, " %08x", EXTRACT_32BITS(tptr
)));
1459 ND_PRINT((ndo
, ", Path Cost: %08x", EXTRACT_32BITS(tptr
)));
1461 ND_PRINT((ndo
, ", Prio: %d", EXTRACT_16BITS(tptr
)));
1463 ND_PRINT((ndo
, "\n\t RES: %d",
1464 EXTRACT_16BITS(tptr
) >> 5));
1465 ND_PRINT((ndo
, ", V: %d",
1466 (EXTRACT_16BITS(tptr
) >> 4) & 0x0001));
1467 ND_PRINT((ndo
, ", SPSource-ID: %d",
1468 (EXTRACT_32BITS(tptr
) & 0x000fffff)));
1470 ND_PRINT((ndo
, ", No of Trees: %x", *(tptr
)));
1474 len
= len
- ISIS_SUBTLV_SPB_INSTANCE_MIN_LEN
;
1478 if (!ND_TTEST2(*(tptr
), ISIS_SUBTLV_SPB_INSTANCE_VLAN_TUPLE_LEN
))
1481 ND_PRINT((ndo
, "\n\t U:%d, M:%d, A:%d, RES:%d",
1482 *(tptr
) >> 7, (*(tptr
) >> 6) & 0x01,
1483 (*(tptr
) >> 5) & 0x01, (*(tptr
) & 0x1f)));
1487 ND_PRINT((ndo
, ", ECT: %08x", EXTRACT_32BITS(tptr
)));
1491 ND_PRINT((ndo
, ", BVID: %d, SPVID: %d",
1492 (EXTRACT_24BITS(tptr
) >> 12) & 0x000fff,
1493 EXTRACT_24BITS(tptr
) & 0x000fff));
1496 len
= len
- ISIS_SUBTLV_SPB_INSTANCE_VLAN_TUPLE_LEN
;
1502 case ISIS_SUBTLV_SPBM_SI
:
1504 if (!ND_TTEST2(*(tptr
), 6))
1507 ND_PRINT((ndo
, "\n\t BMAC: %08x", EXTRACT_32BITS(tptr
)));
1509 ND_PRINT((ndo
, "%04x", EXTRACT_16BITS(tptr
)));
1512 ND_PRINT((ndo
, ", RES: %d, VID: %d", EXTRACT_16BITS(tptr
) >> 12,
1513 (EXTRACT_16BITS(tptr
)) & 0x0fff));
1517 stlv_len
= stlv_len
- 8;
1521 ND_PRINT((ndo
, "\n\t T: %d, R: %d, RES: %d, ISID: %d",
1522 (EXTRACT_32BITS(tptr
) >> 31),
1523 (EXTRACT_32BITS(tptr
) >> 30) & 0x01,
1524 (EXTRACT_32BITS(tptr
) >> 24) & 0x03f,
1525 (EXTRACT_32BITS(tptr
)) & 0x0ffffff));
1529 stlv_len
= stlv_len
- 4;
1541 ND_PRINT((ndo
, "\n\t\t packet exceeded snapshot"));
1545 /* shared routine for printing system, node and lsp-ids */
1547 isis_print_id(const uint8_t *cp
, int id_len
)
1550 static char id
[sizeof("xxxx.xxxx.xxxx.yy-zz")];
1553 for (i
= 1; i
<= SYSTEM_ID_LEN
; i
++) {
1554 snprintf(pos
, sizeof(id
) - (pos
- id
), "%02x", *cp
++);
1556 if (i
== 2 || i
== 4)
1559 if (id_len
>= NODE_ID_LEN
) {
1560 snprintf(pos
, sizeof(id
) - (pos
- id
), ".%02x", *cp
++);
1563 if (id_len
== LSP_ID_LEN
)
1564 snprintf(pos
, sizeof(id
) - (pos
- id
), "-%02x", *cp
);
1568 /* print the 4-byte metric block which is common found in the old-style TLVs */
1570 isis_print_metric_block(netdissect_options
*ndo
,
1571 const struct isis_metric_block
*isis_metric_block
)
1573 ND_PRINT((ndo
, ", Default Metric: %d, %s",
1574 ISIS_LSP_TLV_METRIC_VALUE(isis_metric_block
->metric_default
),
1575 ISIS_LSP_TLV_METRIC_IE(isis_metric_block
->metric_default
) ? "External" : "Internal"));
1576 if (!ISIS_LSP_TLV_METRIC_SUPPORTED(isis_metric_block
->metric_delay
))
1577 ND_PRINT((ndo
, "\n\t\t Delay Metric: %d, %s",
1578 ISIS_LSP_TLV_METRIC_VALUE(isis_metric_block
->metric_delay
),
1579 ISIS_LSP_TLV_METRIC_IE(isis_metric_block
->metric_delay
) ? "External" : "Internal"));
1580 if (!ISIS_LSP_TLV_METRIC_SUPPORTED(isis_metric_block
->metric_expense
))
1581 ND_PRINT((ndo
, "\n\t\t Expense Metric: %d, %s",
1582 ISIS_LSP_TLV_METRIC_VALUE(isis_metric_block
->metric_expense
),
1583 ISIS_LSP_TLV_METRIC_IE(isis_metric_block
->metric_expense
) ? "External" : "Internal"));
1584 if (!ISIS_LSP_TLV_METRIC_SUPPORTED(isis_metric_block
->metric_error
))
1585 ND_PRINT((ndo
, "\n\t\t Error Metric: %d, %s",
1586 ISIS_LSP_TLV_METRIC_VALUE(isis_metric_block
->metric_error
),
1587 ISIS_LSP_TLV_METRIC_IE(isis_metric_block
->metric_error
) ? "External" : "Internal"));
1589 return(1); /* everything is ok */
1593 isis_print_tlv_ip_reach(netdissect_options
*ndo
,
1594 const uint8_t *cp
, const char *ident
, int length
)
1597 const struct isis_tlv_ip_reach
*tlv_ip_reach
;
1599 tlv_ip_reach
= (const struct isis_tlv_ip_reach
*)cp
;
1601 while (length
> 0) {
1602 if ((size_t)length
< sizeof(*tlv_ip_reach
)) {
1603 ND_PRINT((ndo
, "short IPv4 Reachability (%d vs %lu)",
1605 (unsigned long)sizeof(*tlv_ip_reach
)));
1609 if (!ND_TTEST(*tlv_ip_reach
))
1612 prefix_len
= mask2plen(EXTRACT_32BITS(tlv_ip_reach
->mask
));
1614 if (prefix_len
== -1)
1615 ND_PRINT((ndo
, "%sIPv4 prefix: %s mask %s",
1617 ipaddr_string(ndo
, (tlv_ip_reach
->prefix
)),
1618 ipaddr_string(ndo
, (tlv_ip_reach
->mask
))));
1620 ND_PRINT((ndo
, "%sIPv4 prefix: %15s/%u",
1622 ipaddr_string(ndo
, (tlv_ip_reach
->prefix
)),
1625 ND_PRINT((ndo
, ", Distribution: %s, Metric: %u, %s",
1626 ISIS_LSP_TLV_METRIC_UPDOWN(tlv_ip_reach
->isis_metric_block
.metric_default
) ? "down" : "up",
1627 ISIS_LSP_TLV_METRIC_VALUE(tlv_ip_reach
->isis_metric_block
.metric_default
),
1628 ISIS_LSP_TLV_METRIC_IE(tlv_ip_reach
->isis_metric_block
.metric_default
) ? "External" : "Internal"));
1630 if (!ISIS_LSP_TLV_METRIC_SUPPORTED(tlv_ip_reach
->isis_metric_block
.metric_delay
))
1631 ND_PRINT((ndo
, "%s Delay Metric: %u, %s",
1633 ISIS_LSP_TLV_METRIC_VALUE(tlv_ip_reach
->isis_metric_block
.metric_delay
),
1634 ISIS_LSP_TLV_METRIC_IE(tlv_ip_reach
->isis_metric_block
.metric_delay
) ? "External" : "Internal"));
1636 if (!ISIS_LSP_TLV_METRIC_SUPPORTED(tlv_ip_reach
->isis_metric_block
.metric_expense
))
1637 ND_PRINT((ndo
, "%s Expense Metric: %u, %s",
1639 ISIS_LSP_TLV_METRIC_VALUE(tlv_ip_reach
->isis_metric_block
.metric_expense
),
1640 ISIS_LSP_TLV_METRIC_IE(tlv_ip_reach
->isis_metric_block
.metric_expense
) ? "External" : "Internal"));
1642 if (!ISIS_LSP_TLV_METRIC_SUPPORTED(tlv_ip_reach
->isis_metric_block
.metric_error
))
1643 ND_PRINT((ndo
, "%s Error Metric: %u, %s",
1645 ISIS_LSP_TLV_METRIC_VALUE(tlv_ip_reach
->isis_metric_block
.metric_error
),
1646 ISIS_LSP_TLV_METRIC_IE(tlv_ip_reach
->isis_metric_block
.metric_error
) ? "External" : "Internal"));
1648 length
-= sizeof(struct isis_tlv_ip_reach
);
1655 * this is the common IP-REACH subTLV decoder it is called
1656 * from various EXTD-IP REACH TLVs (135,235,236,237)
1660 isis_print_ip_reach_subtlv(netdissect_options
*ndo
,
1661 const uint8_t *tptr
, int subt
, int subl
,
1664 /* first lets see if we know the subTLVs name*/
1665 ND_PRINT((ndo
, "%s%s subTLV #%u, length: %u",
1666 ident
, tok2str(isis_ext_ip_reach_subtlv_values
, "unknown", subt
),
1669 if (!ND_TTEST2(*tptr
,subl
))
1673 case ISIS_SUBTLV_EXTD_IP_REACH_MGMT_PREFIX_COLOR
: /* fall through */
1674 case ISIS_SUBTLV_EXTD_IP_REACH_ADMIN_TAG32
:
1676 ND_PRINT((ndo
, ", 0x%08x (=%u)",
1677 EXTRACT_32BITS(tptr
),
1678 EXTRACT_32BITS(tptr
)));
1683 case ISIS_SUBTLV_EXTD_IP_REACH_ADMIN_TAG64
:
1685 ND_PRINT((ndo
, ", 0x%08x%08x",
1686 EXTRACT_32BITS(tptr
),
1687 EXTRACT_32BITS(tptr
+4)));
1693 if (!print_unknown_data(ndo
, tptr
, "\n\t\t ", subl
))
1700 ND_PRINT((ndo
, "%spacket exceeded snapshot", ident
));
1705 * this is the common IS-REACH subTLV decoder it is called
1706 * from isis_print_ext_is_reach()
1710 isis_print_is_reach_subtlv(netdissect_options
*ndo
,
1711 const uint8_t *tptr
, u_int subt
, u_int subl
,
1714 u_int te_class
,priority_level
,gmpls_switch_cap
;
1715 union { /* int to float conversion buffer for several subTLVs */
1720 /* first lets see if we know the subTLVs name*/
1721 ND_PRINT((ndo
, "%s%s subTLV #%u, length: %u",
1722 ident
, tok2str(isis_ext_is_reach_subtlv_values
, "unknown", subt
),
1725 if (!ND_TTEST2(*tptr
,subl
))
1729 case ISIS_SUBTLV_EXT_IS_REACH_ADMIN_GROUP
:
1730 case ISIS_SUBTLV_EXT_IS_REACH_LINK_LOCAL_REMOTE_ID
:
1731 case ISIS_SUBTLV_EXT_IS_REACH_LINK_REMOTE_ID
:
1733 ND_PRINT((ndo
, ", 0x%08x", EXTRACT_32BITS(tptr
)));
1734 if (subl
== 8) /* rfc4205 */
1735 ND_PRINT((ndo
, ", 0x%08x", EXTRACT_32BITS(tptr
+4)));
1738 case ISIS_SUBTLV_EXT_IS_REACH_IPV4_INTF_ADDR
:
1739 case ISIS_SUBTLV_EXT_IS_REACH_IPV4_NEIGHBOR_ADDR
:
1740 if (subl
>= sizeof(struct in_addr
))
1741 ND_PRINT((ndo
, ", %s", ipaddr_string(ndo
, tptr
)));
1743 case ISIS_SUBTLV_EXT_IS_REACH_MAX_LINK_BW
:
1744 case ISIS_SUBTLV_EXT_IS_REACH_RESERVABLE_BW
:
1746 bw
.i
= EXTRACT_32BITS(tptr
);
1747 ND_PRINT((ndo
, ", %.3f Mbps", bw
.f
* 8 / 1000000));
1750 case ISIS_SUBTLV_EXT_IS_REACH_UNRESERVED_BW
:
1752 for (te_class
= 0; te_class
< 8; te_class
++) {
1753 bw
.i
= EXTRACT_32BITS(tptr
);
1754 ND_PRINT((ndo
, "%s TE-Class %u: %.3f Mbps",
1757 bw
.f
* 8 / 1000000));
1762 case ISIS_SUBTLV_EXT_IS_REACH_BW_CONSTRAINTS
: /* fall through */
1763 case ISIS_SUBTLV_EXT_IS_REACH_BW_CONSTRAINTS_OLD
:
1764 ND_PRINT((ndo
, "%sBandwidth Constraints Model ID: %s (%u)",
1766 tok2str(diffserv_te_bc_values
, "unknown", *tptr
),
1769 /* decode BCs until the subTLV ends */
1770 for (te_class
= 0; te_class
< (subl
-1)/4; te_class
++) {
1771 bw
.i
= EXTRACT_32BITS(tptr
);
1772 ND_PRINT((ndo
, "%s Bandwidth constraint CT%u: %.3f Mbps",
1775 bw
.f
* 8 / 1000000));
1779 case ISIS_SUBTLV_EXT_IS_REACH_TE_METRIC
:
1781 ND_PRINT((ndo
, ", %u", EXTRACT_24BITS(tptr
)));
1783 case ISIS_SUBTLV_EXT_IS_REACH_LINK_ATTRIBUTE
:
1785 ND_PRINT((ndo
, ", [ %s ] (0x%04x)",
1786 bittok2str(isis_subtlv_link_attribute_values
,
1788 EXTRACT_16BITS(tptr
)),
1789 EXTRACT_16BITS(tptr
)));
1792 case ISIS_SUBTLV_EXT_IS_REACH_LINK_PROTECTION_TYPE
:
1794 ND_PRINT((ndo
, ", %s, Priority %u",
1795 bittok2str(gmpls_link_prot_values
, "none", *tptr
),
1799 case ISIS_SUBTLV_SPB_METRIC
:
1801 ND_PRINT((ndo
, ", LM: %u", EXTRACT_24BITS(tptr
)));
1803 ND_PRINT((ndo
, ", P: %u", *(tptr
)));
1805 ND_PRINT((ndo
, ", P-ID: %u", EXTRACT_16BITS(tptr
)));
1808 case ISIS_SUBTLV_EXT_IS_REACH_INTF_SW_CAP_DESCR
:
1810 gmpls_switch_cap
= *tptr
;
1811 ND_PRINT((ndo
, "%s Interface Switching Capability:%s",
1813 tok2str(gmpls_switch_cap_values
, "Unknown", gmpls_switch_cap
)));
1814 ND_PRINT((ndo
, ", LSP Encoding: %s",
1815 tok2str(gmpls_encoding_values
, "Unknown", *(tptr
+ 1))));
1817 ND_PRINT((ndo
, "%s Max LSP Bandwidth:", ident
));
1818 for (priority_level
= 0; priority_level
< 8; priority_level
++) {
1819 bw
.i
= EXTRACT_32BITS(tptr
);
1820 ND_PRINT((ndo
, "%s priority level %d: %.3f Mbps",
1823 bw
.f
* 8 / 1000000));
1827 switch (gmpls_switch_cap
) {
1832 bw
.i
= EXTRACT_32BITS(tptr
);
1833 ND_PRINT((ndo
, "%s Min LSP Bandwidth: %.3f Mbps", ident
, bw
.f
* 8 / 1000000));
1834 ND_PRINT((ndo
, "%s Interface MTU: %u", ident
, EXTRACT_16BITS(tptr
+ 4)));
1837 bw
.i
= EXTRACT_32BITS(tptr
);
1838 ND_PRINT((ndo
, "%s Min LSP Bandwidth: %.3f Mbps", ident
, bw
.f
* 8 / 1000000));
1839 ND_PRINT((ndo
, "%s Indication %s", ident
,
1840 tok2str(gmpls_switch_cap_tsc_indication_values
, "Unknown (%u)", *(tptr
+ 4))));
1843 /* there is some optional stuff left to decode but this is as of yet
1844 not specified so just lets hexdump what is left */
1846 if (!print_unknown_data(ndo
, tptr
, "\n\t\t ", subl
))
1853 if (!print_unknown_data(ndo
, tptr
, "\n\t\t ", subl
))
1860 ND_PRINT((ndo
, "%spacket exceeded snapshot", ident
));
1866 * this is the common IS-REACH decoder it is called
1867 * from various EXTD-IS REACH style TLVs (22,24,222)
1871 isis_print_ext_is_reach(netdissect_options
*ndo
,
1872 const uint8_t *tptr
, const char *ident
, int tlv_type
)
1874 char ident_buffer
[20];
1875 int subtlv_type
,subtlv_len
,subtlv_sum_len
;
1876 int proc_bytes
= 0; /* how many bytes did we process ? */
1878 if (!ND_TTEST2(*tptr
, NODE_ID_LEN
))
1881 ND_PRINT((ndo
, "%sIS Neighbor: %s", ident
, isis_print_id(tptr
, NODE_ID_LEN
)));
1882 tptr
+=(NODE_ID_LEN
);
1884 if (tlv_type
!= ISIS_TLV_IS_ALIAS_ID
) { /* the Alias TLV Metric field is implicit 0 */
1885 if (!ND_TTEST2(*tptr
, 3)) /* and is therefore skipped */
1887 ND_PRINT((ndo
, ", Metric: %d", EXTRACT_24BITS(tptr
)));
1891 if (!ND_TTEST2(*tptr
, 1))
1893 subtlv_sum_len
=*(tptr
++); /* read out subTLV length */
1894 proc_bytes
=NODE_ID_LEN
+3+1;
1895 ND_PRINT((ndo
, ", %ssub-TLVs present",subtlv_sum_len
? "" : "no "));
1896 if (subtlv_sum_len
) {
1897 ND_PRINT((ndo
, " (%u)", subtlv_sum_len
));
1898 while (subtlv_sum_len
>0) {
1899 if (!ND_TTEST2(*tptr
,2))
1901 subtlv_type
=*(tptr
++);
1902 subtlv_len
=*(tptr
++);
1903 /* prepend the ident string */
1904 snprintf(ident_buffer
, sizeof(ident_buffer
), "%s ",ident
);
1905 if (!isis_print_is_reach_subtlv(ndo
, tptr
, subtlv_type
, subtlv_len
, ident_buffer
))
1908 subtlv_sum_len
-=(subtlv_len
+2);
1909 proc_bytes
+=(subtlv_len
+2);
1916 * this is the common Multi Topology ID decoder
1917 * it is called from various MT-TLVs (222,229,235,237)
1921 isis_print_mtid(netdissect_options
*ndo
,
1922 const uint8_t *tptr
, const char *ident
)
1924 if (!ND_TTEST2(*tptr
, 2))
1927 ND_PRINT((ndo
, "%s%s",
1929 tok2str(isis_mt_values
,
1930 "Reserved for IETF Consensus",
1931 ISIS_MASK_MTID(EXTRACT_16BITS(tptr
)))));
1933 ND_PRINT((ndo
, " Topology (0x%03x), Flags: [%s]",
1934 ISIS_MASK_MTID(EXTRACT_16BITS(tptr
)),
1935 bittok2str(isis_mt_flag_values
, "none",ISIS_MASK_MTFLAGS(EXTRACT_16BITS(tptr
)))));
1941 * this is the common extended IP reach decoder
1942 * it is called from TLVs (135,235,236,237)
1943 * we process the TLV and optional subTLVs and return
1944 * the amount of processed bytes
1948 isis_print_extd_ip_reach(netdissect_options
*ndo
,
1949 const uint8_t *tptr
, const char *ident
, uint16_t afi
)
1951 char ident_buffer
[20];
1953 uint8_t prefix
[sizeof(struct in6_addr
)]; /* shared copy buffer for IPv4 and IPv6 prefixes */
1955 uint8_t prefix
[sizeof(struct in_addr
)]; /* shared copy buffer for IPv4 prefixes */
1957 u_int metric
, status_byte
, bit_length
, byte_length
, sublen
, processed
, subtlvtype
, subtlvlen
;
1959 if (!ND_TTEST2(*tptr
, 4))
1961 metric
= EXTRACT_32BITS(tptr
);
1965 if (afi
== AF_INET
) {
1966 if (!ND_TTEST2(*tptr
, 1)) /* fetch status byte */
1968 status_byte
=*(tptr
++);
1969 bit_length
= status_byte
&0x3f;
1970 if (bit_length
> 32) {
1971 ND_PRINT((ndo
, "%sIPv4 prefix: bad bit length %u",
1978 } else if (afi
== AF_INET6
) {
1979 if (!ND_TTEST2(*tptr
, 1)) /* fetch status & prefix_len byte */
1981 status_byte
=*(tptr
++);
1982 bit_length
=*(tptr
++);
1983 if (bit_length
> 128) {
1984 ND_PRINT((ndo
, "%sIPv6 prefix: bad bit length %u",
1992 return (0); /* somebody is fooling us */
1994 byte_length
= (bit_length
+ 7) / 8; /* prefix has variable length encoding */
1996 if (!ND_TTEST2(*tptr
, byte_length
))
1998 memset(prefix
, 0, sizeof prefix
); /* clear the copy buffer */
1999 memcpy(prefix
,tptr
,byte_length
); /* copy as much as is stored in the TLV */
2001 processed
+=byte_length
;
2004 ND_PRINT((ndo
, "%sIPv4 prefix: %15s/%u",
2006 ipaddr_string(ndo
, prefix
),
2009 if (afi
== AF_INET6
)
2010 ND_PRINT((ndo
, "%sIPv6 prefix: %s/%u",
2012 ip6addr_string(ndo
, prefix
),
2016 ND_PRINT((ndo
, ", Distribution: %s, Metric: %u",
2017 ISIS_MASK_TLV_EXTD_IP_UPDOWN(status_byte
) ? "down" : "up",
2020 if (afi
== AF_INET
&& ISIS_MASK_TLV_EXTD_IP_SUBTLV(status_byte
))
2021 ND_PRINT((ndo
, ", sub-TLVs present"));
2023 if (afi
== AF_INET6
)
2024 ND_PRINT((ndo
, ", %s%s",
2025 ISIS_MASK_TLV_EXTD_IP6_IE(status_byte
) ? "External" : "Internal",
2026 ISIS_MASK_TLV_EXTD_IP6_SUBTLV(status_byte
) ? ", sub-TLVs present" : ""));
2029 if ((afi
== AF_INET
&& ISIS_MASK_TLV_EXTD_IP_SUBTLV(status_byte
))
2031 || (afi
== AF_INET6
&& ISIS_MASK_TLV_EXTD_IP6_SUBTLV(status_byte
))
2034 /* assume that one prefix can hold more
2035 than one subTLV - therefore the first byte must reflect
2036 the aggregate bytecount of the subTLVs for this prefix
2038 if (!ND_TTEST2(*tptr
, 1))
2041 processed
+=sublen
+1;
2042 ND_PRINT((ndo
, " (%u)", sublen
)); /* print out subTLV length */
2045 if (!ND_TTEST2(*tptr
,2))
2047 subtlvtype
=*(tptr
++);
2048 subtlvlen
=*(tptr
++);
2049 /* prepend the ident string */
2050 snprintf(ident_buffer
, sizeof(ident_buffer
), "%s ",ident
);
2051 if (!isis_print_ip_reach_subtlv(ndo
, tptr
, subtlvtype
, subtlvlen
, ident_buffer
))
2054 sublen
-=(subtlvlen
+2);
2062 * Decode IS-IS packets. Return 0 on error.
2066 isis_print(netdissect_options
*ndo
,
2067 const uint8_t *p
, u_int length
)
2069 const struct isis_common_header
*isis_header
;
2071 const struct isis_iih_lan_header
*header_iih_lan
;
2072 const struct isis_iih_ptp_header
*header_iih_ptp
;
2073 struct isis_lsp_header
*header_lsp
;
2074 const struct isis_csnp_header
*header_csnp
;
2075 const struct isis_psnp_header
*header_psnp
;
2077 const struct isis_tlv_lsp
*tlv_lsp
;
2078 const struct isis_tlv_ptp_adj
*tlv_ptp_adj
;
2079 const struct isis_tlv_is_reach
*tlv_is_reach
;
2080 const struct isis_tlv_es_reach
*tlv_es_reach
;
2082 uint8_t pdu_type
, max_area
, id_length
, tlv_type
, tlv_len
, tmp
, alen
, lan_alen
, prefix_len
;
2083 uint8_t ext_is_len
, ext_ip_len
, mt_len
;
2084 const uint8_t *optr
, *pptr
, *tptr
;
2085 u_short packet_len
,pdu_len
, key_id
;
2090 optr
= p
; /* initialize the _o_riginal pointer to the packet start -
2091 need it for parsing the checksum TLV and authentication
2093 isis_header
= (const struct isis_common_header
*)p
;
2094 ND_TCHECK(*isis_header
);
2095 pptr
= p
+(ISIS_COMMON_HEADER_SIZE
);
2096 header_iih_lan
= (const struct isis_iih_lan_header
*)pptr
;
2097 header_iih_ptp
= (const struct isis_iih_ptp_header
*)pptr
;
2098 header_lsp
= (struct isis_lsp_header
*)pptr
;
2099 header_csnp
= (const struct isis_csnp_header
*)pptr
;
2100 header_psnp
= (const struct isis_psnp_header
*)pptr
;
2102 if (!ndo
->ndo_eflag
)
2103 ND_PRINT((ndo
, "IS-IS"));
2106 * Sanity checking of the header.
2109 if (isis_header
->version
!= ISIS_VERSION
) {
2110 ND_PRINT((ndo
, "version %d packet not supported", isis_header
->version
));
2114 if ((isis_header
->id_length
!= SYSTEM_ID_LEN
) && (isis_header
->id_length
!= 0)) {
2115 ND_PRINT((ndo
, "system ID length of %d is not supported",
2116 isis_header
->id_length
));
2120 if (isis_header
->pdu_version
!= ISIS_VERSION
) {
2121 ND_PRINT((ndo
, "version %d packet not supported", isis_header
->pdu_version
));
2125 max_area
= isis_header
->max_area
;
2128 max_area
= 3; /* silly shit */
2131 ND_PRINT((ndo
, "bad packet -- 255 areas"));
2137 id_length
= isis_header
->id_length
;
2140 id_length
= 6; /* silly shit again */
2142 case 1: /* 1-8 are valid sys-ID lenghts */
2152 id_length
= 0; /* entirely useless */
2158 /* toss any non 6-byte sys-ID len PDUs */
2159 if (id_length
!= 6 ) {
2160 ND_PRINT((ndo
, "bad packet -- illegal sys-ID length (%u)", id_length
));
2164 pdu_type
=isis_header
->pdu_type
;
2166 /* in non-verbose mode print the basic PDU Type plus PDU specific brief information*/
2167 if (ndo
->ndo_vflag
< 1) {
2168 ND_PRINT((ndo
, "%s%s",
2169 ndo
->ndo_eflag
? "" : ", ",
2170 tok2str(isis_pdu_values
, "unknown PDU-Type %u", pdu_type
)));
2174 case ISIS_PDU_L1_LAN_IIH
:
2175 case ISIS_PDU_L2_LAN_IIH
:
2176 ND_PRINT((ndo
, ", src-id %s",
2177 isis_print_id(header_iih_lan
->source_id
, SYSTEM_ID_LEN
)));
2178 ND_PRINT((ndo
, ", lan-id %s, prio %u",
2179 isis_print_id(header_iih_lan
->lan_id
,NODE_ID_LEN
),
2180 header_iih_lan
->priority
));
2182 case ISIS_PDU_PTP_IIH
:
2183 ND_PRINT((ndo
, ", src-id %s", isis_print_id(header_iih_ptp
->source_id
, SYSTEM_ID_LEN
)));
2185 case ISIS_PDU_L1_LSP
:
2186 case ISIS_PDU_L2_LSP
:
2187 ND_PRINT((ndo
, ", lsp-id %s, seq 0x%08x, lifetime %5us",
2188 isis_print_id(header_lsp
->lsp_id
, LSP_ID_LEN
),
2189 EXTRACT_32BITS(header_lsp
->sequence_number
),
2190 EXTRACT_16BITS(header_lsp
->remaining_lifetime
)));
2192 case ISIS_PDU_L1_CSNP
:
2193 case ISIS_PDU_L2_CSNP
:
2194 ND_PRINT((ndo
, ", src-id %s", isis_print_id(header_csnp
->source_id
, NODE_ID_LEN
)));
2196 case ISIS_PDU_L1_PSNP
:
2197 case ISIS_PDU_L2_PSNP
:
2198 ND_PRINT((ndo
, ", src-id %s", isis_print_id(header_psnp
->source_id
, NODE_ID_LEN
)));
2202 ND_PRINT((ndo
, ", length %u", length
));
2207 /* ok they seem to want to know everything - lets fully decode it */
2208 ND_PRINT((ndo
, "%slength %u", ndo
->ndo_eflag
? "" : ", ", length
));
2210 ND_PRINT((ndo
, "\n\t%s, hlen: %u, v: %u, pdu-v: %u, sys-id-len: %u (%u), max-area: %u (%u)",
2211 tok2str(isis_pdu_values
,
2214 isis_header
->fixed_len
,
2215 isis_header
->version
,
2216 isis_header
->pdu_version
,
2218 isis_header
->id_length
,
2220 isis_header
->max_area
));
2222 if (ndo
->ndo_vflag
> 1) {
2223 if (!print_unknown_data(ndo
, optr
, "\n\t", 8)) /* provide the _o_riginal pointer */
2224 return(0); /* for optionally debugging the common header */
2229 case ISIS_PDU_L1_LAN_IIH
:
2230 case ISIS_PDU_L2_LAN_IIH
:
2231 if (isis_header
->fixed_len
!= (ISIS_COMMON_HEADER_SIZE
+ISIS_IIH_LAN_HEADER_SIZE
)) {
2232 ND_PRINT((ndo
, ", bogus fixed header length %u should be %lu",
2233 isis_header
->fixed_len
, (unsigned long)ISIS_IIH_LAN_HEADER_SIZE
));
2237 pdu_len
=EXTRACT_16BITS(header_iih_lan
->pdu_len
);
2238 if (packet_len
>pdu_len
) {
2239 packet_len
=pdu_len
; /* do TLV decoding as long as it makes sense */
2243 ND_TCHECK(*header_iih_lan
);
2244 ND_PRINT((ndo
, "\n\t source-id: %s, holding time: %us, Flags: [%s]",
2245 isis_print_id(header_iih_lan
->source_id
,SYSTEM_ID_LEN
),
2246 EXTRACT_16BITS(header_iih_lan
->holding_time
),
2247 tok2str(isis_iih_circuit_type_values
,
2248 "unknown circuit type 0x%02x",
2249 header_iih_lan
->circuit_type
)));
2251 ND_PRINT((ndo
, "\n\t lan-id: %s, Priority: %u, PDU length: %u",
2252 isis_print_id(header_iih_lan
->lan_id
, NODE_ID_LEN
),
2253 (header_iih_lan
->priority
) & ISIS_LAN_PRIORITY_MASK
,
2256 if (ndo
->ndo_vflag
> 1) {
2257 if (!print_unknown_data(ndo
, pptr
, "\n\t ", ISIS_IIH_LAN_HEADER_SIZE
))
2261 packet_len
-= (ISIS_COMMON_HEADER_SIZE
+ISIS_IIH_LAN_HEADER_SIZE
);
2262 pptr
= p
+ (ISIS_COMMON_HEADER_SIZE
+ISIS_IIH_LAN_HEADER_SIZE
);
2265 case ISIS_PDU_PTP_IIH
:
2266 if (isis_header
->fixed_len
!= (ISIS_COMMON_HEADER_SIZE
+ISIS_IIH_PTP_HEADER_SIZE
)) {
2267 ND_PRINT((ndo
, ", bogus fixed header length %u should be %lu",
2268 isis_header
->fixed_len
, (unsigned long)ISIS_IIH_PTP_HEADER_SIZE
));
2272 pdu_len
=EXTRACT_16BITS(header_iih_ptp
->pdu_len
);
2273 if (packet_len
>pdu_len
) {
2274 packet_len
=pdu_len
; /* do TLV decoding as long as it makes sense */
2278 ND_TCHECK(*header_iih_ptp
);
2279 ND_PRINT((ndo
, "\n\t source-id: %s, holding time: %us, Flags: [%s]",
2280 isis_print_id(header_iih_ptp
->source_id
,SYSTEM_ID_LEN
),
2281 EXTRACT_16BITS(header_iih_ptp
->holding_time
),
2282 tok2str(isis_iih_circuit_type_values
,
2283 "unknown circuit type 0x%02x",
2284 header_iih_ptp
->circuit_type
)));
2286 ND_PRINT((ndo
, "\n\t circuit-id: 0x%02x, PDU length: %u",
2287 header_iih_ptp
->circuit_id
,
2290 if (ndo
->ndo_vflag
> 1) {
2291 if (!print_unknown_data(ndo
, pptr
, "\n\t ", ISIS_IIH_PTP_HEADER_SIZE
))
2295 packet_len
-= (ISIS_COMMON_HEADER_SIZE
+ISIS_IIH_PTP_HEADER_SIZE
);
2296 pptr
= p
+ (ISIS_COMMON_HEADER_SIZE
+ISIS_IIH_PTP_HEADER_SIZE
);
2299 case ISIS_PDU_L1_LSP
:
2300 case ISIS_PDU_L2_LSP
:
2301 if (isis_header
->fixed_len
!= (ISIS_COMMON_HEADER_SIZE
+ISIS_LSP_HEADER_SIZE
)) {
2302 ND_PRINT((ndo
, ", bogus fixed header length %u should be %lu",
2303 isis_header
->fixed_len
, (unsigned long)ISIS_LSP_HEADER_SIZE
));
2307 pdu_len
=EXTRACT_16BITS(header_lsp
->pdu_len
);
2308 if (packet_len
>pdu_len
) {
2309 packet_len
=pdu_len
; /* do TLV decoding as long as it makes sense */
2313 ND_TCHECK(*header_lsp
);
2314 ND_PRINT((ndo
, "\n\t lsp-id: %s, seq: 0x%08x, lifetime: %5us\n\t chksum: 0x%04x",
2315 isis_print_id(header_lsp
->lsp_id
, LSP_ID_LEN
),
2316 EXTRACT_32BITS(header_lsp
->sequence_number
),
2317 EXTRACT_16BITS(header_lsp
->remaining_lifetime
),
2318 EXTRACT_16BITS(header_lsp
->checksum
)));
2321 osi_print_cksum(ndo
, (uint8_t *)header_lsp
->lsp_id
,
2322 EXTRACT_16BITS(header_lsp
->checksum
), 12, length
-12);
2325 * Clear checksum and lifetime prior to signature verification.
2327 header_lsp
->checksum
[0] = 0;
2328 header_lsp
->checksum
[1] = 0;
2329 header_lsp
->remaining_lifetime
[0] = 0;
2330 header_lsp
->remaining_lifetime
[1] = 0;
2333 ND_PRINT((ndo
, ", PDU length: %u, Flags: [ %s",
2335 ISIS_MASK_LSP_OL_BIT(header_lsp
->typeblock
) ? "Overload bit set, " : ""));
2337 if (ISIS_MASK_LSP_ATT_BITS(header_lsp
->typeblock
)) {
2338 ND_PRINT((ndo
, "%s", ISIS_MASK_LSP_ATT_DEFAULT_BIT(header_lsp
->typeblock
) ? "default " : ""));
2339 ND_PRINT((ndo
, "%s", ISIS_MASK_LSP_ATT_DELAY_BIT(header_lsp
->typeblock
) ? "delay " : ""));
2340 ND_PRINT((ndo
, "%s", ISIS_MASK_LSP_ATT_EXPENSE_BIT(header_lsp
->typeblock
) ? "expense " : ""));
2341 ND_PRINT((ndo
, "%s", ISIS_MASK_LSP_ATT_ERROR_BIT(header_lsp
->typeblock
) ? "error " : ""));
2342 ND_PRINT((ndo
, "ATT bit set, "));
2344 ND_PRINT((ndo
, "%s", ISIS_MASK_LSP_PARTITION_BIT(header_lsp
->typeblock
) ? "P bit set, " : ""));
2345 ND_PRINT((ndo
, "%s ]", tok2str(isis_lsp_istype_values
, "Unknown(0x%x)",
2346 ISIS_MASK_LSP_ISTYPE_BITS(header_lsp
->typeblock
))));
2348 if (ndo
->ndo_vflag
> 1) {
2349 if (!print_unknown_data(ndo
, pptr
, "\n\t ", ISIS_LSP_HEADER_SIZE
))
2353 packet_len
-= (ISIS_COMMON_HEADER_SIZE
+ISIS_LSP_HEADER_SIZE
);
2354 pptr
= p
+ (ISIS_COMMON_HEADER_SIZE
+ISIS_LSP_HEADER_SIZE
);
2357 case ISIS_PDU_L1_CSNP
:
2358 case ISIS_PDU_L2_CSNP
:
2359 if (isis_header
->fixed_len
!= (ISIS_COMMON_HEADER_SIZE
+ISIS_CSNP_HEADER_SIZE
)) {
2360 ND_PRINT((ndo
, ", bogus fixed header length %u should be %lu",
2361 isis_header
->fixed_len
, (unsigned long)ISIS_CSNP_HEADER_SIZE
));
2365 pdu_len
=EXTRACT_16BITS(header_csnp
->pdu_len
);
2366 if (packet_len
>pdu_len
) {
2367 packet_len
=pdu_len
; /* do TLV decoding as long as it makes sense */
2371 ND_TCHECK(*header_csnp
);
2372 ND_PRINT((ndo
, "\n\t source-id: %s, PDU length: %u",
2373 isis_print_id(header_csnp
->source_id
, NODE_ID_LEN
),
2375 ND_PRINT((ndo
, "\n\t start lsp-id: %s",
2376 isis_print_id(header_csnp
->start_lsp_id
, LSP_ID_LEN
)));
2377 ND_PRINT((ndo
, "\n\t end lsp-id: %s",
2378 isis_print_id(header_csnp
->end_lsp_id
, LSP_ID_LEN
)));
2380 if (ndo
->ndo_vflag
> 1) {
2381 if (!print_unknown_data(ndo
, pptr
, "\n\t ", ISIS_CSNP_HEADER_SIZE
))
2385 packet_len
-= (ISIS_COMMON_HEADER_SIZE
+ISIS_CSNP_HEADER_SIZE
);
2386 pptr
= p
+ (ISIS_COMMON_HEADER_SIZE
+ISIS_CSNP_HEADER_SIZE
);
2389 case ISIS_PDU_L1_PSNP
:
2390 case ISIS_PDU_L2_PSNP
:
2391 if (isis_header
->fixed_len
!= (ISIS_COMMON_HEADER_SIZE
+ISIS_PSNP_HEADER_SIZE
)) {
2392 ND_PRINT((ndo
, "- bogus fixed header length %u should be %lu",
2393 isis_header
->fixed_len
, (unsigned long)ISIS_PSNP_HEADER_SIZE
));
2397 pdu_len
=EXTRACT_16BITS(header_psnp
->pdu_len
);
2398 if (packet_len
>pdu_len
) {
2399 packet_len
=pdu_len
; /* do TLV decoding as long as it makes sense */
2403 ND_TCHECK(*header_psnp
);
2404 ND_PRINT((ndo
, "\n\t source-id: %s, PDU length: %u",
2405 isis_print_id(header_psnp
->source_id
, NODE_ID_LEN
),
2408 if (ndo
->ndo_vflag
> 1) {
2409 if (!print_unknown_data(ndo
, pptr
, "\n\t ", ISIS_PSNP_HEADER_SIZE
))
2413 packet_len
-= (ISIS_COMMON_HEADER_SIZE
+ISIS_PSNP_HEADER_SIZE
);
2414 pptr
= p
+ (ISIS_COMMON_HEADER_SIZE
+ISIS_PSNP_HEADER_SIZE
);
2418 (void)print_unknown_data(ndo
, pptr
, "\n\t ", length
);
2423 * Now print the TLV's.
2426 while (packet_len
>= 2) {
2427 if (pptr
== ndo
->ndo_snapend
) {
2431 if (!ND_TTEST2(*pptr
, 2)) {
2432 ND_PRINT((ndo
, "\n\t\t packet exceeded snapshot (%ld) bytes",
2433 (long)(pptr
- ndo
->ndo_snapend
)));
2438 tmp
=tlv_len
; /* copy temporary len & pointer to packet data */
2441 if (tlv_len
> packet_len
) {
2445 /* first lets see if we know the TLVs name*/
2446 ND_PRINT((ndo
, "\n\t %s TLV #%u, length: %u",
2447 tok2str(isis_tlv_values
,
2453 if (tlv_len
== 0) /* something is malformed */
2456 /* now check if we have a decoder otherwise do a hexdump at the end*/
2458 case ISIS_TLV_AREA_ADDR
:
2459 if (!ND_TTEST2(*tptr
, 1))
2462 while (tmp
&& alen
< tmp
) {
2463 ND_PRINT((ndo
, "\n\t Area address (length: %u): %s",
2465 isonsap_string(tptr
, alen
)));
2468 if (tmp
==0) /* if this is the last area address do not attemt a boundary check */
2470 if (!ND_TTEST2(*tptr
, 1))
2475 case ISIS_TLV_ISNEIGH
:
2476 while (tmp
>= ETHER_ADDR_LEN
) {
2477 if (!ND_TTEST2(*tptr
, ETHER_ADDR_LEN
))
2479 ND_PRINT((ndo
, "\n\t SNPA: %s", isis_print_id(tptr
, ETHER_ADDR_LEN
)));
2480 tmp
-= ETHER_ADDR_LEN
;
2481 tptr
+= ETHER_ADDR_LEN
;
2485 case ISIS_TLV_ISNEIGH_VARLEN
:
2486 if (!ND_TTEST2(*tptr
, 1) || tmp
< 3) /* min. TLV length */
2488 lan_alen
= *tptr
++; /* LAN address length */
2489 if (lan_alen
== 0) {
2490 ND_PRINT((ndo
, "\n\t LAN address length 0 bytes (invalid)"));
2494 ND_PRINT((ndo
, "\n\t LAN address length %u bytes ", lan_alen
));
2495 while (tmp
>= lan_alen
) {
2496 if (!ND_TTEST2(*tptr
, lan_alen
))
2498 ND_PRINT((ndo
, "\n\t\tIS Neighbor: %s", isis_print_id(tptr
, lan_alen
)));
2504 case ISIS_TLV_PADDING
:
2507 case ISIS_TLV_MT_IS_REACH
:
2508 mt_len
= isis_print_mtid(ndo
, tptr
, "\n\t ");
2509 if (mt_len
== 0) /* did something go wrong ? */
2513 while (tmp
>= 2+NODE_ID_LEN
+3+1) {
2514 ext_is_len
= isis_print_ext_is_reach(ndo
, tptr
, "\n\t ", tlv_type
);
2515 if (ext_is_len
== 0) /* did something go wrong ? */
2523 case ISIS_TLV_IS_ALIAS_ID
:
2524 while (tmp
>= NODE_ID_LEN
+1) { /* is it worth attempting a decode ? */
2525 ext_is_len
= isis_print_ext_is_reach(ndo
, tptr
, "\n\t ", tlv_type
);
2526 if (ext_is_len
== 0) /* did something go wrong ? */
2533 case ISIS_TLV_EXT_IS_REACH
:
2534 while (tmp
>= NODE_ID_LEN
+3+1) { /* is it worth attempting a decode ? */
2535 ext_is_len
= isis_print_ext_is_reach(ndo
, tptr
, "\n\t ", tlv_type
);
2536 if (ext_is_len
== 0) /* did something go wrong ? */
2542 case ISIS_TLV_IS_REACH
:
2543 if (!ND_TTEST2(*tptr
,1)) /* check if there is one byte left to read out the virtual flag */
2545 ND_PRINT((ndo
, "\n\t %s",
2546 tok2str(isis_is_reach_virtual_values
,
2547 "bogus virtual flag 0x%02x",
2549 tlv_is_reach
= (const struct isis_tlv_is_reach
*)tptr
;
2550 while (tmp
>= sizeof(struct isis_tlv_is_reach
)) {
2551 if (!ND_TTEST(*tlv_is_reach
))
2553 ND_PRINT((ndo
, "\n\t IS Neighbor: %s",
2554 isis_print_id(tlv_is_reach
->neighbor_nodeid
, NODE_ID_LEN
)));
2555 isis_print_metric_block(ndo
, &tlv_is_reach
->isis_metric_block
);
2556 tmp
-= sizeof(struct isis_tlv_is_reach
);
2561 case ISIS_TLV_ESNEIGH
:
2562 tlv_es_reach
= (const struct isis_tlv_es_reach
*)tptr
;
2563 while (tmp
>= sizeof(struct isis_tlv_es_reach
)) {
2564 if (!ND_TTEST(*tlv_es_reach
))
2566 ND_PRINT((ndo
, "\n\t ES Neighbor: %s",
2567 isis_print_id(tlv_es_reach
->neighbor_sysid
, SYSTEM_ID_LEN
)));
2568 isis_print_metric_block(ndo
, &tlv_es_reach
->isis_metric_block
);
2569 tmp
-= sizeof(struct isis_tlv_es_reach
);
2574 /* those two TLVs share the same format */
2575 case ISIS_TLV_INT_IP_REACH
:
2576 case ISIS_TLV_EXT_IP_REACH
:
2577 if (!isis_print_tlv_ip_reach(ndo
, pptr
, "\n\t ", tlv_len
))
2581 case ISIS_TLV_EXTD_IP_REACH
:
2583 ext_ip_len
= isis_print_extd_ip_reach(ndo
, tptr
, "\n\t ", AF_INET
);
2584 if (ext_ip_len
== 0) /* did something go wrong ? */
2591 case ISIS_TLV_MT_IP_REACH
:
2592 mt_len
= isis_print_mtid(ndo
, tptr
, "\n\t ");
2593 if (mt_len
== 0) { /* did something go wrong ? */
2600 ext_ip_len
= isis_print_extd_ip_reach(ndo
, tptr
, "\n\t ", AF_INET
);
2601 if (ext_ip_len
== 0) /* did something go wrong ? */
2609 case ISIS_TLV_IP6_REACH
:
2611 ext_ip_len
= isis_print_extd_ip_reach(ndo
, tptr
, "\n\t ", AF_INET6
);
2612 if (ext_ip_len
== 0) /* did something go wrong ? */
2619 case ISIS_TLV_MT_IP6_REACH
:
2620 mt_len
= isis_print_mtid(ndo
, tptr
, "\n\t ");
2621 if (mt_len
== 0) { /* did something go wrong ? */
2628 ext_ip_len
= isis_print_extd_ip_reach(ndo
, tptr
, "\n\t ", AF_INET6
);
2629 if (ext_ip_len
== 0) /* did something go wrong ? */
2636 case ISIS_TLV_IP6ADDR
:
2637 while (tmp
>=sizeof(struct in6_addr
)) {
2638 if (!ND_TTEST2(*tptr
, sizeof(struct in6_addr
)))
2641 ND_PRINT((ndo
, "\n\t IPv6 interface address: %s",
2642 ip6addr_string(ndo
, tptr
)));
2644 tptr
+= sizeof(struct in6_addr
);
2645 tmp
-= sizeof(struct in6_addr
);
2650 if (!ND_TTEST2(*tptr
, 1))
2653 ND_PRINT((ndo
, "\n\t %s: ",
2654 tok2str(isis_subtlv_auth_values
,
2655 "unknown Authentication type 0x%02x",
2659 case ISIS_SUBTLV_AUTH_SIMPLE
:
2660 for(i
=1;i
<tlv_len
;i
++) {
2661 if (!ND_TTEST2(*(tptr
+ i
), 1))
2663 ND_PRINT((ndo
, "%c", *(tptr
+ i
)));
2666 case ISIS_SUBTLV_AUTH_MD5
:
2667 for(i
=1;i
<tlv_len
;i
++) {
2668 if (!ND_TTEST2(*(tptr
+ i
), 1))
2670 ND_PRINT((ndo
, "%02x", *(tptr
+ i
)));
2672 if (tlv_len
!= ISIS_SUBTLV_AUTH_MD5_LEN
+1)
2673 ND_PRINT((ndo
, ", (malformed subTLV) "));
2675 #ifdef HAVE_LIBCRYPTO
2676 sigcheck
= signature_verify(ndo
, optr
, length
,
2677 (unsigned char *)tptr
+ 1);
2679 sigcheck
= CANT_CHECK_SIGNATURE
;
2681 ND_PRINT((ndo
, " (%s)", tok2str(signature_check_values
, "Unknown", sigcheck
)));
2684 case ISIS_SUBTLV_AUTH_GENERIC
:
2685 key_id
= EXTRACT_16BITS((tptr
+1));
2686 ND_PRINT((ndo
, "%u, password: ", key_id
));
2687 for(i
=1 + sizeof(uint16_t);i
<tlv_len
;i
++) {
2688 if (!ND_TTEST2(*(tptr
+ i
), 1))
2690 ND_PRINT((ndo
, "%02x", *(tptr
+ i
)));
2693 case ISIS_SUBTLV_AUTH_PRIVATE
:
2695 if (!print_unknown_data(ndo
, tptr
+ 1, "\n\t\t ", tlv_len
- 1))
2701 case ISIS_TLV_PTP_ADJ
:
2702 tlv_ptp_adj
= (const struct isis_tlv_ptp_adj
*)tptr
;
2704 if (!ND_TTEST2(*tptr
, 1))
2706 ND_PRINT((ndo
, "\n\t Adjacency State: %s (%u)",
2707 tok2str(isis_ptp_adjancey_values
, "unknown", *tptr
),
2711 if(tmp
>sizeof(tlv_ptp_adj
->extd_local_circuit_id
)) {
2712 if (!ND_TTEST2(tlv_ptp_adj
->extd_local_circuit_id
,
2713 sizeof(tlv_ptp_adj
->extd_local_circuit_id
)))
2715 ND_PRINT((ndo
, "\n\t Extended Local circuit-ID: 0x%08x",
2716 EXTRACT_32BITS(tlv_ptp_adj
->extd_local_circuit_id
)));
2717 tmp
-=sizeof(tlv_ptp_adj
->extd_local_circuit_id
);
2719 if(tmp
>=SYSTEM_ID_LEN
) {
2720 if (!ND_TTEST2(tlv_ptp_adj
->neighbor_sysid
, SYSTEM_ID_LEN
))
2722 ND_PRINT((ndo
, "\n\t Neighbor System-ID: %s",
2723 isis_print_id(tlv_ptp_adj
->neighbor_sysid
, SYSTEM_ID_LEN
)));
2726 if(tmp
>=sizeof(tlv_ptp_adj
->neighbor_extd_local_circuit_id
)) {
2727 if (!ND_TTEST2(tlv_ptp_adj
->neighbor_extd_local_circuit_id
,
2728 sizeof(tlv_ptp_adj
->neighbor_extd_local_circuit_id
)))
2730 ND_PRINT((ndo
, "\n\t Neighbor Extended Local circuit-ID: 0x%08x",
2731 EXTRACT_32BITS(tlv_ptp_adj
->neighbor_extd_local_circuit_id
)));
2735 case ISIS_TLV_PROTOCOLS
:
2736 ND_PRINT((ndo
, "\n\t NLPID(s): "));
2738 if (!ND_TTEST2(*(tptr
), 1))
2740 ND_PRINT((ndo
, "%s (0x%02x)",
2741 tok2str(nlpid_values
,
2745 if (tmp
>1) /* further NPLIDs ? - put comma */
2746 ND_PRINT((ndo
, ", "));
2752 case ISIS_TLV_MT_PORT_CAP
:
2754 if (!ND_TTEST2(*(tptr
), 2))
2757 ND_PRINT((ndo
, "\n\t RES: %d, MTID(s): %d",
2758 (EXTRACT_16BITS (tptr
) >> 12),
2759 (EXTRACT_16BITS (tptr
) & 0x0fff)));
2765 isis_print_mt_port_cap_subtlv(ndo
, tptr
, tmp
);
2770 case ISIS_TLV_MT_CAPABILITY
:
2772 if (!ND_TTEST2(*(tptr
), 2))
2775 ND_PRINT((ndo
, "\n\t O: %d, RES: %d, MTID(s): %d",
2776 (EXTRACT_16BITS(tptr
) >> 15) & 0x01,
2777 (EXTRACT_16BITS(tptr
) >> 12) & 0x07,
2778 EXTRACT_16BITS(tptr
) & 0x0fff));
2784 isis_print_mt_capability_subtlv(ndo
, tptr
, tmp
);
2788 case ISIS_TLV_TE_ROUTER_ID
:
2789 if (!ND_TTEST2(*pptr
, sizeof(struct in_addr
)))
2791 ND_PRINT((ndo
, "\n\t Traffic Engineering Router ID: %s", ipaddr_string(ndo
, pptr
)));
2794 case ISIS_TLV_IPADDR
:
2795 while (tmp
>=sizeof(struct in_addr
)) {
2796 if (!ND_TTEST2(*tptr
, sizeof(struct in_addr
)))
2798 ND_PRINT((ndo
, "\n\t IPv4 interface address: %s", ipaddr_string(ndo
, tptr
)));
2799 tptr
+= sizeof(struct in_addr
);
2800 tmp
-= sizeof(struct in_addr
);
2804 case ISIS_TLV_HOSTNAME
:
2805 ND_PRINT((ndo
, "\n\t Hostname: "));
2807 if (!ND_TTEST2(*tptr
, 1))
2809 ND_PRINT((ndo
, "%c", *tptr
++));
2814 case ISIS_TLV_SHARED_RISK_GROUP
:
2815 if (tmp
< NODE_ID_LEN
)
2817 if (!ND_TTEST2(*tptr
, NODE_ID_LEN
))
2819 ND_PRINT((ndo
, "\n\t IS Neighbor: %s", isis_print_id(tptr
, NODE_ID_LEN
)));
2820 tptr
+=(NODE_ID_LEN
);
2825 if (!ND_TTEST2(*tptr
, 1))
2827 ND_PRINT((ndo
, ", Flags: [%s]", ISIS_MASK_TLV_SHARED_RISK_GROUP(*tptr
++) ? "numbered" : "unnumbered"));
2830 if (tmp
< sizeof(struct in_addr
))
2832 if (!ND_TTEST2(*tptr
, sizeof(struct in_addr
)))
2834 ND_PRINT((ndo
, "\n\t IPv4 interface address: %s", ipaddr_string(ndo
, tptr
)));
2835 tptr
+=sizeof(struct in_addr
);
2836 tmp
-=sizeof(struct in_addr
);
2838 if (tmp
< sizeof(struct in_addr
))
2840 if (!ND_TTEST2(*tptr
, sizeof(struct in_addr
)))
2842 ND_PRINT((ndo
, "\n\t IPv4 neighbor address: %s", ipaddr_string(ndo
, tptr
)));
2843 tptr
+=sizeof(struct in_addr
);
2844 tmp
-=sizeof(struct in_addr
);
2847 if (!ND_TTEST2(*tptr
, 4))
2849 ND_PRINT((ndo
, "\n\t Link-ID: 0x%08x", EXTRACT_32BITS(tptr
)));
2856 tlv_lsp
= (const struct isis_tlv_lsp
*)tptr
;
2857 while(tmp
>=sizeof(struct isis_tlv_lsp
)) {
2858 if (!ND_TTEST((tlv_lsp
->lsp_id
)[LSP_ID_LEN
-1]))
2860 ND_PRINT((ndo
, "\n\t lsp-id: %s",
2861 isis_print_id(tlv_lsp
->lsp_id
, LSP_ID_LEN
)));
2862 if (!ND_TTEST2(tlv_lsp
->sequence_number
, 4))
2864 ND_PRINT((ndo
, ", seq: 0x%08x", EXTRACT_32BITS(tlv_lsp
->sequence_number
)));
2865 if (!ND_TTEST2(tlv_lsp
->remaining_lifetime
, 2))
2867 ND_PRINT((ndo
, ", lifetime: %5ds", EXTRACT_16BITS(tlv_lsp
->remaining_lifetime
)));
2868 if (!ND_TTEST2(tlv_lsp
->checksum
, 2))
2870 ND_PRINT((ndo
, ", chksum: 0x%04x", EXTRACT_16BITS(tlv_lsp
->checksum
)));
2871 tmp
-=sizeof(struct isis_tlv_lsp
);
2876 case ISIS_TLV_CHECKSUM
:
2877 if (tmp
< ISIS_TLV_CHECKSUM_MINLEN
)
2879 if (!ND_TTEST2(*tptr
, ISIS_TLV_CHECKSUM_MINLEN
))
2881 ND_PRINT((ndo
, "\n\t checksum: 0x%04x ", EXTRACT_16BITS(tptr
)));
2882 /* do not attempt to verify the checksum if it is zero
2883 * most likely a HMAC-MD5 TLV is also present and
2884 * to avoid conflicts the checksum TLV is zeroed.
2885 * see rfc3358 for details
2887 osi_print_cksum(ndo
, optr
, EXTRACT_16BITS(tptr
), tptr
-optr
, length
);
2891 if (tlv_len
>= SYSTEM_ID_LEN
+ 1) {
2892 if (!ND_TTEST2(*tptr
, SYSTEM_ID_LEN
+ 1))
2894 ND_PRINT((ndo
, "\n\t Purge Originator System-ID: %s",
2895 isis_print_id(tptr
+ 1, SYSTEM_ID_LEN
)));
2898 if (tlv_len
== 2 * SYSTEM_ID_LEN
+ 1) {
2899 if (!ND_TTEST2(*tptr
, 2 * SYSTEM_ID_LEN
+ 1))
2901 ND_PRINT((ndo
, "\n\t Received from System-ID: %s",
2902 isis_print_id(tptr
+ SYSTEM_ID_LEN
+ 1, SYSTEM_ID_LEN
)));
2906 case ISIS_TLV_MT_SUPPORTED
:
2907 if (tmp
< ISIS_TLV_MT_SUPPORTED_MINLEN
)
2910 /* length can only be a multiple of 2, otherwise there is
2911 something broken -> so decode down until length is 1 */
2913 mt_len
= isis_print_mtid(ndo
, tptr
, "\n\t ");
2914 if (mt_len
== 0) /* did something go wrong ? */
2919 ND_PRINT((ndo
, "\n\t malformed MT-ID"));
2925 case ISIS_TLV_RESTART_SIGNALING
:
2926 /* first attempt to decode the flags */
2927 if (tmp
< ISIS_TLV_RESTART_SIGNALING_FLAGLEN
)
2929 if (!ND_TTEST2(*tptr
, ISIS_TLV_RESTART_SIGNALING_FLAGLEN
))
2931 ND_PRINT((ndo
, "\n\t Flags [%s]",
2932 bittok2str(isis_restart_flag_values
, "none", *tptr
)));
2933 tptr
+=ISIS_TLV_RESTART_SIGNALING_FLAGLEN
;
2934 tmp
-=ISIS_TLV_RESTART_SIGNALING_FLAGLEN
;
2936 /* is there anything other than the flags field? */
2940 if (tmp
< ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN
)
2942 if (!ND_TTEST2(*tptr
, ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN
))
2945 ND_PRINT((ndo
, ", Remaining holding time %us", EXTRACT_16BITS(tptr
)));
2946 tptr
+=ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN
;
2947 tmp
-=ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN
;
2949 /* is there an additional sysid field present ?*/
2950 if (tmp
== SYSTEM_ID_LEN
) {
2951 if (!ND_TTEST2(*tptr
, SYSTEM_ID_LEN
))
2953 ND_PRINT((ndo
, ", for %s", isis_print_id(tptr
,SYSTEM_ID_LEN
)));
2957 case ISIS_TLV_IDRP_INFO
:
2958 if (tmp
< ISIS_TLV_IDRP_INFO_MINLEN
)
2960 if (!ND_TTEST2(*tptr
, ISIS_TLV_IDRP_INFO_MINLEN
))
2962 ND_PRINT((ndo
, "\n\t Inter-Domain Information Type: %s",
2963 tok2str(isis_subtlv_idrp_values
,
2967 case ISIS_SUBTLV_IDRP_ASN
:
2968 if (!ND_TTEST2(*tptr
, 2)) /* fetch AS number */
2970 ND_PRINT((ndo
, "AS Number: %u", EXTRACT_16BITS(tptr
)));
2972 case ISIS_SUBTLV_IDRP_LOCAL
:
2973 case ISIS_SUBTLV_IDRP_RES
:
2975 if (!print_unknown_data(ndo
, tptr
, "\n\t ", tlv_len
- 1))
2981 case ISIS_TLV_LSP_BUFFERSIZE
:
2982 if (tmp
< ISIS_TLV_LSP_BUFFERSIZE_MINLEN
)
2984 if (!ND_TTEST2(*tptr
, ISIS_TLV_LSP_BUFFERSIZE_MINLEN
))
2986 ND_PRINT((ndo
, "\n\t LSP Buffersize: %u", EXTRACT_16BITS(tptr
)));
2989 case ISIS_TLV_PART_DIS
:
2990 while (tmp
>= SYSTEM_ID_LEN
) {
2991 if (!ND_TTEST2(*tptr
, SYSTEM_ID_LEN
))
2993 ND_PRINT((ndo
, "\n\t %s", isis_print_id(tptr
, SYSTEM_ID_LEN
)));
2994 tptr
+=SYSTEM_ID_LEN
;
2999 case ISIS_TLV_PREFIX_NEIGH
:
3000 if (tmp
< sizeof(struct isis_metric_block
))
3002 if (!ND_TTEST2(*tptr
, sizeof(struct isis_metric_block
)))
3004 ND_PRINT((ndo
, "\n\t Metric Block"));
3005 isis_print_metric_block(ndo
, (const struct isis_metric_block
*)tptr
);
3006 tptr
+=sizeof(struct isis_metric_block
);
3007 tmp
-=sizeof(struct isis_metric_block
);
3010 if (!ND_TTEST2(*tptr
, 1))
3012 prefix_len
=*tptr
++; /* read out prefix length in semioctets*/
3013 if (prefix_len
< 2) {
3014 ND_PRINT((ndo
, "\n\t\tAddress: prefix length %u < 2", prefix_len
));
3018 if (tmp
< prefix_len
/2)
3020 if (!ND_TTEST2(*tptr
, prefix_len
/ 2))
3022 ND_PRINT((ndo
, "\n\t\tAddress: %s/%u",
3023 isonsap_string(tptr
, prefix_len
/ 2), prefix_len
* 4));
3029 case ISIS_TLV_IIH_SEQNR
:
3030 if (tmp
< ISIS_TLV_IIH_SEQNR_MINLEN
)
3032 if (!ND_TTEST2(*tptr
, ISIS_TLV_IIH_SEQNR_MINLEN
)) /* check if four bytes are on the wire */
3034 ND_PRINT((ndo
, "\n\t Sequence number: %u", EXTRACT_32BITS(tptr
)));
3037 case ISIS_TLV_VENDOR_PRIVATE
:
3038 if (tmp
< ISIS_TLV_VENDOR_PRIVATE_MINLEN
)
3040 if (!ND_TTEST2(*tptr
, ISIS_TLV_VENDOR_PRIVATE_MINLEN
)) /* check if enough byte for a full oui */
3042 vendor_id
= EXTRACT_24BITS(tptr
);
3043 ND_PRINT((ndo
, "\n\t Vendor: %s (%u)",
3044 tok2str(oui_values
, "Unknown", vendor_id
),
3048 if (tmp
> 0) /* hexdump the rest */
3049 if (!print_unknown_data(ndo
, tptr
, "\n\t\t", tmp
))
3053 * FIXME those are the defined TLVs that lack a decoder
3054 * you are welcome to contribute code ;-)
3057 case ISIS_TLV_DECNET_PHASE4
:
3058 case ISIS_TLV_LUCENT_PRIVATE
:
3059 case ISIS_TLV_IPAUTH
:
3060 case ISIS_TLV_NORTEL_PRIVATE1
:
3061 case ISIS_TLV_NORTEL_PRIVATE2
:
3064 if (ndo
->ndo_vflag
<= 1) {
3065 if (!print_unknown_data(ndo
, pptr
, "\n\t\t", tlv_len
))
3070 /* do we want to see an additionally hexdump ? */
3071 if (ndo
->ndo_vflag
> 1) {
3072 if (!print_unknown_data(ndo
, pptr
, "\n\t ", tlv_len
))
3077 packet_len
-= tlv_len
;
3080 if (packet_len
!= 0) {
3081 ND_PRINT((ndo
, "\n\t %u straggler bytes", packet_len
));
3086 ND_PRINT((ndo
, "[|isis]"));
3090 ND_PRINT((ndo
, "\n\t\t packet exceeded snapshot"));
3095 osi_print_cksum(netdissect_options
*ndo
, const uint8_t *pptr
,
3096 uint16_t checksum
, int checksum_offset
, int length
)
3098 uint16_t calculated_checksum
;
3100 /* do not attempt to verify the checksum if it is zero,
3101 * if the total length is nonsense,
3102 * if the offset is nonsense,
3103 * or the base pointer is not sane
3107 || checksum_offset
< 0
3108 || length
> ndo
->ndo_snaplen
3109 || checksum_offset
> ndo
->ndo_snaplen
3110 || checksum_offset
> length
) {
3111 ND_PRINT((ndo
, " (unverified)"));
3113 const char *truncated
= "trunc";
3115 printf("\nosi_print_cksum: %p %u %u %u\n", pptr
, checksum_offset
, length
, ndo
->ndo_snaplen
);
3116 ND_TCHECK2(pptr
, checksum_offset
+length
);
3118 calculated_checksum
= create_osi_cksum(pptr
, checksum_offset
, length
);
3119 if (checksum
== calculated_checksum
) {
3120 ND_PRINT((ndo
, " (correct)"));
3122 truncated
= "incorrect";
3126 ND_PRINT((ndo
, " (%s should be 0x%04x)", truncated
, calculated_checksum
));
3133 * c-style: whitesmith