2 * Copyright (c) 1992, 1993, 1994, 1995, 1996
3 * The Regents of the University of California. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that: (1) source code distributions
7 * retain the above copyright notice and this paragraph in its entirety, (2)
8 * distributions including binary code include the above copyright notice and
9 * this paragraph in its entirety in the documentation or other materials
10 * provided with the distribution, and (3) all advertising materials mentioning
11 * features or use of this software display the following acknowledgement:
12 * ``This product includes software developed by the University of California,
13 * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
14 * the University nor the names of its contributors may be used to endorse
15 * or promote products derived from this software without specific prior
17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21 * Original code by Matt Thomas, Digital Equipment Corporation
23 * Extensively modified by Hannes Gredler (hannes@gredler.at) for more
24 * complete IS-IS & CLNP support.
27 /* \summary: ISO CLNS, ESIS, and ISIS printer */
33 #include <netdissect-stdinc.h>
37 #include "netdissect.h"
38 #include "addrtoname.h"
44 #include "signature.h"
46 static const char tstr
[] = " [|isis]";
49 * IS-IS is defined in ISO 10589. Look there for protocol definitions.
52 #define SYSTEM_ID_LEN ETHER_ADDR_LEN
53 #define NODE_ID_LEN SYSTEM_ID_LEN+1
54 #define LSP_ID_LEN SYSTEM_ID_LEN+2
56 #define ISIS_VERSION 1
57 #define ESIS_VERSION 1
58 #define CLNP_VERSION 1
60 #define ISIS_PDU_TYPE_MASK 0x1F
61 #define ESIS_PDU_TYPE_MASK 0x1F
62 #define CLNP_PDU_TYPE_MASK 0x1F
63 #define CLNP_FLAG_MASK 0xE0
64 #define ISIS_LAN_PRIORITY_MASK 0x7F
66 #define ISIS_PDU_L1_LAN_IIH 15
67 #define ISIS_PDU_L2_LAN_IIH 16
68 #define ISIS_PDU_PTP_IIH 17
69 #define ISIS_PDU_L1_LSP 18
70 #define ISIS_PDU_L2_LSP 20
71 #define ISIS_PDU_L1_CSNP 24
72 #define ISIS_PDU_L2_CSNP 25
73 #define ISIS_PDU_L1_PSNP 26
74 #define ISIS_PDU_L2_PSNP 27
76 static const struct tok isis_pdu_values
[] = {
77 { ISIS_PDU_L1_LAN_IIH
, "L1 Lan IIH"},
78 { ISIS_PDU_L2_LAN_IIH
, "L2 Lan IIH"},
79 { ISIS_PDU_PTP_IIH
, "p2p IIH"},
80 { ISIS_PDU_L1_LSP
, "L1 LSP"},
81 { ISIS_PDU_L2_LSP
, "L2 LSP"},
82 { ISIS_PDU_L1_CSNP
, "L1 CSNP"},
83 { ISIS_PDU_L2_CSNP
, "L2 CSNP"},
84 { ISIS_PDU_L1_PSNP
, "L1 PSNP"},
85 { ISIS_PDU_L2_PSNP
, "L2 PSNP"},
90 * A TLV is a tuple of a type, length and a value and is normally used for
91 * encoding information in all sorts of places. This is an enumeration of
92 * the well known types.
94 * list taken from rfc3359 plus some memory from veterans ;-)
97 #define ISIS_TLV_AREA_ADDR 1 /* iso10589 */
98 #define ISIS_TLV_IS_REACH 2 /* iso10589 */
99 #define ISIS_TLV_ESNEIGH 3 /* iso10589 */
100 #define ISIS_TLV_PART_DIS 4 /* iso10589 */
101 #define ISIS_TLV_PREFIX_NEIGH 5 /* iso10589 */
102 #define ISIS_TLV_ISNEIGH 6 /* iso10589 */
103 #define ISIS_TLV_ISNEIGH_VARLEN 7 /* iso10589 */
104 #define ISIS_TLV_PADDING 8 /* iso10589 */
105 #define ISIS_TLV_LSP 9 /* iso10589 */
106 #define ISIS_TLV_AUTH 10 /* iso10589, rfc3567 */
107 #define ISIS_TLV_CHECKSUM 12 /* rfc3358 */
108 #define ISIS_TLV_CHECKSUM_MINLEN 2
109 #define ISIS_TLV_POI 13 /* rfc6232 */
110 #define ISIS_TLV_LSP_BUFFERSIZE 14 /* iso10589 rev2 */
111 #define ISIS_TLV_LSP_BUFFERSIZE_MINLEN 2
112 #define ISIS_TLV_EXT_IS_REACH 22 /* draft-ietf-isis-traffic-05 */
113 #define ISIS_TLV_IS_ALIAS_ID 24 /* draft-ietf-isis-ext-lsp-frags-02 */
114 #define ISIS_TLV_DECNET_PHASE4 42
115 #define ISIS_TLV_LUCENT_PRIVATE 66
116 #define ISIS_TLV_INT_IP_REACH 128 /* rfc1195, rfc2966 */
117 #define ISIS_TLV_PROTOCOLS 129 /* rfc1195 */
118 #define ISIS_TLV_EXT_IP_REACH 130 /* rfc1195, rfc2966 */
119 #define ISIS_TLV_IDRP_INFO 131 /* rfc1195 */
120 #define ISIS_TLV_IDRP_INFO_MINLEN 1
121 #define ISIS_TLV_IPADDR 132 /* rfc1195 */
122 #define ISIS_TLV_IPAUTH 133 /* rfc1195 */
123 #define ISIS_TLV_TE_ROUTER_ID 134 /* draft-ietf-isis-traffic-05 */
124 #define ISIS_TLV_EXTD_IP_REACH 135 /* draft-ietf-isis-traffic-05 */
125 #define ISIS_TLV_HOSTNAME 137 /* rfc2763 */
126 #define ISIS_TLV_SHARED_RISK_GROUP 138 /* draft-ietf-isis-gmpls-extensions */
127 #define ISIS_TLV_MT_PORT_CAP 143 /* rfc6165 */
128 #define ISIS_TLV_MT_CAPABILITY 144 /* rfc6329 */
129 #define ISIS_TLV_NORTEL_PRIVATE1 176
130 #define ISIS_TLV_NORTEL_PRIVATE2 177
131 #define ISIS_TLV_RESTART_SIGNALING 211 /* rfc3847 */
132 #define ISIS_TLV_RESTART_SIGNALING_FLAGLEN 1
133 #define ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN 2
134 #define ISIS_TLV_MT_IS_REACH 222 /* draft-ietf-isis-wg-multi-topology-05 */
135 #define ISIS_TLV_MT_SUPPORTED 229 /* draft-ietf-isis-wg-multi-topology-05 */
136 #define ISIS_TLV_MT_SUPPORTED_MINLEN 2
137 #define ISIS_TLV_IP6ADDR 232 /* draft-ietf-isis-ipv6-02 */
138 #define ISIS_TLV_MT_IP_REACH 235 /* draft-ietf-isis-wg-multi-topology-05 */
139 #define ISIS_TLV_IP6_REACH 236 /* draft-ietf-isis-ipv6-02 */
140 #define ISIS_TLV_MT_IP6_REACH 237 /* draft-ietf-isis-wg-multi-topology-05 */
141 #define ISIS_TLV_PTP_ADJ 240 /* rfc3373 */
142 #define ISIS_TLV_IIH_SEQNR 241 /* draft-shen-isis-iih-sequence-00 */
143 #define ISIS_TLV_IIH_SEQNR_MINLEN 4
144 #define ISIS_TLV_VENDOR_PRIVATE 250 /* draft-ietf-isis-experimental-tlv-01 */
145 #define ISIS_TLV_VENDOR_PRIVATE_MINLEN 3
147 static const struct tok isis_tlv_values
[] = {
148 { ISIS_TLV_AREA_ADDR
, "Area address(es)"},
149 { ISIS_TLV_IS_REACH
, "IS Reachability"},
150 { ISIS_TLV_ESNEIGH
, "ES Neighbor(s)"},
151 { ISIS_TLV_PART_DIS
, "Partition DIS"},
152 { ISIS_TLV_PREFIX_NEIGH
, "Prefix Neighbors"},
153 { ISIS_TLV_ISNEIGH
, "IS Neighbor(s)"},
154 { ISIS_TLV_ISNEIGH_VARLEN
, "IS Neighbor(s) (variable length)"},
155 { ISIS_TLV_PADDING
, "Padding"},
156 { ISIS_TLV_LSP
, "LSP entries"},
157 { ISIS_TLV_AUTH
, "Authentication"},
158 { ISIS_TLV_CHECKSUM
, "Checksum"},
159 { ISIS_TLV_POI
, "Purge Originator Identifier"},
160 { ISIS_TLV_LSP_BUFFERSIZE
, "LSP Buffersize"},
161 { ISIS_TLV_EXT_IS_REACH
, "Extended IS Reachability"},
162 { ISIS_TLV_IS_ALIAS_ID
, "IS Alias ID"},
163 { ISIS_TLV_DECNET_PHASE4
, "DECnet Phase IV"},
164 { ISIS_TLV_LUCENT_PRIVATE
, "Lucent Proprietary"},
165 { ISIS_TLV_INT_IP_REACH
, "IPv4 Internal Reachability"},
166 { ISIS_TLV_PROTOCOLS
, "Protocols supported"},
167 { ISIS_TLV_EXT_IP_REACH
, "IPv4 External Reachability"},
168 { ISIS_TLV_IDRP_INFO
, "Inter-Domain Information Type"},
169 { ISIS_TLV_IPADDR
, "IPv4 Interface address(es)"},
170 { ISIS_TLV_IPAUTH
, "IPv4 authentication (deprecated)"},
171 { ISIS_TLV_TE_ROUTER_ID
, "Traffic Engineering Router ID"},
172 { ISIS_TLV_EXTD_IP_REACH
, "Extended IPv4 Reachability"},
173 { ISIS_TLV_SHARED_RISK_GROUP
, "Shared Risk Link Group"},
174 { ISIS_TLV_MT_PORT_CAP
, "Multi-Topology-Aware Port Capability"},
175 { ISIS_TLV_MT_CAPABILITY
, "Multi-Topology Capability"},
176 { ISIS_TLV_NORTEL_PRIVATE1
, "Nortel Proprietary"},
177 { ISIS_TLV_NORTEL_PRIVATE2
, "Nortel Proprietary"},
178 { ISIS_TLV_HOSTNAME
, "Hostname"},
179 { ISIS_TLV_RESTART_SIGNALING
, "Restart Signaling"},
180 { ISIS_TLV_MT_IS_REACH
, "Multi Topology IS Reachability"},
181 { ISIS_TLV_MT_SUPPORTED
, "Multi Topology"},
182 { ISIS_TLV_IP6ADDR
, "IPv6 Interface address(es)"},
183 { ISIS_TLV_MT_IP_REACH
, "Multi-Topology IPv4 Reachability"},
184 { ISIS_TLV_IP6_REACH
, "IPv6 reachability"},
185 { ISIS_TLV_MT_IP6_REACH
, "Multi-Topology IP6 Reachability"},
186 { ISIS_TLV_PTP_ADJ
, "Point-to-point Adjacency State"},
187 { ISIS_TLV_IIH_SEQNR
, "Hello PDU Sequence Number"},
188 { ISIS_TLV_VENDOR_PRIVATE
, "Vendor Private"},
192 #define ESIS_OPTION_PROTOCOLS 129
193 #define ESIS_OPTION_QOS_MAINTENANCE 195 /* iso9542 */
194 #define ESIS_OPTION_SECURITY 197 /* iso9542 */
195 #define ESIS_OPTION_ES_CONF_TIME 198 /* iso9542 */
196 #define ESIS_OPTION_PRIORITY 205 /* iso9542 */
197 #define ESIS_OPTION_ADDRESS_MASK 225 /* iso9542 */
198 #define ESIS_OPTION_SNPA_MASK 226 /* iso9542 */
200 static const struct tok esis_option_values
[] = {
201 { ESIS_OPTION_PROTOCOLS
, "Protocols supported"},
202 { ESIS_OPTION_QOS_MAINTENANCE
, "QoS Maintenance" },
203 { ESIS_OPTION_SECURITY
, "Security" },
204 { ESIS_OPTION_ES_CONF_TIME
, "ES Configuration Time" },
205 { ESIS_OPTION_PRIORITY
, "Priority" },
206 { ESIS_OPTION_ADDRESS_MASK
, "Addressk Mask" },
207 { ESIS_OPTION_SNPA_MASK
, "SNPA Mask" },
211 #define CLNP_OPTION_DISCARD_REASON 193
212 #define CLNP_OPTION_QOS_MAINTENANCE 195 /* iso8473 */
213 #define CLNP_OPTION_SECURITY 197 /* iso8473 */
214 #define CLNP_OPTION_SOURCE_ROUTING 200 /* iso8473 */
215 #define CLNP_OPTION_ROUTE_RECORDING 203 /* iso8473 */
216 #define CLNP_OPTION_PADDING 204 /* iso8473 */
217 #define CLNP_OPTION_PRIORITY 205 /* iso8473 */
219 static const struct tok clnp_option_values
[] = {
220 { CLNP_OPTION_DISCARD_REASON
, "Discard Reason"},
221 { CLNP_OPTION_PRIORITY
, "Priority"},
222 { CLNP_OPTION_QOS_MAINTENANCE
, "QoS Maintenance"},
223 { CLNP_OPTION_SECURITY
, "Security"},
224 { CLNP_OPTION_SOURCE_ROUTING
, "Source Routing"},
225 { CLNP_OPTION_ROUTE_RECORDING
, "Route Recording"},
226 { CLNP_OPTION_PADDING
, "Padding"},
230 static const struct tok clnp_option_rfd_class_values
[] = {
233 { 0x9, "Source Routeing"},
235 { 0xb, "PDU Discarded"},
236 { 0xc, "Reassembly"},
240 static const struct tok clnp_option_rfd_general_values
[] = {
241 { 0x0, "Reason not specified"},
242 { 0x1, "Protocol procedure error"},
243 { 0x2, "Incorrect checksum"},
244 { 0x3, "PDU discarded due to congestion"},
245 { 0x4, "Header syntax error (cannot be parsed)"},
246 { 0x5, "Segmentation needed but not permitted"},
247 { 0x6, "Incomplete PDU received"},
248 { 0x7, "Duplicate option"},
252 static const struct tok clnp_option_rfd_address_values
[] = {
253 { 0x0, "Destination address unreachable"},
254 { 0x1, "Destination address unknown"},
258 static const struct tok clnp_option_rfd_source_routeing_values
[] = {
259 { 0x0, "Unspecified source routeing error"},
260 { 0x1, "Syntax error in source routeing field"},
261 { 0x2, "Unknown address in source routeing field"},
262 { 0x3, "Path not acceptable"},
266 static const struct tok clnp_option_rfd_lifetime_values
[] = {
267 { 0x0, "Lifetime expired while data unit in transit"},
268 { 0x1, "Lifetime expired during reassembly"},
272 static const struct tok clnp_option_rfd_pdu_discard_values
[] = {
273 { 0x0, "Unsupported option not specified"},
274 { 0x1, "Unsupported protocol version"},
275 { 0x2, "Unsupported security option"},
276 { 0x3, "Unsupported source routeing option"},
277 { 0x4, "Unsupported recording of route option"},
281 static const struct tok clnp_option_rfd_reassembly_values
[] = {
282 { 0x0, "Reassembly interference"},
286 /* array of 16 error-classes */
287 static const struct tok
*clnp_option_rfd_error_class
[] = {
288 clnp_option_rfd_general_values
,
296 clnp_option_rfd_address_values
,
297 clnp_option_rfd_source_routeing_values
,
298 clnp_option_rfd_lifetime_values
,
299 clnp_option_rfd_pdu_discard_values
,
300 clnp_option_rfd_reassembly_values
,
306 #define CLNP_OPTION_OPTION_QOS_MASK 0x3f
307 #define CLNP_OPTION_SCOPE_MASK 0xc0
308 #define CLNP_OPTION_SCOPE_SA_SPEC 0x40
309 #define CLNP_OPTION_SCOPE_DA_SPEC 0x80
310 #define CLNP_OPTION_SCOPE_GLOBAL 0xc0
312 static const struct tok clnp_option_scope_values
[] = {
313 { CLNP_OPTION_SCOPE_SA_SPEC
, "Source Address Specific"},
314 { CLNP_OPTION_SCOPE_DA_SPEC
, "Destination Address Specific"},
315 { CLNP_OPTION_SCOPE_GLOBAL
, "Globally unique"},
319 static const struct tok clnp_option_sr_rr_values
[] = {
325 static const struct tok clnp_option_sr_rr_string_values
[] = {
326 { CLNP_OPTION_SOURCE_ROUTING
, "source routing"},
327 { CLNP_OPTION_ROUTE_RECORDING
, "recording of route in progress"},
331 static const struct tok clnp_option_qos_global_values
[] = {
333 { 0x10, "sequencing vs. delay"},
334 { 0x08, "congested"},
335 { 0x04, "delay vs. cost"},
336 { 0x02, "error vs. delay"},
337 { 0x01, "error vs. cost"},
341 #define ISIS_SUBTLV_EXT_IS_REACH_ADMIN_GROUP 3 /* draft-ietf-isis-traffic-05 */
342 #define ISIS_SUBTLV_EXT_IS_REACH_LINK_LOCAL_REMOTE_ID 4 /* rfc4205 */
343 #define ISIS_SUBTLV_EXT_IS_REACH_LINK_REMOTE_ID 5 /* draft-ietf-isis-traffic-05 */
344 #define ISIS_SUBTLV_EXT_IS_REACH_IPV4_INTF_ADDR 6 /* draft-ietf-isis-traffic-05 */
345 #define ISIS_SUBTLV_EXT_IS_REACH_IPV4_NEIGHBOR_ADDR 8 /* draft-ietf-isis-traffic-05 */
346 #define ISIS_SUBTLV_EXT_IS_REACH_MAX_LINK_BW 9 /* draft-ietf-isis-traffic-05 */
347 #define ISIS_SUBTLV_EXT_IS_REACH_RESERVABLE_BW 10 /* draft-ietf-isis-traffic-05 */
348 #define ISIS_SUBTLV_EXT_IS_REACH_UNRESERVED_BW 11 /* rfc4124 */
349 #define ISIS_SUBTLV_EXT_IS_REACH_BW_CONSTRAINTS_OLD 12 /* draft-ietf-tewg-diff-te-proto-06 */
350 #define ISIS_SUBTLV_EXT_IS_REACH_TE_METRIC 18 /* draft-ietf-isis-traffic-05 */
351 #define ISIS_SUBTLV_EXT_IS_REACH_LINK_ATTRIBUTE 19 /* draft-ietf-isis-link-attr-01 */
352 #define ISIS_SUBTLV_EXT_IS_REACH_LINK_PROTECTION_TYPE 20 /* rfc4205 */
353 #define ISIS_SUBTLV_EXT_IS_REACH_INTF_SW_CAP_DESCR 21 /* rfc4205 */
354 #define ISIS_SUBTLV_EXT_IS_REACH_BW_CONSTRAINTS 22 /* rfc4124 */
356 #define ISIS_SUBTLV_SPB_METRIC 29 /* rfc6329 */
358 static const struct tok isis_ext_is_reach_subtlv_values
[] = {
359 { ISIS_SUBTLV_EXT_IS_REACH_ADMIN_GROUP
, "Administrative groups" },
360 { ISIS_SUBTLV_EXT_IS_REACH_LINK_LOCAL_REMOTE_ID
, "Link Local/Remote Identifier" },
361 { ISIS_SUBTLV_EXT_IS_REACH_LINK_REMOTE_ID
, "Link Remote Identifier" },
362 { ISIS_SUBTLV_EXT_IS_REACH_IPV4_INTF_ADDR
, "IPv4 interface address" },
363 { ISIS_SUBTLV_EXT_IS_REACH_IPV4_NEIGHBOR_ADDR
, "IPv4 neighbor address" },
364 { ISIS_SUBTLV_EXT_IS_REACH_MAX_LINK_BW
, "Maximum link bandwidth" },
365 { ISIS_SUBTLV_EXT_IS_REACH_RESERVABLE_BW
, "Reservable link bandwidth" },
366 { ISIS_SUBTLV_EXT_IS_REACH_UNRESERVED_BW
, "Unreserved bandwidth" },
367 { ISIS_SUBTLV_EXT_IS_REACH_TE_METRIC
, "Traffic Engineering Metric" },
368 { ISIS_SUBTLV_EXT_IS_REACH_LINK_ATTRIBUTE
, "Link Attribute" },
369 { ISIS_SUBTLV_EXT_IS_REACH_LINK_PROTECTION_TYPE
, "Link Protection Type" },
370 { ISIS_SUBTLV_EXT_IS_REACH_INTF_SW_CAP_DESCR
, "Interface Switching Capability" },
371 { ISIS_SUBTLV_EXT_IS_REACH_BW_CONSTRAINTS_OLD
, "Bandwidth Constraints (old)" },
372 { ISIS_SUBTLV_EXT_IS_REACH_BW_CONSTRAINTS
, "Bandwidth Constraints" },
373 { ISIS_SUBTLV_SPB_METRIC
, "SPB Metric" },
374 { 250, "Reserved for cisco specific extensions" },
375 { 251, "Reserved for cisco specific extensions" },
376 { 252, "Reserved for cisco specific extensions" },
377 { 253, "Reserved for cisco specific extensions" },
378 { 254, "Reserved for cisco specific extensions" },
379 { 255, "Reserved for future expansion" },
383 #define ISIS_SUBTLV_EXTD_IP_REACH_ADMIN_TAG32 1 /* draft-ietf-isis-admin-tags-01 */
384 #define ISIS_SUBTLV_EXTD_IP_REACH_ADMIN_TAG64 2 /* draft-ietf-isis-admin-tags-01 */
385 #define ISIS_SUBTLV_EXTD_IP_REACH_MGMT_PREFIX_COLOR 117 /* draft-ietf-isis-wg-multi-topology-05 */
387 static const struct tok isis_ext_ip_reach_subtlv_values
[] = {
388 { ISIS_SUBTLV_EXTD_IP_REACH_ADMIN_TAG32
, "32-Bit Administrative tag" },
389 { ISIS_SUBTLV_EXTD_IP_REACH_ADMIN_TAG64
, "64-Bit Administrative tag" },
390 { ISIS_SUBTLV_EXTD_IP_REACH_MGMT_PREFIX_COLOR
, "Management Prefix Color" },
394 static const struct tok isis_subtlv_link_attribute_values
[] = {
395 { 0x01, "Local Protection Available" },
396 { 0x02, "Link excluded from local protection path" },
397 { 0x04, "Local maintenance required"},
401 #define ISIS_SUBTLV_AUTH_SIMPLE 1
402 #define ISIS_SUBTLV_AUTH_GENERIC 3 /* rfc 5310 */
403 #define ISIS_SUBTLV_AUTH_MD5 54
404 #define ISIS_SUBTLV_AUTH_MD5_LEN 16
405 #define ISIS_SUBTLV_AUTH_PRIVATE 255
407 static const struct tok isis_subtlv_auth_values
[] = {
408 { ISIS_SUBTLV_AUTH_SIMPLE
, "simple text password"},
409 { ISIS_SUBTLV_AUTH_GENERIC
, "Generic Crypto key-id"},
410 { ISIS_SUBTLV_AUTH_MD5
, "HMAC-MD5 password"},
411 { ISIS_SUBTLV_AUTH_PRIVATE
, "Routing Domain private password"},
415 #define ISIS_SUBTLV_IDRP_RES 0
416 #define ISIS_SUBTLV_IDRP_LOCAL 1
417 #define ISIS_SUBTLV_IDRP_ASN 2
419 static const struct tok isis_subtlv_idrp_values
[] = {
420 { ISIS_SUBTLV_IDRP_RES
, "Reserved"},
421 { ISIS_SUBTLV_IDRP_LOCAL
, "Routing-Domain Specific"},
422 { ISIS_SUBTLV_IDRP_ASN
, "AS Number Tag"},
426 #define ISIS_SUBTLV_SPB_MCID 4
427 #define ISIS_SUBTLV_SPB_DIGEST 5
428 #define ISIS_SUBTLV_SPB_BVID 6
430 #define ISIS_SUBTLV_SPB_INSTANCE 1
431 #define ISIS_SUBTLV_SPBM_SI 3
433 #define ISIS_SPB_MCID_LEN 51
434 #define ISIS_SUBTLV_SPB_MCID_MIN_LEN 102
435 #define ISIS_SUBTLV_SPB_DIGEST_MIN_LEN 33
436 #define ISIS_SUBTLV_SPB_BVID_MIN_LEN 6
437 #define ISIS_SUBTLV_SPB_INSTANCE_MIN_LEN 19
438 #define ISIS_SUBTLV_SPB_INSTANCE_VLAN_TUPLE_LEN 8
440 static const struct tok isis_mt_port_cap_subtlv_values
[] = {
441 { ISIS_SUBTLV_SPB_MCID
, "SPB MCID" },
442 { ISIS_SUBTLV_SPB_DIGEST
, "SPB Digest" },
443 { ISIS_SUBTLV_SPB_BVID
, "SPB BVID" },
447 static const struct tok isis_mt_capability_subtlv_values
[] = {
448 { ISIS_SUBTLV_SPB_INSTANCE
, "SPB Instance" },
449 { ISIS_SUBTLV_SPBM_SI
, "SPBM Service Identifier and Unicast Address" },
453 struct isis_spb_mcid
{
456 uint8_t revision_lvl
[2];
460 struct isis_subtlv_spb_mcid
{
461 struct isis_spb_mcid mcid
;
462 struct isis_spb_mcid aux_mcid
;
465 struct isis_subtlv_spb_instance
{
466 uint8_t cist_root_id
[8];
467 uint8_t cist_external_root_path_cost
[4];
468 uint8_t bridge_priority
[2];
469 uint8_t spsourceid
[4];
473 #define CLNP_SEGMENT_PART 0x80
474 #define CLNP_MORE_SEGMENTS 0x40
475 #define CLNP_REQUEST_ER 0x20
477 static const struct tok clnp_flag_values
[] = {
478 { CLNP_SEGMENT_PART
, "Segmentation permitted"},
479 { CLNP_MORE_SEGMENTS
, "more Segments"},
480 { CLNP_REQUEST_ER
, "request Error Report"},
484 #define ISIS_MASK_LSP_OL_BIT(x) ((x)&0x4)
485 #define ISIS_MASK_LSP_ISTYPE_BITS(x) ((x)&0x3)
486 #define ISIS_MASK_LSP_PARTITION_BIT(x) ((x)&0x80)
487 #define ISIS_MASK_LSP_ATT_BITS(x) ((x)&0x78)
488 #define ISIS_MASK_LSP_ATT_ERROR_BIT(x) ((x)&0x40)
489 #define ISIS_MASK_LSP_ATT_EXPENSE_BIT(x) ((x)&0x20)
490 #define ISIS_MASK_LSP_ATT_DELAY_BIT(x) ((x)&0x10)
491 #define ISIS_MASK_LSP_ATT_DEFAULT_BIT(x) ((x)&0x8)
493 #define ISIS_MASK_MTID(x) ((x)&0x0fff)
494 #define ISIS_MASK_MTFLAGS(x) ((x)&0xf000)
496 static const struct tok isis_mt_flag_values
[] = {
497 { 0x4000, "ATT bit set"},
498 { 0x8000, "Overload bit set"},
502 #define ISIS_MASK_TLV_EXTD_IP_UPDOWN(x) ((x)&0x80)
503 #define ISIS_MASK_TLV_EXTD_IP_SUBTLV(x) ((x)&0x40)
505 #define ISIS_MASK_TLV_EXTD_IP6_IE(x) ((x)&0x40)
506 #define ISIS_MASK_TLV_EXTD_IP6_SUBTLV(x) ((x)&0x20)
508 #define ISIS_LSP_TLV_METRIC_SUPPORTED(x) ((x)&0x80)
509 #define ISIS_LSP_TLV_METRIC_IE(x) ((x)&0x40)
510 #define ISIS_LSP_TLV_METRIC_UPDOWN(x) ((x)&0x80)
511 #define ISIS_LSP_TLV_METRIC_VALUE(x) ((x)&0x3f)
513 #define ISIS_MASK_TLV_SHARED_RISK_GROUP(x) ((x)&0x1)
515 static const struct tok isis_mt_values
[] = {
516 { 0, "IPv4 unicast"},
517 { 1, "In-Band Management"},
518 { 2, "IPv6 unicast"},
520 { 4095, "Development, Experimental or Proprietary"},
524 static const struct tok isis_iih_circuit_type_values
[] = {
525 { 1, "Level 1 only"},
526 { 2, "Level 2 only"},
527 { 3, "Level 1, Level 2"},
531 #define ISIS_LSP_TYPE_UNUSED0 0
532 #define ISIS_LSP_TYPE_LEVEL_1 1
533 #define ISIS_LSP_TYPE_UNUSED2 2
534 #define ISIS_LSP_TYPE_LEVEL_2 3
536 static const struct tok isis_lsp_istype_values
[] = {
537 { ISIS_LSP_TYPE_UNUSED0
, "Unused 0x0 (invalid)"},
538 { ISIS_LSP_TYPE_LEVEL_1
, "L1 IS"},
539 { ISIS_LSP_TYPE_UNUSED2
, "Unused 0x2 (invalid)"},
540 { ISIS_LSP_TYPE_LEVEL_2
, "L2 IS"},
545 * Katz's point to point adjacency TLV uses codes to tell us the state of
546 * the remote adjacency. Enumerate them.
549 #define ISIS_PTP_ADJ_UP 0
550 #define ISIS_PTP_ADJ_INIT 1
551 #define ISIS_PTP_ADJ_DOWN 2
553 static const struct tok isis_ptp_adjancey_values
[] = {
554 { ISIS_PTP_ADJ_UP
, "Up" },
555 { ISIS_PTP_ADJ_INIT
, "Initializing" },
556 { ISIS_PTP_ADJ_DOWN
, "Down" },
560 struct isis_tlv_ptp_adj
{
561 uint8_t adjacency_state
;
562 uint8_t extd_local_circuit_id
[4];
563 uint8_t neighbor_sysid
[SYSTEM_ID_LEN
];
564 uint8_t neighbor_extd_local_circuit_id
[4];
567 static void osi_print_cksum(netdissect_options
*, const uint8_t *pptr
,
568 uint16_t checksum
, int checksum_offset
, u_int length
);
569 static int clnp_print(netdissect_options
*, const uint8_t *, u_int
);
570 static void esis_print(netdissect_options
*, const uint8_t *, u_int
);
571 static int isis_print(netdissect_options
*, const uint8_t *, u_int
);
573 struct isis_metric_block
{
574 uint8_t metric_default
;
575 uint8_t metric_delay
;
576 uint8_t metric_expense
;
577 uint8_t metric_error
;
580 struct isis_tlv_is_reach
{
581 struct isis_metric_block isis_metric_block
;
582 uint8_t neighbor_nodeid
[NODE_ID_LEN
];
585 struct isis_tlv_es_reach
{
586 struct isis_metric_block isis_metric_block
;
587 uint8_t neighbor_sysid
[SYSTEM_ID_LEN
];
590 struct isis_tlv_ip_reach
{
591 struct isis_metric_block isis_metric_block
;
596 static const struct tok isis_is_reach_virtual_values
[] = {
597 { 0, "IsNotVirtual"},
602 static const struct tok isis_restart_flag_values
[] = {
603 { 0x1, "Restart Request"},
604 { 0x2, "Restart Acknowledgement"},
605 { 0x4, "Suppress adjacency advertisement"},
609 struct isis_common_header
{
612 uint8_t version
; /* Protocol version */
614 uint8_t pdu_type
; /* 3 MSbits are reserved */
615 uint8_t pdu_version
; /* Packet format version */
620 struct isis_iih_lan_header
{
621 uint8_t circuit_type
;
622 uint8_t source_id
[SYSTEM_ID_LEN
];
623 uint8_t holding_time
[2];
626 uint8_t lan_id
[NODE_ID_LEN
];
629 struct isis_iih_ptp_header
{
630 uint8_t circuit_type
;
631 uint8_t source_id
[SYSTEM_ID_LEN
];
632 uint8_t holding_time
[2];
637 struct isis_lsp_header
{
639 uint8_t remaining_lifetime
[2];
640 uint8_t lsp_id
[LSP_ID_LEN
];
641 uint8_t sequence_number
[4];
646 struct isis_csnp_header
{
648 uint8_t source_id
[NODE_ID_LEN
];
649 uint8_t start_lsp_id
[LSP_ID_LEN
];
650 uint8_t end_lsp_id
[LSP_ID_LEN
];
653 struct isis_psnp_header
{
655 uint8_t source_id
[NODE_ID_LEN
];
658 struct isis_tlv_lsp
{
659 uint8_t remaining_lifetime
[2];
660 uint8_t lsp_id
[LSP_ID_LEN
];
661 uint8_t sequence_number
[4];
665 #define ISIS_COMMON_HEADER_SIZE (sizeof(struct isis_common_header))
666 #define ISIS_IIH_LAN_HEADER_SIZE (sizeof(struct isis_iih_lan_header))
667 #define ISIS_IIH_PTP_HEADER_SIZE (sizeof(struct isis_iih_ptp_header))
668 #define ISIS_LSP_HEADER_SIZE (sizeof(struct isis_lsp_header))
669 #define ISIS_CSNP_HEADER_SIZE (sizeof(struct isis_csnp_header))
670 #define ISIS_PSNP_HEADER_SIZE (sizeof(struct isis_psnp_header))
673 isoclns_print(netdissect_options
*ndo
, const uint8_t *p
, u_int length
)
675 if (!ND_TTEST(*p
)) { /* enough bytes on the wire ? */
676 ND_PRINT((ndo
, "|OSI"));
681 ND_PRINT((ndo
, "OSI NLPID %s (0x%02x): ", tok2str(nlpid_values
, "Unknown", *p
), *p
));
686 if (!clnp_print(ndo
, p
, length
))
687 print_unknown_data(ndo
, p
, "\n\t", length
);
691 esis_print(ndo
, p
, length
);
695 if (!isis_print(ndo
, p
, length
))
696 print_unknown_data(ndo
, p
, "\n\t", length
);
700 ND_PRINT((ndo
, "%slength: %u", ndo
->ndo_eflag
? "" : ", ", length
));
704 q933_print(ndo
, p
+ 1, length
- 1);
708 ip_print(ndo
, p
+ 1, length
- 1);
712 ip6_print(ndo
, p
+ 1, length
- 1);
716 ppp_print(ndo
, p
+ 1, length
- 1);
721 ND_PRINT((ndo
, "OSI NLPID 0x%02x unknown", *p
));
722 ND_PRINT((ndo
, "%slength: %u", ndo
->ndo_eflag
? "" : ", ", length
));
724 print_unknown_data(ndo
, p
, "\n\t", length
);
729 #define CLNP_PDU_ER 1
730 #define CLNP_PDU_DT 28
731 #define CLNP_PDU_MD 29
732 #define CLNP_PDU_ERQ 30
733 #define CLNP_PDU_ERP 31
735 static const struct tok clnp_pdu_values
[] = {
736 { CLNP_PDU_ER
, "Error Report"},
737 { CLNP_PDU_MD
, "MD"},
738 { CLNP_PDU_DT
, "Data"},
739 { CLNP_PDU_ERQ
, "Echo Request"},
740 { CLNP_PDU_ERP
, "Echo Response"},
744 struct clnp_header_t
{
746 uint8_t length_indicator
;
748 uint8_t lifetime
; /* units of 500ms */
750 uint8_t segment_length
[2];
754 struct clnp_segment_header_t
{
755 uint8_t data_unit_id
[2];
756 uint8_t segment_offset
[2];
757 uint8_t total_length
[2];
762 * Decode CLNP packets. Return 0 on error.
766 clnp_print(netdissect_options
*ndo
,
767 const uint8_t *pptr
, u_int length
)
769 const uint8_t *optr
,*source_address
,*dest_address
;
770 u_int li
,tlen
,nsap_offset
,source_address_length
,dest_address_length
, clnp_pdu_type
, clnp_flags
;
771 const struct clnp_header_t
*clnp_header
;
772 const struct clnp_segment_header_t
*clnp_segment_header
;
773 uint8_t rfd_error_major
,rfd_error_minor
;
775 clnp_header
= (const struct clnp_header_t
*) pptr
;
776 ND_TCHECK(*clnp_header
);
778 li
= clnp_header
->length_indicator
;
782 ND_PRINT((ndo
, "CLNP"));
785 * Sanity checking of the header.
788 if (clnp_header
->version
!= CLNP_VERSION
) {
789 ND_PRINT((ndo
, "version %d packet not supported", clnp_header
->version
));
794 ND_PRINT((ndo
, " length indicator(%u) > PDU size (%u)!", li
, length
));
798 if (li
< sizeof(struct clnp_header_t
)) {
799 ND_PRINT((ndo
, " length indicator %u < min PDU size:", li
));
800 while (pptr
< ndo
->ndo_snapend
)
801 ND_PRINT((ndo
, "%02X", *pptr
++));
805 /* FIXME further header sanity checking */
807 clnp_pdu_type
= clnp_header
->type
& CLNP_PDU_TYPE_MASK
;
808 clnp_flags
= clnp_header
->type
& CLNP_FLAG_MASK
;
810 pptr
+= sizeof(struct clnp_header_t
);
811 li
-= sizeof(struct clnp_header_t
);
814 ND_PRINT((ndo
, "li < size of fixed part of CLNP header and addresses"));
818 dest_address_length
= *pptr
;
821 if (li
< dest_address_length
) {
822 ND_PRINT((ndo
, "li < size of fixed part of CLNP header and addresses"));
825 ND_TCHECK2(*pptr
, dest_address_length
);
827 pptr
+= dest_address_length
;
828 li
-= dest_address_length
;
831 ND_PRINT((ndo
, "li < size of fixed part of CLNP header and addresses"));
835 source_address_length
= *pptr
;
838 if (li
< source_address_length
) {
839 ND_PRINT((ndo
, "li < size of fixed part of CLNP header and addresses"));
842 ND_TCHECK2(*pptr
, source_address_length
);
843 source_address
= pptr
;
844 pptr
+= source_address_length
;
845 li
-= source_address_length
;
847 if (ndo
->ndo_vflag
< 1) {
848 ND_PRINT((ndo
, "%s%s > %s, %s, length %u",
849 ndo
->ndo_eflag
? "" : ", ",
850 isonsap_string(ndo
, source_address
, source_address_length
),
851 isonsap_string(ndo
, dest_address
, dest_address_length
),
852 tok2str(clnp_pdu_values
,"unknown (%u)",clnp_pdu_type
),
856 ND_PRINT((ndo
, "%slength %u", ndo
->ndo_eflag
? "" : ", ", length
));
858 ND_PRINT((ndo
, "\n\t%s PDU, hlen: %u, v: %u, lifetime: %u.%us, Segment PDU length: %u, checksum: 0x%04x",
859 tok2str(clnp_pdu_values
, "unknown (%u)",clnp_pdu_type
),
860 clnp_header
->length_indicator
,
861 clnp_header
->version
,
862 clnp_header
->lifetime
/2,
863 (clnp_header
->lifetime
%2)*5,
864 EXTRACT_16BITS(clnp_header
->segment_length
),
865 EXTRACT_16BITS(clnp_header
->cksum
)));
867 osi_print_cksum(ndo
, optr
, EXTRACT_16BITS(clnp_header
->cksum
), 7,
868 clnp_header
->length_indicator
);
870 ND_PRINT((ndo
, "\n\tFlags [%s]",
871 bittok2str(clnp_flag_values
, "none", clnp_flags
)));
873 ND_PRINT((ndo
, "\n\tsource address (length %u): %s\n\tdest address (length %u): %s",
874 source_address_length
,
875 isonsap_string(ndo
, source_address
, source_address_length
),
877 isonsap_string(ndo
, dest_address
, dest_address_length
)));
879 if (clnp_flags
& CLNP_SEGMENT_PART
) {
880 if (li
< sizeof(const struct clnp_segment_header_t
)) {
881 ND_PRINT((ndo
, "li < size of fixed part of CLNP header, addresses, and segment part"));
884 clnp_segment_header
= (const struct clnp_segment_header_t
*) pptr
;
885 ND_TCHECK(*clnp_segment_header
);
886 ND_PRINT((ndo
, "\n\tData Unit ID: 0x%04x, Segment Offset: %u, Total PDU Length: %u",
887 EXTRACT_16BITS(clnp_segment_header
->data_unit_id
),
888 EXTRACT_16BITS(clnp_segment_header
->segment_offset
),
889 EXTRACT_16BITS(clnp_segment_header
->total_length
)));
890 pptr
+=sizeof(const struct clnp_segment_header_t
);
891 li
-=sizeof(const struct clnp_segment_header_t
);
894 /* now walk the options */
900 ND_PRINT((ndo
, ", bad opts/li"));
903 ND_TCHECK2(*pptr
, 2);
908 ND_PRINT((ndo
, ", opt (%d) too long", op
));
911 ND_TCHECK2(*pptr
, opli
);
916 ND_PRINT((ndo
, "\n\t %s Option #%u, length %u, value: ",
917 tok2str(clnp_option_values
,"Unknown",op
),
922 * We've already checked that the entire option is present
923 * in the captured packet with the ND_TCHECK2() call.
924 * Therefore, we don't need to do ND_TCHECK()/ND_TCHECK2()
926 * We do, however, need to check tlen, to make sure we
927 * don't run past the end of the option.
932 case CLNP_OPTION_ROUTE_RECORDING
: /* those two options share the format */
933 case CLNP_OPTION_SOURCE_ROUTING
:
935 ND_PRINT((ndo
, ", bad opt len"));
938 ND_PRINT((ndo
, "%s %s",
939 tok2str(clnp_option_sr_rr_values
,"Unknown",*tptr
),
940 tok2str(clnp_option_sr_rr_string_values
, "Unknown Option %u", op
)));
941 nsap_offset
=*(tptr
+1);
942 if (nsap_offset
== 0) {
943 ND_PRINT((ndo
, " Bad NSAP offset (0)"));
946 nsap_offset
-=1; /* offset to nsap list */
947 if (nsap_offset
> tlen
) {
948 ND_PRINT((ndo
, " Bad NSAP offset (past end of option)"));
954 source_address_length
=*tptr
;
955 if (tlen
< source_address_length
+1) {
956 ND_PRINT((ndo
, "\n\t NSAP address goes past end of option"));
959 if (source_address_length
> 0) {
960 source_address
=(tptr
+1);
961 ND_TCHECK2(*source_address
, source_address_length
);
962 ND_PRINT((ndo
, "\n\t NSAP address (length %u): %s",
963 source_address_length
,
964 isonsap_string(ndo
, source_address
, source_address_length
)));
966 tlen
-=source_address_length
+1;
970 case CLNP_OPTION_PRIORITY
:
972 ND_PRINT((ndo
, ", bad opt len"));
975 ND_PRINT((ndo
, "0x%1x", *tptr
&0x0f));
978 case CLNP_OPTION_QOS_MAINTENANCE
:
980 ND_PRINT((ndo
, ", bad opt len"));
983 ND_PRINT((ndo
, "\n\t Format Code: %s",
984 tok2str(clnp_option_scope_values
, "Reserved", *tptr
&CLNP_OPTION_SCOPE_MASK
)));
986 if ((*tptr
&CLNP_OPTION_SCOPE_MASK
) == CLNP_OPTION_SCOPE_GLOBAL
)
987 ND_PRINT((ndo
, "\n\t QoS Flags [%s]",
988 bittok2str(clnp_option_qos_global_values
,
990 *tptr
&CLNP_OPTION_OPTION_QOS_MASK
)));
993 case CLNP_OPTION_SECURITY
:
995 ND_PRINT((ndo
, ", bad opt len"));
998 ND_PRINT((ndo
, "\n\t Format Code: %s, Security-Level %u",
999 tok2str(clnp_option_scope_values
,"Reserved",*tptr
&CLNP_OPTION_SCOPE_MASK
),
1003 case CLNP_OPTION_DISCARD_REASON
:
1005 ND_PRINT((ndo
, ", bad opt len"));
1008 rfd_error_major
= (*tptr
&0xf0) >> 4;
1009 rfd_error_minor
= *tptr
&0x0f;
1010 ND_PRINT((ndo
, "\n\t Class: %s Error (0x%01x), %s (0x%01x)",
1011 tok2str(clnp_option_rfd_class_values
,"Unknown",rfd_error_major
),
1013 tok2str(clnp_option_rfd_error_class
[rfd_error_major
],"Unknown",rfd_error_minor
),
1017 case CLNP_OPTION_PADDING
:
1018 ND_PRINT((ndo
, "padding data"));
1022 * FIXME those are the defined Options that lack a decoder
1023 * you are welcome to contribute code ;-)
1027 print_unknown_data(ndo
, tptr
, "\n\t ", opli
);
1030 if (ndo
->ndo_vflag
> 1)
1031 print_unknown_data(ndo
, pptr
, "\n\t ", opli
);
1035 switch (clnp_pdu_type
) {
1037 case CLNP_PDU_ER
: /* fall through */
1040 if (*(pptr
) == NLPID_CLNP
) {
1041 ND_PRINT((ndo
, "\n\t-----original packet-----\n\t"));
1042 /* FIXME recursion protection */
1043 clnp_print(ndo
, pptr
, length
- clnp_header
->length_indicator
);
1052 /* dump the PDU specific data */
1053 if (length
-(pptr
-optr
) > 0) {
1054 ND_PRINT((ndo
, "\n\t undecoded non-header data, length %u", length
-clnp_header
->length_indicator
));
1055 print_unknown_data(ndo
, pptr
, "\n\t ", length
- (pptr
- optr
));
1062 ND_PRINT((ndo
, "[|clnp]"));
1068 #define ESIS_PDU_REDIRECT 6
1069 #define ESIS_PDU_ESH 2
1070 #define ESIS_PDU_ISH 4
1072 static const struct tok esis_pdu_values
[] = {
1073 { ESIS_PDU_REDIRECT
, "redirect"},
1074 { ESIS_PDU_ESH
, "ESH"},
1075 { ESIS_PDU_ISH
, "ISH"},
1079 struct esis_header_t
{
1081 uint8_t length_indicator
;
1085 uint8_t holdtime
[2];
1090 esis_print(netdissect_options
*ndo
,
1091 const uint8_t *pptr
, u_int length
)
1093 const uint8_t *optr
;
1094 u_int li
,esis_pdu_type
,source_address_length
, source_address_number
;
1095 const struct esis_header_t
*esis_header
;
1097 if (!ndo
->ndo_eflag
)
1098 ND_PRINT((ndo
, "ES-IS"));
1101 ND_PRINT((ndo
, ndo
->ndo_qflag
? "bad pkt!" : "no header at all!"));
1105 esis_header
= (const struct esis_header_t
*) pptr
;
1106 ND_TCHECK(*esis_header
);
1107 li
= esis_header
->length_indicator
;
1111 * Sanity checking of the header.
1114 if (esis_header
->nlpid
!= NLPID_ESIS
) {
1115 ND_PRINT((ndo
, " nlpid 0x%02x packet not supported", esis_header
->nlpid
));
1119 if (esis_header
->version
!= ESIS_VERSION
) {
1120 ND_PRINT((ndo
, " version %d packet not supported", esis_header
->version
));
1125 ND_PRINT((ndo
, " length indicator(%u) > PDU size (%u)!", li
, length
));
1129 if (li
< sizeof(struct esis_header_t
) + 2) {
1130 ND_PRINT((ndo
, " length indicator %u < min PDU size:", li
));
1131 while (pptr
< ndo
->ndo_snapend
)
1132 ND_PRINT((ndo
, "%02X", *pptr
++));
1136 esis_pdu_type
= esis_header
->type
& ESIS_PDU_TYPE_MASK
;
1138 if (ndo
->ndo_vflag
< 1) {
1139 ND_PRINT((ndo
, "%s%s, length %u",
1140 ndo
->ndo_eflag
? "" : ", ",
1141 tok2str(esis_pdu_values
,"unknown type (%u)",esis_pdu_type
),
1145 ND_PRINT((ndo
, "%slength %u\n\t%s (%u)",
1146 ndo
->ndo_eflag
? "" : ", ",
1148 tok2str(esis_pdu_values
,"unknown type: %u", esis_pdu_type
),
1151 ND_PRINT((ndo
, ", v: %u%s", esis_header
->version
, esis_header
->version
== ESIS_VERSION
? "" : "unsupported" ));
1152 ND_PRINT((ndo
, ", checksum: 0x%04x", EXTRACT_16BITS(esis_header
->cksum
)));
1154 osi_print_cksum(ndo
, pptr
, EXTRACT_16BITS(esis_header
->cksum
), 7, li
);
1156 ND_PRINT((ndo
, ", holding time: %us, length indicator: %u",
1157 EXTRACT_16BITS(esis_header
->holdtime
), li
));
1159 if (ndo
->ndo_vflag
> 1)
1160 print_unknown_data(ndo
, optr
, "\n\t", sizeof(struct esis_header_t
));
1162 pptr
+= sizeof(struct esis_header_t
);
1163 li
-= sizeof(struct esis_header_t
);
1165 switch (esis_pdu_type
) {
1166 case ESIS_PDU_REDIRECT
: {
1167 const uint8_t *dst
, *snpa
, *neta
;
1168 u_int dstl
, snpal
, netal
;
1172 ND_PRINT((ndo
, ", bad redirect/li"));
1178 ND_TCHECK2(*pptr
, dstl
);
1180 ND_PRINT((ndo
, ", bad redirect/li"));
1186 ND_PRINT((ndo
, "\n\t %s", isonsap_string(ndo
, dst
, dstl
)));
1190 ND_PRINT((ndo
, ", bad redirect/li"));
1196 ND_TCHECK2(*pptr
, snpal
);
1198 ND_PRINT((ndo
, ", bad redirect/li"));
1206 ND_PRINT((ndo
, ", bad redirect/li"));
1211 ND_TCHECK2(*pptr
, netal
);
1213 ND_PRINT((ndo
, ", bad redirect/li"));
1221 ND_PRINT((ndo
, "\n\t %s", etheraddr_string(ndo
, snpa
)));
1223 ND_PRINT((ndo
, "\n\t %s", isonsap_string(ndo
, neta
, netal
)));
1230 ND_PRINT((ndo
, ", bad esh/li"));
1233 source_address_number
= *pptr
;
1237 ND_PRINT((ndo
, "\n\t Number of Source Addresses: %u", source_address_number
));
1239 while (source_address_number
> 0) {
1242 ND_PRINT((ndo
, ", bad esh/li"));
1245 source_address_length
= *pptr
;
1249 ND_TCHECK2(*pptr
, source_address_length
);
1250 if (li
< source_address_length
) {
1251 ND_PRINT((ndo
, ", bad esh/li"));
1254 ND_PRINT((ndo
, "\n\t NET (length: %u): %s",
1255 source_address_length
,
1256 isonsap_string(ndo
, pptr
, source_address_length
)));
1257 pptr
+= source_address_length
;
1258 li
-= source_address_length
;
1259 source_address_number
--;
1264 case ESIS_PDU_ISH
: {
1267 ND_PRINT((ndo
, ", bad ish/li"));
1270 source_address_length
= *pptr
;
1273 ND_TCHECK2(*pptr
, source_address_length
);
1274 if (li
< source_address_length
) {
1275 ND_PRINT((ndo
, ", bad ish/li"));
1278 ND_PRINT((ndo
, "\n\t NET (length: %u): %s", source_address_length
, isonsap_string(ndo
, pptr
, source_address_length
)));
1279 pptr
+= source_address_length
;
1280 li
-= source_address_length
;
1285 if (ndo
->ndo_vflag
<= 1) {
1286 if (pptr
< ndo
->ndo_snapend
)
1287 print_unknown_data(ndo
, pptr
, "\n\t ", ndo
->ndo_snapend
- pptr
);
1292 /* now walk the options */
1295 const uint8_t *tptr
;
1298 ND_PRINT((ndo
, ", bad opts/li"));
1301 ND_TCHECK2(*pptr
, 2);
1306 ND_PRINT((ndo
, ", opt (%d) too long", op
));
1312 ND_PRINT((ndo
, "\n\t %s Option #%u, length %u, value: ",
1313 tok2str(esis_option_values
,"Unknown",op
),
1319 case ESIS_OPTION_ES_CONF_TIME
:
1321 ND_TCHECK2(*pptr
, 2);
1322 ND_PRINT((ndo
, "%us", EXTRACT_16BITS(tptr
)));
1324 ND_PRINT((ndo
, "(bad length)"));
1327 case ESIS_OPTION_PROTOCOLS
:
1330 ND_PRINT((ndo
, "%s (0x%02x)",
1331 tok2str(nlpid_values
,
1335 if (opli
>1) /* further NPLIDs ? - put comma */
1336 ND_PRINT((ndo
, ", "));
1343 * FIXME those are the defined Options that lack a decoder
1344 * you are welcome to contribute code ;-)
1347 case ESIS_OPTION_QOS_MAINTENANCE
:
1348 case ESIS_OPTION_SECURITY
:
1349 case ESIS_OPTION_PRIORITY
:
1350 case ESIS_OPTION_ADDRESS_MASK
:
1351 case ESIS_OPTION_SNPA_MASK
:
1354 print_unknown_data(ndo
, tptr
, "\n\t ", opli
);
1357 if (ndo
->ndo_vflag
> 1)
1358 print_unknown_data(ndo
, pptr
, "\n\t ", opli
);
1366 isis_print_mcid(netdissect_options
*ndo
,
1367 const struct isis_spb_mcid
*mcid
)
1372 ND_PRINT((ndo
, "ID: %d, Name: ", mcid
->format_id
));
1374 if (fn_printzp(ndo
, mcid
->name
, 32, ndo
->ndo_snapend
))
1377 ND_PRINT((ndo
, "\n\t Lvl: %d", EXTRACT_16BITS(mcid
->revision_lvl
)));
1379 ND_PRINT((ndo
, ", Digest: "));
1382 ND_PRINT((ndo
, "%.2x ", mcid
->digest
[i
]));
1385 ND_PRINT((ndo
, "%s", tstr
));
1389 isis_print_mt_port_cap_subtlv(netdissect_options
*ndo
,
1390 const uint8_t *tptr
, int len
)
1392 int stlv_type
, stlv_len
;
1393 const struct isis_subtlv_spb_mcid
*subtlv_spb_mcid
;
1398 stlv_type
= *(tptr
++);
1399 stlv_len
= *(tptr
++);
1401 /* first lets see if we know the subTLVs name*/
1402 ND_PRINT((ndo
, "\n\t %s subTLV #%u, length: %u",
1403 tok2str(isis_mt_port_cap_subtlv_values
, "unknown", stlv_type
),
1407 /*len -= TLV_TYPE_LEN_OFFSET;*/
1412 case ISIS_SUBTLV_SPB_MCID
:
1414 ND_TCHECK2(*(tptr
), ISIS_SUBTLV_SPB_MCID_MIN_LEN
);
1416 subtlv_spb_mcid
= (const struct isis_subtlv_spb_mcid
*)tptr
;
1418 ND_PRINT((ndo
, "\n\t MCID: "));
1419 isis_print_mcid(ndo
, &(subtlv_spb_mcid
->mcid
));
1421 /*tptr += SPB_MCID_MIN_LEN;
1422 len -= SPB_MCID_MIN_LEN; */
1424 ND_PRINT((ndo
, "\n\t AUX-MCID: "));
1425 isis_print_mcid(ndo
, &(subtlv_spb_mcid
->aux_mcid
));
1427 /*tptr += SPB_MCID_MIN_LEN;
1428 len -= SPB_MCID_MIN_LEN; */
1429 tptr
= tptr
+ sizeof(struct isis_subtlv_spb_mcid
);
1430 len
= len
- sizeof(struct isis_subtlv_spb_mcid
);
1435 case ISIS_SUBTLV_SPB_DIGEST
:
1437 ND_TCHECK2(*(tptr
), ISIS_SUBTLV_SPB_DIGEST_MIN_LEN
);
1439 ND_PRINT((ndo
, "\n\t RES: %d V: %d A: %d D: %d",
1440 (*(tptr
) >> 5), (((*tptr
)>> 4) & 0x01),
1441 ((*(tptr
) >> 2) & 0x03), ((*tptr
) & 0x03)));
1445 ND_PRINT((ndo
, "\n\t Digest: "));
1449 ND_PRINT((ndo
, "%08x ", EXTRACT_32BITS(tptr
)));
1450 if (i
%4 == 0 && i
!= 8)
1451 ND_PRINT((ndo
, "\n\t "));
1455 len
= len
- ISIS_SUBTLV_SPB_DIGEST_MIN_LEN
;
1460 case ISIS_SUBTLV_SPB_BVID
:
1462 ND_TCHECK2(*(tptr
), stlv_len
);
1464 while (len
>= ISIS_SUBTLV_SPB_BVID_MIN_LEN
)
1466 ND_TCHECK2(*(tptr
), ISIS_SUBTLV_SPB_BVID_MIN_LEN
);
1468 ND_PRINT((ndo
, "\n\t ECT: %08x",
1469 EXTRACT_32BITS(tptr
)));
1473 ND_PRINT((ndo
, " BVID: %d, U:%01x M:%01x ",
1474 (EXTRACT_16BITS (tptr
) >> 4) ,
1475 (EXTRACT_16BITS (tptr
) >> 3) & 0x01,
1476 (EXTRACT_16BITS (tptr
) >> 2) & 0x01));
1479 len
= len
- ISIS_SUBTLV_SPB_BVID_MIN_LEN
;
1493 ND_PRINT((ndo
, "\n\t\t"));
1494 ND_PRINT((ndo
, "%s", tstr
));
1499 isis_print_mt_capability_subtlv(netdissect_options
*ndo
,
1500 const uint8_t *tptr
, int len
)
1502 int stlv_type
, stlv_len
, tmp
;
1506 stlv_type
= *(tptr
++);
1507 stlv_len
= *(tptr
++);
1509 /* first lets see if we know the subTLVs name*/
1510 ND_PRINT((ndo
, "\n\t %s subTLV #%u, length: %u",
1511 tok2str(isis_mt_capability_subtlv_values
, "unknown", stlv_type
),
1519 case ISIS_SUBTLV_SPB_INSTANCE
:
1521 ND_TCHECK2(*tptr
, ISIS_SUBTLV_SPB_INSTANCE_MIN_LEN
);
1523 ND_PRINT((ndo
, "\n\t CIST Root-ID: %08x", EXTRACT_32BITS(tptr
)));
1525 ND_PRINT((ndo
, " %08x", EXTRACT_32BITS(tptr
)));
1527 ND_PRINT((ndo
, ", Path Cost: %08x", EXTRACT_32BITS(tptr
)));
1529 ND_PRINT((ndo
, ", Prio: %d", EXTRACT_16BITS(tptr
)));
1531 ND_PRINT((ndo
, "\n\t RES: %d",
1532 EXTRACT_16BITS(tptr
) >> 5));
1533 ND_PRINT((ndo
, ", V: %d",
1534 (EXTRACT_16BITS(tptr
) >> 4) & 0x0001));
1535 ND_PRINT((ndo
, ", SPSource-ID: %d",
1536 (EXTRACT_32BITS(tptr
) & 0x000fffff)));
1538 ND_PRINT((ndo
, ", No of Trees: %x", *(tptr
)));
1542 len
= len
- ISIS_SUBTLV_SPB_INSTANCE_MIN_LEN
;
1546 ND_TCHECK2(*tptr
, ISIS_SUBTLV_SPB_INSTANCE_VLAN_TUPLE_LEN
);
1548 ND_PRINT((ndo
, "\n\t U:%d, M:%d, A:%d, RES:%d",
1549 *(tptr
) >> 7, (*(tptr
) >> 6) & 0x01,
1550 (*(tptr
) >> 5) & 0x01, (*(tptr
) & 0x1f)));
1554 ND_PRINT((ndo
, ", ECT: %08x", EXTRACT_32BITS(tptr
)));
1558 ND_PRINT((ndo
, ", BVID: %d, SPVID: %d",
1559 (EXTRACT_24BITS(tptr
) >> 12) & 0x000fff,
1560 EXTRACT_24BITS(tptr
) & 0x000fff));
1563 len
= len
- ISIS_SUBTLV_SPB_INSTANCE_VLAN_TUPLE_LEN
;
1569 case ISIS_SUBTLV_SPBM_SI
:
1571 ND_TCHECK2(*tptr
, 8);
1573 ND_PRINT((ndo
, "\n\t BMAC: %08x", EXTRACT_32BITS(tptr
)));
1575 ND_PRINT((ndo
, "%04x", EXTRACT_16BITS(tptr
)));
1578 ND_PRINT((ndo
, ", RES: %d, VID: %d", EXTRACT_16BITS(tptr
) >> 12,
1579 (EXTRACT_16BITS(tptr
)) & 0x0fff));
1583 stlv_len
= stlv_len
- 8;
1585 while (stlv_len
>= 4) {
1586 ND_TCHECK2(*tptr
, 4);
1587 ND_PRINT((ndo
, "\n\t T: %d, R: %d, RES: %d, ISID: %d",
1588 (EXTRACT_32BITS(tptr
) >> 31),
1589 (EXTRACT_32BITS(tptr
) >> 30) & 0x01,
1590 (EXTRACT_32BITS(tptr
) >> 24) & 0x03f,
1591 (EXTRACT_32BITS(tptr
)) & 0x0ffffff));
1595 stlv_len
= stlv_len
- 4;
1607 ND_PRINT((ndo
, "\n\t\t"));
1608 ND_PRINT((ndo
, "%s", tstr
));
1612 /* shared routine for printing system, node and lsp-ids */
1614 isis_print_id(const uint8_t *cp
, int id_len
)
1617 static char id
[sizeof("xxxx.xxxx.xxxx.yy-zz")];
1620 for (i
= 1; i
<= SYSTEM_ID_LEN
; i
++) {
1621 snprintf(pos
, sizeof(id
) - (pos
- id
), "%02x", *cp
++);
1623 if (i
== 2 || i
== 4)
1626 if (id_len
>= NODE_ID_LEN
) {
1627 snprintf(pos
, sizeof(id
) - (pos
- id
), ".%02x", *cp
++);
1630 if (id_len
== LSP_ID_LEN
)
1631 snprintf(pos
, sizeof(id
) - (pos
- id
), "-%02x", *cp
);
1635 /* print the 4-byte metric block which is common found in the old-style TLVs */
1637 isis_print_metric_block(netdissect_options
*ndo
,
1638 const struct isis_metric_block
*isis_metric_block
)
1640 ND_PRINT((ndo
, ", Default Metric: %d, %s",
1641 ISIS_LSP_TLV_METRIC_VALUE(isis_metric_block
->metric_default
),
1642 ISIS_LSP_TLV_METRIC_IE(isis_metric_block
->metric_default
) ? "External" : "Internal"));
1643 if (!ISIS_LSP_TLV_METRIC_SUPPORTED(isis_metric_block
->metric_delay
))
1644 ND_PRINT((ndo
, "\n\t\t Delay Metric: %d, %s",
1645 ISIS_LSP_TLV_METRIC_VALUE(isis_metric_block
->metric_delay
),
1646 ISIS_LSP_TLV_METRIC_IE(isis_metric_block
->metric_delay
) ? "External" : "Internal"));
1647 if (!ISIS_LSP_TLV_METRIC_SUPPORTED(isis_metric_block
->metric_expense
))
1648 ND_PRINT((ndo
, "\n\t\t Expense Metric: %d, %s",
1649 ISIS_LSP_TLV_METRIC_VALUE(isis_metric_block
->metric_expense
),
1650 ISIS_LSP_TLV_METRIC_IE(isis_metric_block
->metric_expense
) ? "External" : "Internal"));
1651 if (!ISIS_LSP_TLV_METRIC_SUPPORTED(isis_metric_block
->metric_error
))
1652 ND_PRINT((ndo
, "\n\t\t Error Metric: %d, %s",
1653 ISIS_LSP_TLV_METRIC_VALUE(isis_metric_block
->metric_error
),
1654 ISIS_LSP_TLV_METRIC_IE(isis_metric_block
->metric_error
) ? "External" : "Internal"));
1656 return(1); /* everything is ok */
1660 isis_print_tlv_ip_reach(netdissect_options
*ndo
,
1661 const uint8_t *cp
, const char *ident
, int length
)
1664 const struct isis_tlv_ip_reach
*tlv_ip_reach
;
1666 tlv_ip_reach
= (const struct isis_tlv_ip_reach
*)cp
;
1668 while (length
> 0) {
1669 if ((size_t)length
< sizeof(*tlv_ip_reach
)) {
1670 ND_PRINT((ndo
, "short IPv4 Reachability (%d vs %lu)",
1672 (unsigned long)sizeof(*tlv_ip_reach
)));
1676 if (!ND_TTEST(*tlv_ip_reach
))
1679 prefix_len
= mask2plen(EXTRACT_32BITS(tlv_ip_reach
->mask
));
1681 if (prefix_len
== -1)
1682 ND_PRINT((ndo
, "%sIPv4 prefix: %s mask %s",
1684 ipaddr_string(ndo
, (tlv_ip_reach
->prefix
)),
1685 ipaddr_string(ndo
, (tlv_ip_reach
->mask
))));
1687 ND_PRINT((ndo
, "%sIPv4 prefix: %15s/%u",
1689 ipaddr_string(ndo
, (tlv_ip_reach
->prefix
)),
1692 ND_PRINT((ndo
, ", Distribution: %s, Metric: %u, %s",
1693 ISIS_LSP_TLV_METRIC_UPDOWN(tlv_ip_reach
->isis_metric_block
.metric_default
) ? "down" : "up",
1694 ISIS_LSP_TLV_METRIC_VALUE(tlv_ip_reach
->isis_metric_block
.metric_default
),
1695 ISIS_LSP_TLV_METRIC_IE(tlv_ip_reach
->isis_metric_block
.metric_default
) ? "External" : "Internal"));
1697 if (!ISIS_LSP_TLV_METRIC_SUPPORTED(tlv_ip_reach
->isis_metric_block
.metric_delay
))
1698 ND_PRINT((ndo
, "%s Delay Metric: %u, %s",
1700 ISIS_LSP_TLV_METRIC_VALUE(tlv_ip_reach
->isis_metric_block
.metric_delay
),
1701 ISIS_LSP_TLV_METRIC_IE(tlv_ip_reach
->isis_metric_block
.metric_delay
) ? "External" : "Internal"));
1703 if (!ISIS_LSP_TLV_METRIC_SUPPORTED(tlv_ip_reach
->isis_metric_block
.metric_expense
))
1704 ND_PRINT((ndo
, "%s Expense Metric: %u, %s",
1706 ISIS_LSP_TLV_METRIC_VALUE(tlv_ip_reach
->isis_metric_block
.metric_expense
),
1707 ISIS_LSP_TLV_METRIC_IE(tlv_ip_reach
->isis_metric_block
.metric_expense
) ? "External" : "Internal"));
1709 if (!ISIS_LSP_TLV_METRIC_SUPPORTED(tlv_ip_reach
->isis_metric_block
.metric_error
))
1710 ND_PRINT((ndo
, "%s Error Metric: %u, %s",
1712 ISIS_LSP_TLV_METRIC_VALUE(tlv_ip_reach
->isis_metric_block
.metric_error
),
1713 ISIS_LSP_TLV_METRIC_IE(tlv_ip_reach
->isis_metric_block
.metric_error
) ? "External" : "Internal"));
1715 length
-= sizeof(struct isis_tlv_ip_reach
);
1722 * this is the common IP-REACH subTLV decoder it is called
1723 * from various EXTD-IP REACH TLVs (135,235,236,237)
1727 isis_print_ip_reach_subtlv(netdissect_options
*ndo
,
1728 const uint8_t *tptr
, int subt
, int subl
,
1731 /* first lets see if we know the subTLVs name*/
1732 ND_PRINT((ndo
, "%s%s subTLV #%u, length: %u",
1733 ident
, tok2str(isis_ext_ip_reach_subtlv_values
, "unknown", subt
),
1736 ND_TCHECK2(*tptr
,subl
);
1739 case ISIS_SUBTLV_EXTD_IP_REACH_MGMT_PREFIX_COLOR
: /* fall through */
1740 case ISIS_SUBTLV_EXTD_IP_REACH_ADMIN_TAG32
:
1742 ND_PRINT((ndo
, ", 0x%08x (=%u)",
1743 EXTRACT_32BITS(tptr
),
1744 EXTRACT_32BITS(tptr
)));
1749 case ISIS_SUBTLV_EXTD_IP_REACH_ADMIN_TAG64
:
1751 ND_PRINT((ndo
, ", 0x%08x%08x",
1752 EXTRACT_32BITS(tptr
),
1753 EXTRACT_32BITS(tptr
+4)));
1759 if (!print_unknown_data(ndo
, tptr
, "\n\t\t ", subl
))
1766 ND_PRINT((ndo
, "%s", ident
));
1767 ND_PRINT((ndo
, "%s", tstr
));
1772 * this is the common IS-REACH subTLV decoder it is called
1773 * from isis_print_ext_is_reach()
1777 isis_print_is_reach_subtlv(netdissect_options
*ndo
,
1778 const uint8_t *tptr
, u_int subt
, u_int subl
,
1781 u_int te_class
,priority_level
,gmpls_switch_cap
;
1782 union { /* int to float conversion buffer for several subTLVs */
1787 /* first lets see if we know the subTLVs name*/
1788 ND_PRINT((ndo
, "%s%s subTLV #%u, length: %u",
1789 ident
, tok2str(isis_ext_is_reach_subtlv_values
, "unknown", subt
),
1792 ND_TCHECK2(*tptr
, subl
);
1795 case ISIS_SUBTLV_EXT_IS_REACH_ADMIN_GROUP
:
1796 case ISIS_SUBTLV_EXT_IS_REACH_LINK_LOCAL_REMOTE_ID
:
1797 case ISIS_SUBTLV_EXT_IS_REACH_LINK_REMOTE_ID
:
1799 ND_PRINT((ndo
, ", 0x%08x", EXTRACT_32BITS(tptr
)));
1800 if (subl
== 8) /* rfc4205 */
1801 ND_PRINT((ndo
, ", 0x%08x", EXTRACT_32BITS(tptr
+4)));
1804 case ISIS_SUBTLV_EXT_IS_REACH_IPV4_INTF_ADDR
:
1805 case ISIS_SUBTLV_EXT_IS_REACH_IPV4_NEIGHBOR_ADDR
:
1806 if (subl
>= sizeof(struct in_addr
))
1807 ND_PRINT((ndo
, ", %s", ipaddr_string(ndo
, tptr
)));
1809 case ISIS_SUBTLV_EXT_IS_REACH_MAX_LINK_BW
:
1810 case ISIS_SUBTLV_EXT_IS_REACH_RESERVABLE_BW
:
1812 bw
.i
= EXTRACT_32BITS(tptr
);
1813 ND_PRINT((ndo
, ", %.3f Mbps", bw
.f
* 8 / 1000000));
1816 case ISIS_SUBTLV_EXT_IS_REACH_UNRESERVED_BW
:
1818 for (te_class
= 0; te_class
< 8; te_class
++) {
1819 bw
.i
= EXTRACT_32BITS(tptr
);
1820 ND_PRINT((ndo
, "%s TE-Class %u: %.3f Mbps",
1823 bw
.f
* 8 / 1000000));
1828 case ISIS_SUBTLV_EXT_IS_REACH_BW_CONSTRAINTS
: /* fall through */
1829 case ISIS_SUBTLV_EXT_IS_REACH_BW_CONSTRAINTS_OLD
:
1830 ND_PRINT((ndo
, "%sBandwidth Constraints Model ID: %s (%u)",
1832 tok2str(diffserv_te_bc_values
, "unknown", *tptr
),
1835 /* decode BCs until the subTLV ends */
1836 for (te_class
= 0; te_class
< (subl
-1)/4; te_class
++) {
1837 ND_TCHECK2(*tptr
, 4);
1838 bw
.i
= EXTRACT_32BITS(tptr
);
1839 ND_PRINT((ndo
, "%s Bandwidth constraint CT%u: %.3f Mbps",
1842 bw
.f
* 8 / 1000000));
1846 case ISIS_SUBTLV_EXT_IS_REACH_TE_METRIC
:
1848 ND_PRINT((ndo
, ", %u", EXTRACT_24BITS(tptr
)));
1850 case ISIS_SUBTLV_EXT_IS_REACH_LINK_ATTRIBUTE
:
1852 ND_PRINT((ndo
, ", [ %s ] (0x%04x)",
1853 bittok2str(isis_subtlv_link_attribute_values
,
1855 EXTRACT_16BITS(tptr
)),
1856 EXTRACT_16BITS(tptr
)));
1859 case ISIS_SUBTLV_EXT_IS_REACH_LINK_PROTECTION_TYPE
:
1861 ND_PRINT((ndo
, ", %s, Priority %u",
1862 bittok2str(gmpls_link_prot_values
, "none", *tptr
),
1866 case ISIS_SUBTLV_SPB_METRIC
:
1868 ND_PRINT((ndo
, ", LM: %u", EXTRACT_24BITS(tptr
)));
1870 ND_PRINT((ndo
, ", P: %u", *(tptr
)));
1872 ND_PRINT((ndo
, ", P-ID: %u", EXTRACT_16BITS(tptr
)));
1875 case ISIS_SUBTLV_EXT_IS_REACH_INTF_SW_CAP_DESCR
:
1877 gmpls_switch_cap
= *tptr
;
1878 ND_PRINT((ndo
, "%s Interface Switching Capability:%s",
1880 tok2str(gmpls_switch_cap_values
, "Unknown", gmpls_switch_cap
)));
1881 ND_PRINT((ndo
, ", LSP Encoding: %s",
1882 tok2str(gmpls_encoding_values
, "Unknown", *(tptr
+ 1))));
1884 ND_PRINT((ndo
, "%s Max LSP Bandwidth:", ident
));
1885 for (priority_level
= 0; priority_level
< 8; priority_level
++) {
1886 bw
.i
= EXTRACT_32BITS(tptr
);
1887 ND_PRINT((ndo
, "%s priority level %d: %.3f Mbps",
1890 bw
.f
* 8 / 1000000));
1894 switch (gmpls_switch_cap
) {
1899 ND_TCHECK2(*tptr
, 6);
1900 bw
.i
= EXTRACT_32BITS(tptr
);
1901 ND_PRINT((ndo
, "%s Min LSP Bandwidth: %.3f Mbps", ident
, bw
.f
* 8 / 1000000));
1902 ND_PRINT((ndo
, "%s Interface MTU: %u", ident
, EXTRACT_16BITS(tptr
+ 4)));
1905 ND_TCHECK2(*tptr
, 8);
1906 bw
.i
= EXTRACT_32BITS(tptr
);
1907 ND_PRINT((ndo
, "%s Min LSP Bandwidth: %.3f Mbps", ident
, bw
.f
* 8 / 1000000));
1908 ND_PRINT((ndo
, "%s Indication %s", ident
,
1909 tok2str(gmpls_switch_cap_tsc_indication_values
, "Unknown (%u)", *(tptr
+ 4))));
1912 /* there is some optional stuff left to decode but this is as of yet
1913 not specified so just lets hexdump what is left */
1915 if (!print_unknown_data(ndo
, tptr
, "\n\t\t ", subl
))
1922 if (!print_unknown_data(ndo
, tptr
, "\n\t\t ", subl
))
1933 * this is the common IS-REACH decoder it is called
1934 * from various EXTD-IS REACH style TLVs (22,24,222)
1938 isis_print_ext_is_reach(netdissect_options
*ndo
,
1939 const uint8_t *tptr
, const char *ident
, int tlv_type
)
1941 char ident_buffer
[20];
1942 int subtlv_type
,subtlv_len
,subtlv_sum_len
;
1943 int proc_bytes
= 0; /* how many bytes did we process ? */
1945 if (!ND_TTEST2(*tptr
, NODE_ID_LEN
))
1948 ND_PRINT((ndo
, "%sIS Neighbor: %s", ident
, isis_print_id(tptr
, NODE_ID_LEN
)));
1949 tptr
+=(NODE_ID_LEN
);
1951 if (tlv_type
!= ISIS_TLV_IS_ALIAS_ID
) { /* the Alias TLV Metric field is implicit 0 */
1952 if (!ND_TTEST2(*tptr
, 3)) /* and is therefore skipped */
1954 ND_PRINT((ndo
, ", Metric: %d", EXTRACT_24BITS(tptr
)));
1958 if (!ND_TTEST2(*tptr
, 1))
1960 subtlv_sum_len
=*(tptr
++); /* read out subTLV length */
1961 proc_bytes
=NODE_ID_LEN
+3+1;
1962 ND_PRINT((ndo
, ", %ssub-TLVs present",subtlv_sum_len
? "" : "no "));
1963 if (subtlv_sum_len
) {
1964 ND_PRINT((ndo
, " (%u)", subtlv_sum_len
));
1965 while (subtlv_sum_len
>0) {
1966 if (!ND_TTEST2(*tptr
,2))
1968 subtlv_type
=*(tptr
++);
1969 subtlv_len
=*(tptr
++);
1970 /* prepend the indent string */
1971 snprintf(ident_buffer
, sizeof(ident_buffer
), "%s ",ident
);
1972 if (!isis_print_is_reach_subtlv(ndo
, tptr
, subtlv_type
, subtlv_len
, ident_buffer
))
1975 subtlv_sum_len
-=(subtlv_len
+2);
1976 proc_bytes
+=(subtlv_len
+2);
1983 * this is the common Multi Topology ID decoder
1984 * it is called from various MT-TLVs (222,229,235,237)
1988 isis_print_mtid(netdissect_options
*ndo
,
1989 const uint8_t *tptr
, const char *ident
)
1991 if (!ND_TTEST2(*tptr
, 2))
1994 ND_PRINT((ndo
, "%s%s",
1996 tok2str(isis_mt_values
,
1997 "Reserved for IETF Consensus",
1998 ISIS_MASK_MTID(EXTRACT_16BITS(tptr
)))));
2000 ND_PRINT((ndo
, " Topology (0x%03x), Flags: [%s]",
2001 ISIS_MASK_MTID(EXTRACT_16BITS(tptr
)),
2002 bittok2str(isis_mt_flag_values
, "none",ISIS_MASK_MTFLAGS(EXTRACT_16BITS(tptr
)))));
2008 * this is the common extended IP reach decoder
2009 * it is called from TLVs (135,235,236,237)
2010 * we process the TLV and optional subTLVs and return
2011 * the amount of processed bytes
2015 isis_print_extd_ip_reach(netdissect_options
*ndo
,
2016 const uint8_t *tptr
, const char *ident
, uint16_t afi
)
2018 char ident_buffer
[20];
2019 uint8_t prefix
[sizeof(struct in6_addr
)]; /* shared copy buffer for IPv4 and IPv6 prefixes */
2020 u_int metric
, status_byte
, bit_length
, byte_length
, sublen
, processed
, subtlvtype
, subtlvlen
;
2022 if (!ND_TTEST2(*tptr
, 4))
2024 metric
= EXTRACT_32BITS(tptr
);
2028 if (afi
== AF_INET
) {
2029 if (!ND_TTEST2(*tptr
, 1)) /* fetch status byte */
2031 status_byte
=*(tptr
++);
2032 bit_length
= status_byte
&0x3f;
2033 if (bit_length
> 32) {
2034 ND_PRINT((ndo
, "%sIPv4 prefix: bad bit length %u",
2040 } else if (afi
== AF_INET6
) {
2041 if (!ND_TTEST2(*tptr
, 1)) /* fetch status & prefix_len byte */
2043 status_byte
=*(tptr
++);
2044 bit_length
=*(tptr
++);
2045 if (bit_length
> 128) {
2046 ND_PRINT((ndo
, "%sIPv6 prefix: bad bit length %u",
2053 return (0); /* somebody is fooling us */
2055 byte_length
= (bit_length
+ 7) / 8; /* prefix has variable length encoding */
2057 if (!ND_TTEST2(*tptr
, byte_length
))
2059 memset(prefix
, 0, sizeof prefix
); /* clear the copy buffer */
2060 memcpy(prefix
,tptr
,byte_length
); /* copy as much as is stored in the TLV */
2062 processed
+=byte_length
;
2065 ND_PRINT((ndo
, "%sIPv4 prefix: %15s/%u",
2067 ipaddr_string(ndo
, prefix
),
2069 else if (afi
== AF_INET6
)
2070 ND_PRINT((ndo
, "%sIPv6 prefix: %s/%u",
2072 ip6addr_string(ndo
, prefix
),
2075 ND_PRINT((ndo
, ", Distribution: %s, Metric: %u",
2076 ISIS_MASK_TLV_EXTD_IP_UPDOWN(status_byte
) ? "down" : "up",
2079 if (afi
== AF_INET
&& ISIS_MASK_TLV_EXTD_IP_SUBTLV(status_byte
))
2080 ND_PRINT((ndo
, ", sub-TLVs present"));
2081 else if (afi
== AF_INET6
)
2082 ND_PRINT((ndo
, ", %s%s",
2083 ISIS_MASK_TLV_EXTD_IP6_IE(status_byte
) ? "External" : "Internal",
2084 ISIS_MASK_TLV_EXTD_IP6_SUBTLV(status_byte
) ? ", sub-TLVs present" : ""));
2086 if ((afi
== AF_INET
&& ISIS_MASK_TLV_EXTD_IP_SUBTLV(status_byte
))
2087 || (afi
== AF_INET6
&& ISIS_MASK_TLV_EXTD_IP6_SUBTLV(status_byte
))
2089 /* assume that one prefix can hold more
2090 than one subTLV - therefore the first byte must reflect
2091 the aggregate bytecount of the subTLVs for this prefix
2093 if (!ND_TTEST2(*tptr
, 1))
2096 processed
+=sublen
+1;
2097 ND_PRINT((ndo
, " (%u)", sublen
)); /* print out subTLV length */
2100 if (!ND_TTEST2(*tptr
,2))
2102 subtlvtype
=*(tptr
++);
2103 subtlvlen
=*(tptr
++);
2104 /* prepend the indent string */
2105 snprintf(ident_buffer
, sizeof(ident_buffer
), "%s ",ident
);
2106 if (!isis_print_ip_reach_subtlv(ndo
, tptr
, subtlvtype
, subtlvlen
, ident_buffer
))
2109 sublen
-=(subtlvlen
+2);
2116 * Clear checksum and lifetime prior to signature verification.
2119 isis_clear_checksum_lifetime(void *header
)
2121 struct isis_lsp_header
*header_lsp
= (struct isis_lsp_header
*) header
;
2123 header_lsp
->checksum
[0] = 0;
2124 header_lsp
->checksum
[1] = 0;
2125 header_lsp
->remaining_lifetime
[0] = 0;
2126 header_lsp
->remaining_lifetime
[1] = 0;
2131 * Decode IS-IS packets. Return 0 on error.
2135 isis_print(netdissect_options
*ndo
,
2136 const uint8_t *p
, u_int length
)
2138 const struct isis_common_header
*isis_header
;
2140 const struct isis_iih_lan_header
*header_iih_lan
;
2141 const struct isis_iih_ptp_header
*header_iih_ptp
;
2142 const struct isis_lsp_header
*header_lsp
;
2143 const struct isis_csnp_header
*header_csnp
;
2144 const struct isis_psnp_header
*header_psnp
;
2146 const struct isis_tlv_lsp
*tlv_lsp
;
2147 const struct isis_tlv_ptp_adj
*tlv_ptp_adj
;
2148 const struct isis_tlv_is_reach
*tlv_is_reach
;
2149 const struct isis_tlv_es_reach
*tlv_es_reach
;
2151 uint8_t pdu_type
, max_area
, id_length
, tlv_type
, tlv_len
, tmp
, alen
, lan_alen
, prefix_len
;
2152 uint8_t ext_is_len
, ext_ip_len
, mt_len
;
2153 const uint8_t *optr
, *pptr
, *tptr
;
2154 u_short packet_len
,pdu_len
, key_id
;
2159 optr
= p
; /* initialize the _o_riginal pointer to the packet start -
2160 need it for parsing the checksum TLV and authentication
2162 isis_header
= (const struct isis_common_header
*)p
;
2163 ND_TCHECK(*isis_header
);
2164 if (length
< ISIS_COMMON_HEADER_SIZE
)
2166 pptr
= p
+(ISIS_COMMON_HEADER_SIZE
);
2167 header_iih_lan
= (const struct isis_iih_lan_header
*)pptr
;
2168 header_iih_ptp
= (const struct isis_iih_ptp_header
*)pptr
;
2169 header_lsp
= (const struct isis_lsp_header
*)pptr
;
2170 header_csnp
= (const struct isis_csnp_header
*)pptr
;
2171 header_psnp
= (const struct isis_psnp_header
*)pptr
;
2173 if (!ndo
->ndo_eflag
)
2174 ND_PRINT((ndo
, "IS-IS"));
2177 * Sanity checking of the header.
2180 if (isis_header
->version
!= ISIS_VERSION
) {
2181 ND_PRINT((ndo
, "version %d packet not supported", isis_header
->version
));
2185 if ((isis_header
->id_length
!= SYSTEM_ID_LEN
) && (isis_header
->id_length
!= 0)) {
2186 ND_PRINT((ndo
, "system ID length of %d is not supported",
2187 isis_header
->id_length
));
2191 if (isis_header
->pdu_version
!= ISIS_VERSION
) {
2192 ND_PRINT((ndo
, "version %d packet not supported", isis_header
->pdu_version
));
2196 if (length
< isis_header
->fixed_len
) {
2197 ND_PRINT((ndo
, "fixed header length %u > packet length %u", isis_header
->fixed_len
, length
));
2201 if (isis_header
->fixed_len
< ISIS_COMMON_HEADER_SIZE
) {
2202 ND_PRINT((ndo
, "fixed header length %u < minimum header size %u", isis_header
->fixed_len
, (u_int
)ISIS_COMMON_HEADER_SIZE
));
2206 max_area
= isis_header
->max_area
;
2209 max_area
= 3; /* silly shit */
2212 ND_PRINT((ndo
, "bad packet -- 255 areas"));
2218 id_length
= isis_header
->id_length
;
2221 id_length
= 6; /* silly shit again */
2223 case 1: /* 1-8 are valid sys-ID lenghts */
2233 id_length
= 0; /* entirely useless */
2239 /* toss any non 6-byte sys-ID len PDUs */
2240 if (id_length
!= 6 ) {
2241 ND_PRINT((ndo
, "bad packet -- illegal sys-ID length (%u)", id_length
));
2245 pdu_type
=isis_header
->pdu_type
;
2247 /* in non-verbose mode print the basic PDU Type plus PDU specific brief information*/
2248 if (ndo
->ndo_vflag
== 0) {
2249 ND_PRINT((ndo
, "%s%s",
2250 ndo
->ndo_eflag
? "" : ", ",
2251 tok2str(isis_pdu_values
, "unknown PDU-Type %u", pdu_type
)));
2253 /* ok they seem to want to know everything - lets fully decode it */
2254 ND_PRINT((ndo
, "%slength %u", ndo
->ndo_eflag
? "" : ", ", length
));
2256 ND_PRINT((ndo
, "\n\t%s, hlen: %u, v: %u, pdu-v: %u, sys-id-len: %u (%u), max-area: %u (%u)",
2257 tok2str(isis_pdu_values
,
2260 isis_header
->fixed_len
,
2261 isis_header
->version
,
2262 isis_header
->pdu_version
,
2264 isis_header
->id_length
,
2266 isis_header
->max_area
));
2268 if (ndo
->ndo_vflag
> 1) {
2269 if (!print_unknown_data(ndo
, optr
, "\n\t", 8)) /* provide the _o_riginal pointer */
2270 return (0); /* for optionally debugging the common header */
2276 case ISIS_PDU_L1_LAN_IIH
:
2277 case ISIS_PDU_L2_LAN_IIH
:
2278 if (isis_header
->fixed_len
!= (ISIS_COMMON_HEADER_SIZE
+ISIS_IIH_LAN_HEADER_SIZE
)) {
2279 ND_PRINT((ndo
, ", bogus fixed header length %u should be %lu",
2280 isis_header
->fixed_len
, (unsigned long)(ISIS_COMMON_HEADER_SIZE
+ISIS_IIH_LAN_HEADER_SIZE
)));
2283 ND_TCHECK(*header_iih_lan
);
2284 if (length
< ISIS_COMMON_HEADER_SIZE
+ISIS_IIH_LAN_HEADER_SIZE
)
2286 if (ndo
->ndo_vflag
== 0) {
2287 ND_PRINT((ndo
, ", src-id %s",
2288 isis_print_id(header_iih_lan
->source_id
, SYSTEM_ID_LEN
)));
2289 ND_PRINT((ndo
, ", lan-id %s, prio %u",
2290 isis_print_id(header_iih_lan
->lan_id
,NODE_ID_LEN
),
2291 header_iih_lan
->priority
));
2292 ND_PRINT((ndo
, ", length %u", length
));
2295 pdu_len
=EXTRACT_16BITS(header_iih_lan
->pdu_len
);
2296 if (packet_len
>pdu_len
) {
2297 packet_len
=pdu_len
; /* do TLV decoding as long as it makes sense */
2301 ND_PRINT((ndo
, "\n\t source-id: %s, holding time: %us, Flags: [%s]",
2302 isis_print_id(header_iih_lan
->source_id
,SYSTEM_ID_LEN
),
2303 EXTRACT_16BITS(header_iih_lan
->holding_time
),
2304 tok2str(isis_iih_circuit_type_values
,
2305 "unknown circuit type 0x%02x",
2306 header_iih_lan
->circuit_type
)));
2308 ND_PRINT((ndo
, "\n\t lan-id: %s, Priority: %u, PDU length: %u",
2309 isis_print_id(header_iih_lan
->lan_id
, NODE_ID_LEN
),
2310 (header_iih_lan
->priority
) & ISIS_LAN_PRIORITY_MASK
,
2313 if (ndo
->ndo_vflag
> 1) {
2314 if (!print_unknown_data(ndo
, pptr
, "\n\t ", ISIS_IIH_LAN_HEADER_SIZE
))
2318 packet_len
-= (ISIS_COMMON_HEADER_SIZE
+ISIS_IIH_LAN_HEADER_SIZE
);
2319 pptr
= p
+ (ISIS_COMMON_HEADER_SIZE
+ISIS_IIH_LAN_HEADER_SIZE
);
2322 case ISIS_PDU_PTP_IIH
:
2323 if (isis_header
->fixed_len
!= (ISIS_COMMON_HEADER_SIZE
+ISIS_IIH_PTP_HEADER_SIZE
)) {
2324 ND_PRINT((ndo
, ", bogus fixed header length %u should be %lu",
2325 isis_header
->fixed_len
, (unsigned long)(ISIS_COMMON_HEADER_SIZE
+ISIS_IIH_PTP_HEADER_SIZE
)));
2328 ND_TCHECK(*header_iih_ptp
);
2329 if (length
< ISIS_COMMON_HEADER_SIZE
+ISIS_IIH_PTP_HEADER_SIZE
)
2331 if (ndo
->ndo_vflag
== 0) {
2332 ND_PRINT((ndo
, ", src-id %s", isis_print_id(header_iih_ptp
->source_id
, SYSTEM_ID_LEN
)));
2333 ND_PRINT((ndo
, ", length %u", length
));
2336 pdu_len
=EXTRACT_16BITS(header_iih_ptp
->pdu_len
);
2337 if (packet_len
>pdu_len
) {
2338 packet_len
=pdu_len
; /* do TLV decoding as long as it makes sense */
2342 ND_PRINT((ndo
, "\n\t source-id: %s, holding time: %us, Flags: [%s]",
2343 isis_print_id(header_iih_ptp
->source_id
,SYSTEM_ID_LEN
),
2344 EXTRACT_16BITS(header_iih_ptp
->holding_time
),
2345 tok2str(isis_iih_circuit_type_values
,
2346 "unknown circuit type 0x%02x",
2347 header_iih_ptp
->circuit_type
)));
2349 ND_PRINT((ndo
, "\n\t circuit-id: 0x%02x, PDU length: %u",
2350 header_iih_ptp
->circuit_id
,
2353 if (ndo
->ndo_vflag
> 1) {
2354 if (!print_unknown_data(ndo
, pptr
, "\n\t ", ISIS_IIH_PTP_HEADER_SIZE
))
2358 packet_len
-= (ISIS_COMMON_HEADER_SIZE
+ISIS_IIH_PTP_HEADER_SIZE
);
2359 pptr
= p
+ (ISIS_COMMON_HEADER_SIZE
+ISIS_IIH_PTP_HEADER_SIZE
);
2362 case ISIS_PDU_L1_LSP
:
2363 case ISIS_PDU_L2_LSP
:
2364 if (isis_header
->fixed_len
!= (ISIS_COMMON_HEADER_SIZE
+ISIS_LSP_HEADER_SIZE
)) {
2365 ND_PRINT((ndo
, ", bogus fixed header length %u should be %lu",
2366 isis_header
->fixed_len
, (unsigned long)ISIS_LSP_HEADER_SIZE
));
2369 ND_TCHECK(*header_lsp
);
2370 if (length
< ISIS_COMMON_HEADER_SIZE
+ISIS_LSP_HEADER_SIZE
)
2372 if (ndo
->ndo_vflag
== 0) {
2373 ND_PRINT((ndo
, ", lsp-id %s, seq 0x%08x, lifetime %5us",
2374 isis_print_id(header_lsp
->lsp_id
, LSP_ID_LEN
),
2375 EXTRACT_32BITS(header_lsp
->sequence_number
),
2376 EXTRACT_16BITS(header_lsp
->remaining_lifetime
)));
2377 ND_PRINT((ndo
, ", length %u", length
));
2380 pdu_len
=EXTRACT_16BITS(header_lsp
->pdu_len
);
2381 if (packet_len
>pdu_len
) {
2382 packet_len
=pdu_len
; /* do TLV decoding as long as it makes sense */
2386 ND_PRINT((ndo
, "\n\t lsp-id: %s, seq: 0x%08x, lifetime: %5us\n\t chksum: 0x%04x",
2387 isis_print_id(header_lsp
->lsp_id
, LSP_ID_LEN
),
2388 EXTRACT_32BITS(header_lsp
->sequence_number
),
2389 EXTRACT_16BITS(header_lsp
->remaining_lifetime
),
2390 EXTRACT_16BITS(header_lsp
->checksum
)));
2392 osi_print_cksum(ndo
, (const uint8_t *)header_lsp
->lsp_id
,
2393 EXTRACT_16BITS(header_lsp
->checksum
),
2396 ND_PRINT((ndo
, ", PDU length: %u, Flags: [ %s",
2398 ISIS_MASK_LSP_OL_BIT(header_lsp
->typeblock
) ? "Overload bit set, " : ""));
2400 if (ISIS_MASK_LSP_ATT_BITS(header_lsp
->typeblock
)) {
2401 ND_PRINT((ndo
, "%s", ISIS_MASK_LSP_ATT_DEFAULT_BIT(header_lsp
->typeblock
) ? "default " : ""));
2402 ND_PRINT((ndo
, "%s", ISIS_MASK_LSP_ATT_DELAY_BIT(header_lsp
->typeblock
) ? "delay " : ""));
2403 ND_PRINT((ndo
, "%s", ISIS_MASK_LSP_ATT_EXPENSE_BIT(header_lsp
->typeblock
) ? "expense " : ""));
2404 ND_PRINT((ndo
, "%s", ISIS_MASK_LSP_ATT_ERROR_BIT(header_lsp
->typeblock
) ? "error " : ""));
2405 ND_PRINT((ndo
, "ATT bit set, "));
2407 ND_PRINT((ndo
, "%s", ISIS_MASK_LSP_PARTITION_BIT(header_lsp
->typeblock
) ? "P bit set, " : ""));
2408 ND_PRINT((ndo
, "%s ]", tok2str(isis_lsp_istype_values
, "Unknown(0x%x)",
2409 ISIS_MASK_LSP_ISTYPE_BITS(header_lsp
->typeblock
))));
2411 if (ndo
->ndo_vflag
> 1) {
2412 if (!print_unknown_data(ndo
, pptr
, "\n\t ", ISIS_LSP_HEADER_SIZE
))
2416 packet_len
-= (ISIS_COMMON_HEADER_SIZE
+ISIS_LSP_HEADER_SIZE
);
2417 pptr
= p
+ (ISIS_COMMON_HEADER_SIZE
+ISIS_LSP_HEADER_SIZE
);
2420 case ISIS_PDU_L1_CSNP
:
2421 case ISIS_PDU_L2_CSNP
:
2422 if (isis_header
->fixed_len
!= (ISIS_COMMON_HEADER_SIZE
+ISIS_CSNP_HEADER_SIZE
)) {
2423 ND_PRINT((ndo
, ", bogus fixed header length %u should be %lu",
2424 isis_header
->fixed_len
, (unsigned long)(ISIS_COMMON_HEADER_SIZE
+ISIS_CSNP_HEADER_SIZE
)));
2427 ND_TCHECK(*header_csnp
);
2428 if (length
< ISIS_COMMON_HEADER_SIZE
+ISIS_CSNP_HEADER_SIZE
)
2430 if (ndo
->ndo_vflag
== 0) {
2431 ND_PRINT((ndo
, ", src-id %s", isis_print_id(header_csnp
->source_id
, NODE_ID_LEN
)));
2432 ND_PRINT((ndo
, ", length %u", length
));
2435 pdu_len
=EXTRACT_16BITS(header_csnp
->pdu_len
);
2436 if (packet_len
>pdu_len
) {
2437 packet_len
=pdu_len
; /* do TLV decoding as long as it makes sense */
2441 ND_PRINT((ndo
, "\n\t source-id: %s, PDU length: %u",
2442 isis_print_id(header_csnp
->source_id
, NODE_ID_LEN
),
2444 ND_PRINT((ndo
, "\n\t start lsp-id: %s",
2445 isis_print_id(header_csnp
->start_lsp_id
, LSP_ID_LEN
)));
2446 ND_PRINT((ndo
, "\n\t end lsp-id: %s",
2447 isis_print_id(header_csnp
->end_lsp_id
, LSP_ID_LEN
)));
2449 if (ndo
->ndo_vflag
> 1) {
2450 if (!print_unknown_data(ndo
, pptr
, "\n\t ", ISIS_CSNP_HEADER_SIZE
))
2454 packet_len
-= (ISIS_COMMON_HEADER_SIZE
+ISIS_CSNP_HEADER_SIZE
);
2455 pptr
= p
+ (ISIS_COMMON_HEADER_SIZE
+ISIS_CSNP_HEADER_SIZE
);
2458 case ISIS_PDU_L1_PSNP
:
2459 case ISIS_PDU_L2_PSNP
:
2460 if (isis_header
->fixed_len
!= (ISIS_COMMON_HEADER_SIZE
+ISIS_PSNP_HEADER_SIZE
)) {
2461 ND_PRINT((ndo
, "- bogus fixed header length %u should be %lu",
2462 isis_header
->fixed_len
, (unsigned long)(ISIS_COMMON_HEADER_SIZE
+ISIS_PSNP_HEADER_SIZE
)));
2465 ND_TCHECK(*header_psnp
);
2466 if (length
< ISIS_COMMON_HEADER_SIZE
+ISIS_PSNP_HEADER_SIZE
)
2468 if (ndo
->ndo_vflag
== 0) {
2469 ND_PRINT((ndo
, ", src-id %s", isis_print_id(header_psnp
->source_id
, NODE_ID_LEN
)));
2470 ND_PRINT((ndo
, ", length %u", length
));
2473 pdu_len
=EXTRACT_16BITS(header_psnp
->pdu_len
);
2474 if (packet_len
>pdu_len
) {
2475 packet_len
=pdu_len
; /* do TLV decoding as long as it makes sense */
2479 ND_PRINT((ndo
, "\n\t source-id: %s, PDU length: %u",
2480 isis_print_id(header_psnp
->source_id
, NODE_ID_LEN
),
2483 if (ndo
->ndo_vflag
> 1) {
2484 if (!print_unknown_data(ndo
, pptr
, "\n\t ", ISIS_PSNP_HEADER_SIZE
))
2488 packet_len
-= (ISIS_COMMON_HEADER_SIZE
+ISIS_PSNP_HEADER_SIZE
);
2489 pptr
= p
+ (ISIS_COMMON_HEADER_SIZE
+ISIS_PSNP_HEADER_SIZE
);
2493 if (ndo
->ndo_vflag
== 0) {
2494 ND_PRINT((ndo
, ", length %u", length
));
2497 (void)print_unknown_data(ndo
, pptr
, "\n\t ", length
);
2502 * Now print the TLV's.
2505 while (packet_len
> 0) {
2506 ND_TCHECK2(*pptr
, 2);
2511 tmp
=tlv_len
; /* copy temporary len & pointer to packet data */
2515 /* first lets see if we know the TLVs name*/
2516 ND_PRINT((ndo
, "\n\t %s TLV #%u, length: %u",
2517 tok2str(isis_tlv_values
,
2523 if (tlv_len
== 0) /* something is invalid */
2526 if (packet_len
< tlv_len
)
2529 /* now check if we have a decoder otherwise do a hexdump at the end*/
2531 case ISIS_TLV_AREA_ADDR
:
2532 ND_TCHECK2(*tptr
, 1);
2534 while (tmp
&& alen
< tmp
) {
2535 ND_PRINT((ndo
, "\n\t Area address (length: %u): %s",
2537 isonsap_string(ndo
, tptr
, alen
)));
2540 if (tmp
==0) /* if this is the last area address do not attemt a boundary check */
2542 ND_TCHECK2(*tptr
, 1);
2546 case ISIS_TLV_ISNEIGH
:
2547 while (tmp
>= ETHER_ADDR_LEN
) {
2548 ND_TCHECK2(*tptr
, ETHER_ADDR_LEN
);
2549 ND_PRINT((ndo
, "\n\t SNPA: %s", isis_print_id(tptr
, ETHER_ADDR_LEN
)));
2550 tmp
-= ETHER_ADDR_LEN
;
2551 tptr
+= ETHER_ADDR_LEN
;
2555 case ISIS_TLV_ISNEIGH_VARLEN
:
2556 if (!ND_TTEST2(*tptr
, 1) || tmp
< 3) /* min. TLV length */
2558 lan_alen
= *tptr
++; /* LAN address length */
2559 if (lan_alen
== 0) {
2560 ND_PRINT((ndo
, "\n\t LAN address length 0 bytes (invalid)"));
2564 ND_PRINT((ndo
, "\n\t LAN address length %u bytes ", lan_alen
));
2565 while (tmp
>= lan_alen
) {
2566 ND_TCHECK2(*tptr
, lan_alen
);
2567 ND_PRINT((ndo
, "\n\t\tIS Neighbor: %s", isis_print_id(tptr
, lan_alen
)));
2573 case ISIS_TLV_PADDING
:
2576 case ISIS_TLV_MT_IS_REACH
:
2577 mt_len
= isis_print_mtid(ndo
, tptr
, "\n\t ");
2578 if (mt_len
== 0) /* did something go wrong ? */
2582 while (tmp
>= 2+NODE_ID_LEN
+3+1) {
2583 ext_is_len
= isis_print_ext_is_reach(ndo
, tptr
, "\n\t ", tlv_type
);
2584 if (ext_is_len
== 0) /* did something go wrong ? */
2592 case ISIS_TLV_IS_ALIAS_ID
:
2593 while (tmp
>= NODE_ID_LEN
+1) { /* is it worth attempting a decode ? */
2594 ext_is_len
= isis_print_ext_is_reach(ndo
, tptr
, "\n\t ", tlv_type
);
2595 if (ext_is_len
== 0) /* did something go wrong ? */
2602 case ISIS_TLV_EXT_IS_REACH
:
2603 while (tmp
>= NODE_ID_LEN
+3+1) { /* is it worth attempting a decode ? */
2604 ext_is_len
= isis_print_ext_is_reach(ndo
, tptr
, "\n\t ", tlv_type
);
2605 if (ext_is_len
== 0) /* did something go wrong ? */
2611 case ISIS_TLV_IS_REACH
:
2612 ND_TCHECK2(*tptr
,1); /* check if there is one byte left to read out the virtual flag */
2613 ND_PRINT((ndo
, "\n\t %s",
2614 tok2str(isis_is_reach_virtual_values
,
2615 "bogus virtual flag 0x%02x",
2617 tlv_is_reach
= (const struct isis_tlv_is_reach
*)tptr
;
2618 while (tmp
>= sizeof(struct isis_tlv_is_reach
)) {
2619 ND_TCHECK(*tlv_is_reach
);
2620 ND_PRINT((ndo
, "\n\t IS Neighbor: %s",
2621 isis_print_id(tlv_is_reach
->neighbor_nodeid
, NODE_ID_LEN
)));
2622 isis_print_metric_block(ndo
, &tlv_is_reach
->isis_metric_block
);
2623 tmp
-= sizeof(struct isis_tlv_is_reach
);
2628 case ISIS_TLV_ESNEIGH
:
2629 tlv_es_reach
= (const struct isis_tlv_es_reach
*)tptr
;
2630 while (tmp
>= sizeof(struct isis_tlv_es_reach
)) {
2631 ND_TCHECK(*tlv_es_reach
);
2632 ND_PRINT((ndo
, "\n\t ES Neighbor: %s",
2633 isis_print_id(tlv_es_reach
->neighbor_sysid
, SYSTEM_ID_LEN
)));
2634 isis_print_metric_block(ndo
, &tlv_es_reach
->isis_metric_block
);
2635 tmp
-= sizeof(struct isis_tlv_es_reach
);
2640 /* those two TLVs share the same format */
2641 case ISIS_TLV_INT_IP_REACH
:
2642 case ISIS_TLV_EXT_IP_REACH
:
2643 if (!isis_print_tlv_ip_reach(ndo
, pptr
, "\n\t ", tlv_len
))
2647 case ISIS_TLV_EXTD_IP_REACH
:
2649 ext_ip_len
= isis_print_extd_ip_reach(ndo
, tptr
, "\n\t ", AF_INET
);
2650 if (ext_ip_len
== 0) /* did something go wrong ? */
2657 case ISIS_TLV_MT_IP_REACH
:
2658 mt_len
= isis_print_mtid(ndo
, tptr
, "\n\t ");
2659 if (mt_len
== 0) { /* did something go wrong ? */
2666 ext_ip_len
= isis_print_extd_ip_reach(ndo
, tptr
, "\n\t ", AF_INET
);
2667 if (ext_ip_len
== 0) /* did something go wrong ? */
2674 case ISIS_TLV_IP6_REACH
:
2676 ext_ip_len
= isis_print_extd_ip_reach(ndo
, tptr
, "\n\t ", AF_INET6
);
2677 if (ext_ip_len
== 0) /* did something go wrong ? */
2684 case ISIS_TLV_MT_IP6_REACH
:
2685 mt_len
= isis_print_mtid(ndo
, tptr
, "\n\t ");
2686 if (mt_len
== 0) { /* did something go wrong ? */
2693 ext_ip_len
= isis_print_extd_ip_reach(ndo
, tptr
, "\n\t ", AF_INET6
);
2694 if (ext_ip_len
== 0) /* did something go wrong ? */
2701 case ISIS_TLV_IP6ADDR
:
2702 while (tmp
>=sizeof(struct in6_addr
)) {
2703 ND_TCHECK2(*tptr
, sizeof(struct in6_addr
));
2705 ND_PRINT((ndo
, "\n\t IPv6 interface address: %s",
2706 ip6addr_string(ndo
, tptr
)));
2708 tptr
+= sizeof(struct in6_addr
);
2709 tmp
-= sizeof(struct in6_addr
);
2713 ND_TCHECK2(*tptr
, 1);
2715 ND_PRINT((ndo
, "\n\t %s: ",
2716 tok2str(isis_subtlv_auth_values
,
2717 "unknown Authentication type 0x%02x",
2721 case ISIS_SUBTLV_AUTH_SIMPLE
:
2722 if (fn_printzp(ndo
, tptr
+ 1, tlv_len
- 1, ndo
->ndo_snapend
))
2725 case ISIS_SUBTLV_AUTH_MD5
:
2726 for(i
=1;i
<tlv_len
;i
++) {
2727 ND_TCHECK2(*(tptr
+ i
), 1);
2728 ND_PRINT((ndo
, "%02x", *(tptr
+ i
)));
2730 if (tlv_len
!= ISIS_SUBTLV_AUTH_MD5_LEN
+1)
2731 ND_PRINT((ndo
, ", (invalid subTLV) "));
2733 sigcheck
= signature_verify(ndo
, optr
, length
, tptr
+ 1,
2734 isis_clear_checksum_lifetime
,
2736 ND_PRINT((ndo
, " (%s)", tok2str(signature_check_values
, "Unknown", sigcheck
)));
2739 case ISIS_SUBTLV_AUTH_GENERIC
:
2740 ND_TCHECK2(*(tptr
+ 1), 2);
2741 key_id
= EXTRACT_16BITS((tptr
+1));
2742 ND_PRINT((ndo
, "%u, password: ", key_id
));
2743 for(i
=1 + sizeof(uint16_t);i
<tlv_len
;i
++) {
2744 ND_TCHECK2(*(tptr
+ i
), 1);
2745 ND_PRINT((ndo
, "%02x", *(tptr
+ i
)));
2748 case ISIS_SUBTLV_AUTH_PRIVATE
:
2750 if (!print_unknown_data(ndo
, tptr
+ 1, "\n\t\t ", tlv_len
- 1))
2756 case ISIS_TLV_PTP_ADJ
:
2757 tlv_ptp_adj
= (const struct isis_tlv_ptp_adj
*)tptr
;
2759 ND_TCHECK2(*tptr
, 1);
2760 ND_PRINT((ndo
, "\n\t Adjacency State: %s (%u)",
2761 tok2str(isis_ptp_adjancey_values
, "unknown", *tptr
),
2765 if(tmp
>sizeof(tlv_ptp_adj
->extd_local_circuit_id
)) {
2766 ND_TCHECK(tlv_ptp_adj
->extd_local_circuit_id
);
2767 ND_PRINT((ndo
, "\n\t Extended Local circuit-ID: 0x%08x",
2768 EXTRACT_32BITS(tlv_ptp_adj
->extd_local_circuit_id
)));
2769 tmp
-=sizeof(tlv_ptp_adj
->extd_local_circuit_id
);
2771 if(tmp
>=SYSTEM_ID_LEN
) {
2772 ND_TCHECK2(tlv_ptp_adj
->neighbor_sysid
, SYSTEM_ID_LEN
);
2773 ND_PRINT((ndo
, "\n\t Neighbor System-ID: %s",
2774 isis_print_id(tlv_ptp_adj
->neighbor_sysid
, SYSTEM_ID_LEN
)));
2777 if(tmp
>=sizeof(tlv_ptp_adj
->neighbor_extd_local_circuit_id
)) {
2778 ND_TCHECK(tlv_ptp_adj
->neighbor_extd_local_circuit_id
);
2779 ND_PRINT((ndo
, "\n\t Neighbor Extended Local circuit-ID: 0x%08x",
2780 EXTRACT_32BITS(tlv_ptp_adj
->neighbor_extd_local_circuit_id
)));
2784 case ISIS_TLV_PROTOCOLS
:
2785 ND_PRINT((ndo
, "\n\t NLPID(s): "));
2787 ND_TCHECK2(*(tptr
), 1);
2788 ND_PRINT((ndo
, "%s (0x%02x)",
2789 tok2str(nlpid_values
,
2793 if (tmp
>1) /* further NPLIDs ? - put comma */
2794 ND_PRINT((ndo
, ", "));
2800 case ISIS_TLV_MT_PORT_CAP
:
2802 ND_TCHECK2(*(tptr
), 2);
2804 ND_PRINT((ndo
, "\n\t RES: %d, MTID(s): %d",
2805 (EXTRACT_16BITS (tptr
) >> 12),
2806 (EXTRACT_16BITS (tptr
) & 0x0fff)));
2812 isis_print_mt_port_cap_subtlv(ndo
, tptr
, tmp
);
2817 case ISIS_TLV_MT_CAPABILITY
:
2819 ND_TCHECK2(*(tptr
), 2);
2821 ND_PRINT((ndo
, "\n\t O: %d, RES: %d, MTID(s): %d",
2822 (EXTRACT_16BITS(tptr
) >> 15) & 0x01,
2823 (EXTRACT_16BITS(tptr
) >> 12) & 0x07,
2824 EXTRACT_16BITS(tptr
) & 0x0fff));
2830 isis_print_mt_capability_subtlv(ndo
, tptr
, tmp
);
2834 case ISIS_TLV_TE_ROUTER_ID
:
2835 ND_TCHECK2(*pptr
, sizeof(struct in_addr
));
2836 ND_PRINT((ndo
, "\n\t Traffic Engineering Router ID: %s", ipaddr_string(ndo
, pptr
)));
2839 case ISIS_TLV_IPADDR
:
2840 while (tmp
>=sizeof(struct in_addr
)) {
2841 ND_TCHECK2(*tptr
, sizeof(struct in_addr
));
2842 ND_PRINT((ndo
, "\n\t IPv4 interface address: %s", ipaddr_string(ndo
, tptr
)));
2843 tptr
+= sizeof(struct in_addr
);
2844 tmp
-= sizeof(struct in_addr
);
2848 case ISIS_TLV_HOSTNAME
:
2849 ND_PRINT((ndo
, "\n\t Hostname: "));
2850 if (fn_printzp(ndo
, tptr
, tmp
, ndo
->ndo_snapend
))
2854 case ISIS_TLV_SHARED_RISK_GROUP
:
2855 if (tmp
< NODE_ID_LEN
)
2857 ND_TCHECK2(*tptr
, NODE_ID_LEN
);
2858 ND_PRINT((ndo
, "\n\t IS Neighbor: %s", isis_print_id(tptr
, NODE_ID_LEN
)));
2859 tptr
+=(NODE_ID_LEN
);
2864 ND_TCHECK2(*tptr
, 1);
2865 ND_PRINT((ndo
, ", Flags: [%s]", ISIS_MASK_TLV_SHARED_RISK_GROUP(*tptr
++) ? "numbered" : "unnumbered"));
2868 if (tmp
< sizeof(struct in_addr
))
2870 ND_TCHECK2(*tptr
, sizeof(struct in_addr
));
2871 ND_PRINT((ndo
, "\n\t IPv4 interface address: %s", ipaddr_string(ndo
, tptr
)));
2872 tptr
+=sizeof(struct in_addr
);
2873 tmp
-=sizeof(struct in_addr
);
2875 if (tmp
< sizeof(struct in_addr
))
2877 ND_TCHECK2(*tptr
, sizeof(struct in_addr
));
2878 ND_PRINT((ndo
, "\n\t IPv4 neighbor address: %s", ipaddr_string(ndo
, tptr
)));
2879 tptr
+=sizeof(struct in_addr
);
2880 tmp
-=sizeof(struct in_addr
);
2883 ND_TCHECK2(*tptr
, 4);
2884 ND_PRINT((ndo
, "\n\t Link-ID: 0x%08x", EXTRACT_32BITS(tptr
)));
2891 tlv_lsp
= (const struct isis_tlv_lsp
*)tptr
;
2892 while(tmp
>=sizeof(struct isis_tlv_lsp
)) {
2893 ND_TCHECK((tlv_lsp
->lsp_id
)[LSP_ID_LEN
-1]);
2894 ND_PRINT((ndo
, "\n\t lsp-id: %s",
2895 isis_print_id(tlv_lsp
->lsp_id
, LSP_ID_LEN
)));
2896 ND_TCHECK2(tlv_lsp
->sequence_number
, 4);
2897 ND_PRINT((ndo
, ", seq: 0x%08x", EXTRACT_32BITS(tlv_lsp
->sequence_number
)));
2898 ND_TCHECK2(tlv_lsp
->remaining_lifetime
, 2);
2899 ND_PRINT((ndo
, ", lifetime: %5ds", EXTRACT_16BITS(tlv_lsp
->remaining_lifetime
)));
2900 ND_TCHECK2(tlv_lsp
->checksum
, 2);
2901 ND_PRINT((ndo
, ", chksum: 0x%04x", EXTRACT_16BITS(tlv_lsp
->checksum
)));
2902 tmp
-=sizeof(struct isis_tlv_lsp
);
2907 case ISIS_TLV_CHECKSUM
:
2908 if (tmp
< ISIS_TLV_CHECKSUM_MINLEN
)
2910 ND_TCHECK2(*tptr
, ISIS_TLV_CHECKSUM_MINLEN
);
2911 ND_PRINT((ndo
, "\n\t checksum: 0x%04x ", EXTRACT_16BITS(tptr
)));
2912 /* do not attempt to verify the checksum if it is zero
2913 * most likely a HMAC-MD5 TLV is also present and
2914 * to avoid conflicts the checksum TLV is zeroed.
2915 * see rfc3358 for details
2917 osi_print_cksum(ndo
, optr
, EXTRACT_16BITS(tptr
), tptr
-optr
,
2922 if (tlv_len
>= SYSTEM_ID_LEN
+ 1) {
2923 ND_TCHECK2(*tptr
, SYSTEM_ID_LEN
+ 1);
2924 ND_PRINT((ndo
, "\n\t Purge Originator System-ID: %s",
2925 isis_print_id(tptr
+ 1, SYSTEM_ID_LEN
)));
2928 if (tlv_len
== 2 * SYSTEM_ID_LEN
+ 1) {
2929 ND_TCHECK2(*tptr
, 2 * SYSTEM_ID_LEN
+ 1);
2930 ND_PRINT((ndo
, "\n\t Received from System-ID: %s",
2931 isis_print_id(tptr
+ SYSTEM_ID_LEN
+ 1, SYSTEM_ID_LEN
)));
2935 case ISIS_TLV_MT_SUPPORTED
:
2936 if (tmp
< ISIS_TLV_MT_SUPPORTED_MINLEN
)
2939 /* length can only be a multiple of 2, otherwise there is
2940 something broken -> so decode down until length is 1 */
2942 mt_len
= isis_print_mtid(ndo
, tptr
, "\n\t ");
2943 if (mt_len
== 0) /* did something go wrong ? */
2948 ND_PRINT((ndo
, "\n\t invalid MT-ID"));
2954 case ISIS_TLV_RESTART_SIGNALING
:
2955 /* first attempt to decode the flags */
2956 if (tmp
< ISIS_TLV_RESTART_SIGNALING_FLAGLEN
)
2958 ND_TCHECK2(*tptr
, ISIS_TLV_RESTART_SIGNALING_FLAGLEN
);
2959 ND_PRINT((ndo
, "\n\t Flags [%s]",
2960 bittok2str(isis_restart_flag_values
, "none", *tptr
)));
2961 tptr
+=ISIS_TLV_RESTART_SIGNALING_FLAGLEN
;
2962 tmp
-=ISIS_TLV_RESTART_SIGNALING_FLAGLEN
;
2964 /* is there anything other than the flags field? */
2968 if (tmp
< ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN
)
2970 ND_TCHECK2(*tptr
, ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN
);
2972 ND_PRINT((ndo
, ", Remaining holding time %us", EXTRACT_16BITS(tptr
)));
2973 tptr
+=ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN
;
2974 tmp
-=ISIS_TLV_RESTART_SIGNALING_HOLDTIMELEN
;
2976 /* is there an additional sysid field present ?*/
2977 if (tmp
== SYSTEM_ID_LEN
) {
2978 ND_TCHECK2(*tptr
, SYSTEM_ID_LEN
);
2979 ND_PRINT((ndo
, ", for %s", isis_print_id(tptr
,SYSTEM_ID_LEN
)));
2983 case ISIS_TLV_IDRP_INFO
:
2984 if (tmp
< ISIS_TLV_IDRP_INFO_MINLEN
)
2986 ND_TCHECK2(*tptr
, ISIS_TLV_IDRP_INFO_MINLEN
);
2987 ND_PRINT((ndo
, "\n\t Inter-Domain Information Type: %s",
2988 tok2str(isis_subtlv_idrp_values
,
2992 case ISIS_SUBTLV_IDRP_ASN
:
2993 ND_TCHECK2(*tptr
, 2); /* fetch AS number */
2994 ND_PRINT((ndo
, "AS Number: %u", EXTRACT_16BITS(tptr
)));
2996 case ISIS_SUBTLV_IDRP_LOCAL
:
2997 case ISIS_SUBTLV_IDRP_RES
:
2999 if (!print_unknown_data(ndo
, tptr
, "\n\t ", tlv_len
- 1))
3005 case ISIS_TLV_LSP_BUFFERSIZE
:
3006 if (tmp
< ISIS_TLV_LSP_BUFFERSIZE_MINLEN
)
3008 ND_TCHECK2(*tptr
, ISIS_TLV_LSP_BUFFERSIZE_MINLEN
);
3009 ND_PRINT((ndo
, "\n\t LSP Buffersize: %u", EXTRACT_16BITS(tptr
)));
3012 case ISIS_TLV_PART_DIS
:
3013 while (tmp
>= SYSTEM_ID_LEN
) {
3014 ND_TCHECK2(*tptr
, SYSTEM_ID_LEN
);
3015 ND_PRINT((ndo
, "\n\t %s", isis_print_id(tptr
, SYSTEM_ID_LEN
)));
3016 tptr
+=SYSTEM_ID_LEN
;
3021 case ISIS_TLV_PREFIX_NEIGH
:
3022 if (tmp
< sizeof(struct isis_metric_block
))
3024 ND_TCHECK2(*tptr
, sizeof(struct isis_metric_block
));
3025 ND_PRINT((ndo
, "\n\t Metric Block"));
3026 isis_print_metric_block(ndo
, (const struct isis_metric_block
*)tptr
);
3027 tptr
+=sizeof(struct isis_metric_block
);
3028 tmp
-=sizeof(struct isis_metric_block
);
3031 ND_TCHECK2(*tptr
, 1);
3032 prefix_len
=*tptr
++; /* read out prefix length in semioctets*/
3033 if (prefix_len
< 2) {
3034 ND_PRINT((ndo
, "\n\t\tAddress: prefix length %u < 2", prefix_len
));
3038 if (tmp
< prefix_len
/2)
3040 ND_TCHECK2(*tptr
, prefix_len
/ 2);
3041 ND_PRINT((ndo
, "\n\t\tAddress: %s/%u",
3042 isonsap_string(ndo
, tptr
, prefix_len
/ 2), prefix_len
* 4));
3048 case ISIS_TLV_IIH_SEQNR
:
3049 if (tmp
< ISIS_TLV_IIH_SEQNR_MINLEN
)
3051 ND_TCHECK2(*tptr
, ISIS_TLV_IIH_SEQNR_MINLEN
); /* check if four bytes are on the wire */
3052 ND_PRINT((ndo
, "\n\t Sequence number: %u", EXTRACT_32BITS(tptr
)));
3055 case ISIS_TLV_VENDOR_PRIVATE
:
3056 if (tmp
< ISIS_TLV_VENDOR_PRIVATE_MINLEN
)
3058 ND_TCHECK2(*tptr
, ISIS_TLV_VENDOR_PRIVATE_MINLEN
); /* check if enough byte for a full oui */
3059 vendor_id
= EXTRACT_24BITS(tptr
);
3060 ND_PRINT((ndo
, "\n\t Vendor: %s (%u)",
3061 tok2str(oui_values
, "Unknown", vendor_id
),
3065 if (tmp
> 0) /* hexdump the rest */
3066 if (!print_unknown_data(ndo
, tptr
, "\n\t\t", tmp
))
3070 * FIXME those are the defined TLVs that lack a decoder
3071 * you are welcome to contribute code ;-)
3074 case ISIS_TLV_DECNET_PHASE4
:
3075 case ISIS_TLV_LUCENT_PRIVATE
:
3076 case ISIS_TLV_IPAUTH
:
3077 case ISIS_TLV_NORTEL_PRIVATE1
:
3078 case ISIS_TLV_NORTEL_PRIVATE2
:
3081 if (ndo
->ndo_vflag
<= 1) {
3082 if (!print_unknown_data(ndo
, pptr
, "\n\t\t", tlv_len
))
3087 /* do we want to see an additionally hexdump ? */
3088 if (ndo
->ndo_vflag
> 1) {
3089 if (!print_unknown_data(ndo
, pptr
, "\n\t ", tlv_len
))
3094 packet_len
-= tlv_len
;
3097 if (packet_len
!= 0) {
3098 ND_PRINT((ndo
, "\n\t %u straggler bytes", packet_len
));
3103 ND_PRINT((ndo
, "%s", tstr
));
3107 ND_PRINT((ndo
, "\n\t\t"));
3108 ND_PRINT((ndo
, "%s", tstr
));
3113 osi_print_cksum(netdissect_options
*ndo
, const uint8_t *pptr
,
3114 uint16_t checksum
, int checksum_offset
, u_int length
)
3116 uint16_t calculated_checksum
;
3118 /* do not attempt to verify the checksum if it is zero,
3119 * if the offset is nonsense,
3120 * or the base pointer is not sane
3123 || checksum_offset
< 0
3124 || !ND_TTEST2(*(pptr
+ checksum_offset
), 2)
3125 || (u_int
)checksum_offset
> length
3126 || !ND_TTEST2(*pptr
, length
)) {
3127 ND_PRINT((ndo
, " (unverified)"));
3130 printf("\nosi_print_cksum: %p %u %u\n", pptr
, checksum_offset
, length
);
3132 calculated_checksum
= create_osi_cksum(pptr
, checksum_offset
, length
);
3133 if (checksum
== calculated_checksum
) {
3134 ND_PRINT((ndo
, " (correct)"));
3136 ND_PRINT((ndo
, " (incorrect should be 0x%04x)", calculated_checksum
));
3143 * c-style: whitesmith