2 * Routines for decoding isis lsp packets and their CLVs
4 * $Id: packet-isis-lsp.c,v 1.36 2002/09/02 22:10:15 guy Exp $
5 * Stuart Stanley <stuarts@mxmail.net>
7 * Ethereal - Network traffic analyzer
8 * By Gerald Combs <gerald@ethereal.com>
9 * Copyright 1998 Gerald Combs
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
34 #include "epan/ipv4.h"
35 #include <epan/packet.h>
36 #include "packet-osi.h"
37 #include "packet-ipv6.h"
38 #include "packet-isis.h"
39 #include "packet-isis-clv.h"
40 #include "packet-isis-lsp.h"
41 #include <epan/resolv.h>
44 static int hf_isis_lsp_pdu_length = -1;
45 static int hf_isis_lsp_remaining_life = -1;
46 static int hf_isis_lsp_sequence_number = -1;
47 static int hf_isis_lsp_checksum = -1;
48 static int hf_isis_lsp_clv_ipv4_int_addr = -1;
49 static int hf_isis_lsp_clv_ipv6_int_addr = -1;
50 static int hf_isis_lsp_clv_te_router_id = -1;
51 static int hf_isis_lsp_clv_mt = -1;
53 static gint ett_isis_lsp = -1;
54 static gint ett_isis_lsp_clv_area_addr = -1;
55 static gint ett_isis_lsp_clv_is_neighbors = -1;
56 static gint ett_isis_lsp_clv_ext_is_reachability = -1; /* CLV 22 */
57 static gint ett_isis_lsp_part_of_clv_ext_is_reachability = -1;
58 static gint ett_isis_lsp_subclv_admin_group = -1;
59 static gint ett_isis_lsp_subclv_unrsv_bw = -1;
60 static gint ett_isis_lsp_clv_unknown = -1;
61 static gint ett_isis_lsp_clv_partition_dis = -1;
62 static gint ett_isis_lsp_clv_prefix_neighbors = -1;
63 static gint ett_isis_lsp_clv_nlpid = -1;
64 static gint ett_isis_lsp_clv_hostname = -1;
65 static gint ett_isis_lsp_clv_te_router_id = -1;
66 static gint ett_isis_lsp_clv_auth = -1;
67 static gint ett_isis_lsp_clv_ipv4_int_addr = -1;
68 static gint ett_isis_lsp_clv_ipv6_int_addr = -1; /* CLV 232 */
69 static gint ett_isis_lsp_clv_ip_reachability = -1;
70 static gint ett_isis_lsp_clv_ext_ip_reachability = -1; /* CLV 135 */
71 static gint ett_isis_lsp_part_of_clv_ext_ip_reachability = -1;
72 static gint ett_isis_lsp_clv_ipv6_reachability = -1; /* CLV 236 */
73 static gint ett_isis_lsp_part_of_clv_ipv6_reachability = -1;
74 static gint ett_isis_lsp_clv_mt = -1;
75 static gint ett_isis_lsp_clv_mt_is = -1;
76 static gint ett_isis_lsp_part_of_clv_mt_is = -1;
78 static const char *isis_lsp_attached_bits[] = {
79 "error", "expense", "delay", "default" };
81 static const value_string isis_lsp_istype_vals[] = {
82 { ISIS_LSP_TYPE_UNUSED0, "Unused 0x0 (invalid)"},
83 { ISIS_LSP_TYPE_LEVEL_1, "Level 1 IS"},
84 { ISIS_LSP_TYPE_UNUSED2, "Unused 0x2 (invalid)"},
85 { ISIS_LSP_TYPE_LEVEL_2, "Level 1 and Level 2 IS"},
89 * Predclare dissectors for use in clv dissection.
91 static void dissect_lsp_prefix_neighbors_clv(tvbuff_t *tvb,
92 proto_tree *tree, int offset, int id_length, int length);
93 static void dissect_lsp_partition_dis_clv(tvbuff_t *tvb,
94 proto_tree *tree, int offset, int id_length, int length);
95 static void dissect_lsp_mt_is_reachability_clv(tvbuff_t *tvb,
96 proto_tree *tree, int offset, int id_length, int length);
97 static void dissect_lsp_ext_is_reachability_clv(tvbuff_t *tvb,
98 proto_tree *tree, int offset, int id_length, int length);
99 static void dissect_lsp_l2_is_neighbors_clv(tvbuff_t *tvb,
100 proto_tree *tree, int offset, int id_length, int length);
101 static void dissect_lsp_l1_es_neighbors_clv(tvbuff_t *tvb,
102 proto_tree *tree, int offset, int id_length, int length);
103 static void dissect_lsp_l1_is_neighbors_clv(tvbuff_t *tvb,
104 proto_tree *tree, int offset, int id_length, int length);
105 static void dissect_lsp_area_address_clv(tvbuff_t *tvb,
106 proto_tree *tree, int offset, int id_length, int length);
107 static void dissect_lsp_l2_auth_clv(tvbuff_t *tvb,
108 proto_tree *tree, int offset, int id_length, int length);
109 static void dissect_lsp_l1_auth_clv(tvbuff_t *tvb,
110 proto_tree *tree, int offset, int id_length, int length);
111 static void dissect_lsp_ipv6_int_addr_clv(tvbuff_t *tvb,
112 proto_tree *tree, int offset, int id_length, int length);
113 static void dissect_lsp_ip_int_addr_clv(tvbuff_t *tvb,
114 proto_tree *tree, int offset, int id_length, int length);
115 static void dissect_lsp_te_router_id_clv(tvbuff_t *tvb,
116 proto_tree *tree, int offset, int id_length, int length);
117 static void dissect_lsp_hostname_clv(tvbuff_t *tvb,
118 proto_tree *tree, int offset, int id_length, int length);
119 static void dissect_lsp_mt_clv(tvbuff_t *tvb,
120 proto_tree *tree, int offset, int id_length, int length);
121 static void dissect_lsp_nlpid_clv(tvbuff_t *tvb,
122 proto_tree *tree, int offset, int id_length, int length);
123 static void dissect_lsp_ipv6_reachability_clv(tvbuff_t *tvb,
124 proto_tree *tree, int offset, int id_length, int length);
125 static void dissect_lsp_ext_ip_reachability_clv(tvbuff_t *tvb,
126 proto_tree *tree, int offset, int id_length, int length);
127 static void dissect_lsp_ip_reachability_clv(tvbuff_t *tvb,
128 proto_tree *tree, int offset, int id_length, int length);
132 static const isis_clv_handle_t clv_l1_lsp_opts[] = {
134 ISIS_CLV_L1_LSP_AREA_ADDRESS,
136 &ett_isis_lsp_clv_area_addr,
137 dissect_lsp_area_address_clv
140 ISIS_CLV_L1_LSP_IS_NEIGHBORS,
142 &ett_isis_lsp_clv_is_neighbors,
143 dissect_lsp_l1_is_neighbors_clv
146 ISIS_CLV_L1_LSP_ES_NEIGHBORS,
148 &ett_isis_lsp_clv_is_neighbors,
149 dissect_lsp_l1_es_neighbors_clv
152 ISIS_CLV_L1_LSP_EXT_IS_REACHABLE,
153 "Extended IS reachability",
154 &ett_isis_lsp_clv_ext_is_reachability,
155 dissect_lsp_ext_is_reachability_clv
158 ISIS_CLV_L1_LSP_IP_INT_REACHABLE,
159 "IP Internal reachability",
160 &ett_isis_lsp_clv_ip_reachability,
161 dissect_lsp_ip_reachability_clv
164 ISIS_CLV_L1_LSP_IP_EXT_REACHABLE,
165 "IP External reachability",
166 &ett_isis_lsp_clv_ip_reachability,
167 dissect_lsp_ip_reachability_clv
170 ISIS_CLV_L1_LSP_EXT_IP_REACHABLE,
171 "Extended IP Reachability",
172 &ett_isis_lsp_clv_ext_ip_reachability,
173 dissect_lsp_ext_ip_reachability_clv
176 ISIS_CLV_L1_LSP_IPv6_REACHABLE,
178 &ett_isis_lsp_clv_ipv6_reachability,
179 dissect_lsp_ipv6_reachability_clv
182 ISIS_CLV_L1_LSP_NLPID,
183 "Protocols supported",
184 &ett_isis_lsp_clv_nlpid,
185 dissect_lsp_nlpid_clv
188 ISIS_CLV_L1_LSP_HOSTNAME,
190 &ett_isis_lsp_clv_hostname,
191 dissect_lsp_hostname_clv
194 ISIS_CLV_L1_LSP_TE_ROUTER_ID,
195 "Traffic Engineering Router ID",
196 &ett_isis_lsp_clv_te_router_id,
197 dissect_lsp_te_router_id_clv
200 ISIS_CLV_L1_LSP_IP_INTERFACE_ADDR,
201 "IP Interface address(es)",
202 &ett_isis_lsp_clv_ipv4_int_addr,
203 dissect_lsp_ip_int_addr_clv
206 ISIS_CLV_L1_LSP_IPv6_INTERFACE_ADDR,
207 "IPv6 Interface address(es)",
208 &ett_isis_lsp_clv_ipv6_int_addr,
209 dissect_lsp_ipv6_int_addr_clv
212 ISIS_CLV_L1_LSP_AUTHENTICATION_NS,
213 "Authentication(non-spec)",
214 &ett_isis_lsp_clv_auth,
215 dissect_lsp_l1_auth_clv
218 ISIS_CLV_L1_LSP_AUTHENTICATION,
220 &ett_isis_lsp_clv_auth,
221 dissect_lsp_l1_auth_clv
226 &ett_isis_lsp_clv_mt,
230 ISIS_CLV_L1_LSP_MT_IS_REACHABLE,
231 "Multi Topology IS Reachability",
232 &ett_isis_lsp_clv_mt_is,
233 dissect_lsp_mt_is_reachability_clv
244 static const isis_clv_handle_t clv_l2_lsp_opts[] = {
246 ISIS_CLV_L1_LSP_AREA_ADDRESS,
248 &ett_isis_lsp_clv_area_addr,
249 dissect_lsp_area_address_clv
252 ISIS_CLV_L2_LSP_IS_NEIGHBORS,
254 &ett_isis_lsp_clv_is_neighbors,
255 dissect_lsp_l2_is_neighbors_clv
258 ISIS_CLV_L2_LSP_EXT_IS_REACHABLE,
259 "Extended IS reachability",
260 &ett_isis_lsp_clv_ext_is_reachability,
261 dissect_lsp_ext_is_reachability_clv
264 ISIS_CLV_L2_LSP_PARTITION_DIS,
265 "Parition Designated Level 2 IS",
266 &ett_isis_lsp_clv_partition_dis,
267 dissect_lsp_partition_dis_clv
270 ISIS_CLV_L2_LSP_PREFIX_NEIGHBORS,
272 &ett_isis_lsp_clv_prefix_neighbors,
273 dissect_lsp_prefix_neighbors_clv
276 ISIS_CLV_L2_LSP_IP_INT_REACHABLE,
277 "IP Internal reachability",
278 &ett_isis_lsp_clv_ip_reachability,
279 dissect_lsp_ip_reachability_clv
282 ISIS_CLV_L2_LSP_IP_EXT_REACHABLE,
283 "IP External reachability",
284 &ett_isis_lsp_clv_ip_reachability,
285 dissect_lsp_ip_reachability_clv
288 ISIS_CLV_L2_LSP_NLPID,
289 "Protocols supported",
290 &ett_isis_lsp_clv_nlpid,
291 dissect_lsp_nlpid_clv
294 ISIS_CLV_L2_LSP_HOSTNAME,
296 &ett_isis_lsp_clv_hostname,
297 dissect_lsp_hostname_clv
300 ISIS_CLV_L2_LSP_TE_ROUTER_ID,
301 "Traffic Engineering Router ID",
302 &ett_isis_lsp_clv_te_router_id,
303 dissect_lsp_te_router_id_clv
306 ISIS_CLV_L2_LSP_EXT_IP_REACHABLE,
307 "Extended IP Reachability",
308 &ett_isis_lsp_clv_ext_ip_reachability,
309 dissect_lsp_ext_ip_reachability_clv
312 ISIS_CLV_L2_LSP_IPv6_REACHABLE,
314 &ett_isis_lsp_clv_ipv6_reachability,
315 dissect_lsp_ipv6_reachability_clv
318 ISIS_CLV_L2_LSP_IP_INTERFACE_ADDR,
319 "IP Interface address(es)",
320 &ett_isis_lsp_clv_ipv4_int_addr,
321 dissect_lsp_ip_int_addr_clv
324 ISIS_CLV_L2_LSP_IPv6_INTERFACE_ADDR,
325 "IPv6 Interface address(es)",
326 &ett_isis_lsp_clv_ipv6_int_addr,
327 dissect_lsp_ipv6_int_addr_clv
330 ISIS_CLV_L2_LSP_AUTHENTICATION_NS,
331 "Authentication(non spec)",
332 &ett_isis_lsp_clv_auth,
333 dissect_lsp_l2_auth_clv
336 ISIS_CLV_L2_LSP_AUTHENTICATION,
338 &ett_isis_lsp_clv_auth,
339 dissect_lsp_l2_auth_clv
344 &ett_isis_lsp_clv_mt,
348 ISIS_CLV_L2_LSP_MT_IS_REACHABLE,
349 "Multi Topology IS Reachability",
350 &ett_isis_lsp_clv_mt_is,
351 dissect_lsp_mt_is_reachability_clv
363 * Name: dissect_metric()
366 * Display a metric prefix portion. ISIS has the concept of multple
367 * metric per prefix (default, delay, expense, and error). This
368 * routine assists other dissectors by adding a single one of
369 * these to the display tree..
371 * The 8th(msbit) bit in the metric octet is the "supported" bit. The
372 * "default" support is required, so we support a "force_supported"
373 * flag that tells us that it MUST be zero (zero==supported,
374 * so it really should be a "not supported" in the boolean sense)
375 * and to display a protocol failure accordingly. Notably,
376 * Cisco IOS 12(6) blows this!
377 * The 7th bit must be zero (reserved).
380 * tvbuff_t * : tvbuffer for packet data
381 * proto_tree * : protocol display tree to fill out. May be NULL
382 * int : offset into packet data where we are.
383 * guint8 : value of the metric.
384 * char * : string giving type of the metric.
385 * int : force supported. True is the supported bit MUST be zero.
388 * void, but we will add to proto tree if !NULL.
391 dissect_metric(tvbuff_t *tvb, proto_tree *tree, int offset, guint8 value,
392 char *pstr, int force_supported )
398 s = ISIS_LSP_CLV_METRIC_SUPPORTED(value);
399 proto_tree_add_text(tree, tvb, offset, 1,
400 "%s Metric: %s%s %s%d:%d", pstr,
401 s ? "Not supported" : "Supported",
402 (s && force_supported) ? "(but is required to be)":"",
403 ISIS_LSP_CLV_METRIC_RESERVED(value) ? "(reserved bit != 0)":"",
404 ISIS_LSP_CLV_METRIC_VALUE(value), value );
408 * Name: dissect_lsp_ip_reachability_clv()
411 * Decode an IP reachability CLV. This can be either internal or
412 * external (the clv format does not change and which type we are
413 * displaying is put there by the dispatcher). All of these
414 * are a metric block followed by an IP addr and mask.
417 * tvbuff_t * : tvbuffer for packet data
418 * proto_tree * : proto tree to build on (may be null)
419 * int : current offset into packet data
420 * int : length of IDs in packet.
421 * int : length of this clv
424 * void, will modify proto_tree if not null.
427 dissect_lsp_ip_reachability_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
428 int id_length _U_, int length)
431 proto_tree *ntree = NULL;
432 guint32 src, mask, prefix_len;
434 guint32 bitmasks[33] = {
436 0x00000008, 0x0000000c, 0x0000000e, 0x0000000f,
437 0x000000f8, 0x000000fc, 0x000000fe, 0x000000ff,
438 0x000008ff, 0x00000cff, 0x00000eff, 0x00000fff,
439 0x0000f8ff, 0x0000fcff, 0x0000feff, 0x0000ffff,
440 0x0008ffff, 0x000cffff, 0x000effff, 0x000fffff,
441 0x00f8ffff, 0x00fcffff, 0x00feffff, 0x00ffffff,
442 0x08ffffff, 0x0cffffff, 0x0effffff, 0x0fffffff,
443 0xf8ffffff, 0xfcffffff, 0xfeffffff, 0xffffffff
447 while ( length > 0 ) {
449 isis_dissect_unknown(tvb, tree, offset,
450 "short IP reachability (%d vs 12)", length );
454 * Gotta build a sub-tree for all our pieces
457 tvb_memcpy(tvb, (guint8 *)&src, offset+4, 4);
458 tvb_memcpy(tvb, (guint8 *)&mask, offset+8, 4);
460 /* find out if the mask matches one of 33 possible prefix lengths */
464 while(prefix_len<=33) {
465 if (bitmasks[prefix_len++]==mask) {
471 /* 34 indicates no match -> must be a discontiguous netmask
472 lets dump the mask, otherwise print the prefix_len */
475 ti = proto_tree_add_text ( tree, tvb, offset, 12,
476 "IPv4 prefix: %s mask %s",
477 ip_to_str((guint8*)&src),
478 ip_to_str((guint8*)&mask));
480 ti = proto_tree_add_text ( tree, tvb, offset, 12,
481 "IPv4 prefix: %s/%d",
482 ip_to_str((guint8*)&src),
486 ntree = proto_item_add_subtree(ti,
487 ett_isis_lsp_clv_ip_reachability);
489 proto_tree_add_text (ntree, tvb, offset, 1,
490 "Default Metric: %d, %s, Distribution: %s",
491 ISIS_LSP_CLV_METRIC_VALUE(tvb_get_guint8(tvb, offset)),
492 ISIS_LSP_CLV_METRIC_IE(tvb_get_guint8(tvb, offset)) ? "External" : "Internal",
493 ISIS_LSP_CLV_METRIC_UPDOWN(tvb_get_guint8(tvb, offset)) ? "down" : "up");
496 if (ISIS_LSP_CLV_METRIC_SUPPORTED(tvb_get_guint8(tvb, offset+1))) {
497 proto_tree_add_text (ntree, tvb, offset+1, 1, "Delay Metric: Not supported");
499 proto_tree_add_text (ntree, tvb, offset+1, 1, "Delay Metric: %d, %s",
500 ISIS_LSP_CLV_METRIC_VALUE(tvb_get_guint8(tvb, offset+1)),
501 ISIS_LSP_CLV_METRIC_IE(tvb_get_guint8(tvb, offset+1)) ? "External" : "Internal");
504 if (ISIS_LSP_CLV_METRIC_SUPPORTED(tvb_get_guint8(tvb, offset+2))) {
505 proto_tree_add_text (ntree, tvb, offset+2, 1, "Expense Metric: Not supported");
507 proto_tree_add_text (ntree, tvb, offset+2, 1, "Exense Metric: %d, %s",
508 ISIS_LSP_CLV_METRIC_VALUE(tvb_get_guint8(tvb, offset+2)),
509 ISIS_LSP_CLV_METRIC_IE(tvb_get_guint8(tvb, offset+2)) ? "External" : "Internal");
512 if (ISIS_LSP_CLV_METRIC_SUPPORTED(tvb_get_guint8(tvb, offset+3))) {
513 proto_tree_add_text (ntree, tvb, offset+3, 1, "Error Metric: Not supported");
515 proto_tree_add_text (ntree, tvb, offset+3, 1, "Error Metric: %d, %s",
516 ISIS_LSP_CLV_METRIC_VALUE(tvb_get_guint8(tvb, offset+3)),
517 ISIS_LSP_CLV_METRIC_IE(tvb_get_guint8(tvb, offset+3)) ? "External" : "Internal");
526 * Name: dissect_lsp_ext_ip_reachability_clv()
528 * Description: Decode an Extended IP Reachability CLV - code 135.
530 * The extended IP reachability TLV is an extended version
531 * of the IP reachability TLVs (codes 128 and 130). It encodes
532 * the metric as a 32-bit unsigned interger and allows to add
536 * tvbuff_t * : tvbuffer for packet data
537 * proto_tree * : proto tree to build on (may be null)
538 * int : current offset into packet data
539 * int : length of IDs in packet.
540 * int : length of this clv
543 * void, will modify proto_tree if not null.
546 dissect_lsp_ext_ip_reachability_clv(tvbuff_t *tvb, proto_tree *tree,
547 int offset, int id_length _U_, int length)
549 proto_item *pi = NULL;
550 proto_tree *subtree = NULL;
552 guint8 bit_length, byte_length;
559 memset (prefix, 0, 4);
560 ctrl_info = tvb_get_guint8(tvb, offset+4);
561 bit_length = ctrl_info & 0x3f;
562 byte_length = (bit_length + 7) / 8;
563 tvb_memcpy (tvb, prefix, offset+5, byte_length);
564 pi = proto_tree_add_text (tree, tvb, offset, -1,
565 "IPv4 prefix: %s/%d",
568 subtree = proto_item_add_subtree (pi,
569 ett_isis_lsp_part_of_clv_ext_ip_reachability);
571 proto_tree_add_text (subtree, tvb, offset, 4,
572 "Metric: %d, Distribution: %s", tvb_get_ntohl(tvb, offset), ((ctrl_info & 0x80) == 0) ? "up" : "down" );
574 proto_tree_add_text (subtree, tvb, offset+4, 1,
575 "%s sub-TLVs present",
576 ((ctrl_info & 0x40) == 0) ? "no" : "" );
578 len = 5 + byte_length;
579 if ((ctrl_info & 0x40) != 0)
580 len += 1 + tvb_get_guint8(tvb, offset+len) ;
581 proto_item_set_len (pi, len);
588 * Name: dissect_lsp_ipv6_reachability_clv()
590 * Description: Decode an IPv6 reachability CLV - code 236.
593 * tvbuff_t * : tvbuffer for packet data
594 * proto_tree * : proto tree to build on (may be null)
595 * int : current offset into packet data
596 * int : length of IDs in packet.
597 * int : length of this clv
600 * void, will modify proto_tree if not null.
603 dissect_lsp_ipv6_reachability_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
604 int id_length _U_, int length)
607 proto_tree *ntree = NULL;
608 guint8 bit_length, byte_length;
609 struct e_in6_addr prefix;
616 memset (prefix.s6_addr, 0, 16);
619 bit_length = tvb_get_guint8(tvb, offset+5);
620 byte_length = (bit_length + 7) / 8;
621 tvb_memcpy (tvb, prefix.s6_addr, offset+6, byte_length);
622 ti = proto_tree_add_text (tree, tvb, offset, -1,
624 ip6_to_str (&prefix),
626 ntree = proto_item_add_subtree (ti, ett_isis_lsp_part_of_clv_ipv6_reachability);
628 metric = tvb_get_ntohl(tvb, offset);
629 proto_tree_add_text (ntree, tvb, offset, 4,
630 "Metric: %d", metric);
632 ctrl_info = tvb_get_guint8(tvb, offset+4);
633 proto_tree_add_text (ntree, tvb, offset+4, 1,
634 "Distribution: %s, %s",
635 ((ctrl_info & 0x80) == 0) ? "up" : "down",
636 ((ctrl_info & 0x40) == 0) ? "internal" : "external" );
638 proto_tree_add_text (ntree, tvb, offset+4, 1,
639 "Reserved bits: 0x%x",
640 (ctrl_info & 0x1f) );
641 proto_tree_add_text (ntree, tvb, offset+4, 1,
643 ((ctrl_info & 0x20) == 0) ? "no" : "yes" );
645 len = 6 + byte_length;
646 if ((ctrl_info & 0x20) != 0)
647 len += 1 + tvb_get_guint8(tvb, offset+len);
648 proto_item_set_len (ti, len);
655 * Name: dissect_lsp_nlpid_clv()
658 * Decode for a lsp packets NLPID clv. Calls into the
662 * tvbuff_t * : tvbuffer for packet data
663 * proto_tree * : proto tree to build on (may be null)
664 * int : current offset into packet data
665 * int : length of IDs in packet.
666 * int : length of this clv
669 * void, will modify proto_tree if not null.
672 dissect_lsp_nlpid_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
673 int id_length _U_, int length)
675 isis_dissect_nlpid_clv(tvb, tree, offset, length);
679 * Name: dissect_lsp_mt_clv()
682 * Decode for a lsp packets Multi Topology clv. Calls into the
686 * tvbuff_t * : tvbuffer for packet data
687 * proto_tree * : proto tree to build on (may be null)
688 * int : current offset into packet data
689 * guint : length of this clv
690 * int : length of IDs in packet.
693 * void, will modify proto_tree if not null.
696 dissect_lsp_mt_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
697 int id_length _U_, int length)
699 isis_dissect_mt_clv(tvb, tree, offset, length, hf_isis_lsp_clv_mt );
703 * Name: dissect_lsp_hostname_clv()
706 * Decode for a lsp packets hostname clv. Calls into the
710 * tvbuff_t * : tvbuffer for packet data
711 * proto_tree * : proto tree to build on (may be null)
712 * int : current offset into packet data
713 * int : length of IDs in packet.
714 * int : length of this clv
717 * void, will modify proto_tree if not null.
720 dissect_lsp_hostname_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
721 int id_length _U_, int length)
723 isis_dissect_hostname_clv(tvb, tree, offset, length);
728 * Name: dissect_lsp_te_router_id_clv()
731 * Decode for a lsp packets Traffic Engineering ID clv. Calls into the
735 * tvbuff_t * : tvbuffer for packet data
736 * proto_tree * : proto tree to build on (may be null)
737 * int : current offset into packet data
738 * int : length of IDs in packet.
739 * int : length of this clv
742 * void, will modify proto_tree if not null.
745 dissect_lsp_te_router_id_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
746 int id_length _U_, int length)
748 isis_dissect_te_router_id_clv(tvb, tree, offset, length,
749 hf_isis_lsp_clv_te_router_id );
754 * Name: dissect_lsp_ip_int_addr_clv()
757 * Decode for a lsp packets ip interface addr clv. Calls into the
761 * tvbuff_t * : tvbuffer for packet data
762 * proto_tree * : proto tree to build on (may be null)
763 * int : current offset into packet data
764 * int : length of IDs in packet.
765 * int : length of this clv
768 * void, will modify proto_tree if not null.
771 dissect_lsp_ip_int_addr_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
772 int id_length _U_, int length)
774 isis_dissect_ip_int_clv(tvb, tree, offset, length,
775 hf_isis_lsp_clv_ipv4_int_addr );
779 * Name: dissect_lsp_ipv6_int_addr_clv()
781 * Description: Decode an IPv6 interface addr CLV - code 232.
783 * Calls into the clv common one.
786 * tvbuff_t * : tvbuffer for packet data
787 * proto_tree * : proto tree to build on (may be null)
788 * int : current offset into packet data
789 * int : length of IDs in packet.
790 * int : length of this clv
793 * void, will modify proto_tree if not null.
796 dissect_lsp_ipv6_int_addr_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
797 int id_length _U_, int length)
799 isis_dissect_ipv6_int_clv(tvb, tree, offset, length,
800 hf_isis_lsp_clv_ipv6_int_addr );
804 * Name: dissect_lsp_L1_auth_clv()
807 * Decode for a lsp packets authenticaion clv. Calls into the
808 * clv common one. An auth inside a L1 LSP is a per area password
811 * tvbuff_t * : tvbuffer for packet data
812 * proto_tree * : proto tree to build on (may be null)
813 * int : current offset into packet data
814 * int : length of IDs in packet.
815 * int : length of this clv
818 * void, will modify proto_tree if not null.
821 dissect_lsp_l1_auth_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
822 int id_length _U_, int length)
824 isis_dissect_authentication_clv(tvb, tree, offset, length,
825 "Per area authentication" );
829 * Name: dissect_lsp_L2_auth_clv()
832 * Decode for a lsp packets authenticaion clv. Calls into the
833 * clv common one. An auth inside a L2 LSP is a per domain password
836 * tvbuff_t * : tvbuffer for packet data
837 * proto_tree * : proto tree to build on (may be null)
838 * int : current offset into packet data
839 * int : length of IDs in packet.
840 * int : length of this clv
843 * void, will modify proto_tree if not null.
846 dissect_lsp_l2_auth_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
847 int id_length _U_, int length)
849 isis_dissect_authentication_clv(tvb, tree, offset, length,
850 "Per domain authentication" );
854 * Name: dissect_lsp_area_address_clv()
857 * Decode for a lsp packet's area address clv. Call into clv common
861 * tvbuff_t * : tvbuffer for packet data
862 * proto_tree * : protocol display tree to fill out. May be NULL
863 * int : offset into packet data where we are.
864 * int : length of IDs in packet.
865 * int : length of clv we are decoding
868 * void, but we will add to proto tree if !NULL.
871 dissect_lsp_area_address_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
872 int id_length _U_, int length)
874 isis_dissect_area_address_clv(tvb, tree, offset, length);
878 * Name: dissect_lsp_eis_neighbors_clv_inner()
881 * Real work horse for showing neighbors. This means we decode the
882 * first octet as either virtual/!virtual (if show_virtual param is
883 * set), or as a must == 0 reserved value.
885 * Once past that, we decode n neighbor elements. Each neighbor
886 * is comprised of a metric block (is dissect_metric) and the
890 * tvbuff_t * : tvbuffer for packet data
891 * proto_tree * : protocol display tree to fill out. May be NULL
892 * int : offset into packet data where we are.
893 * int : length of IDs in packet.
894 * int : length of clv we are decoding
895 * int : set to decode first octet as virtual vs reserved == 0
896 * int : set to indicate EIS instead of IS (6 octet per addr instead of 7)
899 * void, but we will add to proto tree if !NULL.
902 dissect_lsp_eis_neighbors_clv_inner(tvbuff_t *tvb, proto_tree *tree,
903 int offset, int length, int id_length, int show_virtual, int is_eis)
906 proto_tree *ntree = NULL;
910 id_length++; /* IDs are one octet longer in IS neighbours */
912 if ( show_virtual ) {
913 /* virtual path flag */
914 proto_tree_add_text ( tree, tvb, offset, 1,
915 tvb_get_guint8(tvb, offset) ? "IsVirtual" : "IsNotVirtual" );
917 proto_tree_add_text ( tree, tvb, offset, 1,
918 "Reserved value 0x%02x, must == 0",
919 tvb_get_guint8(tvb, offset) );
925 tlen = 4 + id_length;
927 while ( length > 0 ) {
929 isis_dissect_unknown(tvb, tree, offset,
930 "short E/IS reachability (%d vs %d)", length,
935 * Gotta build a sub-tree for all our pieces
939 ti = proto_tree_add_text(tree, tvb, offset, tlen,
941 print_system_id( tvb_get_ptr(tvb, offset+4, id_length), id_length ) );
943 ti = proto_tree_add_text(tree, tvb, offset, tlen,
945 print_system_id(tvb_get_ptr(tvb, offset+4, id_length), id_length ) );
947 ntree = proto_item_add_subtree(ti,
948 ett_isis_lsp_clv_is_neighbors);
952 proto_tree_add_text (ntree, tvb, offset, 1,
953 "Default Metric: %d, %s",
954 ISIS_LSP_CLV_METRIC_VALUE(tvb_get_guint8(tvb, offset)),
955 ISIS_LSP_CLV_METRIC_IE(tvb_get_guint8(tvb, offset)) ? "External" : "Internal");
957 if (ISIS_LSP_CLV_METRIC_SUPPORTED(tvb_get_guint8(tvb, offset+1))) {
958 proto_tree_add_text (ntree, tvb, offset+1, 1, "Delay Metric: Not supported");
960 proto_tree_add_text (ntree, tvb, offset+1, 1, "Delay Metric: %d, %s",
961 ISIS_LSP_CLV_METRIC_VALUE(tvb_get_guint8(tvb, offset+1)),
962 ISIS_LSP_CLV_METRIC_IE(tvb_get_guint8(tvb, offset+1)) ? "External" : "Internal");
966 if (ISIS_LSP_CLV_METRIC_SUPPORTED(tvb_get_guint8(tvb, offset+2))) {
967 proto_tree_add_text (ntree, tvb, offset+2, 1, "Expense Metric: Not supported");
969 proto_tree_add_text (ntree, tvb, offset+2, 1, "Expense Metric: %d, %s",
970 ISIS_LSP_CLV_METRIC_VALUE(tvb_get_guint8(tvb, offset+2)),
971 ISIS_LSP_CLV_METRIC_IE(tvb_get_guint8(tvb, offset+2)) ? "External" : "Internal");
974 if (ISIS_LSP_CLV_METRIC_SUPPORTED(tvb_get_guint8(tvb, offset+3))) {
975 proto_tree_add_text (ntree, tvb, offset+3, 1, "Error Metric: Not supported");
977 proto_tree_add_text (ntree, tvb, offset+3, 1, "Error Metric: %d, %s",
978 ISIS_LSP_CLV_METRIC_VALUE(tvb_get_guint8(tvb, offset+3)),
979 ISIS_LSP_CLV_METRIC_IE(tvb_get_guint8(tvb, offset+3)) ? "External" : "Internal");
989 * Name: dissect_lsp_l1_is_neighbors_clv()
992 * Dispatch a l1 intermediate system neighbor by calling
993 * the inner function with show virtual set to TRUE and is es set to FALSE.
996 * tvbuff_t * : tvbuffer for packet data
997 * proto_tree * : protocol display tree to fill out. May be NULL
998 * int : offset into packet data where we are.
999 * int : length of IDs in packet.
1000 * int : length of clv we are decoding
1003 * void, but we will add to proto tree if !NULL.
1006 dissect_lsp_l1_is_neighbors_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
1007 int id_length, int length)
1009 dissect_lsp_eis_neighbors_clv_inner(tvb, tree, offset,
1010 length, id_length, TRUE, FALSE);
1014 * Name: dissect_lsp_l1_es_neighbors_clv()
1017 * Dispatch a l1 end or intermediate system neighbor by calling
1018 * the inner function with show virtual set to TRUE and es set to TRUE.
1021 * tvbuff_t * : tvbuffer for packet data
1022 * proto_tree * : protocol display tree to fill out. May be NULL
1023 * int : offset into packet data where we are.
1024 * int : length of IDs in packet.
1025 * int : length of clv we are decoding
1028 * void, but we will add to proto tree if !NULL.
1031 dissect_lsp_l1_es_neighbors_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
1032 int id_length, int length)
1034 dissect_lsp_eis_neighbors_clv_inner(tvb, tree, offset,
1035 length, id_length, TRUE, TRUE);
1039 * Name: dissect_lsp_l2_is_neighbors_clv()
1042 * Dispatch a l2 intermediate system neighbor by calling
1043 * the inner function with show virtual set to FALSE, and is es set
1047 * tvbuff_t * : tvbuffer for packet data
1048 * proto_tree * : protocol display tree to fill out. May be NULL
1049 * int : offset into packet data where we are.
1050 * int : length of IDs in packet.
1051 * int : length of clv we are decoding
1054 * void, but we will add to proto tree if !NULL.
1057 dissect_lsp_l2_is_neighbors_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
1058 int id_length, int length)
1060 dissect_lsp_eis_neighbors_clv_inner(tvb, tree, offset,
1061 length, id_length, FALSE, FALSE);
1066 * Name: dissect_subclv_admin_group ()
1068 * Description: Called by function dissect_lsp_ext_is_reachability_clv().
1070 * This function is called by dissect_lsp_ext_is_reachability_clv()
1071 * for dissect the administrive group sub-CLV (code 3).
1074 * tvbuff_t * : tvbuffer for packet data
1075 * proto_tree * : protocol display tree to fill out.
1076 * int : offset into packet data where we are (beginning of the sub_clv value).
1082 dissect_subclv_admin_group (tvbuff_t *tvb, proto_tree *tree, int offset) {
1089 ti = proto_tree_add_text(tree, tvb, offset-2, 6, "Administrative group(s):");
1090 ntree = proto_item_add_subtree (ti, ett_isis_lsp_subclv_admin_group);
1092 clv_value = tvb_get_ntohl(tvb, offset);
1094 for (i = 0 ; i < 32 ; i++) {
1095 if ( (clv_value & mask) != 0 ) {
1096 proto_tree_add_text (ntree, tvb, offset, 4, "group %d", i);
1103 * Name: dissect_subclv_max_bw ()
1105 * Description: Called by function dissect_lsp_ext_is_reachability_clv().
1107 * This function is called by dissect_lsp_ext_is_reachability_clv()
1108 * for dissect the maximum link bandwidth sub-CLV (code 9).
1111 * tvbuff_t * : tvbuffer for packet data
1112 * proto_tree * : protocol display tree to fill out.
1113 * int : offset into packet data where we are (beginning of the sub_clv value).
1119 dissect_subclv_max_bw(tvbuff_t *tvb, proto_tree *tree, int offset)
1123 bw = tvb_get_ntohieee_float(tvb, offset);
1124 proto_tree_add_text (tree, tvb, offset-2, 6,
1125 "Maximum link bandwidth : %.2f Mbps", bw*8/1000000 );
1129 * Name: dissect_subclv_rsv_bw ()
1131 * Description: Called by function dissect_lsp_ext_is_reachability_clv().
1133 * This function is called by dissect_lsp_ext_is_reachability_clv()
1134 * for dissect the reservable link bandwidth sub-CLV (code 10).
1137 * tvbuff_t * : tvbuffer for packet data
1138 * proto_tree * : protocol display tree to fill out.
1139 * int : offset into packet data where we are (beginning of the sub_clv value).
1145 dissect_subclv_rsv_bw(tvbuff_t *tvb, proto_tree *tree, int offset)
1149 bw = tvb_get_ntohieee_float(tvb, offset);
1150 proto_tree_add_text (tree, tvb, offset-2, 6,
1151 "Reservable link bandwidth: %.2f Mbps", bw*8/1000000 );
1155 * Name: dissect_subclv_unrsv_bw ()
1157 * Description: Called by function dissect_lsp_ext_is_reachability_clv().
1159 * This function is called by dissect_lsp_ext_is_reachability_clv()
1160 * for dissect the unreserved bandwidth sub-CLV (code 11).
1163 * tvbuff_t * : tvbuffer for packet data
1164 * proto_tree * : protocol display tree to fill out.
1165 * int : offset into packet data where we are (beginning of the sub_clv value).
1171 dissect_subclv_unrsv_bw(tvbuff_t *tvb, proto_tree *tree, int offset)
1178 ti = proto_tree_add_text (tree, tvb, offset-2, 34, "Unreserved bandwidth:");
1179 ntree = proto_item_add_subtree (ti, ett_isis_lsp_subclv_unrsv_bw);
1181 for (i = 0 ; i < 8 ; i++) {
1182 bw = tvb_get_ntohieee_float(tvb, offset+4*i);
1183 proto_tree_add_text (ntree, tvb, offset+4*i, 4,
1184 "priority level %d: %.2f Mbps", i, bw*8/1000000 );
1189 * Name: dissect_lsp_ext_is_reachability_clv()
1191 * Description: Decode a Extended IS Reachability CLV - code 22
1193 * The extended IS reachability TLV is an extended version
1194 * of the IS reachability TLV (code 2). It encodes the metric
1195 * as a 24-bit unsigned interger and allows to add sub-CLV(s).
1198 * tvbuff_t * : tvbuffer for packet data
1199 * proto_tree * : protocol display tree to fill out. May be NULL
1200 * int : offset into packet data where we are.
1201 * int : length of IDs in packet.
1202 * int : length of clv we are decoding
1205 * void, but we will add to proto tree if !NULL.
1208 dissect_lsp_ext_is_reachability_clv(tvbuff_t *tvb, proto_tree *tree,
1209 int offset, int id_length _U_, int length)
1212 proto_tree *ntree = NULL;
1215 guint8 clv_code, clv_len;
1219 while (length > 0) {
1220 ti = proto_tree_add_text (tree, tvb, offset, -1,
1222 print_system_id (tvb_get_ptr(tvb, offset, 7), 7) );
1223 ntree = proto_item_add_subtree (ti,
1224 ett_isis_lsp_part_of_clv_ext_is_reachability );
1226 proto_tree_add_text (ntree, tvb, offset+7, 3,
1227 "Metric: %d", tvb_get_ntoh24(tvb, offset+7) );
1229 subclvs_len = tvb_get_guint8(tvb, offset+10);
1230 if (subclvs_len == 0) {
1231 proto_tree_add_text (ntree, tvb, offset+10, 1, "no sub-TLVs present");
1235 while (i < subclvs_len) {
1236 clv_code = tvb_get_guint8(tvb, offset+11+i);
1237 clv_len = tvb_get_guint8(tvb, offset+12+i);
1240 dissect_subclv_admin_group(tvb, ntree, offset+13+i);
1243 proto_tree_add_text (ntree, tvb, offset+11+i, 6,
1244 "IPv4 interface address: %s", ip_to_str (tvb_get_ptr(tvb, offset+13+i, 4)) );
1247 proto_tree_add_text (ntree, tvb, offset+11+i, 6,
1248 "IPv4 neighbor address: %s", ip_to_str (tvb_get_ptr(tvb, offset+13+i, 4)) );
1251 dissect_subclv_max_bw (tvb, ntree, offset+13+i);
1254 dissect_subclv_rsv_bw (tvb, ntree, offset+13+i);
1257 dissect_subclv_unrsv_bw (tvb, ntree, offset+13+i);
1260 proto_tree_add_text (ntree, tvb, offset+11+i, 5,
1261 "Traffic engineering default metric: %d",
1262 tvb_get_ntoh24(tvb, offset+13+i) );
1269 proto_tree_add_text (ntree, tvb, offset+11+i, clv_len+2,
1270 "Unknown Cisco specific extensions: code %d, length %d",
1271 clv_code, clv_len );
1274 proto_tree_add_text (ntree, tvb, offset+11+i, clv_len+2,
1275 "Unknown sub-CLV: code %d, length %d", clv_code, clv_len );
1282 len = 11 + subclvs_len;
1283 proto_item_set_len (ti, len);
1295 dissect_lsp_mt_is_reachability_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
1296 int id_length _U_, int length)
1299 proto_tree *ntree = NULL;
1308 while (length > 0) {
1310 /* fetch two bytes */
1311 mt_block = tvb_get_ntohs(tvb, offset);
1313 /* mask out the lower 12 bits */
1314 switch(mt_block&0x0fff) {
1316 strcpy(mt_desc,"IPv4 unicast");
1319 strcpy(mt_desc,"In-Band Management");
1322 strcpy(mt_desc,"IPv6 unicast");
1325 strcpy(mt_desc,"Multicast");
1328 strcpy(mt_desc,"Development, Experimental or Proprietary");
1331 strcpy(mt_desc,"Reserved for IETF Consensus");
1334 proto_tree_add_text ( tree, tvb, offset, 2 ,
1335 "%s Topology (0x%x)",
1339 ti = proto_tree_add_text (tree, tvb, offset+2, -1,
1341 print_system_id(tvb_get_ptr(tvb, offset+2, 7), 7) );
1343 ntree = proto_item_add_subtree (ti,
1344 ett_isis_lsp_part_of_clv_mt_is );
1346 proto_tree_add_text (ntree, tvb, offset+9, 3,
1347 "Metric: %d", tvb_get_ntoh24(tvb, offset+9) );
1349 subclvs_len = tvb_get_guint8(tvb, offset+12);
1350 if (subclvs_len == 0) {
1351 proto_tree_add_text (ntree, tvb, offset+12, 1, "no sub-TLVs present");
1353 proto_tree_add_text (ntree, tvb, offset+12, 1, "sub-TLVs present");
1356 len = 13 + subclvs_len;
1357 proto_item_set_len (ti, len);
1365 * Name: dissect_lsp_partition_dis_clv()
1368 * This CLV is used to indicate which system is the designated
1369 * IS for partition repair. This means just putting out the
1370 * "id_length"-octet IS.
1373 * tvbuff_t * : tvbuffer for packet data
1374 * proto_tree * : protocol display tree to fill out. May be NULL
1375 * int : offset into packet data where we are.
1376 * int : length of IDs in packet.
1377 * int : length of clv we are decoding
1380 * void, but we will add to proto tree if !NULL.
1383 dissect_lsp_partition_dis_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
1384 int id_length, int length)
1386 if ( length < id_length ) {
1387 isis_dissect_unknown(tvb, tree, offset,
1388 "short lsp partition DIS(%d vs %d)", length,
1393 * Gotta build a sub-tree for all our pieces
1396 proto_tree_add_text ( tree, tvb, offset, id_length,
1397 "Partition designated L2 IS: %s",
1398 print_system_id( tvb_get_ptr(tvb, offset, id_length), id_length ) );
1400 length -= id_length;
1401 offset += id_length;
1403 isis_dissect_unknown(tvb, tree, offset,
1404 "Long lsp partition DIS, %d left over", length );
1410 * Name: dissect_lsp_prefix_neighbors_clv()
1413 * The prefix CLV describes what other (OSI) networks we can reach
1414 * and what their cost is. It is built from a metric block
1415 * (see dissect_metric) followed by n addresses.
1418 * tvbuff_t * : tvbuffer for packet data
1419 * proto_tree * : protocol display tree to fill out. May be NULL
1420 * int : offset into packet data where we are.
1421 * int : length of IDs in packet.
1422 * int : length of clv we are decoding
1425 * void, but we will add to proto tree if !NULL.
1428 dissect_lsp_prefix_neighbors_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
1429 int id_length _U_, int length)
1435 isis_dissect_unknown(tvb, tree, offset,
1436 "Short lsp prefix neighbors (%d vs 4)", length );
1440 dissect_metric (tvb, tree, offset,
1441 tvb_get_guint8(tvb, offset), "Default", TRUE );
1442 dissect_metric (tvb, tree, offset+1,
1443 tvb_get_guint8(tvb, offset+1), "Delay", FALSE );
1444 dissect_metric (tvb, tree, offset+2,
1445 tvb_get_guint8(tvb, offset+2), "Expense", FALSE );
1446 dissect_metric (tvb, tree, offset+3,
1447 tvb_get_guint8(tvb, offset+3), "Error", FALSE );
1451 while ( length > 0 ) {
1452 mylen = tvb_get_guint8(tvb, offset);
1455 isis_dissect_unknown(tvb, tree, offset,
1456 "Zero payload space after length in prefix neighbor" );
1459 if ( mylen > length) {
1460 isis_dissect_unknown(tvb, tree, offset,
1461 "Interal length of prefix neighbor too long (%d vs %d)",
1467 * Lets turn the area address into "standard" 0000.0000.etc
1470 sbuf = print_area( tvb_get_ptr(tvb, offset+1, mylen), mylen );
1471 /* and spit it out */
1473 proto_tree_add_text ( tree, tvb, offset, mylen + 1,
1474 "Area address (%d): %s", mylen, sbuf );
1476 offset += mylen + 1;
1477 length -= mylen; /* length already adjusted for len fld*/
1482 * Name: isis_dissect_isis_lsp()
1485 * Print out the LSP part of the main header and then call the CLV
1486 * de-mangler with the right list of valid CLVs.
1489 * tvbuff_t * : tvbuffer for packet data
1490 * proto_tree * : protocol display tree to add to. May be NULL.
1491 * int offset : our offset into packet data.
1492 * int : LSP type, a la packet-isis.h ISIS_TYPE_* values
1493 * int : header length of packet.
1494 * int : length of IDs in packet.
1497 * void, but we will add to proto tree if !NULL.
1500 isis_dissect_isis_lsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset,
1501 int lsp_type, int header_length, int id_length)
1504 proto_tree *lsp_tree = NULL;
1507 int inx, q, some, value, len;
1510 ti = proto_tree_add_text(tree, tvb, offset, -1,
1512 lsp_tree = proto_item_add_subtree(ti, ett_isis_lsp);
1515 pdu_length = tvb_get_ntohs(tvb, offset);
1517 proto_tree_add_uint(lsp_tree, hf_isis_lsp_pdu_length, tvb,
1518 offset, 2, pdu_length);
1523 proto_tree_add_text(lsp_tree, tvb, offset, 2,
1524 "Remaining Lifetime: %us",
1525 tvb_get_ntohs(tvb, offset));
1530 proto_tree_add_text(lsp_tree, tvb, offset, id_length + 2,
1532 print_system_id( tvb_get_ptr(tvb, offset, id_length+2), id_length+2 ) );
1535 if (check_col(pinfo->cinfo, COL_INFO)) {
1536 col_append_fstr(pinfo->cinfo, COL_INFO, ", LSP-ID: %s",
1537 print_system_id( tvb_get_ptr(tvb, offset, id_length+2), id_length+2 ) );
1539 offset += id_length + 2;
1542 proto_tree_add_uint(lsp_tree, hf_isis_lsp_sequence_number, tvb,
1544 tvb_get_ntohl(tvb, offset));
1546 if (check_col(pinfo->cinfo, COL_INFO)) {
1547 col_append_fstr(pinfo->cinfo, COL_INFO, ", Sequence: 0x%08x, Lifetime: %5us",
1548 tvb_get_ntohl(tvb, offset),
1549 tvb_get_ntohs(tvb, offset - (id_length+2+2)));
1554 /* XXX -> we could validate the cksum here! */
1555 proto_tree_add_uint(lsp_tree, hf_isis_lsp_checksum, tvb,
1556 offset, 2, tvb_get_ntohs(tvb, offset));
1562 * We need to build our type block values.
1566 value = ISIS_LSP_ATT(tvb_get_guint8(tvb, offset));
1568 for ( q = (1<<ISIS_LSP_ATT_SHIFT); q > 0; q = q >> 1 ){
1573 strcat ( sbuf, isis_lsp_attached_bits[inx] );
1578 strcat ( sbuf, "default-only" );
1580 proto_tree_add_text(lsp_tree, tvb, offset + 18, 1,
1581 "Type block(0x%02x): P:%d, Supported metric(s): %s, OL:%d, istype:%s",
1582 tvb_get_guint8(tvb, offset),
1583 ISIS_LSP_PARTITION(tvb_get_guint8(tvb, offset)) ? 1 : 0,
1585 ISIS_LSP_HIPPITY(tvb_get_guint8(tvb, offset)) ? 1 : 0,
1586 val_to_str(ISIS_LSP_IS_TYPE(tvb_get_guint8(tvb, offset)),
1587 isis_lsp_istype_vals, "Unknown (0x%x)")
1592 len = pdu_length - header_length;
1594 isis_dissect_unknown(tvb, tree, offset,
1595 "packet header length %d went beyond packet",
1600 * Now, we need to decode our CLVs. We need to pass in
1601 * our list of valid ones!
1603 if (lsp_type == ISIS_TYPE_L1_LSP){
1604 isis_dissect_clvs(tvb, lsp_tree, offset,
1605 clv_l1_lsp_opts, len, id_length,
1606 ett_isis_lsp_clv_unknown );
1608 isis_dissect_clvs(tvb, lsp_tree, offset,
1609 clv_l2_lsp_opts, len, id_length,
1610 ett_isis_lsp_clv_unknown );
1614 * Name: isis_register_lsp()
1617 * Register our protocol sub-sets with protocol manager.
1620 * int : protocol index for the ISIS protocol
1626 isis_register_lsp(int proto_isis) {
1627 static hf_register_info hf[] = {
1628 { &hf_isis_lsp_pdu_length,
1629 { "PDU length", "isis.lsp.pdu_length", FT_UINT16,
1630 BASE_DEC, NULL, 0x0, "", HFILL }},
1632 { &hf_isis_lsp_remaining_life,
1633 { "Remaining lifetime", "isis.lsp.remaining_life", FT_UINT16,
1634 BASE_DEC, NULL, 0x0, "", HFILL }},
1636 { &hf_isis_lsp_sequence_number,
1637 { "Sequence number", "isis.lsp.sequence_number",
1638 FT_UINT32, BASE_HEX, NULL, 0x0, "", HFILL }},
1640 { &hf_isis_lsp_checksum,
1641 { "Checksum", "isis.lsp.checksum",FT_UINT16,
1642 BASE_HEX, NULL, 0x0, "", HFILL }},
1644 { &hf_isis_lsp_clv_ipv4_int_addr,
1645 { "IPv4 interface address", "isis.lsp.clv_ipv4_int_addr", FT_IPv4,
1646 BASE_NONE, NULL, 0x0, "", HFILL }},
1648 { &hf_isis_lsp_clv_ipv6_int_addr,
1649 { "IPv6 interface address", "isis.lsp.clv_ipv6_int_addr", FT_IPv6,
1650 BASE_NONE, NULL, 0x0, "", HFILL }},
1652 { &hf_isis_lsp_clv_te_router_id,
1653 { "Traffic Engineering Router ID", "isis.lsp.clv_te_router_id", FT_IPv4,
1654 BASE_NONE, NULL, 0x0, "", HFILL }},
1656 { &hf_isis_lsp_clv_mt,
1657 { "MT-ID ", "isis.lsp.clv_mt",
1658 FT_UINT16, BASE_HEX, NULL, 0x0, "", HFILL }},
1660 static gint *ett[] = {
1662 &ett_isis_lsp_clv_area_addr,
1663 &ett_isis_lsp_clv_is_neighbors,
1664 &ett_isis_lsp_clv_ext_is_reachability, /* CLV 22 */
1665 &ett_isis_lsp_part_of_clv_ext_is_reachability,
1666 &ett_isis_lsp_subclv_admin_group,
1667 &ett_isis_lsp_subclv_unrsv_bw,
1668 &ett_isis_lsp_clv_unknown,
1669 &ett_isis_lsp_clv_partition_dis,
1670 &ett_isis_lsp_clv_prefix_neighbors,
1671 &ett_isis_lsp_clv_auth,
1672 &ett_isis_lsp_clv_nlpid,
1673 &ett_isis_lsp_clv_hostname,
1674 &ett_isis_lsp_clv_ipv4_int_addr,
1675 &ett_isis_lsp_clv_ipv6_int_addr, /* CLV 232 */
1676 &ett_isis_lsp_clv_te_router_id,
1677 &ett_isis_lsp_clv_ip_reachability,
1678 &ett_isis_lsp_clv_ext_ip_reachability, /* CLV 135 */
1679 &ett_isis_lsp_part_of_clv_ext_ip_reachability,
1680 &ett_isis_lsp_clv_ipv6_reachability, /* CLV 236 */
1681 &ett_isis_lsp_part_of_clv_ipv6_reachability,
1682 &ett_isis_lsp_clv_mt,
1683 &ett_isis_lsp_clv_mt_is,
1684 &ett_isis_lsp_part_of_clv_mt_is,
1687 proto_register_field_array(proto_isis, hf, array_length(hf));
1688 proto_register_subtree_array(ett, array_length(ett));