1 /* packet-isis-lsp.c
2  * Routines for decoding isis lsp packets and their CLVs
3  *
4  * Stuart Stanley <stuarts@mxmail.net>
5  *
6  * Wireshark - Network traffic analyzer
7  * By Gerald Combs <gerald@wireshark.org>
8  * Copyright 1998 Gerald Combs
9  *
10  * SPDX-License-Identifier: GPL-2.0-or-later
11  */
12 /*
13  * Copyright 2011, Malgi Nikitha Vivekananda <malgi.nikitha@ipinfusion.com>
14  *                 Krishnamurthy Mayya <krishnamurthy.mayya@ipinfusion.com>
15  *                    - Decoding for Router Capability TLV and associated subTLVs as per RFC 6326
16  *                    - Decoding for Group Address TLV and associated subTLVs as per RFC 6326
17  *
18  * Copyright 2019, Rohan Saini <rohan.saini@nokia.com>
19  *     - Support for dissecting BIER Info Sub-TLV (RFC 8401)
20  */
21 
22 #include "config.h"
23 
24 #include <epan/packet.h>
25 #include <epan/expert.h>
26 #include "packet-osi.h"
27 #include "packet-isis.h"
28 #include "packet-isis-clv.h"
29 #include <epan/addr_resolv.h>
30 #include <epan/addr_and_mask.h>
31 
32 /*
33  * Declarations for L1/L2 LSP base header.
34  */
35 
36 /* P | ATT | HIPPITY | DS FIELD description */
37 #define ISIS_LSP_PARTITION_MASK     0x80
38 #define ISIS_LSP_PARTITION_SHIFT    7
39 #define ISIS_LSP_PARTITION(info)    (((info) & ISIS_LSP_PARTITION_MASK) >> ISIS_LSP_PARTITION_SHIFT)
40 
41 #define ISIS_LSP_ATT_MASK           0x78
42 #define ISIS_LSP_ATT_SHIFT          3
43 #define ISIS_LSP_ATT(info)          (((info) & ISIS_LSP_ATT_MASK) >> ISIS_LSP_ATT_SHIFT)
44 
45 #define ISIS_LSP_ATT_ERROR(info)    ((info) >> 3)
46 #define ISIS_LSP_ATT_EXPENSE(info)  (((info) >> 2) & 1)
47 #define ISIS_LSP_ATT_DELAY(info)    (((info) >> 1) & 1)
48 #define ISIS_LSP_ATT_DEFAULT(info)  ((info) & 1)
49 
50 #define ISIS_LSP_HIPPITY_MASK       0x04
51 #define ISIS_LSP_HIPPITY_SHIFT      2
52 #define ISIS_LSP_HIPPITY(info)      (((info) & ISIS_LSP_HIPPITY_MASK) >> ISIS_LSP_HIPPITY_SHIFT)
53 
54 #define ISIS_LSP_IS_TYPE_MASK       0x03
55 #define ISIS_LSP_IS_TYPE(info)      ((info) & ISIS_LSP_IS_TYPE_MASK)
56 
57 #define ISIS_LSP_MT_MSHIP_RES_MASK  0xF000
58 #define ISIS_LSP_MT_MSHIP_ID_MASK   0x0FFF
59 
60 
61 #define ISIS_LSP_TYPE_UNUSED0       0
62 #define ISIS_LSP_TYPE_LEVEL_1       1
63 #define ISIS_LSP_TYPE_UNUSED2       2
64 #define ISIS_LSP_TYPE_LEVEL_2       3
65 
66 #define ISIS_LSP_ATTACHED_NONE      0
67 #define ISIS_LSP_ATTACHED_DEFAULT   1
68 #define ISIS_LSP_ATTACHED_DELAY     2
69 #define ISIS_LSP_ATTACHED_EXPENSE   4
70 #define ISIS_LSP_ATTACHED_ERROR     8
71 
72 /*
73  * The "supported" bit in a metric is actually the "not supported" bit;
74  * if it's *clear*, the metric is supported, and if it's *set*, the
75  * metric is not supported.
76  */
77 #define ISIS_LSP_CLV_METRIC_SUPPORTED(x)    (!((x)&0x80))
78 #define ISIS_LSP_CLV_METRIC_IE(x)           ((x)&0x40)
79 #define ISIS_LSP_CLV_METRIC_RESERVED(x)     ((x)&0x40)
80 #define ISIS_LSP_CLV_METRIC_UPDOWN(x)       ((x)&0x80)
81 #define ISIS_LSP_CLV_METRIC_VALUE(x)        ((x)&0x3f)
82 
83 /* Sub-TLVs under Router Capability and MT Capability TLVs
84    As per RFC 7176 section 2.3
85    http://www.iana.org/assignments/isis-tlv-codepoints/isis-tlv-codepoints.xhtml#isis-tlv-codepoints-242
86  */
87 #define ISIS_TE_NODE_CAP_DESC     1
88 #define SEGMENT_ROUTING_CAP       2            /* draft-ietf-isis-segment-routing-extensions-03 */
89 #define NICKNAME                  6
90 #define TREES                     7
91 #define TREE_IDENTIFIER           8
92 #define TREES_USED_IDENTIFIER     9
93 #define INTERESTED_VLANS         10
94 #define IPV6_TE_ROUTER_ID        12
95 #define TRILL_VERSION            13
96 #define VLAN_GROUP               14
97 #define SEGMENT_ROUTING_ALG      19
98 #define SEGMENT_ROUTING_LB       22
99 #define NODE_MSD                 23            /* rfc8491 */
100 #define SRV6_CAP                 25
101 #define FLEX_ALGO_DEF            26            /* draft-ietf-lsr-flex-algo-16 */
102 
103 
104 /*Sub-TLVs under Group Address TLV*/
105 #define GRP_MAC_ADDRESS 1
106 #define GRP_IPV4_ADDRESS 2
107 #define GRP_IPV6_ADDRESS 3
108 
109 /* sub-TLV's under SID/Label binding TLV */
110 #define ISIS_LSP_SL_SUB_SID_LABEL   1
111 #define ISIS_LSP_SL_SUB_PREFIX_SID  3
112 #define ISIS_LSP_SL_SUB_ADJ_SID     31
113 #define ISIS_LSP_SL_SUB_LAN_ADJ_SID 32
114 
115 /* Segment Routing Sub-TLV */
116 #define ISIS_SR_SID_LABEL           1
117 
118 /*
119     From: https://www.iana.org/assignments/igp-parameters/igp-parameters.xhtml
120     IGP Algorithm Types
121 */
122 #define ISIS_ALG_SPF  0
123 #define ISIS_ALG_SSPF 1
124 
125 /* IGP MSD Type (rfc8491) */
126 #define IGP_MSD_TYPE_RESERVED       0
127 #define IGP_MSD_TYPE_MPLS           1
128 #define IGP_MSD_TYPE_SEGMENT_LEFT   41
129 #define IGP_MSD_TYPE_END_POP        42
130 #define IGP_MSD_TYPE_T_INSERT       43
131 #define IGP_MSD_TYPE_T_ENCAP        44
132 #define IGP_MSD_TYPE_END_D          45
133 
134 /* Flex Algo Definition Sub-TLV (draft-ietf-lsr-flex-algo-16) */
135 #define FAD_EXCLUDE_AG              1
136 #define FAD_INCLUDE_ANY_AG          2
137 #define FAD_INCLUDE_ALL_AG          3
138 #define FAD_DEF_FLAGS               4
139 #define FAD_EXCLUDE_SRLG            5
140 
141 /* Prefix Attribute Flags Sub-TLV (rfc7794)*/
142 #define ISIS_LSP_PFX_ATTR_FLAG_X    0x80
143 #define ISIS_LSP_PFX_ATTR_FLAG_R    0x40
144 #define ISIS_LSP_PFX_ATTR_FLAG_N    0x20
145 
146 const range_string mtid_strings[] = {
147   {    0,    0, "Standard topology" },
148   {    1,    1, "IPv4 In-Band Management" },
149   {    2,    2, "IPv6 routing topology" },
150   {    3,    3, "IPv4 multicast routing topology" },
151   {    4,    4, "IPv6 multicast routing topology" },
152   {    5,    5, "IPv6 in-band management" },
153   {    6, 3995, "Reserved for IETF Consensus" },
154   { 3996, 4095, "Development, Experimental and Proprietary features" },
155   {    0,    0, NULL }
156 } ;
157 
158 void proto_register_isis_lsp(void);
159 void proto_reg_handoff_isis_lsp(void);
160 
161 static int proto_isis_lsp = -1;
162 
163 /* lsp packets */
164 static int hf_isis_lsp_pdu_length = -1;
165 static int hf_isis_lsp_remaining_life = -1;
166 static int hf_isis_lsp_sequence_number = -1;
167 static int hf_isis_lsp_lsp_id = -1;
168 static int hf_isis_lsp_hostname = -1;
169 static int hf_isis_lsp_srlg_system_id = -1;
170 static int hf_isis_lsp_srlg_pseudo_num = -1;
171 static int hf_isis_lsp_srlg_flags_numbered = -1;
172 static int hf_isis_lsp_srlg_ipv4_local = -1;
173 static int hf_isis_lsp_srlg_ipv4_remote = -1;
174 static int hf_isis_lsp_srlg_value = -1;
175 static int hf_isis_lsp_checksum = -1;
176 static int hf_isis_lsp_checksum_status = -1;
177 static int hf_isis_lsp_clv_ipv4_int_addr = -1;
178 static int hf_isis_lsp_clv_ipv6_int_addr = -1;
179 static int hf_isis_lsp_clv_te_router_id = -1;
180 static int hf_isis_lsp_clv_mt = -1;
181 static int hf_isis_lsp_p = -1;
182 static int hf_isis_lsp_att = -1;
183 static int hf_isis_lsp_hippity = -1;
184 static int hf_isis_lsp_is_type = -1;
185 static int hf_isis_lsp_clv_type = -1;
186 static int hf_isis_lsp_clv_length = -1;
187 static int hf_isis_lsp_root_id = -1;
188 static int hf_isis_lsp_bw_ct_model = -1;
189 static int hf_isis_lsp_bw_ct_reserved = -1;
190 static int hf_isis_lsp_bw_ct0 = -1;
191 static int hf_isis_lsp_bw_ct1 = -1;
192 static int hf_isis_lsp_bw_ct2 = -1;
193 static int hf_isis_lsp_bw_ct3 = -1;
194 static int hf_isis_lsp_bw_ct4 = -1;
195 static int hf_isis_lsp_bw_ct5 = -1;
196 static int hf_isis_lsp_bw_ct6 = -1;
197 static int hf_isis_lsp_bw_ct7 = -1;
198 static int hf_isis_lsp_spb_link_metric = -1;
199 static int hf_isis_lsp_spb_port_count = -1;
200 static int hf_isis_lsp_spb_port_id = -1;
201 static int hf_isis_lsp_adj_sid_flags = -1;
202 static int hf_isis_lsp_adj_sid_family_flag = -1;
203 static int hf_isis_lsp_adj_sid_backup_flag = -1;
204 static int hf_isis_lsp_adj_sid_value_flag = -1;
205 static int hf_isis_lsp_adj_sid_local_flag = -1;
206 static int hf_isis_lsp_adj_sid_set_flag = -1;
207 static int hf_isis_lsp_adj_sid_weight = -1;
208 static int hf_isis_lsp_adj_sid_system_id = -1;
209 static int hf_isis_lsp_sid_sli_label = -1;
210 static int hf_isis_lsp_sid_sli_index = -1;
211 static int hf_isis_lsp_sid_sli_ipv6 = -1;
212 static int hf_isis_lsp_spb_reserved = -1;
213 static int hf_isis_lsp_spb_sr_bit = -1;
214 static int hf_isis_lsp_spb_spvid = -1;
215 static int hf_isis_lsp_spb_short_mac_address_t = -1;
216 static int hf_isis_lsp_spb_short_mac_address_r = -1;
217 static int hf_isis_lsp_spb_short_mac_address_reserved = -1;
218 static int hf_isis_lsp_spb_short_mac_address = -1;
219 /* TLV 149 items draft-previdi-isis-segment-routing-extensions */
220 static int hf_isis_lsp_sl_binding_flags = -1;
221 static int hf_isis_lsp_sl_binding_flags_f = -1;
222 static int hf_isis_lsp_sl_binding_flags_m = -1;
223 static int hf_isis_lsp_sl_binding_flags_s = -1;
224 static int hf_isis_lsp_sl_binding_flags_d = -1;
225 static int hf_isis_lsp_sl_binding_flags_a = -1;
226 static int hf_isis_lsp_sl_binding_flags_rsv = -1;
227 static int hf_isis_lsp_sl_binding_weight = -1;
228 static int hf_isis_lsp_sl_binding_range = -1;
229 static int hf_isis_lsp_sl_binding_prefix_length = -1;
230 static int hf_isis_lsp_sl_binding_fec_prefix_ipv4 = -1;
231 static int hf_isis_lsp_sl_binding_fec_prefix_ipv6 = -1;
232 static int hf_isis_lsp_sl_sub_tlv = -1;
233 static int hf_isis_lsp_sl_sub_tlv_type = -1;
234 static int hf_isis_lsp_sl_sub_tlv_length = -1;
235 static int hf_isis_lsp_sl_sub_tlv_label_20 = -1;
236 static int hf_isis_lsp_sl_sub_tlv_label_32 = -1;
237 static int hf_isis_lsp_sl_sub_tlv_flags = -1;
238 static int hf_isis_lsp_sl_sub_tlv_flags_r = -1;
239 static int hf_isis_lsp_sl_sub_tlv_flags_n = -1;
240 static int hf_isis_lsp_sl_sub_tlv_flags_p = -1;
241 static int hf_isis_lsp_sl_sub_tlv_flags_e = -1;
242 static int hf_isis_lsp_sl_sub_tlv_flags_v = -1;
243 static int hf_isis_lsp_sl_sub_tlv_flags_l = -1;
244 static int hf_isis_lsp_sl_sub_tlv_flags_rsv = -1;
245 static int hf_isis_lsp_sl_sub_tlv_algorithm = -1;
246 static int hf_isis_lsp_mt_cap_spb_instance_v = -1;
247 static int hf_isis_lsp_mt_cap_spb_instance_cist_external_root_path_cost = -1;
248 static int hf_isis_lsp_rt_capable_tree_used_id_starting_tree_no = -1;
249 static int hf_isis_lsp_mt_cap_spb_instance_bridge_priority = -1;
250 static int hf_isis_lsp_mt_cap_spbm_service_identifier_base_vid = -1;
251 static int hf_isis_lsp_mt_cap_spbm_service_identifier_t = -1;
252 static int hf_isis_lsp_mt_cap_spbm_service_identifier_r = -1;
253 static int hf_isis_lsp_mt_cap_spbm_service_identifier_reserved = -1;
254 static int hf_isis_lsp_mt_cap_spbm_service_identifier_i_sid = -1;
255 static int hf_isis_lsp_64_bit_administrative_tag = -1;
256 static int hf_isis_lsp_grp_type = -1;
257 static int hf_isis_lsp_grp_macaddr_length = -1;
258 static int hf_isis_lsp_grp_ipv4addr_length = -1;
259 static int hf_isis_lsp_grp_ipv6addr_length = -1;
260 static int hf_isis_lsp_grp_unknown_length = -1;
261 static int hf_isis_lsp_grp_macaddr_number_of_sources = -1;
262 static int hf_isis_lsp_grp_ipv4addr_number_of_sources = -1;
263 static int hf_isis_lsp_grp_ipv6addr_number_of_sources = -1;
264 static int hf_isis_lsp_ext_is_reachability_traffic_engineering_default_metric = -1;
265 static int hf_isis_lsp_grp_macaddr_group_address = -1;
266 static int hf_isis_lsp_grp_ipv4addr_group_address = -1;
267 static int hf_isis_lsp_grp_ipv6addr_group_address = -1;
268 static int hf_isis_lsp_rt_capable_tree_root_id_nickname = -1;
269 static int hf_isis_lsp_ext_is_reachability_ipv4_interface_address = -1;
270 static int hf_isis_lsp_ext_ip_reachability_metric = -1;
271 static int hf_isis_lsp_ext_ip_reachability_ipv4_prefix = -1;
272 static int hf_isis_lsp_eis_neighbors_es_neighbor_id = -1;
273 static int hf_isis_lsp_expense_metric = -1;
274 static int hf_isis_lsp_ext_is_reachability_link_remote_identifier = -1;
275 static int hf_isis_lsp_rt_capable_vlan_group_secondary_vlan_id = -1;
276 static int hf_isis_lsp_grp_macaddr_vlan_id = -1;
277 static int hf_isis_lsp_grp_ipv4addr_vlan_id = -1;
278 static int hf_isis_lsp_grp_ipv6addr_vlan_id = -1;
279 static int hf_isis_lsp_rt_capable_trill_affinity_tlv = -1;
280 static int hf_isis_lsp_rt_capable_trill_fgl_safe = -1;
281 static int hf_isis_lsp_rt_capable_trill_caps = -1;
282 static int hf_isis_lsp_rt_capable_trill_flags = -1;
283 static int hf_isis_lsp_rt_capable_tree_root_id_starting_tree_no = -1;
284 static int hf_isis_lsp_rt_capable_interested_vlans_nickname = -1;
285 static int hf_isis_lsp_ip_reachability_ipv4_prefix = -1;
286 static int hf_isis_lsp_grp_macaddr_topology_id = -1;
287 static int hf_isis_lsp_grp_ipv4addr_topology_id = -1;
288 static int hf_isis_lsp_grp_ipv6addr_topology_id = -1;
289 static int hf_isis_lsp_ext_is_reachability_ipv4_neighbor_address = -1;
290 static int hf_isis_lsp_ipv6_reachability_reserved_bits = -1;
291 static int hf_isis_lsp_eis_neighbors_default_metric = -1;
292 static int hf_isis_lsp_mt_cap_spb_instance_cist_root_identifier = -1;
293 static int hf_isis_lsp_rt_capable_tree_used_id_nickname = -1;
294 static int hf_isis_lsp_grp_macaddr_source_address = -1;
295 static int hf_isis_lsp_grp_ipv4addr_source_address = -1;
296 static int hf_isis_lsp_grp_ipv6addr_source_address = -1;
297 static int hf_isis_lsp_delay_metric = -1;
298 static int hf_isis_lsp_ext_is_reachability_link_local_identifier = -1;
299 static int hf_isis_lsp_mt_cap_mtid = -1;
300 static int hf_isis_lsp_32_bit_administrative_tag = -1;
301 static int hf_isis_lsp_ext_is_reachability_is_neighbor_id = -1;
302 static int hf_isis_lsp_reservable_link_bandwidth = -1;
303 static int hf_isis_lsp_rt_capable_vlan_group_primary_vlan_id = -1;
304 static int hf_isis_lsp_rt_capable_interested_vlans_multicast_ipv4 = -1;
305 static int hf_isis_lsp_rt_capable_interested_vlans_multicast_ipv6 = -1;
306 static int hf_isis_lsp_mt_cap_spb_instance_number_of_trees = -1;
307 static int hf_isis_lsp_mt_cap_spb_instance_vlanid_tuple_u = -1;
308 static int hf_isis_lsp_mt_cap_spb_instance_vlanid_tuple_m = -1;
309 static int hf_isis_lsp_mt_cap_spb_instance_vlanid_tuple_a = -1;
310 static int hf_isis_lsp_mt_cap_spb_instance_vlanid_tuple_reserved = -1;
311 static int hf_isis_lsp_mt_cap_spb_instance_vlanid_tuple_ect = -1;
312 static int hf_isis_lsp_mt_cap_spb_instance_vlanid_tuple_base_vid = -1;
313 static int hf_isis_lsp_mt_cap_spb_instance_vlanid_tuple_spvid = -1;
314 static int hf_isis_lsp_mt_cap_spb_opaque_algorithm = -1;
315 static int hf_isis_lsp_mt_cap_spb_opaque_information = -1;
316 static int hf_isis_lsp_mt_cap_spbm_service_identifier_b_mac = -1;
317 static int hf_isis_lsp_ipv6_reachability_subclvs_len = -1;
318 static int hf_isis_lsp_ipv6_reachability_distribution = -1;
319 static int hf_isis_lsp_ipv6_reachability_distribution_internal = -1;
320 static int hf_isis_lsp_ipv6_reachability_subtlv = -1;
321 static int hf_isis_lsp_ipv6_reachability_metric = -1;
322 static int hf_isis_lsp_ipv6_reachability_prefix_length = -1;
323 static int hf_isis_lsp_prefix_attr_flags = -1;
324 static int hf_isis_lsp_prefix_attr_flags_x = -1;
325 static int hf_isis_lsp_prefix_attr_flags_r = -1;
326 static int hf_isis_lsp_prefix_attr_flags_n = -1;
327 static int hf_isis_lsp_rt_capable_trees_maximum_nof_trees_to_compute = -1;
328 static int hf_isis_lsp_rt_capable_interested_vlans_vlan_start_id = -1;
329 static int hf_isis_lsp_rt_capable_nickname_nickname_priority = -1;
330 static int hf_isis_lsp_ext_is_reachability_metric = -1;
331 static int hf_isis_lsp_ext_is_reachability_subclvs_len = -1;
332 static int hf_isis_lsp_ext_is_reachability_code = -1;
333 static int hf_isis_lsp_ext_is_reachability_len = -1;
334 static int hf_isis_lsp_ext_is_reachability_value = -1;
335 static int hf_isis_lsp_default_metric = -1;
336 static int hf_isis_lsp_ext_is_reachability_unidir_link_flags = -1;
337 static int hf_isis_lsp_ext_is_reachability_unidir_link_flags_a = -1;
338 static int hf_isis_lsp_ext_is_reachability_unidir_link_reserved = -1;
339 static int hf_isis_lsp_ext_is_reachability_unidir_link_delay = -1;
340 static int hf_isis_lsp_ext_is_reachability_unidir_link_delay_min = -1;
341 static int hf_isis_lsp_ext_is_reachability_unidir_link_delay_max = -1;
342 static int hf_isis_lsp_ext_is_reachability_unidir_delay_variation = -1;
343 static int hf_isis_lsp_ext_is_reachability_unidir_link_loss = -1;
344 static int hf_isis_lsp_ext_is_reachability_unidir_residual_bandwidth = -1;
345 static int hf_isis_lsp_ext_is_reachability_unidir_available_bandwidth = -1;
346 static int hf_isis_lsp_ext_is_reachability_unidir_utilized_bandwidth = -1;
347 static int hf_isis_lsp_ext_ip_reachability_distribution = -1;
348 static int hf_isis_lsp_ext_ip_reachability_subtlv = -1;
349 static int hf_isis_lsp_ext_ip_reachability_prefix_length = -1;
350 static int hf_isis_lsp_ext_ip_reachability_subclvs_len = -1;
351 static int hf_isis_lsp_ext_ip_reachability_code = -1;
352 static int hf_isis_lsp_ext_ip_reachability_len = -1;
353 static int hf_isis_lsp_ext_ip_reachability_prefix_flags = -1;
354 static int hf_isis_lsp_ext_ip_reachability_prefix_re_adv_flag = -1;
355 static int hf_isis_lsp_ext_ip_reachability_prefix_node_sid_flag = -1;
356 static int hf_isis_lsp_ext_ip_reachability_prefix_nophp_flag = -1;
357 static int hf_isis_lsp_ext_ip_reachability_prefix_expl_null_flag = -1;
358 static int hf_isis_lsp_ext_ip_reachability_prefix_value_flag = -1;
359 static int hf_isis_lsp_ext_ip_reachability_prefix_local_flag = -1;
360 static int hf_isis_lsp_maximum_link_bandwidth = -1;
361 static int hf_isis_lsp_rt_capable_nickname_tree_root_priority = -1;
362 static int hf_isis_lsp_eis_neighbors_delay_metric = -1;
363 static int hf_isis_lsp_rt_capable_trill_maximum_version = -1;
364 static int hf_isis_lsp_rt_capable_interested_vlans_afs_lost_counter = -1;
365 static int hf_isis_lsp_ipv6_reachability_ipv6_prefix = -1;
366 static int hf_isis_lsp_eis_neighbors_error_metric = -1;
367 static int hf_isis_lsp_rt_capable_interested_vlans_vlan_end_id = -1;
368 static int hf_isis_lsp_error_metric = -1;
369 static int hf_isis_lsp_grp_macaddr_number_of_records = -1;
370 static int hf_isis_lsp_grp_ipv4addr_number_of_records = -1;
371 static int hf_isis_lsp_grp_ipv6addr_number_of_records = -1;
372 static int hf_isis_lsp_rt_capable_nickname_nickname = -1;
373 static int hf_isis_lsp_mt_id_reserved = -1;
374 static int hf_isis_lsp_eis_neighbors_is_neighbor_id = -1;
375 static int hf_isis_lsp_mt_id = -1;
376 static int hf_isis_lsp_eis_neighbors_reserved = -1;
377 static int hf_isis_lsp_ip_reachability_error_metric = -1;
378 static int hf_isis_lsp_ip_reachability_delay_metric = -1;
379 static int hf_isis_lsp_ip_reachability_expense_metric = -1;
380 static int hf_isis_lsp_rt_capable_trees_nof_trees_to_use = -1;
381 static int hf_isis_lsp_ip_reachability_default_metric = -1;
382 static int hf_isis_lsp_rt_capable_trees_nof_trees_to_compute = -1;
383 static int hf_isis_lsp_eis_neighbors_expense_metric = -1;
384 static int hf_isis_lsp_partition_designated_l2_is = -1;
385 static int hf_isis_lsp_originating_lsp_buffer_size = -1;
386 static int hf_isis_lsp_ip_reachability_default_metric_ie = -1;
387 static int hf_isis_lsp_eis_neighbors_default_metric_ie = -1;
388 static int hf_isis_lsp_eis_neighbors_error_metric_supported = -1;
389 static int hf_isis_lsp_unrsv_bw_priority_level = -1;
390 static int hf_isis_lsp_ip_reachability_expense_metric_support = -1;
391 static int hf_isis_lsp_mt_cap_overload = -1;
392 static int hf_isis_lsp_eis_neighbors_expense_metric_supported = -1;
393 static int hf_isis_lsp_ip_reachability_delay_metric_support = -1;
394 static int hf_isis_lsp_ip_reachability_error_metric_support = -1;
395 static int hf_isis_lsp_mt_cap_spsourceid = -1;
396 static int hf_isis_lsp_eis_neighbors_delay_metric_supported = -1;
397 static int hf_isis_lsp_eis_neighbors_error_metric_ie = -1;
398 static int hf_isis_lsp_eis_neighbors_expense_metric_ie = -1;
399 static int hf_isis_lsp_eis_neighbors_delay_metric_ie = -1;
400 static int hf_isis_lsp_ip_reachability_delay_metric_ie = -1;
401 static int hf_isis_lsp_ip_reachability_distribution = -1;
402 static int hf_isis_lsp_ip_reachability_error_metric_ie = -1;
403 static int hf_isis_lsp_ip_reachability_expense_metric_ie = -1;
404 static int hf_isis_lsp_rt_capable_router_id =-1;
405 static int hf_isis_lsp_rt_capable_flag_s =-1;
406 static int hf_isis_lsp_rt_capable_flag_d =-1;
407 static int hf_isis_lsp_clv_te_node_cap_b_bit = -1;
408 static int hf_isis_lsp_clv_te_node_cap_e_bit = -1;
409 static int hf_isis_lsp_clv_te_node_cap_m_bit = -1;
410 static int hf_isis_lsp_clv_te_node_cap_g_bit = -1;
411 static int hf_isis_lsp_clv_te_node_cap_p_bit = -1;
412 static int hf_isis_lsp_clv_sr_cap_i_flag = -1;
413 static int hf_isis_lsp_clv_sr_cap_v_flag = -1;
414 static int hf_isis_lsp_clv_sr_cap_range = -1;
415 static int hf_isis_lsp_clv_sr_cap_sid = -1;
416 static int hf_isis_lsp_clv_sr_cap_label = -1;
417 static int hf_isis_lsp_clv_sr_alg = -1;
418 static int hf_isis_lsp_clv_sr_lb_flags = -1;
419 static int hf_isis_lsp_clv_srv6_cap_flags = -1;
420 static int hf_isis_lsp_clv_srv6_cap_flags_o = -1;
421 static int hf_isis_lsp_clv_srv6_cap_flags_unused = -1;
422 static int hf_isis_lsp_clv_igp_msd_type = -1;
423 static int hf_isis_lsp_clv_igp_msd_value = -1;
424 static int hf_isis_lsp_clv_ext_admin_group = -1;
425 static int hf_isis_lsp_clv_app_sabm_legacy = -1;
426 static int hf_isis_lsp_clv_app_sabm_length = -1;
427 static int hf_isis_lsp_clv_app_sabm_bits = -1;
428 static int hf_isis_lsp_clv_app_sabm_bits_r = -1;
429 static int hf_isis_lsp_clv_app_sabm_bits_s = -1;
430 static int hf_isis_lsp_clv_app_sabm_bits_f = -1;
431 static int hf_isis_lsp_clv_app_sabm_bits_x = -1;
432 static int hf_isis_lsp_clv_app_udabm_reserved = -1;
433 static int hf_isis_lsp_clv_app_udabm_length = -1;
434 static int hf_isis_lsp_clv_app_udabm_bits = -1;
435 static int hf_isis_lsp_clv_flex_algo_algorithm = -1;
436 static int hf_isis_lsp_clv_flex_algo_metric_type = -1;
437 static int hf_isis_lsp_clv_flex_algo_calc_type = -1;
438 static int hf_isis_lsp_clv_flex_algo_priority = -1;
439 static int hf_isis_lsp_clv_srv6_endx_sid_system_id = -1;
440 static int hf_isis_lsp_clv_srv6_endx_sid_flags = -1;
441 static int hf_isis_lsp_clv_srv6_endx_sid_flags_b = -1;
442 static int hf_isis_lsp_clv_srv6_endx_sid_flags_s = -1;
443 static int hf_isis_lsp_clv_srv6_endx_sid_flags_p = -1;
444 static int hf_isis_lsp_clv_srv6_endx_sid_alg = -1;
445 static int hf_isis_lsp_clv_srv6_endx_sid_weight = -1;
446 static int hf_isis_lsp_clv_srv6_endx_sid_endpoint_func = -1;
447 static int hf_isis_lsp_clv_srv6_endx_sid_sid = -1;
448 static int hf_isis_lsp_clv_srv6_endx_sid_subsubclvs_len = -1;
449 static int hf_isis_lsp_area_address = -1;
450 static int hf_isis_lsp_instance_identifier = -1;
451 static int hf_isis_lsp_supported_itid = -1;
452 static int hf_isis_lsp_clv_nlpid_nlpid = -1;
453 static int hf_isis_lsp_ip_authentication = -1;
454 static int hf_isis_lsp_authentication = -1;
455 static int hf_isis_lsp_area_address_str = -1;
456 static int hf_isis_lsp_is_virtual = -1;
457 static int hf_isis_lsp_group = -1;
458 static int hf_isis_lsp_default = -1;
459 static int hf_isis_lsp_default_support = -1;
460 static int hf_isis_lsp_delay = -1;
461 static int hf_isis_lsp_delay_support = -1;
462 static int hf_isis_lsp_expense = -1;
463 static int hf_isis_lsp_expense_support = -1;
464 static int hf_isis_lsp_error = -1;
465 static int hf_isis_lsp_error_support = -1;
466 static int hf_isis_lsp_clv_ipv6_te_router_id = -1;
467 static int hf_isis_lsp_ext_is_reachability_ipv6_interface_address = -1;
468 static int hf_isis_lsp_ext_is_reachability_ipv6_neighbor_address = -1;
469 static int hf_isis_lsp_clv_bier_alg = -1;
470 static int hf_isis_lsp_clv_bier_igp_alg = -1;
471 static int hf_isis_lsp_clv_bier_subdomain = -1;
472 static int hf_isis_lsp_clv_bier_bfrid = -1;
473 static int hf_isis_lsp_clv_bier_subsub_type = -1;
474 static int hf_isis_lsp_clv_bier_subsub_len = -1;
475 static int hf_isis_lsp_clv_bier_subsub_mplsencap_maxsi= -1;
476 static int hf_isis_lsp_clv_bier_subsub_mplsencap_bslen= -1;
477 static int hf_isis_lsp_clv_bier_subsub_mplsencap_label= -1;
478 static int hf_isis_lsp_srv6_loc_metric = -1;
479 static int hf_isis_lsp_srv6_loc_flags = -1;
480 static int hf_isis_lsp_srv6_loc_flags_d = -1;
481 static int hf_isis_lsp_srv6_loc_flags_reserved = -1;
482 static int hf_isis_lsp_srv6_loc_alg = -1;
483 static int hf_isis_lsp_srv6_loc_size = -1;
484 static int hf_isis_lsp_srv6_loc_locator = -1;
485 static int hf_isis_lsp_srv6_loc_subclvs_len = -1;
486 static int hf_isis_lsp_srv6_loc_sub_tlv_type = -1;
487 static int hf_isis_lsp_srv6_loc_sub_tlv_length = -1;
488 static int hf_isis_lsp_clv_srv6_end_sid_flags = -1;
489 static int hf_isis_lsp_clv_srv6_end_sid_endpoint_func = -1;
490 static int hf_isis_lsp_clv_srv6_end_sid_sid = -1;
491 static int hf_isis_lsp_clv_srv6_end_sid_subsubclvs_len = -1;
492 static int hf_isis_lsp_purge_orig_id_num = -1;
493 static int hf_isis_lsp_purge_orig_id_system_id = -1;
494 /* rfc 6165: MAC Reachability */
495 static int hf_isis_lsp_mac_reachability_topoid_nick = -1;
496 static int hf_isis_lsp_mac_reachability_confidence = -1;
497 static int hf_isis_lsp_mac_reachability_reserved = -1;
498 static int hf_isis_lsp_mac_reachability_vlan = -1;
499 static int hf_isis_lsp_mac_reachability_mac = -1;
500 static int hf_isis_lsp_mac_reachability_chassismac = -1;
501 static int hf_isis_lsp_mac_reachability_fanmcast = -1;
502 /* Avaya proprietary */
503 static int hf_isis_lsp_avaya_ipvpn_unknown = -1;
504 static int hf_isis_lsp_avaya_ipvpn_system_id = -1;
505 static int hf_isis_lsp_avaya_ipvpn_vrfsid = -1;
506 static int hf_isis_lsp_avaya_ipvpn_subtlvbytes = -1;
507 static int hf_isis_lsp_avaya_ipvpn_subtlvtype = -1;
508 static int hf_isis_lsp_avaya_ipvpn_subtlvlength = -1;
509 static int hf_isis_lsp_avaya_ipvpn_unknown_sub = -1;
510 static int hf_isis_lsp_avaya_ipvpn_ipv4_metric = -1;
511 static int hf_isis_lsp_avaya_ipvpn_ipv4_metrictype = -1;
512 static int hf_isis_lsp_avaya_ipvpn_ipv4_addr = -1;
513 static int hf_isis_lsp_avaya_ipvpn_ipv4_mask = -1;
514 static int hf_isis_lsp_avaya_ipvpn_ipv6_metric = -1;
515 static int hf_isis_lsp_avaya_ipvpn_ipv6_prefixlen = -1;
516 static int hf_isis_lsp_avaya_ipvpn_ipv6_prefix = -1;
517 static int hf_isis_lsp_avaya_185_unknown = -1;
518 static int hf_isis_lsp_avaya_186_unknown = -1;
519 
520 static gint ett_isis_lsp = -1;
521 static gint ett_isis_lsp_info = -1;
522 static gint ett_isis_lsp_att = -1;
523 static gint ett_isis_lsp_cksum = -1;
524 static gint ett_isis_lsp_clv_area_addr = -1;
525 static gint ett_isis_lsp_clv_is_neighbors = -1;
526 static gint ett_isis_lsp_clv_instance_identifier = -1;
527 static gint ett_isis_lsp_clv_ext_is_reachability = -1; /* CLV 22 */
528 static gint ett_isis_lsp_part_of_clv_ext_is_reachability = -1;
529 static gint ett_isis_lsp_part_of_clv_ext_is_reachability_subtlv = -1;
530 static gint ett_isis_lsp_subclv_admin_group = -1;
531 static gint ett_isis_lsp_subclv_unrsv_bw = -1;
532 static gint ett_isis_lsp_subclv_bw_ct = -1;
533 static gint ett_isis_lsp_subclv_spb_link_metric = -1;
534 static gint ett_isis_lsp_adj_sid_flags = -1;
535 static gint ett_isis_lsp_clv_unknown = -1;
536 static gint ett_isis_lsp_clv_partition_dis = -1;
537 static gint ett_isis_lsp_clv_prefix_neighbors = -1;
538 static gint ett_isis_lsp_clv_nlpid_nlpid = -1;
539 static gint ett_isis_lsp_clv_hostname = -1;
540 static gint ett_isis_lsp_clv_srlg = -1;
541 static gint ett_isis_lsp_clv_te_router_id = -1;
542 static gint ett_isis_lsp_clv_authentication = -1;
543 static gint ett_isis_lsp_clv_ip_authentication = -1;
544 static gint ett_isis_lsp_clv_ipv4_int_addr = -1;
545 static gint ett_isis_lsp_clv_ipv6_int_addr = -1; /* CLV 232 */
546 static gint ett_isis_lsp_clv_mt_cap = -1;
547 static gint ett_isis_lsp_clv_mt_cap_spb_instance = -1;
548 static gint ett_isis_lsp_clv_mt_cap_spbm_service_identifier = -1;
549 static gint ett_isis_lsp_clv_mt_cap_spbv_mac_address = -1;
550 static gint ett_isis_lsp_clv_sid_label_binding = -1;
551 static gint ett_isis_lsp_clv_ip_reachability = -1;
552 static gint ett_isis_lsp_clv_ip_reach_subclv = -1;
553 static gint ett_isis_lsp_clv_ext_ip_reachability = -1; /* CLV 135 */
554 static gint ett_isis_lsp_part_of_clv_ext_ip_reachability = -1;
555 static gint ett_isis_lsp_clv_ipv6_reachability = -1; /* CLV 236 */
556 static gint ett_isis_lsp_part_of_clv_ipv6_reachability = -1;
557 static gint ett_isis_lsp_prefix_sid_flags = -1;
558 static gint ett_isis_lsp_prefix_attr_flags = -1;
559 static gint ett_isis_lsp_clv_mt = -1;
560 static gint ett_isis_lsp_clv_mt_is = -1;
561 static gint ett_isis_lsp_part_of_clv_mt_is = -1;
562 static gint ett_isis_lsp_clv_mt_reachable_IPv4_prefx = -1;  /* CLV 235 */
563 static gint ett_isis_lsp_clv_mt_reachable_IPv6_prefx = -1;  /* CLV 237 */
564 static gint ett_isis_lsp_clv_rt_capable = -1;   /* CLV 242 */
565 static gint ett_isis_lsp_clv_te_node_cap_desc = -1;
566 static gint ett_isis_lsp_clv_sr_cap = -1;
567 static gint ett_isis_lsp_clv_sr_sid_label = -1;
568 static gint ett_isis_lsp_clv_sr_alg = -1;
569 static gint ett_isis_lsp_clv_sr_lb = -1;
570 static gint ett_isis_lsp_clv_node_msd = -1;
571 static gint ett_isis_lsp_clv_srv6_cap = -1;
572 static gint ett_isis_lsp_clv_srv6_cap_flags = -1;
573 static gint ett_isis_lsp_clv_flex_algo_def = -1;
574 static gint ett_isis_lsp_clv_flex_algo_def_sub_tlv = -1;
575 static gint ett_isis_lsp_clv_app_sabm_bits = -1;
576 static gint ett_isis_lsp_clv_ipv6_te_rtrid = -1;
577 static gint ett_isis_lsp_clv_trill_version = -1;
578 static gint ett_isis_lsp_clv_trees = -1;
579 static gint ett_isis_lsp_clv_root_id = -1;
580 static gint ett_isis_lsp_clv_nickname = -1;
581 static gint ett_isis_lsp_clv_interested_vlans = -1;
582 static gint ett_isis_lsp_clv_tree_used = -1;
583 static gint ett_isis_lsp_clv_vlan_group = -1;
584 static gint ett_isis_lsp_clv_grp_address = -1;  /* CLV 142 */
585 static gint ett_isis_lsp_clv_grp_macaddr = -1;
586 static gint ett_isis_lsp_clv_grp_ipv4addr = -1;
587 static gint ett_isis_lsp_clv_grp_ipv6addr = -1;
588 static gint ett_isis_lsp_clv_grp_unknown = -1;
589 static gint ett_isis_lsp_clv_purge_orig_id = -1; /* CLV 13 */
590 static gint ett_isis_lsp_clv_originating_buff_size = -1; /* CLV 14 */
591 static gint ett_isis_lsp_sl_flags = -1;
592 static gint ett_isis_lsp_sl_sub_tlv = -1;
593 static gint ett_isis_lsp_sl_sub_tlv_flags = -1;
594 static gint ett_isis_lsp_clv_ipv6_te_router_id = -1;
595 static gint ett_isis_lsp_clv_bier_subsub_tlv = -1;
596 static gint ett_isis_lsp_clv_srv6_locator = -1;
597 static gint ett_isis_lsp_clv_srv6_loc_flags = -1;
598 static gint ett_isis_lsp_clv_srv6_loc_sub_tlv = -1;
599 static gint ett_isis_lsp_clv_srv6_endx_sid_flags = -1;
600 static gint ett_isis_lsp_clv_unidir_link_flags = -1;
601 static gint ett_isis_lsp_clv_mac_reachability = -1;
602 static gint ett_isis_lsp_clv_avaya_ipvpn = -1;
603 static gint ett_isis_lsp_clv_avaya_ipvpn_subtlv = -1;
604 static gint ett_isis_lsp_clv_avaya_ipvpn_mc = -1;
605 static gint ett_isis_lsp_clv_avaya_ip_grt_mc = -1;
606 
607 
608 static expert_field ei_isis_lsp_short_pdu = EI_INIT;
609 static expert_field ei_isis_lsp_long_pdu = EI_INIT;
610 static expert_field ei_isis_lsp_bad_checksum = EI_INIT;
611 static expert_field ei_isis_lsp_subtlv = EI_INIT;
612 static expert_field ei_isis_lsp_authentication = EI_INIT;
613 static expert_field ei_isis_lsp_short_clv = EI_INIT;
614 static expert_field ei_isis_lsp_long_clv = EI_INIT;
615 static expert_field ei_isis_lsp_length_clv = EI_INIT;
616 static expert_field ei_isis_lsp_clv_mt = EI_INIT;
617 static expert_field ei_isis_lsp_clv_unknown = EI_INIT;
618 static expert_field ei_isis_lsp_malformed_subtlv = EI_INIT;
619 static expert_field ei_isis_lsp_unknown_subtlv = EI_INIT;
620 static expert_field ei_isis_lsp_reserved_not_zero = EI_INIT;
621 static expert_field ei_isis_lsp_length_invalid = EI_INIT;
622 
623 static const value_string isis_lsp_istype_vals[] = {
624     { ISIS_LSP_TYPE_UNUSED0,    "Unused 0x0 (invalid)"},
625     { ISIS_LSP_TYPE_LEVEL_1,    "Level 1"},
626     { ISIS_LSP_TYPE_UNUSED2,    "Unused 0x2 (invalid)"},
627     { ISIS_LSP_TYPE_LEVEL_2,    "Level 2"},
628     { 0, NULL } };
629 
630 static const value_string isis_lsp_sl_sub_tlv_vals[] = {
631     { ISIS_LSP_SL_SUB_SID_LABEL,  "SID/Label"},
632     { ISIS_LSP_SL_SUB_PREFIX_SID, "Prefix SID"},
633     { ISIS_LSP_SL_SUB_ADJ_SID,    "Adjacency SID"},
634     { ISIS_LSP_SL_SUB_LAN_ADJ_SID,"LAN-Adjacency SID"},
635     { 0, NULL } };
636 
637 static const value_string srv6_endpoint_type_vals[] = {
638     { 1,     "End" },
639     { 2,     "End (PSP)" },
640     { 3,     "End (USP)" },
641     { 4,     "End (PSP/USP)" },
642     { 5,     "End.X" },
643     { 6,     "End.X (PSP)" },
644     { 7,     "End.X (USP)" },
645     { 8,     "End.X (PSP/USP)" },
646     { 9,     "End.T" },
647     { 10,    "End.T (PSP)" },
648     { 11,    "End.T (USP)" },
649     { 12,    "End.T (PSP/USP)" },
650     { 13,    "End.B6" },
651     { 14,    "End.B6.Encaps" },
652     { 15,    "End.BM" },
653     { 16,    "End.DX6" },
654     { 17,    "End.DX4" },
655     { 18,    "End.DT6" },
656     { 19,    "End.DT4" },
657     { 20,    "End.DT46" },
658     { 21,    "End.DX2" },
659     { 22,    "End.DX2V" },
660     { 23,    "End.DT2U" },
661     { 24,    "End.DT2M" },
662     { 25,    "End.S" },
663     { 26,    "End.B6.Red" },
664     { 27,    "End.B6.Encaps.Red" },
665     { 0, NULL }
666 };
667 
668 static const value_string isis_lsp_srv6_loc_sub_tlv_vals[] = {
669     { 5,  "SRv6 End SID"},
670     { 0, NULL } };
671 
672 static int * const adj_sid_flags[] = {
673     &hf_isis_lsp_adj_sid_family_flag,
674     &hf_isis_lsp_adj_sid_backup_flag,
675     &hf_isis_lsp_adj_sid_value_flag,
676     &hf_isis_lsp_adj_sid_local_flag,
677     &hf_isis_lsp_adj_sid_set_flag,
678     NULL,
679 };
680 
681 static int * const srv6_cap_flags[] = {
682     &hf_isis_lsp_clv_srv6_cap_flags_o,
683     &hf_isis_lsp_clv_srv6_cap_flags_unused,
684     NULL,
685 };
686 
687 static int * const srv6_locator_flags[] = {
688     &hf_isis_lsp_srv6_loc_flags_d,
689     &hf_isis_lsp_srv6_loc_flags_reserved,
690     NULL,
691 };
692 
693 static int * const srv6_endx_sid_flags[] = {
694     &hf_isis_lsp_clv_srv6_endx_sid_flags_b,
695     &hf_isis_lsp_clv_srv6_endx_sid_flags_s,
696     &hf_isis_lsp_clv_srv6_endx_sid_flags_p,
697     NULL,
698 };
699 
700 static int * const prefix_sid_flags[] = {
701     &hf_isis_lsp_ext_ip_reachability_prefix_re_adv_flag,
702     &hf_isis_lsp_ext_ip_reachability_prefix_node_sid_flag,
703     &hf_isis_lsp_ext_ip_reachability_prefix_nophp_flag,
704     &hf_isis_lsp_ext_ip_reachability_prefix_expl_null_flag,
705     &hf_isis_lsp_ext_ip_reachability_prefix_value_flag,
706     &hf_isis_lsp_ext_ip_reachability_prefix_local_flag,
707     NULL,
708 };
709 
710 static int * const prefix_attr_flags[] = {
711     &hf_isis_lsp_prefix_attr_flags_x,
712     &hf_isis_lsp_prefix_attr_flags_r,
713     &hf_isis_lsp_prefix_attr_flags_n,
714     NULL,
715 };
716 
717 static const true_false_string tfs_ipv6_ipv4 = { "IPv6", "IPv4" };
718 
719 static const value_string isis_igp_alg_vals[] = {
720     { ISIS_ALG_SPF,  "Shortest Path First (SPF)" },
721     { ISIS_ALG_SSPF, "Strict Shortest Path First (SPF)" },
722     { 0, NULL }
723 };
724 
725 static const value_string isis_lsp_igp_msd_types[] = {
726     { IGP_MSD_TYPE_RESERVED,        "Reserved" },
727     { IGP_MSD_TYPE_MPLS,            "Base MPLS Imposition" },
728     { IGP_MSD_TYPE_SEGMENT_LEFT,    "Maximum Segments Left" },
729     { IGP_MSD_TYPE_END_POP,         "Maximum End Pop" },
730     { IGP_MSD_TYPE_T_INSERT,        "Maximum T.Insert" },
731     { IGP_MSD_TYPE_T_ENCAP,         "Maximum T.Encaps" },
732     { IGP_MSD_TYPE_END_D,           "Maximum End D" },
733     { 0, NULL }
734 };
735 
736 static const value_string isis_lsp_flex_algo_metric_type_vals[] = {
737     { 0, "IGP Metric"},
738     { 1, "Min Unidirectional Link Delay"},
739     { 2, "TE Metric"},
740     { 0, NULL }
741 };
742 
743 static const value_string isis_lsp_flex_algo_sub_tlv_vals[] = {
744     { FAD_EXCLUDE_AG,       "Flexible Algorithm Exclude Admin Group"},
745     { FAD_INCLUDE_ANY_AG,   "Flexible Algorithm Include-Any Admin Group"},
746     { FAD_INCLUDE_ALL_AG,   "Flexible Algorithm Include-All Admin Group"},
747     { FAD_DEF_FLAGS,        "Flexible Algorithm Definition Flags"},
748     { FAD_EXCLUDE_SRLG,     "Flexible Algorithm Exclude SRLG"},
749     { 0, NULL } };
750 
751 static int * const isis_lsp_app_sabm_bits[] = {
752     &hf_isis_lsp_clv_app_sabm_bits_r,
753     &hf_isis_lsp_clv_app_sabm_bits_s,
754     &hf_isis_lsp_clv_app_sabm_bits_f,
755     &hf_isis_lsp_clv_app_sabm_bits_x,
756     NULL,
757 };
758 
759 static const value_string isis_lsp_grp_types[] = {
760     { GRP_MAC_ADDRESS,  "MAC address" },
761     { GRP_IPV4_ADDRESS, "IPv4 address" },
762     { GRP_IPV6_ADDRESS, "IPv6 address" },
763     { 0, NULL }
764 };
765 
766 static int * const unidir_link_flags[] = {
767     &hf_isis_lsp_ext_is_reachability_unidir_link_flags_a,
768     NULL,
769 };
770 
771 /*
772 http://www.iana.org/assignments/isis-tlv-codepoints/isis-tlv-codepoints.xhtml#isis-tlv-codepoints-22-23-141-222-223
773 https://tools.ietf.org/html/rfc8667
774 */
775 static const value_string isis_lsp_ext_is_reachability_code_vals[] = {
776     { 3, "Administrative group (color)" },
777     { 4, "Link Local/Remote Identifiers" },
778     { 6, "IPv4 interface address" },
779     { 8, "IPv4 neighbor address" },
780     { 9, "Maximum link bandwidth" },
781     { 10, "Maximum reservable link bandwidth" },
782     { 11, "Unreserved bandwidth" },
783     { 12, "IPv6 Interface Address" },
784     { 13, "IPv6 Neighbor Address" },
785     { 14, "Extended Administrative Group" },
786     { 15, "Link Maximum SID Depth" },
787     { 16, "Application-Specific Link Attributes" },
788     { 18, "TE Default metric" },
789     { 19, "Link-attributes" },
790     { 20, "Link Protection Type" },
791     { 21, "Interface Switching Capability Descriptor" },
792     { 22, "Bandwidth Constraints" },
793     { 23, "Unconstrained TE LSP Count (sub-)TLV" },
794     { 24, "remote AS number" },
795     { 25, "IPv4 remote ASBR Identifier" },
796     { 26, "IPv6 remote ASBR Identifier" },
797     { 27, "Interface Adjustment Capability Descriptor (IACD)" },
798     { 28, "MTU" },
799     { 29, "SPB-Metric" },
800     { 30, "SPB-A-OALG" },
801     { 31, "Adj-SID" },
802     { 32, "LAN-Adj-SID" },
803     { 33, "Unidirectional Link Delay"},
804     { 34, "Min/Max Unidirectional Link Delay"},
805     { 35, "Unidirectional Delay Variation"},
806     { 36, "Unidirectional Link Loss"},
807     { 37, "Unidirectional Residual Bandwidth"},
808     { 38, "Unidirectional Available Bandwidth"},
809     { 39, "Unidirectional Utilized Bandwidth"},
810     { 43, "SRv6 End.X SID" },       /* Suggested Value */
811     { 44, "SRv6 LAN End.X SID" },   /* Suggested Value */
812     { 250, "Reserved for Cisco-specific extensions" },
813     { 251, "Reserved for Cisco-specific extensions" },
814     { 252, "Reserved for Cisco-specific extensions" },
815     { 253, "Reserved for Cisco-specific extensions" },
816     { 254, "Reserved for Cisco-specific extensions" },
817     { 0, NULL }
818 };
819 
820 /*
821     From: https://www.iana.org/assignments/isis-tlv-codepoints/isis-tlv-codepoints.xhtml
822     Sub-TLVs for TLVs 135, 235, 236, and 237
823 */
824 #define IP_REACH_SUBTLV_32BIT_ADMIN_TAG 1
825 #define IP_REACH_SUBTLV_64BIT_ADMIN_TAG 2
826 #define IP_REACH_SUBTLV_PFX_SID         3
827 #define IP_REACH_SUBTLV_PFX_ATTRIB_FLAG 4
828 #define IP_REACH_SUBTLV_BIER_INFO       32
829 
830 static const value_string isis_lsp_ext_ip_reachability_code_vals[] = {
831     { IP_REACH_SUBTLV_32BIT_ADMIN_TAG, "32-bit Administrative Tag" },
832     { IP_REACH_SUBTLV_64BIT_ADMIN_TAG, "64-bit Administrative Tag" },
833     { IP_REACH_SUBTLV_PFX_SID,         "Prefix-SID" },
834     { IP_REACH_SUBTLV_PFX_ATTRIB_FLAG, "Prefix Attribute Flags" },
835     { IP_REACH_SUBTLV_BIER_INFO,       "BIER Info" },
836     { 0, NULL }
837 };
838 
839 /*
840     From: https://www.iana.org/assignments/bier/bier.xhtml
841     BIER Algorithm
842 */
843 static const range_string isis_lsp_bier_alg_vals[] = {
844     {   0,   0, "No BIER specific algorithm is used" },
845     { 240, 255, "Experimental Use" },
846     {   0,   0, NULL }
847 };
848 
849 /*
850     From: https://www.iana.org/assignments/isis-tlv-codepoints/isis-tlv-codepoints.xhtml
851     sub-sub-TLVs for BIER Info sub-TLV
852 */
853 static const value_string isis_lsp_bier_subsubtlv_type_vals[] = {
854     { 1, "BIER MPLS Encapsulation" },
855     { 0, NULL }
856 };
857 
858 /* Avaya specific sub-TLV types */
859 static const value_string isis_lsp_avaya_ipvpn_subtlv_code_vals[] = {
860     { 1,   "IPv4 Metric Type" },
861     { 135, "IPv4 Reachability" },
862     { 236, "IPv6 Reachability" },
863     { 0, NULL }
864 };
865 
866 /*
867  * Name: dissect_lsp_mt_id()
868  *
869  * Description:
870  *    dissect and display the multi-topology ID value
871  *
872  * Input:
873  *    tvbuff_t * : tvbuffer for packet data
874  *    proto_tree * : protocol display tree to fill out.  CAN'T BE NULL
875  *    int : offset into packet data where we are.
876  *
877  * Output:
878  *    void, but we will add to proto tree.
879  */
880 static void
dissect_lsp_mt_id(tvbuff_t * tvb,proto_tree * tree,int offset)881 dissect_lsp_mt_id(tvbuff_t *tvb, proto_tree *tree, int offset)
882 {
883 
884     proto_tree_add_item(tree, hf_isis_lsp_mt_id_reserved, tvb, offset, 2, ENC_BIG_ENDIAN);
885 
886     proto_tree_add_item(tree, hf_isis_lsp_mt_id, tvb, offset, 2, ENC_BIG_ENDIAN);
887 
888 }
889 
890 /*
891  * Name: dissect_metric()
892  *
893  * Description:
894  *    Display a metric prefix portion.  ISIS has the concept of multiple
895  *    metric per prefix (default, delay, expense, and error).  This
896  *    routine assists other dissectors by adding a single one of
897  *    these to the display tree..
898  *
899  *    The 8th(msbit) bit in the metric octet is the "supported" bit.  The
900  *        "default" support is required, so we support a "force_supported"
901  *        flag that tells us that it MUST be zero (zero==supported,
902  *        so it really should be a "not supported" in the boolean sense)
903  *        and to display a protocol failure accordingly.  Notably,
904  *        Cisco IOS 12(6) blows this!
905  *    The 7th bit must be zero (reserved).
906  *
907  * Input:
908  *    tvbuff_t * : tvbuffer for packet data
909  *    proto_tree * : protocol display tree to fill out.  May be NULL
910  *    int : offset into packet data where we are.
911  *    int : hf of the metric.
912  *    int : hf_support of the metric.
913  *    int : force supported.  True is the supported bit MUST be zero.
914  *
915  * Output:
916  *    void, but we will add to proto tree if !NULL.
917  */
918 static void
dissect_metric(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,int offset,int hf,int hf_support,int force_supported)919 dissect_metric(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, int offset,
920     int hf, int hf_support, int force_supported )
921 {
922     guint8 metric;
923     proto_item *item, *support_item;
924 
925     metric = tvb_get_guint8(tvb, offset);
926     support_item = proto_tree_add_boolean(tree, hf_support, tvb, offset, 1, metric);
927     item = proto_tree_add_uint(tree, hf, tvb, offset, 1, metric);
928 
929     if (!ISIS_LSP_CLV_METRIC_SUPPORTED(metric) && force_supported)
930         proto_item_append_text(support_item, " (but is required to be)");
931 
932     if (ISIS_LSP_CLV_METRIC_RESERVED(metric))
933         expert_add_info(pinfo, item, &ei_isis_lsp_reserved_not_zero);
934 }
935 
936 /*
937  * Name: dissect_lsp_ip_reachability_clv()
938  *
939  * Description:
940  *    Decode an IP reachability CLV.  This can be either internal or
941  *    external (the clv format does not change and which type we are
942  *    displaying is put there by the dispatcher).  All of these
943  *    are a metric block followed by an IP addr and mask.
944  *
945  * Input:
946  *    tvbuff_t * : tvbuffer for packet data
947  *    proto_tree * : proto tree to build on (may be null)
948  *    int : current offset into packet data
949  *    int : length of IDs in packet.
950  *    int : length of this clv
951  *
952  * Output:
953  *    void, will modify proto_tree if not null.
954  */
955 static void
dissect_lsp_ip_reachability_clv(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,int offset,isis_data_t * isis _U_,int length)956 dissect_lsp_ip_reachability_clv(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, int offset,
957     isis_data_t *isis _U_, int length)
958 {
959     proto_item     *ti;
960     proto_tree    *ntree = NULL;
961     guint32        src, mask, bitmask;
962     int        prefix_len;
963     gboolean    found_mask = FALSE;
964 
965     while ( length > 0 ) {
966         if (length<12) {
967             proto_tree_add_expert_format(tree, pinfo, &ei_isis_lsp_short_clv, tvb, offset, -1,
968                 "short IP reachability (%d vs 12)", length );
969             return;
970         }
971         /*
972          * Gotta build a sub-tree for all our pieces
973          */
974         if ( tree ) {
975             src = tvb_get_ipv4(tvb, offset+4);
976             mask = tvb_get_ntohl(tvb, offset+8);
977 
978             /* find out if the mask matches one of 33 possible prefix lengths */
979             bitmask = 0xffffffff;
980             for(prefix_len = 32; prefix_len >= 0; prefix_len--) {
981                 if (bitmask==mask) {
982                     found_mask = TRUE;
983                     break;
984                 }
985                 bitmask = bitmask << 1;
986             }
987 
988             /* If we have a discontiguous netmask, dump the mask, otherwise print the prefix_len */
989             /* XXX - We should probably have some sort of netmask_to_str() routine in to_str.c that does this. */
990 
991             if(found_mask) {
992               ti = proto_tree_add_ipv4_format_value( tree, hf_isis_lsp_ip_reachability_ipv4_prefix, tvb, offset, 12,
993                 src, "%s/%d", tvb_ip_to_str(pinfo->pool, tvb, offset+4), prefix_len );
994             } else {
995               ti = proto_tree_add_ipv4_format_value( tree, hf_isis_lsp_ip_reachability_ipv4_prefix, tvb, offset, 12,
996                 src, "%s mask %s", tvb_ip_to_str(pinfo->pool, tvb, offset+4), tvb_ip_to_str(pinfo->pool, tvb, offset+8));
997             };
998 
999             ntree = proto_item_add_subtree(ti, ett_isis_lsp_clv_ip_reachability);
1000 
1001             proto_tree_add_item(ntree, hf_isis_lsp_ip_reachability_default_metric, tvb, offset, 1, ENC_BIG_ENDIAN);
1002             proto_tree_add_item(ntree, hf_isis_lsp_ip_reachability_default_metric_ie, tvb, offset, 1, ENC_NA);
1003             proto_tree_add_item(ntree, hf_isis_lsp_ip_reachability_distribution, tvb, offset, 1, ENC_NA);
1004 
1005             proto_tree_add_item(ntree, hf_isis_lsp_ip_reachability_delay_metric, tvb, offset+1, 1, ENC_BIG_ENDIAN);
1006             proto_tree_add_item(ntree, hf_isis_lsp_ip_reachability_delay_metric_support, tvb, offset+1, 1, ENC_NA);
1007             proto_tree_add_item(ntree, hf_isis_lsp_ip_reachability_delay_metric_ie, tvb, offset+1, 1, ENC_NA);
1008 
1009             proto_tree_add_item(ntree, hf_isis_lsp_ip_reachability_expense_metric, tvb, offset+2, 1, ENC_BIG_ENDIAN);
1010             proto_tree_add_item(ntree, hf_isis_lsp_ip_reachability_expense_metric_support, tvb, offset+2, 1, ENC_NA);
1011             proto_tree_add_item(ntree, hf_isis_lsp_ip_reachability_expense_metric_ie, tvb, offset+2, 1, ENC_NA);
1012 
1013             proto_tree_add_item(ntree, hf_isis_lsp_ip_reachability_error_metric, tvb, offset+3, 1, ENC_BIG_ENDIAN);
1014             proto_tree_add_item(ntree, hf_isis_lsp_ip_reachability_error_metric_support, tvb, offset+3, 1, ENC_NA);
1015             proto_tree_add_item(ntree, hf_isis_lsp_ip_reachability_error_metric_ie, tvb, offset+3, 1, ENC_NA);
1016         }
1017         offset += 12;
1018         length -= 12;
1019     }
1020 }
1021 
1022 
1023 /*
1024  * Name: dissect_bierinfo_subsubtlv()
1025  *
1026  * Description:
1027  *    Decodes a BIER Info sub-sub-TLV (RFC 8401)
1028  *
1029  * Input:
1030  *    tvbuff_t * : tvbuffer for packet data
1031  *    proto_tree * : proto tree to build on (may be null)
1032  *    int : current offset into packet data
1033  *
1034  * Output:
1035  *    void, will modify proto_tree if not null.
1036  */
1037 static void
dissect_bierinfo_subsubtlv(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,int offset,int tlv_type,int tlv_len)1038 dissect_bierinfo_subsubtlv (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1039                             int offset, int tlv_type, int tlv_len)
1040 {
1041     switch (tlv_type) {
1042     case 1:
1043         if (tlv_len != 4) {
1044             proto_tree_add_expert_format(tree, pinfo, &ei_isis_lsp_malformed_subtlv,
1045                     tvb, offset, tlv_len, "TLV length (%d) != 4 bytes", tlv_len);
1046             return;
1047         }
1048         proto_tree_add_item(tree, hf_isis_lsp_clv_bier_subsub_mplsencap_maxsi, tvb, offset, 1, ENC_BIG_ENDIAN);
1049         proto_tree_add_item(tree, hf_isis_lsp_clv_bier_subsub_mplsencap_bslen, tvb, offset+1, 1, ENC_BIG_ENDIAN);
1050         proto_tree_add_item(tree, hf_isis_lsp_clv_bier_subsub_mplsencap_label, tvb, offset+1, 3, ENC_BIG_ENDIAN);
1051         break;
1052     default:
1053         break;
1054     }
1055 
1056     return;
1057 }
1058 
1059 
1060 /*
1061  * Name: dissect_bierinfo_subtlv()
1062  *
1063  * Description:
1064  *    Decodes a BIER Info sub-TLV (RFC 8401)
1065  *
1066  * Input:
1067  *    tvbuff_t * : tvbuffer for packet data
1068  *    proto_tree * : proto tree to build on (may be null)
1069  *    int : current offset into packet data
1070  *
1071  * Output:
1072  *    void, will modify proto_tree if not null.
1073  */
1074 static void
dissect_bierinfo_subtlv(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,int offset,int tlv_len)1075 dissect_bierinfo_subtlv (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
1076                          int offset, int tlv_len)
1077 {
1078     int min_tlv_len = 5;
1079     int len = tlv_len;
1080     guint subsub_type, subsub_len;
1081     proto_tree *subsub_tree = NULL;
1082     proto_item *ti_subsub = NULL;
1083 
1084     if (tlv_len < min_tlv_len) {
1085         proto_tree_add_expert_format(tree, pinfo, &ei_isis_lsp_malformed_subtlv,
1086                 tvb, offset-2, tlv_len+2,
1087                 "Invalid length (%d) bytes for BIER Info sub-TLV: Minimum length (%d) bytes",
1088                 tlv_len+2, min_tlv_len+2);
1089         return;
1090     }
1091     proto_tree_add_item(tree, hf_isis_lsp_clv_bier_alg, tvb, offset, 1, ENC_BIG_ENDIAN);
1092     offset += 1;
1093     proto_tree_add_item(tree, hf_isis_lsp_clv_bier_igp_alg, tvb, offset, 1, ENC_BIG_ENDIAN);
1094     offset += 1;
1095     proto_tree_add_item(tree, hf_isis_lsp_clv_bier_subdomain, tvb, offset, 1, ENC_BIG_ENDIAN);
1096     offset += 1;
1097     proto_tree_add_item(tree, hf_isis_lsp_clv_bier_bfrid, tvb, offset, 2, ENC_BIG_ENDIAN);
1098     offset += 2;
1099     len -= 5;
1100 
1101     /* Dissect sub-sub-TLVs if present */
1102     min_tlv_len = 2;
1103     while (len > 0) {
1104         if (len < min_tlv_len) {
1105             proto_tree_add_expert_format(tree, pinfo, &ei_isis_lsp_malformed_subtlv,
1106                     tvb, offset, len,
1107                     "Invalid data length (%d) bytes for BIER Info sub-sub-TLV: Minimum length (%d) bytes",
1108                     len, min_tlv_len);
1109             return;
1110         }
1111         subsub_type = tvb_get_guint8(tvb, offset);
1112         subsub_len  = tvb_get_guint8(tvb, offset+1);
1113         subsub_tree = proto_tree_add_subtree(tree, tvb, offset, subsub_len+2,
1114                                              ett_isis_lsp_clv_bier_subsub_tlv,
1115                                              &ti_subsub, "sub-subTLV");
1116         proto_tree_add_item(subsub_tree, hf_isis_lsp_clv_bier_subsub_type,
1117                             tvb, offset, 1, ENC_BIG_ENDIAN);
1118         offset += 1;
1119         proto_tree_add_item(subsub_tree, hf_isis_lsp_clv_bier_subsub_len,
1120                             tvb, offset, 1, ENC_BIG_ENDIAN);
1121         offset += 1;
1122         len -= 2;
1123         proto_item_append_text(ti_subsub, ": %s (t=%u, l=%u)",
1124                 val_to_str(subsub_type, isis_lsp_bier_subsubtlv_type_vals, "Unknown"),
1125                 subsub_type, subsub_len);
1126         dissect_bierinfo_subsubtlv(tvb, pinfo, subsub_tree, offset, subsub_type, subsub_len);
1127         offset += subsub_len;
1128         len -= subsub_len;
1129     }
1130 
1131     return;
1132 }
1133 
1134 
1135 /*
1136  * Name: dissect_ipreach_subclv ()
1137  *
1138  * Description: parses IP reach subTLVs
1139  *              Called by various IP Reachability dissectors.
1140  *
1141  * Input:
1142  *   tvbuff_t * : tvbuffer for packet data
1143  *   proto_tree * : protocol display tree to fill out.
1144  *   int : offset into packet data where we are (beginning of the sub_clv value).
1145  *
1146  * Output:
1147  *   void
1148  */
1149 static void
dissect_ipreach_subclv(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,proto_item * tree_item,int offset,int clv_code,int clv_len)1150 dissect_ipreach_subclv(tvbuff_t *tvb, packet_info *pinfo,  proto_tree *tree, proto_item *tree_item, int offset, int clv_code, int clv_len)
1151 {
1152     guint8 flags;
1153 
1154     switch (clv_code) {
1155     case IP_REACH_SUBTLV_32BIT_ADMIN_TAG:
1156         while (clv_len >= 4) {
1157             proto_tree_add_item(tree, hf_isis_lsp_32_bit_administrative_tag, tvb, offset, 4, ENC_BIG_ENDIAN);
1158             offset+=4;
1159             clv_len-=4;
1160         }
1161         break;
1162     case IP_REACH_SUBTLV_64BIT_ADMIN_TAG:
1163         while (clv_len >= 8) {
1164             proto_tree_add_item(tree, hf_isis_lsp_64_bit_administrative_tag, tvb, offset, 8, ENC_BIG_ENDIAN);
1165             offset+=8;
1166             clv_len-=8;
1167         }
1168         break;
1169     case IP_REACH_SUBTLV_PFX_SID:
1170         flags = tvb_get_guint8(tvb, offset);
1171         proto_tree_add_bitmask(tree, tvb, offset, hf_isis_lsp_ext_ip_reachability_prefix_flags,
1172                                    ett_isis_lsp_prefix_sid_flags, prefix_sid_flags, ENC_BIG_ENDIAN);
1173         offset++;
1174 
1175         proto_tree_add_item(tree, hf_isis_lsp_clv_sr_alg, tvb, offset, 1, ENC_BIG_ENDIAN);
1176         offset++;
1177 
1178         if (clv_len == 5) {
1179             if (!((flags & 0x0C) == 0x0C))
1180                 proto_tree_add_expert_format(tree, pinfo, &ei_isis_lsp_malformed_subtlv, tvb,
1181                                 offset-2, clv_len, "V & L flags must be set");
1182             proto_tree_add_item(tree, hf_isis_lsp_sid_sli_label, tvb, offset, 3, ENC_BIG_ENDIAN);
1183         } else if (clv_len == 6) {
1184             if (flags & 0x0C)
1185                 proto_tree_add_expert_format(tree, pinfo, &ei_isis_lsp_malformed_subtlv, tvb,
1186                                 offset-2, clv_len, "V & L flags must be unset");
1187             proto_tree_add_item(tree, hf_isis_lsp_sid_sli_index, tvb, offset, 4, ENC_BIG_ENDIAN);
1188         } else {
1189                 proto_tree_add_expert_format(tree, pinfo, &ei_isis_lsp_malformed_subtlv, tvb,
1190                                 offset-2, clv_len, "Unknown SID/Index/Label format");
1191         }
1192         break;
1193     case IP_REACH_SUBTLV_PFX_ATTRIB_FLAG:
1194         /* Prefix Attribute Flags */
1195         flags = tvb_get_guint8(tvb, offset);
1196         proto_tree_add_bitmask(tree, tvb, offset, hf_isis_lsp_prefix_attr_flags,
1197                                ett_isis_lsp_prefix_attr_flags, prefix_attr_flags, ENC_BIG_ENDIAN);
1198         if (tree_item) {
1199             proto_item_append_text(tree_item, ": Flags:%c%c%c",
1200                                    ((flags & ISIS_LSP_PFX_ATTR_FLAG_X) != 0) ? 'X' : '-',
1201                                    ((flags & ISIS_LSP_PFX_ATTR_FLAG_R) != 0) ? 'R' : '-',
1202                                    ((flags & ISIS_LSP_PFX_ATTR_FLAG_N) != 0) ? 'N' : '-');
1203         }
1204         break;
1205     case IP_REACH_SUBTLV_BIER_INFO:
1206         dissect_bierinfo_subtlv(tvb, pinfo, tree, offset, clv_len);
1207         break;
1208     default :
1209         break;
1210     }
1211 }
1212 
1213 
1214 /*
1215  * Name: dissect_lsp_ext_ip_reachability_clv()
1216  *
1217  * Description: Decode an Extended IP Reachability CLV - code 135.
1218  *
1219  *   The extended IP reachability TLV is an extended version
1220  *   of the IP reachability TLVs (codes 128 and 130). It encodes
1221  *   the metric as a 32-bit unsigned interger and allows to add
1222  *   sub-CLV(s).
1223  *
1224  *   CALLED BY TLV 235 DISSECTOR
1225  *
1226  *
1227  * Input:
1228  *   tvbuff_t * : tvbuffer for packet data
1229  *   proto_tree * : proto tree to build on (may be null)
1230  *   int : current offset into packet data
1231  *   int : length of IDs in packet.
1232  *   int : length of this clv
1233  *
1234  * Output:
1235  *   void, will modify proto_tree if not null.
1236  */
1237 static void
dissect_lsp_ext_ip_reachability_clv(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,int offset,isis_data_t * isis _U_,int length)1238 dissect_lsp_ext_ip_reachability_clv(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree,
1239     int offset, isis_data_t *isis _U_, int length)
1240 {
1241     proto_tree  *subtree = NULL;
1242     proto_tree  *subclv_tree = NULL;
1243     proto_item  *ti_subtree = NULL;
1244     proto_item  *ti_subclvs = NULL;
1245     guint8      ctrl_info;
1246     guint       bit_length;
1247     int         byte_length;
1248     ws_in4_addr prefix;
1249     address     prefix_addr;
1250     guint       len,i;
1251     guint       subclvs_len;
1252     guint       clv_code, clv_len;
1253     gint        clv_offset;
1254     gchar       *prefix_str;
1255 
1256     while (length > 0) {
1257         ctrl_info = tvb_get_guint8(tvb, offset+4);
1258         bit_length = ctrl_info & 0x3f;
1259         byte_length = tvb_get_ipv4_addr_with_prefix_len(tvb, offset+5, &prefix, bit_length);
1260         if (byte_length == -1) {
1261             proto_tree_add_expert_format(tree, pinfo, &ei_isis_lsp_short_clv, tvb, offset, -1,
1262                  "IPv4 prefix has an invalid length: %d bits", bit_length );
1263                 return;
1264             }
1265         subclvs_len = 0;
1266         if ((ctrl_info & 0x40) != 0)
1267             subclvs_len = 1+tvb_get_guint8(tvb, offset+5+byte_length);
1268 
1269         /* open up a new tree per prefix */
1270         subtree = proto_tree_add_subtree(tree, tvb, offset, 5+byte_length+subclvs_len,
1271                             ett_isis_lsp_part_of_clv_ext_ip_reachability, &ti_subtree, "Ext. IP Reachability");
1272 
1273         set_address(&prefix_addr, AT_IPv4, 4, &prefix);
1274         prefix_str = address_to_str(pinfo->pool, &prefix_addr);
1275         proto_item_append_text(ti_subtree, ": %s/%u", prefix_str, bit_length);
1276 
1277         proto_tree_add_item(subtree, hf_isis_lsp_ext_ip_reachability_metric, tvb, offset, 4, ENC_BIG_ENDIAN);
1278         proto_tree_add_item(subtree, hf_isis_lsp_ext_ip_reachability_distribution, tvb, offset+4, 1, ENC_NA);
1279         proto_tree_add_item(subtree, hf_isis_lsp_ext_ip_reachability_subtlv, tvb, offset+4, 1, ENC_NA);
1280         proto_tree_add_item(subtree, hf_isis_lsp_ext_ip_reachability_prefix_length, tvb, offset+4, 1, ENC_NA);
1281 
1282         proto_tree_add_ipv4(subtree, hf_isis_lsp_ext_ip_reachability_ipv4_prefix, tvb, offset + 5, byte_length, prefix);
1283 
1284         len = 5 + byte_length;
1285         if ((ctrl_info & 0x40) != 0) {
1286             subclvs_len = tvb_get_guint8(tvb, offset+len);
1287             proto_tree_add_item(subtree, hf_isis_lsp_ext_ip_reachability_subclvs_len, tvb, offset+len, 1, ENC_BIG_ENDIAN);
1288             i =0;
1289             while (i < subclvs_len) {
1290                 clv_offset = offset + len + 1 + i; /* skip the total subtlv len indicator */
1291                 clv_code = tvb_get_guint8(tvb, clv_offset);
1292                 clv_len  = tvb_get_guint8(tvb, clv_offset+1);
1293                 subclv_tree = proto_tree_add_subtree(subtree, tvb, clv_offset, clv_len + 2,
1294                                                  ett_isis_lsp_clv_ip_reach_subclv,
1295                                                  &ti_subclvs, "subTLV");
1296                 proto_tree_add_item(subclv_tree, hf_isis_lsp_ext_ip_reachability_code,
1297                                     tvb, clv_offset, 1, ENC_BIG_ENDIAN);
1298                 proto_tree_add_item(subclv_tree, hf_isis_lsp_ext_ip_reachability_len, tvb, clv_offset+1, 1, ENC_BIG_ENDIAN);
1299                 proto_item_append_text(ti_subclvs, ": %s (c=%u, l=%u)", val_to_str(clv_code, isis_lsp_ext_ip_reachability_code_vals, "Unknown"), clv_code, clv_len);
1300 
1301                 /*
1302                  * we pass on now the raw data to the ipreach_subtlv dissector
1303                  * therefore we need to skip 3 bytes
1304                  * (total subtlv len, subtlv type, subtlv len)
1305                  */
1306                 dissect_ipreach_subclv(tvb, pinfo, subclv_tree, ti_subclvs, clv_offset+2, clv_code, clv_len);
1307                 i += clv_len + 2;
1308             }
1309             len += 1 + subclvs_len;
1310         } else {
1311             proto_tree_add_uint_format(subtree, hf_isis_lsp_ext_ip_reachability_subclvs_len, tvb, offset+len, 0, 0, "no sub-TLVs present");
1312         }
1313 
1314         offset += len;
1315         length -= len;
1316     }
1317 }
1318 
1319 /*
1320  * Name: dissect_isis_grp_address_clv()
1321  *
1322  * Description: Decode GROUP ADDRESS subTLVs
1323  *              The  Group Address  TLV is composed of 1 octet for the type,
1324  *              1 octet that specifies the number of bytes in the value field, and a
1325  *              Variable length value field that can have any or all of the subTLVs that are listed in the
1326  *              - below section
1327  *
1328  *Input:
1329  *   tvbuff_t * : tvbuffer for packet data
1330  *   proto_tree * : proto tree to build on (may be null)
1331  *   int : current offset into packet data
1332  *   int : length of IDs in packet.
1333  *   int : length of this clv
1334  *
1335  * Output:
1336  *   void, will modify proto_tree if not null.
1337  */
1338 
1339 static void
dissect_isis_grp_address_clv(tvbuff_t * tvb,packet_info * pinfo _U_,proto_tree * tree,int offset,isis_data_t * isis _U_,int length)1340 dissect_isis_grp_address_clv(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *tree, int offset,
1341     isis_data_t *isis _U_, int length)
1342 {
1343     gint source_num;
1344     guint8 subtlv_type;
1345     int subtlv_len;
1346 
1347     proto_tree *rt_tree=NULL;
1348 
1349     while (length>0) {
1350         subtlv_type = tvb_get_guint8(tvb, offset);
1351         subtlv_len = tvb_get_guint8(tvb, offset+1);
1352         switch(subtlv_type) {
1353 
1354 
1355             case GRP_MAC_ADDRESS:
1356                 rt_tree = proto_tree_add_subtree(tree, tvb, offset, subtlv_len+2,
1357                     ett_isis_lsp_clv_grp_macaddr, NULL, "Group MAC Address Sub-TLV");
1358 
1359                 proto_tree_add_uint(rt_tree, hf_isis_lsp_grp_type, tvb, offset, 1, subtlv_type);
1360 
1361                 length--;
1362                 offset++;
1363 
1364                 proto_tree_add_uint(rt_tree, hf_isis_lsp_grp_macaddr_length, tvb, offset, 1, subtlv_len);
1365 
1366                 if(subtlv_len < 5) {
1367                     length -= subtlv_len;
1368                     offset += subtlv_len;
1369                     break;
1370                 }
1371 
1372                 length--;
1373                 offset++;
1374 
1375                 proto_tree_add_item(rt_tree, hf_isis_lsp_grp_macaddr_topology_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1376 
1377                 length -= 2;
1378                 offset += 2;
1379                 subtlv_len -= 2;
1380 
1381                 proto_tree_add_item(rt_tree, hf_isis_lsp_grp_macaddr_vlan_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1382 
1383                 length -= 2;
1384                 offset += 2;
1385                 subtlv_len -= 2;
1386 
1387                 proto_tree_add_item(rt_tree, hf_isis_lsp_grp_macaddr_number_of_records, tvb, offset, 1, ENC_BIG_ENDIAN);
1388 
1389                 length--;
1390                 offset++;
1391                 subtlv_len--;
1392 
1393                 while(subtlv_len > 0) {
1394 
1395                     source_num=tvb_get_guint8(tvb, offset);
1396                     proto_tree_add_item(rt_tree, hf_isis_lsp_grp_macaddr_number_of_sources, tvb, offset, 1, ENC_BIG_ENDIAN);
1397 
1398                     length--;
1399                     offset++;
1400                     subtlv_len--;
1401 
1402                     proto_tree_add_item(rt_tree, hf_isis_lsp_grp_macaddr_group_address, tvb, offset, 6, ENC_NA);
1403 
1404                     length -= 6;
1405                     offset += 6;
1406                     subtlv_len -= 6;
1407 
1408 
1409                     while((subtlv_len > 0) && (source_num > 0)) {
1410                         proto_tree_add_item(rt_tree, hf_isis_lsp_grp_macaddr_source_address, tvb, offset, 6, ENC_NA);
1411 
1412                         length -= 6;
1413                         offset += 6;
1414                         subtlv_len -= 6;
1415                         source_num--;
1416                     }
1417                 }
1418 
1419                 break;
1420 
1421             case GRP_IPV4_ADDRESS:
1422                 rt_tree = proto_tree_add_subtree(tree, tvb, offset, subtlv_len+2,
1423                     ett_isis_lsp_clv_grp_ipv4addr, NULL, "Group IPv4 Address Sub-TLV");
1424 
1425                 proto_tree_add_uint(rt_tree, hf_isis_lsp_grp_type, tvb, offset, 1, subtlv_type);
1426 
1427                 length--;
1428                 offset++;
1429 
1430                 proto_tree_add_uint(rt_tree, hf_isis_lsp_grp_ipv4addr_length, tvb, offset, 1, subtlv_len);
1431 
1432                 if(subtlv_len < 5) {
1433                     length -= subtlv_len;
1434                     offset += subtlv_len;
1435                     break;
1436                 }
1437 
1438                 length--;
1439                 offset++;
1440 
1441                 proto_tree_add_item(rt_tree, hf_isis_lsp_grp_ipv4addr_topology_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1442 
1443                 length -= 2;
1444                 offset += 2;
1445                 subtlv_len -= 2;
1446 
1447                 proto_tree_add_item(rt_tree, hf_isis_lsp_grp_ipv4addr_vlan_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1448 
1449                 length -= 2;
1450                 offset += 2;
1451                 subtlv_len -= 2;
1452 
1453                 proto_tree_add_item(rt_tree, hf_isis_lsp_grp_ipv4addr_number_of_records, tvb, offset, 1, ENC_BIG_ENDIAN);
1454 
1455                 length--;
1456                 offset++;
1457                 subtlv_len--;
1458 
1459                 while(subtlv_len > 0) {
1460 
1461                     source_num=tvb_get_guint8(tvb, offset);
1462                     proto_tree_add_item(rt_tree, hf_isis_lsp_grp_ipv4addr_number_of_sources, tvb, offset, 1, ENC_BIG_ENDIAN);
1463 
1464                     length--;
1465                     offset++;
1466                     subtlv_len--;
1467 
1468                     proto_tree_add_item(rt_tree, hf_isis_lsp_grp_ipv4addr_group_address, tvb, offset, 4, ENC_BIG_ENDIAN);
1469 
1470                     length -= 4;
1471                     offset += 4;
1472                     subtlv_len -= 4;
1473 
1474 
1475                     while((subtlv_len > 0) && (source_num > 0)) {
1476                         proto_tree_add_item(rt_tree, hf_isis_lsp_grp_ipv4addr_source_address, tvb, offset, 4, ENC_BIG_ENDIAN);
1477 
1478                         length -= 4;
1479                         offset += 4;
1480                         subtlv_len -= 4;
1481                         source_num--;
1482                     }
1483                 }
1484 
1485                 break;
1486 
1487             case GRP_IPV6_ADDRESS:
1488                 rt_tree = proto_tree_add_subtree(tree, tvb, offset, subtlv_len+2,
1489                     ett_isis_lsp_clv_grp_ipv6addr, NULL, "Group IPv6 Address Sub-TLV");
1490 
1491                 proto_tree_add_uint(rt_tree, hf_isis_lsp_grp_type, tvb, offset, 1, subtlv_type);
1492 
1493                 length--;
1494                 offset++;
1495 
1496                 proto_tree_add_uint(rt_tree, hf_isis_lsp_grp_ipv6addr_length, tvb, offset, 1, subtlv_len);
1497 
1498                 if(subtlv_len < 5) {
1499                     length -= subtlv_len;
1500                     offset += subtlv_len;
1501                     break;
1502                 }
1503 
1504                 length--;
1505                 offset++;
1506 
1507                 proto_tree_add_item(rt_tree, hf_isis_lsp_grp_ipv6addr_topology_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1508 
1509                 length -= 2;
1510                 offset += 2;
1511                 subtlv_len -= 2;
1512 
1513                 proto_tree_add_item(rt_tree, hf_isis_lsp_grp_ipv6addr_vlan_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1514 
1515                 length -= 2;
1516                 offset += 2;
1517                 subtlv_len -= 2;
1518 
1519                 proto_tree_add_item(rt_tree, hf_isis_lsp_grp_ipv6addr_number_of_records, tvb, offset, 1, ENC_BIG_ENDIAN);
1520 
1521                 length--;
1522                 offset++;
1523                 subtlv_len--;
1524 
1525                 while(subtlv_len > 0) {
1526 
1527                     source_num=tvb_get_guint8(tvb, offset);
1528                     proto_tree_add_item(rt_tree, hf_isis_lsp_grp_ipv6addr_number_of_sources, tvb, offset, 1, ENC_BIG_ENDIAN);
1529 
1530                     length--;
1531                     offset++;
1532                     subtlv_len--;
1533 
1534                     proto_tree_add_item(rt_tree, hf_isis_lsp_grp_ipv6addr_group_address, tvb, offset, 16, ENC_NA);
1535 
1536                     length -= 16;
1537                     offset += 16;
1538                     subtlv_len -= 16;
1539 
1540 
1541                     while((subtlv_len > 0) && (source_num > 0)) {
1542                         proto_tree_add_item(rt_tree, hf_isis_lsp_grp_ipv6addr_source_address, tvb, offset, 16, ENC_NA);
1543 
1544                         length -= 16;
1545                         offset += 16;
1546                         subtlv_len -= 16;
1547                         source_num--;
1548                     }
1549                 }
1550 
1551                 break;
1552 
1553             default:
1554                 rt_tree = proto_tree_add_subtree(tree, tvb, offset, subtlv_len+2,
1555                     ett_isis_lsp_clv_grp_unknown, NULL, "Unknown Sub-TLV");
1556 
1557                 proto_tree_add_uint(rt_tree, hf_isis_lsp_grp_type, tvb, offset, 1, subtlv_type);
1558 
1559                 length--;
1560                 offset++;
1561 
1562                 proto_tree_add_uint(rt_tree, hf_isis_lsp_grp_unknown_length, tvb, offset, 1, subtlv_len);
1563 
1564                 length--;
1565                 offset++;
1566 
1567                 length -= subtlv_len;
1568                 offset += subtlv_len;
1569                 break;
1570         }
1571     }
1572 }
1573 
1574 /**
1575  * Decode the Segment Routing "SID/Label" Sub-TLV
1576  *
1577  * This Sub-TLV is used in the Segment Routing Capability TLV (2)
1578  * It's called by the TLV 242 dissector (dissect_isis_trill_clv)
1579  *
1580  * @param tvb the buffer of the current data
1581  * @param pinfo the packet info of the current data
1582  * @param tree the tree to append this item
1583  * @param offset the offset in the tvb
1584  * @param tlv_len the length of tlv
1585  */
1586 static void
dissect_lsp_sr_sid_label_clv(tvbuff_t * tvb,packet_info * pinfo _U_,proto_tree * tree,int offset,guint8 tlv_len)1587 dissect_lsp_sr_sid_label_clv(tvbuff_t *tvb, packet_info* pinfo _U_,
1588                              proto_tree *tree, int offset, guint8 tlv_len)
1589 {
1590     proto_tree *subtree;
1591 
1592     subtree = proto_tree_add_subtree_format(tree, tvb, offset-2, tlv_len+2, ett_isis_lsp_clv_sr_sid_label,
1593                                          NULL, "SID/Label (t=1, l=%u)", tlv_len);
1594 
1595     switch (tlv_len) { /* The length determines the type of info */
1596     case 4:     /* Then it's a SID */
1597             proto_tree_add_item(subtree, hf_isis_lsp_clv_sr_cap_sid, tvb, offset, tlv_len, ENC_BIG_ENDIAN);
1598             break;
1599         case 3: /* Then it's a Label */
1600             proto_tree_add_item(subtree, hf_isis_lsp_clv_sr_cap_label, tvb, offset, tlv_len, ENC_BIG_ENDIAN);
1601             break;
1602     default:
1603             proto_tree_add_expert_format(subtree, pinfo, &ei_isis_lsp_subtlv, tvb, offset, tlv_len,
1604                                          "SID/Label SubTlv - Bad length: Type: %d, Length: %d", ISIS_SR_SID_LABEL, tlv_len);
1605             break;
1606     }
1607 }
1608 
1609 static void dissect_subclv_ext_admin_group(tvbuff_t *tvb, proto_tree *tree,
1610                                            int offset, int subtype _U_, int sublen);
1611 
1612 static int
dissect_isis_trill_clv(tvbuff_t * tvb,packet_info * pinfo _U_,proto_tree * tree,int offset,int subtype,int sublen)1613 dissect_isis_trill_clv(tvbuff_t *tvb, packet_info* pinfo _U_,
1614         proto_tree *tree, int offset, int subtype, int sublen)
1615 {
1616     guint16 rt_block;
1617     proto_tree *rt_tree, *cap_tree, *subtree;
1618     guint16 root_id;
1619     guint8 tlv_type, tlv_len;
1620     int i;
1621     gint local_offset;
1622 
1623     switch (subtype) {
1624 
1625     case ISIS_TE_NODE_CAP_DESC:
1626         /* 1 TE Node Capability Descriptor [RFC5073] */
1627         cap_tree = proto_tree_add_subtree(tree, tvb, offset-2, sublen+2,
1628             ett_isis_lsp_clv_te_node_cap_desc, NULL, "TE Node Capability Descriptor");
1629         /*
1630          *    0        B bit: P2MP Branch LSR capability       [RFC5073]
1631          *    1        E bit: P2MP Bud LSR capability          [RFC5073]
1632          *    2        M bit: MPLS-TE support                  [RFC5073]
1633          *    3        G bit: GMPLS support                    [RFC5073]
1634          *    4        P bit: P2MP RSVP-TE support             [RFC5073]
1635          *    5-7      Unassigned                              [RFC5073]
1636          */
1637 
1638         proto_tree_add_item(cap_tree, hf_isis_lsp_clv_te_node_cap_b_bit, tvb, offset, 1, ENC_NA);
1639         proto_tree_add_item(cap_tree, hf_isis_lsp_clv_te_node_cap_e_bit, tvb, offset, 1, ENC_NA);
1640         proto_tree_add_item(cap_tree, hf_isis_lsp_clv_te_node_cap_m_bit, tvb, offset, 1, ENC_NA);
1641         proto_tree_add_item(cap_tree, hf_isis_lsp_clv_te_node_cap_g_bit, tvb, offset, 1, ENC_NA);
1642         proto_tree_add_item(cap_tree, hf_isis_lsp_clv_te_node_cap_p_bit, tvb, offset, 1, ENC_NA);
1643         return(0);
1644 
1645     case SEGMENT_ROUTING_CAP:
1646         rt_tree = proto_tree_add_subtree_format(tree, tvb, offset-2, sublen+2, ett_isis_lsp_clv_sr_cap,
1647                                                 NULL, "Segment Routing - Capability (t=%u, l=%u)", subtype, sublen);
1648 
1649         /*
1650          *    0        I-Flag: IPv4 flag                [draft-ietf-isis-segment-routing-extensions]
1651          *    1        V-Flag: IPv6 flag                [draft-ietf-isis-segment-routing-extensions]
1652          *    2-7      Unassigned
1653          */
1654 
1655         proto_tree_add_item(rt_tree, hf_isis_lsp_clv_sr_cap_i_flag, tvb, offset, 1, ENC_NA);
1656         proto_tree_add_item(rt_tree, hf_isis_lsp_clv_sr_cap_v_flag, tvb, offset, 1, ENC_NA);
1657         proto_tree_add_item(rt_tree, hf_isis_lsp_clv_sr_cap_range, tvb, offset+1, 3, ENC_BIG_ENDIAN);
1658 
1659         tlv_type = tvb_get_guint8(tvb, offset+4);
1660         tlv_len = tvb_get_guint8(tvb, offset+5);
1661         if (tlv_type == ISIS_SR_SID_LABEL) {
1662             dissect_lsp_sr_sid_label_clv(tvb, pinfo, rt_tree, offset+6, tlv_len);
1663         } else
1664             proto_tree_add_expert_format(rt_tree, pinfo, &ei_isis_lsp_subtlv, tvb, offset+4, tlv_len+2,
1665                                          "Unknown SubTlv: Type: %d, Length: %d", tlv_type, tlv_len);
1666 
1667         return(0);
1668 
1669     case IPV6_TE_ROUTER_ID:
1670         /* 12: IPv6 TE Router ID (rfc5316) */
1671         rt_tree = proto_tree_add_subtree_format(tree, tvb, offset-2, sublen+2,
1672                                                 ett_isis_lsp_clv_ipv6_te_rtrid,
1673                                                 NULL, "IPv6 TE Router ID (t=%u, l=%u)",
1674                                                 subtype, sublen);
1675         proto_tree_add_item(rt_tree, hf_isis_lsp_clv_ipv6_te_router_id, tvb, offset, 16, ENC_NA);
1676         return (0);
1677 
1678     case TRILL_VERSION:
1679         rt_tree = proto_tree_add_subtree_format(tree, tvb, offset-2, sublen+2,
1680                     ett_isis_lsp_clv_trill_version, NULL, "TRILL version (t=%u, l=%u)", subtype, sublen);
1681 
1682         proto_tree_add_item(rt_tree, hf_isis_lsp_rt_capable_trill_maximum_version, tvb, offset, 1, ENC_BIG_ENDIAN);
1683 
1684         if ( sublen == 5 ) {
1685             offset++;
1686             proto_tree_add_item(rt_tree, hf_isis_lsp_rt_capable_trill_affinity_tlv, tvb, offset, 4, ENC_NA);
1687             proto_tree_add_item(rt_tree, hf_isis_lsp_rt_capable_trill_fgl_safe, tvb, offset, 4, ENC_NA);
1688             proto_tree_add_item(rt_tree, hf_isis_lsp_rt_capable_trill_caps, tvb, offset, 4, ENC_NA);
1689             proto_tree_add_item(rt_tree, hf_isis_lsp_rt_capable_trill_flags, tvb, offset, 4, ENC_NA);
1690         }
1691 
1692         return(0);
1693 
1694     case TREES:
1695         rt_tree = proto_tree_add_subtree_format(tree, tvb, offset-2, sublen+2,
1696                             ett_isis_lsp_clv_trees, NULL, "Trees (t=%u, l=%u)", subtype, sublen);
1697 
1698         proto_tree_add_item(rt_tree, hf_isis_lsp_rt_capable_trees_nof_trees_to_compute, tvb, offset, 2, ENC_BIG_ENDIAN);
1699         proto_tree_add_item(rt_tree, hf_isis_lsp_rt_capable_trees_maximum_nof_trees_to_compute, tvb, offset+2, 2, ENC_BIG_ENDIAN);
1700         proto_tree_add_item(rt_tree, hf_isis_lsp_rt_capable_trees_nof_trees_to_use, tvb, offset+4, 2, ENC_BIG_ENDIAN);
1701 
1702         return(0);
1703 
1704     case TREE_IDENTIFIER:
1705         rt_tree = proto_tree_add_subtree_format(tree, tvb, offset-2, sublen+2,
1706                             ett_isis_lsp_clv_root_id, NULL, "Tree root identifiers (t=%u, l=%u)", subtype, sublen);
1707 
1708         root_id = tvb_get_ntohs(tvb, offset);
1709         proto_tree_add_item(rt_tree, hf_isis_lsp_rt_capable_tree_root_id_starting_tree_no, tvb, offset, 2, ENC_BIG_ENDIAN);
1710 
1711         sublen -= 2;
1712         offset += 2;
1713 
1714         while (sublen>=2) {
1715             rt_block = tvb_get_ntohs(tvb, offset);
1716             proto_tree_add_uint_format(rt_tree, hf_isis_lsp_rt_capable_tree_root_id_nickname, tvb, offset, 2,
1717                                        rt_block, "Nickname(%dth root): 0x%04x (%d)", root_id, rt_block, rt_block);
1718             root_id++;
1719             sublen -= 2;
1720             offset += 2;
1721         }
1722 
1723         return(0);
1724 
1725     case NICKNAME:
1726         rt_tree = proto_tree_add_subtree_format(tree, tvb, offset-2, sublen+2,
1727                             ett_isis_lsp_clv_nickname, NULL, "Nickname (t=%u, l=%u)", subtype, sublen);
1728 
1729         while (sublen>=5) {
1730             proto_tree_add_item(rt_tree, hf_isis_lsp_rt_capable_nickname_nickname_priority, tvb, offset, 1, ENC_BIG_ENDIAN);
1731             proto_tree_add_item(rt_tree, hf_isis_lsp_rt_capable_nickname_tree_root_priority, tvb, offset+1, 2, ENC_BIG_ENDIAN);
1732             proto_tree_add_item(rt_tree, hf_isis_lsp_rt_capable_nickname_nickname, tvb, offset+3, 2, ENC_BIG_ENDIAN);
1733             sublen -= 5;
1734             offset += 5;
1735         }
1736 
1737         return(0);
1738 
1739     case INTERESTED_VLANS:
1740         rt_tree = proto_tree_add_subtree_format(tree, tvb, offset-2, sublen+2,
1741                         ett_isis_lsp_clv_interested_vlans, NULL, "Interested VLANs and spanning tree roots (t=%u, l=%u)", subtype, sublen);
1742 
1743         proto_tree_add_item(rt_tree, hf_isis_lsp_rt_capable_interested_vlans_nickname, tvb, offset, 2, ENC_BIG_ENDIAN);
1744         sublen -= 2;
1745         offset += 2;
1746 
1747         proto_tree_add_item(rt_tree, hf_isis_lsp_rt_capable_interested_vlans_multicast_ipv4, tvb, offset, 2, ENC_BIG_ENDIAN);
1748         proto_tree_add_item(rt_tree, hf_isis_lsp_rt_capable_interested_vlans_multicast_ipv6, tvb, offset, 2, ENC_BIG_ENDIAN);
1749         proto_tree_add_item(rt_tree, hf_isis_lsp_rt_capable_interested_vlans_vlan_start_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1750         sublen -= 2;
1751         offset += 2;
1752 
1753         proto_tree_add_item(rt_tree, hf_isis_lsp_rt_capable_interested_vlans_vlan_end_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1754         sublen -= 2;
1755         offset += 2;
1756 
1757         proto_tree_add_item(rt_tree, hf_isis_lsp_rt_capable_interested_vlans_afs_lost_counter, tvb, offset, 4, ENC_BIG_ENDIAN);
1758         sublen -= 4;
1759         offset += 4;
1760 
1761         while (sublen>=6) {
1762             proto_tree_add_item(rt_tree, hf_isis_lsp_root_id, tvb, offset, 6, ENC_NA);
1763             sublen -= 6;
1764             offset += 6;
1765         }
1766 
1767         return(0);
1768 
1769     case TREES_USED_IDENTIFIER:
1770         rt_tree = proto_tree_add_subtree_format(tree, tvb, offset-2, sublen+2,
1771                     ett_isis_lsp_clv_tree_used, NULL, "Trees used identifiers (t=%u, l=%u)", subtype, sublen);
1772 
1773         root_id = tvb_get_ntohs(tvb, offset);
1774         proto_tree_add_item(rt_tree, hf_isis_lsp_rt_capable_tree_used_id_starting_tree_no, tvb, offset, 2, ENC_BIG_ENDIAN);
1775 
1776         sublen -= 2;
1777         offset += 2;
1778 
1779         while (sublen>=2) {
1780             rt_block = tvb_get_ntohs(tvb, offset);
1781             proto_tree_add_uint_format(rt_tree, hf_isis_lsp_rt_capable_tree_used_id_nickname, tvb, offset,2,
1782                                        rt_block, "Nickname(%dth root): 0x%04x (%d)", root_id, rt_block, rt_block);
1783             root_id++;
1784             offset += 2;
1785             sublen -= 2;
1786         }
1787 
1788         return(0);
1789 
1790     case VLAN_GROUP:
1791         rt_tree = proto_tree_add_subtree_format(tree, tvb, offset-2, sublen+2,
1792                         ett_isis_lsp_clv_vlan_group, NULL, "VLAN group (t=%u, l=%u)", subtype, sublen);
1793 
1794         proto_tree_add_item(rt_tree, hf_isis_lsp_rt_capable_vlan_group_primary_vlan_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1795 
1796         offset += 2;
1797         sublen -= 2;
1798 
1799         while (sublen>=2) {
1800 
1801             proto_tree_add_item(rt_tree, hf_isis_lsp_rt_capable_vlan_group_secondary_vlan_id, tvb, offset, 2, ENC_BIG_ENDIAN);
1802             sublen -= 2;
1803             offset += 2;
1804         }
1805 
1806         return(0);
1807 
1808     case SEGMENT_ROUTING_ALG:
1809         rt_tree = proto_tree_add_subtree_format(tree, tvb, offset-2, sublen+2,
1810                                          ett_isis_lsp_clv_sr_alg, NULL, "Segment Routing - Algorithms (t=%u, l=%u)",
1811                                          subtype, sublen);
1812         i = 0;
1813         while (i < sublen) {
1814             proto_tree_add_item(rt_tree, hf_isis_lsp_clv_sr_alg, tvb, offset+i, 1, ENC_NA);
1815             i++;
1816         }
1817         return(0);
1818 
1819     case SEGMENT_ROUTING_LB:
1820         rt_tree = proto_tree_add_subtree_format(tree, tvb, offset-2, sublen+2,
1821                                          ett_isis_lsp_clv_sr_lb, NULL, "Segment Routing - Local Block (t=%u, l=%u)",
1822                                          subtype, sublen);
1823         proto_tree_add_item(rt_tree, hf_isis_lsp_clv_sr_lb_flags, tvb, offset, 1, ENC_NA);
1824         offset += 1;
1825         sublen -= 1;
1826         i = 0;
1827         while (i < sublen) {
1828             local_offset = offset + i;
1829             proto_tree_add_item(rt_tree, hf_isis_lsp_clv_sr_cap_range, tvb, local_offset, 3, ENC_NA);
1830             tlv_type = tvb_get_guint8(tvb, local_offset+3);
1831             tlv_len = tvb_get_guint8(tvb, local_offset+4);
1832             if (tlv_type == ISIS_SR_SID_LABEL) {
1833                 dissect_lsp_sr_sid_label_clv(tvb, pinfo, rt_tree, local_offset+5, tlv_len);
1834             } else {
1835                 proto_tree_add_expert_format(rt_tree, pinfo, &ei_isis_lsp_subtlv, tvb, local_offset+3, tlv_len+2,
1836                                              "Unknown Sub-TLV: Type: %d, Length: %d", tlv_type, tlv_len);
1837             }
1838             i += (5 + tlv_len);
1839         }
1840         return(0);
1841 
1842     case SRV6_CAP:
1843         rt_tree = proto_tree_add_subtree_format(tree, tvb, offset-2, sublen+2,
1844                                                 ett_isis_lsp_clv_srv6_cap,
1845                                                 NULL, "SRv6 Capability (t=%u, l=%u)",
1846                                                 subtype, sublen);
1847         proto_tree_add_bitmask(rt_tree, tvb, offset, hf_isis_lsp_clv_srv6_cap_flags,
1848                                ett_isis_lsp_clv_srv6_cap_flags, srv6_cap_flags, ENC_NA);
1849         return(0);
1850 
1851     case NODE_MSD:
1852         rt_tree = proto_tree_add_subtree_format(tree, tvb, offset-2, sublen+2,
1853                                                 ett_isis_lsp_clv_node_msd,
1854                                                 NULL, "Node Maximum SID Depth (t=%u, l=%u)",
1855                                                 subtype, sublen);
1856         while (sublen >= 2) {
1857             proto_tree_add_item(rt_tree, hf_isis_lsp_clv_igp_msd_type, tvb, offset, 1, ENC_NA);
1858             proto_tree_add_item(rt_tree, hf_isis_lsp_clv_igp_msd_value, tvb, offset+1, 1, ENC_NA);
1859             sublen -= 2;
1860             offset += 2;
1861         }
1862         return(0);
1863 
1864     case FLEX_ALGO_DEF:
1865         rt_tree = proto_tree_add_subtree_format(tree, tvb, offset-2, sublen+2,
1866                                                 ett_isis_lsp_clv_flex_algo_def,
1867                                                 NULL, "Flexible Algorithm Definition (t=%u, l=%u)",
1868                                                 subtype, sublen);
1869         proto_tree_add_item(rt_tree, hf_isis_lsp_clv_flex_algo_algorithm, tvb, offset, 1, ENC_NA);
1870         proto_tree_add_item(rt_tree, hf_isis_lsp_clv_flex_algo_metric_type, tvb, offset+1, 1, ENC_NA);
1871         proto_tree_add_item(rt_tree, hf_isis_lsp_clv_flex_algo_calc_type, tvb, offset+2, 1, ENC_NA);
1872         proto_tree_add_item(rt_tree, hf_isis_lsp_clv_flex_algo_priority, tvb, offset+3, 1, ENC_NA);
1873         sublen -= 4;
1874         offset += 4;
1875         while (sublen >= 2) {
1876             tlv_type = tvb_get_guint8(tvb, offset);
1877             tlv_len = tvb_get_guint8(tvb, offset+1);
1878             sublen -= 2;
1879             offset += 2;
1880             subtree = proto_tree_add_subtree_format(rt_tree, tvb, offset-2, tlv_len+2,
1881                                                     ett_isis_lsp_clv_flex_algo_def_sub_tlv,
1882                                                     NULL, "%s (t=%u, l=%u)",
1883                                                     val_to_str(tlv_type, isis_lsp_flex_algo_sub_tlv_vals, "Unknown"),
1884                                                     tlv_type, tlv_len);
1885             switch (tlv_type) {
1886             case FAD_EXCLUDE_AG:
1887             case FAD_INCLUDE_ANY_AG:
1888             case FAD_INCLUDE_ALL_AG:
1889                 dissect_subclv_ext_admin_group(tvb, subtree, offset, tlv_type, tlv_len);
1890                 break;
1891             default:
1892                 break;
1893             }
1894             sublen -= tlv_len;
1895             offset += tlv_len;
1896         }
1897         return(0);
1898 
1899     default:
1900         return(-1);
1901     }
1902 }
1903 
1904 /*
1905  * Name: dissect_isis_rt_capable_clv()
1906  *
1907  * Description: Decode RouterCapability subTLVs
1908  *
1909  *   The Router Capability TLV is composed of 1 octet for the type,
1910  *   1 octet that specifies the number of bytes in the value field, and a
1911  *   variable length value field that can have any or all of the subTLVs
1912  *   that are listed in the below section
1913  *
1914  * Input:
1915  *   tvbuff_t * : tvbuffer for packet data
1916  *   proto_tree * : proto tree to build on (may be null)
1917  *   int : current offset into packet data
1918  *   int : length of IDs in packet.
1919  *   int : length of this clv
1920  *   len : local variable described to handle the length of the subTLV
1921  *
1922  * Output:
1923  *   void, will modify proto_tree if not null.
1924  */
1925 
1926 /* As per RFC 7176 section 2.3 */
1927 static void
dissect_isis_rt_capable_clv(tvbuff_t * tvb,packet_info * pinfo _U_,proto_tree * tree,int offset,isis_data_t * isis _U_,int length)1928 dissect_isis_rt_capable_clv(tvbuff_t *tvb, packet_info* pinfo _U_,
1929         proto_tree *tree, int offset, isis_data_t *isis _U_, int length)
1930 {
1931     guint8 subtype, subtlvlen;
1932 
1933     proto_tree_add_item(tree, hf_isis_lsp_rt_capable_router_id, tvb, offset, 4, ENC_BIG_ENDIAN);
1934     offset += 4;
1935     length -= 4;
1936     proto_tree_add_item(tree, hf_isis_lsp_rt_capable_flag_s, tvb, offset, 1, ENC_BIG_ENDIAN);
1937     proto_tree_add_item(tree, hf_isis_lsp_rt_capable_flag_d, tvb, offset, 1, ENC_BIG_ENDIAN);
1938     length -= 1;
1939     offset += 1;
1940 
1941     while (length>=2) {
1942         subtype   = tvb_get_guint8(tvb, offset);
1943         subtlvlen = tvb_get_guint8(tvb, offset+1);
1944         length -= 2;
1945         offset += 2;
1946 
1947         if (subtlvlen > length) {
1948             proto_tree_add_expert_format(tree, pinfo, &ei_isis_lsp_short_clv, tvb, offset-2, -1,
1949                                   "Short type %d TLV (%d vs %d)", subtype, subtlvlen, length);
1950             return;
1951         }
1952 
1953         if (dissect_isis_trill_clv(tvb, pinfo, tree, offset, subtype, subtlvlen)==-1) {
1954 
1955             proto_tree_add_expert_format( tree, pinfo, &ei_isis_lsp_subtlv, tvb, offset-2, subtlvlen+2,
1956                                       "Unknown SubTlv: Type: %d, Length: %d", subtype, subtlvlen);
1957         }
1958         length -= subtlvlen;
1959         offset += subtlvlen;
1960     }
1961 }
1962 
1963 /*
1964  * Name: dissect_lsp_ipv6_reachability_clv()
1965  *
1966  * Description: Decode an IPv6 reachability CLV - code 236.
1967  *
1968  *   CALLED BY TLV 237 DISSECTOR
1969  *
1970  * Input:
1971  *   tvbuff_t * : tvbuffer for packet data
1972  *   proto_tree * : proto tree to build on (may be null)
1973  *   int : current offset into packet data
1974  *   int : length of IDs in packet.
1975  *   int : length of this clv
1976  *
1977  * Output:
1978  *   void, will modify proto_tree if not null.
1979  */
1980 static void
dissect_lsp_ipv6_reachability_clv(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,int offset,isis_data_t * isis _U_,int length)1981 dissect_lsp_ipv6_reachability_clv(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, int offset,
1982     isis_data_t *isis _U_, int length)
1983 {
1984     proto_tree        *subtree = NULL;
1985     proto_tree        *subtree2 = NULL;
1986     proto_item        *ti_subtree = NULL;
1987     proto_item        *ti_subclvs = NULL;
1988     guint8            ctrl_info;
1989     guint             bit_length;
1990     int               byte_length;
1991     ws_in6_addr prefix;
1992     address           prefix_addr;
1993     guint             len,i;
1994     guint             subclvs_len;
1995     guint             clv_code, clv_len;
1996     gint              clv_offset;
1997     gchar             *prefix_str;
1998 
1999     if (!tree) return;
2000 
2001     while (length > 0) {
2002         ctrl_info = tvb_get_guint8(tvb, offset+4);
2003         bit_length = tvb_get_guint8(tvb, offset+5);
2004         byte_length = tvb_get_ipv6_addr_with_prefix_len(tvb, offset+6, &prefix, bit_length);
2005         if (byte_length == -1) {
2006             proto_tree_add_expert_format(tree, pinfo, &ei_isis_lsp_short_clv, tvb, offset, -1,
2007                 "IPv6 prefix has an invalid length: %d bits", bit_length );
2008                 return;
2009             }
2010         subclvs_len = 0;
2011         if ((ctrl_info & 0x20) != 0)
2012             subclvs_len = 1+tvb_get_guint8(tvb, offset+6+byte_length);
2013 
2014         subtree = proto_tree_add_subtree(tree, tvb, offset, 6+byte_length+subclvs_len,
2015             ett_isis_lsp_part_of_clv_ipv6_reachability, &ti_subtree, "IPv6 Reachability");
2016 
2017         set_address(&prefix_addr, AT_IPv6, 16, prefix.bytes);
2018         prefix_str = address_to_str(pinfo->pool, &prefix_addr);
2019         proto_item_append_text(ti_subtree, ": %s/%u", prefix_str, bit_length);
2020 
2021         proto_tree_add_item(subtree, hf_isis_lsp_ipv6_reachability_metric, tvb, offset, 4, ENC_BIG_ENDIAN);
2022         proto_tree_add_item(subtree, hf_isis_lsp_ipv6_reachability_distribution, tvb, offset+4, 1, ENC_NA);
2023         proto_tree_add_item(subtree, hf_isis_lsp_ipv6_reachability_distribution_internal, tvb, offset+4, 1, ENC_NA);
2024         proto_tree_add_item(subtree, hf_isis_lsp_ipv6_reachability_subtlv, tvb, offset+4, 1, ENC_NA);
2025 
2026         if ((ctrl_info & 0x1f) != 0) {
2027             proto_tree_add_item(subtree, hf_isis_lsp_ipv6_reachability_reserved_bits, tvb, offset+4, 1, ENC_BIG_ENDIAN);
2028         }
2029         proto_tree_add_item(subtree, hf_isis_lsp_ipv6_reachability_prefix_length, tvb, offset+5, 1, ENC_NA);
2030         proto_tree_add_ipv6_format_value(subtree, hf_isis_lsp_ipv6_reachability_ipv6_prefix, tvb, offset+6, byte_length,
2031                             &prefix, "%s", prefix_str);
2032 
2033         len = 6 + byte_length;
2034         if ((ctrl_info & 0x20) != 0) {
2035             subclvs_len = tvb_get_guint8(tvb, offset+len);
2036             proto_tree_add_item(subtree, hf_isis_lsp_ipv6_reachability_subclvs_len, tvb, offset+len, 1, ENC_BIG_ENDIAN);
2037 
2038             i =0;
2039             while (i < subclvs_len) {
2040                 clv_offset = offset + len + 1 + i; /* skip the total subtlv len indicator */
2041                 clv_code = tvb_get_guint8(tvb, clv_offset);
2042                 clv_len  = tvb_get_guint8(tvb, clv_offset+ 1);
2043                 subtree2 = proto_tree_add_subtree_format(subtree, tvb, clv_offset, clv_len + 2,
2044                                                          ett_isis_lsp_clv_ip_reach_subclv,
2045                                                          &ti_subclvs, "subTLV");
2046                 proto_tree_add_item(subtree2, hf_isis_lsp_ext_ip_reachability_code,
2047                                     tvb, clv_offset, 1, ENC_BIG_ENDIAN);
2048                 proto_tree_add_item(subtree2, hf_isis_lsp_ext_ip_reachability_len,
2049                                     tvb, clv_offset+1, 1, ENC_BIG_ENDIAN);
2050                 proto_item_append_text(ti_subclvs, ": %s (c=%u, l=%u)",
2051                                        val_to_str(clv_code, isis_lsp_ext_ip_reachability_code_vals, "Unknown"), clv_code, clv_len);
2052 
2053                 dissect_ipreach_subclv(tvb, pinfo, subtree2, ti_subclvs, clv_offset+2, clv_code, clv_len);
2054                 i += clv_len + 2;
2055             }
2056             len += 1 + subclvs_len;
2057         } else {
2058             proto_tree_add_uint_format(subtree, hf_isis_lsp_ext_ip_reachability_subclvs_len, tvb, offset, len, 0, "no sub-TLVs present");
2059         }
2060         offset += len;
2061         length -= len;
2062     }
2063 }
2064 
2065 /*
2066  * Name: dissect_lsp_nlpid_clv()
2067  *
2068  * Description:
2069  *    Decode for a lsp packets NLPID clv.  Calls into the
2070  *    clv common one.
2071  *
2072  * Input:
2073  *    tvbuff_t * : tvbuffer for packet data
2074  *    proto_tree * : proto tree to build on (may be null)
2075  *    int : current offset into packet data
2076  *    int : length of IDs in packet.
2077  *    int : length of this clv
2078  *
2079  * Output:
2080  *    void, will modify proto_tree if not null.
2081  */
2082 static void
dissect_lsp_nlpid_clv(tvbuff_t * tvb,packet_info * pinfo _U_,proto_tree * tree,int offset,isis_data_t * isis _U_,int length)2083 dissect_lsp_nlpid_clv(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *tree, int offset,
2084     isis_data_t *isis _U_, int length)
2085 {
2086     isis_dissect_nlpid_clv(tvb, tree, ett_isis_lsp_clv_nlpid_nlpid, hf_isis_lsp_clv_nlpid_nlpid, offset, length);
2087 }
2088 
2089 /*
2090  * Name: dissect_lsp_mt_clv()
2091  *
2092  * Description: - code 229
2093  *    Decode for a lsp packets Multi Topology clv.  Calls into the
2094  *    clv common one.
2095  *
2096  * Input:
2097  *      tvbuff_t * : tvbuffer for packet data
2098  *      proto_tree * : proto tree to build on (may be null)
2099  *    int : current offset into packet data
2100  *    guint : length of this clv
2101  *    int : length of IDs in packet.
2102  *
2103  * Output:
2104  *    void, will modify proto_tree if not null.
2105  */
2106 static void
dissect_lsp_mt_clv(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,int offset,isis_data_t * isis _U_,int length)2107 dissect_lsp_mt_clv(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, int offset,
2108     isis_data_t *isis _U_, int length)
2109 {
2110     isis_dissect_mt_clv(tvb, pinfo, tree, offset, length, hf_isis_lsp_clv_mt, &ei_isis_lsp_clv_mt );
2111 }
2112 
2113 /*
2114  * Name: dissect_lsp_hostname_clv()
2115  *
2116  * Description:
2117  *      Decode for a lsp packets hostname clv.  Calls into the
2118  *      clv common one.
2119  *
2120  * Input:
2121  *      tvbuff_t * : tvbuffer for packet data
2122  *      proto_tree * : proto tree to build on (may be null)
2123  *      int : current offset into packet data
2124  *      int : length of IDs in packet.
2125  *      int : length of this clv
2126  *
2127  * Output:
2128  *      void, will modify proto_tree if not null.
2129  */
2130 static void
dissect_lsp_hostname_clv(tvbuff_t * tvb,packet_info * pinfo _U_,proto_tree * tree,int offset,isis_data_t * isis _U_,int length)2131 dissect_lsp_hostname_clv(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *tree, int offset,
2132     isis_data_t *isis _U_, int length)
2133 {
2134     isis_dissect_hostname_clv(tvb, tree, offset, length,
2135         hf_isis_lsp_hostname);
2136 }
2137 
2138 /*
2139  * Name: dissect_lsp_srlg_clv()
2140  *
2141  * Description:
2142  *      Decode for a lsp packets Shared Risk Link Group (SRLG) clv (138).  Calls into the
2143  *      clv common one.
2144  *
2145  * Input:
2146  *      tvbuff_t * : tvbuffer for packet data
2147  *      proto_tree * : proto tree to build on (may be null)
2148  *      int : current offset into packet data
2149  *      int : length of IDs in packet.
2150  *      int : length of this clv
2151  *
2152  * Output:
2153  *      void, will modify proto_tree if not null.
2154  */
2155 static void
dissect_lsp_srlg_clv(tvbuff_t * tvb,packet_info * pinfo _U_,proto_tree * tree,int offset,isis_data_t * isis _U_,int length)2156 dissect_lsp_srlg_clv(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *tree, int offset,
2157     isis_data_t *isis _U_, int length)
2158 {
2159 
2160     proto_tree_add_item(tree, hf_isis_lsp_srlg_system_id, tvb, offset, 6, ENC_BIG_ENDIAN);
2161     offset += 6;
2162 
2163     proto_tree_add_item(tree, hf_isis_lsp_srlg_pseudo_num, tvb, offset, 1, ENC_BIG_ENDIAN);
2164     offset += 1;
2165 
2166     proto_tree_add_item(tree, hf_isis_lsp_srlg_flags_numbered, tvb, offset, 1, ENC_BIG_ENDIAN);
2167     offset += 1;
2168 
2169     proto_tree_add_item(tree, hf_isis_lsp_srlg_ipv4_local, tvb, offset, 4, ENC_BIG_ENDIAN);
2170     offset += 4;
2171 
2172     proto_tree_add_item(tree, hf_isis_lsp_srlg_ipv4_remote, tvb, offset, 4, ENC_BIG_ENDIAN);
2173     offset += 4;
2174 
2175     length -= 16;
2176     while(length){
2177         proto_tree_add_item(tree, hf_isis_lsp_srlg_value, tvb, offset, 4, ENC_BIG_ENDIAN);
2178         offset += 4;
2179         length -= 4;
2180     }
2181 }
2182 
2183 
2184 /*
2185  * Name: dissect_lsp_te_router_id_clv()
2186  *
2187  * Description:
2188  *      Decode for a lsp packets Traffic Engineering ID clv.  Calls into the
2189  *      clv common one.
2190  *
2191  * Input:
2192  *      tvbuff_t * : tvbuffer for packet data
2193  *      proto_tree * : proto tree to build on (may be null)
2194  *      int : current offset into packet data
2195  *      int : length of IDs in packet.
2196  *      int : length of this clv
2197  *
2198  * Output:
2199  *      void, will modify proto_tree if not null.
2200  */
2201 static void
dissect_lsp_te_router_id_clv(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,int offset,isis_data_t * isis _U_,int length)2202 dissect_lsp_te_router_id_clv(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, int offset,
2203     isis_data_t *isis _U_, int length)
2204 {
2205     isis_dissect_te_router_id_clv(tree, pinfo, tvb, &ei_isis_lsp_short_clv, offset, length,
2206         hf_isis_lsp_clv_te_router_id );
2207 }
2208 
2209 
2210 /*
2211  * Name: dissect_lsp_ip_int_addr_clv()
2212  *
2213  * Description:
2214  *    Decode for a lsp packets ip interface addr clv.  Calls into the
2215  *    clv common one.
2216  *
2217  * Input:
2218  *    tvbuff_t * : tvbuffer for packet data
2219  *    proto_tree * : proto tree to build on (may be null)
2220  *    int : current offset into packet data
2221  *    int : length of IDs in packet.
2222  *    int : length of this clv
2223  *
2224  * Output:
2225  *    void, will modify proto_tree if not null.
2226  */
2227 static void
dissect_lsp_ip_int_addr_clv(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,int offset,isis_data_t * isis _U_,int length)2228 dissect_lsp_ip_int_addr_clv(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, int offset,
2229     isis_data_t *isis _U_, int length)
2230 {
2231     isis_dissect_ip_int_clv(tree, pinfo, tvb, &ei_isis_lsp_short_clv, offset, length,
2232         hf_isis_lsp_clv_ipv4_int_addr );
2233 }
2234 
2235 /*
2236  * Name: dissect_lsp_ipv6_int_addr_clv()
2237  *
2238  * Description: Decode an IPv6 interface addr CLV - code 232.
2239  *
2240  *   Calls into the clv common one.
2241  *
2242  * Input:
2243  *   tvbuff_t * : tvbuffer for packet data
2244  *   proto_tree * : proto tree to build on (may be null)
2245  *   int : current offset into packet data
2246  *   int : length of IDs in packet.
2247  *   int : length of this clv
2248  *
2249  * Output:
2250  *   void, will modify proto_tree if not null.
2251  */
2252 static void
dissect_lsp_ipv6_int_addr_clv(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,int offset,isis_data_t * isis _U_,int length)2253 dissect_lsp_ipv6_int_addr_clv(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, int offset,
2254     isis_data_t *isis _U_, int length)
2255 {
2256     isis_dissect_ipv6_int_clv(tree, pinfo, tvb, &ei_isis_lsp_short_clv, offset, length,
2257         hf_isis_lsp_clv_ipv6_int_addr );
2258 }
2259 
2260 static void
dissect_isis_lsp_clv_mt_cap_spb_instance(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,int offset,int subtype,int sublen)2261 dissect_isis_lsp_clv_mt_cap_spb_instance(tvbuff_t *tvb, packet_info *pinfo,
2262         proto_tree *tree, int offset, int subtype, int sublen)
2263 {
2264     const int CIST_ROOT_ID_LEN            = 8; /* CIST Root Identifier */
2265     const int CIST_EXT_ROOT_PATH_COST_LEN = 4; /* CIST External Root Path Cost */
2266     const int BRIDGE_PRI_LEN              = 2; /* Bridge Priority */
2267     const int V_SPSOURCEID_LEN            = 4; /* v | SPSourceID */
2268     const int NUM_TREES_LEN               = 1; /* num of trees */
2269 
2270     const int CIST_ROOT_ID_OFFSET = 0;
2271     const int CIST_EXT_ROOT_PATH_COST_OFFSET = CIST_ROOT_ID_OFFSET            + CIST_ROOT_ID_LEN;
2272     const int BRIDGE_PRI_OFFSET              = CIST_EXT_ROOT_PATH_COST_OFFSET + CIST_EXT_ROOT_PATH_COST_LEN;
2273     const int V_SPSOURCEID_OFFSET            = BRIDGE_PRI_OFFSET              + BRIDGE_PRI_LEN;
2274     const int NUM_TREES_OFFSET               = V_SPSOURCEID_OFFSET            + V_SPSOURCEID_LEN;
2275     const int FIXED_LEN                      = NUM_TREES_OFFSET               + NUM_TREES_LEN;
2276     const int VLAN_ID_TUPLE_LEN = 8;
2277 
2278     static int * const lsp_cap_spb_instance_vlanid_tuple[] = {
2279         &hf_isis_lsp_mt_cap_spb_instance_vlanid_tuple_u,
2280         &hf_isis_lsp_mt_cap_spb_instance_vlanid_tuple_m,
2281         &hf_isis_lsp_mt_cap_spb_instance_vlanid_tuple_a,
2282         &hf_isis_lsp_mt_cap_spb_instance_vlanid_tuple_reserved,
2283         NULL
2284     };
2285 
2286     if (sublen < FIXED_LEN) {
2287         proto_tree_add_expert_format(tree, pinfo, &ei_isis_lsp_short_clv, tvb, offset, -1,
2288                               "Short SPB Digest subTLV (%d vs %d)", sublen, FIXED_LEN);
2289         return;
2290     }
2291     else {
2292         proto_tree *subtree, *ti;
2293         int subofs = offset;
2294         guint8        num_trees            = tvb_get_guint8(tvb, subofs + NUM_TREES_OFFSET);
2295 
2296         /*************************/
2297         subtree = proto_tree_add_subtree_format( tree, tvb, offset-2, sublen+2, ett_isis_lsp_clv_mt_cap_spb_instance, NULL,
2298                                   "SPB Instance: Type: 0x%02x, Length: %d", subtype, sublen);
2299 
2300         /*************************/
2301         proto_tree_add_item(subtree, hf_isis_lsp_mt_cap_spb_instance_cist_root_identifier, tvb, subofs + CIST_ROOT_ID_OFFSET, CIST_ROOT_ID_LEN, ENC_NA);
2302         proto_tree_add_item(subtree, hf_isis_lsp_mt_cap_spb_instance_cist_external_root_path_cost, tvb, subofs + CIST_EXT_ROOT_PATH_COST_OFFSET, CIST_EXT_ROOT_PATH_COST_LEN, ENC_BIG_ENDIAN);
2303         proto_tree_add_item(subtree, hf_isis_lsp_mt_cap_spb_instance_bridge_priority, tvb, subofs + BRIDGE_PRI_OFFSET, BRIDGE_PRI_LEN, ENC_BIG_ENDIAN);
2304 
2305         proto_tree_add_item(subtree, hf_isis_lsp_mt_cap_spb_instance_v, tvb, subofs + V_SPSOURCEID_OFFSET, V_SPSOURCEID_LEN, ENC_BIG_ENDIAN);
2306 
2307         proto_tree_add_item(subtree, hf_isis_lsp_mt_cap_spsourceid, tvb, subofs + V_SPSOURCEID_OFFSET, V_SPSOURCEID_LEN, ENC_BIG_ENDIAN);
2308         ti = proto_tree_add_item(subtree, hf_isis_lsp_mt_cap_spb_instance_number_of_trees, tvb, subofs + NUM_TREES_OFFSET, NUM_TREES_LEN, ENC_BIG_ENDIAN);
2309         if (num_trees == 0)
2310             proto_item_append_text(ti, " Invalid subTLV: zero trees");
2311 
2312         subofs += FIXED_LEN;
2313         sublen -= FIXED_LEN;
2314 
2315         /*************************/
2316         if (sublen != (num_trees * VLAN_ID_TUPLE_LEN)) {
2317             proto_tree_add_expert_format( subtree, pinfo, &ei_isis_lsp_short_clv, tvb, subofs, 0, "SubTLV length doesn't match number of trees");
2318             return;
2319         }
2320         while (sublen > 0 && num_trees > 0) {
2321             if (sublen < VLAN_ID_TUPLE_LEN) {
2322                 proto_tree_add_expert_format(subtree, pinfo, &ei_isis_lsp_short_clv, tvb, offset, -1,
2323                                       "Short VLAN_ID entry (%d vs %d)", sublen, VLAN_ID_TUPLE_LEN);
2324                 return;
2325             }
2326             else {
2327                 proto_tree_add_bitmask_list(subtree, tvb, subofs, 1, lsp_cap_spb_instance_vlanid_tuple, ENC_BIG_ENDIAN);
2328                 subofs += 1;
2329 
2330                 proto_tree_add_item(subtree, hf_isis_lsp_mt_cap_spb_instance_vlanid_tuple_ect, tvb, subofs, 4, ENC_BIG_ENDIAN);
2331                 subofs += 4;
2332                 proto_tree_add_item(subtree, hf_isis_lsp_mt_cap_spb_instance_vlanid_tuple_base_vid, tvb, subofs, 3, ENC_BIG_ENDIAN);
2333                 proto_tree_add_item(subtree, hf_isis_lsp_mt_cap_spb_instance_vlanid_tuple_spvid, tvb, subofs, 3, ENC_BIG_ENDIAN);
2334                 subofs += 3;
2335 
2336                 sublen -= VLAN_ID_TUPLE_LEN;
2337                 --num_trees;
2338             }
2339         }
2340         if (num_trees) {
2341             proto_tree_add_expert_format(subtree, pinfo, &ei_isis_lsp_short_clv, tvb, offset, -1,
2342                                   "Short subTLV (%d vs %d)", sublen, num_trees * VLAN_ID_TUPLE_LEN);
2343             return;
2344         }
2345     }
2346 }
2347 static void
dissect_isis_lsp_clv_mt_cap_spb_oalg(tvbuff_t * tvb,proto_tree * tree,int offset,int subtype _U_,int sublen _U_)2348 dissect_isis_lsp_clv_mt_cap_spb_oalg(tvbuff_t   *tvb,
2349     proto_tree *tree, int offset, int subtype _U_, int sublen _U_)
2350 {
2351 
2352     proto_tree_add_item(tree, hf_isis_lsp_mt_cap_spb_opaque_algorithm, tvb, offset, 4, ENC_BIG_ENDIAN);
2353     offset += 4;
2354     proto_tree_add_item(tree, hf_isis_lsp_mt_cap_spb_opaque_information, tvb, offset, -1, ENC_NA);
2355 
2356 }
2357 static void
dissect_isis_lsp_clv_mt_cap_spbm_service_identifier(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,int offset,int subtype,int sublen)2358 dissect_isis_lsp_clv_mt_cap_spbm_service_identifier(tvbuff_t *tvb, packet_info *pinfo,
2359     proto_tree *tree, int offset, int subtype, int sublen)
2360 {
2361     const int BMAC_LEN = 6; /* B-MAC Address */
2362     const int BVID_LEN = 2; /* Base-VID */
2363 
2364     const int BMAC_OFFSET = 0;
2365     const int BVID_OFFSET = BMAC_OFFSET + BMAC_LEN;
2366     const int FIXED_LEN   = BVID_OFFSET + BVID_LEN;
2367 
2368     const int ISID_LEN = 4;
2369 
2370     static int * const lsp_cap_spbm_service_identifier[] = {
2371         &hf_isis_lsp_mt_cap_spbm_service_identifier_t,
2372         &hf_isis_lsp_mt_cap_spbm_service_identifier_r,
2373         &hf_isis_lsp_mt_cap_spbm_service_identifier_reserved,
2374         NULL
2375     };
2376 
2377     if (sublen < FIXED_LEN) {
2378         proto_tree_add_expert_format(tree, pinfo, &ei_isis_lsp_short_clv, tvb, offset, -1,
2379                               "Short SPBM Service Identifier and Unicast Address subTLV (%d vs %d)", sublen, FIXED_LEN);
2380         return;
2381     }
2382     else {
2383         proto_tree *subtree;
2384         int subofs = offset;
2385 
2386         /*************************/
2387         subtree = proto_tree_add_subtree_format( tree, tvb, offset-2, sublen+2, ett_isis_lsp_clv_mt_cap_spbm_service_identifier, NULL,
2388                                   "SPB Service ID and Unicast Address: Type: 0x%02x, Length: %d", subtype, sublen);
2389 
2390         /*************************/
2391         proto_tree_add_item(subtree, hf_isis_lsp_mt_cap_spbm_service_identifier_b_mac, tvb, subofs + BMAC_OFFSET, BMAC_LEN, ENC_NA);
2392         proto_tree_add_item(subtree, hf_isis_lsp_mt_cap_spbm_service_identifier_base_vid, tvb, subofs + BVID_OFFSET, BVID_LEN, ENC_BIG_ENDIAN);
2393 
2394         subofs += FIXED_LEN;
2395         sublen -= FIXED_LEN;
2396 
2397         /*************************/
2398         while (sublen > 0) {
2399             if (sublen < ISID_LEN) {
2400                 proto_tree_add_expert_format(subtree, pinfo, &ei_isis_lsp_short_clv, tvb, offset, -1,
2401                                       "Short ISID entry (%d vs %d)", sublen, 4);
2402                 return;
2403             }
2404             else {
2405                 proto_tree_add_bitmask_list(subtree, tvb, subofs, 1, lsp_cap_spbm_service_identifier, ENC_BIG_ENDIAN);
2406                 subofs += 1;
2407                 sublen -= 1;
2408 
2409                 proto_tree_add_item(subtree, hf_isis_lsp_mt_cap_spbm_service_identifier_i_sid, tvb, subofs, 3, ENC_BIG_ENDIAN);
2410                 subofs += 3;
2411                 sublen -= 3;
2412             }
2413         }
2414     }
2415 }
2416 static void
dissect_isis_lsp_clv_mt_cap_spbv_mac_address(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,int offset,int subtype,int sublen)2417 dissect_isis_lsp_clv_mt_cap_spbv_mac_address(tvbuff_t *tvb, packet_info *pinfo,
2418     proto_tree *tree, int offset, int subtype, int sublen)
2419 {
2420 
2421     static int * const lsp_spb_short_mac_address[] = {
2422         &hf_isis_lsp_spb_short_mac_address_t,
2423         &hf_isis_lsp_spb_short_mac_address_r,
2424         &hf_isis_lsp_spb_short_mac_address_reserved,
2425         NULL
2426     };
2427 
2428 
2429     if (sublen < 2) {
2430         proto_tree_add_expert_format(tree, pinfo, &ei_isis_lsp_short_clv, tvb, offset, -1,
2431                               "Short SPBV Mac Address subTLV (%d vs %d)", sublen, 2);
2432         return;
2433     }
2434     else {
2435         proto_tree *subtree;
2436         int subofs = offset;
2437 
2438         /*************************/
2439         subtree = proto_tree_add_subtree_format( tree, tvb, offset-2, sublen+2, ett_isis_lsp_clv_mt_cap_spbv_mac_address, NULL,
2440                                   "SPBV Mac Address: Type: 0x%02x, Length: %d", subtype, sublen);
2441 
2442         /*************************/
2443         proto_tree_add_item(subtree, hf_isis_lsp_spb_reserved, tvb, subofs, 2, ENC_BIG_ENDIAN);
2444         proto_tree_add_item(subtree, hf_isis_lsp_spb_sr_bit, tvb, subofs, 2, ENC_BIG_ENDIAN);
2445         proto_tree_add_item(subtree, hf_isis_lsp_spb_spvid, tvb, subofs, 2, ENC_BIG_ENDIAN);
2446 
2447         subofs += 2;
2448         sublen -= 2;
2449 
2450         /*************************/
2451         while (sublen > 0) {
2452             if (sublen < 7) {
2453                 proto_tree_add_expert_format(subtree, pinfo, &ei_isis_lsp_short_clv, tvb, offset, -1,
2454                                       "Short MAC Address entry (%d vs %d)", sublen, 7);
2455                 return;
2456             }
2457             else {
2458                 proto_tree_add_bitmask_list(subtree, tvb, subofs, 1, lsp_spb_short_mac_address, ENC_BIG_ENDIAN);
2459                 subofs += 1;
2460                 sublen -= 1;
2461 
2462                 proto_tree_add_item(subtree, hf_isis_lsp_spb_short_mac_address, tvb, subofs, 6, ENC_NA);
2463 
2464                 subofs += 6;
2465                 sublen -= 6;
2466             }
2467         }
2468     }
2469 }
2470 
2471 
2472 
2473 
2474 /*
2475  * Name: dissect_lsp_clv_mt_cap()
2476  *
2477  * Description: Decode an ISIS MT-CAP CLV - code 144.
2478  *
2479  * Input:
2480  *   tvbuff_t * : tvbuffer for packet data
2481  *   proto_tree * : proto tree to build on (may be null)
2482  *   int : current offset into packet data
2483  *   int : length of IDs in packet.
2484  *   int : length of this clv
2485  *
2486  * Output:
2487  *   void, will modify proto_tree if not null.
2488  */
2489 static void
dissect_isis_lsp_clv_mt_cap(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,int offset,isis_data_t * isis _U_,int length)2490 dissect_isis_lsp_clv_mt_cap(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, int offset,
2491                             isis_data_t *isis _U_, int length)
2492 {
2493     if (length >= 2) {
2494         /* mtid */
2495         proto_tree_add_item( tree, hf_isis_lsp_mt_cap_mtid, tvb, offset, 2, ENC_BIG_ENDIAN);
2496         proto_tree_add_item(tree, hf_isis_lsp_mt_cap_overload, tvb, offset, 2, ENC_BIG_ENDIAN);
2497         length -= 2;
2498         offset += 2;
2499         while (length >= 2) {
2500             guint8 subtype   = tvb_get_guint8(tvb, offset);
2501             guint8 subtlvlen = tvb_get_guint8(tvb, offset+1);
2502             length -= 2;
2503             offset += 2;
2504             if (subtlvlen > length) {
2505                 proto_tree_add_expert_format(tree, pinfo, &ei_isis_lsp_short_clv, tvb, offset-2, -1,
2506                                       "Short type %d TLV (%d vs %d)", subtype, subtlvlen, length);
2507                 return;
2508             }
2509             if (subtype == 0x01) { /* SPB Instance */
2510                 dissect_isis_lsp_clv_mt_cap_spb_instance(tvb, pinfo, tree, offset, subtype, subtlvlen);
2511             }
2512             else if (subtype == 0x02) { /* OALG */
2513                 dissect_isis_lsp_clv_mt_cap_spb_oalg(tvb, tree, offset, subtype, subtlvlen);
2514             }
2515             else if (subtype == 0x03) { /* SPBM Service Identifier */
2516                 dissect_isis_lsp_clv_mt_cap_spbm_service_identifier(tvb, pinfo, tree, offset, subtype, subtlvlen);
2517             }
2518             else if (subtype == 0x04) { /* SPBV Mac Address */
2519                 dissect_isis_lsp_clv_mt_cap_spbv_mac_address(tvb, pinfo, tree, offset, subtype, subtlvlen);
2520             }
2521             else if (dissect_isis_trill_clv(tvb, pinfo, tree, offset, subtype, subtlvlen)==-1) {
2522                 proto_tree_add_expert_format( tree, pinfo, &ei_isis_lsp_subtlv, tvb, offset-2, subtlvlen+2,
2523                                       "Unknown SubTlv: Type: %d, Length: %d", subtype, subtlvlen);
2524             }
2525             length -= subtlvlen;
2526             offset += subtlvlen;
2527         }
2528 
2529     }
2530 }
2531 
2532 
2533 /*
2534  * Name: dissect_isis_lsp_clv_sid_label_binding()
2535  *
2536  * Description: Decode an ISIS SID/LABEL binding - code 149.
2537  *
2538  * Input:
2539  *   tvbuff_t * : tvbuffer for packet data
2540  *   proto_tree * : proto tree to build on (may be null)
2541  *   int : current offset into packet data
2542  *   int : length of IDs in packet.
2543  *   int : length of this clv
2544  *
2545  * Output:
2546  *   void, will modify proto_tree if not null.
2547  */
2548 static void
dissect_isis_lsp_clv_sid_label_binding(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,int offset,isis_data_t * isis _U_,int length)2549 dissect_isis_lsp_clv_sid_label_binding(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, int offset,
2550                                        isis_data_t *isis _U_, int length)
2551 {
2552     proto_item *ti_subclvs = NULL;
2553     proto_tree *subtree = NULL;
2554     int tlv_offset = 0;
2555     int sub_tlv_len = 0;
2556     int i = 0;
2557     guint8 clv_pref_l = 0;
2558     guint   clv_code;
2559     guint   clv_len;
2560 
2561     static int * const lsp_sl_flags[] = {
2562         &hf_isis_lsp_sl_binding_flags_f,
2563         &hf_isis_lsp_sl_binding_flags_m,
2564         &hf_isis_lsp_sl_binding_flags_s,
2565         &hf_isis_lsp_sl_binding_flags_d,
2566         &hf_isis_lsp_sl_binding_flags_a,
2567         &hf_isis_lsp_sl_binding_flags_rsv,
2568         NULL
2569     };
2570 
2571     static int * const lsp_sl_sub_tlv_flags[] = {
2572         &hf_isis_lsp_sl_sub_tlv_flags_r,
2573         &hf_isis_lsp_sl_sub_tlv_flags_n,
2574         &hf_isis_lsp_sl_sub_tlv_flags_p,
2575         &hf_isis_lsp_sl_sub_tlv_flags_e,
2576         &hf_isis_lsp_sl_sub_tlv_flags_v,
2577         &hf_isis_lsp_sl_sub_tlv_flags_l,
2578         &hf_isis_lsp_sl_sub_tlv_flags_rsv,
2579         NULL
2580     };
2581 
2582     if ( length <= 0 ) {
2583         return;
2584     }
2585 
2586 
2587     tlv_offset  = offset;
2588 
2589     proto_tree_add_bitmask(tree, tvb, tlv_offset,
2590                            hf_isis_lsp_sl_binding_flags, ett_isis_lsp_sl_flags, lsp_sl_flags, ENC_NA);
2591     tlv_offset++;
2592     proto_tree_add_item(tree, hf_isis_lsp_sl_binding_weight, tvb, tlv_offset, 1, ENC_BIG_ENDIAN);
2593     tlv_offset++;
2594     proto_tree_add_item(tree, hf_isis_lsp_sl_binding_range, tvb, tlv_offset, 2, ENC_BIG_ENDIAN);
2595     tlv_offset = tlv_offset+2;
2596     proto_tree_add_item(tree, hf_isis_lsp_sl_binding_prefix_length, tvb, tlv_offset, 1, ENC_BIG_ENDIAN);
2597     clv_pref_l = tvb_get_guint8(tvb, tlv_offset);
2598     tlv_offset++;
2599     if (clv_pref_l == 32) {
2600         proto_tree_add_item(tree, hf_isis_lsp_sl_binding_fec_prefix_ipv4, tvb, tlv_offset, clv_pref_l/8, ENC_NA);
2601     }
2602     else if (clv_pref_l == 128) {
2603         proto_tree_add_item(tree, hf_isis_lsp_sl_binding_fec_prefix_ipv6, tvb, tlv_offset, clv_pref_l/8, ENC_NA);
2604     }
2605     else {
2606       proto_tree_add_expert_format(tree, pinfo, &ei_isis_lsp_malformed_subtlv, tvb, tlv_offset, -1,
2607                                       "Prefix address format unknown length : %d",clv_pref_l);
2608     }
2609     tlv_offset = tlv_offset+(clv_pref_l/8);
2610     sub_tlv_len = length - (5+clv_pref_l/8);
2611     while (i < sub_tlv_len) {
2612         clv_code = tvb_get_guint8(tvb, i+tlv_offset);
2613         clv_len  = tvb_get_guint8(tvb, i+1+tlv_offset);
2614         ti_subclvs = proto_tree_add_item(tree, hf_isis_lsp_sl_sub_tlv, tvb, tlv_offset, clv_len+2, ENC_NA);
2615         proto_item_append_text(ti_subclvs, " %s",
2616                                val_to_str(clv_code, isis_lsp_sl_sub_tlv_vals, "Unknown capability sub-tlv type"));
2617         subtree = proto_item_add_subtree(ti_subclvs, ett_isis_lsp_sl_sub_tlv);
2618         proto_tree_add_item(subtree, hf_isis_lsp_sl_sub_tlv_type, tvb, i+tlv_offset, 1, ENC_BIG_ENDIAN);
2619         proto_tree_add_item(subtree, hf_isis_lsp_sl_sub_tlv_length, tvb, i+1+tlv_offset, 1, ENC_BIG_ENDIAN);
2620         switch (clv_code) {
2621             case ISIS_LSP_SL_SUB_SID_LABEL:
2622                 switch (clv_len) {
2623                     case 3 :
2624                         proto_tree_add_item(subtree, hf_isis_lsp_sl_sub_tlv_label_20,
2625                                             tvb, i+2+tlv_offset, clv_len, ENC_BIG_ENDIAN);
2626                         break;
2627                     case 4 :
2628                         proto_tree_add_item(subtree, hf_isis_lsp_sl_sub_tlv_label_32,
2629                                             tvb, i+2+tlv_offset, clv_len, ENC_BIG_ENDIAN);
2630                         break;
2631                     default :
2632                         proto_tree_add_expert_format(tree, pinfo, &ei_isis_lsp_malformed_subtlv, tvb, i+2+tlv_offset, -1,
2633                                                 "Label badly formatted");
2634                     break;
2635                 }
2636                 break;
2637             case ISIS_LSP_SL_SUB_PREFIX_SID: {
2638                 proto_tree_add_bitmask(subtree, tvb, i+2+tlv_offset, hf_isis_lsp_sl_sub_tlv_flags,
2639                                        ett_isis_lsp_sl_sub_tlv_flags, lsp_sl_sub_tlv_flags, ENC_NA);
2640                 proto_tree_add_item(subtree, hf_isis_lsp_sl_sub_tlv_algorithm,
2641                                     tvb, i+2+tlv_offset+1, 1, ENC_BIG_ENDIAN);
2642                 switch (clv_len-2) {
2643                     case 3 :
2644                         proto_tree_add_item(subtree, hf_isis_lsp_sl_sub_tlv_label_20,
2645                                             tvb, i+2+tlv_offset+2, clv_len-2, ENC_BIG_ENDIAN);
2646                         break;
2647                     case 4 :
2648                         proto_tree_add_item(subtree, hf_isis_lsp_sl_sub_tlv_label_32,
2649                                             tvb, i+2+tlv_offset+2, clv_len-2, ENC_BIG_ENDIAN);
2650                         break;
2651                     default :
2652                         proto_tree_add_expert_format(tree, pinfo, &ei_isis_lsp_malformed_subtlv, tvb, i+2+tlv_offset+2, -1,
2653                                                 "Label badly formatted");
2654                         break;
2655                     }
2656                 }
2657                 break;
2658             default:
2659                 proto_tree_add_expert_format(tree, pinfo, &ei_isis_lsp_malformed_subtlv, tvb, i+2+tlv_offset, -1,
2660                                             "Sub TLV badly formatted, type unknown %d", clv_code);
2661                 break;
2662         }
2663         i += clv_len + 2;
2664     }
2665 }
2666 
2667 /*
2668  * Name: dissect_lsp_authentication_clv()
2669  *
2670  * Description:
2671  *    Decode for a lsp packets authentication clv.  Calls into the
2672  *    clv common one.
2673  *
2674  * Input:
2675  *    tvbuff_t * : tvbuffer for packet data
2676  *    proto_tree * : proto tree to build on (may be null)
2677  *    int : current offset into packet data
2678  *    int : length of IDs in packet.
2679  *    int : length of this clv
2680  *
2681  * Output:
2682  *    void, will modify proto_tree if not null.
2683  */
2684 static void
dissect_lsp_authentication_clv(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,int offset,isis_data_t * isis _U_,int length)2685 dissect_lsp_authentication_clv(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, int offset,
2686     isis_data_t *isis _U_, int length)
2687 {
2688     isis_dissect_authentication_clv(tree, pinfo, tvb, hf_isis_lsp_authentication, hf_isis_clv_key_id, &ei_isis_lsp_authentication, offset, length);
2689 }
2690 
2691 /*
2692  * Name: dissect_lsp_ip_authentication_clv()
2693  *
2694  * Description:
2695  *    Decode for a lsp packets authentication clv.  Calls into the
2696  *    clv common one.
2697  *
2698  * Input:
2699  *    tvbuff_t * : tvbuffer for packet data
2700  *    proto_tree * : proto tree to build on (may be null)
2701  *    int : current offset into packet data
2702  *    int : length of IDs in packet.
2703  *    int : length of this clv
2704  *
2705  * Output:
2706  *    void, will modify proto_tree if not null.
2707  */
2708 static void
dissect_lsp_ip_authentication_clv(tvbuff_t * tvb,packet_info * pinfo _U_,proto_tree * tree,int offset,isis_data_t * isis _U_,int length)2709 dissect_lsp_ip_authentication_clv(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *tree, int offset,
2710     isis_data_t *isis _U_, int length)
2711 {
2712     if ( length != 0 ) {
2713        proto_tree_add_item(tree, hf_isis_lsp_ip_authentication, tvb, offset, length, ENC_ASCII|ENC_NA);
2714     }
2715 }
2716 
2717 /*
2718  * Name: dissect_lsp_area_address_clv()
2719  *
2720  * Description:
2721  *    Decode for a lsp packet's area address clv.  Call into clv common
2722  *    one.
2723  *
2724  * Input:
2725  *    tvbuff_t * : tvbuffer for packet data
2726  *    proto_tree * : protocol display tree to fill out.  May be NULL
2727  *    int : offset into packet data where we are.
2728  *    int : length of IDs in packet.
2729  *    int : length of clv we are decoding
2730  *
2731  * Output:
2732  *      void, but we will add to proto tree if !NULL.
2733  */
2734 static void
dissect_lsp_area_address_clv(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,int offset,isis_data_t * isis _U_,int length)2735 dissect_lsp_area_address_clv(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, int offset,
2736     isis_data_t *isis _U_, int length)
2737 {
2738     isis_dissect_area_address_clv(tree, pinfo, tvb, &ei_isis_lsp_short_clv, hf_isis_lsp_area_address, offset, length);
2739 }
2740 
2741 /*
2742  * Name: dissect_lsp_eis_neighbors_clv_inner()
2743  *
2744  * Description:
2745  *    Real work horse for showing neighbors.  This means we decode the
2746  *    first octet as either virtual/!virtual (if show_virtual param is
2747  *    set), or as a must == 0 reserved value.
2748  *
2749  *    Once past that, we decode n neighbor elements.  Each neighbor
2750  *    is comprised of a metric block (is dissect_metric) and the
2751  *    addresses.
2752  *
2753  * Input:
2754  *    tvbuff_t * : tvbuffer for packet data
2755  *    proto_tree * : protocol display tree to fill out.  May be NULL
2756  *    int : offset into packet data where we are.
2757  *    int : length of IDs in packet.
2758  *    int : length of clv we are decoding
2759  *    int : set to decode first octet as virtual vs reserved == 0
2760  *    int : set to indicate EIS instead of IS (6 octet per addr instead of 7)
2761  *
2762  * Output:
2763  *      void, but we will add to proto tree if !NULL.
2764  */
2765 static void
dissect_lsp_eis_neighbors_clv_inner(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,int offset,int length,guint id_length,int show_virtual,int is_eis)2766 dissect_lsp_eis_neighbors_clv_inner(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
2767     int offset, int length, guint id_length, int show_virtual, int is_eis)
2768 {
2769     proto_item     *ti;
2770     proto_tree    *ntree = NULL;
2771     int        tlen;
2772 
2773     if (!is_eis) {
2774         id_length++;    /* IDs are one octet longer in IS neighbours */
2775         if ( tree ) {
2776             if ( show_virtual ) {
2777                 /* virtual path flag */
2778                 proto_tree_add_item( tree, hf_isis_lsp_is_virtual, tvb, offset, 1, ENC_NA);
2779             } else {
2780                 proto_tree_add_item(tree, hf_isis_lsp_eis_neighbors_reserved, tvb, offset, 1, ENC_BIG_ENDIAN);
2781             }
2782         }
2783         offset++;
2784         length--;
2785     }
2786     tlen = 4 + id_length;
2787 
2788     while ( length > 0 ) {
2789         if (length<tlen) {
2790             proto_tree_add_expert_format(tree, pinfo, &ei_isis_lsp_short_clv, tvb, offset, -1,
2791                 "short E/IS reachability (%d vs %d)", length, tlen );
2792             return;
2793         }
2794         /*
2795          * Gotta build a sub-tree for all our pieces
2796          */
2797         if ( tree ) {
2798             if ( is_eis ) {
2799                 ntree = proto_tree_add_subtree(tree, tvb, offset, tlen, ett_isis_lsp_clv_is_neighbors, &ti, "ES Neighbor");
2800             } else {
2801                 ntree = proto_tree_add_subtree(tree, tvb, offset, tlen, ett_isis_lsp_clv_is_neighbors, &ti, "IS Neighbor");
2802             }
2803 
2804             proto_tree_add_item(ntree, hf_isis_lsp_eis_neighbors_default_metric, tvb, offset, 1, ENC_BIG_ENDIAN);
2805             proto_tree_add_item(ntree, hf_isis_lsp_eis_neighbors_default_metric_ie, tvb, offset, 1, ENC_NA);
2806 
2807             proto_tree_add_item(ntree, hf_isis_lsp_eis_neighbors_delay_metric, tvb, offset, 1, ENC_BIG_ENDIAN);
2808             proto_tree_add_item(ntree, hf_isis_lsp_eis_neighbors_delay_metric_supported, tvb, offset, 1, ENC_NA);
2809 
2810             proto_tree_add_item(ntree, hf_isis_lsp_eis_neighbors_delay_metric_ie, tvb, offset+1, 1, ENC_NA);
2811 
2812             proto_tree_add_item(ntree, hf_isis_lsp_eis_neighbors_expense_metric, tvb, offset, 1, ENC_BIG_ENDIAN);
2813             proto_tree_add_item(ntree, hf_isis_lsp_eis_neighbors_expense_metric_supported, tvb, offset, 1, ENC_NA);
2814             proto_tree_add_item(ntree, hf_isis_lsp_eis_neighbors_expense_metric_ie, tvb, offset+2, 1, ENC_NA);
2815 
2816             proto_tree_add_item(ntree, hf_isis_lsp_eis_neighbors_error_metric, tvb, offset, 1, ENC_BIG_ENDIAN);
2817             proto_tree_add_item(ntree, hf_isis_lsp_eis_neighbors_error_metric_supported, tvb, offset, 1, ENC_NA);
2818             proto_tree_add_item(ntree, hf_isis_lsp_eis_neighbors_error_metric_ie, tvb, offset+3, 1, ENC_NA);
2819             proto_tree_add_item(ntree, is_eis ? hf_isis_lsp_eis_neighbors_es_neighbor_id : hf_isis_lsp_eis_neighbors_is_neighbor_id,
2820                                     tvb, offset+4, id_length, ENC_NA);
2821             proto_item_append_text(ti, ": %s", tvb_print_system_id(pinfo->pool, tvb, offset+4, id_length));
2822         }
2823         offset += tlen;
2824         length -= tlen;
2825     }
2826 }
2827 
2828 /*
2829  * Name: dissect_lsp_l1_is_neighbors_clv()
2830  *
2831  * Description:
2832  *    Dispatch a l1 intermediate system neighbor by calling
2833  *    the inner function with show virtual set to TRUE and is es set to FALSE.
2834  *
2835  * Input:
2836  *    tvbuff_t * : tvbuffer for packet data
2837  *    proto_tree * : protocol display tree to fill out.  May be NULL
2838  *    int : offset into packet data where we are.
2839  *    int : length of IDs in packet.
2840  *    int : length of clv we are decoding
2841  *
2842  * Output:
2843  *      void, but we will add to proto tree if !NULL.
2844  */
2845 static void
dissect_lsp_l1_is_neighbors_clv(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,int offset,isis_data_t * isis,int length)2846 dissect_lsp_l1_is_neighbors_clv(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, int offset,
2847     isis_data_t *isis, int length)
2848 {
2849     dissect_lsp_eis_neighbors_clv_inner(tvb, pinfo, tree, offset,
2850         length, isis->system_id_len, TRUE, FALSE);
2851 }
2852 
2853 /*
2854  * Name: dissect_lsp_l1_es_neighbors_clv()
2855  *
2856  * Description:
2857  *    Dispatch a l1 end or intermediate system neighbor by calling
2858  *    the inner function with show virtual set to TRUE and es set to TRUE.
2859  *
2860  * Input:
2861  *    tvbuff_t * : tvbuffer for packet data
2862  *    proto_tree * : protocol display tree to fill out.  May be NULL
2863  *    int : offset into packet data where we are.
2864  *    int : length of IDs in packet.
2865  *    int : length of clv we are decoding
2866  *
2867  * Output:
2868  *      void, but we will add to proto tree if !NULL.
2869  */
2870 static void
dissect_lsp_l1_es_neighbors_clv(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,int offset,isis_data_t * isis,int length)2871 dissect_lsp_l1_es_neighbors_clv(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, int offset,
2872     isis_data_t *isis, int length)
2873 {
2874     dissect_lsp_eis_neighbors_clv_inner(tvb, pinfo, tree, offset,
2875         length, isis->system_id_len, TRUE, TRUE);
2876 }
2877 
2878 /*
2879  * Name: dissect_lsp_l2_is_neighbors_clv()
2880  *
2881  * Description:
2882  *    Dispatch a l2 intermediate system neighbor by calling
2883  *    the inner function with show virtual set to FALSE, and is es set
2884  *    to FALSE
2885  *
2886  * Input:
2887  *    tvbuff_t * : tvbuffer for packet data
2888  *    proto_tree * : protocol display tree to fill out.  May be NULL
2889  *    int : offset into packet data where we are.
2890  *    int : length of IDs in packet.
2891  *    int : length of clv we are decoding
2892  *
2893  * Output:
2894  *      void, but we will add to proto tree if !NULL.
2895  */
2896 static void
dissect_lsp_l2_is_neighbors_clv(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,int offset,isis_data_t * isis,int length)2897 dissect_lsp_l2_is_neighbors_clv(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, int offset,
2898     isis_data_t *isis, int length)
2899 {
2900     dissect_lsp_eis_neighbors_clv_inner(tvb, pinfo, tree, offset,
2901         length, isis->system_id_len, FALSE, FALSE);
2902 }
2903 
2904 /*
2905  * Name: dissect_lsp_instance_identifier_clv()
2906  *
2907  * Description:
2908  *    Decode for a lsp packets Instance Identifier clv.
2909  *      Calls into the CLV common one.
2910  *
2911  * Input:
2912  *    tvbuff_t * : tvbuffer for packet data
2913  *    proto_tree * : proto tree to build on (may be null)
2914  *    int : current offset into packet data
2915  *    int : length of IDs in packet.
2916  *    int : length of this clv
2917  *
2918  * Output:
2919  *    void, will modify proto_tree if not null.
2920  */
2921 static void
dissect_lsp_instance_identifier_clv(tvbuff_t * tvb,packet_info * pinfo _U_,proto_tree * tree,int offset,isis_data_t * isis _U_,int length)2922 dissect_lsp_instance_identifier_clv(tvbuff_t *tvb, packet_info* pinfo _U_,
2923     proto_tree *tree, int offset, isis_data_t *isis _U_, int length)
2924 {
2925     isis_dissect_instance_identifier_clv(tree, pinfo, tvb, &ei_isis_lsp_short_clv, hf_isis_lsp_instance_identifier, hf_isis_lsp_supported_itid, offset, length);
2926 }
2927 
2928 /*
2929  * Name: dissect_subclv_admin_group ()
2930  *
2931  * Description: Called by function dissect_lsp_ext_is_reachability_clv().
2932  *
2933  *   This function is called by dissect_lsp_ext_is_reachability_clv()
2934  *   for dissect the administrative group sub-CLV (code 3).
2935  *
2936  * Input:
2937  *   tvbuff_t * : tvbuffer for packet data
2938  *   proto_tree * : protocol display tree to fill out.
2939  *   int : offset into packet data where we are (beginning of the sub_clv value).
2940  *
2941  * Output:
2942  *   void
2943  */
2944 static void
dissect_subclv_admin_group(tvbuff_t * tvb,proto_tree * tree,int offset)2945 dissect_subclv_admin_group (tvbuff_t *tvb, proto_tree *tree, int offset) {
2946     proto_tree *ntree;
2947     guint32    clv_value;
2948     guint32    mask;
2949     int        i;
2950 
2951     ntree = proto_tree_add_subtree(tree, tvb, offset-2, 6,
2952                 ett_isis_lsp_subclv_admin_group, NULL, "Administrative group(s):");
2953 
2954     clv_value = tvb_get_ntohl(tvb, offset);
2955     mask = 1;
2956     for (i = 0 ; i < 32 ; i++) {
2957         if ( (clv_value & mask) != 0 ) {
2958             proto_tree_add_uint_format(ntree, hf_isis_lsp_group, tvb, offset, 4, clv_value & mask, "group %d", i);
2959         }
2960         mask <<= 1;
2961     }
2962 }
2963 
2964 /*
2965  * Name: dissect_subclv_max_bw ()
2966  *
2967  * Description: Called by function dissect_lsp_ext_is_reachability_clv().
2968  *
2969  *   This function is called by dissect_lsp_ext_is_reachability_clv()
2970  *   for dissect the maximum link bandwidth sub-CLV (code 9).
2971  *
2972  * Input:
2973  *   tvbuff_t * : tvbuffer for packet data
2974  *   proto_tree * : protocol display tree to fill out.
2975  *   int : offset into packet data where we are (beginning of the sub_clv value).
2976  *
2977  * Output:
2978  *   void
2979  */
2980 static void
dissect_subclv_max_bw(tvbuff_t * tvb,proto_tree * tree,int offset)2981 dissect_subclv_max_bw(tvbuff_t *tvb, proto_tree *tree, int offset)
2982 {
2983     gfloat  bw;
2984 
2985     bw = tvb_get_ntohieee_float(tvb, offset)*8/1000000;
2986     proto_tree_add_float_format_value(tree, hf_isis_lsp_maximum_link_bandwidth, tvb, offset-2, 6,
2987         bw, "%.2f Mbps", bw);
2988 }
2989 
2990 /*
2991  * Name: dissect_subclv_rsv_bw ()
2992  *
2993  * Description: Called by function dissect_lsp_ext_is_reachability_clv().
2994  *
2995  *   This function is called by dissect_lsp_ext_is_reachability_clv()
2996  *   for dissect the reservable link bandwidth sub-CLV (code 10).
2997  *
2998  * Input:
2999  *   tvbuff_t * : tvbuffer for packet data
3000  *   proto_tree * : protocol display tree to fill out.
3001  *   int : offset into packet data where we are (beginning of the sub_clv value).
3002  *
3003  * Output:
3004  *   void
3005  */
3006 static void
dissect_subclv_rsv_bw(tvbuff_t * tvb,proto_tree * tree,int offset)3007 dissect_subclv_rsv_bw(tvbuff_t *tvb, proto_tree *tree, int offset)
3008 {
3009     gfloat  bw;
3010 
3011     bw = tvb_get_ntohieee_float(tvb, offset)*8/1000000;
3012     proto_tree_add_float_format_value (tree, hf_isis_lsp_reservable_link_bandwidth, tvb, offset-2, 6,
3013         bw, "%.2f Mbps", bw );
3014 }
3015 
3016 /*
3017  * Name: dissect_subclv_unrsv_bw ()
3018  *
3019  * Description: Called by function dissect_lsp_ext_is_reachability_clv().
3020  *
3021  *   This function is called by dissect_lsp_ext_is_reachability_clv()
3022  *   for dissect the unreserved bandwidth sub-CLV (code 11).
3023  *
3024  * Input:
3025  *   tvbuff_t * : tvbuffer for packet data
3026  *   proto_tree * : protocol display tree to fill out.
3027  *   int : offset into packet data where we are (beginning of the sub_clv value).
3028  *
3029  * Output:
3030  *   void
3031  */
3032 static void
dissect_subclv_unrsv_bw(tvbuff_t * tvb,proto_tree * tree,int offset)3033 dissect_subclv_unrsv_bw(tvbuff_t *tvb, proto_tree *tree, int offset)
3034 {
3035     proto_tree *ntree;
3036     gfloat     bw;
3037     int        i;
3038 
3039     ntree = proto_tree_add_subtree(tree, tvb, offset-2, 34,
3040                     ett_isis_lsp_subclv_unrsv_bw, NULL, "Unreserved bandwidth:");
3041 
3042     for (i = 0 ; i < 8 ; i++) {
3043         bw = tvb_get_ntohieee_float(tvb, offset+4*i)*8/1000000;
3044         proto_tree_add_float_format(ntree, hf_isis_lsp_unrsv_bw_priority_level, tvb, offset+4*i, 4,
3045             bw, "priority level %d: %.2f Mbps", i, bw );
3046     }
3047 }
3048 
3049 /*
3050  * Name: dissect_subclv_bw_ct ()
3051  *
3052  * Description: Called by function dissect_lsp_ext_is_reachability_clv().
3053  *
3054  *   This function is called by dissect_lsp_ext_is_reachability_clv()
3055  *   for dissect the Bandwidth Constraints sub-CLV (code 22).
3056  *
3057  * Input:
3058  *   tvbuff_t * : tvbuffer for packet data
3059  *   proto_tree * : protocol display tree to fill out.
3060  *   int : offset into packet data where we are (beginning of the sub_clv value).
3061  *
3062  * Output:
3063  *   void
3064  */
3065 static void
dissect_subclv_bw_ct(tvbuff_t * tvb,proto_tree * tree,int offset,int sublen)3066 dissect_subclv_bw_ct(tvbuff_t *tvb, proto_tree *tree, int offset, int sublen)
3067 {
3068     proto_tree *ntree;
3069     int offset_end = offset + sublen;
3070     gfloat  bw;
3071 
3072     ntree = proto_tree_add_subtree(tree, tvb, offset-2, sublen,
3073                     ett_isis_lsp_subclv_bw_ct, NULL, "Bandwidth Constraints:");
3074 
3075     proto_tree_add_item(ntree, hf_isis_lsp_bw_ct_model, tvb, offset, 1, ENC_BIG_ENDIAN);
3076     offset +=1;
3077 
3078     proto_tree_add_item(ntree, hf_isis_lsp_bw_ct_reserved, tvb, offset, 3, ENC_BIG_ENDIAN);
3079     offset +=3;
3080 
3081     if(offset < offset_end){
3082         bw = tvb_get_ntohieee_float(tvb, offset)*8/1000000;
3083         proto_tree_add_float_format_value(ntree, hf_isis_lsp_bw_ct0, tvb, offset, 4,
3084             bw, "%.2f Mbps", bw);
3085         offset += 4;
3086     }
3087 
3088     if(offset < offset_end){
3089         bw = tvb_get_ntohieee_float(tvb, offset)*8/1000000;
3090         proto_tree_add_float_format_value(ntree, hf_isis_lsp_bw_ct1, tvb, offset, 4,
3091             bw, "%.2f Mbps", bw);
3092         offset += 4;
3093     }
3094 
3095     if(offset < offset_end){
3096         bw = tvb_get_ntohieee_float(tvb, offset)*8/1000000;
3097         proto_tree_add_float_format_value(ntree, hf_isis_lsp_bw_ct2, tvb, offset, 4,
3098             bw, "%.2f Mbps", bw);
3099         offset += 4;
3100     }
3101 
3102     if(offset < offset_end){
3103         bw = tvb_get_ntohieee_float(tvb, offset)*8/1000000;
3104         proto_tree_add_float_format_value(ntree, hf_isis_lsp_bw_ct3, tvb, offset, 4,
3105             bw, "%.2f Mbps", bw);
3106         offset += 4;
3107     }
3108 
3109     if(offset < offset_end){
3110         bw = tvb_get_ntohieee_float(tvb, offset)*8/1000000;
3111         proto_tree_add_float_format_value(ntree, hf_isis_lsp_bw_ct4, tvb, offset, 4,
3112             bw, "%.2f Mbps", bw);
3113         offset += 4;
3114     }
3115 
3116     if(offset < offset_end){
3117         bw = tvb_get_ntohieee_float(tvb, offset)*8/1000000;
3118         proto_tree_add_float_format_value(ntree, hf_isis_lsp_bw_ct5, tvb, offset, 4,
3119             bw, "%.2f Mbps", bw);
3120         offset += 4;
3121     }
3122 
3123     if(offset < offset_end){
3124         bw = tvb_get_ntohieee_float(tvb, offset)*8/1000000;
3125         proto_tree_add_float_format_value(ntree, hf_isis_lsp_bw_ct6, tvb, offset, 4,
3126             bw, "%.2f Mbps", bw);
3127         offset += 4;
3128     }
3129 
3130     if(offset < offset_end){
3131         bw = tvb_get_ntohieee_float(tvb, offset)*8/1000000;
3132         proto_tree_add_float_format_value(ntree, hf_isis_lsp_bw_ct7, tvb, offset, 4,
3133             bw, "%.2f Mbps", bw);
3134         /*offset += 4;*/
3135     }
3136 }
3137 
3138 /*
3139  * Name: dissect_subclv_spb_link_metric ()
3140  *
3141  * Description: Called by function dissect_lsp_ext_is_reachability_clv().
3142  *
3143  *   This function is called by dissect_lsp_ext_is_reachability_clv()
3144  *   for dissect the SPB link metric sub-CLV (code 29).
3145  *
3146  * Input:
3147  *   tvbuff_t * : tvbuffer for packet data
3148  *   proto_tree * : protocol display tree to fill out.
3149  *   int : offset into packet data where we are (beginning of the sub_clv value).
3150  *   int : subtlv type
3151  *   int : subtlv length
3152  *
3153  * Output:
3154  *   void
3155  */
3156 
3157 static void
dissect_subclv_spb_link_metric(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,int offset,int subtype,int sublen)3158 dissect_subclv_spb_link_metric(tvbuff_t *tvb, packet_info *pinfo,
3159         proto_tree *tree, int offset, int subtype, int sublen)
3160 {
3161     const int SUBLEN     = 6;
3162 
3163     if (sublen != SUBLEN) {
3164         proto_tree_add_expert_format(tree, pinfo, &ei_isis_lsp_short_clv, tvb, offset, -1,
3165                               "Short SPB Link Metric sub-TLV (%d vs %d)", sublen, SUBLEN);
3166         return;
3167     }
3168     else {
3169         proto_tree *subtree;
3170         subtree = proto_tree_add_subtree_format( tree, tvb, offset-2, sublen+2, ett_isis_lsp_subclv_spb_link_metric, NULL,
3171                                   "SPB Link Metric: Type: 0x%02x (%d), Length: %d", subtype, subtype, sublen);
3172 
3173         proto_tree_add_item(subtree, hf_isis_lsp_spb_link_metric,
3174                             tvb, offset, 3, ENC_BIG_ENDIAN);
3175 
3176         proto_tree_add_item(subtree, hf_isis_lsp_spb_port_count,
3177                             tvb, offset+3, 1, ENC_BIG_ENDIAN);
3178 
3179         proto_tree_add_item(subtree, hf_isis_lsp_spb_port_id,
3180                             tvb, offset+4, 2, ENC_BIG_ENDIAN);
3181     }
3182 }
3183 
3184 /*
3185  * Name : dissect_subclv_ext_admin_group()
3186  *
3187  * Description : called by function dissect_sub_clv_tlv_22_22_23_141_222_223()
3188  *
3189  *   Dissects Extended Administrative Groups subclv
3190  *
3191  * Input :
3192  *   tvbuff_t * : tvbuffer for packet data
3193  *   proto_tree * : protocol display tree to fill out.
3194  *   int : offset into packet data where we are (beginning of the sub_clv value).
3195  *   int : subtlv type
3196  *   int : subtlv length
3197  *
3198  * Output:
3199  *   void
3200  */
3201 static void
dissect_subclv_ext_admin_group(tvbuff_t * tvb,proto_tree * tree,int offset,int subtype _U_,int sublen)3202 dissect_subclv_ext_admin_group(tvbuff_t *tvb, proto_tree *tree,
3203                                int offset, int subtype _U_, int sublen)
3204 {
3205     int i;
3206     guint32 admin_group;
3207 
3208     /* Number of Extended Admin Groups */
3209     for (i = 0; i < (sublen / 4); i++) {
3210         admin_group = tvb_get_guint32(tvb, offset + (i * 4), ENC_BIG_ENDIAN);
3211         proto_tree_add_uint_format(tree, hf_isis_lsp_clv_ext_admin_group,
3212                                    tvb, offset + (i * 4), 4, admin_group,
3213                                    "Extended Admin Group[%d]: 0x%08x",
3214                                    i, admin_group);
3215     }
3216 }
3217 
3218 /*
3219  * Name : dissect_subclv_adj_sid()
3220  *
3221  * Description : called by function dissect_sub_clv_tlv_22_22_23_141_222_223()
3222  *
3223  *   Dissects LAN-Adj-SID & Adj-SID subclv
3224  *
3225  * Input :
3226  *   tvbuff_t * : tvbuffer for packet data
3227  *   proto_tree * : protocol display tree to fill out.
3228  *   int : offset into packet data where we are (beginning of the sub_clv value).
3229  *   int : subtlv type
3230  *   int : subtlv length
3231  *
3232  * Output:
3233  *   void
3234  */
3235 
3236 static void
dissect_subclv_adj_sid(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,int local_offset,int subtype,int sublen)3237 dissect_subclv_adj_sid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
3238         int local_offset, int subtype, int sublen)
3239 {
3240     int offset = local_offset;
3241     proto_item *ti;
3242     int sli_len;
3243     guint8 flags;
3244 
3245     flags = tvb_get_guint8(tvb, offset);
3246     proto_tree_add_bitmask(tree, tvb, offset, hf_isis_lsp_adj_sid_flags,
3247                                ett_isis_lsp_adj_sid_flags, adj_sid_flags, ENC_BIG_ENDIAN);
3248 
3249     offset++;
3250 
3251     proto_tree_add_item(tree, hf_isis_lsp_adj_sid_weight, tvb, offset, 1, ENC_BIG_ENDIAN);
3252     offset++;
3253 
3254     /* Only present in LAN-Adj-SID, not Adj-SID */
3255     if (subtype == 32) {
3256         proto_tree_add_item(tree, hf_isis_lsp_adj_sid_system_id, tvb, offset, 6, ENC_NA);
3257         offset += 6;
3258     }
3259 
3260     sli_len = local_offset + sublen - offset;
3261     switch(sli_len) {
3262         case 3:
3263             if (!((flags & 0x30) == 0x30))
3264                 proto_tree_add_expert_format(tree, pinfo, &ei_isis_lsp_malformed_subtlv, tvb,
3265                                 local_offset, sublen, "V & L flags must be set");
3266             proto_tree_add_item(tree, hf_isis_lsp_sid_sli_label, tvb, offset, sli_len, ENC_BIG_ENDIAN);
3267             break;
3268         case 4:
3269             if (flags & 0x30)
3270                 proto_tree_add_expert_format(tree, pinfo, &ei_isis_lsp_malformed_subtlv, tvb,
3271                                 local_offset, sublen, "V & L flags must be unset");
3272             proto_tree_add_item(tree, hf_isis_lsp_sid_sli_index, tvb, offset, sli_len, ENC_BIG_ENDIAN);
3273             break;
3274         case 16:
3275             if (!(flags & 0x20))
3276                 proto_tree_add_expert_format(tree, pinfo, &ei_isis_lsp_malformed_subtlv, tvb,
3277                                 local_offset, sublen, "V flag must be set");
3278             ti = proto_tree_add_item(tree, hf_isis_lsp_sid_sli_ipv6, tvb, offset, sli_len, ENC_NA);
3279             /* L flag set */
3280             if (flags & 0x10)
3281                 proto_item_append_text(ti, "Globally unique");
3282             break;
3283         default:
3284             break;
3285     }
3286     /*offset += sli_len;*/
3287 }
3288 /*
3289  * Name: dissect_sub_clv_tlv_22_22_23_141_222_223
3290  *
3291  * Description: Decode a sub tlv's for all those tlv
3292  *
3293  *   CALLED BY TLV 22,23,141,222,223 DISSECTOR
3294  *
3295  * Input:
3296  *   tvbuff_t * : tvbuffer for packet data
3297  *   packet_info * : expert error misuse reporting
3298  *   proto_tree * : protocol display tree to fill out.  May be NULL
3299  *   int : offset into packet data where we are.
3300  *   int : sub-tlv length
3301  *   int : length of clv we are decoding
3302  *
3303  * Output:
3304  *   void
3305  */
3306 
3307 static void
dissect_sub_clv_tlv_22_22_23_141_222_223(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,int offset,int subclvs_len)3308 dissect_sub_clv_tlv_22_22_23_141_222_223(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree,
3309     int offset, int subclvs_len)
3310 {
3311     proto_item *ti_subclvs = NULL;
3312     proto_tree *subtree = NULL;
3313     int sub_tlv_offset = 0;
3314     int i = 0;
3315     guint  clv_code, clv_len;
3316     int local_offset, local_len;
3317     proto_item *ti;
3318     gfloat percentage;
3319     guint8 sabm_length = 0, udabm_length = 0;
3320 
3321     while (i < subclvs_len) {
3322         /* offset for each sub-TLV */
3323         sub_tlv_offset = offset + i;
3324 
3325         subtree = proto_tree_add_subtree(tree, tvb, sub_tlv_offset, 0,
3326                                          ett_isis_lsp_part_of_clv_ext_is_reachability_subtlv,
3327                                          &ti_subclvs, "subTLV");
3328         proto_tree_add_item(subtree, hf_isis_lsp_ext_is_reachability_code,
3329                             tvb, sub_tlv_offset, 1, ENC_BIG_ENDIAN);
3330         proto_tree_add_item(subtree, hf_isis_lsp_ext_is_reachability_len, tvb, sub_tlv_offset+1, 1, ENC_BIG_ENDIAN);
3331         clv_code = tvb_get_guint8(tvb, sub_tlv_offset);
3332         clv_len  = tvb_get_guint8(tvb, sub_tlv_offset+1);
3333         proto_item_append_text(ti_subclvs, ": %s (c=%u, l=%u)", val_to_str(clv_code, isis_lsp_ext_is_reachability_code_vals, "Unknown"), clv_code, clv_len);
3334         proto_item_set_len(ti_subclvs, clv_len+2);
3335 
3336         sub_tlv_offset += 2;
3337 
3338         switch (clv_code) {
3339             case 3 :
3340                 dissect_subclv_admin_group(tvb, subtree, sub_tlv_offset);
3341             break;
3342             case 4 :
3343                 proto_tree_add_item(subtree, hf_isis_lsp_ext_is_reachability_link_local_identifier,
3344                                     tvb, sub_tlv_offset, 4, ENC_BIG_ENDIAN);
3345                 proto_tree_add_item(subtree, hf_isis_lsp_ext_is_reachability_link_remote_identifier,
3346                                     tvb, sub_tlv_offset + 4, 4, ENC_BIG_ENDIAN);
3347             break;
3348             case 6 :
3349                 proto_tree_add_item(subtree, hf_isis_lsp_ext_is_reachability_ipv4_interface_address, tvb, sub_tlv_offset, 4, ENC_BIG_ENDIAN);
3350             break;
3351             case 8 :
3352                 proto_tree_add_item(subtree, hf_isis_lsp_ext_is_reachability_ipv4_neighbor_address, tvb, sub_tlv_offset, 4, ENC_BIG_ENDIAN);
3353             break;
3354             case 9 :
3355                 dissect_subclv_max_bw(tvb, subtree, sub_tlv_offset);
3356             break;
3357             case 10:
3358                 dissect_subclv_rsv_bw(tvb, subtree, sub_tlv_offset);
3359             break;
3360             case 11:
3361                 dissect_subclv_unrsv_bw(tvb, subtree, sub_tlv_offset);
3362             break;
3363             case 12:
3364                 proto_tree_add_item(subtree, hf_isis_lsp_ext_is_reachability_ipv6_interface_address, tvb, sub_tlv_offset, 16, ENC_NA);
3365             break;
3366             case 13:
3367                 proto_tree_add_item(subtree, hf_isis_lsp_ext_is_reachability_ipv6_neighbor_address, tvb, sub_tlv_offset, 16, ENC_NA);
3368             break;
3369             case 14:
3370                 /* Extended Administrative Groups (rfc7308) */
3371                 dissect_subclv_ext_admin_group(tvb, subtree, sub_tlv_offset, clv_code, clv_len);
3372                 break;
3373             case 15:
3374                 /* Link MSD */
3375                 local_offset = sub_tlv_offset;
3376                 local_len = clv_len;
3377                 while (local_len >= 2) {
3378                     proto_tree_add_item(subtree, hf_isis_lsp_clv_igp_msd_type, tvb, local_offset, 1, ENC_NA);
3379                     proto_tree_add_item(subtree, hf_isis_lsp_clv_igp_msd_value, tvb, local_offset+1, 1, ENC_NA);
3380                     local_len -= 2;
3381                     local_offset += 2;
3382                 }
3383             break;
3384             case 16:
3385                 /* Application-Specific Link Attributes (rfc8919) */
3386                 local_offset = sub_tlv_offset;
3387                 local_len = clv_len;
3388                 proto_tree_add_item(subtree, hf_isis_lsp_clv_app_sabm_legacy, tvb, local_offset, 1, ENC_NA);
3389                 sabm_length = tvb_get_guint8(tvb, local_offset) & 0x7f;
3390                 proto_tree_add_uint(subtree, hf_isis_lsp_clv_app_sabm_length, tvb, local_offset, 1, sabm_length);
3391                 proto_tree_add_item(subtree, hf_isis_lsp_clv_app_udabm_reserved, tvb, local_offset + 1, 1, ENC_NA);
3392                 udabm_length = tvb_get_guint8(tvb, local_offset + 1) & 0x7f;
3393                 proto_tree_add_uint(subtree, hf_isis_lsp_clv_app_udabm_length, tvb, local_offset + 1, 1, udabm_length);
3394                 local_offset += 2;
3395                 local_len -= 2;
3396                 if (sabm_length > 0) {
3397                     proto_tree_add_bitmask(subtree, tvb, local_offset,
3398                                            hf_isis_lsp_clv_app_sabm_bits,
3399                                            ett_isis_lsp_clv_app_sabm_bits,
3400                                            isis_lsp_app_sabm_bits, ENC_NA);
3401                     local_offset += sabm_length;
3402                     local_len -= sabm_length;
3403                 }
3404                 if (udabm_length > 0) {
3405                     proto_tree_add_item(subtree, hf_isis_lsp_clv_app_udabm_bits,
3406                                         tvb, local_offset, udabm_length, ENC_NA);
3407                     local_offset += udabm_length;
3408                     local_len -= udabm_length;
3409                 }
3410                 if (local_len > 2) {
3411                     /* Dissect Link Attribute sub-sub-TLVs */
3412                     dissect_sub_clv_tlv_22_22_23_141_222_223(tvb, pinfo, subtree, local_offset, local_len);
3413                 }
3414                 break;
3415             case 18:
3416                 proto_tree_add_item(subtree, hf_isis_lsp_ext_is_reachability_traffic_engineering_default_metric,
3417                                     tvb, sub_tlv_offset, 3, ENC_BIG_ENDIAN);
3418             break;
3419             case 22:
3420                 dissect_subclv_bw_ct(tvb, subtree, sub_tlv_offset, clv_len);
3421             break;
3422             case 29:
3423                 dissect_subclv_spb_link_metric(tvb, pinfo, subtree,
3424                                                sub_tlv_offset, clv_code, clv_len);
3425             break;
3426             case 31:
3427             case 32:
3428                 dissect_subclv_adj_sid(tvb, pinfo, subtree, sub_tlv_offset, clv_code, clv_len);
3429             break;
3430             case 33:
3431                 /* Unidirectional Link Delay (rfc8570) */
3432                 proto_tree_add_bitmask(subtree, tvb, sub_tlv_offset,
3433                                        hf_isis_lsp_ext_is_reachability_unidir_link_flags,
3434                                        ett_isis_lsp_clv_unidir_link_flags,
3435                                        unidir_link_flags, ENC_NA);
3436                 proto_tree_add_item(subtree, hf_isis_lsp_ext_is_reachability_unidir_link_delay, tvb, sub_tlv_offset+1, 3, ENC_BIG_ENDIAN);
3437             break;
3438             case 34:
3439                 /* Min/Max Unidirectional Link Delay (rfc8570) */
3440                 proto_tree_add_bitmask(subtree, tvb, sub_tlv_offset,
3441                                        hf_isis_lsp_ext_is_reachability_unidir_link_flags,
3442                                        ett_isis_lsp_clv_unidir_link_flags,
3443                                        unidir_link_flags, ENC_NA);
3444                 proto_tree_add_item(subtree, hf_isis_lsp_ext_is_reachability_unidir_link_delay_min, tvb, sub_tlv_offset+1, 3, ENC_BIG_ENDIAN);
3445                 proto_tree_add_item(subtree, hf_isis_lsp_ext_is_reachability_unidir_link_reserved, tvb, sub_tlv_offset+4, 1, ENC_NA);
3446                 proto_tree_add_item(subtree, hf_isis_lsp_ext_is_reachability_unidir_link_delay_max, tvb, sub_tlv_offset+5, 3, ENC_BIG_ENDIAN);
3447             break;
3448             case 35:
3449                 /* Unidirectional Delay Variation (rfc8570) */
3450                 proto_tree_add_item(subtree, hf_isis_lsp_ext_is_reachability_unidir_link_reserved, tvb, sub_tlv_offset, 1, ENC_NA);
3451                 proto_tree_add_item(subtree, hf_isis_lsp_ext_is_reachability_unidir_delay_variation, tvb, sub_tlv_offset+1, 3, ENC_BIG_ENDIAN);
3452             break;
3453             case 36:
3454                 /* Unidirectional Link Loss (rfc8570) */
3455                 proto_tree_add_bitmask(subtree, tvb, sub_tlv_offset,
3456                                        hf_isis_lsp_ext_is_reachability_unidir_link_flags,
3457                                        ett_isis_lsp_clv_unidir_link_flags,
3458                                        unidir_link_flags, ENC_NA);
3459                 ti = proto_tree_add_item(subtree, hf_isis_lsp_ext_is_reachability_unidir_link_loss, tvb, sub_tlv_offset+1, 3, ENC_BIG_ENDIAN);
3460                 if (ti) {
3461                     percentage = (gfloat)tvb_get_guint24(tvb, sub_tlv_offset+1, ENC_BIG_ENDIAN);
3462                     proto_item_append_text(ti, " (%f %%)", percentage * 0.000003);
3463                 }
3464             break;
3465             case 37:
3466                 /* 37: Unidirectional Residual Bandwidth (rfc8570) */
3467                 proto_tree_add_item(subtree, hf_isis_lsp_ext_is_reachability_unidir_residual_bandwidth, tvb, sub_tlv_offset, 4, ENC_BIG_ENDIAN);
3468                 break;
3469             case 38:
3470                 /* 38: Unidirectional Available Bandwidth (rfc8570) */
3471                 proto_tree_add_item(subtree, hf_isis_lsp_ext_is_reachability_unidir_available_bandwidth, tvb, sub_tlv_offset, 4, ENC_BIG_ENDIAN);
3472                 break;
3473             case 39:
3474                 /* 39: Unidirectional Utilized Bandwidth (rfc8570) */
3475                 proto_tree_add_item(subtree, hf_isis_lsp_ext_is_reachability_unidir_utilized_bandwidth, tvb, sub_tlv_offset, 4, ENC_BIG_ENDIAN);
3476             break;
3477             case 43:
3478                 /* SRv6 End.X SID */
3479                 proto_tree_add_bitmask(subtree, tvb, sub_tlv_offset,
3480                                        hf_isis_lsp_clv_srv6_endx_sid_flags,
3481                                        ett_isis_lsp_clv_srv6_endx_sid_flags,
3482                                        srv6_endx_sid_flags, ENC_BIG_ENDIAN);
3483                 proto_tree_add_item(subtree, hf_isis_lsp_clv_srv6_endx_sid_alg, tvb, sub_tlv_offset+1, 1, ENC_NA);
3484                 proto_tree_add_item(subtree, hf_isis_lsp_clv_srv6_endx_sid_weight, tvb, sub_tlv_offset+2, 1, ENC_BIG_ENDIAN);
3485                 proto_tree_add_item(subtree, hf_isis_lsp_clv_srv6_endx_sid_endpoint_func, tvb, sub_tlv_offset+3, 2, ENC_NA);
3486                 proto_tree_add_item(subtree, hf_isis_lsp_clv_srv6_endx_sid_sid, tvb, sub_tlv_offset+5, 16, ENC_NA);
3487                 proto_tree_add_item(subtree, hf_isis_lsp_clv_srv6_endx_sid_subsubclvs_len, tvb, sub_tlv_offset+21, 1, ENC_NA);
3488                 break;
3489             case 44:
3490                 /* SRv6 LAN End.X SID */
3491                 proto_tree_add_item(subtree, hf_isis_lsp_clv_srv6_endx_sid_system_id, tvb, sub_tlv_offset, 6, ENC_NA);
3492                 proto_tree_add_bitmask(subtree, tvb, sub_tlv_offset+6,
3493                                        hf_isis_lsp_clv_srv6_endx_sid_flags,
3494                                        ett_isis_lsp_clv_srv6_endx_sid_flags,
3495                                        srv6_endx_sid_flags, ENC_BIG_ENDIAN);
3496                 proto_tree_add_item(subtree, hf_isis_lsp_clv_srv6_endx_sid_alg, tvb, sub_tlv_offset+7, 1, ENC_NA);
3497                 proto_tree_add_item(subtree, hf_isis_lsp_clv_srv6_endx_sid_weight, tvb, sub_tlv_offset+8, 1, ENC_BIG_ENDIAN);
3498                 proto_tree_add_item(subtree, hf_isis_lsp_clv_srv6_endx_sid_endpoint_func, tvb, sub_tlv_offset+9, 2, ENC_NA);
3499                 proto_tree_add_item(subtree, hf_isis_lsp_clv_srv6_endx_sid_sid, tvb, sub_tlv_offset+11, 16, ENC_NA);
3500                 proto_tree_add_item(subtree, hf_isis_lsp_clv_srv6_endx_sid_subsubclvs_len, tvb, sub_tlv_offset+27, 1, ENC_NA);
3501                 break;
3502             default:
3503                 proto_tree_add_item(subtree, hf_isis_lsp_ext_is_reachability_value, tvb, sub_tlv_offset, clv_len, ENC_NA);
3504             break;
3505         }
3506     i += clv_len + 2;
3507   }
3508 }
3509 
3510 
3511 /*
3512  * Name: dissect_lsp_ext_is_reachability_clv()
3513  *
3514  * Description: Decode a Extended IS Reachability CLV - code 22
3515  * RFC 3784
3516  *
3517  *   The extended IS reachability TLV is an extended version
3518  *   of the IS reachability TLV (code 2). It encodes the metric
3519  *   as a 24-bit unsigned integer and allows to add sub-CLV(s).
3520  *
3521  *   CALLED BY TLV 222 DISSECTOR
3522  *
3523  * Input:
3524  *   tvbuff_t * : tvbuffer for packet data
3525  *   proto_tree * : protocol display tree to fill out.  May be NULL
3526  *   int : offset into packet data where we are.
3527  *   int : length of IDs in packet.
3528  *   int : length of clv we are decoding
3529  *
3530  * Output:
3531  *   void, but we will add to proto tree if !NULL.
3532  */
3533 
3534 static void
dissect_lsp_ext_is_reachability_clv(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,int offset,isis_data_t * isis _U_,int length)3535 dissect_lsp_ext_is_reachability_clv(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree,
3536     int offset, isis_data_t *isis _U_, int length)
3537 {
3538     proto_item *ti, *ti_subclvs_len;
3539     proto_tree *ntree = NULL;
3540     guint      subclvs_len;
3541     guint      len;
3542 
3543     while (length > 0) {
3544         ntree = proto_tree_add_subtree(tree, tvb, offset, -1,
3545                 ett_isis_lsp_part_of_clv_ext_is_reachability, &ti, "IS Neighbor");
3546 
3547         proto_tree_add_item(ntree, hf_isis_lsp_ext_is_reachability_is_neighbor_id, tvb, offset, 7, ENC_NA);
3548         proto_item_append_text(ti, ": %s", tvb_print_system_id(pinfo->pool, tvb, offset, 7));
3549 
3550         proto_tree_add_item(ntree, hf_isis_lsp_ext_is_reachability_metric, tvb, offset+7, 3, ENC_BIG_ENDIAN);
3551 
3552         ti_subclvs_len = proto_tree_add_item(ntree, hf_isis_lsp_ext_is_reachability_subclvs_len, tvb, offset+10, 1, ENC_BIG_ENDIAN);
3553 
3554         subclvs_len = tvb_get_guint8(tvb, offset+10);
3555         if (subclvs_len == 0) {
3556             proto_item_append_text(ti_subclvs_len, " (no sub-TLVs present)");
3557         }
3558         else {
3559             dissect_sub_clv_tlv_22_22_23_141_222_223(tvb, pinfo, ntree,
3560                                                     offset + 11, subclvs_len);
3561         }
3562 
3563         len = 11 + subclvs_len;
3564         proto_item_set_len (ti, len);
3565         offset += len;
3566         length -= len;
3567     }
3568 }
3569 
3570 /*
3571  * Name: dissect_lsp_mt_reachable_IPv4_prefx_clv()
3572  *
3573  * Description: Decode Multi-Topology IPv4 Prefixes - code 235
3574  *
3575  *
3576  * Input:
3577  *   tvbuff_t * : tvbuffer for packet data
3578  *   proto_tree * : protocol display tree to fill out.  May be NULL
3579  *   int : offset into packet data where we are.
3580  *   int : length of IDs in packet.
3581  *   int : length of clv we are decoding
3582  *
3583  * Output:
3584  *   void, but we will add to proto tree if !NULL.
3585  */
3586 static void
dissect_lsp_mt_reachable_IPv4_prefx_clv(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,int offset,isis_data_t * isis _U_,int length)3587 dissect_lsp_mt_reachable_IPv4_prefx_clv(tvbuff_t *tvb, packet_info* pinfo,
3588         proto_tree *tree, int offset, isis_data_t *isis _U_, int length)
3589 {
3590     if (length < 2) {
3591         proto_tree_add_expert_format(tree, pinfo, &ei_isis_lsp_short_clv, tvb, offset, -1,
3592                 "short lsp multi-topology reachable IPv4 prefixes(%d vs %d)", length, 2 );
3593         return;
3594     }
3595     dissect_lsp_mt_id(tvb, tree, offset);
3596     dissect_lsp_ext_ip_reachability_clv(tvb, pinfo, tree, offset+2, 0, length-2);
3597 }
3598 
3599 /*
3600  * Name: dissect_lsp_mt_reachable_IPv6_prefx_clv()
3601  *
3602  * Description: Decode Multi-Topology IPv6 Prefixes - code 237
3603  *
3604  *
3605  * Input:
3606  *   tvbuff_t * : tvbuffer for packet data
3607  *   proto_tree * : protocol display tree to fill out.  May be NULL
3608  *   int : offset into packet data where we are.
3609  *   int : length of IDs in packet.
3610  *   int : length of clv we are decoding
3611  *
3612  * Output:
3613  *   void, but we will add to proto tree if !NULL.
3614  */
3615 static void
dissect_lsp_mt_reachable_IPv6_prefx_clv(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,int offset,isis_data_t * isis _U_,int length)3616 dissect_lsp_mt_reachable_IPv6_prefx_clv(tvbuff_t *tvb, packet_info* pinfo,
3617         proto_tree *tree, int offset, isis_data_t *isis _U_, int length)
3618 {
3619     if (length < 2) {
3620         proto_tree_add_expert_format(tree, pinfo, &ei_isis_lsp_short_clv, tvb, offset, -1,
3621                 "short lsp multi-topology reachable IPv6 prefixes(%d vs %d)", length, 2 );
3622         return;
3623     }
3624     dissect_lsp_mt_id(tvb, tree, offset);
3625     dissect_lsp_ipv6_reachability_clv(tvb, pinfo, tree, offset+2, 0, length-2);
3626 }
3627 
3628 
3629 /*
3630  * Name: dissect_lsp_mt_is_reachability_clv()
3631  *
3632  * Description: Decode Multi-Topology Intermediate Systems - code 222
3633  *
3634  *
3635  * Input:
3636  *   tvbuff_t * : tvbuffer for packet data
3637  *   proto_tree * : protocol display tree to fill out.  May be NULL
3638  *   int : offset into packet data where we are.
3639  *   int : unused
3640  *   int : length of clv we are decoding
3641  *
3642  * Output:
3643  *   void, but we will add to proto tree if !NULL.
3644  */
3645 
3646 static void
dissect_lsp_mt_is_reachability_clv(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,int offset,isis_data_t * isis _U_,int length)3647 dissect_lsp_mt_is_reachability_clv(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, int offset,
3648     isis_data_t *isis _U_, int length)
3649 {
3650     if (length < 2) {
3651         proto_tree_add_expert_format(tree, pinfo, &ei_isis_lsp_short_clv, tvb, offset, -1,
3652                 "short lsp reachability(%d vs %d)", length, 2 );
3653         return;
3654     }
3655 
3656     /*
3657      * the MT ID value dissection is used in other LSPs so we push it
3658      * in a function
3659      */
3660     dissect_lsp_mt_id(tvb, tree, offset);
3661     /*
3662      * fix here. No need to parse TLV 22 (with bugs) while it is
3663      * already done correctly!!
3664      */
3665     dissect_lsp_ext_is_reachability_clv(tvb, pinfo, tree, offset+2, 0, length-2);
3666 }
3667 
3668 
3669 /*
3670  * Name: dissect_lsp_ori_buffersize_clv()
3671  *
3672  * Description:
3673  *    This CLV is used give neighbor buffer size
3674  *
3675  * Input:
3676  *    tvbuff_t * : tvbuffer for packet data
3677  *    proto_tree * : protocol display tree to fill out.  May be NULL
3678  *    int : offset into packet data where we are.
3679  *    int : length of IDs in packet.
3680  *    int : length of clv we are decoding
3681  *
3682  * Output:
3683  *      void, but we will add to proto tree if !NULL.
3684  */
3685 static void
dissect_lsp_ori_buffersize_clv(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,int offset,isis_data_t * isis,int length)3686 dissect_lsp_ori_buffersize_clv(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, int offset,
3687     isis_data_t *isis, int length)
3688 {
3689     if ( length != 2 ) {
3690         proto_tree_add_expert_format(tree, pinfo, &ei_isis_lsp_short_clv, tvb, offset, -1,
3691                 "short lsp partition DIS(%d vs %d)", length, isis->system_id_len );
3692         return;
3693     }
3694     /*
3695      * Gotta build a sub-tree for all our pieces
3696      */
3697     proto_tree_add_item(tree, hf_isis_lsp_originating_lsp_buffer_size, tvb, offset, length, ENC_BIG_ENDIAN);
3698 }
3699 
3700 
3701 /*
3702  * Name: dissect_lsp_partition_dis_clv()
3703  *
3704  * Description:
3705  *    This CLV is used to indicate which system is the designated
3706  *    IS for partition repair.  This means just putting out the
3707  *    "isis->system_id_len"-octet IS.
3708  *
3709  * Input:
3710  *    tvbuff_t * : tvbuffer for packet data
3711  *    proto_tree * : protocol display tree to fill out.  May be NULL
3712  *    int : offset into packet data where we are.
3713  *    int : length of IDs in packet.
3714  *    int : length of clv we are decoding
3715  *
3716  * Output:
3717  *      void, but we will add to proto tree if !NULL.
3718  */
3719 static void
dissect_lsp_partition_dis_clv(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,int offset,isis_data_t * isis,int length)3720 dissect_lsp_partition_dis_clv(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, int offset,
3721     isis_data_t *isis, int length)
3722 {
3723     if ( length < isis->system_id_len ) {
3724         proto_tree_add_expert_format(tree, pinfo, &ei_isis_lsp_short_clv, tvb, offset, -1,
3725                 "short lsp partition DIS(%d vs %d)", length, isis->system_id_len );
3726         return;
3727     }
3728     /*
3729      * Gotta build a sub-tree for all our pieces
3730      */
3731     proto_tree_add_item( tree, hf_isis_lsp_partition_designated_l2_is, tvb, offset, isis->system_id_len, ENC_NA);
3732 
3733     length -= isis->system_id_len;
3734     offset += isis->system_id_len;
3735     if ( length > 0 ) {
3736         proto_tree_add_expert_format(tree, pinfo, &ei_isis_lsp_long_clv, tvb, offset, -1,
3737                 "Long lsp partition DIS, %d left over", length );
3738         return;
3739     }
3740 }
3741 
3742 /*
3743  * Name: dissect_lsp_prefix_neighbors_clv()
3744  *
3745  * Description:
3746  *    The prefix CLV describes what other (OSI) networks we can reach
3747  *    and what their cost is.  It is built from a metric block
3748  *    (see dissect_metric) followed by n addresses.
3749  *
3750  * Input:
3751  *    tvbuff_t * : tvbuffer for packet data
3752  *    proto_tree * : protocol display tree to fill out.  May be NULL
3753  *    int : offset into packet data where we are.
3754  *    int : length of IDs in packet.
3755  *    int : length of clv we are decoding
3756  *
3757  * Output:
3758  *      void, but we will add to proto tree if !NULL.
3759  */
3760 static void
dissect_lsp_prefix_neighbors_clv(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,int offset,isis_data_t * isis _U_,int length)3761 dissect_lsp_prefix_neighbors_clv(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, int offset,
3762     isis_data_t *isis _U_, int length)
3763 {
3764     char *sbuf;
3765     int mylen;
3766 
3767     if ( length < 4 ) {
3768         proto_tree_add_expert_format(tree, pinfo, &ei_isis_lsp_short_clv, tvb, offset, -1,
3769             "Short lsp prefix neighbors (%d vs 4)", length );
3770         return;
3771     }
3772     if ( tree ) {
3773         dissect_metric (tvb, pinfo, tree, offset,
3774             hf_isis_lsp_default, hf_isis_lsp_default_support, TRUE );
3775         dissect_metric (tvb, pinfo, tree, offset+1,
3776             hf_isis_lsp_delay, hf_isis_lsp_delay_support, FALSE );
3777         dissect_metric (tvb, pinfo, tree, offset+2,
3778             hf_isis_lsp_expense, hf_isis_lsp_expense_support, FALSE );
3779         dissect_metric (tvb, pinfo, tree, offset+3,
3780             hf_isis_lsp_error, hf_isis_lsp_error_support, FALSE );
3781     }
3782     offset += 4;
3783     length -= 4;
3784     while ( length > 0 ) {
3785         /*
3786          * This is a length in "semi-octets", i.e., in nibbles.
3787          */
3788         mylen = tvb_get_guint8(tvb, offset);
3789         length--;
3790         if (length<=0) {
3791             proto_tree_add_expert_format(tree, pinfo, &ei_isis_lsp_short_clv, tvb, offset, -1,
3792                 "Zero payload space after length in prefix neighbor" );
3793             return;
3794         }
3795         if ( mylen > length*2) {
3796             proto_tree_add_expert_format(tree, pinfo, &ei_isis_lsp_long_clv, tvb, offset, -1,
3797                 "Integral length of prefix neighbor too long (%d vs %d)", mylen, length*2 );
3798             return;
3799         }
3800 
3801         /*
3802          * Lets turn the area address into "standard" 0000.0000.etc
3803          * format string.
3804          */
3805         sbuf =  print_address_prefix( pinfo->pool, tvb, offset+1, mylen );
3806         /* and spit it out */
3807         proto_tree_add_string( tree, hf_isis_lsp_area_address_str, tvb, offset, (mylen+1)/2 + 1, sbuf);
3808 
3809         offset += mylen + 1;
3810         length -= mylen;    /* length already adjusted for len fld*/
3811     }
3812 }
3813 
3814 /*
3815  * Name: dissect_lsp_ipv6_te_router_id()
3816  *
3817  * Description: Decode an IPv6 TE Router ID CLV - code 140.
3818  *
3819  *   Calls into the clv common one.
3820  *
3821  * Input:
3822  *   tvbuff_t * : tvbuffer for packet data
3823  *   proto_tree * : proto tree to build on (may be null)
3824  *   int : current offset into packet data
3825  *   int : length of IDs in packet.
3826  *   int : length of this clv
3827  *
3828  * Output:
3829  *   void, will modify proto_tree if not null.
3830  */
3831 static void
dissect_lsp_ipv6_te_router_id_clv(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,int offset,isis_data_t * isis _U_,int length)3832 dissect_lsp_ipv6_te_router_id_clv(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, int offset,
3833     isis_data_t *isis _U_, int length)
3834 {
3835     isis_dissect_ipv6_int_clv(tree, pinfo, tvb, &ei_isis_lsp_short_clv, offset, length,
3836         hf_isis_lsp_clv_ipv6_te_router_id );
3837 }
3838 
3839 /*
3840  * Name: dissect_lsp_srv6_locator_subclv ()
3841  *
3842  * Description: parses IP reach subTLVs
3843  *              Called by various IP Reachability dissectors.
3844  *
3845  * Input:
3846  *   tvbuff_t * : tvbuffer for packet data
3847  *   packet_info * : expert error misuse reporting
3848  *   proto_tree * : protocol display tree to fill out.
3849  *   int : offset into packet data where we are (beginning of the sub_clv value).
3850  *
3851  * Output:
3852  *   void
3853  */
3854 static void
dissect_lsp_srv6_locator_subclv(tvbuff_t * tvb,packet_info * pinfo,proto_tree * subtree,int offset,int clv_code,int clv_len)3855 dissect_lsp_srv6_locator_subclv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *subtree,
3856                                 int offset, int clv_code, int clv_len)
3857 {
3858     switch (clv_code) {
3859     case 5:
3860         /* SRv6 End SID */
3861         if (clv_len < 20) {
3862             proto_tree_add_expert_format(subtree, pinfo, &ei_isis_lsp_malformed_subtlv, tvb, offset, clv_len,
3863                                          "Invalid SubSub-TLV Length (%d vs 20)", clv_len);
3864             break;
3865         }
3866         proto_tree_add_item(subtree, hf_isis_lsp_clv_srv6_end_sid_flags, tvb, offset, 1, ENC_NA);
3867         proto_tree_add_item(subtree, hf_isis_lsp_clv_srv6_end_sid_endpoint_func, tvb, offset+1, 2, ENC_NA);
3868         proto_tree_add_item(subtree, hf_isis_lsp_clv_srv6_end_sid_sid, tvb, offset+3, 16, ENC_NA);
3869         proto_tree_add_item(subtree, hf_isis_lsp_clv_srv6_end_sid_subsubclvs_len, tvb, offset+19, 1, ENC_NA);
3870         break;
3871     default:
3872         proto_tree_add_expert_format(subtree, pinfo, &ei_isis_lsp_subtlv, tvb,
3873                                      offset, clv_len,
3874                                      "Unknown Sub-TLV: Type: %u, Length: %u", clv_code, clv_len);
3875         break;
3876     }
3877 }
3878 
3879 /*
3880  * Name: dissect_lsp_srv6_locator_clv()
3881  *
3882  * Description: Decode an SRv6 Locator CLV - code 27.
3883  *
3884  *   CALLED BY TLV 27 DISSECTOR
3885  *
3886  * Input:
3887  *   tvbuff_t * : tvbuffer for packet data
3888  *   packet_info * : expert error misuse reporting
3889  *   proto_tree * : proto tree to build on (may be null)
3890  *   int : current offset into packet data
3891  *   int : length of IDs in packet.
3892  *   int : length of this clv
3893  *
3894  * Output:
3895  *   void, will modify proto_tree if not null.
3896  */
3897 static void
dissect_lsp_srv6_locator_clv(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,int offset,isis_data_t * isis _U_,int length)3898 dissect_lsp_srv6_locator_clv(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, int offset,
3899                              isis_data_t *isis _U_, int length)
3900 {
3901     int min_tlv_len = 13;
3902     ws_in6_addr prefix;
3903     guint32 bit_length;
3904     int byte_length;
3905     int i, subtlv_length;
3906     guint clv_code, clv_len;
3907     int clv_offset;
3908     proto_item *ti_subtree = NULL;
3909     proto_tree *subtree = NULL;
3910 
3911     if (length < min_tlv_len) {
3912         proto_tree_add_expert_format(tree, pinfo, &ei_isis_lsp_short_clv, tvb, offset, length,
3913                                      "Short LSP SRv6 locator (%d vs %d)",
3914                                      length, min_tlv_len);
3915         return;
3916     }
3917 
3918     /* MTID */
3919     dissect_lsp_mt_id(tvb, tree, offset);
3920     offset += 2;
3921     length -= 2;
3922 
3923     /* Metric */
3924     proto_tree_add_item(tree, hf_isis_lsp_srv6_loc_metric, tvb, offset, 4, ENC_BIG_ENDIAN);
3925     offset += 4;
3926     length -= 4;
3927 
3928     /* Flags */
3929     proto_tree_add_bitmask(tree, tvb, offset, hf_isis_lsp_srv6_loc_flags,
3930                            ett_isis_lsp_clv_srv6_loc_flags, srv6_locator_flags, ENC_NA);
3931     offset++;
3932     length--;
3933 
3934     /* Algorithm */
3935     proto_tree_add_item(tree, hf_isis_lsp_srv6_loc_alg, tvb, offset, 1, ENC_BIG_ENDIAN);
3936     offset++;
3937     length--;
3938 
3939     /* Locator Size */
3940     bit_length = tvb_get_guint8(tvb, offset);
3941     proto_tree_add_item(tree, hf_isis_lsp_srv6_loc_size, tvb, offset, 1, ENC_BIG_ENDIAN);
3942     offset++;
3943     length--;
3944 
3945     /* Locator */
3946     byte_length = tvb_get_ipv6_addr_with_prefix_len(tvb, offset, &prefix, bit_length);
3947     if (byte_length < 0) {
3948         proto_tree_add_expert_format(tree, pinfo, &ei_isis_lsp_length_invalid, tvb, offset - 1, length,
3949                                      "Invalid locator size %u", bit_length);
3950         return;
3951     }
3952     if (length < byte_length + 1) { /* including Sub-tlv-len */
3953         proto_tree_add_expert_format(tree, pinfo, &ei_isis_lsp_short_clv, tvb, offset, length,
3954                                      "Invalid locator length %u (%d bytes left)",
3955                                      byte_length, length);
3956         return;
3957     }
3958     proto_tree_add_ipv6(tree, hf_isis_lsp_srv6_loc_locator, tvb, offset, byte_length, &prefix);
3959     offset += byte_length;
3960     length -= byte_length;
3961 
3962     /* Sub-TLV Length */
3963     subtlv_length = tvb_get_guint8(tvb, offset);
3964     proto_tree_add_item(tree, hf_isis_lsp_srv6_loc_subclvs_len, tvb, offset, 1, ENC_NA);
3965     offset++;
3966     length--;
3967 
3968     if (length < subtlv_length) {
3969         proto_tree_add_expert_format(tree, pinfo, &ei_isis_lsp_malformed_subtlv, tvb, offset, length,
3970                                      "Invalid Sub-TLV length %d (%d bytes left)",
3971                                      subtlv_length, length);
3972         return;
3973     }
3974 
3975     i = 0;
3976     while (i < subtlv_length) {
3977         clv_offset = offset + i;
3978         clv_code = tvb_get_guint8(tvb, clv_offset);
3979         clv_len  = tvb_get_guint8(tvb, clv_offset+1);
3980         subtree = proto_tree_add_subtree(tree, tvb, clv_offset, clv_len + 2,
3981                                          ett_isis_lsp_clv_srv6_loc_sub_tlv,
3982                                          &ti_subtree, "subTLV");
3983         proto_tree_add_item(subtree, hf_isis_lsp_srv6_loc_sub_tlv_type, tvb, clv_offset, 1, ENC_BIG_ENDIAN);
3984         proto_tree_add_item(subtree, hf_isis_lsp_srv6_loc_sub_tlv_length, tvb, clv_offset+1, 1, ENC_BIG_ENDIAN);
3985         proto_item_append_text(ti_subtree, ": %s (c=%u, l=%u)",
3986                                val_to_str(clv_code, isis_lsp_srv6_loc_sub_tlv_vals, "Unknown"), clv_code, clv_len);
3987         if (i + ((int)clv_len + 2) > subtlv_length) {
3988             proto_tree_add_expert_format(subtree, pinfo, &ei_isis_lsp_malformed_subtlv, tvb, clv_offset+2, (subtlv_length-(i+2)),
3989                                          "Invalid Sub-TLV length %u (%d bytes left)",
3990                                          clv_len, subtlv_length-(i+2));
3991             break;
3992         }
3993         dissect_lsp_srv6_locator_subclv(tvb, pinfo, subtree, clv_offset+2, clv_code, clv_len);
3994         i += (clv_len + 2);
3995     }
3996 }
3997 
3998 /*
3999  * Name: dissect_lsp_purge_orig_id_clv()
4000  *
4001  * Description: Decode a Purge Originator ID CLV - code 13.
4002  *
4003  *   CALLED BY TLV 13 DISSECTOR
4004  *
4005  * Input:
4006  *   tvbuff_t * : tvbuffer for packet data
4007  *   packet_info * : expert error misuse reporting
4008  *   proto_tree * : proto tree to build on (may be null)
4009  *   int : current offset into packet data
4010  *   isis_data_t : data given to subdissectors
4011  *   int : length of clv we are decoding
4012  *
4013  * Output:
4014  *   void, will modify proto_tree if not null.
4015  */
4016 static void
dissect_lsp_purge_orig_id_clv(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,int offset,isis_data_t * isis _U_,int length)4017 dissect_lsp_purge_orig_id_clv(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, int offset,
4018                               isis_data_t *isis _U_, int length)
4019 {
4020     int min_tlv_len = 7;
4021     guint8 num_of_system_ids;
4022     int i;
4023 
4024     if (length < min_tlv_len) {
4025         proto_tree_add_expert_format(tree, pinfo, &ei_isis_lsp_short_clv, tvb, offset, length,
4026                                      "Too short LSP Purge Originator ID (%d vs %d)",
4027                                      length, min_tlv_len);
4028         return;
4029     }
4030 
4031     /* Number of System IDs */
4032     num_of_system_ids = tvb_get_guint8(tvb, offset);
4033     proto_tree_add_item(tree, hf_isis_lsp_purge_orig_id_num, tvb, offset, 1, ENC_NA);
4034     offset++;
4035     length--;
4036 
4037     if (num_of_system_ids != 1 && num_of_system_ids != 2) {
4038         proto_tree_add_expert_format(tree, pinfo, &ei_isis_lsp_malformed_subtlv, tvb, offset, length,
4039                                      "Invalid number of System IDs: %u (should be 1 or 2)",
4040                                      num_of_system_ids);
4041         return;
4042     }
4043     if (length < num_of_system_ids * 6) {
4044         proto_tree_add_expert_format(tree, pinfo, &ei_isis_lsp_malformed_subtlv, tvb, offset, length,
4045                                      "Invalid Purge Originator ID TLV length: %u ",
4046                                      length+1);
4047         return;
4048     }
4049     for (i = 0; i < num_of_system_ids; i++) {
4050         proto_tree_add_item(tree, hf_isis_lsp_purge_orig_id_system_id, tvb, offset, 6, ENC_NA);
4051         offset += 6;
4052         length -= 6;
4053     }
4054 }
4055 
4056 /* rfc6165: MAC Reachability */
4057 static void
dissect_lsp_mac_reachability(tvbuff_t * tvb,packet_info * pinfo _U_,proto_tree * tree,int offset,isis_data_t * isis _U_,int length)4058 dissect_lsp_mac_reachability(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *tree, int offset,
4059                               isis_data_t *isis _U_, int length)
4060 {
4061     int num_macs;
4062     int count;
4063     gboolean is_avaya = TRUE; // JMayer: FIXME Add preference or determine from other parts of packet
4064 
4065     if ((length - 5) % 6) {
4066         proto_tree_add_expert_format(tree, pinfo, &ei_isis_lsp_length_clv, tvb, offset, length,
4067                                      "Unexpected length of MAC Reachability TLV (%d vs 5 + N*6)",
4068                                      length);
4069         return;
4070     }
4071     num_macs = (length -5) / 6;
4072 
4073     proto_tree_add_item(tree, hf_isis_lsp_mac_reachability_topoid_nick, tvb, offset, 2, ENC_NA);
4074     offset += 2;
4075     proto_tree_add_item(tree, hf_isis_lsp_mac_reachability_confidence, tvb, offset, 1, ENC_NA);
4076     offset += 1;
4077     proto_tree_add_item(tree, hf_isis_lsp_mac_reachability_reserved, tvb, offset, 2, ENC_NA);
4078     proto_tree_add_item(tree, hf_isis_lsp_mac_reachability_vlan, tvb, offset, 2, ENC_BIG_ENDIAN);
4079     offset += 2;
4080 
4081     for (count = 1; count <= num_macs; count++) {
4082         if (is_avaya && count == 1 )
4083             proto_tree_add_item(tree, hf_isis_lsp_mac_reachability_chassismac, tvb, offset, 6, ENC_NA);
4084         else if (is_avaya && count == 2)
4085             proto_tree_add_item(tree, hf_isis_lsp_mac_reachability_fanmcast, tvb, offset, 6, ENC_NA);
4086         else
4087             proto_tree_add_item(tree, hf_isis_lsp_mac_reachability_mac, tvb, offset + 5, 6, ENC_NA);
4088         offset += 6;
4089     }
4090 }
4091 
4092 static void
dissect_lsp_avaya_ipvpn(tvbuff_t * tvb,packet_info * pinfo _U_,proto_tree * tree,int offset,isis_data_t * isis _U_,int length)4093 dissect_lsp_avaya_ipvpn(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *tree, int offset,
4094                               isis_data_t *isis _U_, int length)
4095 {
4096     guint subtlvbytes;
4097     proto_item *ti;
4098     proto_item *ti_pfxlen, *ti_prefix;
4099     proto_tree *subtlvtree;
4100     guint subtype;
4101     guint sublength;
4102 
4103     if (length < 15) {
4104         proto_tree_add_expert_format(tree, pinfo, &ei_isis_lsp_short_clv, tvb, offset, length,
4105                                      "Too short LSP Avaya IPVPN (%d vs min 15)",
4106                                      length);
4107         return;
4108     }
4109     proto_tree_add_item(tree, hf_isis_lsp_avaya_ipvpn_unknown, tvb, offset, 4, ENC_NA);
4110     offset += 4;
4111     proto_tree_add_item(tree, hf_isis_lsp_avaya_ipvpn_system_id, tvb, offset, 7, ENC_NA);
4112     offset += 7;
4113     proto_tree_add_item(tree, hf_isis_lsp_avaya_ipvpn_vrfsid, tvb, offset, 3, ENC_BIG_ENDIAN);
4114     offset += 3;
4115     proto_tree_add_item_ret_uint(tree, hf_isis_lsp_avaya_ipvpn_subtlvbytes, tvb, offset, 1, ENC_NA, &subtlvbytes);
4116     offset += 1;
4117 
4118     if ((guint)length != 15+subtlvbytes) {
4119         proto_tree_add_expert_format(tree, pinfo, &ei_isis_lsp_length_clv, tvb, offset, length,
4120                                      "Inconsistent length of LSP Avaya IPVPN with subtlvs (%d vs min %d)",
4121                                      length, 15 + subtlvbytes);
4122         return;
4123     }
4124     while (subtlvbytes > 0) {
4125         if (subtlvbytes == 1) {
4126             proto_tree_add_expert_format(tree, pinfo, &ei_isis_lsp_malformed_subtlv, tvb, offset, length,
4127                                          "Too few bytes remaining for Sub-TLV header (1 vs 2)");
4128             return;
4129         }
4130 	subtype = tvb_get_guint8(tvb, offset);
4131 	sublength = tvb_get_guint8(tvb, offset + 1);
4132         subtlvtree = proto_tree_add_subtree_format(tree, tvb, offset, sublength + 2, ett_isis_lsp_clv_avaya_ipvpn_subtlv, &ti, "%s",
4133                                     val_to_str(subtype, isis_lsp_avaya_ipvpn_subtlv_code_vals, "Unknown"));
4134         proto_tree_add_item(subtlvtree, hf_isis_lsp_avaya_ipvpn_subtlvtype, tvb, offset, 1, ENC_NA);
4135         proto_tree_add_item(subtlvtree, hf_isis_lsp_avaya_ipvpn_subtlvlength, tvb, offset + 1, 1, ENC_NA);
4136         offset += 2;
4137         switch (subtype) {
4138         case 1:   /* Metric Type */
4139             if (sublength != 4) {
4140                 proto_tree_add_expert_format(subtlvtree, pinfo, &ei_isis_lsp_malformed_subtlv, tvb, offset, sublength,
4141                                          "Unexpected Metric Type sub-TLV length (%d vs 4)", sublength);
4142                 offset += sublength;
4143             } else {
4144                 proto_tree_add_item(subtlvtree, hf_isis_lsp_avaya_ipvpn_ipv4_metrictype, tvb, offset, 4, ENC_BIG_ENDIAN);
4145                 offset += 4;
4146             }
4147             break;
4148         case 135: /* IPv4 */
4149             if (sublength != 12) {
4150                 proto_tree_add_expert_format(subtlvtree, pinfo, &ei_isis_lsp_malformed_subtlv, tvb, offset, sublength,
4151                                          "Unexpected IPv4 Reachability sub-TLV length (%d vs 12)", sublength);
4152                 offset += sublength;
4153             } else {
4154                 proto_tree_add_item(subtlvtree, hf_isis_lsp_avaya_ipvpn_ipv4_metric, tvb, offset, 4, ENC_BIG_ENDIAN);
4155                 offset += 4;
4156                 ti_prefix = proto_tree_add_item(subtlvtree, hf_isis_lsp_avaya_ipvpn_ipv4_addr, tvb, offset, 4, ENC_BIG_ENDIAN);
4157                 offset += 4;
4158                 ti_pfxlen = proto_tree_add_item(subtlvtree, hf_isis_lsp_avaya_ipvpn_ipv4_mask, tvb, offset, 4, ENC_BIG_ENDIAN);
4159                 offset += 4;
4160                 proto_item_append_text(ti, ": %s/%s", proto_item_get_display_repr(pinfo->pool, ti_prefix),
4161                                                   proto_item_get_display_repr(pinfo->pool, ti_pfxlen));
4162             }
4163             break;
4164         case 236: /* IPv6 */
4165             if (sublength != 22) {
4166                 proto_tree_add_expert_format(subtlvtree, pinfo, &ei_isis_lsp_malformed_subtlv, tvb, offset, sublength,
4167                                          "Unexpected IPv6 Reachability sub-TLV length (%d vs 22)", sublength);
4168                 offset += sublength;
4169             } else {
4170                 proto_tree_add_item(subtlvtree, hf_isis_lsp_avaya_ipvpn_ipv6_metric, tvb, offset, 4, ENC_BIG_ENDIAN);
4171                 offset += 4;
4172                 ti_pfxlen = proto_tree_add_item(subtlvtree, hf_isis_lsp_avaya_ipvpn_ipv6_prefixlen, tvb, offset, 2, ENC_BIG_ENDIAN);
4173                 offset += 2;
4174                 ti_prefix = proto_tree_add_item(subtlvtree, hf_isis_lsp_avaya_ipvpn_ipv6_prefix, tvb, offset, 16, ENC_NA);
4175                 offset += 16;
4176                 proto_item_append_text(ti, ": %s/%s", proto_item_get_display_repr(pinfo->pool, ti_prefix),
4177                                                   proto_item_get_display_repr(pinfo->pool, ti_pfxlen));
4178             }
4179             break;
4180         default:
4181             proto_tree_add_item(subtlvtree, hf_isis_lsp_avaya_ipvpn_unknown_sub, tvb, offset, sublength, ENC_NA);
4182             proto_tree_add_expert_format(subtlvtree, pinfo, &ei_isis_lsp_unknown_subtlv, tvb, offset, sublength,
4183                                          "Unknown Avaya IPVPN subTLV (%d): Please report to Wireshark developers.", subtype);
4184             offset += sublength;
4185         }
4186         subtlvbytes -= (2 + sublength);
4187     }
4188 }
4189 
4190 static void
dissect_lsp_avaya_ipvpn_mc(tvbuff_t * tvb,packet_info * pinfo _U_,proto_tree * tree,int offset,isis_data_t * isis _U_,int length)4191 dissect_lsp_avaya_ipvpn_mc(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *tree, int offset,
4192                               isis_data_t *isis _U_, int length)
4193 {
4194     proto_tree_add_item(tree, hf_isis_lsp_avaya_185_unknown, tvb, offset, length, ENC_NA);
4195 }
4196 
4197 static void
dissect_lsp_avaya_ip_grt_mc(tvbuff_t * tvb,packet_info * pinfo _U_,proto_tree * tree,int offset,isis_data_t * isis _U_,int length)4198 dissect_lsp_avaya_ip_grt_mc(tvbuff_t *tvb, packet_info* pinfo _U_, proto_tree *tree, int offset,
4199                               isis_data_t *isis _U_, int length)
4200 {
4201     proto_tree_add_item(tree, hf_isis_lsp_avaya_186_unknown, tvb, offset, length, ENC_NA);
4202 }
4203 
4204 static const isis_clv_handle_t clv_l1_lsp_opts[] = {
4205     {
4206         ISIS_CLV_AREA_ADDRESS,
4207         "Area address(es)",
4208         &ett_isis_lsp_clv_area_addr,
4209         dissect_lsp_area_address_clv
4210     },
4211     {
4212         ISIS_CLV_IS_REACH,
4213         "IS Reachability",
4214         &ett_isis_lsp_clv_is_neighbors,
4215         dissect_lsp_l1_is_neighbors_clv
4216     },
4217     {
4218         ISIS_CLV_ES_NEIGHBORS,
4219         "ES Neighbor(s)",
4220         &ett_isis_lsp_clv_is_neighbors,
4221         dissect_lsp_l1_es_neighbors_clv
4222     },
4223     {
4224         ISIS_CLV_INSTANCE_IDENTIFIER,
4225         "Instance Identifier",
4226         &ett_isis_lsp_clv_instance_identifier,
4227         dissect_lsp_instance_identifier_clv
4228     },
4229     {
4230         ISIS_CLV_LSP_BUFFERSIZE,
4231         "Originating neighbor buffer size",
4232         &ett_isis_lsp_clv_originating_buff_size,
4233         dissect_lsp_ori_buffersize_clv
4234     },
4235     {
4236         ISIS_CLV_EXTD_IS_REACH,
4237         "Extended IS reachability",
4238         &ett_isis_lsp_clv_ext_is_reachability,
4239         dissect_lsp_ext_is_reachability_clv
4240     },
4241     {
4242         ISIS_CLV_INT_IP_REACH,
4243         "IP Internal reachability",
4244         &ett_isis_lsp_clv_ip_reachability,
4245         dissect_lsp_ip_reachability_clv
4246     },
4247     {
4248         ISIS_CLV_EXT_IP_REACH,
4249         "IP External reachability",
4250         &ett_isis_lsp_clv_ip_reachability,
4251         dissect_lsp_ip_reachability_clv
4252     },
4253     {
4254         ISIS_CLV_EXTD_IP_REACH,
4255         "Extended IP Reachability",
4256         &ett_isis_lsp_clv_ext_ip_reachability,
4257         dissect_lsp_ext_ip_reachability_clv
4258     },
4259     {
4260         ISIS_CLV_IP6_REACH,
4261         "IPv6 reachability",
4262         &ett_isis_lsp_clv_ipv6_reachability,
4263         dissect_lsp_ipv6_reachability_clv
4264     },
4265     {
4266         ISIS_CLV_PROTOCOLS_SUPPORTED,
4267         "Protocols supported",
4268         &ett_isis_lsp_clv_nlpid_nlpid,
4269         dissect_lsp_nlpid_clv
4270     },
4271     {
4272         ISIS_CLV_HOSTNAME,
4273         "Hostname",
4274         &ett_isis_lsp_clv_hostname,
4275         dissect_lsp_hostname_clv
4276     },
4277     {
4278         ISIS_CLV_SHARED_RISK_GROUP,
4279         "Shared Risk Link Group",
4280         &ett_isis_lsp_clv_srlg,
4281         dissect_lsp_srlg_clv
4282     },
4283     {
4284         ISIS_CLV_TE_ROUTER_ID,
4285         "Traffic Engineering Router ID",
4286         &ett_isis_lsp_clv_te_router_id,
4287         dissect_lsp_te_router_id_clv
4288     },
4289     {
4290         ISIS_CLV_IP_ADDR,
4291         "IP Interface address(es)",
4292         &ett_isis_lsp_clv_ipv4_int_addr,
4293         dissect_lsp_ip_int_addr_clv
4294     },
4295     {
4296         ISIS_CLV_IP6_ADDR,
4297         "IPv6 Interface address(es)",
4298         &ett_isis_lsp_clv_ipv6_int_addr,
4299         dissect_lsp_ipv6_int_addr_clv
4300     },
4301     {
4302         ISIS_CLV_MT_CAP,
4303         "MT-Capability",
4304         &ett_isis_lsp_clv_mt_cap,
4305         dissect_isis_lsp_clv_mt_cap
4306     },
4307     {
4308         ISIS_CLV_SID_LABEL_BINDING,
4309         "SID/Label Binding TLV",
4310         &ett_isis_lsp_clv_sid_label_binding,
4311         dissect_isis_lsp_clv_sid_label_binding
4312     },
4313     {
4314         ISIS_CLV_AUTHENTICATION,
4315         "Authentication",
4316         &ett_isis_lsp_clv_authentication,
4317         dissect_lsp_authentication_clv
4318     },
4319     {
4320         ISIS_CLV_IP_AUTHENTICATION,
4321         "IP Authentication",
4322         &ett_isis_lsp_clv_ip_authentication,
4323         dissect_lsp_ip_authentication_clv
4324     },
4325     {
4326         ISIS_CLV_MT_SUPPORTED,
4327         "Multi Topology supported",
4328         &ett_isis_lsp_clv_mt,
4329         dissect_lsp_mt_clv
4330     },
4331     {
4332         ISIS_CLV_MT_IS_REACH,
4333         "Multi Topology IS Reachability",
4334         &ett_isis_lsp_clv_mt_is,
4335         dissect_lsp_mt_is_reachability_clv
4336     },
4337     {
4338         ISIS_CLV_MT_IP_REACH,
4339         "Multi Topology Reachable IPv4 Prefixes",
4340         &ett_isis_lsp_clv_mt_reachable_IPv4_prefx,
4341         dissect_lsp_mt_reachable_IPv4_prefx_clv
4342     },
4343     {
4344         ISIS_CLV_MT_IP6_REACH,
4345         "Multi Topology Reachable IPv6 Prefixes",
4346         &ett_isis_lsp_clv_mt_reachable_IPv6_prefx,
4347         dissect_lsp_mt_reachable_IPv6_prefx_clv
4348     },
4349     {
4350         ISIS_CLV_RT_CAPABLE,
4351         "Router Capability",
4352         &ett_isis_lsp_clv_rt_capable,
4353         dissect_isis_rt_capable_clv
4354     },
4355     {
4356         ISIS_GRP_ADDR,
4357         "Group Address",
4358         &ett_isis_lsp_clv_grp_address,
4359         dissect_isis_grp_address_clv
4360     },
4361     {
4362         ISIS_CLV_IPV6_TE_ROUTER_ID,
4363         "IPv6 TE Router ID",
4364         &ett_isis_lsp_clv_ipv6_te_router_id,
4365         dissect_lsp_ipv6_te_router_id_clv
4366     },
4367     {
4368         ISIS_CLV_SRV6_LOCATOR,
4369         "SRv6 Locator",
4370         &ett_isis_lsp_clv_srv6_locator,
4371         dissect_lsp_srv6_locator_clv
4372     },
4373     {
4374         ISIS_CLV_PURGE_ORIG_ID,
4375         "Purge Originator ID",
4376         &ett_isis_lsp_clv_purge_orig_id,
4377         dissect_lsp_purge_orig_id_clv
4378     },
4379     {
4380         ISIS_CLV_MAC_RI,
4381         "MAC Reachability",
4382         &ett_isis_lsp_clv_mac_reachability,
4383         dissect_lsp_mac_reachability
4384     },
4385     {
4386         ISIS_CLV_AVAYA_IPVPN,
4387         "Avaya IPVPN",
4388         &ett_isis_lsp_clv_avaya_ipvpn,
4389         dissect_lsp_avaya_ipvpn
4390     },
4391     {
4392         ISIS_CLV_AVAYA_IPVPN_MC,
4393         "Avaya IPVPN MCast",
4394         &ett_isis_lsp_clv_avaya_ipvpn_mc,
4395         dissect_lsp_avaya_ipvpn_mc
4396     },
4397     {
4398         ISIS_CLV_AVAYA_IP_GRT_MC,
4399         "Avaya IP GRT MCast",
4400         &ett_isis_lsp_clv_avaya_ip_grt_mc,
4401         dissect_lsp_avaya_ip_grt_mc
4402     },
4403     {
4404         0,
4405         "",
4406         NULL,
4407         NULL
4408     }
4409 };
4410 
4411 static const isis_clv_handle_t clv_l2_lsp_opts[] = {
4412     {
4413         ISIS_CLV_AREA_ADDRESS,
4414         "Area address(es)",
4415         &ett_isis_lsp_clv_area_addr,
4416         dissect_lsp_area_address_clv
4417     },
4418     {
4419         ISIS_CLV_IS_REACH,
4420         "IS Reachability",
4421         &ett_isis_lsp_clv_is_neighbors,
4422         dissect_lsp_l2_is_neighbors_clv
4423     },
4424     {
4425         ISIS_CLV_EXTD_IS_REACH,
4426         "Extended IS reachability",
4427         &ett_isis_lsp_clv_ext_is_reachability,
4428         dissect_lsp_ext_is_reachability_clv
4429     },
4430     {
4431         ISIS_CLV_PARTITION_DIS,
4432         "Partition Designated Level 2 IS",
4433         &ett_isis_lsp_clv_partition_dis,
4434         dissect_lsp_partition_dis_clv
4435     },
4436     {
4437         ISIS_CLV_PREFIX_NEIGHBORS,
4438         "Prefix neighbors",
4439         &ett_isis_lsp_clv_prefix_neighbors,
4440         dissect_lsp_prefix_neighbors_clv
4441     },
4442     {
4443         ISIS_CLV_INSTANCE_IDENTIFIER,
4444         "Instance Identifier",
4445         &ett_isis_lsp_clv_instance_identifier,
4446         dissect_lsp_instance_identifier_clv
4447     },
4448     {
4449         ISIS_CLV_LSP_BUFFERSIZE,
4450         "Originating neighbor buffer size",
4451         &ett_isis_lsp_clv_originating_buff_size,
4452         dissect_lsp_ori_buffersize_clv
4453     },
4454     {
4455         ISIS_CLV_INT_IP_REACH,
4456         "IP Internal reachability",
4457         &ett_isis_lsp_clv_ip_reachability,
4458         dissect_lsp_ip_reachability_clv
4459     },
4460     {
4461         ISIS_CLV_EXT_IP_REACH,
4462         "IP External reachability",
4463         &ett_isis_lsp_clv_ip_reachability,
4464         dissect_lsp_ip_reachability_clv
4465     },
4466     {
4467         ISIS_CLV_PROTOCOLS_SUPPORTED,
4468         "Protocols supported",
4469         &ett_isis_lsp_clv_nlpid_nlpid,
4470         dissect_lsp_nlpid_clv
4471     },
4472     {
4473         ISIS_CLV_HOSTNAME,
4474         "Hostname",
4475         &ett_isis_lsp_clv_hostname,
4476         dissect_lsp_hostname_clv
4477     },
4478     {
4479         ISIS_CLV_SHARED_RISK_GROUP,
4480         "Shared Risk Link Group",
4481         &ett_isis_lsp_clv_srlg,
4482         dissect_lsp_srlg_clv
4483     },
4484     {
4485         ISIS_CLV_TE_ROUTER_ID,
4486         "Traffic Engineering Router ID",
4487         &ett_isis_lsp_clv_te_router_id,
4488         dissect_lsp_te_router_id_clv
4489     },
4490     {
4491         ISIS_CLV_EXTD_IP_REACH,
4492         "Extended IP Reachability",
4493         &ett_isis_lsp_clv_ext_ip_reachability,
4494         dissect_lsp_ext_ip_reachability_clv
4495     },
4496     {
4497         ISIS_CLV_IP6_REACH,
4498         "IPv6 reachability",
4499         &ett_isis_lsp_clv_ipv6_reachability,
4500         dissect_lsp_ipv6_reachability_clv
4501     },
4502     {
4503         ISIS_CLV_IP_ADDR,
4504         "IP Interface address(es)",
4505         &ett_isis_lsp_clv_ipv4_int_addr,
4506         dissect_lsp_ip_int_addr_clv
4507     },
4508     {
4509         ISIS_CLV_IP6_ADDR,
4510         "IPv6 Interface address(es)",
4511         &ett_isis_lsp_clv_ipv6_int_addr,
4512         dissect_lsp_ipv6_int_addr_clv
4513     },
4514     {
4515         ISIS_CLV_MT_CAP,
4516         "MT-Capability",
4517         &ett_isis_lsp_clv_mt_cap,
4518         dissect_isis_lsp_clv_mt_cap
4519     },
4520     {
4521         ISIS_CLV_SID_LABEL_BINDING,
4522         "SID/Label Binding TLV",
4523         &ett_isis_lsp_clv_sid_label_binding,
4524         dissect_isis_lsp_clv_sid_label_binding
4525     },
4526     {
4527         ISIS_CLV_AUTHENTICATION,
4528         "Authentication",
4529         &ett_isis_lsp_clv_authentication,
4530         dissect_lsp_authentication_clv
4531     },
4532     {
4533         ISIS_CLV_IP_AUTHENTICATION,
4534         "IP Authentication",
4535         &ett_isis_lsp_clv_ip_authentication,
4536         dissect_lsp_ip_authentication_clv
4537     },
4538     {
4539         ISIS_CLV_MT_SUPPORTED,
4540         "Multi Topology",
4541         &ett_isis_lsp_clv_mt,
4542         dissect_lsp_mt_clv
4543     },
4544     {
4545         ISIS_CLV_MT_IS_REACH,
4546         "Multi Topology IS Reachability",
4547         &ett_isis_lsp_clv_mt_is,
4548         dissect_lsp_mt_is_reachability_clv
4549     },
4550     {
4551         ISIS_CLV_MT_IP_REACH,
4552         "Multi Topology Reachable IPv4 Prefixes",
4553         &ett_isis_lsp_clv_mt_reachable_IPv4_prefx,
4554         dissect_lsp_mt_reachable_IPv4_prefx_clv
4555     },
4556     {
4557         ISIS_CLV_MT_IP6_REACH,
4558         "Multi Topology Reachable IPv6 Prefixes",
4559         &ett_isis_lsp_clv_mt_reachable_IPv6_prefx,
4560         dissect_lsp_mt_reachable_IPv6_prefx_clv
4561     },
4562     {
4563         ISIS_CLV_RT_CAPABLE,
4564         "Router Capability",
4565         &ett_isis_lsp_clv_rt_capable,
4566         dissect_isis_rt_capable_clv
4567     },
4568     {
4569         ISIS_CLV_IPV6_TE_ROUTER_ID,
4570         "IPv6 TE Router ID",
4571         &ett_isis_lsp_clv_ipv6_te_router_id,
4572         dissect_lsp_ipv6_te_router_id_clv
4573     },
4574     {
4575         ISIS_CLV_SRV6_LOCATOR,
4576         "SRv6 Locator",
4577         &ett_isis_lsp_clv_srv6_locator,
4578         dissect_lsp_srv6_locator_clv
4579     },
4580     {
4581         ISIS_CLV_PURGE_ORIG_ID,
4582         "Purge Originator ID",
4583         &ett_isis_lsp_clv_purge_orig_id,
4584         dissect_lsp_purge_orig_id_clv
4585     },
4586     {
4587         0,
4588         "",
4589         NULL,
4590         NULL
4591     }
4592 };
4593 
4594 /*
4595  * Name: isis_dissect_isis_lsp()
4596  *
4597  * Description:
4598  *    Print out the LSP part of the main header and then call the CLV
4599  *    de-mangler with the right list of valid CLVs.
4600  *
4601  * Input:
4602  *    tvbuff_t * : tvbuffer for packet data
4603  *    proto_tree * : protocol display tree to add to.  May be NULL.
4604  *    int offset : our offset into packet data.
4605  *    int : LSP type, a la packet-isis.h ISIS_TYPE_* values
4606  *    int : header length of packet.
4607  *    int : length of IDs in packet.
4608  *
4609  * Output:
4610  *      void, but we will add to proto tree if !NULL.
4611  */
4612 static void
dissect_isis_lsp(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,int offset,const isis_clv_handle_t * opts,isis_data_t * isis)4613 dissect_isis_lsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset,
4614     const isis_clv_handle_t *opts, isis_data_t *isis)
4615 {
4616     proto_item    *ti;
4617     proto_tree    *lsp_tree, *info_tree;
4618     guint16        pdu_length, lifetime, checksum, cacl_checksum=0;
4619     gboolean       pdu_length_too_short = FALSE;
4620     gboolean       pdu_length_too_long = FALSE;
4621     guint8         lsp_info;
4622     int            offset_checksum;
4623     char          *system_id;
4624 
4625     /*
4626      * We are passed a tvbuff for the entire ISIS PDU, because some ISIS
4627      * PDUs may contain a checksum CLV, and that's a checksum covering
4628      * the entire PDU.  Skip the part of the header that's already been
4629      * dissected.
4630      */
4631     offset += 8;
4632 
4633     col_set_str(pinfo->cinfo, COL_PROTOCOL, "ISIS LSP");
4634 
4635     ti = proto_tree_add_item(tree, proto_isis_lsp, tvb, offset, -1, ENC_NA);
4636     lsp_tree = proto_item_add_subtree(ti, ett_isis_lsp);
4637 
4638     if (isis->header_length < 8 + 2) {
4639         /* Not large enough to include the part of the header that
4640            we dissect here. */
4641         expert_add_info(pinfo, isis->header_length_item, isis->ei_bad_header_length);
4642         return;
4643     }
4644     pdu_length = tvb_get_ntohs(tvb, offset);
4645     ti = proto_tree_add_uint(lsp_tree, hf_isis_lsp_pdu_length, tvb,
4646             offset, 2, pdu_length);
4647     if (pdu_length < isis->header_length) {
4648         expert_add_info(pinfo, ti, &ei_isis_lsp_short_pdu);
4649         pdu_length_too_short = TRUE;
4650     } else if (pdu_length > tvb_reported_length(tvb) + isis->header_length) {
4651         expert_add_info(pinfo, ti, &ei_isis_lsp_long_pdu);
4652         pdu_length_too_long = TRUE;
4653     }
4654     offset += 2;
4655 
4656     if (isis->header_length < 8 + 2 + 2) {
4657         /* Not large enough to include the part of the header that
4658            we dissect here. */
4659         expert_add_info(pinfo, isis->header_length_item, isis->ei_bad_header_length);
4660         return;
4661     }
4662     proto_tree_add_item(lsp_tree, hf_isis_lsp_remaining_life,
4663             tvb, offset, 2, ENC_BIG_ENDIAN);
4664     lifetime = tvb_get_ntohs(tvb, offset);
4665     offset += 2;
4666 
4667     /* Checksumming starts with the LSP ID */
4668     offset_checksum = offset;
4669 
4670     if (isis->header_length < 8 + 2 + 2 + isis->system_id_len + 2) {
4671         /* Not large enough to include the part of the header that
4672            we dissect here. */
4673         expert_add_info(pinfo, isis->header_length_item, isis->ei_bad_header_length);
4674         return;
4675     }
4676     proto_tree_add_item(lsp_tree, hf_isis_lsp_lsp_id, tvb, offset, isis->system_id_len + 2, ENC_NA);
4677     system_id = tvb_print_system_id( pinfo->pool, tvb, offset, isis->system_id_len+2 );
4678     col_append_fstr(pinfo->cinfo, COL_INFO, ", LSP-ID: %s", system_id);
4679     offset += (isis->system_id_len + 2);
4680 
4681     if (isis->header_length < 8 + 2 + 2 + isis->system_id_len + 2 + 4) {
4682         /* Not large enough to include the part of the header that
4683            we dissect here. */
4684         expert_add_info(pinfo, isis->header_length_item, isis->ei_bad_header_length);
4685         return;
4686     }
4687     proto_tree_add_item(lsp_tree, hf_isis_lsp_sequence_number,
4688             tvb, offset, 4, ENC_BIG_ENDIAN);
4689     col_append_fstr(pinfo->cinfo, COL_INFO, ", Sequence: 0x%08x, Lifetime: %5us",
4690             tvb_get_ntohl(tvb, offset),
4691             tvb_get_ntohs(tvb, offset - (isis->system_id_len+2+2)));
4692     offset += 4;
4693 
4694     if (isis->header_length < 8 + 2 + 2 + isis->system_id_len + 2 + 4 + 2) {
4695         /* Not large enough to include the part of the header that
4696            we dissect here. */
4697         expert_add_info(pinfo, isis->header_length_item, isis->ei_bad_header_length);
4698         return;
4699     }
4700     checksum = lifetime ? tvb_get_ntohs(tvb, offset) : 0;
4701     if (checksum == 0) {
4702         /* No checksum present */
4703         proto_tree_add_checksum(lsp_tree, tvb, offset, hf_isis_lsp_checksum, hf_isis_lsp_checksum_status, &ei_isis_lsp_bad_checksum, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NOT_PRESENT);
4704     } else if (pdu_length_too_short || pdu_length_too_long) {
4705         /* Length bogus, so we can't check the checksum */
4706         proto_tree_add_checksum(lsp_tree, tvb, offset, hf_isis_lsp_checksum, hf_isis_lsp_checksum_status, &ei_isis_lsp_bad_checksum, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
4707     } else {
4708         if (osi_check_and_get_checksum(tvb, offset_checksum, pdu_length-12, offset, &cacl_checksum)) {
4709             /* Successfully processed checksum, verify it */
4710             proto_tree_add_checksum(lsp_tree, tvb, offset, hf_isis_lsp_checksum, hf_isis_lsp_checksum_status, &ei_isis_lsp_bad_checksum, pinfo, cacl_checksum, ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
4711             if (cacl_checksum != checksum) {
4712                 col_append_str(pinfo->cinfo, COL_INFO, " [ISIS CHECKSUM INCORRECT]");
4713             }
4714         } else {
4715             /* We didn't capture the entire packet, so we can't verify it */
4716             proto_tree_add_checksum(lsp_tree, tvb, offset, hf_isis_lsp_checksum, hf_isis_lsp_checksum_status, &ei_isis_lsp_bad_checksum, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
4717         }
4718     }
4719     offset += 2;
4720 
4721     if (isis->header_length < 8 + 2 + 2 + isis->system_id_len + 2 + 4 + 2 + 1) {
4722         /* Not large enough to include the part of the header that
4723            we dissect here. */
4724         expert_add_info(pinfo, isis->header_length_item, isis->ei_bad_header_length);
4725         return;
4726     }
4727     if (tree) {
4728         static int * const attach_flags[] = {
4729             &hf_isis_lsp_error_metric,
4730             &hf_isis_lsp_expense_metric,
4731             &hf_isis_lsp_delay_metric,
4732             &hf_isis_lsp_default_metric,
4733             NULL
4734         };
4735 
4736         /*
4737          * P | ATT | HIPPITY | IS TYPE description.
4738          */
4739         lsp_info = tvb_get_guint8(tvb, offset);
4740         info_tree = proto_tree_add_subtree_format(lsp_tree, tvb, offset, 1, ett_isis_lsp_info, NULL,
4741             "Type block(0x%02x): Partition Repair:%d, Attached bits:%d, Overload bit:%d, IS type:%d",
4742             lsp_info,
4743             ISIS_LSP_PARTITION(lsp_info),
4744             ISIS_LSP_ATT(lsp_info),
4745             ISIS_LSP_HIPPITY(lsp_info),
4746             ISIS_LSP_IS_TYPE(lsp_info)
4747             );
4748 
4749         proto_tree_add_boolean(info_tree, hf_isis_lsp_p, tvb, offset, 1, lsp_info);
4750         proto_tree_add_bitmask_with_flags(info_tree, tvb, offset, hf_isis_lsp_att,
4751                            ett_isis_lsp_att, attach_flags, ENC_NA, BMT_NO_APPEND);
4752         proto_tree_add_boolean(info_tree, hf_isis_lsp_hippity, tvb, offset, 1, lsp_info);
4753         proto_tree_add_uint(info_tree, hf_isis_lsp_is_type, tvb, offset, 1, lsp_info);
4754     }
4755     offset += 1;
4756 
4757     if (pdu_length_too_short) {
4758         return;
4759     }
4760     /*
4761      * Now, we need to decode our CLVs.  We need to pass in
4762      * our list of valid ones!
4763      */
4764     isis->pdu_length = pdu_length;
4765     isis_dissect_clvs(tvb, pinfo, lsp_tree, offset,
4766             opts, &ei_isis_lsp_short_clv, isis, ett_isis_lsp_clv_unknown,
4767             hf_isis_lsp_clv_type, hf_isis_lsp_clv_length,
4768             &ei_isis_lsp_clv_unknown);
4769 }
4770 
4771 static int
dissect_isis_l1_lsp(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data)4772 dissect_isis_l1_lsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
4773 {
4774     isis_data_t* isis = (isis_data_t*)data;
4775     dissect_isis_lsp(tvb, pinfo, tree, 0, clv_l1_lsp_opts, isis);
4776     return tvb_reported_length(tvb);
4777 }
4778 
4779 static int
dissect_isis_l2_lsp(tvbuff_t * tvb,packet_info * pinfo,proto_tree * tree,void * data)4780 dissect_isis_l2_lsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
4781 {
4782     isis_data_t* isis = (isis_data_t*)data;
4783     dissect_isis_lsp(tvb, pinfo, tree, 0, clv_l2_lsp_opts, isis);
4784     return tvb_reported_length(tvb);
4785 }
4786 
4787 /*
4788  * The "supported" bit in a metric is actually the "not supported" bit;
4789  * if it's *clear*, the metric is supported, and if it's *set*, the
4790  * metric is not supported.
4791  */
4792 
4793 void
proto_register_isis_lsp(void)4794 proto_register_isis_lsp(void)
4795 {
4796     static hf_register_info hf[] = {
4797         { &hf_isis_lsp_pdu_length,
4798             { "PDU length", "isis.lsp.pdu_length",
4799               FT_UINT16, BASE_DEC,
4800               NULL, 0x0, NULL, HFILL }
4801         },
4802 
4803         { &hf_isis_lsp_remaining_life,
4804             { "Remaining lifetime", "isis.lsp.remaining_life",
4805               FT_UINT16, BASE_DEC, NULL, 0x0,
4806               NULL, HFILL }
4807         },
4808 
4809         { &hf_isis_lsp_lsp_id,
4810             { "LSP-ID", "isis.lsp.lsp_id",
4811               FT_SYSTEM_ID, BASE_NONE, NULL, 0x0,
4812               NULL, HFILL }
4813         },
4814 
4815         { &hf_isis_lsp_hostname,
4816             { "Hostname", "isis.lsp.hostname",
4817               FT_STRING, BASE_NONE, NULL, 0x0,
4818               NULL, HFILL }
4819         },
4820 
4821         { &hf_isis_lsp_srlg_system_id,
4822             { "System ID", "isis.lsp.srlg.system_id",
4823               FT_SYSTEM_ID, BASE_NONE, NULL, 0x0,
4824               NULL, HFILL }
4825         },
4826 
4827         { &hf_isis_lsp_srlg_pseudo_num,
4828             { "Pseudonode num", "isis.lsp.srlg.pseudo_num",
4829               FT_UINT8, BASE_DEC, NULL, 0x0,
4830               NULL, HFILL }
4831         },
4832 
4833         { &hf_isis_lsp_srlg_flags_numbered,
4834             { "Numbered", "isis.lsp.srlg.flags_numbered",
4835               FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x01,
4836               NULL, HFILL }
4837         },
4838 
4839         { &hf_isis_lsp_srlg_ipv4_local,
4840             { "IPv4 interface address/Link Local Identifier", "isis.lsp.srlg.ipv4_local",
4841               FT_IPv4, BASE_NONE, NULL, 0x0,
4842               NULL, HFILL }
4843         },
4844 
4845         { &hf_isis_lsp_srlg_ipv4_remote,
4846             { "IPv4 neighbor address/Link remote Identifier", "isis.lsp.srlg.ipv4_remote",
4847               FT_IPv4, BASE_NONE, NULL, 0x0,
4848               NULL, HFILL }
4849         },
4850 
4851         { &hf_isis_lsp_srlg_value,
4852             { "Shared Risk Link Group Value", "isis.lsp.srlg.value",
4853               FT_UINT32, BASE_DEC_HEX, NULL, 0x0,
4854               NULL, HFILL }
4855         },
4856 
4857         { &hf_isis_lsp_sequence_number,
4858             { "Sequence number", "isis.lsp.sequence_number",
4859               FT_UINT32, BASE_HEX, NULL, 0x0,
4860               NULL, HFILL }
4861         },
4862 
4863         { &hf_isis_lsp_checksum,
4864             { "Checksum", "isis.lsp.checksum",
4865               FT_UINT16, BASE_HEX, NULL, 0x0,
4866               NULL, HFILL }
4867         },
4868 
4869         { &hf_isis_lsp_checksum_status,
4870             { "Checksum Status", "isis.lsp.checksum.status",
4871               FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x0,
4872               NULL, HFILL }
4873         },
4874 
4875         { &hf_isis_lsp_clv_ipv4_int_addr,
4876             { "IPv4 interface address", "isis.lsp.clv_ipv4_int_addr",
4877               FT_IPv4, BASE_NONE, NULL, 0x0,
4878               NULL, HFILL }
4879         },
4880 
4881         { &hf_isis_lsp_clv_ipv6_int_addr,
4882             { "IPv6 interface address", "isis.lsp.clv_ipv6_int_addr",
4883               FT_IPv6, BASE_NONE, NULL, 0x0,
4884               NULL, HFILL }
4885         },
4886 
4887         { &hf_isis_lsp_clv_te_router_id,
4888             { "Traffic Engineering Router ID", "isis.lsp.clv_te_router_id",
4889               FT_IPv4, BASE_NONE, NULL, 0x0,
4890               NULL, HFILL }
4891         },
4892 
4893         { &hf_isis_lsp_clv_mt,
4894             { "MT-ID", "isis.lsp.clv_mt",
4895               FT_UINT16, BASE_HEX, NULL, 0x0,
4896               NULL, HFILL }
4897         },
4898 
4899         { &hf_isis_lsp_p,
4900             { "Partition Repair", "isis.lsp.partition_repair",
4901               FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), ISIS_LSP_PARTITION_MASK,
4902               "If set, this router supports the optional Partition Repair function", HFILL }
4903         },
4904 
4905         { &hf_isis_lsp_att,
4906             { "Attachment", "isis.lsp.att",
4907               FT_UINT8, BASE_DEC, NULL, ISIS_LSP_ATT_MASK,
4908               NULL, HFILL }
4909         },
4910 
4911         { &hf_isis_lsp_hippity,
4912             { "Overload bit", "isis.lsp.overload",
4913               FT_BOOLEAN, 8, TFS(&tfs_set_notset), ISIS_LSP_HIPPITY_MASK,
4914               "If set, this router will not be used by any decision process to calculate routes", HFILL }
4915         },
4916 
4917         { &hf_isis_lsp_root_id,
4918             { "Root Bridge ID", "isis.lsp.root.id",
4919               FT_SYSTEM_ID, BASE_NONE, NULL, 0x0,
4920               NULL, HFILL }
4921         },
4922 
4923         { &hf_isis_lsp_is_type,
4924             { "Type of Intermediate System", "isis.lsp.is_type",
4925               FT_UINT8, BASE_DEC, VALS(isis_lsp_istype_vals), ISIS_LSP_IS_TYPE_MASK,
4926               NULL, HFILL }
4927         },
4928 
4929         { &hf_isis_lsp_clv_type,
4930             { "Type", "isis.lsp.clv.type",
4931               FT_UINT8, BASE_DEC, NULL, 0x0,
4932               NULL, HFILL }
4933         },
4934 
4935         { &hf_isis_lsp_clv_length,
4936             { "Length", "isis.lsp.clv.length",
4937               FT_UINT8, BASE_DEC, NULL, 0x0,
4938               NULL, HFILL }
4939         },
4940 
4941         { &hf_isis_lsp_bw_ct_model,
4942             { "Bandwidth Constraints Model Id", "isis.lsp.bw_ct.model",
4943               FT_UINT8, BASE_DEC, NULL, 0,
4944               NULL, HFILL }
4945         },
4946         { &hf_isis_lsp_bw_ct_reserved,
4947             { "Reserved", "isis.lsp.bw_ct.rsv",
4948               FT_UINT24, BASE_HEX, NULL, 0,
4949               NULL, HFILL }
4950         },
4951         { &hf_isis_lsp_bw_ct0,
4952             { "Bandwidth Constraints 0", "isis.lsp.bw_ct.0",
4953               FT_FLOAT, BASE_NONE, NULL, 0,
4954               NULL, HFILL }
4955         },
4956         { &hf_isis_lsp_bw_ct1,
4957             { "Bandwidth Constraints 1", "isis.lsp.bw_ct.1",
4958               FT_FLOAT, BASE_NONE, NULL, 0,
4959               NULL, HFILL }
4960         },
4961         { &hf_isis_lsp_bw_ct2,
4962             { "Bandwidth Constraints 2", "isis.lsp.bw_ct.2",
4963               FT_FLOAT, BASE_NONE, NULL, 0,
4964               NULL, HFILL }
4965         },
4966         { &hf_isis_lsp_bw_ct3,
4967             { "Bandwidth Constraints 3", "isis.lsp.bw_ct.3",
4968               FT_FLOAT, BASE_NONE, NULL, 0,
4969               NULL, HFILL }
4970         },
4971         { &hf_isis_lsp_bw_ct4,
4972             { "Bandwidth Constraints 4", "isis.lsp.bw_ct.4",
4973               FT_FLOAT, BASE_NONE, NULL, 0,
4974               NULL, HFILL }
4975         },
4976         { &hf_isis_lsp_bw_ct5,
4977             { "Bandwidth Constraints 5", "isis.lsp.bw_ct.5",
4978               FT_FLOAT, BASE_NONE, NULL, 0,
4979               NULL, HFILL }
4980         },
4981         { &hf_isis_lsp_bw_ct6,
4982             { "Bandwidth Constraints 6", "isis.lsp.bw_ct.6",
4983               FT_FLOAT, BASE_NONE, NULL, 0,
4984               NULL, HFILL }
4985         },
4986         { &hf_isis_lsp_bw_ct7,
4987             { "Bandwidth Constraints 7", "isis.lsp.bw_ct.7",
4988               FT_FLOAT, BASE_NONE, NULL, 0,
4989               NULL, HFILL }
4990         },
4991 
4992         { &hf_isis_lsp_spb_link_metric,
4993             { "SPB Link Metric", "isis.lsp.spb.link_metric",
4994               FT_UINT24, BASE_HEX_DEC, NULL, 0,
4995               NULL, HFILL }
4996         },
4997 
4998         { &hf_isis_lsp_spb_port_count,
4999             { "Number of Ports", "isis.lsp.spb.port_count",
5000               FT_UINT8, BASE_DEC, NULL, 0,
5001               NULL, HFILL }
5002         },
5003 
5004         { &hf_isis_lsp_spb_port_id,
5005             { "Port Id", "isis.lsp.spb.port_id",
5006               FT_UINT16, BASE_HEX_DEC, NULL, 0,
5007               NULL, HFILL }
5008         },
5009 
5010         { &hf_isis_lsp_adj_sid_flags,
5011             { "Flags", "isis.lsp.adj_sid.flags",
5012               FT_UINT8, BASE_HEX, NULL, 0x0,
5013               NULL, HFILL }
5014         },
5015 
5016         { &hf_isis_lsp_adj_sid_family_flag,
5017             { "Outgoing Encapsulation", "isis.lsp.adj_sid.flags.f",
5018               FT_BOOLEAN, 8, TFS(&tfs_ipv6_ipv4), 0x80,
5019               NULL, HFILL }
5020         },
5021 
5022         { &hf_isis_lsp_adj_sid_backup_flag,
5023             { "Backup", "isis.lsp.adj_sid.flags.b",
5024               FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x40,
5025               NULL, HFILL }
5026         },
5027 
5028         { &hf_isis_lsp_adj_sid_value_flag,
5029             { "Value", "isis.lsp.adj_sid.flags.v",
5030               FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x20,
5031               NULL, HFILL }
5032         },
5033 
5034         { &hf_isis_lsp_adj_sid_local_flag,
5035             { "Local Significance", "isis.lsp.adj_sid.flags.l",
5036               FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x10,
5037               NULL, HFILL }
5038         },
5039 
5040         { &hf_isis_lsp_adj_sid_set_flag,
5041             { "Set", "isis.lsp.adj_sid.flags.s",
5042               FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x8,
5043               NULL, HFILL }
5044         },
5045 
5046         { &hf_isis_lsp_adj_sid_weight,
5047             { "Weight", "isis.lsp.adj_sid.weight",
5048               FT_UINT8, BASE_HEX, NULL, 0x0,
5049               NULL, HFILL }
5050         },
5051 
5052         { &hf_isis_lsp_adj_sid_system_id,
5053             { "System-ID", "isis.lsp.adj_sid.system_id",
5054               FT_SYSTEM_ID, BASE_NONE, NULL, 0x0,
5055               NULL, HFILL }
5056         },
5057 
5058         { &hf_isis_lsp_sid_sli_label,
5059             { "SID/Label/Index", "isis.lsp.sid.sli_label",
5060               FT_UINT24, BASE_DEC, NULL, 0xFFFFF,
5061               NULL, HFILL }
5062         },
5063 
5064         { &hf_isis_lsp_sid_sli_index,
5065             { "SID/Label/Index", "isis.lsp.sid.sli_index",
5066               FT_UINT32, BASE_HEX, NULL, 0x0,
5067               NULL, HFILL }
5068         },
5069 
5070         { &hf_isis_lsp_sid_sli_ipv6,
5071             { "SID/Label/Index", "isis.lsp.sid.sli_ipv6",
5072               FT_IPv6, BASE_NONE, NULL, 0x0,
5073               NULL, HFILL }
5074         },
5075 
5076         { &hf_isis_lsp_spb_reserved,
5077             { "SR Bit", "isis.lsp.spb.reserved",
5078               FT_UINT16, BASE_DEC, NULL, 0xC000,
5079               NULL, HFILL }
5080         },
5081 
5082         { &hf_isis_lsp_spb_sr_bit,
5083             { "SR Bit", "isis.lsp.spb.sr_bit",
5084               FT_UINT16, BASE_DEC, NULL, 0x3000,
5085               NULL, HFILL }
5086         },
5087 
5088         { &hf_isis_lsp_spb_spvid,
5089             { "SPVID", "isis.lsp.spb.spvid",
5090               FT_UINT16, BASE_HEX_DEC, NULL, 0x0FFF,
5091               NULL, HFILL }
5092         },
5093         { &hf_isis_lsp_spb_short_mac_address_t,
5094             { "T", "isis.lsp.spb.mac_address.t",
5095               FT_BOOLEAN, 8, NULL, 0x80,
5096               NULL, HFILL }
5097         },
5098         { &hf_isis_lsp_spb_short_mac_address_r,
5099             { "R", "isis.lsp.spb.mac_address.r",
5100               FT_BOOLEAN, 8, NULL, 0x40,
5101               NULL, HFILL }
5102         },
5103         { &hf_isis_lsp_spb_short_mac_address_reserved,
5104             { "Reserved", "isis.lsp.spb.mac_address.reserved",
5105               FT_UINT8, BASE_DEC, NULL, 0x3F,
5106               NULL, HFILL }
5107         },
5108         { &hf_isis_lsp_spb_short_mac_address,
5109             { "MAC Address", "isis.lsp.spb.mac_address",
5110               FT_ETHER, BASE_NONE, NULL, 0x00,
5111               NULL, HFILL }
5112         },
5113       /* TLV 149 draft-previdi-isis-segmentrouting-extensions */
5114         { &hf_isis_lsp_sl_binding_flags,
5115             { "TLV Flags", "isis.lsp.sl_binding.flags",
5116               FT_UINT8, BASE_HEX, NULL, 0,
5117               NULL, HFILL }
5118         },
5119         { &hf_isis_lsp_sl_binding_flags_f,
5120             { "Flag F: Address Family", "isis.lsp.sl_binding.flags_f",
5121               FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x80,
5122               NULL, HFILL}
5123         },
5124         { &hf_isis_lsp_sl_binding_flags_m,
5125             { "Flag M: Mirror Context", "isis.lsp.sl_binding.flags_m",
5126               FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x40,
5127               NULL, HFILL}
5128         },
5129         { &hf_isis_lsp_sl_binding_flags_s,
5130             { "Flag S", "isis.lsp.sl_binding.flags_s",
5131               FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x20,
5132               "If set, the SID/Label Binding TLV SHOULD be flooded across the entire routing domain", HFILL}
5133         },
5134         { &hf_isis_lsp_sl_binding_flags_d,
5135             { "Flag D", "isis.lsp.sl_binding.flags_d",
5136               FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x10,
5137               "when the SID/Label Binding TLV is leaked from level-2 to level-1", HFILL}
5138         },
5139         { &hf_isis_lsp_sl_binding_flags_a,
5140             { "Flag A: Attached", "isis.lsp.sl_binding.flags_a",
5141               FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x08,
5142               NULL, HFILL}
5143         },
5144         { &hf_isis_lsp_sl_binding_flags_rsv,
5145             { "Flag reserved", "isis.lsp.sl_binding.flags_rsv",
5146               FT_UINT8, BASE_HEX, NULL, 0x07,
5147               NULL, HFILL}
5148         },
5149         { &hf_isis_lsp_sl_binding_weight,
5150             { "Weight", "isis.lsp.sl_binding.weight",
5151               FT_UINT8, BASE_DEC, NULL, 0,
5152               NULL, HFILL}
5153         },
5154         { &hf_isis_lsp_sl_binding_range,
5155             { "Range", "isis.lsp.sl_binding.range",
5156               FT_UINT16, BASE_DEC, NULL, 0,
5157               NULL, HFILL}
5158         },
5159         { &hf_isis_lsp_sl_binding_prefix_length,
5160             { "Prefix length", "isis.lsp.sl_binding.prefix_len",
5161               FT_UINT8, BASE_DEC, NULL, 0,
5162               NULL, HFILL}
5163         },
5164         { &hf_isis_lsp_sl_binding_fec_prefix_ipv4,
5165             { "Prefix", "isis.lsp.sl_binding.prefix_ipv4",
5166               FT_IPv4, BASE_NONE, NULL, 0,
5167               NULL, HFILL}
5168         },
5169         { &hf_isis_lsp_sl_binding_fec_prefix_ipv6,
5170             { "Prefix", "isis.lsp.sl_binding.prefix_ipv6",
5171               FT_IPv6, BASE_NONE, NULL, 0,
5172               NULL, HFILL}
5173         },
5174         { &hf_isis_lsp_sl_sub_tlv,
5175             { "SID/Label sub-TLV :", "isis.lsp.sl_binding.subtlv",
5176               FT_NONE, BASE_NONE, NULL, 0,
5177               NULL, HFILL}
5178         },
5179         { &hf_isis_lsp_sl_sub_tlv_type,
5180             { "SID/label sub-TLV type", "isis.lsp.sl_sub_tlv_type",
5181               FT_UINT8, BASE_DEC, VALS(isis_lsp_sl_sub_tlv_vals), 0,
5182               NULL, HFILL}
5183         },
5184         { &hf_isis_lsp_sl_sub_tlv_length,
5185             { "Sub-TLV length", "isis.lsp.sl_binding.sub_tlv_len",
5186               FT_UINT8, BASE_DEC, NULL, 0,
5187               NULL, HFILL}
5188         },
5189         { &hf_isis_lsp_sl_sub_tlv_label_20,
5190             { "SID/Label", "isis.lsp.sl_sub_tlv.label20",
5191               FT_UINT24, BASE_DEC, NULL, 0x0FFFFF,
5192               NULL, HFILL}
5193         },
5194         { &hf_isis_lsp_sl_sub_tlv_label_32,
5195             { "SID/Label", "isis.lsp.sl_sub_tlv.label32",
5196               FT_UINT32, BASE_DEC, NULL, 0x0,
5197               NULL, HFILL}
5198         },
5199         { &hf_isis_lsp_sl_sub_tlv_flags,
5200             { "sub-TLV Flags", "isis.lsp.sl_sub_tlv.flags",
5201               FT_UINT8, BASE_HEX, NULL, 0,
5202               NULL, HFILL }
5203         },
5204         { &hf_isis_lsp_sl_sub_tlv_flags_r,
5205             { "Flag R: Re-advertisement", "isis.lsp.sl_sub_tlv.flags_r",
5206               FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x80,
5207               NULL, HFILL}
5208         },
5209         { &hf_isis_lsp_sl_sub_tlv_flags_n,
5210             { "Flag N: Node-SID", "isis.lsp.sl_sub_tlv.flags_n",
5211               FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x40,
5212               NULL, HFILL}
5213         },
5214         { &hf_isis_lsp_sl_sub_tlv_flags_p,
5215             { "Flag P: no-PHP", "isis.lsp.sl_sub_tlv.flags_p",
5216               FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x20,
5217               NULL, HFILL}
5218         },
5219         { &hf_isis_lsp_sl_sub_tlv_flags_e,
5220             { "Flag E: Explicit-Null", "isis.lsp.sl_sub_tlv.flags_e",
5221               FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x10,
5222               NULL, HFILL}
5223         },
5224         { &hf_isis_lsp_sl_sub_tlv_flags_v,
5225             { "Flag V: Value", "isis.lsp.sl_sub_tlv.flags_v",
5226               FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x08,
5227               NULL, HFILL}
5228         },
5229         { &hf_isis_lsp_sl_sub_tlv_flags_l,
5230             { "Flag L: Local", "isis.lsp.sl_sub_tlv.flags_l",
5231               FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x04,
5232               NULL, HFILL}
5233         },
5234         { &hf_isis_lsp_sl_sub_tlv_flags_rsv,
5235             { "Flag reserved", "isis.lsp.sl_sub_tlv.flags_rsv",
5236               FT_UINT8, BASE_HEX, NULL, 0x03,
5237               NULL, HFILL}
5238         },
5239         { &hf_isis_lsp_sl_sub_tlv_algorithm,
5240             { "Algorithm", "isis.lsp.sl_sub_tlv.algorithm",
5241               FT_UINT8, BASE_DEC, NULL, 0x0,
5242               NULL, HFILL}
5243         },
5244 
5245         /* Generated from convert_proto_tree_add_text.pl */
5246         { &hf_isis_lsp_mt_id_reserved,
5247             { "Reserved", "isis.lsp.reserved",
5248               FT_UINT16, BASE_HEX, NULL, ISIS_LSP_MT_MSHIP_RES_MASK,
5249             NULL, HFILL}
5250         },
5251         { &hf_isis_lsp_mt_id,
5252             { "Topology ID", "isis.lsp.mtid",
5253               FT_UINT16, BASE_DEC|BASE_RANGE_STRING, RVALS(mtid_strings), 0x0fff,
5254               NULL, HFILL }
5255         },
5256         { &hf_isis_lsp_ip_reachability_ipv4_prefix,
5257             { "IPv4 prefix", "isis.lsp.ip_reachability.ipv4_prefix",
5258               FT_IPv4, BASE_NONE, NULL, 0x0,
5259               NULL, HFILL }
5260         },
5261         { &hf_isis_lsp_ip_reachability_default_metric,
5262             { "Default Metric", "isis.lsp.ip_reachability.default_metric",
5263               FT_UINT8, BASE_DEC, NULL, 0x3F,
5264               NULL, HFILL }
5265         },
5266         { &hf_isis_lsp_ip_reachability_delay_metric,
5267             { "Delay Metric", "isis.lsp.ip_reachability.delay_metric",
5268               FT_UINT8, BASE_DEC, NULL, 0x3F,
5269               NULL, HFILL }
5270         },
5271         { &hf_isis_lsp_ip_reachability_expense_metric,
5272             { "Expense Metric", "isis.lsp.ip_reachability.expense_metric",
5273               FT_UINT8, BASE_DEC, NULL, 0x3F,
5274               NULL, HFILL }
5275         },
5276         { &hf_isis_lsp_ip_reachability_error_metric,
5277             { "Error Metric", "isis.lsp.ip_reachability.error_metric",
5278               FT_UINT8, BASE_DEC, NULL, 0x3F,
5279               NULL, HFILL }
5280         },
5281         { &hf_isis_lsp_ext_ip_reachability_subclvs_len,
5282             { "SubCLV Length", "isis.lsp.ext_ip_reachability.subclvs_length",
5283               FT_UINT8, BASE_DEC, NULL, 0x0,
5284               NULL, HFILL }
5285         },
5286         { &hf_isis_lsp_ext_ip_reachability_code,
5287             { "Code", "isis.lsp.ext_ip_reachability.code",
5288               FT_UINT8, BASE_DEC, VALS(isis_lsp_ext_ip_reachability_code_vals), 0x0,
5289               NULL, HFILL }
5290         },
5291         { &hf_isis_lsp_ext_ip_reachability_len,
5292             { "Length", "isis.lsp.ext_ip_reachability.length",
5293               FT_UINT8, BASE_DEC, NULL, 0x0,
5294               NULL, HFILL }
5295         },
5296         { &hf_isis_lsp_ext_ip_reachability_prefix_flags,
5297             { "Flags", "isis.lsp.ext_ip_reachability.prefix_sid.flags",
5298               FT_UINT8, BASE_HEX, NULL, 0x0,
5299               NULL, HFILL }
5300         },
5301         { &hf_isis_lsp_ext_ip_reachability_prefix_re_adv_flag,
5302             { "Re-advertisement", "isis.lsp.ext_ip_reachability.prefix_sid.flags.r",
5303               FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x80,
5304               NULL, HFILL }
5305         },
5306         { &hf_isis_lsp_ext_ip_reachability_prefix_node_sid_flag,
5307             { "Node-SID", "isis.lsp.ext_ip_reachability.prefix_sid.flags.n",
5308               FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x40,
5309               NULL, HFILL }
5310         },
5311         { &hf_isis_lsp_ext_ip_reachability_prefix_nophp_flag,
5312             { "no-PHP", "isis.lsp.ext_ip_reachability.prefix_sid.flags.p",
5313               FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x20,
5314               NULL, HFILL }
5315         },
5316         { &hf_isis_lsp_ext_ip_reachability_prefix_expl_null_flag,
5317             { "Explicit-Null", "isis.lsp.ext_ip_reachability.prefix_sid.flags.e",
5318               FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x10,
5319               NULL, HFILL }
5320         },
5321         { &hf_isis_lsp_ext_ip_reachability_prefix_value_flag,
5322             { "Value", "isis.lsp.ext_ip_reachability.prefix_sid.flags.v",
5323               FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x8,
5324               NULL, HFILL }
5325         },
5326         { &hf_isis_lsp_ext_ip_reachability_prefix_local_flag,
5327             { "Local", "isis.lsp.ext_ip_reachability.prefix_sid.flags.l",
5328               FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x4,
5329               NULL, HFILL }
5330         },
5331         { &hf_isis_lsp_32_bit_administrative_tag,
5332             { "32-Bit Administrative tag", "isis.lsp.32_bit_administrative_tag",
5333               FT_UINT32, BASE_HEX_DEC, NULL, 0x0,
5334               NULL, HFILL }
5335         },
5336         { &hf_isis_lsp_64_bit_administrative_tag,
5337             { "64-Bit Administrative tag", "isis.lsp.64_bit_administrative_tag",
5338               FT_UINT64, BASE_HEX, NULL, 0x0,
5339               NULL, HFILL }
5340         },
5341         { &hf_isis_lsp_ext_ip_reachability_ipv4_prefix,
5342             { "IPv4 prefix", "isis.lsp.ext_ip_reachability.ipv4_prefix",
5343               FT_IPv4, BASE_NONE, NULL, 0x0,
5344               NULL, HFILL }
5345         },
5346         { &hf_isis_lsp_ext_ip_reachability_metric,
5347             { "Metric", "isis.lsp.ext_ip_reachability.metric",
5348               FT_UINT32, BASE_DEC, NULL, 0x0,
5349               NULL, HFILL }
5350         },
5351         { &hf_isis_lsp_ext_ip_reachability_distribution,
5352             { "Distribution", "isis.lsp.ext_ip_reachability.distribution",
5353               FT_BOOLEAN, 8, TFS(&tfs_down_up), 0x80,
5354               NULL, HFILL }
5355         },
5356         { &hf_isis_lsp_ext_ip_reachability_subtlv,
5357             { "Sub-TLV", "isis.lsp.ext_ip_reachability.subtlv",
5358               FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x40,
5359               NULL, HFILL }
5360         },
5361         { &hf_isis_lsp_ext_ip_reachability_prefix_length,
5362             { "Prefix Length", "isis.lsp.ext_ip_reachability.prefix_length",
5363               FT_UINT8, BASE_DEC, NULL, 0x3F,
5364               NULL, HFILL }
5365         },
5366         { &hf_isis_lsp_grp_type,
5367             { "Type", "isis.lsp.grp.type",
5368               FT_UINT8, BASE_DEC, VALS(isis_lsp_grp_types), 0x0,
5369               NULL, HFILL }
5370         },
5371         { &hf_isis_lsp_grp_macaddr_length,
5372             { "Length", "isis.lsp.grp_macaddr.length",
5373               FT_UINT8, BASE_DEC, NULL, 0x0,
5374               NULL, HFILL }
5375         },
5376         { &hf_isis_lsp_grp_macaddr_topology_id,
5377             { "Topology ID", "isis.lsp.grp_macaddr.mtid",
5378               FT_UINT16, BASE_DEC|BASE_RANGE_STRING, RVALS(mtid_strings), 0x0fff,
5379               NULL, HFILL }
5380         },
5381         { &hf_isis_lsp_grp_macaddr_vlan_id,
5382             { "VLAN ID", "isis.lsp.grp_macaddr.vlan_id",
5383               FT_UINT16, BASE_DEC, NULL, 0x0fff,
5384               NULL, HFILL }
5385         },
5386         { &hf_isis_lsp_grp_macaddr_number_of_records,
5387             { "Number of records", "isis.lsp.grp_macaddr.number_of_records",
5388               FT_UINT8, BASE_DEC, NULL, 0x0,
5389               NULL, HFILL }
5390         },
5391         { &hf_isis_lsp_grp_macaddr_number_of_sources,
5392             { "Number of sources", "isis.lsp.grp_macaddr.number_of_sources",
5393               FT_UINT8, BASE_DEC, NULL, 0x0,
5394               NULL, HFILL }
5395         },
5396         { &hf_isis_lsp_grp_macaddr_group_address,
5397             { "Group Address", "isis.lsp.grp_macaddr.group_address",
5398               FT_SYSTEM_ID, BASE_NONE, NULL, 0x0,
5399               NULL, HFILL }
5400         },
5401         { &hf_isis_lsp_grp_macaddr_source_address,
5402             { "Source Address", "isis.lsp.grp_macaddr.source_address",
5403               FT_SYSTEM_ID, BASE_NONE, NULL, 0x0,
5404               NULL, HFILL }
5405         },
5406         { &hf_isis_lsp_grp_ipv4addr_length,
5407             { "Length", "isis.lsp.grp_ipv4addr.length",
5408               FT_UINT8, BASE_DEC, NULL, 0x0,
5409               NULL, HFILL }
5410         },
5411         { &hf_isis_lsp_grp_ipv4addr_topology_id,
5412             { "Topology ID", "isis.lsp.grp_ipv4addr.mtid",
5413               FT_UINT16, BASE_DEC|BASE_RANGE_STRING, RVALS(mtid_strings), 0x0fff,
5414               NULL, HFILL }
5415         },
5416         { &hf_isis_lsp_grp_ipv4addr_vlan_id,
5417             { "VLAN ID", "isis.lsp.grp_ipv4addr.vlan_id",
5418               FT_UINT16, BASE_DEC, NULL, 0x0fff,
5419               NULL, HFILL }
5420         },
5421         { &hf_isis_lsp_grp_ipv4addr_number_of_records,
5422             { "Number of records", "isis.lsp.grp_ipv4addr.number_of_records",
5423               FT_UINT8, BASE_DEC, NULL, 0x0,
5424               NULL, HFILL }
5425         },
5426         { &hf_isis_lsp_grp_ipv4addr_number_of_sources,
5427             { "Number of sources", "isis.lsp.grp_ipv4addr.number_of_sources",
5428               FT_UINT8, BASE_DEC, NULL, 0x0,
5429               NULL, HFILL }
5430         },
5431         { &hf_isis_lsp_grp_ipv4addr_group_address,
5432             { "Group Address", "isis.lsp.grp_ipv4addr.group_address",
5433               FT_IPv4, BASE_NONE, NULL, 0x0,
5434               NULL, HFILL }
5435         },
5436         { &hf_isis_lsp_grp_ipv4addr_source_address,
5437             { "Source Address", "isis.lsp.grp_ipv4addr.source_address",
5438               FT_IPv4, BASE_NONE, NULL, 0x0,
5439               NULL, HFILL }
5440         },
5441         { &hf_isis_lsp_grp_ipv6addr_length,
5442             { "Length", "isis.lsp.grp_ipv6addr.length",
5443               FT_UINT8, BASE_DEC, NULL, 0x0,
5444               NULL, HFILL }
5445         },
5446         { &hf_isis_lsp_grp_ipv6addr_topology_id,
5447             { "Topology ID", "isis.lsp.grp_ipv6addr.mtid",
5448               FT_UINT16, BASE_DEC|BASE_RANGE_STRING, RVALS(mtid_strings), 0x0fff,
5449               NULL, HFILL }
5450         },
5451         { &hf_isis_lsp_grp_ipv6addr_vlan_id,
5452             { "VLAN ID", "isis.lsp.grp_ipv6addr.vlan_id",
5453               FT_UINT16, BASE_DEC, NULL, 0x0fff,
5454               NULL, HFILL }
5455         },
5456         { &hf_isis_lsp_grp_ipv6addr_number_of_records,
5457             { "Number of records", "isis.lsp.grp_ipv6addr.number_of_records",
5458               FT_UINT8, BASE_DEC, NULL, 0x0,
5459               NULL, HFILL }
5460         },
5461         { &hf_isis_lsp_grp_ipv6addr_number_of_sources,
5462             { "Number of sources", "isis.lsp.grp_ipv6addr.number_of_sources",
5463               FT_UINT8, BASE_DEC, NULL, 0x0,
5464               NULL, HFILL }
5465         },
5466         { &hf_isis_lsp_grp_ipv6addr_group_address,
5467             { "Group Address", "isis.lsp.grp_ipv6addr.group_address",
5468               FT_IPv6, BASE_NONE, NULL, 0x0,
5469               NULL, HFILL }
5470         },
5471         { &hf_isis_lsp_grp_ipv6addr_source_address,
5472             { "Source Address", "isis.lsp.grp_ipv6addr.source_address",
5473               FT_IPv6, BASE_NONE, NULL, 0x0,
5474               NULL, HFILL }
5475         },
5476         { &hf_isis_lsp_grp_unknown_length,
5477             { "Length", "isis.lsp.grp_unknown.length",
5478               FT_UINT8, BASE_DEC, NULL, 0x0,
5479               NULL, HFILL }
5480         },
5481         { &hf_isis_lsp_rt_capable_trill_affinity_tlv,
5482             { "Affinity Sub-TLV", "isis.lsp.rt_capable.trill.affinity_tlv",
5483               FT_BOOLEAN, 32 , TFS(&tfs_supported_not_supported), 0x80000000,
5484               NULL, HFILL }
5485         },
5486         { &hf_isis_lsp_rt_capable_trill_fgl_safe,
5487             { "FGL-safe", "isis.lsp.rt_capable.trill.fgl_safe",
5488               FT_BOOLEAN, 32 , TFS(&tfs_yes_no), 0x40000000,
5489               NULL, HFILL }
5490         },
5491         { &hf_isis_lsp_rt_capable_trill_caps,
5492             { "Other Capabilities", "isis.lsp.rt_capable.trill.caps",
5493               FT_BOOLEAN, 32 , TFS(&tfs_supported_not_supported), 0x3ffc0000,
5494               NULL, HFILL }
5495         },
5496         { &hf_isis_lsp_rt_capable_trill_flags,
5497             { "Extended Header Flags", "isis.lsp.rt_capable.trill.flags",
5498               FT_BOOLEAN, 32 , TFS(&tfs_supported_not_supported), 0x0003ffff,
5499               NULL, HFILL }
5500         },
5501         { &hf_isis_lsp_rt_capable_trill_maximum_version,
5502             { "Maximum version", "isis.lsp.rt_capable.trill.maximum_version",
5503               FT_UINT8, BASE_DEC, NULL, 0x0,
5504               NULL, HFILL }
5505         },
5506         { &hf_isis_lsp_rt_capable_trees_nof_trees_to_compute,
5507             { "Nof. trees to compute", "isis.lsp.rt_capable.trees.nof_trees_to_compute",
5508               FT_UINT16, BASE_DEC, NULL, 0x0,
5509               NULL, HFILL }
5510         },
5511         { &hf_isis_lsp_rt_capable_trees_maximum_nof_trees_to_compute,
5512             { "Maximum nof. trees to compute", "isis.lsp.rt_capable.trees.maximum_nof_trees_to_compute",
5513               FT_UINT16, BASE_DEC, NULL, 0x0,
5514               NULL, HFILL }
5515         },
5516         { &hf_isis_lsp_rt_capable_trees_nof_trees_to_use,
5517             { "Nof. trees to use", "isis.lsp.rt_capable.trees.nof_trees_to_use",
5518               FT_UINT16, BASE_DEC, NULL, 0x0,
5519               NULL, HFILL }
5520         },
5521         { &hf_isis_lsp_rt_capable_tree_root_id_starting_tree_no,
5522             { "Starting tree no", "isis.lsp.rt_capable.tree_root_id.starting_tree_no",
5523               FT_UINT16, BASE_DEC, NULL, 0x0,
5524               NULL, HFILL }
5525         },
5526         { &hf_isis_lsp_rt_capable_tree_root_id_nickname,
5527             { "Nickname", "isis.lsp.rt_capable.tree_root_id.nickname",
5528               FT_UINT16, BASE_HEX_DEC, NULL, 0x0,
5529               NULL, HFILL }
5530         },
5531         { &hf_isis_lsp_rt_capable_nickname_nickname_priority,
5532             { "Nickname priority", "isis.lsp.rt_capable.nickname.nickname_priority",
5533               FT_UINT8, BASE_DEC, NULL, 0x0,
5534               NULL, HFILL }
5535         },
5536         { &hf_isis_lsp_rt_capable_nickname_tree_root_priority,
5537             { "Tree root priority", "isis.lsp.rt_capable.nickname.tree_root_priority",
5538               FT_UINT16, BASE_DEC, NULL, 0x0,
5539               NULL, HFILL }
5540         },
5541         { &hf_isis_lsp_rt_capable_nickname_nickname,
5542             { "Nickname", "isis.lsp.rt_capable.nickname.nickname",
5543               FT_UINT16, BASE_HEX_DEC, NULL, 0x0,
5544               NULL, HFILL }
5545         },
5546         { &hf_isis_lsp_rt_capable_interested_vlans_nickname,
5547             { "Nickname", "isis.lsp.rt_capable.interested_vlans.nickname",
5548               FT_UINT16, BASE_HEX_DEC, NULL, 0x0,
5549               NULL, HFILL }
5550         },
5551         { &hf_isis_lsp_rt_capable_interested_vlans_multicast_ipv4,
5552             { "IPv4 multicast router", "isis.lsp.rt_capable.interested_vlans.multicast_ipv4",
5553               FT_BOOLEAN, 16, TFS(&tfs_set_notset), 0x8000,
5554               NULL, HFILL }
5555         },
5556         { &hf_isis_lsp_rt_capable_interested_vlans_multicast_ipv6,
5557             { "IPv6 multicast router", "isis.lsp.rt_capable.interested_vlans.multicast_ipv6",
5558               FT_BOOLEAN, 16, TFS(&tfs_set_notset), 0x4000,
5559               NULL, HFILL }
5560         },
5561         { &hf_isis_lsp_rt_capable_interested_vlans_vlan_start_id,
5562             { "Vlan start id", "isis.lsp.rt_capable.interested_vlans.vlan_start_id",
5563               FT_UINT16, BASE_DEC, NULL, 0x0fff,
5564               NULL, HFILL }
5565         },
5566         { &hf_isis_lsp_rt_capable_interested_vlans_vlan_end_id,
5567             { "Vlan end id", "isis.lsp.rt_capable.interested_vlans.vlan_end_id",
5568               FT_UINT16, BASE_DEC, NULL, 0x0fff,
5569               NULL, HFILL }
5570         },
5571         { &hf_isis_lsp_rt_capable_interested_vlans_afs_lost_counter,
5572             { "Appointed forward state lost counter", "isis.lsp.rt_capable.interested_vlans.afs_lost_counter",
5573               FT_UINT32, BASE_DEC, NULL, 0x0,
5574               NULL, HFILL }
5575         },
5576         { &hf_isis_lsp_rt_capable_tree_used_id_starting_tree_no,
5577             { "Starting tree no", "isis.lsp.rt_capable.tree_used_id.starting_tree_no",
5578               FT_UINT16, BASE_DEC, NULL, 0x0,
5579               NULL, HFILL }
5580         },
5581         { &hf_isis_lsp_rt_capable_tree_used_id_nickname,
5582             { "Nickname", "isis.lsp.rt_capable.tree_used_id.nickname",
5583               FT_UINT16, BASE_HEX_DEC, NULL, 0x0,
5584               NULL, HFILL }
5585         },
5586         { &hf_isis_lsp_rt_capable_vlan_group_primary_vlan_id,
5587             { "Primary vlan id", "isis.lsp.rt_capable.vlan_group.primary_vlan_id",
5588               FT_UINT16, BASE_DEC, NULL, 0x0fff,
5589               NULL, HFILL }
5590         },
5591         { &hf_isis_lsp_rt_capable_vlan_group_secondary_vlan_id,
5592             { "Secondary vlan id", "isis.lsp.rt_capable.vlan_group.secondary_vlan_id",
5593               FT_UINT16, BASE_DEC, NULL, 0x0fff,
5594               NULL, HFILL }
5595         },
5596         { &hf_isis_lsp_ipv6_reachability_subclvs_len,
5597             { "SubCLV Length", "isis.lsp.ipv6_reachability.subclvs_length",
5598               FT_UINT8, BASE_DEC, NULL, 0x0,
5599               NULL, HFILL }
5600         },
5601         { &hf_isis_lsp_ipv6_reachability_ipv6_prefix,
5602             { "IPv6 prefix", "isis.lsp.ipv6_reachability.ipv6_prefix",
5603               FT_IPv6, BASE_NONE, NULL, 0x0,
5604               NULL, HFILL }
5605         },
5606         { &hf_isis_lsp_ipv6_reachability_metric,
5607             { "Metric", "isis.lsp.ipv6_reachability.metric",
5608               FT_UINT32, BASE_DEC, NULL, 0x0,
5609               NULL, HFILL }
5610         },
5611         { &hf_isis_lsp_ipv6_reachability_distribution,
5612             { "Distribution", "isis.lsp.ipv6_reachability.distribution",
5613               FT_BOOLEAN, 8, TFS(&tfs_down_up), 0x80,
5614               NULL, HFILL }
5615         },
5616         { &hf_isis_lsp_ipv6_reachability_distribution_internal,
5617             { "Distribution", "isis.lsp.ipv6_reachability.distribution_internal",
5618               FT_BOOLEAN, 8, TFS(&tfs_external_internal), 0x40,
5619               NULL, HFILL }
5620         },
5621         { &hf_isis_lsp_ipv6_reachability_subtlv,
5622             { "Sub-TLV", "isis.lsp.ipv6_reachability.subtlv",
5623               FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x20,
5624               NULL, HFILL }
5625         },
5626         { &hf_isis_lsp_ipv6_reachability_reserved_bits,
5627             { "Reserved bits", "isis.lsp.ipv6_reachability.reserved_bits",
5628               FT_UINT8, BASE_HEX, NULL, 0x1F,
5629               NULL, HFILL }
5630         },
5631         { &hf_isis_lsp_ipv6_reachability_prefix_length,
5632             { "Prefix Length", "isis.lsp.ipv6_reachability.prefix_length",
5633               FT_UINT8, BASE_DEC, NULL, 0x0,
5634               NULL, HFILL }
5635         },
5636 
5637         /* rfc7794 */
5638         { &hf_isis_lsp_prefix_attr_flags,
5639             { "Flags", "isis.lsp.prefix_attribute.flags",
5640               FT_UINT8, BASE_HEX, NULL, 0x0,
5641               NULL, HFILL }
5642         },
5643         { &hf_isis_lsp_prefix_attr_flags_x,
5644             { "External Prefix", "isis.lsp.prefix_attribute.flags.x",
5645               FT_BOOLEAN, 8, TFS(&tfs_set_notset), ISIS_LSP_PFX_ATTR_FLAG_X,
5646               NULL, HFILL }
5647         },
5648         { &hf_isis_lsp_prefix_attr_flags_r,
5649             { "Re-advertisement", "isis.lsp.prefix_attribute.flags.r",
5650               FT_BOOLEAN, 8, TFS(&tfs_set_notset), ISIS_LSP_PFX_ATTR_FLAG_R,
5651               NULL, HFILL }
5652         },
5653         { &hf_isis_lsp_prefix_attr_flags_n,
5654             { "Node", "isis.lsp.prefix_attribute.flags.n",
5655               FT_BOOLEAN, 8, TFS(&tfs_set_notset), ISIS_LSP_PFX_ATTR_FLAG_N,
5656               NULL, HFILL }
5657         },
5658 
5659         { &hf_isis_lsp_mt_cap_spb_instance_cist_root_identifier,
5660             { "CIST Root Identifier", "isis.lsp.mt_cap_spb_instance.cist_root_identifier",
5661               FT_BYTES, SEP_DASH, NULL, 0x0,
5662               NULL, HFILL }
5663         },
5664         { &hf_isis_lsp_mt_cap_spb_instance_cist_external_root_path_cost,
5665             { "CIST External Root Path Cost", "isis.lsp.mt_cap_spb_instance.cist_external_root_path_cost",
5666               FT_UINT32, BASE_HEX_DEC, NULL, 0x0,
5667               NULL, HFILL }
5668         },
5669         { &hf_isis_lsp_mt_cap_spb_instance_bridge_priority,
5670             { "Bridge Priority", "isis.lsp.mt_cap_spb_instance.bridge_priority",
5671               FT_UINT16, BASE_HEX_DEC, NULL, 0x0,
5672               NULL, HFILL }
5673         },
5674         { &hf_isis_lsp_mt_cap_spb_instance_v,
5675             { "V", "isis.lsp.mt_cap_spb_instance.v",
5676               FT_BOOLEAN, 32, NULL, 0x00100000,
5677               NULL, HFILL }
5678         },
5679         { &hf_isis_lsp_mt_cap_spb_instance_number_of_trees,
5680             { "Number of Trees", "isis.lsp.mt_cap_spb_instance.number_of_trees",
5681               FT_UINT16, BASE_HEX_DEC, NULL, 0x0,
5682               NULL, HFILL }
5683         },
5684         { &hf_isis_lsp_mt_cap_spb_instance_vlanid_tuple_u,
5685             { "U", "isis.lsp.mt_cap_spb_instance.vlanid_tuple.u",
5686               FT_BOOLEAN, 8, NULL, 0x80,
5687               "Set if this bridge is currently using this ECT-ALGORITHM for I-SIDs it sources or sinks", HFILL }
5688         },
5689         { &hf_isis_lsp_mt_cap_spb_instance_vlanid_tuple_m,
5690             { "M", "isis.lsp.mt_cap_spb_instance.vlanid_tuple.m",
5691               FT_BOOLEAN, 8, NULL, 0x40,
5692               "indicates if this is SPBM or SPBV mode", HFILL }
5693         },
5694         { &hf_isis_lsp_mt_cap_spb_instance_vlanid_tuple_a,
5695             { "A", "isis.lsp.mt_cap_spb_instance.vlanid_tuple.a",
5696               FT_BOOLEAN, 8, NULL, 0x20,
5697               "When set, declares this is an SPVID with auto-allocation", HFILL }
5698         },
5699         { &hf_isis_lsp_mt_cap_spb_instance_vlanid_tuple_reserved,
5700             { "Reserved", "isis.lsp.mt_cap_spb_instance.vlanid_tuple.reserved",
5701               FT_UINT8, BASE_HEX, NULL, 0x1F,
5702               NULL, HFILL }
5703         },
5704         { &hf_isis_lsp_mt_cap_spb_instance_vlanid_tuple_ect,
5705             { "ECT-ALGORITHM", "isis.lsp.mt_cap_spb_instance.vlanid_tuple.ect",
5706               FT_UINT32, BASE_DEC, NULL, 0x0,
5707               NULL, HFILL }
5708         },
5709         { &hf_isis_lsp_mt_cap_spb_instance_vlanid_tuple_base_vid,
5710             { "Base VID", "isis.lsp.mt_cap_spb_instance.vlanid_tuple.basevid",
5711               FT_UINT24, BASE_DEC, NULL, 0xFFF000,
5712               NULL, HFILL }
5713         },
5714         { &hf_isis_lsp_mt_cap_spb_instance_vlanid_tuple_spvid,
5715             { "SPVID", "isis.lsp.mt_cap_spb_instance.vlanid_tuple.spvid",
5716               FT_UINT24, BASE_DEC, NULL, 0x000FFF,
5717               NULL, HFILL }
5718         },
5719         { &hf_isis_lsp_mt_cap_spb_opaque_algorithm,
5720             { "Algorithm", "isis.lsp.mt_cap_spb_opaque.algorithm",
5721               FT_UINT32, BASE_DEC, NULL, 0x0,
5722               NULL, HFILL }
5723         },
5724         { &hf_isis_lsp_mt_cap_spb_opaque_information,
5725             { "information", "isis.lsp.mt_cap_spb_opaque.information",
5726               FT_BYTES, BASE_NONE, NULL, 0x0,
5727               NULL, HFILL }
5728         },
5729         { &hf_isis_lsp_mt_cap_spbm_service_identifier_b_mac,
5730             { "B-MAC", "isis.lsp.mt_cap_spbm_service_identifier.b_mac",
5731               FT_ETHER, BASE_NONE, NULL, 0x0,
5732               NULL, HFILL }
5733         },
5734         { &hf_isis_lsp_mt_cap_spbm_service_identifier_base_vid,
5735             { "Base-VID", "isis.lsp.mt_cap_spbm_service_identifier.base_vid",
5736               FT_UINT16, BASE_HEX_DEC, NULL, 0x0,
5737               NULL, HFILL }
5738         },
5739         { &hf_isis_lsp_mt_cap_spbm_service_identifier_t,
5740             { "T", "isis.lsp.mt_cap_spbm_service_identifier.t",
5741               FT_BOOLEAN, 8, NULL, 0x80,
5742               NULL, HFILL }
5743         },
5744         { &hf_isis_lsp_mt_cap_spbm_service_identifier_r,
5745             { "R", "isis.lsp.mt_cap_spbm_service_identifier.r",
5746               FT_BOOLEAN, 8, NULL, 0x40,
5747               NULL, HFILL }
5748         },
5749         { &hf_isis_lsp_mt_cap_spbm_service_identifier_reserved,
5750             { "Reserved", "isis.lsp.mt_cap_spbm_service_identifier.reserved",
5751               FT_UINT8, BASE_HEX, NULL, 0x3F,
5752               NULL, HFILL }
5753         },
5754         { &hf_isis_lsp_mt_cap_spbm_service_identifier_i_sid,
5755             { "I-SID", "isis.lsp.mt_cap_spbm_service_identifier.i_sid",
5756               FT_UINT24, BASE_HEX, NULL, 0x0,
5757               NULL, HFILL }
5758         },
5759         { &hf_isis_lsp_mt_cap_mtid,
5760             { "Topology ID", "isis.lsp.mt_cap.mtid",
5761               FT_UINT16, BASE_DEC|BASE_RANGE_STRING, RVALS(mtid_strings), 0x0fff,
5762               NULL, HFILL }
5763         },
5764         { &hf_isis_lsp_eis_neighbors_reserved,
5765             { "Reserved", "isis.lsp.eis_neighbors_clv_inner.reserved",
5766               FT_UINT8, BASE_HEX, NULL, 0x0,
5767               NULL, HFILL }
5768         },
5769         { &hf_isis_lsp_eis_neighbors_es_neighbor_id,
5770             { "ES Neighbor ID", "isis.lsp.eis_neighbors.es_neighbor_id",
5771               FT_SYSTEM_ID, BASE_NONE, NULL, 0x0,
5772               NULL, HFILL }
5773         },
5774         { &hf_isis_lsp_eis_neighbors_is_neighbor_id,
5775             { "IS Neighbor", "isis.lsp.eis_neighbors.is_neighbor",
5776               FT_SYSTEM_ID, BASE_NONE, NULL, 0x0,
5777               NULL, HFILL }
5778         },
5779         { &hf_isis_lsp_eis_neighbors_default_metric,
5780             { "Default Metric", "isis.lsp.eis_neighbors.default_metric",
5781               FT_UINT8, BASE_DEC, NULL, 0x3F,
5782               NULL, HFILL }
5783         },
5784         { &hf_isis_lsp_eis_neighbors_delay_metric,
5785             { "Delay Metric", "isis.lsp.eis_neighbors.delay_metric",
5786               FT_UINT8, BASE_DEC, NULL, 0x3F,
5787               NULL, HFILL }
5788         },
5789         { &hf_isis_lsp_eis_neighbors_expense_metric,
5790             { "Expense Metric", "isis.lsp.eis_neighbors.expense_metric",
5791               FT_UINT8, BASE_DEC, NULL, 0x3F,
5792               NULL, HFILL }
5793         },
5794         { &hf_isis_lsp_eis_neighbors_error_metric,
5795             { "Error Metric", "isis.lsp.eis_neighbors.error_metric",
5796               FT_UINT8, BASE_DEC, NULL, 0x3F,
5797               NULL, HFILL }
5798         },
5799         { &hf_isis_lsp_maximum_link_bandwidth,
5800             { "Maximum link bandwidth", "isis.lsp.maximum_link_bandwidth",
5801               FT_FLOAT, BASE_NONE, NULL, 0x0,
5802               NULL, HFILL }
5803         },
5804         { &hf_isis_lsp_reservable_link_bandwidth,
5805             { "Reservable link bandwidth", "isis.lsp.reservable_link_bandwidth",
5806               FT_FLOAT, BASE_NONE, NULL, 0x0,
5807               NULL, HFILL }
5808         },
5809         { &hf_isis_lsp_ext_is_reachability_is_neighbor_id,
5810             { "IS neighbor ID", "isis.lsp.ext_is_reachability.is_neighbor_id",
5811               FT_SYSTEM_ID, BASE_NONE, NULL, 0x0,
5812               NULL, HFILL }
5813         },
5814         { &hf_isis_lsp_ext_is_reachability_metric,
5815             { "Metric", "isis.lsp.ext_is_reachability.metric",
5816               FT_UINT24, BASE_DEC, NULL, 0x0,
5817               NULL, HFILL }
5818         },
5819         { &hf_isis_lsp_ext_is_reachability_subclvs_len,
5820             { "SubCLV Length", "isis.lsp.ext_is_reachability.subclvs_length",
5821               FT_UINT8, BASE_DEC, NULL, 0x0,
5822               NULL, HFILL }
5823         },
5824         { &hf_isis_lsp_ext_is_reachability_code,
5825             { "Code", "isis.lsp.ext_is_reachability.code",
5826               FT_UINT8, BASE_DEC, VALS(isis_lsp_ext_is_reachability_code_vals), 0x0,
5827               NULL, HFILL }
5828         },
5829         { &hf_isis_lsp_ext_is_reachability_len,
5830             { "Length", "isis.lsp.ext_is_reachability.length",
5831               FT_UINT8, BASE_DEC, NULL, 0x0,
5832               NULL, HFILL }
5833         },
5834         { &hf_isis_lsp_ext_is_reachability_value,
5835             { "Value", "isis.lsp.ext_is_reachability.value",
5836               FT_BYTES, BASE_NONE, NULL, 0x0,
5837               NULL, HFILL }
5838         },
5839         { &hf_isis_lsp_ext_is_reachability_link_local_identifier,
5840             { "Link Local Identifier", "isis.lsp.ext_is_reachability.link_local_identifier",
5841               FT_UINT32, BASE_DEC, NULL, 0x0,
5842               NULL, HFILL }
5843         },
5844         { &hf_isis_lsp_ext_is_reachability_link_remote_identifier,
5845             { "Link Remote Identifier", "isis.lsp.ext_is_reachability.link_remote_identifier",
5846               FT_UINT32, BASE_DEC, NULL, 0x0,
5847               NULL, HFILL }
5848         },
5849         { &hf_isis_lsp_ext_is_reachability_ipv4_interface_address,
5850             { "IPv4 interface address", "isis.lsp.ext_is_reachability.ipv4_interface_address",
5851               FT_IPv4, BASE_NONE, NULL, 0x0,
5852               NULL, HFILL }
5853         },
5854         { &hf_isis_lsp_ext_is_reachability_ipv4_neighbor_address,
5855             { "IPv4 neighbor address", "isis.lsp.ext_is_reachability.ipv4_neighbor_address",
5856               FT_IPv4, BASE_NONE, NULL, 0x0,
5857               NULL, HFILL }
5858         },
5859         { &hf_isis_lsp_ext_is_reachability_traffic_engineering_default_metric,
5860             { "Traffic engineering default metric", "isis.lsp.ext_is_reachability.traffic_engineering_default_metric",
5861               FT_UINT24, BASE_DEC, NULL, 0x0,
5862               NULL, HFILL }
5863         },
5864         /* rfc8570 */
5865         { &hf_isis_lsp_ext_is_reachability_unidir_link_flags,
5866             { "Flags", "isis.lsp.ext_is_reachability.unidirectional_link_flags",
5867               FT_UINT8, BASE_HEX, NULL, 0x0,
5868               NULL, HFILL }
5869         },
5870         { &hf_isis_lsp_ext_is_reachability_unidir_link_flags_a,
5871             { "Anomalous bit", "isis.lsp.ext_is_reachability.unidirectional_link_flags.a",
5872               FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x80,
5873               NULL, HFILL }
5874         },
5875         { &hf_isis_lsp_ext_is_reachability_unidir_link_reserved,
5876             { "Reserved", "isis.lsp.ext_is_reachability.unidirectional_link_reserved",
5877               FT_UINT8, BASE_HEX, NULL, 0x0,
5878               NULL, HFILL }
5879         },
5880         { &hf_isis_lsp_ext_is_reachability_unidir_link_delay,
5881             { "Delay", "isis.lsp.ext_is_reachability.unidirectional_link_delay",
5882               FT_UINT24, BASE_DEC, NULL, 0,
5883               NULL, HFILL }
5884         },
5885         { &hf_isis_lsp_ext_is_reachability_unidir_link_delay_min,
5886             { "Min Delay", "isis.lsp.ext_is_reachability.unidirectional_link_delay_min",
5887               FT_UINT24, BASE_DEC, NULL, 0,
5888               NULL, HFILL }
5889         },
5890         { &hf_isis_lsp_ext_is_reachability_unidir_link_delay_max,
5891             { "Max Delay", "isis.lsp.ext_is_reachability.unidirectional_link_delay_max",
5892               FT_UINT24, BASE_DEC, NULL, 0,
5893               NULL, HFILL }
5894         },
5895         { &hf_isis_lsp_ext_is_reachability_unidir_delay_variation,
5896             { "Delay Variation", "isis.lsp.ext_is_reachability.unidirectional_delay_variation",
5897               FT_UINT24, BASE_DEC, NULL, 0,
5898               NULL, HFILL }
5899         },
5900         { &hf_isis_lsp_ext_is_reachability_unidir_link_loss,
5901             { "Link Loss", "isis.lsp.ext_is_reachability.unidirectional_link_loss",
5902               FT_UINT24, BASE_DEC, NULL, 0,
5903               NULL, HFILL }
5904         },
5905         { &hf_isis_lsp_ext_is_reachability_unidir_residual_bandwidth,
5906             { "Residual Bandwidth", "isis.lsp.ext_is_reachability.unidirectional_residual_bandwidth",
5907               FT_UINT32, BASE_DEC, NULL, 0,
5908               NULL, HFILL }
5909         },
5910         { &hf_isis_lsp_ext_is_reachability_unidir_available_bandwidth,
5911             { "Available Bandwidth", "isis.lsp.ext_is_reachability.unidirectional_available_bandwidth",
5912               FT_UINT32, BASE_DEC, NULL, 0,
5913               NULL, HFILL }
5914         },
5915         { &hf_isis_lsp_ext_is_reachability_unidir_utilized_bandwidth,
5916             { "Utilized Bandwidth", "isis.lsp.ext_is_reachability.unidirectional_utilized_bandwidth",
5917               FT_UINT32, BASE_DEC, NULL, 0,
5918               NULL, HFILL }
5919         },
5920 
5921         { &hf_isis_lsp_partition_designated_l2_is,
5922             { "Partition designated L2 IS", "isis.lsp.partition_designated_l2_is",
5923               FT_SYSTEM_ID, BASE_NONE, NULL, 0x0,
5924               NULL, HFILL }
5925         },
5926         { &hf_isis_lsp_originating_lsp_buffer_size,
5927             { "Neighbor originating buffer size", "isis.lsp.originating_lsp_buffer_size",
5928               FT_UINT16, BASE_DEC, NULL, 0x0,
5929               NULL, HFILL }
5930         },
5931         { &hf_isis_lsp_error_metric,
5932             { "Error metric", "isis.lsp.error_metric",
5933               FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x08,
5934               NULL, HFILL }
5935         },
5936         { &hf_isis_lsp_expense_metric,
5937             { "Expense metric", "isis.lsp.expense_metric",
5938               FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x04,
5939               NULL, HFILL }
5940         },
5941         { &hf_isis_lsp_delay_metric,
5942             { "Delay metric", "isis.lsp.delay_metric",
5943               FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x02,
5944               NULL, HFILL }
5945         },
5946         { &hf_isis_lsp_default_metric,
5947             { "Default metric", "isis.lsp.default_metric",
5948               FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x01,
5949               NULL, HFILL }
5950         },
5951         { &hf_isis_lsp_ip_reachability_default_metric_ie,
5952             { "Default Metric IE", "isis.lsp.ip_reachability.default_metric_ie",
5953               FT_BOOLEAN, 8, TFS(&tfs_external_internal), 0x40,
5954               NULL, HFILL }
5955         },
5956         { &hf_isis_lsp_ip_reachability_delay_metric_support,
5957             { "Delay Metric", "isis.lsp.ip_reachability.delay_metric_support",
5958               FT_BOOLEAN, 8, TFS(&tfs_not_supported_supported), 0x80,
5959               NULL, HFILL }
5960         },
5961         { &hf_isis_lsp_ip_reachability_expense_metric_support,
5962             { "Expense Metric", "isis.lsp.ip_reachability.expense_metric_support",
5963               FT_BOOLEAN, 8, TFS(&tfs_not_supported_supported), 0x80,
5964               NULL, HFILL }
5965         },
5966         { &hf_isis_lsp_ip_reachability_error_metric_support,
5967             { "Error Metric", "isis.lsp.ip_reachability.error_metric_support",
5968               FT_BOOLEAN, 8, TFS(&tfs_not_supported_supported), 0x80,
5969               NULL, HFILL }
5970         },
5971         { &hf_isis_lsp_mt_cap_spsourceid,
5972             { "SPSourceId", "isis.lsp.mt_cap.spsourceid",
5973               FT_UINT32, BASE_HEX_DEC, NULL, 0xfffff,
5974               NULL, HFILL }
5975         },
5976         { &hf_isis_lsp_mt_cap_overload,
5977             { "Overload", "isis.lsp.overload",
5978               FT_BOOLEAN, 16, NULL, 0x8000,
5979               NULL, HFILL }
5980         },
5981         { &hf_isis_lsp_eis_neighbors_default_metric_ie,
5982             { "Default Metric", "isis.lsp.eis_neighbors.default_metric_ie",
5983               FT_BOOLEAN, 8, TFS(&tfs_external_internal), 0x40,
5984               NULL, HFILL }
5985         },
5986         { &hf_isis_lsp_eis_neighbors_delay_metric_supported,
5987             { "Delay Metric", "isis.lsp.eis_neighbors_delay_metric.supported",
5988               FT_BOOLEAN, 8, TFS(&tfs_not_supported_supported), 0x80,
5989               NULL, HFILL }
5990         },
5991         { &hf_isis_lsp_eis_neighbors_expense_metric_supported,
5992             { "Expense Metric", "isis.lsp.eis_neighbors.expense_metric_supported",
5993               FT_BOOLEAN, 8, TFS(&tfs_not_supported_supported), 0x80,
5994               NULL, HFILL }
5995         },
5996         { &hf_isis_lsp_eis_neighbors_error_metric_supported,
5997             { "Error Metric", "isis.lsp.eis_neighbors.error_metric_supported",
5998               FT_BOOLEAN, 8, TFS(&tfs_not_supported_supported), 0x80,
5999               NULL, HFILL }
6000         },
6001         { &hf_isis_lsp_unrsv_bw_priority_level,
6002             { "priority level", "isis.lsp.unrsv_bw.priority_level",
6003               FT_FLOAT, BASE_NONE, NULL, 0x0,
6004               NULL, HFILL }
6005         },
6006         { &hf_isis_lsp_ip_reachability_distribution,
6007             { "Distribution", "isis.lsp.ip_reachability.distribution",
6008               FT_BOOLEAN, 8, TFS(&tfs_down_up), 0x80,
6009               NULL, HFILL }
6010         },
6011         { &hf_isis_lsp_ip_reachability_delay_metric_ie,
6012             { "Delay Metric", "isis.lsp.ip_reachability.delay_metric_ie",
6013               FT_BOOLEAN, 8, TFS(&tfs_external_internal), 0x40,
6014               NULL, HFILL }
6015         },
6016         { &hf_isis_lsp_ip_reachability_expense_metric_ie,
6017             { "Expense Metric", "isis.lsp.ip_reachability.expense_metric_ie",
6018               FT_BOOLEAN, 8, TFS(&tfs_external_internal), 0x40,
6019               NULL, HFILL }
6020         },
6021         { &hf_isis_lsp_ip_reachability_error_metric_ie,
6022             { "Error Metric", "isis.lsp.ip_reachability.error_metric_ie",
6023               FT_BOOLEAN, 8, TFS(&tfs_external_internal), 0x40,
6024               NULL, HFILL }
6025         },
6026         { &hf_isis_lsp_eis_neighbors_delay_metric_ie,
6027             { "Delay Metric", "isis.lsp.eis_neighbors.delay_metric_ie",
6028               FT_BOOLEAN, 8, TFS(&tfs_external_internal), 0x40,
6029               NULL, HFILL }
6030         },
6031         { &hf_isis_lsp_eis_neighbors_expense_metric_ie,
6032             { "Expense Metric", "isis.lsp.eis_neighbors.expense_metric_ie",
6033               FT_BOOLEAN, 8, TFS(&tfs_external_internal), 0x40,
6034               NULL, HFILL }
6035         },
6036         { &hf_isis_lsp_eis_neighbors_error_metric_ie,
6037             { "Error Metric", "isis.lsp.eis_neighbors.error_metric_ie",
6038               FT_BOOLEAN, 8, TFS(&tfs_external_internal), 0x40,
6039               NULL, HFILL }
6040         },
6041         { &hf_isis_lsp_rt_capable_router_id,
6042             { "Router ID", "isis.lsp.rt_capable.router_id",
6043               FT_UINT32, BASE_HEX, NULL, 0x0,
6044               NULL, HFILL }
6045         },
6046         { &hf_isis_lsp_rt_capable_flag_s,
6047             { "S bit", "isis.lsp.rt_capable.flag_s",
6048               FT_BOOLEAN, 8, NULL, 0x01,
6049               NULL, HFILL }
6050         },
6051         { &hf_isis_lsp_rt_capable_flag_d,
6052             { "D bit", "isis.lsp.rt_capable.flag_d",
6053               FT_BOOLEAN, 8, NULL, 0x02,
6054               NULL, HFILL }
6055         },
6056         { &hf_isis_lsp_clv_te_node_cap_b_bit,
6057             { "B bit: P2MP Branch LSR capability", "isis.lsp.te_node_cap.b_bit",
6058               FT_BOOLEAN, 8, NULL, 0x80,
6059               NULL, HFILL }
6060         },
6061         { &hf_isis_lsp_clv_te_node_cap_e_bit,
6062             { "E bit: P2MP Bud LSR capability", "isis.lsp.te_node_cap.e_bit",
6063               FT_BOOLEAN, 8, NULL, 0x40,
6064               NULL, HFILL }
6065         },
6066         { &hf_isis_lsp_clv_te_node_cap_m_bit,
6067             { "M bit: MPLS-TE support", "isis.lsp.te_node_cap.m_bit",
6068               FT_BOOLEAN, 8, NULL, 0x20,
6069               NULL, HFILL }
6070         },
6071         { &hf_isis_lsp_clv_te_node_cap_g_bit,
6072             { "G bit: GMPLS support", "isis.lsp.te_node_cap.g_bit",
6073               FT_BOOLEAN, 8, NULL, 0x10,
6074               NULL, HFILL }
6075         },
6076         { &hf_isis_lsp_clv_te_node_cap_p_bit,
6077             { "P bit: P2MP RSVP-TE support", "isis.lsp.te_node_cap.p_bit",
6078               FT_BOOLEAN, 8, NULL, 0x08,
6079               NULL, HFILL }
6080         },
6081         { &hf_isis_lsp_clv_sr_cap_i_flag,
6082             { "I flag: IPv4 support", "isis.lsp.sr_cap.i_flag",
6083               FT_BOOLEAN, 8, NULL, 0x80,
6084               NULL, HFILL }
6085         },
6086         { &hf_isis_lsp_clv_sr_cap_v_flag,
6087           { "V flag: IPv6 support", "isis.lsp.sr_cap.v_flag",
6088             FT_BOOLEAN, 8, NULL, 0x40,
6089             NULL, HFILL }
6090         },
6091         { &hf_isis_lsp_clv_sr_cap_range,
6092           { "Range", "isis.lsp.sr_cap.range",
6093             FT_UINT24, BASE_DEC, NULL, 0x0,
6094             NULL, HFILL }
6095         },
6096         { &hf_isis_lsp_clv_sr_cap_sid,
6097           { "SID", "isis.lsp.sr_cap.sid",
6098             FT_UINT32, BASE_DEC, NULL, 0x0,
6099             NULL, HFILL }
6100         },
6101         { &hf_isis_lsp_clv_sr_cap_label,
6102           { "Label", "isis.lsp.sr_cap.label",
6103             FT_UINT24, BASE_DEC, NULL, 0x0,
6104             NULL, HFILL }
6105         },
6106         { &hf_isis_lsp_clv_sr_alg,
6107           { "Algorithm", "isis.lsp.sr_alg",
6108             FT_UINT8, BASE_DEC, VALS(isis_igp_alg_vals), 0x0,
6109             NULL, HFILL }
6110         },
6111         { &hf_isis_lsp_clv_sr_lb_flags,
6112           { "Flags", "isis.lsp.sr_local_block.flags",
6113             FT_UINT8, BASE_HEX, NULL, 0x0,
6114             NULL, HFILL }
6115         },
6116         { &hf_isis_lsp_clv_srv6_cap_flags,
6117             { "Flags", "isis.lsp.srv6_cap.flags",
6118               FT_UINT16, BASE_HEX, NULL, 0x0,
6119               NULL, HFILL }
6120         },
6121         { &hf_isis_lsp_clv_srv6_cap_flags_o,
6122             { "OAM flag", "isis.lsp.srv6_cap.flags.o",
6123               FT_BOOLEAN, 16, TFS(&tfs_set_notset), 0x4000,
6124               NULL, HFILL }
6125         },
6126         { &hf_isis_lsp_clv_srv6_cap_flags_unused,
6127             { "Unused", "isis.lsp.srv6_cap.flags.unused",
6128               FT_UINT16, BASE_HEX, NULL, 0xbfff,
6129               NULL, HFILL }
6130         },
6131 
6132         { &hf_isis_lsp_srv6_loc_metric,
6133             { "Metric", "isis.lsp.srv6_locator.metric",
6134               FT_UINT32, BASE_DEC, NULL, 0x0,
6135               NULL, HFILL }
6136         },
6137         { &hf_isis_lsp_srv6_loc_flags,
6138             { "Flags", "isis.lsp.srv6_locator.flags",
6139               FT_UINT8, BASE_HEX, NULL, 0x0,
6140               NULL, HFILL }
6141         },
6142         { &hf_isis_lsp_srv6_loc_flags_d,
6143             { "Down bit", "isis.lsp.srv6_locator.flags.d",
6144               FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x80,
6145               NULL, HFILL }
6146         },
6147         { &hf_isis_lsp_srv6_loc_flags_reserved,
6148             { "Reserved", "isis.lsp.srv6_locator.flags.reserved",
6149               FT_UINT8, BASE_HEX, NULL, 0x7f,
6150               NULL, HFILL }
6151         },
6152         { &hf_isis_lsp_srv6_loc_alg,
6153             { "Algorithm", "isis.lsp.srv6_locator.algorithm",
6154               FT_UINT8, BASE_DEC, VALS(isis_igp_alg_vals), 0x0,
6155               NULL, HFILL }
6156         },
6157         { &hf_isis_lsp_srv6_loc_size,
6158             { "Locator Size", "isis.lsp.srv6_locator.locator_size",
6159               FT_UINT8, BASE_DEC, NULL, 0x0,
6160               NULL, HFILL }
6161         },
6162         { &hf_isis_lsp_srv6_loc_locator,
6163             { "Locator", "isis.lsp.srv6_locator.locator",
6164               FT_IPv6, BASE_NONE, NULL, 0x0,
6165               NULL, HFILL }
6166         },
6167         { &hf_isis_lsp_srv6_loc_subclvs_len,
6168             { "SubCLV Length", "isis.lsp.srv6_locator.subclvs_length",
6169               FT_UINT8, BASE_DEC, NULL, 0x0,
6170               NULL, HFILL }
6171         },
6172         { &hf_isis_lsp_srv6_loc_sub_tlv_type,
6173             { "Code", "isis.lsp.srv6_locator.sub_tlv_type",
6174               FT_UINT8, BASE_DEC, VALS(isis_lsp_srv6_loc_sub_tlv_vals), 0x0,
6175               NULL, HFILL }
6176         },
6177         { &hf_isis_lsp_srv6_loc_sub_tlv_length,
6178             { "Length", "isis.lsp.srv6_locator.sub_tlv_length",
6179               FT_UINT8, BASE_DEC, NULL, 0x0,
6180               NULL, HFILL }
6181         },
6182 
6183         { &hf_isis_lsp_clv_srv6_end_sid_flags,
6184             { "Flags", "isis.lsp.srv6_end_sid.flags",
6185               FT_UINT8, BASE_HEX, NULL, 0x0,
6186               NULL, HFILL }
6187         },
6188         { &hf_isis_lsp_clv_srv6_end_sid_endpoint_func,
6189             { "SRv6 Endpoint Function", "isis.lsp.srv6_end_sid.endpoint_function",
6190               FT_UINT16, BASE_DEC, VALS(srv6_endpoint_type_vals), 0x0,
6191               NULL, HFILL }
6192         },
6193         { &hf_isis_lsp_clv_srv6_end_sid_sid,
6194             { "SID", "isis.lsp.srv6_end_sid.sid",
6195               FT_IPv6, BASE_NONE, NULL, 0x0,
6196               NULL, HFILL }
6197         },
6198         { &hf_isis_lsp_clv_srv6_end_sid_subsubclvs_len,
6199             { "SubSubCLV Length", "isis.lsp.srv6_end_sid.subsubclvs_length",
6200               FT_UINT8, BASE_DEC, NULL, 0x0,
6201               NULL, HFILL }
6202         },
6203 
6204         { &hf_isis_lsp_clv_srv6_endx_sid_system_id,
6205             { "System-ID", "isis.lsp.srv6_endx_sid.system_id",
6206               FT_SYSTEM_ID, BASE_NONE, NULL, 0x0,
6207               NULL, HFILL }
6208         },
6209         { &hf_isis_lsp_clv_srv6_endx_sid_flags,
6210             { "Flags", "isis.lsp.srv6_endx_sid.flags",
6211               FT_UINT8, BASE_HEX, NULL, 0x0,
6212               NULL, HFILL }
6213         },
6214         { &hf_isis_lsp_clv_srv6_endx_sid_flags_b,
6215             { "Backup flag", "isis.lsp.srv6_endx_sid.flags.b",
6216               FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x80,
6217               NULL, HFILL }
6218         },
6219         { &hf_isis_lsp_clv_srv6_endx_sid_flags_s,
6220             { "Set flag", "isis.lsp.srv6_endx_sid.flags.s",
6221               FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x40,
6222               NULL, HFILL }
6223         },
6224         { &hf_isis_lsp_clv_srv6_endx_sid_flags_p,
6225             { "Persistent flag", "isis.lsp.srv6_endx_sid.flags.p",
6226               FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x20,
6227               NULL, HFILL }
6228         },
6229         { &hf_isis_lsp_clv_srv6_endx_sid_alg,
6230           { "Algorithm", "isis.lsp.srv6_endx_sid.algorithm",
6231             FT_UINT8, BASE_DEC, VALS(isis_igp_alg_vals), 0x0,
6232             NULL, HFILL }
6233         },
6234         { &hf_isis_lsp_clv_srv6_endx_sid_weight,
6235             { "Weight", "isis.lsp.srv6_endx_sid.weight",
6236               FT_UINT8, BASE_DEC, NULL, 0x0,
6237               NULL, HFILL }
6238         },
6239         { &hf_isis_lsp_clv_srv6_endx_sid_endpoint_func,
6240             { "SRv6 Endpoint Function", "isis.lsp.srv6_endx_sid.endpoint_function",
6241               FT_UINT16, BASE_DEC, VALS(srv6_endpoint_type_vals), 0x0,
6242               NULL, HFILL }
6243         },
6244         { &hf_isis_lsp_clv_srv6_endx_sid_sid,
6245             { "SID", "isis.lsp.srv6_endx_sid.sid",
6246               FT_IPv6, BASE_NONE, NULL, 0x0,
6247               NULL, HFILL }
6248         },
6249         { &hf_isis_lsp_clv_srv6_endx_sid_subsubclvs_len,
6250             { "SubSubCLV Length", "isis.lsp.srv6_endx_sid.subsubclvs_length",
6251               FT_UINT8, BASE_DEC, NULL, 0x0,
6252               NULL, HFILL }
6253         },
6254 
6255         /* rfc8491 */
6256         { &hf_isis_lsp_clv_igp_msd_type,
6257           { "MSD Type", "isis.lsp.igp_msd_type",
6258             FT_UINT8, BASE_DEC, VALS(isis_lsp_igp_msd_types), 0x0,
6259             NULL, HFILL }
6260         },
6261         { &hf_isis_lsp_clv_igp_msd_value,
6262           { "MSD Value", "isis.lsp.igp_msd_value",
6263             FT_UINT8, BASE_DEC, NULL, 0x0,
6264             NULL, HFILL }
6265         },
6266 
6267         /* rfc7308 */
6268         { &hf_isis_lsp_clv_ext_admin_group,
6269             { "Extended Admin Group", "isis.lsp.extended_admin_group",
6270               FT_UINT32, BASE_HEX, NULL, 0x0,
6271               NULL, HFILL }
6272         },
6273 
6274         /* rfc8919 */
6275         { &hf_isis_lsp_clv_app_sabm_legacy,
6276           { "Legacy flag (L)", "isis.lsp.application.sabm.legacy",
6277             FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x80,
6278             NULL, HFILL }
6279         },
6280         { &hf_isis_lsp_clv_app_sabm_length,
6281           { "SABM Length", "isis.lsp.application.sabm.length",
6282             FT_UINT8, BASE_DEC, NULL, 0x7f,
6283             NULL, HFILL }
6284         },
6285         { &hf_isis_lsp_clv_app_udabm_reserved,
6286           { "Reserved (R)", "isis.lsp.application.udabm.reserved",
6287             FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x80,
6288             NULL, HFILL }
6289         },
6290         { &hf_isis_lsp_clv_app_udabm_length,
6291           { "UDABM Length", "isis.lsp.application.udabm.length",
6292             FT_UINT8, BASE_DEC, NULL, 0x7f,
6293             NULL, HFILL }
6294         },
6295         { &hf_isis_lsp_clv_app_sabm_bits,
6296             { "Standard Application Identifier Bit Mask", "isis.lsp.application.sabm.bits",
6297               FT_UINT8, BASE_HEX, NULL, 0x0,
6298               NULL, HFILL }
6299         },
6300         { &hf_isis_lsp_clv_app_sabm_bits_r,
6301             { "RSVP-TE bit (R)", "isis.lsp.application.sabm.bits.r",
6302               FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x80,
6303               NULL, HFILL }
6304         },
6305         { &hf_isis_lsp_clv_app_sabm_bits_s,
6306             { "Segment Routing Policy bit (S)", "isis.lsp.application.sabm.bits.s",
6307               FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x40,
6308               NULL, HFILL }
6309         },
6310         { &hf_isis_lsp_clv_app_sabm_bits_f,
6311             { "Loop-Free Alternate (LFA) bit (F)", "isis.lsp.application.sabm.bits.f",
6312               FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x20,
6313               NULL, HFILL }
6314         },
6315         { &hf_isis_lsp_clv_app_sabm_bits_x,
6316             { "Flexible Algorithm bit (X)", "isis.lsp.application.sabm.bits.x",
6317               FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x10,
6318               NULL, HFILL }
6319         },
6320         { &hf_isis_lsp_clv_app_udabm_bits,
6321           { "User-Defined Application Identifier Bit Mask", "isis.lsp.application.udabm.bits",
6322             FT_BYTES, SEP_SPACE, NULL, 0x0,
6323             NULL, HFILL }
6324         },
6325 
6326         /* draft-ietf-lsr-flex-algo-16 */
6327         { &hf_isis_lsp_clv_flex_algo_algorithm,
6328           { "Flex-Algorithm", "isis.lsp.flex_algorithm.algorithm",
6329             FT_UINT8, BASE_DEC, NULL, 0x0,
6330             NULL, HFILL }
6331         },
6332         { &hf_isis_lsp_clv_flex_algo_metric_type,
6333           { "Metric-Type", "isis.lsp.flex_algorithm.metric_type",
6334             FT_UINT8, BASE_DEC, VALS(isis_lsp_flex_algo_metric_type_vals), 0x0,
6335             NULL, HFILL }
6336         },
6337         { &hf_isis_lsp_clv_flex_algo_calc_type,
6338           { "Calculation-Type", "isis.lsp.flex_algorithm.calculation_type",
6339             FT_UINT8, BASE_DEC, VALS(isis_igp_alg_vals), 0x0,
6340             NULL, HFILL }
6341         },
6342         { &hf_isis_lsp_clv_flex_algo_priority,
6343           { "Priority", "isis.lsp.flex_algorithm.priority",
6344             FT_UINT8, BASE_DEC, NULL, 0x0,
6345             NULL, HFILL }
6346         },
6347 
6348         /* rfc6232 */
6349         { &hf_isis_lsp_purge_orig_id_num,
6350             { "Number of System IDs", "isis.lsp.purge_originator_id.num",
6351               FT_UINT8, BASE_DEC, NULL, 0x0,
6352               NULL, HFILL }
6353         },
6354         { &hf_isis_lsp_purge_orig_id_system_id,
6355             { "System ID", "isis.lsp.purge_originator_id.system_id",
6356               FT_SYSTEM_ID, BASE_NONE, NULL, 0x0,
6357               NULL, HFILL }
6358         },
6359 
6360         { &hf_isis_lsp_area_address,
6361             { "Area address", "isis.lsp.area_address",
6362               FT_BYTES, BASE_NONE, NULL, 0x0,
6363               NULL, HFILL }
6364         },
6365         { &hf_isis_lsp_instance_identifier,
6366             { "Instance Identifier", "isis.lsp.iid",
6367                FT_UINT16, BASE_DEC, NULL, 0x0,
6368                NULL, HFILL }
6369         },
6370         { &hf_isis_lsp_supported_itid,
6371             { "Supported ITID", "isis.lsp.supported_itid",
6372               FT_UINT16, BASE_DEC, NULL, 0x0,
6373               NULL, HFILL }
6374         },
6375         { &hf_isis_lsp_clv_nlpid_nlpid,
6376             { "NLPID", "isis.lsp.clv_nlpid.nlpid",
6377               FT_UINT8, BASE_HEX, NULL, 0x0,
6378               NULL, HFILL }
6379         },
6380         { &hf_isis_lsp_ip_authentication,
6381             { "IP Authentication", "isis.lsp.ip_authentication",
6382               FT_STRING, BASE_NONE, NULL, 0x0,
6383               NULL, HFILL }
6384         },
6385         { &hf_isis_lsp_authentication,
6386             { "Authentication", "isis.lsp.authentication",
6387               FT_BYTES, BASE_NONE, NULL, 0x0,
6388               NULL, HFILL }
6389         },
6390         { &hf_isis_lsp_area_address_str,
6391             { "Area address", "isis.lsp.area_address_str",
6392               FT_STRING, BASE_NONE, NULL, 0x0,
6393               NULL, HFILL }
6394         },
6395         { &hf_isis_lsp_is_virtual,
6396             { "IsVirtual", "isis.lsp.is_virtual",
6397               FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x0,
6398               NULL, HFILL }
6399         },
6400         { &hf_isis_lsp_group,
6401           { "Group", "isis.lsp.group",
6402             FT_UINT32, BASE_DEC, NULL, 0x0,
6403             NULL, HFILL }
6404         },
6405         { &hf_isis_lsp_default,
6406           { "Default metric", "isis.lsp.default",
6407             FT_UINT8, BASE_DEC, NULL, 0x3f,
6408             NULL, HFILL }
6409         },
6410         { &hf_isis_lsp_default_support,
6411           { "Default metric supported", "isis.lsp.default_support",
6412             FT_BOOLEAN, 8, TFS(&tfs_no_yes), 0x80,
6413             NULL, HFILL }
6414         },
6415         { &hf_isis_lsp_delay,
6416           { "Delay metric", "isis.lsp.delay",
6417             FT_UINT8, BASE_DEC, NULL, 0x3f,
6418             NULL, HFILL }
6419         },
6420         { &hf_isis_lsp_delay_support,
6421           { "Delay metric supported", "isis.lsp.delay_support",
6422             FT_BOOLEAN, 8, TFS(&tfs_no_yes), 0x80,
6423             NULL, HFILL }
6424         },
6425         { &hf_isis_lsp_expense,
6426           { "Expense metric", "isis.lsp.expense",
6427             FT_UINT8, BASE_DEC, NULL, 0xef,
6428             NULL, HFILL }
6429         },
6430         { &hf_isis_lsp_expense_support,
6431           { "Expense metric supported", "isis.lsp.expense_support",
6432             FT_BOOLEAN, 8, TFS(&tfs_no_yes), 0x80,
6433             NULL, HFILL }
6434         },
6435         { &hf_isis_lsp_error,
6436           { "Error metric", "isis.lsp.error",
6437             FT_UINT8, BASE_DEC, NULL, 0x3F,
6438             NULL, HFILL }
6439         },
6440         { &hf_isis_lsp_error_support,
6441           { "Error metric supported", "isis.lsp.error_support",
6442             FT_BOOLEAN, 8, TFS(&tfs_no_yes), 0x80,
6443             NULL, HFILL }
6444         },
6445 
6446         /* rfc6119 */
6447         { &hf_isis_lsp_clv_ipv6_te_router_id,
6448             { "IPv6 TE Router ID", "isis.lsp.clv_ipv6_te_router_id",
6449               FT_IPv6, BASE_NONE, NULL, 0x0,
6450               "IPv6 Traffic Engineering Router ID", HFILL }
6451         },
6452         { &hf_isis_lsp_ext_is_reachability_ipv6_interface_address,
6453             { "IPv6 interface address", "isis.lsp.ext_is_reachability.ipv6_interface_address",
6454               FT_IPv6, BASE_NONE, NULL, 0x0,
6455               NULL, HFILL }
6456         },
6457         { &hf_isis_lsp_ext_is_reachability_ipv6_neighbor_address,
6458             { "IPv6 neighbor address", "isis.lsp.ext_is_reachability.ipv6_neighbor_address",
6459               FT_IPv6, BASE_NONE, NULL, 0x0,
6460               NULL, HFILL }
6461         },
6462         { &hf_isis_lsp_clv_bier_alg,
6463           { "BIER Algorithm", "isis.lsp.bier_alg",
6464             FT_UINT8, BASE_DEC | BASE_RANGE_STRING, RVALS(isis_lsp_bier_alg_vals), 0x0,
6465             NULL, HFILL }
6466         },
6467         { &hf_isis_lsp_clv_bier_igp_alg,
6468           { "IGP Algorithm", "isis.lsp.bier_igp_alg",
6469             FT_UINT8, BASE_DEC, VALS(isis_igp_alg_vals), 0x0,
6470             NULL, HFILL }
6471         },
6472         { &hf_isis_lsp_clv_bier_subdomain,
6473             { "BIER sub-domain", "isis.lsp.bier_subdomain",
6474               FT_UINT8, BASE_DEC, NULL, 0x0,
6475               NULL, HFILL }
6476         },
6477         { &hf_isis_lsp_clv_bier_bfrid,
6478             { "BFR-id", "isis.lsp.bier_bfrid",
6479               FT_UINT16, BASE_DEC, NULL, 0x0,
6480               NULL, HFILL }
6481         },
6482         { &hf_isis_lsp_clv_bier_subsub_type,
6483             { "Type", "isis.lsp.bier.subsub.type",
6484               FT_UINT8, BASE_DEC, VALS(isis_lsp_bier_subsubtlv_type_vals), 0x0,
6485               NULL, HFILL }
6486         },
6487         { &hf_isis_lsp_clv_bier_subsub_len,
6488             { "Length", "isis.lsp.bier.subsub.length",
6489               FT_UINT8, BASE_DEC, NULL, 0x0,
6490               NULL, HFILL }
6491         },
6492         { &hf_isis_lsp_clv_bier_subsub_mplsencap_maxsi,
6493             { "Maximum Set Identifier", "isis.lsp.bier.subsub.mplsencap.maxsi",
6494               FT_UINT8, BASE_DEC, NULL, 0x0,
6495               NULL, HFILL }
6496         },
6497         { &hf_isis_lsp_clv_bier_subsub_mplsencap_bslen,
6498             { "BitString Length", "isis.lsp.bier.subsub.mplsencap.bslen",
6499               FT_UINT8, BASE_DEC, NULL, 0xF0,
6500               NULL, HFILL }
6501         },
6502         { &hf_isis_lsp_clv_bier_subsub_mplsencap_label,
6503             { "Label", "isis.lsp.bier.subsub.mplsencap.label",
6504               FT_UINT24, BASE_DEC, NULL, 0x0FFFFF,
6505               NULL, HFILL }
6506         },
6507         /* rfc 6165 */
6508         { &hf_isis_lsp_mac_reachability_topoid_nick,
6509             { "Topology-id/Nickname", "isis.lsp.mac_reachability.topoid_nick",
6510               FT_BYTES, BASE_NONE, NULL, 0x0,
6511               NULL, HFILL }
6512         },
6513         { &hf_isis_lsp_mac_reachability_confidence,
6514             { "Confidence", "isis.lsp.mac_reachability.confidence",
6515               FT_UINT8, BASE_DEC, NULL, 0x0,
6516               NULL, HFILL }
6517         },
6518         { &hf_isis_lsp_mac_reachability_reserved,
6519             { "Reserved", "isis.lsp.mac_reachability.reserved",
6520               FT_UINT16, BASE_DEC, NULL, 0xf000,
6521               NULL, HFILL }
6522         },
6523         { &hf_isis_lsp_mac_reachability_vlan,
6524             { "VLAN-ID", "isis.lsp.mac_reachability.vlan",
6525               FT_UINT16, BASE_DEC, NULL, 0x0fff,
6526               NULL, HFILL }
6527         },
6528         { &hf_isis_lsp_mac_reachability_mac,
6529             { "MAC Address", "isis.lsp.mac_reachability.mac",
6530               FT_ETHER, BASE_NONE, NULL, 0x0,
6531               NULL, HFILL }
6532         },
6533         { &hf_isis_lsp_mac_reachability_chassismac,
6534             { "Chassis MAC", "isis.lsp.mac_reachability.chassismac",
6535               FT_ETHER, BASE_NONE, NULL, 0x0,
6536               NULL, HFILL }
6537         },
6538         { &hf_isis_lsp_mac_reachability_fanmcast,
6539             { "FAN Mcast", "isis.lsp.mac_reachability.fanmcast",
6540               FT_ETHER, BASE_NONE, NULL, 0x0,
6541               NULL, HFILL }
6542         },
6543 	/* Avaya proprietary */
6544         { &hf_isis_lsp_avaya_ipvpn_unknown,
6545             { "Unknown", "isis.lsp.avaya.ipvpn.unknown",
6546               FT_BYTES, BASE_NONE, NULL, 0x0,
6547               NULL, HFILL }
6548         },
6549         { &hf_isis_lsp_avaya_ipvpn_system_id,
6550             { "System-ID", "isis.lsp.avaya.ipvpn.system_id",
6551               FT_SYSTEM_ID, BASE_NONE, NULL, 0x0,
6552               NULL, HFILL }
6553         },
6554         { &hf_isis_lsp_avaya_ipvpn_vrfsid,
6555             { "Vrf I-SID", "isis.lsp.avaya.ipvpn.vrfsid",
6556               FT_UINT24, BASE_DEC, NULL, 0x0,
6557               NULL, HFILL }
6558         },
6559         { &hf_isis_lsp_avaya_ipvpn_subtlvbytes,
6560             { "SubTLV Bytes", "isis.lsp.avaya.ipvpn.subtlvbytes",
6561               FT_UINT8, BASE_DEC, NULL, 0x0,
6562               NULL, HFILL }
6563         },
6564         { &hf_isis_lsp_avaya_ipvpn_subtlvtype,
6565             { "SubTLV Type", "isis.lsp.avaya.ipvpn.subtlvtype",
6566               FT_UINT8, BASE_DEC, VALS(isis_lsp_avaya_ipvpn_subtlv_code_vals), 0x0,
6567               NULL, HFILL }
6568         },
6569         { &hf_isis_lsp_avaya_ipvpn_subtlvlength,
6570             { "SubTLV Length", "isis.lsp.avaya.ipvpn.subtlvlength",
6571               FT_UINT8, BASE_DEC, NULL, 0x0,
6572               NULL, HFILL }
6573         },
6574         { &hf_isis_lsp_avaya_ipvpn_unknown_sub,
6575             { "Unknown", "isis.lsp.avaya.ipvpn.sub.unknown",
6576               FT_BYTES, BASE_NONE, NULL, 0x0,
6577               NULL, HFILL }
6578         },
6579         { &hf_isis_lsp_avaya_ipvpn_ipv4_metric,
6580             { "Metric", "isis.lsp.avaya.ipvpn.ipv4.metric",
6581               FT_UINT32, BASE_DEC, NULL, 0x0,
6582               NULL, HFILL }
6583         },
6584         { &hf_isis_lsp_avaya_ipvpn_ipv4_metrictype,
6585             { "Metric Type", "isis.lsp.avaya.ipvpn.ipv4.metrictype",
6586               FT_UINT32, BASE_DEC, NULL, 0x0,
6587               NULL, HFILL }
6588         },
6589         { &hf_isis_lsp_avaya_ipvpn_ipv4_addr,
6590             { "IPv4 Address", "isis.lsp.avaya.ipvpn.ipv4.address",
6591               FT_IPv4, BASE_NONE, NULL, 0x0,
6592               NULL, HFILL }
6593         },
6594         { &hf_isis_lsp_avaya_ipvpn_ipv4_mask,
6595             { "IPv4 Mask", "isis.lsp.avaya.ipvpn.ipv4.mask",
6596               FT_IPv4, BASE_NONE, NULL, 0x0,
6597               NULL, HFILL }
6598         },
6599         { &hf_isis_lsp_avaya_ipvpn_ipv6_metric,
6600             { "Metric", "isis.lsp.avaya.ipvpn.ipv6.metric",
6601               FT_UINT32, BASE_DEC, NULL, 0x0,
6602               NULL, HFILL }
6603         },
6604         { &hf_isis_lsp_avaya_ipvpn_ipv6_prefixlen,
6605             { "Prefix length", "isis.lsp.avaya.ipvpn.ipv6.prefixlen",
6606               FT_UINT16, BASE_DEC, NULL, 0x0,
6607               NULL, HFILL }
6608         },
6609         { &hf_isis_lsp_avaya_ipvpn_ipv6_prefix,
6610             { "Prefix", "isis.lsp.avaya.ipvpn.ipv6.prefix",
6611               FT_IPv6, BASE_NONE, NULL, 0x0,
6612               NULL, HFILL }
6613         },
6614         { &hf_isis_lsp_avaya_185_unknown,
6615             { "Unknown", "isis.lsp.avaya.185.unknown",
6616               FT_BYTES, BASE_NONE, NULL, 0x0,
6617               NULL, HFILL }
6618         },
6619         { &hf_isis_lsp_avaya_186_unknown,
6620             { "Unknown", "isis.lsp.avaya.186.unknown",
6621               FT_BYTES, BASE_NONE, NULL, 0x0,
6622               NULL, HFILL }
6623         },
6624     };
6625     static gint *ett[] = {
6626         &ett_isis_lsp,
6627         &ett_isis_lsp_info,
6628         &ett_isis_lsp_att,
6629         &ett_isis_lsp_cksum,
6630         &ett_isis_lsp_clv_area_addr,
6631         &ett_isis_lsp_clv_is_neighbors,
6632         &ett_isis_lsp_clv_instance_identifier,
6633         &ett_isis_lsp_clv_ext_is_reachability, /* CLV 22 */
6634         &ett_isis_lsp_part_of_clv_ext_is_reachability,
6635         &ett_isis_lsp_part_of_clv_ext_is_reachability_subtlv,
6636         &ett_isis_lsp_subclv_admin_group,
6637         &ett_isis_lsp_subclv_unrsv_bw,
6638         &ett_isis_lsp_subclv_bw_ct,
6639         &ett_isis_lsp_subclv_spb_link_metric,
6640         &ett_isis_lsp_adj_sid_flags,
6641         &ett_isis_lsp_clv_unknown,
6642         &ett_isis_lsp_clv_partition_dis,
6643         &ett_isis_lsp_clv_prefix_neighbors,
6644         &ett_isis_lsp_clv_authentication,
6645         &ett_isis_lsp_clv_ip_authentication,
6646         &ett_isis_lsp_clv_nlpid_nlpid,
6647         &ett_isis_lsp_clv_hostname,
6648         &ett_isis_lsp_clv_srlg,
6649         &ett_isis_lsp_clv_ipv4_int_addr,
6650         &ett_isis_lsp_clv_ipv6_int_addr, /* CLV 232 */
6651         &ett_isis_lsp_clv_mt_cap,
6652         &ett_isis_lsp_clv_mt_cap_spb_instance,
6653         &ett_isis_lsp_clv_mt_cap_spbm_service_identifier,
6654         &ett_isis_lsp_clv_mt_cap_spbv_mac_address,
6655         &ett_isis_lsp_clv_sid_label_binding,
6656         &ett_isis_lsp_clv_te_router_id,
6657         &ett_isis_lsp_clv_ip_reachability,
6658         &ett_isis_lsp_clv_ip_reach_subclv,
6659         &ett_isis_lsp_clv_ext_ip_reachability, /* CLV 135 */
6660         &ett_isis_lsp_part_of_clv_ext_ip_reachability,
6661         &ett_isis_lsp_prefix_sid_flags,
6662         &ett_isis_lsp_prefix_attr_flags,
6663         &ett_isis_lsp_clv_ipv6_reachability, /* CLV 236 */
6664         &ett_isis_lsp_part_of_clv_ipv6_reachability,
6665         &ett_isis_lsp_clv_mt,
6666         &ett_isis_lsp_clv_mt_is,
6667         &ett_isis_lsp_part_of_clv_mt_is,
6668         &ett_isis_lsp_clv_rt_capable, /*CLV 242*/
6669         &ett_isis_lsp_clv_te_node_cap_desc,
6670         &ett_isis_lsp_clv_trill_version,
6671         &ett_isis_lsp_clv_trees,
6672         &ett_isis_lsp_clv_root_id,
6673         &ett_isis_lsp_clv_nickname,
6674         &ett_isis_lsp_clv_interested_vlans,
6675         &ett_isis_lsp_clv_tree_used,
6676         &ett_isis_lsp_clv_vlan_group,
6677         &ett_isis_lsp_clv_grp_address, /*CLV 142*/
6678         &ett_isis_lsp_clv_grp_macaddr,
6679         &ett_isis_lsp_clv_grp_ipv4addr,
6680         &ett_isis_lsp_clv_grp_ipv6addr,
6681         &ett_isis_lsp_clv_grp_unknown,
6682         &ett_isis_lsp_clv_mt_reachable_IPv4_prefx,
6683         &ett_isis_lsp_clv_mt_reachable_IPv6_prefx,
6684         &ett_isis_lsp_clv_purge_orig_id, /* CLV 13 */
6685         &ett_isis_lsp_clv_originating_buff_size, /* CLV 14 */
6686         &ett_isis_lsp_clv_sr_cap,
6687         &ett_isis_lsp_clv_sr_sid_label,
6688         &ett_isis_lsp_clv_sr_alg,
6689         &ett_isis_lsp_clv_sr_lb,
6690         &ett_isis_lsp_clv_bier_subsub_tlv,
6691         &ett_isis_lsp_clv_node_msd,
6692         &ett_isis_lsp_clv_srv6_cap,
6693         &ett_isis_lsp_clv_srv6_cap_flags,
6694         &ett_isis_lsp_clv_ipv6_te_rtrid,
6695         &ett_isis_lsp_clv_srv6_endx_sid_flags,
6696         &ett_isis_lsp_clv_srv6_locator,
6697         &ett_isis_lsp_clv_srv6_loc_flags,
6698         &ett_isis_lsp_clv_srv6_loc_sub_tlv,
6699         &ett_isis_lsp_clv_flex_algo_def,
6700         &ett_isis_lsp_clv_flex_algo_def_sub_tlv,
6701         &ett_isis_lsp_clv_app_sabm_bits,
6702         &ett_isis_lsp_sl_flags,
6703         &ett_isis_lsp_sl_sub_tlv,
6704         &ett_isis_lsp_sl_sub_tlv_flags,
6705         &ett_isis_lsp_clv_ipv6_te_router_id, /* CLV 140, rfc6119 */
6706         &ett_isis_lsp_clv_mac_reachability,  /* CLV 147, rfc6165 */
6707         &ett_isis_lsp_clv_avaya_ipvpn,
6708         &ett_isis_lsp_clv_avaya_ipvpn_subtlv,
6709         &ett_isis_lsp_clv_avaya_ipvpn_mc,
6710         &ett_isis_lsp_clv_avaya_ip_grt_mc,
6711         &ett_isis_lsp_clv_unidir_link_flags,
6712     };
6713 
6714     static ei_register_info ei[] = {
6715         { &ei_isis_lsp_short_pdu, { "isis.lsp.short_pdu", PI_MALFORMED, PI_ERROR, "PDU length less than header length", EXPFILL }},
6716         { &ei_isis_lsp_long_pdu, { "isis.lsp.long_pdu", PI_MALFORMED, PI_ERROR, "PDU length greater than packet length", EXPFILL }},
6717         { &ei_isis_lsp_bad_checksum, { "isis.lsp.bad_checksum", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }},
6718         { &ei_isis_lsp_subtlv, { "isis.lsp.subtlv.unknown", PI_PROTOCOL, PI_WARN, "Unknown SubTLV", EXPFILL }},
6719         { &ei_isis_lsp_authentication, { "isis.lsp.authentication.unknown", PI_PROTOCOL, PI_WARN, "Unknown authentication type", EXPFILL }},
6720         { &ei_isis_lsp_short_clv, { "isis.lsp.short_clv", PI_MALFORMED, PI_ERROR, "Short CLV", EXPFILL }},
6721         { &ei_isis_lsp_long_clv, { "isis.lsp.long_clv", PI_MALFORMED, PI_ERROR, "Long CLV", EXPFILL }},
6722         { &ei_isis_lsp_length_clv, { "isis.lsp.length_clv", PI_MALFORMED, PI_ERROR, "Wrong length CLV", EXPFILL }},
6723         { &ei_isis_lsp_clv_mt, { "isis.lsp.clv_mt.malformed", PI_MALFORMED, PI_ERROR, "malformed MT-ID", EXPFILL }},
6724         { &ei_isis_lsp_clv_unknown, { "isis.lsp.clv.unknown", PI_UNDECODED, PI_NOTE, "Unknown option", EXPFILL }},
6725         { &ei_isis_lsp_malformed_subtlv, { "isis.lsp.subtlv.malformed", PI_MALFORMED, PI_ERROR, "malformed SubTLV", EXPFILL }},
6726         { &ei_isis_lsp_unknown_subtlv, { "isis.lsp.subtlv.unknown", PI_UNDECODED, PI_NOTE, "Unknown SubTLV", EXPFILL }},
6727         { &ei_isis_lsp_reserved_not_zero, { "isis.lsp.reserved_not_zero", PI_PROTOCOL, PI_WARN, "Reserve bit not 0", EXPFILL }},
6728         { &ei_isis_lsp_length_invalid, { "isis.lsp.length.invalid", PI_PROTOCOL, PI_WARN, "Invalid length", EXPFILL }},
6729     };
6730 
6731     expert_module_t* expert_isis_lsp;
6732 
6733     /* Register the protocol name and description */
6734     proto_isis_lsp = proto_register_protocol(PROTO_STRING_LSP, "ISIS LSP", "isis.lsp");
6735 
6736     proto_register_field_array(proto_isis_lsp, hf, array_length(hf));
6737     proto_register_subtree_array(ett, array_length(ett));
6738     expert_isis_lsp = expert_register_protocol(proto_isis_lsp);
6739     expert_register_field_array(expert_isis_lsp, ei, array_length(ei));
6740 }
6741 
6742 void
proto_reg_handoff_isis_lsp(void)6743 proto_reg_handoff_isis_lsp(void)
6744 {
6745     dissector_add_uint("isis.type", ISIS_TYPE_L1_LSP, create_dissector_handle(dissect_isis_l1_lsp, proto_isis_lsp));
6746     dissector_add_uint("isis.type", ISIS_TYPE_L2_LSP, create_dissector_handle(dissect_isis_l2_lsp, proto_isis_lsp));
6747 }
6748 
6749 /*
6750  * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
6751  *
6752  * Local variables:
6753  * c-basic-offset: 4
6754  * tab-width: 8
6755  * indent-tabs-mode: nil
6756  * End:
6757  *
6758  * vi: set shiftwidth=4 tabstop=8 expandtab:
6759  * :indentSize=4:tabSize=8:noTabs=true:
6760  */
6761