aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--epan/osi-utils.c6
-rw-r--r--packet-isis-lsp.c40
-rw-r--r--packet-isis-lsp.h4
-rw-r--r--packet-isis-snp.c117
4 files changed, 99 insertions, 68 deletions
diff --git a/epan/osi-utils.c b/epan/osi-utils.c
index 73dd44f873..568338b2ca 100644
--- a/epan/osi-utils.c
+++ b/epan/osi-utils.c
@@ -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 {
diff --git a/packet-isis-lsp.c b/packet-isis-lsp.c
index 34e54cbb5c..30f811e959 100644
--- a/packet-isis-lsp.c
+++ b/packet-isis-lsp.c
@@ -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
@@ -1479,33 +1479,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()
*
* Description:
@@ -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 ) );
diff --git a/packet-isis-lsp.h b/packet-isis-lsp.h
index 2efe5def0c..d831525cf5 100644
--- a/packet-isis-lsp.h
+++ b/packet-isis-lsp.h
@@ -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 */
diff --git a/packet-isis-snp.c b/packet-isis-snp.c
index 7cad07f78f..1925afc436 100644
--- a/packet-isis-snp.c
+++ b/packet-isis-snp.c
@@ -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(tree, tvb, offset, 4,
- "LSP Sequence Number : 0x%04x",
- tvb_get_ntohl(tvb, offset));
- length -= 4;
- offset += 4;
-
- proto_tree_add_text(tree, tvb, offset, 2,
- "LSP checksum : 0x%02x",
+
+ proto_tree_add_text(subtree, tvb, offset+14, 2,
+ "LSP checksum : 0x%04x",
+ tvb_get_ntohs(tvb, offset+14));
+
+ length -= 16;
+ offset += 16;
+ }
+
+}
+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",