2 * Routines for decoding isis lsp packets and their CLVs
4 * $Id: packet-isis-lsp.c,v 1.28 2002/04/07 23:39:00 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.
30 #ifdef HAVE_SYS_TYPES_H
31 # include <sys/types.h>
38 #ifdef HAVE_NET_INET_H
42 #include "epan/ipv4.h"
43 #include <epan/packet.h>
44 #include "packet-osi.h"
45 #include "packet-ipv6.h"
46 #include "packet-isis.h"
47 #include "packet-isis-clv.h"
48 #include "packet-isis-lsp.h"
49 #include <epan/resolv.h>
52 static int hf_isis_lsp_pdu_length = -1;
53 static int hf_isis_lsp_remaining_life = -1;
54 static int hf_isis_lsp_sequence_number = -1;
55 static int hf_isis_lsp_checksum = -1;
56 static int hf_isis_lsp_clv_ipv4_int_addr = -1;
57 static int hf_isis_lsp_clv_ipv6_int_addr = -1;
58 static int hf_isis_lsp_clv_te_router_id = -1;
59 static int hf_isis_lsp_clv_mt = -1;
61 static gint ett_isis_lsp = -1;
62 static gint ett_isis_lsp_clv_area_addr = -1;
63 static gint ett_isis_lsp_clv_is_neighbors = -1;
64 static gint ett_isis_lsp_clv_ext_is_reachability = -1; /* CLV 22 */
65 static gint ett_isis_lsp_part_of_clv_ext_is_reachability = -1;
66 static gint ett_isis_lsp_subclv_admin_group = -1;
67 static gint ett_isis_lsp_subclv_unrsv_bw = -1;
68 static gint ett_isis_lsp_clv_unknown = -1;
69 static gint ett_isis_lsp_clv_partition_dis = -1;
70 static gint ett_isis_lsp_clv_prefix_neighbors = -1;
71 static gint ett_isis_lsp_clv_nlpid = -1;
72 static gint ett_isis_lsp_clv_hostname = -1;
73 static gint ett_isis_lsp_clv_te_router_id = -1;
74 static gint ett_isis_lsp_clv_auth = -1;
75 static gint ett_isis_lsp_clv_ipv4_int_addr = -1;
76 static gint ett_isis_lsp_clv_ipv6_int_addr = -1; /* CLV 232 */
77 static gint ett_isis_lsp_clv_ip_reachability = -1;
78 static gint ett_isis_lsp_clv_ext_ip_reachability = -1; /* CLV 135 */
79 static gint ett_isis_lsp_part_of_clv_ext_ip_reachability = -1;
80 static gint ett_isis_lsp_clv_ipv6_reachability = -1; /* CLV 236 */
81 static gint ett_isis_lsp_part_of_clv_ipv6_reachability = -1;
82 static gint ett_isis_lsp_clv_mt = -1;
83 static gint ett_isis_lsp_clv_mt_is = -1;
84 static gint ett_isis_lsp_part_of_clv_mt_is = -1;
86 static const char *isis_lsp_attached_bits[] = {
87 "error", "expense", "delay", "default" };
89 static const value_string isis_lsp_istype_vals[] = {
90 { ISIS_LSP_TYPE_UNUSED0, "Unused 0x0 (invalid)"},
91 { ISIS_LSP_TYPE_LEVEL_1, "Level 1 IS"},
92 { ISIS_LSP_TYPE_UNUSED2, "Unused 0x2 (invalid)"},
93 { ISIS_LSP_TYPE_LEVEL_2, "Level 1 and Level 2 IS"},
97 * Predclare dissectors for use in clv dissection.
99 static void dissect_lsp_prefix_neighbors_clv(tvbuff_t *tvb,
100 proto_tree *tree, int offset, int id_length, int length);
101 static void dissect_lsp_partition_dis_clv(tvbuff_t *tvb,
102 proto_tree *tree, int offset, int id_length, int length);
103 static void dissect_lsp_mt_is_reachability_clv(tvbuff_t *tvb,
104 proto_tree *tree, int offset, int id_length, int length);
105 static void dissect_lsp_ext_is_reachability_clv(tvbuff_t *tvb,
106 proto_tree *tree, int offset, int id_length, int length);
107 static void dissect_lsp_l2_is_neighbors_clv(tvbuff_t *tvb,
108 proto_tree *tree, int offset, int id_length, int length);
109 static void dissect_lsp_l1_es_neighbors_clv(tvbuff_t *tvb,
110 proto_tree *tree, int offset, int id_length, int length);
111 static void dissect_lsp_l1_is_neighbors_clv(tvbuff_t *tvb,
112 proto_tree *tree, int offset, int id_length, int length);
113 static void dissect_lsp_area_address_clv(tvbuff_t *tvb,
114 proto_tree *tree, int offset, int id_length, int length);
115 static void dissect_lsp_l2_auth_clv(tvbuff_t *tvb,
116 proto_tree *tree, int offset, int id_length, int length);
117 static void dissect_lsp_l1_auth_clv(tvbuff_t *tvb,
118 proto_tree *tree, int offset, int id_length, int length);
119 static void dissect_lsp_ipv6_int_addr_clv(tvbuff_t *tvb,
120 proto_tree *tree, int offset, int id_length, int length);
121 static void dissect_lsp_ip_int_addr_clv(tvbuff_t *tvb,
122 proto_tree *tree, int offset, int id_length, int length);
123 static void dissect_lsp_te_router_id_clv(tvbuff_t *tvb,
124 proto_tree *tree, int offset, int id_length, int length);
125 static void dissect_lsp_hostname_clv(tvbuff_t *tvb,
126 proto_tree *tree, int offset, int id_length, int length);
127 static void dissect_lsp_mt_clv(tvbuff_t *tvb,
128 proto_tree *tree, int offset, int id_length, int length);
129 static void dissect_lsp_nlpid_clv(tvbuff_t *tvb,
130 proto_tree *tree, int offset, int id_length, int length);
131 static void dissect_lsp_ipv6_reachability_clv(tvbuff_t *tvb,
132 proto_tree *tree, int offset, int id_length, int length);
133 static void dissect_lsp_ext_ip_reachability_clv(tvbuff_t *tvb,
134 proto_tree *tree, int offset, int id_length, int length);
135 static void dissect_lsp_ip_reachability_clv(tvbuff_t *tvb,
136 proto_tree *tree, int offset, int id_length, int length);
140 static const isis_clv_handle_t clv_l1_lsp_opts[] = {
142 ISIS_CLV_L1_LSP_AREA_ADDRESS,
144 &ett_isis_lsp_clv_area_addr,
145 dissect_lsp_area_address_clv
148 ISIS_CLV_L1_LSP_IS_NEIGHBORS,
150 &ett_isis_lsp_clv_is_neighbors,
151 dissect_lsp_l1_is_neighbors_clv
154 ISIS_CLV_L1_LSP_ES_NEIGHBORS,
156 &ett_isis_lsp_clv_is_neighbors,
157 dissect_lsp_l1_es_neighbors_clv
160 ISIS_CLV_L1_LSP_EXT_IS_REACHABLE,
161 "Extended IS reachability",
162 &ett_isis_lsp_clv_ext_is_reachability,
163 dissect_lsp_ext_is_reachability_clv
166 ISIS_CLV_L1_LSP_IP_INT_REACHABLE,
167 "IP Internal reachability",
168 &ett_isis_lsp_clv_ip_reachability,
169 dissect_lsp_ip_reachability_clv
172 ISIS_CLV_L1_LSP_IP_EXT_REACHABLE,
173 "IP External reachability",
174 &ett_isis_lsp_clv_ip_reachability,
175 dissect_lsp_ip_reachability_clv
178 ISIS_CLV_L1_LSP_EXT_IP_REACHABLE,
179 "Extended IP Reachability",
180 &ett_isis_lsp_clv_ext_ip_reachability,
181 dissect_lsp_ext_ip_reachability_clv
184 ISIS_CLV_L1_LSP_IPv6_REACHABLE,
186 &ett_isis_lsp_clv_ipv6_reachability,
187 dissect_lsp_ipv6_reachability_clv
190 ISIS_CLV_L1_LSP_NLPID,
191 "Protocols supported",
192 &ett_isis_lsp_clv_nlpid,
193 dissect_lsp_nlpid_clv
196 ISIS_CLV_L1_LSP_HOSTNAME,
198 &ett_isis_lsp_clv_hostname,
199 dissect_lsp_hostname_clv
202 ISIS_CLV_L1_LSP_TE_ROUTER_ID,
203 "Traffic Engineering Router ID",
204 &ett_isis_lsp_clv_te_router_id,
205 dissect_lsp_te_router_id_clv
208 ISIS_CLV_L1_LSP_IP_INTERFACE_ADDR,
209 "IP Interface address(es)",
210 &ett_isis_lsp_clv_ipv4_int_addr,
211 dissect_lsp_ip_int_addr_clv
214 ISIS_CLV_L1_LSP_IPv6_INTERFACE_ADDR,
215 "IPv6 Interface address(es)",
216 &ett_isis_lsp_clv_ipv6_int_addr,
217 dissect_lsp_ipv6_int_addr_clv
220 ISIS_CLV_L1_LSP_AUTHENTICATION_NS,
221 "Authentication(non-spec)",
222 &ett_isis_lsp_clv_auth,
223 dissect_lsp_l1_auth_clv
226 ISIS_CLV_L1_LSP_AUTHENTICATION,
228 &ett_isis_lsp_clv_auth,
229 dissect_lsp_l1_auth_clv
234 &ett_isis_lsp_clv_mt,
238 ISIS_CLV_L1_LSP_MT_IS_REACHABLE,
239 "Multi Topology IS Reachability",
240 &ett_isis_lsp_clv_mt_is,
241 dissect_lsp_mt_is_reachability_clv
252 static const isis_clv_handle_t clv_l2_lsp_opts[] = {
254 ISIS_CLV_L1_LSP_AREA_ADDRESS,
256 &ett_isis_lsp_clv_area_addr,
257 dissect_lsp_area_address_clv
260 ISIS_CLV_L2_LSP_IS_NEIGHBORS,
262 &ett_isis_lsp_clv_is_neighbors,
263 dissect_lsp_l2_is_neighbors_clv
266 ISIS_CLV_L2_LSP_EXT_IS_REACHABLE,
267 "Extended IS reachability",
268 &ett_isis_lsp_clv_ext_is_reachability,
269 dissect_lsp_ext_is_reachability_clv
272 ISIS_CLV_L2_LSP_PARTITION_DIS,
273 "Parition Designated Level 2 IS",
274 &ett_isis_lsp_clv_partition_dis,
275 dissect_lsp_partition_dis_clv
278 ISIS_CLV_L2_LSP_PREFIX_NEIGHBORS,
280 &ett_isis_lsp_clv_prefix_neighbors,
281 dissect_lsp_prefix_neighbors_clv
284 ISIS_CLV_L2_LSP_IP_INT_REACHABLE,
285 "IP Internal reachability",
286 &ett_isis_lsp_clv_ip_reachability,
287 dissect_lsp_ip_reachability_clv
290 ISIS_CLV_L2_LSP_IP_EXT_REACHABLE,
291 "IP External reachability",
292 &ett_isis_lsp_clv_ip_reachability,
293 dissect_lsp_ip_reachability_clv
296 ISIS_CLV_L2_LSP_NLPID,
297 "Protocols supported",
298 &ett_isis_lsp_clv_nlpid,
299 dissect_lsp_nlpid_clv
302 ISIS_CLV_L2_LSP_HOSTNAME,
304 &ett_isis_lsp_clv_hostname,
305 dissect_lsp_hostname_clv
308 ISIS_CLV_L2_LSP_TE_ROUTER_ID,
309 "Traffic Engineering Router ID",
310 &ett_isis_lsp_clv_te_router_id,
311 dissect_lsp_te_router_id_clv
314 ISIS_CLV_L2_LSP_EXT_IP_REACHABLE,
315 "Extended IP Reachability",
316 &ett_isis_lsp_clv_ext_ip_reachability,
317 dissect_lsp_ext_ip_reachability_clv
320 ISIS_CLV_L2_LSP_IPv6_REACHABLE,
322 &ett_isis_lsp_clv_ipv6_reachability,
323 dissect_lsp_ipv6_reachability_clv
326 ISIS_CLV_L2_LSP_IP_INTERFACE_ADDR,
327 "IP Interface address(es)",
328 &ett_isis_lsp_clv_ipv4_int_addr,
329 dissect_lsp_ip_int_addr_clv
332 ISIS_CLV_L2_LSP_IPv6_INTERFACE_ADDR,
333 "IPv6 Interface address(es)",
334 &ett_isis_lsp_clv_ipv6_int_addr,
335 dissect_lsp_ipv6_int_addr_clv
338 ISIS_CLV_L2_LSP_AUTHENTICATION_NS,
339 "Authentication(non spec)",
340 &ett_isis_lsp_clv_auth,
341 dissect_lsp_l2_auth_clv
344 ISIS_CLV_L2_LSP_AUTHENTICATION,
346 &ett_isis_lsp_clv_auth,
347 dissect_lsp_l2_auth_clv
352 &ett_isis_lsp_clv_mt,
356 ISIS_CLV_L2_LSP_MT_IS_REACHABLE,
357 "Multi Topology IS Reachability",
358 &ett_isis_lsp_clv_mt_is,
359 dissect_lsp_mt_is_reachability_clv
371 * Name: dissect_metric()
374 * Display a metric prefix portion. ISIS has the concept of multple
375 * metric per prefix (default, delay, expense, and error). This
376 * routine assists other dissectors by adding a single one of
377 * these to the display tree..
379 * The 8th(msbit) bit in the metric octet is the "supported" bit. The
380 * "default" support is required, so we support a "force_supported"
381 * flag that tells us that it MUST be zero (zero==supported,
382 * so it really should be a "not supported" in the boolean sense)
383 * and to display a protocol failure accordingly. Notably,
384 * Cisco IOS 12(6) blows this!
385 * The 7th bit must be zero (reserved).
388 * tvbuff_t * : tvbuffer for packet data
389 * proto_tree * : protocol display tree to fill out. May be NULL
390 * int : offset into packet data where we are.
391 * guint8 : value of the metric.
392 * char * : string giving type of the metric.
393 * int : force supported. True is the supported bit MUST be zero.
396 * void, but we will add to proto tree if !NULL.
399 dissect_metric(tvbuff_t *tvb, proto_tree *tree, int offset, guint8 value,
400 char *pstr, int force_supported )
406 s = ISIS_LSP_CLV_METRIC_SUPPORTED(value);
407 proto_tree_add_text(tree, tvb, offset, 1,
408 "%s Metric: %s%s %s%d:%d", pstr,
409 s ? "Not supported" : "Supported",
410 (s && force_supported) ? "(but is required to be)":"",
411 ISIS_LSP_CLV_METRIC_RESERVED(value) ? "(reserved bit != 0)":"",
412 ISIS_LSP_CLV_METRIC_VALUE(value), value );
416 * Name: dissect_lsp_ip_reachability_clv()
419 * Decode an IP reachability CLV. This can be either internal or
420 * external (the clv format does not change and which type we are
421 * displaying is put there by the dispatcher). All of these
422 * are a metric block followed by an IP addr and mask.
425 * tvbuff_t * : tvbuffer for packet data
426 * proto_tree * : proto tree to build on (may be null)
427 * int : current offset into packet data
428 * int : length of IDs in packet.
429 * int : length of this clv
432 * void, will modify proto_tree if not null.
435 dissect_lsp_ip_reachability_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
436 int id_length, int length)
439 proto_tree *ntree = NULL;
440 guint32 src, mask, prefix_len;
442 guint32 bitmasks[33] = {
444 0x00000008, 0x0000000c, 0x0000000e, 0x0000000f,
445 0x000000f8, 0x000000fc, 0x000000fe, 0x000000ff,
446 0x000008ff, 0x00000cff, 0x00000eff, 0x00000fff,
447 0x0000f8ff, 0x0000fcff, 0x0000feff, 0x0000ffff,
448 0x0008ffff, 0x000cffff, 0x000effff, 0x000fffff,
449 0x00f8ffff, 0x00fcffff, 0x00feffff, 0x00ffffff,
450 0x08ffffff, 0x0cffffff, 0x0effffff, 0x0fffffff,
451 0xf8ffffff, 0xfcffffff, 0xfeffffff, 0xffffffff
455 while ( length > 0 ) {
457 isis_dissect_unknown(tvb, tree, offset,
458 "short IP reachability (%d vs 12)", length );
462 * Gotta build a sub-tree for all our pieces
465 tvb_memcpy(tvb, (guint8 *)&src, offset+4, 4);
466 tvb_memcpy(tvb, (guint8 *)&mask, offset+8, 4);
468 /* find out if the mask matches one of 33 possible prefix lengths */
472 while(prefix_len<=33) {
473 if (bitmasks[prefix_len++]==mask) {
479 /* 34 indicates no match -> must be a discontiguous netmask
480 lets dump the mask, otherwise print the prefix_len */
483 ti = proto_tree_add_text ( tree, tvb, offset, 12,
484 "IPv4 prefix: %s mask %s",
485 ip_to_str((guint8*)&src),
486 ip_to_str((guint8*)&mask));
488 ti = proto_tree_add_text ( tree, tvb, offset, 12,
489 "IPv4 prefix: %s/%d",
490 ip_to_str((guint8*)&src),
494 ntree = proto_item_add_subtree(ti,
495 ett_isis_lsp_clv_ip_reachability);
497 proto_tree_add_text (ntree, tvb, offset, 1,
498 "Default Metric: %d, %s, Distribution: %s",
499 ISIS_LSP_CLV_METRIC_VALUE(tvb_get_guint8(tvb, offset)),
500 ISIS_LSP_CLV_METRIC_IE(tvb_get_guint8(tvb, offset)) ? "External" : "Internal",
501 ISIS_LSP_CLV_METRIC_UPDOWN(tvb_get_guint8(tvb, offset)) ? "down" : "up");
504 if (ISIS_LSP_CLV_METRIC_SUPPORTED(tvb_get_guint8(tvb, offset+1))) {
505 proto_tree_add_text (ntree, tvb, offset+1, 1, "Delay Metric: Not supported");
507 proto_tree_add_text (ntree, tvb, offset+1, 1, "Delay Metric: %d, %s",
508 ISIS_LSP_CLV_METRIC_VALUE(tvb_get_guint8(tvb, offset+1)),
509 ISIS_LSP_CLV_METRIC_IE(tvb_get_guint8(tvb, offset+1)) ? "External" : "Internal");
512 if (ISIS_LSP_CLV_METRIC_SUPPORTED(tvb_get_guint8(tvb, offset+2))) {
513 proto_tree_add_text (ntree, tvb, offset+2, 1, "Expense Metric: Not supported");
515 proto_tree_add_text (ntree, tvb, offset+2, 1, "Exense Metric: %d, %s",
516 ISIS_LSP_CLV_METRIC_VALUE(tvb_get_guint8(tvb, offset+2)),
517 ISIS_LSP_CLV_METRIC_IE(tvb_get_guint8(tvb, offset+2)) ? "External" : "Internal");
520 if (ISIS_LSP_CLV_METRIC_SUPPORTED(tvb_get_guint8(tvb, offset+3))) {
521 proto_tree_add_text (ntree, tvb, offset+3, 1, "Error Metric: Not supported");
523 proto_tree_add_text (ntree, tvb, offset+3, 1, "Error Metric: %d, %s",
524 ISIS_LSP_CLV_METRIC_VALUE(tvb_get_guint8(tvb, offset+3)),
525 ISIS_LSP_CLV_METRIC_IE(tvb_get_guint8(tvb, offset+3)) ? "External" : "Internal");
534 * Name: dissect_lsp_ext_ip_reachability_clv()
536 * Description: Decode an Extended IP Reachability CLV - code 135.
538 * The extended IP reachability TLV is an extended version
539 * of the IP reachability TLVs (codes 128 and 130). It encodes
540 * the metric as a 32-bit unsigned interger and allows to add
544 * tvbuff_t * : tvbuffer for packet data
545 * proto_tree * : proto tree to build on (may be null)
546 * int : current offset into packet data
547 * int : length of IDs in packet.
548 * int : length of this clv
551 * void, will modify proto_tree if not null.
554 dissect_lsp_ext_ip_reachability_clv(tvbuff_t *tvb, proto_tree *tree,
555 int offset, int id_length, int length)
557 proto_item *pi = NULL;
558 proto_tree *subtree = NULL;
560 guint8 bit_length, byte_length;
567 memset (prefix, 0, 4);
568 ctrl_info = tvb_get_guint8(tvb, offset+4);
569 bit_length = ctrl_info & 0x3f;
570 byte_length = (bit_length + 7) / 8;
571 tvb_memcpy (tvb, prefix, offset+5, byte_length);
572 pi = proto_tree_add_text (tree, tvb, offset, -1,
573 "IPv4 prefix: %s/%d",
576 subtree = proto_item_add_subtree (pi,
577 ett_isis_lsp_part_of_clv_ext_ip_reachability);
579 proto_tree_add_text (subtree, tvb, offset, 4,
580 "Metric: %d, Distribution: %s", tvb_get_ntohl(tvb, offset), ((ctrl_info & 0x80) == 0) ? "up" : "down" );
582 proto_tree_add_text (subtree, tvb, offset+4, 1,
583 "%s sub-TLVs present",
584 ((ctrl_info & 0x40) == 0) ? "no" : "" );
586 len = 5 + byte_length;
587 if ((ctrl_info & 0x40) != 0)
588 len += 1 + tvb_get_guint8(tvb, offset+len) ;
589 proto_item_set_len (pi, len);
596 * Name: dissect_lsp_ipv6_reachability_clv()
598 * Description: Decode an IPv6 reachability CLV - code 236.
601 * tvbuff_t * : tvbuffer for packet data
602 * proto_tree * : proto tree to build on (may be null)
603 * int : current offset into packet data
604 * int : length of IDs in packet.
605 * int : length of this clv
608 * void, will modify proto_tree if not null.
611 dissect_lsp_ipv6_reachability_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
612 int id_length, int length)
615 proto_tree *ntree = NULL;
616 guint8 bit_length, byte_length;
617 struct e_in6_addr prefix;
624 memset (prefix.s6_addr, 0, 16);
627 bit_length = tvb_get_guint8(tvb, offset+5);
628 byte_length = (bit_length + 7) / 8;
629 tvb_memcpy (tvb, prefix.s6_addr, offset+6, byte_length);
630 ti = proto_tree_add_text (tree, tvb, offset, -1,
632 ip6_to_str (&prefix),
634 ntree = proto_item_add_subtree (ti, ett_isis_lsp_part_of_clv_ipv6_reachability);
636 metric = tvb_get_ntohl(tvb, offset);
637 proto_tree_add_text (ntree, tvb, offset, 4,
638 "Metric: %d", metric);
640 ctrl_info = tvb_get_guint8(tvb, offset+4);
641 proto_tree_add_text (ntree, tvb, offset+4, 1,
642 "Distribution: %s, %s",
643 ((ctrl_info & 0x80) == 0) ? "up" : "down",
644 ((ctrl_info & 0x40) == 0) ? "internal" : "external" );
646 proto_tree_add_text (ntree, tvb, offset+4, 1,
647 "Reserved bits: 0x%x",
648 (ctrl_info & 0x1f) );
649 proto_tree_add_text (ntree, tvb, offset+4, 1,
651 ((ctrl_info & 0x20) == 0) ? "no" : "yes" );
653 len = 6 + byte_length;
654 if ((ctrl_info & 0x20) != 0)
655 len += 1 + tvb_get_guint8(tvb, offset+len);
656 proto_item_set_len (ti, len);
663 * Name: dissect_lsp_nlpid_clv()
666 * Decode for a lsp packets NLPID clv. Calls into the
670 * tvbuff_t * : tvbuffer for packet data
671 * proto_tree * : proto tree to build on (may be null)
672 * int : current offset into packet data
673 * int : length of IDs in packet.
674 * int : length of this clv
677 * void, will modify proto_tree if not null.
680 dissect_lsp_nlpid_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
681 int id_length, int length)
683 isis_dissect_nlpid_clv(tvb, tree, offset, length);
687 * Name: dissect_lsp_mt_clv()
690 * Decode for a lsp packets Multi Topology clv. Calls into the
694 * tvbuff_t * : tvbuffer for packet data
695 * proto_tree * : proto tree to build on (may be null)
696 * int : current offset into packet data
697 * guint : length of this clv
698 * int : length of IDs in packet.
701 * void, will modify proto_tree if not null.
704 dissect_lsp_mt_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
705 int id_length, int length)
707 isis_dissect_mt_clv(tvb, tree, offset, length, hf_isis_lsp_clv_mt );
711 * Name: dissect_lsp_hostname_clv()
714 * Decode for a lsp packets hostname clv. Calls into the
718 * tvbuff_t * : tvbuffer for packet data
719 * proto_tree * : proto tree to build on (may be null)
720 * int : current offset into packet data
721 * int : length of IDs in packet.
722 * int : length of this clv
725 * void, will modify proto_tree if not null.
728 dissect_lsp_hostname_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
729 int id_length, int length)
731 isis_dissect_hostname_clv(tvb, tree, offset, length);
736 * Name: dissect_lsp_te_router_id_clv()
739 * Decode for a lsp packets Traffic Engineering ID clv. Calls into the
743 * tvbuff_t * : tvbuffer for packet data
744 * proto_tree * : proto tree to build on (may be null)
745 * int : current offset into packet data
746 * int : length of IDs in packet.
747 * int : length of this clv
750 * void, will modify proto_tree if not null.
753 dissect_lsp_te_router_id_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
754 int id_length, int length)
756 isis_dissect_te_router_id_clv(tvb, tree, offset, length,
757 hf_isis_lsp_clv_te_router_id );
762 * Name: dissect_lsp_ip_int_addr_clv()
765 * Decode for a lsp packets ip interface addr clv. Calls into the
769 * tvbuff_t * : tvbuffer for packet data
770 * proto_tree * : proto tree to build on (may be null)
771 * int : current offset into packet data
772 * int : length of IDs in packet.
773 * int : length of this clv
776 * void, will modify proto_tree if not null.
779 dissect_lsp_ip_int_addr_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
780 int id_length, int length)
782 isis_dissect_ip_int_clv(tvb, tree, offset, length,
783 hf_isis_lsp_clv_ipv4_int_addr );
787 * Name: dissect_lsp_ipv6_int_addr_clv()
789 * Description: Decode an IPv6 interface addr CLV - code 232.
791 * Calls into the clv common one.
794 * tvbuff_t * : tvbuffer for packet data
795 * proto_tree * : proto tree to build on (may be null)
796 * int : current offset into packet data
797 * int : length of IDs in packet.
798 * int : length of this clv
801 * void, will modify proto_tree if not null.
804 dissect_lsp_ipv6_int_addr_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
805 int id_length, int length)
807 isis_dissect_ipv6_int_clv(tvb, tree, offset, length,
808 hf_isis_lsp_clv_ipv6_int_addr );
812 * Name: dissect_lsp_L1_auth_clv()
815 * Decode for a lsp packets authenticaion clv. Calls into the
816 * clv common one. An auth inside a L1 LSP is a per area password
819 * tvbuff_t * : tvbuffer for packet data
820 * proto_tree * : proto tree to build on (may be null)
821 * int : current offset into packet data
822 * int : length of IDs in packet.
823 * int : length of this clv
826 * void, will modify proto_tree if not null.
829 dissect_lsp_l1_auth_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
830 int id_length, int length)
832 isis_dissect_authentication_clv(tvb, tree, offset, length,
833 "Per area authentication" );
837 * Name: dissect_lsp_L2_auth_clv()
840 * Decode for a lsp packets authenticaion clv. Calls into the
841 * clv common one. An auth inside a L2 LSP is a per domain password
844 * tvbuff_t * : tvbuffer for packet data
845 * proto_tree * : proto tree to build on (may be null)
846 * int : current offset into packet data
847 * int : length of IDs in packet.
848 * int : length of this clv
851 * void, will modify proto_tree if not null.
854 dissect_lsp_l2_auth_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
855 int id_length, int length)
857 isis_dissect_authentication_clv(tvb, tree, offset, length,
858 "Per domain authentication" );
862 * Name: dissect_lsp_area_address_clv()
865 * Decode for a lsp packet's area address clv. Call into clv common
869 * tvbuff_t * : tvbuffer for packet data
870 * proto_tree * : protocol display tree to fill out. May be NULL
871 * int : offset into packet data where we are.
872 * int : length of IDs in packet.
873 * int : length of clv we are decoding
876 * void, but we will add to proto tree if !NULL.
879 dissect_lsp_area_address_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
880 int id_length, int length)
882 isis_dissect_area_address_clv(tvb, tree, offset, length);
886 * Name: dissect_lsp_eis_neighbors_clv_inner()
889 * Real work horse for showing neighbors. This means we decode the
890 * first octet as either virtual/!virtual (if show_virtual param is
891 * set), or as a must == 0 reserved value.
893 * Once past that, we decode n neighbor elements. Each neighbor
894 * is comprised of a metric block (is dissect_metric) and the
898 * tvbuff_t * : tvbuffer for packet data
899 * proto_tree * : protocol display tree to fill out. May be NULL
900 * int : offset into packet data where we are.
901 * int : length of IDs in packet.
902 * int : length of clv we are decoding
903 * int : set to decode first octet as virtual vs reserved == 0
904 * int : set to indicate EIS instead of IS (6 octet per addr instead of 7)
907 * void, but we will add to proto tree if !NULL.
910 dissect_lsp_eis_neighbors_clv_inner(tvbuff_t *tvb, proto_tree *tree,
911 int offset, int length, int id_length, int show_virtual, int is_eis)
914 proto_tree *ntree = NULL;
918 id_length++; /* IDs are one octet longer in IS neighbours */
920 if ( show_virtual ) {
921 /* virtual path flag */
922 proto_tree_add_text ( tree, tvb, offset, 1,
923 tvb_get_guint8(tvb, offset) ? "IsVirtual" : "IsNotVirtual" );
925 proto_tree_add_text ( tree, tvb, offset, 1,
926 "Reserved value 0x%02x, must == 0",
927 tvb_get_guint8(tvb, offset) );
933 tlen = 4 + id_length;
935 while ( length > 0 ) {
937 isis_dissect_unknown(tvb, tree, offset,
938 "short E/IS reachability (%d vs %d)", length,
943 * Gotta build a sub-tree for all our pieces
947 ti = proto_tree_add_text(tree, tvb, offset, tlen,
949 print_system_id( tvb_get_ptr(tvb, offset+4, id_length), id_length ) );
951 ti = proto_tree_add_text(tree, tvb, offset, tlen,
953 print_system_id(tvb_get_ptr(tvb, offset+4, id_length), id_length ) );
955 ntree = proto_item_add_subtree(ti,
956 ett_isis_lsp_clv_is_neighbors);
960 proto_tree_add_text (ntree, tvb, offset, 1,
961 "Default Metric: %d, %s",
962 ISIS_LSP_CLV_METRIC_VALUE(tvb_get_guint8(tvb, offset)),
963 ISIS_LSP_CLV_METRIC_IE(tvb_get_guint8(tvb, offset)) ? "External" : "Internal");
965 if (ISIS_LSP_CLV_METRIC_SUPPORTED(tvb_get_guint8(tvb, offset+1))) {
966 proto_tree_add_text (ntree, tvb, offset+1, 1, "Delay Metric: Not supported");
968 proto_tree_add_text (ntree, tvb, offset+1, 1, "Delay Metric: %d, %s",
969 ISIS_LSP_CLV_METRIC_VALUE(tvb_get_guint8(tvb, offset+1)),
970 ISIS_LSP_CLV_METRIC_IE(tvb_get_guint8(tvb, offset+1)) ? "External" : "Internal");
974 if (ISIS_LSP_CLV_METRIC_SUPPORTED(tvb_get_guint8(tvb, offset+2))) {
975 proto_tree_add_text (ntree, tvb, offset+2, 1, "Expense Metric: Not supported");
977 proto_tree_add_text (ntree, tvb, offset+2, 1, "Expense Metric: %d, %s",
978 ISIS_LSP_CLV_METRIC_VALUE(tvb_get_guint8(tvb, offset+2)),
979 ISIS_LSP_CLV_METRIC_IE(tvb_get_guint8(tvb, offset+2)) ? "External" : "Internal");
982 if (ISIS_LSP_CLV_METRIC_SUPPORTED(tvb_get_guint8(tvb, offset+3))) {
983 proto_tree_add_text (ntree, tvb, offset+3, 1, "Error Metric: Not supported");
985 proto_tree_add_text (ntree, tvb, offset+3, 1, "Error Metric: %d, %s",
986 ISIS_LSP_CLV_METRIC_VALUE(tvb_get_guint8(tvb, offset+3)),
987 ISIS_LSP_CLV_METRIC_IE(tvb_get_guint8(tvb, offset+3)) ? "External" : "Internal");
997 * Name: dissect_lsp_l1_is_neighbors_clv()
1000 * Dispatch a l1 intermediate system neighbor by calling
1001 * the inner function with show virtual set to TRUE and is es set to FALSE.
1004 * tvbuff_t * : tvbuffer for packet data
1005 * proto_tree * : protocol display tree to fill out. May be NULL
1006 * int : offset into packet data where we are.
1007 * int : length of IDs in packet.
1008 * int : length of clv we are decoding
1011 * void, but we will add to proto tree if !NULL.
1014 dissect_lsp_l1_is_neighbors_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
1015 int id_length, int length)
1017 dissect_lsp_eis_neighbors_clv_inner(tvb, tree, offset,
1018 length, id_length, TRUE, FALSE);
1022 * Name: dissect_lsp_l1_es_neighbors_clv()
1025 * Dispatch a l1 end or intermediate system neighbor by calling
1026 * the inner function with show virtual set to TRUE and es set to TRUE.
1029 * tvbuff_t * : tvbuffer for packet data
1030 * proto_tree * : protocol display tree to fill out. May be NULL
1031 * int : offset into packet data where we are.
1032 * int : length of IDs in packet.
1033 * int : length of clv we are decoding
1036 * void, but we will add to proto tree if !NULL.
1039 dissect_lsp_l1_es_neighbors_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
1040 int id_length, int length)
1042 dissect_lsp_eis_neighbors_clv_inner(tvb, tree, offset,
1043 length, id_length, TRUE, TRUE);
1047 * Name: dissect_lsp_l2_is_neighbors_clv()
1050 * Dispatch a l2 intermediate system neighbor by calling
1051 * the inner function with show virtual set to FALSE, and is es set
1055 * tvbuff_t * : tvbuffer for packet data
1056 * proto_tree * : protocol display tree to fill out. May be NULL
1057 * int : offset into packet data where we are.
1058 * int : length of IDs in packet.
1059 * int : length of clv we are decoding
1062 * void, but we will add to proto tree if !NULL.
1065 dissect_lsp_l2_is_neighbors_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
1066 int id_length, int length)
1068 dissect_lsp_eis_neighbors_clv_inner(tvb, tree, offset,
1069 length, id_length, FALSE, FALSE);
1074 * Name: dissect_subclv_admin_group ()
1076 * Description: Called by function dissect_lsp_ext_is_reachability_clv().
1078 * This function is called by dissect_lsp_ext_is_reachability_clv()
1079 * for dissect the administrive group sub-CLV (code 3).
1082 * tvbuff_t * : tvbuffer for packet data
1083 * proto_tree * : protocol display tree to fill out.
1084 * int : offset into packet data where we are (beginning of the sub_clv value).
1090 dissect_subclv_admin_group (tvbuff_t *tvb, proto_tree *tree, int offset) {
1097 ti = proto_tree_add_text(tree, tvb, offset-2, 6, "Administrative group(s):");
1098 ntree = proto_item_add_subtree (ti, ett_isis_lsp_subclv_admin_group);
1100 clv_value = tvb_get_ntohl(tvb, offset);
1102 for (i = 0 ; i < 32 ; i++) {
1103 if ( (clv_value & mask) != 0 ) {
1104 proto_tree_add_text (ntree, tvb, offset, 4, "group %d", i);
1111 * Name: dissect_subclv_max_bw ()
1113 * Description: Called by function dissect_lsp_ext_is_reachability_clv().
1115 * This function is called by dissect_lsp_ext_is_reachability_clv()
1116 * for dissect the maximum link bandwidth sub-CLV (code 9).
1119 * tvbuff_t * : tvbuffer for packet data
1120 * proto_tree * : protocol display tree to fill out.
1121 * int : offset into packet data where we are (beginning of the sub_clv value).
1127 dissect_subclv_max_bw(tvbuff_t *tvb, proto_tree *tree, int offset)
1132 ui = tvb_get_ntohl(tvb, offset);
1133 memcpy (&bw, &ui, 4);
1134 proto_tree_add_text (tree, tvb, offset-2, 6,
1135 "Maximum link bandwidth : %.2f Mbps", bw*8/1000000 );
1139 * Name: dissect_subclv_rsv_bw ()
1141 * Description: Called by function dissect_lsp_ext_is_reachability_clv().
1143 * This function is called by dissect_lsp_ext_is_reachability_clv()
1144 * for dissect the reservable link bandwidth sub-CLV (code 10).
1147 * tvbuff_t * : tvbuffer for packet data
1148 * proto_tree * : protocol display tree to fill out.
1149 * int : offset into packet data where we are (beginning of the sub_clv value).
1155 dissect_subclv_rsv_bw(tvbuff_t *tvb, proto_tree *tree, int offset)
1160 ui = tvb_get_ntohl(tvb, offset);
1161 memcpy (&bw, &ui, 4);
1162 proto_tree_add_text (tree, tvb, offset-2, 6,
1163 "Reservable link bandwidth: %.2f Mbps", bw*8/1000000 );
1167 * Name: dissect_subclv_unrsv_bw ()
1169 * Description: Called by function dissect_lsp_ext_is_reachability_clv().
1171 * This function is called by dissect_lsp_ext_is_reachability_clv()
1172 * for dissect the unreserved bandwidth sub-CLV (code 11).
1175 * tvbuff_t * : tvbuffer for packet data
1176 * proto_tree * : protocol display tree to fill out.
1177 * int : offset into packet data where we are (beginning of the sub_clv value).
1183 dissect_subclv_unrsv_bw(tvbuff_t *tvb, proto_tree *tree, int offset)
1191 ti = proto_tree_add_text (tree, tvb, offset-2, 34, "Unreserved bandwidth:");
1192 ntree = proto_item_add_subtree (ti, ett_isis_lsp_subclv_unrsv_bw);
1194 for (i = 0 ; i < 8 ; i++) {
1195 ui = tvb_get_ntohl(tvb, offset);;
1196 memcpy (&bw, &ui, 4);
1197 proto_tree_add_text (ntree, tvb, offset+4*i, 4,
1198 "priority level %d: %.2f Mbps", i, bw*8/1000000 );
1203 * Name: dissect_lsp_ext_is_reachability_clv()
1205 * Description: Decode a Extended IS Reachability CLV - code 22
1207 * The extended IS reachability TLV is an extended version
1208 * of the IS reachability TLV (code 2). It encodes the metric
1209 * as a 24-bit unsigned interger and allows to add sub-CLV(s).
1212 * tvbuff_t * : tvbuffer for packet data
1213 * proto_tree * : protocol display tree to fill out. May be NULL
1214 * int : offset into packet data where we are.
1215 * int : length of IDs in packet.
1216 * int : length of clv we are decoding
1219 * void, but we will add to proto tree if !NULL.
1222 dissect_lsp_ext_is_reachability_clv(tvbuff_t *tvb, proto_tree *tree,
1223 int offset, int id_length, int length)
1226 proto_tree *ntree = NULL;
1229 guint8 clv_code, clv_len;
1233 while (length > 0) {
1234 ti = proto_tree_add_text (tree, tvb, offset, -1,
1236 print_system_id (tvb_get_ptr(tvb, offset, 7), 7) );
1237 ntree = proto_item_add_subtree (ti,
1238 ett_isis_lsp_part_of_clv_ext_is_reachability );
1240 proto_tree_add_text (ntree, tvb, offset+7, 3,
1241 "Metric: %d", tvb_get_ntoh24(tvb, offset+7) );
1243 subclvs_len = tvb_get_guint8(tvb, offset+10);
1244 if (subclvs_len == 0) {
1245 proto_tree_add_text (ntree, tvb, offset+10, 1, "no sub-TLVs present");
1249 while (i < subclvs_len) {
1250 clv_code = tvb_get_guint8(tvb, offset+11+i);
1251 clv_len = tvb_get_guint8(tvb, offset+12+i);
1254 dissect_subclv_admin_group(tvb, ntree, offset+13+i);
1257 proto_tree_add_text (ntree, tvb, offset+11+i, 6,
1258 "IPv4 interface address: %s", ip_to_str (tvb_get_ptr(tvb, offset+13+i, 4)) );
1261 proto_tree_add_text (ntree, tvb, offset+11+i, 6,
1262 "IPv4 neighbor address: %s", ip_to_str (tvb_get_ptr(tvb, offset+13+i, 4)) );
1265 dissect_subclv_max_bw (tvb, ntree, offset+13+i);
1268 dissect_subclv_rsv_bw (tvb, ntree, offset+13+i);
1271 dissect_subclv_unrsv_bw (tvb, ntree, offset+13+i);
1274 proto_tree_add_text (ntree, tvb, offset+11+i, 5,
1275 "Traffic engineering default metric: %d",
1276 tvb_get_ntoh24(tvb, offset+13+i) );
1283 proto_tree_add_text (ntree, tvb, offset+11+i, clv_len+2,
1284 "Unknown Cisco specific extensions: code %d, length %d",
1285 clv_code, clv_len );
1288 proto_tree_add_text (ntree, tvb, offset+11+i, clv_len+2,
1289 "Unknown sub-CLV: code %d, length %d", clv_code, clv_len );
1296 len = 11 + subclvs_len;
1297 proto_item_set_len (ti, len);
1309 dissect_lsp_mt_is_reachability_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
1310 int id_length, int length)
1313 proto_tree *ntree = NULL;
1322 while (length > 0) {
1324 /* fetch two bytes */
1325 mt_block = tvb_get_ntohs(tvb, offset);
1327 /* mask out the lower 12 bits */
1328 switch(mt_block&0x0fff) {
1330 strcpy(mt_desc,"IPv4 unicast");
1333 strcpy(mt_desc,"In-Band Management");
1336 strcpy(mt_desc,"IPv6 unicast");
1339 strcpy(mt_desc,"Multicast");
1342 strcpy(mt_desc,"Development, Experimental or Proprietary");
1345 strcpy(mt_desc,"Reserved for IETF Consensus");
1348 proto_tree_add_text ( tree, tvb, offset, 2 ,
1349 "%s Topology (0x%x)",
1353 ti = proto_tree_add_text (tree, tvb, offset+2, -1,
1355 print_system_id(tvb_get_ptr(tvb, offset+2, 7), 7) );
1357 ntree = proto_item_add_subtree (ti,
1358 ett_isis_lsp_part_of_clv_mt_is );
1360 proto_tree_add_text (ntree, tvb, offset+9, 3,
1361 "Metric: %d", tvb_get_ntoh24(tvb, offset+9) );
1363 subclvs_len = tvb_get_guint8(tvb, offset+12);
1364 if (subclvs_len == 0) {
1365 proto_tree_add_text (ntree, tvb, offset+12, 1, "no sub-TLVs present");
1367 proto_tree_add_text (ntree, tvb, offset+12, 1, "sub-TLVs present");
1370 len = 13 + subclvs_len;
1371 proto_item_set_len (ti, len);
1379 * Name: dissect_lsp_partition_dis_clv()
1382 * This CLV is used to indicate which system is the designated
1383 * IS for partition repair. This means just putting out the
1384 * "id_length"-octet IS.
1387 * tvbuff_t * : tvbuffer for packet data
1388 * proto_tree * : protocol display tree to fill out. May be NULL
1389 * int : offset into packet data where we are.
1390 * int : length of IDs in packet.
1391 * int : length of clv we are decoding
1394 * void, but we will add to proto tree if !NULL.
1397 dissect_lsp_partition_dis_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
1398 int id_length, int length)
1400 if ( length < id_length ) {
1401 isis_dissect_unknown(tvb, tree, offset,
1402 "short lsp partition DIS(%d vs %d)", length,
1407 * Gotta build a sub-tree for all our pieces
1410 proto_tree_add_text ( tree, tvb, offset, id_length,
1411 "Partition designated L2 IS: %s",
1412 print_system_id( tvb_get_ptr(tvb, offset, id_length), id_length ) );
1414 length -= id_length;
1415 offset += id_length;
1417 isis_dissect_unknown(tvb, tree, offset,
1418 "Long lsp partition DIS, %d left over", length );
1424 * Name: dissect_lsp_prefix_neighbors_clv()
1427 * The prefix CLV describes what other (OSI) networks we can reach
1428 * and what their cost is. It is built from a metric block
1429 * (see dissect_metric) followed by n addresses.
1432 * tvbuff_t * : tvbuffer for packet data
1433 * proto_tree * : protocol display tree to fill out. May be NULL
1434 * int : offset into packet data where we are.
1435 * int : length of IDs in packet.
1436 * int : length of clv we are decoding
1439 * void, but we will add to proto tree if !NULL.
1442 dissect_lsp_prefix_neighbors_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
1443 int id_length, int length)
1449 isis_dissect_unknown(tvb, tree, offset,
1450 "Short lsp prefix neighbors (%d vs 4)", length );
1454 dissect_metric (tvb, tree, offset,
1455 tvb_get_guint8(tvb, offset), "Default", TRUE );
1456 dissect_metric (tvb, tree, offset+1,
1457 tvb_get_guint8(tvb, offset+1), "Delay", FALSE );
1458 dissect_metric (tvb, tree, offset+2,
1459 tvb_get_guint8(tvb, offset+2), "Expense", FALSE );
1460 dissect_metric (tvb, tree, offset+3,
1461 tvb_get_guint8(tvb, offset+3), "Error", FALSE );
1465 while ( length > 0 ) {
1466 mylen = tvb_get_guint8(tvb, offset);
1469 isis_dissect_unknown(tvb, tree, offset,
1470 "Zero payload space after length in prefix neighbor" );
1473 if ( mylen > length) {
1474 isis_dissect_unknown(tvb, tree, offset,
1475 "Interal length of prefix neighbor too long (%d vs %d)",
1481 * Lets turn the area address into "standard" 0000.0000.etc
1484 sbuf = print_area( tvb_get_ptr(tvb, offset+1, mylen), mylen );
1485 /* and spit it out */
1487 proto_tree_add_text ( tree, tvb, offset, mylen + 1,
1488 "Area address (%d): %s", mylen, sbuf );
1490 offset += mylen + 1;
1491 length -= mylen; /* length already adjusted for len fld*/
1496 * Name: isis_lsp_decode_lsp_id()
1499 * Display a LSP id into the display tree.
1502 * tvbuff_t * : tvbuffer for packet data
1503 * proto_tree * : tree to display into. REQUIRED
1504 * int : offset into packet data where we are.
1505 * char * : title string
1506 * int : length of IDs in packet.
1509 * void, but we will add to proto tree
1512 isis_lsp_decode_lsp_id(tvbuff_t *tvb, proto_tree *tree, int offset,
1513 char *tstr, int id_length)
1515 proto_tree_add_text(tree, tvb, offset, id_length + 2,
1516 "%s: %s.%02x-%02x", tstr,
1517 print_system_id( tvb_get_ptr(tvb, offset, id_length), id_length ),
1518 tvb_get_guint8(tvb, offset+id_length),
1519 tvb_get_guint8(tvb, offset+id_length+1) );
1523 * Name: isis_dissect_isis_lsp()
1526 * Print out the LSP part of the main header and then call the CLV
1527 * de-mangler with the right list of valid CLVs.
1530 * tvbuff_t * : tvbuffer for packet data
1531 * proto_tree * : protocol display tree to add to. May be NULL.
1532 * int offset : our offset into packet data.
1533 * int : LSP type, a la packet-isis.h ISIS_TYPE_* values
1534 * int : header length of packet.
1535 * int : length of IDs in packet.
1538 * void, but we will add to proto tree if !NULL.
1541 isis_dissect_isis_lsp(tvbuff_t *tvb, proto_tree *tree, int offset,
1542 int lsp_type, int header_length, int id_length)
1545 proto_tree *lsp_tree = NULL;
1548 int inx, q, some, value, len;
1551 ti = proto_tree_add_text(tree, tvb, offset, -1,
1553 lsp_tree = proto_item_add_subtree(ti, ett_isis_lsp);
1556 pdu_length = tvb_get_ntohs(tvb, offset);
1558 proto_tree_add_uint(lsp_tree, hf_isis_lsp_pdu_length, tvb,
1559 offset, 2, pdu_length);
1564 proto_tree_add_uint(lsp_tree, hf_isis_lsp_remaining_life, tvb,
1565 offset, 2, tvb_get_ntohs(tvb, offset));
1570 isis_lsp_decode_lsp_id(tvb, lsp_tree, offset,
1571 "LSP ID", id_length);
1573 offset += id_length + 2;
1576 proto_tree_add_uint(lsp_tree, hf_isis_lsp_sequence_number, tvb,
1578 tvb_get_ntohl(tvb, offset));
1583 /* XXX -> we could validate the cksum here! */
1584 proto_tree_add_uint(lsp_tree, hf_isis_lsp_checksum, tvb,
1585 offset, 2, tvb_get_ntohs(tvb, offset));
1591 * We need to build our type block values.
1595 value = ISIS_LSP_ATT(tvb_get_guint8(tvb, offset));
1597 for ( q = (1<<ISIS_LSP_ATT_SHIFT); q > 0; q = q >> 1 ){
1602 strcat ( sbuf, isis_lsp_attached_bits[inx] );
1607 strcat ( sbuf, "default-only" );
1609 proto_tree_add_text(lsp_tree, tvb, offset + 18, 1,
1610 "Type block(0x%02x): P:%d, Supported metric(s): %s, OL:%d, istype:%s",
1611 tvb_get_guint8(tvb, offset),
1612 ISIS_LSP_PARTITION(tvb_get_guint8(tvb, offset)) ? 1 : 0,
1614 ISIS_LSP_HIPPITY(tvb_get_guint8(tvb, offset)) ? 1 : 0,
1615 val_to_str(ISIS_LSP_IS_TYPE(tvb_get_guint8(tvb, offset)),
1616 isis_lsp_istype_vals, "Unknown (0x%x)")
1621 len = pdu_length - header_length;
1623 isis_dissect_unknown(tvb, tree, offset,
1624 "packet header length %d went beyond packet",
1629 * Now, we need to decode our CLVs. We need to pass in
1630 * our list of valid ones!
1632 if (lsp_type == ISIS_TYPE_L1_LSP){
1633 isis_dissect_clvs(tvb, lsp_tree, offset,
1634 clv_l1_lsp_opts, len, id_length,
1635 ett_isis_lsp_clv_unknown );
1637 isis_dissect_clvs(tvb, lsp_tree, offset,
1638 clv_l2_lsp_opts, len, id_length,
1639 ett_isis_lsp_clv_unknown );
1643 * Name: isis_register_lsp()
1646 * Register our protocol sub-sets with protocol manager.
1649 * int : protocol index for the ISIS protocol
1655 isis_register_lsp(int proto_isis) {
1656 static hf_register_info hf[] = {
1657 { &hf_isis_lsp_pdu_length,
1658 { "PDU length", "isis.lsp.pdu_length", FT_UINT16,
1659 BASE_DEC, NULL, 0x0, "", HFILL }},
1661 { &hf_isis_lsp_remaining_life,
1662 { "Remaining lifetime", "isis.lsp.remaining_life", FT_UINT16,
1663 BASE_DEC, NULL, 0x0, "", HFILL }},
1665 { &hf_isis_lsp_sequence_number,
1666 { "Sequence number", "isis.lsp.sequence_number",
1667 FT_UINT32, BASE_HEX, NULL, 0x0, "", HFILL }},
1669 { &hf_isis_lsp_checksum,
1670 { "Checksum", "isis.lsp.checksum",FT_UINT16,
1671 BASE_HEX, NULL, 0x0, "", HFILL }},
1673 { &hf_isis_lsp_clv_ipv4_int_addr,
1674 { "IPv4 interface address", "isis.lsp.clv_ipv4_int_addr", FT_IPv4,
1675 BASE_NONE, NULL, 0x0, "", HFILL }},
1677 { &hf_isis_lsp_clv_ipv6_int_addr,
1678 { "IPv6 interface address", "isis.lsp.clv_ipv6_int_addr", FT_IPv6,
1679 BASE_NONE, NULL, 0x0, "", HFILL }},
1681 { &hf_isis_lsp_clv_te_router_id,
1682 { "Traffic Engineering Router ID", "isis.lsp.clv_te_router_id", FT_IPv4,
1683 BASE_NONE, NULL, 0x0, "", HFILL }},
1685 { &hf_isis_lsp_clv_mt,
1686 { "MT-ID ", "isis.lsp.clv_mt",
1687 FT_UINT16, BASE_HEX, NULL, 0x0, "", HFILL }},
1689 static gint *ett[] = {
1691 &ett_isis_lsp_clv_area_addr,
1692 &ett_isis_lsp_clv_is_neighbors,
1693 &ett_isis_lsp_clv_ext_is_reachability, /* CLV 22 */
1694 &ett_isis_lsp_part_of_clv_ext_is_reachability,
1695 &ett_isis_lsp_subclv_admin_group,
1696 &ett_isis_lsp_subclv_unrsv_bw,
1697 &ett_isis_lsp_clv_unknown,
1698 &ett_isis_lsp_clv_partition_dis,
1699 &ett_isis_lsp_clv_prefix_neighbors,
1700 &ett_isis_lsp_clv_auth,
1701 &ett_isis_lsp_clv_nlpid,
1702 &ett_isis_lsp_clv_hostname,
1703 &ett_isis_lsp_clv_ipv4_int_addr,
1704 &ett_isis_lsp_clv_ipv6_int_addr, /* CLV 232 */
1705 &ett_isis_lsp_clv_te_router_id,
1706 &ett_isis_lsp_clv_ip_reachability,
1707 &ett_isis_lsp_clv_ext_ip_reachability, /* CLV 135 */
1708 &ett_isis_lsp_part_of_clv_ext_ip_reachability,
1709 &ett_isis_lsp_clv_ipv6_reachability, /* CLV 236 */
1710 &ett_isis_lsp_part_of_clv_ipv6_reachability,
1711 &ett_isis_lsp_clv_mt,
1712 &ett_isis_lsp_clv_mt_is,
1713 &ett_isis_lsp_part_of_clv_mt_is,
1716 proto_register_field_array(proto_isis, hf, array_length(hf));
1717 proto_register_subtree_array(ett, array_length(ett));