From Hannes Gredler:
open up a new subtree for dissecting the lsp-entry TLV; remove the isis_lsp_decode_lsp_id() routine, as the same functionality is better served using print_system_id(); fix a small bug in print_system_id(). svn path=/trunk/; revision=6169
This commit is contained in:
parent
da5d4a70f9
commit
46ac8aa4bd
|
@ -2,7 +2,7 @@
|
|||
* Routines for ISO/OSI network and transport protocol packet disassembly
|
||||
* Main entrance point and common functions
|
||||
*
|
||||
* $Id: osi-utils.c,v 1.9 2002/08/29 18:52:54 guy Exp $
|
||||
* $Id: osi-utils.c,v 1.10 2002/09/02 22:10:17 guy Exp $
|
||||
* Laurent Deniel <deniel@worldnet.fr>
|
||||
* Ralf Schneider <Ralf.Schneider@t-online.de>
|
||||
*
|
||||
|
@ -84,10 +84,10 @@ gchar *print_system_id( const guint8 *buffer, int length ) {
|
|||
buffer[2], buffer[3], buffer[4], buffer[5] );
|
||||
if ( ( 7 == length ) ||
|
||||
( 8 == length )) {
|
||||
sprintf( cur, ".%02x", buffer[6] );
|
||||
cur += sprintf( cur, ".%02x", buffer[6] );
|
||||
}
|
||||
if ( 8 == length ) {
|
||||
sprintf( cur, "-%02x", buffer[7] );
|
||||
cur += sprintf( cur, "-%02x", buffer[7] );
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* packet-isis-lsp.c
|
||||
* Routines for decoding isis lsp packets and their CLVs
|
||||
*
|
||||
* $Id: packet-isis-lsp.c,v 1.35 2002/08/29 18:52:51 guy Exp $
|
||||
* $Id: packet-isis-lsp.c,v 1.36 2002/09/02 22:10:15 guy Exp $
|
||||
* Stuart Stanley <stuarts@mxmail.net>
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
|
@ -1478,33 +1478,6 @@ dissect_lsp_prefix_neighbors_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Name: isis_lsp_decode_lsp_id()
|
||||
*
|
||||
* Description:
|
||||
* Display a LSP id into the display tree.
|
||||
*
|
||||
* Input:
|
||||
* tvbuff_t * : tvbuffer for packet data
|
||||
* proto_tree * : tree to display into. REQUIRED
|
||||
* int : offset into packet data where we are.
|
||||
* char * : title string
|
||||
* int : length of IDs in packet.
|
||||
*
|
||||
* Output:
|
||||
* void, but we will add to proto tree
|
||||
*/
|
||||
void
|
||||
isis_lsp_decode_lsp_id(tvbuff_t *tvb, proto_tree *tree, int offset,
|
||||
char *tstr, int id_length)
|
||||
{
|
||||
proto_tree_add_text(tree, tvb, offset, id_length + 2,
|
||||
"%s: %s.%02x-%02x", tstr,
|
||||
print_system_id( tvb_get_ptr(tvb, offset, id_length), id_length ),
|
||||
tvb_get_guint8(tvb, offset+id_length),
|
||||
tvb_get_guint8(tvb, offset+id_length+1) );
|
||||
}
|
||||
|
||||
/*
|
||||
* Name: isis_dissect_isis_lsp()
|
||||
*
|
||||
|
@ -1547,15 +1520,18 @@ isis_dissect_isis_lsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int o
|
|||
offset += 2;
|
||||
|
||||
if (tree) {
|
||||
proto_tree_add_uint(lsp_tree, hf_isis_lsp_remaining_life, tvb,
|
||||
offset, 2, tvb_get_ntohs(tvb, offset));
|
||||
proto_tree_add_text(lsp_tree, tvb, offset, 2,
|
||||
"Remaining Lifetime: %us",
|
||||
tvb_get_ntohs(tvb, offset));
|
||||
}
|
||||
offset += 2;
|
||||
|
||||
if (tree) {
|
||||
isis_lsp_decode_lsp_id(tvb, lsp_tree, offset,
|
||||
"LSP-ID", id_length);
|
||||
proto_tree_add_text(lsp_tree, tvb, offset, id_length + 2,
|
||||
"LSP-ID: %s",
|
||||
print_system_id( tvb_get_ptr(tvb, offset, id_length+2), id_length+2 ) );
|
||||
}
|
||||
|
||||
if (check_col(pinfo->cinfo, COL_INFO)) {
|
||||
col_append_fstr(pinfo->cinfo, COL_INFO, ", LSP-ID: %s",
|
||||
print_system_id( tvb_get_ptr(tvb, offset, id_length+2), id_length+2 ) );
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* packet-isis-lsp.h
|
||||
* Defines and such for LSP and their CLV decodes
|
||||
*
|
||||
* $Id: packet-isis-lsp.h,v 1.14 2002/08/29 18:52:51 guy Exp $
|
||||
* $Id: packet-isis-lsp.h,v 1.15 2002/09/02 22:10:15 guy Exp $
|
||||
* Stuart Stanley <stuarts@mxmail.net>
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
|
@ -110,8 +110,6 @@
|
|||
*/
|
||||
extern void isis_dissect_isis_lsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
||||
int offset, int hello_type, int header_length, int id_length);
|
||||
extern void isis_lsp_decode_lsp_id(tvbuff_t *tvb, proto_tree *tree,
|
||||
int offset, char *tstr, int id_length);
|
||||
extern void isis_register_lsp(int proto_isis);
|
||||
|
||||
#endif /* _PACKET_ISIS_LSP_H */
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* packet-isis-snp.c
|
||||
* Routines for decoding isis complete & partial SNP and their payload
|
||||
*
|
||||
* $Id: packet-isis-snp.c,v 1.19 2002/08/29 18:52:51 guy Exp $
|
||||
* $Id: packet-isis-snp.c,v 1.20 2002/09/02 22:10:15 guy Exp $
|
||||
* Stuart Stanley <stuarts@mxmail.net>
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
|
@ -55,7 +55,9 @@ static void dissect_l1_snp_authentication_clv(tvbuff_t *tvb,
|
|||
proto_tree *tree, int offset, int id_length, int length);
|
||||
static void dissect_l2_snp_authentication_clv(tvbuff_t *tvb,
|
||||
proto_tree *tree, int offset, int id_length, int length);
|
||||
static void dissect_snp_lsp_entries(tvbuff_t *tvb,
|
||||
static void dissect_csnp_lsp_entries(tvbuff_t *tvb,
|
||||
proto_tree *tree, int offset, int id_length, int length);
|
||||
static void dissect_psnp_lsp_entries(tvbuff_t *tvb,
|
||||
proto_tree *tree, int offset, int id_length, int length);
|
||||
|
||||
static const isis_clv_handle_t clv_l1_csnp_opts[] = {
|
||||
|
@ -63,7 +65,7 @@ static const isis_clv_handle_t clv_l1_csnp_opts[] = {
|
|||
ISIS_CLV_L1_CSNP_LSP_ENTRIES,
|
||||
"LSP entries",
|
||||
&ett_isis_csnp_lsp_entries,
|
||||
dissect_snp_lsp_entries
|
||||
dissect_csnp_lsp_entries
|
||||
},
|
||||
{
|
||||
ISIS_CLV_L1_CSNP_AUTHENTICATION_NS,
|
||||
|
@ -87,7 +89,7 @@ static const isis_clv_handle_t clv_l2_csnp_opts[] = {
|
|||
ISIS_CLV_L2_CSNP_LSP_ENTRIES,
|
||||
"LSP entries",
|
||||
&ett_isis_csnp_lsp_entries,
|
||||
dissect_snp_lsp_entries
|
||||
dissect_csnp_lsp_entries
|
||||
},
|
||||
{
|
||||
ISIS_CLV_L2_CSNP_AUTHENTICATION_NS,
|
||||
|
@ -111,7 +113,7 @@ static const isis_clv_handle_t clv_l1_psnp_opts[] = {
|
|||
ISIS_CLV_L1_PSNP_LSP_ENTRIES,
|
||||
"LSP entries",
|
||||
&ett_isis_psnp_lsp_entries,
|
||||
dissect_snp_lsp_entries
|
||||
dissect_psnp_lsp_entries
|
||||
},
|
||||
{
|
||||
ISIS_CLV_L1_PSNP_AUTHENTICATION_NS,
|
||||
|
@ -135,7 +137,7 @@ static const isis_clv_handle_t clv_l2_psnp_opts[] = {
|
|||
ISIS_CLV_L2_PSNP_LSP_ENTRIES,
|
||||
"LSP entries",
|
||||
&ett_isis_psnp_lsp_entries,
|
||||
dissect_snp_lsp_entries
|
||||
dissect_psnp_lsp_entries
|
||||
},
|
||||
{
|
||||
ISIS_CLV_L2_PSNP_AUTHENTICATION,
|
||||
|
@ -153,6 +155,7 @@ static const isis_clv_handle_t clv_l2_psnp_opts[] = {
|
|||
0, "", NULL, NULL
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
* Name: dissect_snp_lsp_entries()
|
||||
*
|
||||
|
@ -175,9 +178,11 @@ static const isis_clv_handle_t clv_l2_psnp_opts[] = {
|
|||
* void, but we will add to proto tree if !NULL.
|
||||
*/
|
||||
static void
|
||||
dissect_snp_lsp_entries(tvbuff_t *tvb, proto_tree *tree, int offset,
|
||||
dissect_csnp_lsp_entries(tvbuff_t *tvb, proto_tree *tree, int offset,
|
||||
int id_length, int length)
|
||||
{
|
||||
proto_tree *subtree,*ti;
|
||||
|
||||
while ( length > 0 ) {
|
||||
if ( length < 2+id_length+2+4+2 ) {
|
||||
isis_dissect_unknown(tvb, tree, offset,
|
||||
|
@ -186,27 +191,77 @@ dissect_snp_lsp_entries(tvbuff_t *tvb, proto_tree *tree, int offset,
|
|||
return;
|
||||
}
|
||||
|
||||
proto_tree_add_text(tree, tvb, offset, 2, "Remaining life : %d",
|
||||
ti = proto_tree_add_text(tree, tvb, offset, 16,
|
||||
"LSP-ID: %s, Sequence: 0x%08x, Lifetime: %5us, Checksum: 0x%04x",
|
||||
print_system_id( tvb_get_ptr(tvb, offset+2, id_length+2), id_length+2 ),
|
||||
tvb_get_ntohl(tvb, offset+10),
|
||||
tvb_get_ntohs(tvb, offset),
|
||||
tvb_get_ntohs(tvb, offset+14));
|
||||
|
||||
subtree = proto_item_add_subtree(ti,ett_isis_csnp_lsp_entries);
|
||||
|
||||
proto_tree_add_text(subtree, tvb, offset+2, 8,
|
||||
"LSP-ID: : %s",
|
||||
print_system_id( tvb_get_ptr(tvb, offset+2, id_length+2), id_length+2 ));
|
||||
|
||||
proto_tree_add_text(subtree, tvb, offset+10, 4,
|
||||
"LSP Sequence Number : 0x%08x",
|
||||
tvb_get_ntohl(tvb, offset+10));
|
||||
|
||||
proto_tree_add_text(subtree, tvb, offset, 2,
|
||||
"Remaining Lifetime : %us",
|
||||
tvb_get_ntohs(tvb, offset));
|
||||
length -= 2;
|
||||
offset += 2;
|
||||
|
||||
isis_lsp_decode_lsp_id(tvb, tree, offset,
|
||||
"LSP ID ", id_length);
|
||||
length -= id_length + 2;
|
||||
offset += id_length + 2;
|
||||
proto_tree_add_text(subtree, tvb, offset+14, 2,
|
||||
"LSP checksum : 0x%04x",
|
||||
tvb_get_ntohs(tvb, offset+14));
|
||||
|
||||
proto_tree_add_text(tree, tvb, offset, 4,
|
||||
"LSP Sequence Number : 0x%04x",
|
||||
tvb_get_ntohl(tvb, offset));
|
||||
length -= 4;
|
||||
offset += 4;
|
||||
length -= 16;
|
||||
offset += 16;
|
||||
}
|
||||
|
||||
proto_tree_add_text(tree, tvb, offset, 2,
|
||||
"LSP checksum : 0x%02x",
|
||||
}
|
||||
static void
|
||||
dissect_psnp_lsp_entries(tvbuff_t *tvb, proto_tree *tree, int offset,
|
||||
int id_length, int length)
|
||||
{
|
||||
proto_tree *subtree,*ti;
|
||||
|
||||
while ( length > 0 ) {
|
||||
if ( length < 2+id_length+2+4+2 ) {
|
||||
isis_dissect_unknown(tvb, tree, offset,
|
||||
"Short SNP header entry (%d vs %d)", length,
|
||||
2+id_length+2+4+2 );
|
||||
return;
|
||||
}
|
||||
|
||||
ti = proto_tree_add_text(tree, tvb, offset, 16,
|
||||
"LSP-ID: %s, Sequence: 0x%08x, Lifetime: %5us, Checksum: 0x%04x",
|
||||
print_system_id( tvb_get_ptr(tvb, offset+2, id_length+2), id_length+2 ),
|
||||
tvb_get_ntohl(tvb, offset+10),
|
||||
tvb_get_ntohs(tvb, offset),
|
||||
tvb_get_ntohs(tvb, offset+14));
|
||||
|
||||
subtree = proto_item_add_subtree(ti,ett_isis_psnp_lsp_entries);
|
||||
|
||||
proto_tree_add_text(subtree, tvb, offset+2, 8,
|
||||
"LSP-ID: : %s",
|
||||
print_system_id( tvb_get_ptr(tvb, offset+2, id_length+2), id_length+2 ));
|
||||
|
||||
proto_tree_add_text(subtree, tvb, offset+10, 4,
|
||||
"LSP Sequence Number : 0x%08x",
|
||||
tvb_get_ntohl(tvb, offset+10));
|
||||
|
||||
proto_tree_add_text(subtree, tvb, offset, 2,
|
||||
"Remaining Lifetime : %us",
|
||||
tvb_get_ntohs(tvb, offset));
|
||||
length -= 2;
|
||||
offset += 2;
|
||||
|
||||
proto_tree_add_text(subtree, tvb, offset+14, 2,
|
||||
"LSP checksum : 0x%04x",
|
||||
tvb_get_ntohs(tvb, offset+14));
|
||||
|
||||
length -= 16;
|
||||
offset += 16;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -263,8 +318,9 @@ isis_dissect_isis_csnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int
|
|||
offset += id_length + 1;
|
||||
|
||||
if (tree) {
|
||||
isis_lsp_decode_lsp_id(tvb, csnp_tree, offset,
|
||||
"Start LSP-ID", id_length );
|
||||
proto_tree_add_text(csnp_tree, tvb, offset, id_length + 2,
|
||||
"Start LSP-ID: %s",
|
||||
print_system_id( tvb_get_ptr(tvb, offset, id_length+2), id_length+2 ) );
|
||||
}
|
||||
if (check_col(pinfo->cinfo, COL_INFO)) {
|
||||
col_append_fstr(pinfo->cinfo, COL_INFO, ", Start LSP-ID: %s",
|
||||
|
@ -273,8 +329,9 @@ isis_dissect_isis_csnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int
|
|||
offset += id_length + 2;
|
||||
|
||||
if (tree) {
|
||||
isis_lsp_decode_lsp_id(tvb, csnp_tree, offset,
|
||||
"End LSP-ID ", id_length );
|
||||
proto_tree_add_text(csnp_tree, tvb, offset, id_length + 2,
|
||||
"End LSP-ID: %s",
|
||||
print_system_id( tvb_get_ptr(tvb, offset, id_length+2), id_length+2 ) );
|
||||
}
|
||||
if (check_col(pinfo->cinfo, COL_INFO)) {
|
||||
col_append_fstr(pinfo->cinfo, COL_INFO, ", End LSP-ID: %s",
|
||||
|
|
Loading…
Reference in New Issue