1999-12-15 04:34:44 +00:00
|
|
|
/* packet-isis-clv.c
|
|
|
|
* Common CLV decode routines.
|
|
|
|
*
|
2004-07-18 00:24:25 +00:00
|
|
|
* $Id$
|
1999-12-15 04:34:44 +00:00
|
|
|
* Stuart Stanley <stuarts@mxmail.net>
|
|
|
|
*
|
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
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2000-08-11 13:37:21 +00:00
|
|
|
#include <glib.h>
|
|
|
|
|
2002-01-21 07:37:49 +00:00
|
|
|
#include <epan/packet.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"
|
|
|
|
#include "packet-isis-clv.h"
|
2005-09-17 00:02:31 +00:00
|
|
|
#include <epan/nlpid.h>
|
1999-12-15 04:34:44 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Name: isis_dissect_area_address_clv()
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
1999-12-15 04:34:44 +00:00
|
|
|
* Description:
|
|
|
|
* Take an area address CLV and display it pieces. An area address
|
|
|
|
* CLV is n, x byte hex strings.
|
|
|
|
*
|
|
|
|
* Input:
|
2001-07-02 00:19:34 +00:00
|
|
|
* tvbuff_t * : tvbuffer for packet data
|
1999-12-15 04:34:44 +00:00
|
|
|
* proto_tree * : protocol display tree to fill out. May be NULL
|
2001-07-02 00:19:34 +00:00
|
|
|
* int : offset into packet data where we are.
|
|
|
|
* int : length of clv we are decoding
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
1999-12-15 04:34:44 +00:00
|
|
|
* Output:
|
|
|
|
* void, but we will add to proto tree if !NULL.
|
|
|
|
*/
|
2002-08-28 21:04:11 +00:00
|
|
|
void
|
2002-04-07 22:36:55 +00:00
|
|
|
isis_dissect_area_address_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
|
|
|
|
int length)
|
2002-08-28 21:04:11 +00:00
|
|
|
{
|
2002-06-28 22:46:36 +00:00
|
|
|
int arealen,area_idx;
|
1999-12-15 04:34:44 +00:00
|
|
|
|
|
|
|
while ( length > 0 ) {
|
2002-06-28 22:46:36 +00:00
|
|
|
arealen = tvb_get_guint8(tvb, offset);
|
1999-12-15 04:34:44 +00:00
|
|
|
length--;
|
|
|
|
if (length<=0) {
|
2002-04-07 22:36:55 +00:00
|
|
|
isis_dissect_unknown(tvb, tree, offset,
|
1999-12-15 04:34:44 +00:00
|
|
|
"short address (no length for payload)");
|
|
|
|
return;
|
|
|
|
}
|
2002-06-28 22:46:36 +00:00
|
|
|
if ( arealen > length) {
|
2002-04-07 22:36:55 +00:00
|
|
|
isis_dissect_unknown(tvb, tree, offset,
|
2002-06-29 23:03:24 +00:00
|
|
|
"short address, packet says %d, we have %d left",
|
2002-06-28 22:46:36 +00:00
|
|
|
arealen, length );
|
1999-12-15 04:34:44 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( tree ) {
|
2005-09-01 11:34:10 +00:00
|
|
|
proto_item *ti;
|
2011-05-18 16:52:45 +00:00
|
|
|
|
2005-09-01 11:34:10 +00:00
|
|
|
/*
|
|
|
|
* Throw an exception rather than putting in a
|
|
|
|
* partial address.
|
|
|
|
*/
|
|
|
|
tvb_ensure_bytes_exist ( tvb, offset, arealen + 1 );
|
|
|
|
|
|
|
|
ti = proto_tree_add_text ( tree, tvb, offset, arealen + 1,
|
|
|
|
"Area address (%d): ", arealen );
|
2005-08-30 08:41:18 +00:00
|
|
|
|
2002-08-28 21:04:11 +00:00
|
|
|
/*
|
2002-06-29 23:03:24 +00:00
|
|
|
* Lets turn the area address into "standard"
|
|
|
|
* xx.xxxx.xxxx.xxxx.xxxx.xxxx.xxxx format string.
|
|
|
|
* this is a private routine as the print_nsap_net in
|
|
|
|
* epan/osi_utils.c is incomplete and we need only
|
|
|
|
* a subset - actually some nice placing of dots ....
|
|
|
|
*/
|
|
|
|
for (area_idx = 0; area_idx < arealen; area_idx++) {
|
2005-09-01 11:34:10 +00:00
|
|
|
proto_item_append_text(ti, "%02x",
|
2002-06-29 23:03:24 +00:00
|
|
|
tvb_get_guint8(tvb, offset+area_idx+1));
|
|
|
|
if (((area_idx & 1) == 0) &&
|
|
|
|
(area_idx + 1 < arealen)) {
|
2005-09-01 11:34:10 +00:00
|
|
|
proto_item_append_text(ti, ".");
|
2002-06-29 23:03:24 +00:00
|
|
|
}
|
|
|
|
}
|
1999-12-15 04:34:44 +00:00
|
|
|
}
|
2002-06-28 22:46:36 +00:00
|
|
|
offset += arealen + 1;
|
|
|
|
length -= arealen; /* length already adjusted for len fld*/
|
1999-12-15 04:34:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Name: isis_dissect_authentication_clv()
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
1999-12-15 04:34:44 +00:00
|
|
|
* Description:
|
|
|
|
* Take apart the CLV that hold authentication information. This
|
2003-12-08 20:40:33 +00:00
|
|
|
* is currently 1 octet auth type.
|
|
|
|
* the two defined authentication types
|
|
|
|
* are 1 for a clear text password and
|
|
|
|
* 54 for a HMAC-MD5 digest
|
1999-12-15 04:34:44 +00:00
|
|
|
*
|
|
|
|
* Input:
|
2001-07-02 00:19:34 +00:00
|
|
|
* tvbuff_t * : tvbuffer for packet data
|
1999-12-15 04:34:44 +00:00
|
|
|
* proto_tree * : protocol display tree to fill out. May be NULL
|
2001-07-02 00:19:34 +00:00
|
|
|
* int : offset into packet data where we are.
|
|
|
|
* int : length of clv we are decoding
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
1999-12-15 04:34:44 +00:00
|
|
|
* Output:
|
|
|
|
* void, but we will add to proto tree if !NULL.
|
|
|
|
*/
|
2002-08-28 21:04:11 +00:00
|
|
|
void
|
2002-04-07 22:36:55 +00:00
|
|
|
isis_dissect_authentication_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
|
2003-12-08 20:40:33 +00:00
|
|
|
int length)
|
2002-08-28 21:04:11 +00:00
|
|
|
{
|
2002-08-02 23:36:07 +00:00
|
|
|
guchar pw_type;
|
2003-05-24 22:58:50 +00:00
|
|
|
int auth_unsupported;
|
2005-09-01 11:34:10 +00:00
|
|
|
proto_item *ti;
|
1999-12-15 04:34:44 +00:00
|
|
|
|
|
|
|
if ( length <= 0 ) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2001-07-02 00:19:34 +00:00
|
|
|
pw_type = tvb_get_guint8(tvb, offset);
|
|
|
|
offset += 1;
|
1999-12-15 04:34:44 +00:00
|
|
|
length--;
|
2001-06-05 21:23:32 +00:00
|
|
|
auth_unsupported = FALSE;
|
|
|
|
|
1999-12-15 04:34:44 +00:00
|
|
|
switch (pw_type) {
|
|
|
|
case 1:
|
2005-09-01 11:34:10 +00:00
|
|
|
ti = proto_tree_add_text ( tree, tvb, offset - 1, length + 1,
|
2003-05-24 22:58:50 +00:00
|
|
|
"clear text (1), password (length %d) = ", length);
|
2001-06-05 21:23:32 +00:00
|
|
|
if ( length > 0 ) {
|
2005-09-01 11:34:10 +00:00
|
|
|
proto_item_append_text(ti, "%s",
|
2003-05-24 22:58:50 +00:00
|
|
|
tvb_format_text(tvb, offset, length));
|
2001-06-05 21:23:32 +00:00
|
|
|
} else {
|
2005-09-01 11:34:10 +00:00
|
|
|
proto_item_append_text(ti, "no clear-text password found!!!");
|
2001-06-05 21:23:32 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 54:
|
2005-09-01 11:34:10 +00:00
|
|
|
ti = proto_tree_add_text ( tree, tvb, offset - 1, length + 1,
|
2003-05-24 22:58:50 +00:00
|
|
|
"hmac-md5 (54), password (length %d) = ", length);
|
2001-06-05 21:23:32 +00:00
|
|
|
|
2003-05-24 22:58:50 +00:00
|
|
|
if ( length == 16 ) {
|
2005-09-01 11:34:10 +00:00
|
|
|
proto_item_append_text(ti, "0x%02x", tvb_get_guint8(tvb, offset));
|
2001-07-02 00:19:34 +00:00
|
|
|
offset += 1;
|
2001-06-05 21:23:32 +00:00
|
|
|
length--;
|
|
|
|
while (length > 0) {
|
2005-09-01 11:34:10 +00:00
|
|
|
proto_item_append_text(ti, "%02x", tvb_get_guint8(tvb, offset));
|
2001-07-02 00:19:34 +00:00
|
|
|
offset += 1;
|
2001-06-05 21:23:32 +00:00
|
|
|
length--;
|
2003-05-24 22:58:50 +00:00
|
|
|
}
|
|
|
|
} else {
|
2005-09-01 11:34:10 +00:00
|
|
|
proto_item_append_text(ti,
|
2003-05-24 22:58:50 +00:00
|
|
|
"illegal hmac-md5 digest format (must be 16 bytes)");
|
2001-06-05 21:23:32 +00:00
|
|
|
}
|
1999-12-15 04:34:44 +00:00
|
|
|
break;
|
|
|
|
default:
|
2011-05-18 16:52:45 +00:00
|
|
|
proto_tree_add_text ( tree, tvb, offset - 1, length + 1,
|
2005-09-01 11:34:10 +00:00
|
|
|
"type 0x%02x (0x%02x): ", pw_type, length );
|
2001-06-05 21:23:32 +00:00
|
|
|
auth_unsupported=TRUE;
|
1999-12-15 04:34:44 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2001-06-05 21:23:32 +00:00
|
|
|
if ( auth_unsupported ) {
|
2002-04-07 22:36:55 +00:00
|
|
|
isis_dissect_unknown(tvb, tree, offset,
|
2001-06-05 21:23:32 +00:00
|
|
|
"Unknown authentication type" );
|
2002-08-28 21:04:11 +00:00
|
|
|
}
|
|
|
|
}
|
2001-04-08 19:32:05 +00:00
|
|
|
|
2003-12-08 20:40:33 +00:00
|
|
|
/*
|
|
|
|
* Name: isis_ip_authentication_clv()
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* dump the IP authentication information found in TLV 133
|
|
|
|
* the CLV is standardized in rf1195, however all major
|
|
|
|
* implementations use TLV #10
|
|
|
|
* Input:
|
|
|
|
* tvbuff_t * : tvbuffer for packet data
|
|
|
|
* proto_tree * : protocol display tree to fill out. May be NULL
|
|
|
|
* int : offset into packet data where we are.
|
|
|
|
* int : length of clv we are decoding
|
|
|
|
*
|
|
|
|
* Output:
|
|
|
|
* void, but we will add to proto tree if !NULL.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
isis_dissect_ip_authentication_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
|
|
|
|
int length)
|
|
|
|
{
|
|
|
|
if ( !tree ) return; /* nothing to do! */
|
|
|
|
|
|
|
|
if ( length != 0 ) {
|
|
|
|
proto_tree_add_text ( tree, tvb, offset, length,
|
|
|
|
"IP Authentication: %.*s", length,
|
2011-01-16 03:46:16 +00:00
|
|
|
tvb_get_ephemeral_string(tvb, offset, length) );
|
2003-12-08 20:40:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-04-08 19:32:05 +00:00
|
|
|
/*
|
|
|
|
* Name: isis_dissect_hostname_clv()
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* dump the hostname information found in TLV 137
|
|
|
|
* pls note that the hostname is not null terminated
|
|
|
|
*
|
|
|
|
* Input:
|
2001-07-02 00:19:34 +00:00
|
|
|
* tvbuff_t * : tvbuffer for packet data
|
2001-04-08 19:32:05 +00:00
|
|
|
* proto_tree * : protocol display tree to fill out. May be NULL
|
2001-07-02 00:19:34 +00:00
|
|
|
* int : offset into packet data where we are.
|
|
|
|
* int : length of clv we are decoding
|
2008-03-13 23:45:48 +00:00
|
|
|
* int : tree id to use for proto tree.
|
2001-04-08 19:32:05 +00:00
|
|
|
*
|
|
|
|
* Output:
|
|
|
|
* void, but we will add to proto tree if !NULL.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2002-04-07 22:36:55 +00:00
|
|
|
isis_dissect_hostname_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
|
2008-03-13 23:45:48 +00:00
|
|
|
int length, int tree_id)
|
2002-08-28 21:04:11 +00:00
|
|
|
{
|
2001-04-08 19:32:05 +00:00
|
|
|
if ( !tree ) return; /* nothing to do! */
|
|
|
|
|
2001-07-02 00:19:34 +00:00
|
|
|
if ( length == 0 ) {
|
|
|
|
proto_tree_add_text ( tree, tvb, offset, length,
|
|
|
|
"Hostname: --none--" );
|
|
|
|
} else {
|
2011-01-16 03:46:16 +00:00
|
|
|
const char* value = tvb_get_ephemeral_string(tvb, offset, length);
|
2008-03-13 23:45:48 +00:00
|
|
|
proto_tree_add_string_format ( tree, tree_id,
|
|
|
|
tvb, offset, length,
|
|
|
|
value, "Hostname: %.*s", length, value);
|
2001-04-08 19:32:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2002-08-28 21:04:11 +00:00
|
|
|
void
|
2002-04-07 22:36:55 +00:00
|
|
|
isis_dissect_mt_clv(tvbuff_t *tvb, proto_tree *tree, int offset, int length,
|
|
|
|
int tree_id)
|
2002-08-28 21:04:11 +00:00
|
|
|
{
|
2002-04-07 23:39:00 +00:00
|
|
|
guint16 mt_block;
|
2008-06-25 09:12:35 +00:00
|
|
|
const char *mt_desc;
|
2001-06-23 19:45:12 +00:00
|
|
|
|
2002-04-07 23:39:00 +00:00
|
|
|
while (length>0) {
|
2002-08-28 21:04:11 +00:00
|
|
|
/* length can only be a multiple of 2, otherwise there is
|
2002-04-07 23:39:00 +00:00
|
|
|
something broken -> so decode down until length is 1 */
|
|
|
|
if (length!=1) {
|
|
|
|
/* fetch two bytes */
|
|
|
|
mt_block=tvb_get_ntohs(tvb, offset);
|
2001-06-23 19:45:12 +00:00
|
|
|
|
2002-04-07 23:39:00 +00:00
|
|
|
/* mask out the lower 12 bits */
|
|
|
|
switch(mt_block&0x0fff) {
|
|
|
|
case 0:
|
2005-08-30 08:47:25 +00:00
|
|
|
mt_desc="IPv4 unicast";
|
2002-04-07 23:39:00 +00:00
|
|
|
break;
|
|
|
|
case 1:
|
2005-08-30 08:47:25 +00:00
|
|
|
mt_desc="In-Band Management";
|
2002-04-07 23:39:00 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2005-08-30 08:47:25 +00:00
|
|
|
mt_desc="IPv6 unicast";
|
2002-04-07 23:39:00 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
2005-08-30 08:47:25 +00:00
|
|
|
mt_desc="Multicast";
|
2002-04-07 23:39:00 +00:00
|
|
|
break;
|
|
|
|
case 4095:
|
2005-08-30 08:47:25 +00:00
|
|
|
mt_desc="Development, Experimental or Proprietary";
|
2002-04-07 23:39:00 +00:00
|
|
|
break;
|
|
|
|
default:
|
2005-08-30 08:47:25 +00:00
|
|
|
mt_desc="Reserved for IETF Consensus";
|
2002-04-07 23:39:00 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
proto_tree_add_uint_format ( tree, tree_id, tvb, offset, 2,
|
|
|
|
mt_block,
|
|
|
|
"%s Topology (0x%03x)%s%s",
|
2001-06-23 19:45:12 +00:00
|
|
|
mt_desc,
|
|
|
|
mt_block&0xfff,
|
|
|
|
(mt_block&0x8000) ? "" : ", no sub-TLVs present",
|
|
|
|
(mt_block&0x4000) ? ", ATT bit set" : "" );
|
2002-04-07 23:39:00 +00:00
|
|
|
} else {
|
|
|
|
proto_tree_add_text ( tree, tvb, offset, 1,
|
|
|
|
"malformed MT-ID");
|
|
|
|
break;
|
2001-06-23 19:45:12 +00:00
|
|
|
}
|
2002-04-07 23:39:00 +00:00
|
|
|
length=length-2;
|
|
|
|
offset=offset+2;
|
2001-06-23 19:45:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-04-08 19:32:05 +00:00
|
|
|
|
1999-12-15 04:34:44 +00:00
|
|
|
/*
|
|
|
|
* Name: isis_dissect_ip_int_clv()
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
1999-12-15 04:34:44 +00:00
|
|
|
* Description:
|
|
|
|
* Take apart the CLV that lists all the IP interfaces. The
|
|
|
|
* meaning of which is slightly different for the different base packet
|
|
|
|
* types, but the display is not different. What we have is n ip
|
|
|
|
* addresses, plain and simple.
|
|
|
|
*
|
|
|
|
* Input:
|
2001-07-02 00:19:34 +00:00
|
|
|
* tvbuff_t * : tvbuffer for packet data
|
1999-12-15 04:34:44 +00:00
|
|
|
* proto_tree * : protocol display tree to fill out. May be NULL
|
2001-07-02 00:19:34 +00:00
|
|
|
* int : offset into packet data where we are.
|
|
|
|
* int : length of clv we are decoding
|
|
|
|
* int : tree id to use for proto tree.
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
1999-12-15 04:34:44 +00:00
|
|
|
* Output:
|
|
|
|
* void, but we will add to proto tree if !NULL.
|
|
|
|
*/
|
2002-08-28 21:04:11 +00:00
|
|
|
void
|
2002-04-07 22:36:55 +00:00
|
|
|
isis_dissect_ip_int_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
|
|
|
|
int length, int tree_id)
|
2001-07-02 00:19:34 +00:00
|
|
|
{
|
1999-12-15 04:34:44 +00:00
|
|
|
if ( length <= 0 ) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
while ( length > 0 ) {
|
|
|
|
if ( length < 4 ) {
|
2002-04-07 22:36:55 +00:00
|
|
|
isis_dissect_unknown(tvb, tree, offset,
|
2002-06-28 22:46:36 +00:00
|
|
|
"Short IP interface address (%d vs 4)",length );
|
1999-12-15 04:34:44 +00:00
|
|
|
return;
|
|
|
|
}
|
2001-07-02 00:19:34 +00:00
|
|
|
|
1999-12-15 04:34:44 +00:00
|
|
|
if ( tree ) {
|
2011-10-27 20:30:38 +00:00
|
|
|
proto_tree_add_item(tree, tree_id, tvb, offset, 4, ENC_BIG_ENDIAN);
|
1999-12-15 04:34:44 +00:00
|
|
|
}
|
|
|
|
offset += 4;
|
|
|
|
length -= 4;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-05-14 18:40:17 +00:00
|
|
|
/*
|
|
|
|
* Name: isis_dissect_ipv6_int_clv()
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
2001-05-14 18:40:17 +00:00
|
|
|
* Description:
|
|
|
|
* Take apart the CLV that lists all the IPv6 interfaces. The
|
|
|
|
* meaning of which is slightly different for the different base packet
|
|
|
|
* types, but the display is not different. What we have is n ip
|
|
|
|
* addresses, plain and simple.
|
|
|
|
*
|
|
|
|
* Input:
|
2001-07-02 00:19:34 +00:00
|
|
|
* tvbuff_t * : tvbuffer for packet data
|
2001-05-14 18:40:17 +00:00
|
|
|
* proto_tree * : protocol display tree to fill out. May be NULL
|
2001-07-02 00:19:34 +00:00
|
|
|
* int : offset into packet data where we are.
|
|
|
|
* int : length of clv we are decoding
|
|
|
|
* int : tree id to use for proto tree.
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
2001-05-14 18:40:17 +00:00
|
|
|
* Output:
|
|
|
|
* void, but we will add to proto tree if !NULL.
|
|
|
|
*/
|
2002-08-28 21:04:11 +00:00
|
|
|
void
|
2002-04-07 22:36:55 +00:00
|
|
|
isis_dissect_ipv6_int_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
|
|
|
|
int length, int tree_id)
|
2001-07-02 00:19:34 +00:00
|
|
|
{
|
2005-09-01 11:34:10 +00:00
|
|
|
guint8 addr [16];
|
2001-05-14 18:40:17 +00:00
|
|
|
|
|
|
|
if ( length <= 0 ) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
while ( length > 0 ) {
|
|
|
|
if ( length < 16 ) {
|
2002-04-07 22:36:55 +00:00
|
|
|
isis_dissect_unknown(tvb, tree, offset,
|
2001-05-14 18:40:17 +00:00
|
|
|
"Short IPv6 interface address (%d vs 16)",length );
|
|
|
|
return;
|
|
|
|
}
|
2005-09-01 11:34:10 +00:00
|
|
|
tvb_memcpy(tvb, addr, offset, sizeof(addr));
|
2001-05-14 18:40:17 +00:00
|
|
|
if ( tree ) {
|
2001-07-02 00:19:34 +00:00
|
|
|
proto_tree_add_ipv6(tree, tree_id, tvb, offset, 16, addr);
|
2001-05-14 18:40:17 +00:00
|
|
|
}
|
|
|
|
offset += 16;
|
|
|
|
length -= 16;
|
|
|
|
}
|
|
|
|
}
|
2001-04-16 10:04:33 +00:00
|
|
|
|
2001-07-02 00:19:34 +00:00
|
|
|
|
2001-04-16 10:04:33 +00:00
|
|
|
/*
|
|
|
|
* Name: isis_dissect_te_router_id_clv()
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Display the Traffic Engineering Router ID TLV #134.
|
|
|
|
* This TLV is like the IP Interface TLV, except that
|
|
|
|
* only _one_ IP address is present
|
|
|
|
*
|
|
|
|
* Input:
|
2001-07-02 00:19:34 +00:00
|
|
|
* tvbuff_t * : tvbuffer for packet data
|
2001-04-16 10:04:33 +00:00
|
|
|
* proto_tree * : protocol display tree to fill out. May be NULL
|
2001-07-02 00:19:34 +00:00
|
|
|
* int : offset into packet data where we are.
|
|
|
|
* int : length of clv we are decoding
|
|
|
|
* int : tree id to use for proto tree.
|
2001-04-16 10:04:33 +00:00
|
|
|
*
|
|
|
|
* Output:
|
|
|
|
* void, but we will add to proto tree if !NULL.
|
|
|
|
*/
|
|
|
|
void
|
2002-04-07 22:36:55 +00:00
|
|
|
isis_dissect_te_router_id_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
|
|
|
|
int length, int tree_id)
|
2001-07-02 00:19:34 +00:00
|
|
|
{
|
2001-04-16 10:04:33 +00:00
|
|
|
if ( length <= 0 ) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( length != 4 ) {
|
2002-04-07 22:36:55 +00:00
|
|
|
isis_dissect_unknown(tvb, tree, offset,
|
2001-04-16 10:04:33 +00:00
|
|
|
"malformed Traffic Engineering Router ID (%d vs 4)",length );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if ( tree ) {
|
2011-10-27 20:30:38 +00:00
|
|
|
proto_tree_add_item(tree, tree_id, tvb, offset, 4, ENC_BIG_ENDIAN);
|
2001-04-16 10:04:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-12-15 04:34:44 +00:00
|
|
|
/*
|
|
|
|
* Name: isis_dissect_nlpid_clv()
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
1999-12-15 04:34:44 +00:00
|
|
|
* Description:
|
|
|
|
* Take apart a NLPID packet and display it. The NLPID (for intergrated
|
|
|
|
* ISIS, contains n network layer protocol IDs that the box supports.
|
2005-04-22 04:07:56 +00:00
|
|
|
* We max out at 256 entries.
|
1999-12-15 04:34:44 +00:00
|
|
|
*
|
|
|
|
* Input:
|
2001-07-02 00:19:34 +00:00
|
|
|
* tvbuff_t * : tvbuffer for packet data
|
1999-12-15 04:34:44 +00:00
|
|
|
* proto_tree * : protocol display tree to fill out. May be NULL
|
2001-07-02 00:19:34 +00:00
|
|
|
* int : offset into packet data where we are.
|
|
|
|
* int : length of clv we are decoding
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
1999-12-15 04:34:44 +00:00
|
|
|
* Output:
|
|
|
|
* void, but we will add to proto tree if !NULL.
|
|
|
|
*/
|
2005-04-22 04:07:56 +00:00
|
|
|
|
|
|
|
#define TRUNCATED_TEXT " [truncated]"
|
2002-08-28 21:04:11 +00:00
|
|
|
void
|
2002-04-07 22:36:55 +00:00
|
|
|
isis_dissect_nlpid_clv(tvbuff_t *tvb, proto_tree *tree, int offset, int length)
|
2001-07-02 00:19:34 +00:00
|
|
|
{
|
2005-09-01 11:34:10 +00:00
|
|
|
gboolean first;
|
|
|
|
proto_item *ti;
|
1999-12-15 04:34:44 +00:00
|
|
|
|
|
|
|
if ( !tree ) return; /* nothing to do! */
|
|
|
|
|
2005-09-01 11:34:10 +00:00
|
|
|
/*
|
|
|
|
* Throw an exception rather than putting in a
|
|
|
|
* partial address.
|
|
|
|
*/
|
|
|
|
tvb_ensure_bytes_exist ( tvb, offset, length );
|
2005-04-22 04:07:56 +00:00
|
|
|
|
|
|
|
if (length <= 0) {
|
2005-09-01 11:34:10 +00:00
|
|
|
proto_tree_add_text (tree, tvb, offset, length,
|
|
|
|
"NLPID(s): --none--");
|
2005-04-22 04:07:56 +00:00
|
|
|
} else {
|
2005-09-01 11:34:10 +00:00
|
|
|
first = TRUE;
|
|
|
|
ti = proto_tree_add_text (tree, tvb, offset, length,
|
|
|
|
"NLPID(s): ");
|
2005-08-30 08:41:18 +00:00
|
|
|
while (length-- > 0 ) {
|
2005-09-01 11:34:10 +00:00
|
|
|
if (!first) {
|
|
|
|
proto_item_append_text(ti, ", ");
|
2005-04-22 04:07:56 +00:00
|
|
|
}
|
2005-09-01 11:34:10 +00:00
|
|
|
proto_item_append_text(ti, "%s (0x%02x)",
|
2012-05-02 14:23:35 +00:00
|
|
|
/* NLPID_IEEE_8021AQ conflicts with NLPID_SNDCF.
|
|
|
|
* In this context, we want the former.
|
|
|
|
*/
|
|
|
|
(tvb_get_guint8(tvb, offset) == NLPID_IEEE_8021AQ
|
|
|
|
? "IEEE 802.1aq (SPB)"
|
2012-08-10 22:55:02 +00:00
|
|
|
: val_to_str_const(tvb_get_guint8(tvb, offset), nlpid_vals,
|
|
|
|
"Unknown")),
|
2012-05-02 14:23:35 +00:00
|
|
|
tvb_get_guint8(tvb, offset));
|
2005-04-22 04:07:56 +00:00
|
|
|
offset++;
|
2005-09-01 11:34:10 +00:00
|
|
|
first = FALSE;
|
2001-04-16 10:04:33 +00:00
|
|
|
}
|
1999-12-15 04:34:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Name: isis_dissect_clvs()
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
1999-12-15 04:34:44 +00:00
|
|
|
* Description:
|
|
|
|
* Dispatch routine to shred all the CLVs in a packet. We just
|
|
|
|
* walk through the clv entries in the packet. For each one, we
|
|
|
|
* search the passed in valid clv's for this protocol (opts) for
|
|
|
|
* a matching code. If found, we add to the display tree and
|
|
|
|
* then call the dissector. If it is not, we just post an
|
2002-04-07 22:36:55 +00:00
|
|
|
* "unknown" clv entry using the passed in unknown clv tree id.
|
1999-12-15 04:34:44 +00:00
|
|
|
*
|
|
|
|
* Input:
|
2001-07-02 00:19:34 +00:00
|
|
|
* tvbuff_t * : tvbuffer for packet data
|
|
|
|
* proto_tree * : protocol display tree to fill out. May be NULL
|
|
|
|
* int : offset into packet data where we are.
|
1999-12-15 04:34:44 +00:00
|
|
|
* isis_clv_handle_t * : NULL dissector terminated array of codes
|
|
|
|
* and handlers (along with tree text and tree id's).
|
|
|
|
* int : length of CLV area.
|
2001-07-02 00:19:34 +00:00
|
|
|
* int : length of IDs in packet.
|
|
|
|
* int : unknown clv tree id
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
1999-12-15 04:34:44 +00:00
|
|
|
* Output:
|
|
|
|
* void, but we will add to proto tree if !NULL.
|
|
|
|
*/
|
2002-08-28 21:04:11 +00:00
|
|
|
void
|
2002-04-07 22:36:55 +00:00
|
|
|
isis_dissect_clvs(tvbuff_t *tvb, proto_tree *tree, int offset,
|
|
|
|
const isis_clv_handle_t *opts, int len, int id_length,
|
2011-05-18 17:19:42 +00:00
|
|
|
int unknown_tree_id _U_)
|
2001-07-02 00:19:34 +00:00
|
|
|
{
|
1999-12-15 04:34:44 +00:00
|
|
|
guint8 code;
|
|
|
|
guint8 length;
|
|
|
|
int q;
|
|
|
|
proto_item *ti;
|
|
|
|
proto_tree *clv_tree;
|
|
|
|
int adj;
|
|
|
|
|
|
|
|
while ( len > 0 ) {
|
2001-07-02 00:19:34 +00:00
|
|
|
code = tvb_get_guint8(tvb, offset);
|
|
|
|
offset += 1;
|
|
|
|
|
|
|
|
length = tvb_get_guint8(tvb, offset);
|
|
|
|
offset += 1;
|
|
|
|
|
1999-12-15 04:34:44 +00:00
|
|
|
adj = (sizeof(code) + sizeof(length) + length);
|
|
|
|
len -= adj;
|
2001-07-02 00:19:34 +00:00
|
|
|
if ( len < 0 ) {
|
2002-04-07 22:36:55 +00:00
|
|
|
isis_dissect_unknown(tvb, tree, offset,
|
1999-12-15 04:34:44 +00:00
|
|
|
"Short CLV header (%d vs %d)",
|
|
|
|
adj, len + adj );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
q = 0;
|
|
|
|
while ((opts[q].dissect != NULL )&&( opts[q].optcode != code )){
|
|
|
|
q++;
|
|
|
|
}
|
|
|
|
if ( opts[q].dissect ) {
|
|
|
|
if (tree) {
|
|
|
|
/* adjust by 2 for code/len octets */
|
2002-08-28 21:04:11 +00:00
|
|
|
ti = proto_tree_add_text(tree, tvb, offset - 2,
|
2003-04-02 08:31:37 +00:00
|
|
|
length + 2, "%s (%u)",
|
|
|
|
opts[q].tree_text, length );
|
2002-08-28 21:04:11 +00:00
|
|
|
clv_tree = proto_item_add_subtree(ti,
|
1999-12-15 04:34:44 +00:00
|
|
|
*opts[q].tree_id );
|
|
|
|
} else {
|
|
|
|
clv_tree = NULL;
|
|
|
|
}
|
2002-04-07 22:36:55 +00:00
|
|
|
opts[q].dissect(tvb, clv_tree, offset,
|
2001-07-02 00:19:34 +00:00
|
|
|
id_length, length);
|
1999-12-15 04:34:44 +00:00
|
|
|
} else {
|
2011-05-18 16:52:45 +00:00
|
|
|
#if 0 /* XXX: Left as commented out in case info about "unknown code" is ever to be displayed under a sub-tree */
|
2002-08-28 21:04:11 +00:00
|
|
|
if (tree) {
|
|
|
|
ti = proto_tree_add_text(tree, tvb, offset - 2,
|
2003-04-02 08:31:37 +00:00
|
|
|
length + 2, "Unknown code %u (%u)",
|
|
|
|
code, length);
|
2002-08-28 21:04:11 +00:00
|
|
|
clv_tree = proto_item_add_subtree(ti,
|
1999-12-15 04:34:44 +00:00
|
|
|
unknown_tree_id );
|
2002-08-28 21:04:11 +00:00
|
|
|
} else {
|
1999-12-15 04:34:44 +00:00
|
|
|
clv_tree = NULL;
|
|
|
|
}
|
2011-05-18 16:52:45 +00:00
|
|
|
#else
|
|
|
|
if (tree) {
|
2011-09-19 20:41:17 +00:00
|
|
|
proto_tree_add_text(tree, tvb, offset - 2,
|
2011-05-18 16:52:45 +00:00
|
|
|
length + 2, "Unknown code %u (%u)",
|
|
|
|
code, length);
|
|
|
|
}
|
|
|
|
#endif
|
1999-12-15 04:34:44 +00:00
|
|
|
}
|
|
|
|
offset += length;
|
|
|
|
}
|
|
|
|
}
|