Get rid of the unused hf_ value "hf_isis_hello_clv_restart".

Use the "tree_id" argument to "isis_dissect_mt_clv()" for the 2-byte MT
IDs, and arrange that the two hf_ values passed as that argument
actually be defined for protocol fields.

Fix the loop in "isis_dissect_mt_clv()" so that it actually catches an
odd byte at the end (i.e., loop until there is data at all, not until
there is 1 or fewer bytes), and put that odd byte, if it exists, into
the tree as a 1-byte text item, not a 2-byte text item.

svn path=/trunk/; revision=5113
This commit is contained in:
Guy Harris 2002-04-07 23:39:00 +00:00
parent 5a89b3b965
commit b212a49bd7
3 changed files with 48 additions and 42 deletions

View File

@ -1,7 +1,7 @@
/* packet-isis-clv.c
* Common CLV decode routines.
*
* $Id: packet-isis-clv.c,v 1.18 2002/04/07 22:36:55 guy Exp $
* $Id: packet-isis-clv.c,v 1.19 2002/04/07 23:39:00 guy Exp $
* Stuart Stanley <stuarts@mxmail.net>
*
* Ethereal - Network traffic analyzer
@ -225,51 +225,51 @@ void
isis_dissect_mt_clv(tvbuff_t *tvb, proto_tree *tree, int offset, int length,
int tree_id)
{
guint16 mt_block;
char mt_desc[60];
guint16 mt_block;
char mt_desc[60];
while (length>1) {
/* length can only be a multiple of 2, otherwise there is
something broken -> so decode down until length is 1 */
if (length!=1)
{
/* fetch two bytes */
mt_block=tvb_get_ntohs(tvb, offset);
while (length>0) {
/* length can only be a multiple of 2, otherwise there is
something broken -> so decode down until length is 1 */
if (length!=1) {
/* fetch two bytes */
mt_block=tvb_get_ntohs(tvb, offset);
/* mask out the lower 12 bits */
switch(mt_block&0x0fff) {
case 0:
strcpy(mt_desc,"IPv4 unicast");
break;
case 1:
strcpy(mt_desc,"In-Band Management");
break;
case 2:
strcpy(mt_desc,"IPv6 unicast");
break;
case 3:
strcpy(mt_desc,"Multicast");
break;
case 4095:
strcpy(mt_desc,"Development, Experimental or Proprietary");
break;
default:
strcpy(mt_desc,"Reserved for IETF Consensus");
}
proto_tree_add_text ( tree, tvb, offset, 2 ,
"%s Topology (0x%03x)%s%s",
/* mask out the lower 12 bits */
switch(mt_block&0x0fff) {
case 0:
strcpy(mt_desc,"IPv4 unicast");
break;
case 1:
strcpy(mt_desc,"In-Band Management");
break;
case 2:
strcpy(mt_desc,"IPv6 unicast");
break;
case 3:
strcpy(mt_desc,"Multicast");
break;
case 4095:
strcpy(mt_desc,"Development, Experimental or Proprietary");
break;
default:
strcpy(mt_desc,"Reserved for IETF Consensus");
break;
}
proto_tree_add_uint_format ( tree, tree_id, tvb, offset, 2,
mt_block,
"%s Topology (0x%03x)%s%s",
mt_desc,
mt_block&0xfff,
(mt_block&0x8000) ? "" : ", no sub-TLVs present",
(mt_block&0x4000) ? ", ATT bit set" : "" );
} else {
proto_tree_add_text ( tree, tvb, offset, 1,
"malformed MT-ID");
break;
}
else {
proto_tree_add_text ( tree, tvb, offset, 2 ,
"malformed MT-ID");
break;
}
length=length-2;
offset=offset+2;
length=length-2;
offset=offset+2;
}
}

View File

@ -1,7 +1,7 @@
/* packet-isis-hello.c
* Routines for decoding isis hello packets and their CLVs
*
* $Id: packet-isis-hello.c,v 1.28 2002/04/07 22:36:55 guy Exp $
* $Id: packet-isis-hello.c,v 1.29 2002/04/07 23:39:00 guy Exp $
* Stuart Stanley <stuarts@mxmail.net>
*
* Ethereal - Network traffic analyzer
@ -53,7 +53,6 @@ static int hf_isis_hello_clv_ipv4_int_addr = -1;
static int hf_isis_hello_clv_ipv6_int_addr = -1;
static int hf_isis_hello_clv_ptp_adj = -1;
static int hf_isis_hello_clv_mt = -1;
static int hf_isis_hello_clv_restart = -1;
static gint ett_isis_hello = -1;
static gint ett_isis_hello_clv_area_addr = -1;
@ -787,6 +786,9 @@ isis_register_hello(int proto_isis) {
{ "Point-to-point Adjacency ", "isis.hello.clv_ptp_adj",
FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL }},
{ &hf_isis_hello_clv_mt,
{ "MT-ID ", "isis.hello.clv_mt",
FT_UINT16, BASE_HEX, NULL, 0x0, "", HFILL }},
};
static gint *ett[] = {
&ett_isis_hello,

View File

@ -1,7 +1,7 @@
/* packet-isis-lsp.c
* Routines for decoding isis lsp packets and their CLVs
*
* $Id: packet-isis-lsp.c,v 1.27 2002/04/07 22:36:55 guy Exp $
* $Id: packet-isis-lsp.c,v 1.28 2002/04/07 23:39:00 guy Exp $
* Stuart Stanley <stuarts@mxmail.net>
*
* Ethereal - Network traffic analyzer
@ -1681,6 +1681,10 @@ isis_register_lsp(int proto_isis) {
{ &hf_isis_lsp_clv_te_router_id,
{ "Traffic Engineering Router ID", "isis.lsp.clv_te_router_id", FT_IPv4,
BASE_NONE, NULL, 0x0, "", HFILL }},
{ &hf_isis_lsp_clv_mt,
{ "MT-ID ", "isis.lsp.clv_mt",
FT_UINT16, BASE_HEX, NULL, 0x0, "", HFILL }},
};
static gint *ett[] = {
&ett_isis_lsp,