2001-07-02 00:46:21 +00:00
|
|
|
/* packet-isis.c
|
1999-12-15 04:34:44 +00:00
|
|
|
* Routines for ISO/OSI network and transport protocol packet disassembly, core
|
|
|
|
* bits.
|
|
|
|
*
|
2014-03-05 07:53:22 +00:00
|
|
|
* Stuart Stanley <stuarts@mxmail.net>
|
1999-12-15 04:34:44 +00:00
|
|
|
*
|
2006-05-21 04:49:01 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
1999-12-15 04:34:44 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
1999-12-15 04:34:44 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
1999-12-15 04:34:44 +00:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
1999-12-15 04:34:44 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2012-06-28 22:56:06 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
1999-12-15 04:34:44 +00:00
|
|
|
*/
|
|
|
|
|
2012-09-20 02:03:38 +00:00
|
|
|
#include "config.h"
|
1999-12-15 04:34:44 +00:00
|
|
|
|
|
|
|
#include <glib.h>
|
2002-01-21 07:37:49 +00:00
|
|
|
#include <epan/packet.h>
|
2013-12-22 18:18:12 +00:00
|
|
|
#include <epan/expert.h>
|
2005-09-17 00:02:31 +00:00
|
|
|
#include <epan/nlpid.h>
|
2010-06-02 19:29:14 +00:00
|
|
|
#include <epan/etypes.h>
|
2000-04-15 22:11:26 +00:00
|
|
|
#include "packet-osi.h"
|
1999-12-15 04:34:44 +00:00
|
|
|
#include "packet-isis.h"
|
|
|
|
|
2013-12-15 23:44:12 +00:00
|
|
|
void proto_register_isis(void);
|
|
|
|
void proto_reg_handoff_isis(void);
|
2000-04-15 22:11:26 +00:00
|
|
|
|
2013-12-22 18:18:12 +00:00
|
|
|
static dissector_table_t isis_dissector_table;
|
|
|
|
|
1999-12-15 04:34:44 +00:00
|
|
|
/* isis base header */
|
2000-04-15 22:11:26 +00:00
|
|
|
static int proto_isis = -1;
|
1999-12-15 04:34:44 +00:00
|
|
|
|
2000-04-15 22:11:26 +00:00
|
|
|
static int hf_isis_irpd = -1;
|
|
|
|
static int hf_isis_header_length = -1;
|
|
|
|
static int hf_isis_version = -1;
|
|
|
|
static int hf_isis_system_id_length = -1;
|
|
|
|
static int hf_isis_type = -1;
|
2013-12-22 18:18:12 +00:00
|
|
|
static int hf_isis_type_reserved = -1;
|
2000-04-15 22:11:26 +00:00
|
|
|
static int hf_isis_version2 = -1;
|
|
|
|
static int hf_isis_reserved = -1;
|
|
|
|
static int hf_isis_max_area_adr = -1;
|
1999-12-15 04:34:44 +00:00
|
|
|
|
2000-04-15 22:11:26 +00:00
|
|
|
static gint ett_isis = -1;
|
1999-12-15 04:34:44 +00:00
|
|
|
|
2013-12-22 18:18:12 +00:00
|
|
|
static expert_field ei_isis_version = EI_INIT;
|
|
|
|
static expert_field ei_isis_type = EI_INIT;
|
|
|
|
|
2013-08-05 19:09:44 +00:00
|
|
|
static dissector_handle_t isis_handle;
|
|
|
|
|
1999-12-15 04:34:44 +00:00
|
|
|
static const value_string isis_vals[] = {
|
2000-04-15 22:11:26 +00:00
|
|
|
{ ISIS_TYPE_L1_HELLO, "L1 HELLO"},
|
|
|
|
{ ISIS_TYPE_L2_HELLO, "L2 HELLO"},
|
|
|
|
{ ISIS_TYPE_PTP_HELLO, "P2P HELLO"},
|
|
|
|
{ ISIS_TYPE_L1_LSP, "L1 LSP"},
|
|
|
|
{ ISIS_TYPE_L2_LSP, "L2 LSP"},
|
|
|
|
{ ISIS_TYPE_L1_CSNP, "L1 CSNP"},
|
|
|
|
{ ISIS_TYPE_L2_CSNP, "L2 CSNP"},
|
|
|
|
{ ISIS_TYPE_L1_PSNP, "L1 PSNP"},
|
|
|
|
{ ISIS_TYPE_L2_PSNP, "L2 PSNP"},
|
|
|
|
{ 0, NULL} };
|
1999-12-15 04:34:44 +00:00
|
|
|
|
2000-04-17 01:36:31 +00:00
|
|
|
static void
|
2001-07-02 00:19:34 +00:00
|
|
|
dissect_isis(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|
|
|
{
|
2013-12-22 18:18:12 +00:00
|
|
|
proto_item *ti, *version_item;
|
1999-12-15 04:34:44 +00:00
|
|
|
proto_tree *isis_tree = NULL;
|
2001-07-02 00:19:34 +00:00
|
|
|
int offset = 0;
|
2001-07-02 01:46:22 +00:00
|
|
|
guint8 isis_version;
|
|
|
|
guint8 isis_type;
|
2013-12-22 18:18:12 +00:00
|
|
|
tvbuff_t *next_tvb;
|
|
|
|
isis_data_t subdissector_data;
|
1999-12-15 04:34:44 +00:00
|
|
|
|
2009-08-09 06:26:46 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "ISIS");
|
2009-08-09 07:36:13 +00:00
|
|
|
col_clear(pinfo->cinfo, COL_INFO);
|
1999-12-15 04:34:44 +00:00
|
|
|
|
2013-06-14 01:02:11 +00:00
|
|
|
ti = proto_tree_add_item(tree, proto_isis, tvb, 0, -1, ENC_NA);
|
|
|
|
isis_tree = proto_item_add_subtree(ti, ett_isis);
|
2001-07-02 01:46:22 +00:00
|
|
|
|
2013-12-22 18:18:12 +00:00
|
|
|
proto_tree_add_item(isis_tree, hf_isis_irpd, tvb, offset, 1, ENC_BIG_ENDIAN );
|
2001-07-02 01:46:22 +00:00
|
|
|
offset += 1;
|
2001-07-02 00:19:34 +00:00
|
|
|
|
2013-12-22 18:18:12 +00:00
|
|
|
subdissector_data.header_length = tvb_get_guint8(tvb, offset);
|
|
|
|
proto_tree_add_uint(isis_tree, hf_isis_header_length, tvb,
|
|
|
|
offset, 1, subdissector_data.header_length );
|
2001-07-02 01:46:22 +00:00
|
|
|
offset += 1;
|
|
|
|
|
2013-12-22 18:18:12 +00:00
|
|
|
isis_version = tvb_get_guint8(tvb, offset);
|
|
|
|
version_item = proto_tree_add_uint(isis_tree, hf_isis_version, tvb,
|
2001-07-02 01:46:22 +00:00
|
|
|
offset, 1, isis_version );
|
2013-12-22 18:18:12 +00:00
|
|
|
if (isis_version != ISIS_REQUIRED_VERSION){
|
|
|
|
col_add_fstr(pinfo->cinfo, COL_INFO,
|
|
|
|
"Unknown ISIS version (%u vs %u)",
|
|
|
|
isis_version, ISIS_REQUIRED_VERSION );
|
|
|
|
expert_add_info(pinfo, version_item, &ei_isis_version);
|
|
|
|
return;
|
2001-07-02 01:46:22 +00:00
|
|
|
}
|
|
|
|
offset += 1;
|
|
|
|
|
2013-12-22 18:18:12 +00:00
|
|
|
subdissector_data.system_id_len = tvb_get_guint8(tvb, offset);
|
|
|
|
proto_tree_add_uint(isis_tree, hf_isis_system_id_length, tvb,
|
|
|
|
offset, 1, subdissector_data.system_id_len );
|
2001-07-02 01:46:22 +00:00
|
|
|
offset += 1;
|
|
|
|
|
2013-12-22 18:18:12 +00:00
|
|
|
isis_type = tvb_get_guint8(tvb, offset) & ISIS_TYPE_MASK;
|
2013-06-14 01:02:11 +00:00
|
|
|
col_add_str(pinfo->cinfo, COL_INFO,
|
2001-07-02 01:46:22 +00:00
|
|
|
val_to_str ( isis_type, isis_vals, "Unknown (0x%x)" ) );
|
2013-06-14 01:02:11 +00:00
|
|
|
|
2013-12-22 18:18:12 +00:00
|
|
|
proto_tree_add_item(isis_tree, hf_isis_type, tvb, offset, 1, ENC_BIG_ENDIAN );
|
|
|
|
proto_tree_add_item(isis_tree, hf_isis_type_reserved, tvb, offset, 1, ENC_BIG_ENDIAN );
|
2001-07-02 01:46:22 +00:00
|
|
|
offset += 1;
|
1999-12-15 04:34:44 +00:00
|
|
|
|
2013-12-22 18:18:12 +00:00
|
|
|
proto_tree_add_item(isis_tree, hf_isis_version2, tvb, offset, 1, ENC_BIG_ENDIAN );
|
2001-07-02 01:46:22 +00:00
|
|
|
offset += 1;
|
1999-12-15 04:34:44 +00:00
|
|
|
|
2013-12-22 18:18:12 +00:00
|
|
|
proto_tree_add_item(isis_tree, hf_isis_reserved, tvb, offset, 1, ENC_BIG_ENDIAN );
|
2001-07-02 01:46:22 +00:00
|
|
|
offset += 1;
|
|
|
|
|
2013-12-22 18:18:12 +00:00
|
|
|
proto_tree_add_item(isis_tree, hf_isis_max_area_adr, tvb, offset, 1, ENC_BIG_ENDIAN );
|
2001-07-02 01:46:22 +00:00
|
|
|
offset += 1;
|
1999-12-15 04:34:44 +00:00
|
|
|
|
2000-06-19 08:33:50 +00:00
|
|
|
/*
|
|
|
|
* Interpret the system ID length.
|
|
|
|
*/
|
2013-12-22 18:18:12 +00:00
|
|
|
if (subdissector_data.system_id_len == 0)
|
|
|
|
subdissector_data.system_id_len = 6; /* zero means 6-octet ID field length */
|
|
|
|
else if (subdissector_data.system_id_len == 255) {
|
|
|
|
subdissector_data.system_id_len = 0; /* 255 means null ID field */
|
2000-06-19 08:33:50 +00:00
|
|
|
/* XXX - what about the LAN ID? */
|
|
|
|
}
|
|
|
|
/* XXX - otherwise, must be in the range 1 through 8 */
|
|
|
|
|
2013-12-22 18:18:12 +00:00
|
|
|
next_tvb = tvb_new_subset_remaining(tvb, offset);
|
|
|
|
if (!dissector_try_uint_new(isis_dissector_table, isis_type, next_tvb,
|
|
|
|
pinfo, tree, TRUE, &subdissector_data))
|
|
|
|
{
|
|
|
|
proto_tree_add_expert(tree, pinfo, &ei_isis_type, tvb, offset, -1);
|
1999-12-15 04:34:44 +00:00
|
|
|
}
|
|
|
|
} /* dissect_isis */
|
|
|
|
|
2002-08-28 21:04:11 +00:00
|
|
|
void
|
2013-12-15 23:44:12 +00:00
|
|
|
proto_register_isis(void)
|
|
|
|
{
|
2000-04-15 22:11:26 +00:00
|
|
|
static hf_register_info hf[] = {
|
|
|
|
{ &hf_isis_irpd,
|
2002-08-28 21:04:11 +00:00
|
|
|
{ "Intra Domain Routing Protocol Discriminator", "isis.irpd",
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
FT_UINT8, BASE_HEX, VALS(nlpid_vals), 0x0, NULL, HFILL }},
|
2000-04-15 22:11:26 +00:00
|
|
|
|
|
|
|
{ &hf_isis_header_length,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
{ "PDU Header Length", "isis.len", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
|
2000-04-15 22:11:26 +00:00
|
|
|
|
|
|
|
{ &hf_isis_version,
|
2013-12-22 18:18:12 +00:00
|
|
|
{ "Version", "isis.version", FT_UINT8,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
BASE_DEC, NULL, 0x0, NULL, HFILL }},
|
2000-04-15 22:11:26 +00:00
|
|
|
|
|
|
|
{ &hf_isis_system_id_length,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
{ "System ID Length", "isis.sysid_len",
|
|
|
|
FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
|
2000-04-15 22:11:26 +00:00
|
|
|
|
2002-08-28 21:04:11 +00:00
|
|
|
{ &hf_isis_type,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
{ "PDU Type", "isis.type", FT_UINT8, BASE_DEC,
|
2013-12-22 18:18:12 +00:00
|
|
|
VALS(isis_vals), ISIS_TYPE_MASK, NULL, HFILL }},
|
|
|
|
|
|
|
|
{ &hf_isis_type_reserved,
|
|
|
|
{ "Reserved", "isis.reserved", FT_UINT8, BASE_HEX,
|
|
|
|
NULL, ISIS_TYPE_RESERVED_MASK, NULL, HFILL }},
|
2000-04-15 22:11:26 +00:00
|
|
|
|
2002-08-28 21:04:11 +00:00
|
|
|
{ &hf_isis_version2,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
{ "Version2 (==1)", "isis.version2", FT_UINT8, BASE_DEC, NULL,
|
|
|
|
0x0, NULL, HFILL }},
|
2000-04-15 22:11:26 +00:00
|
|
|
|
|
|
|
{ &hf_isis_reserved,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
{ "Reserved (==0)", "isis.reserved", FT_UINT8, BASE_DEC, NULL,
|
|
|
|
0x0, NULL, HFILL }},
|
2000-04-15 22:11:26 +00:00
|
|
|
|
|
|
|
{ &hf_isis_max_area_adr,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
{ "Max.AREAs: (0==3)", "isis.max_area_adr", FT_UINT8, BASE_DEC, NULL,
|
|
|
|
0x0, NULL, HFILL }},
|
2000-04-15 22:11:26 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
/*
|
|
|
|
* Note, we pull in the unknown CLV handler here, since it
|
|
|
|
* is used by all ISIS packet types.
|
2001-07-02 01:46:22 +00:00
|
|
|
*/
|
2000-04-15 22:11:26 +00:00
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_isis,
|
|
|
|
};
|
|
|
|
|
2013-12-22 18:18:12 +00:00
|
|
|
static ei_register_info ei[] = {
|
|
|
|
{ &ei_isis_version, { "isis.version.unknown", PI_PROTOCOL, PI_WARN, "Unknown ISIS version", EXPFILL }},
|
|
|
|
{ &ei_isis_type, { "isis.type.unknown", PI_PROTOCOL, PI_WARN, "Unknown ISIS packet type", EXPFILL }},
|
|
|
|
};
|
2001-12-20 07:33:21 +00:00
|
|
|
|
2013-12-22 18:18:12 +00:00
|
|
|
expert_module_t* expert_isis;
|
2012-02-02 21:10:13 +00:00
|
|
|
|
2013-12-22 18:18:12 +00:00
|
|
|
proto_isis = proto_register_protocol(PROTO_STRING_ISIS, "ISIS", "isis");
|
|
|
|
proto_register_field_array(proto_isis, hf, array_length(hf));
|
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
|
|
|
expert_isis = expert_register_protocol(proto_isis);
|
|
|
|
expert_register_field_array(expert_isis, ei, array_length(ei));
|
|
|
|
|
|
|
|
isis_handle = register_dissector("isis", dissect_isis, proto_isis);
|
|
|
|
|
|
|
|
isis_dissector_table = register_dissector_table("isis.type",
|
|
|
|
"ISIS Type", FT_UINT8, BASE_DEC);
|
1999-12-15 04:34:44 +00:00
|
|
|
}
|
2000-04-17 01:36:31 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
proto_reg_handoff_isis(void)
|
|
|
|
{
|
2013-09-12 20:34:19 +00:00
|
|
|
dissector_add_uint("osinl.incl", NLPID_ISO10589_ISIS, isis_handle);
|
2010-12-20 05:35:29 +00:00
|
|
|
dissector_add_uint("ethertype", ETHERTYPE_L2ISIS, isis_handle);
|
2000-04-17 01:36:31 +00:00
|
|
|
}
|