Ethereal-dev: [Ethereal-dev] isis l1 externals support
Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.
From: Hannes Gredler <hannes@xxxxxxxxxxx>
Date: Sun, 17 Jun 2001 03:15:54 +0200
ethereal developers, pls find attached a patch to support decoding for external_reachability TLVs at level 1 for is-is. also cleaned up much of the tlv dissectors output [now e.g. the ip_int_reach decoder puts out prefix-lenghts rather than masks] therefore TLV 128,130,135 output looks now almost the same. /hannes
? hannes-isis-hdlc-tcpdump.1500
? hannes-isis-hdlc-tcpdump.1500.2
? hannes-isis-lan-tcpdump.1500
? hannes-isis-auth-tcpdump.1514
? hannes-isis-ppp-tcpdump.1500
? hannes-isis-external-l1-tcpdump.1500
Index: packet-isis-lsp.c
===================================================================
RCS file: /cvsroot/ethereal/packet-isis-lsp.c,v
retrieving revision 1.15
diff -u -r1.15 packet-isis-lsp.c
--- packet-isis-lsp.c 2001/06/07 19:13:35 1.15
+++ packet-isis-lsp.c 2001/06/17 01:08:46
@@ -42,6 +42,7 @@
#include <net/inet.h>
#endif
+#include "epan/ipv4.h"
#include "packet.h"
#include "packet-osi.h"
#include "packet-ipv6.h"
@@ -155,13 +156,19 @@
&ett_isis_lsp_clv_ext_is_reachability,
dissect_lsp_ext_is_reachability_clv
},
- {
+ {
ISIS_CLV_L1_LSP_IP_INT_REACHABLE,
"IP Internal reachability",
&ett_isis_lsp_clv_ip_reachability,
dissect_lsp_ip_reachability_clv
},
{
+ ISIS_CLV_L1_LSP_IP_EXT_REACHABLE,
+ "IP External reachability",
+ &ett_isis_lsp_clv_ip_reachability,
+ dissect_lsp_ip_reachability_clv
+ },
+ {
ISIS_CLV_L1_LSP_EXT_IP_REACHABLE,
"Extended IP Reachability",
&ett_isis_lsp_clv_ext_ip_reachability,
@@ -261,6 +268,12 @@
dissect_lsp_ip_reachability_clv
},
{
+ ISIS_CLV_L2_LSP_IP_EXT_REACHABLE,
+ "IP External reachability",
+ &ett_isis_lsp_clv_ip_reachability,
+ dissect_lsp_ip_reachability_clv
+ },
+ {
ISIS_CLV_L2_LSP_NLPID,
"Protocols supported",
&ett_isis_lsp_clv_nlpid,
@@ -279,12 +292,6 @@
dissect_lsp_te_router_id_clv
},
{
- ISIS_CLV_L2_LSP_IP_EXT_REACHABLE,
- "IP external reachability",
- &ett_isis_lsp_clv_ip_reachability,
- dissect_lsp_ip_reachability_clv
- },
- {
ISIS_CLV_L2_LSP_EXT_IP_REACHABLE,
"Extended IP Reachability",
&ett_isis_lsp_clv_ext_ip_reachability,
@@ -399,8 +406,21 @@
guint length, int id_length, frame_data *fd, proto_tree *tree) {
proto_item *ti;
proto_tree *ntree = NULL;
- guint32 src, mask;
+ guint32 src, mask, prefix_len;
+ guint32 bitmasks[33] = {
+ 0x00000000,
+ 0x00000008, 0x0000000c, 0x0000000e, 0x0000000f,
+ 0x000000f8, 0x000000fc, 0x000000fe, 0x000000ff,
+ 0x000008ff, 0x00000cff, 0x00000eff, 0x00000fff,
+ 0x0000f8ff, 0x0000fcff, 0x0000feff, 0x0000ffff,
+ 0x0008ffff, 0x000cffff, 0x000effff, 0x000fffff,
+ 0x00f8ffff, 0x00fcffff, 0x00feffff, 0x00ffffff,
+ 0x08ffffff, 0x0cffffff, 0x0effffff, 0x0fffffff,
+ 0xf8ffffff, 0xfcffffff, 0xfeffffff, 0xffffffff
+ };
+
+
while ( length > 0 ) {
if (length<12) {
isis_dissect_unknown(offset, length, tree, fd,
@@ -413,10 +433,33 @@
if ( tree ) {
memcpy(&src, &pd[offset+4], 4);
memcpy(&mask, &pd[offset+8], 4);
- ti = proto_tree_add_text ( tree, NullTVB, offset, 12,
- "IPv4 prefix: %s : %s",
+
+ /* find out if the mask matches one of 33 possible prefix lengths */
+
+ prefix_len=0;
+
+ while(prefix_len<=33) {
+ if (bitmasks[prefix_len++]==mask) {
+ prefix_len--;
+ break;
+ }
+ }
+
+ /* 34 indicates no match -> must be a discontiguous netmask
+ lets dump the mask, otherwise print the prefix_len */
+
+ if(prefix_len==34) {
+ ti = proto_tree_add_text ( tree, NullTVB, offset, 12,
+ "IPv4 prefix: %s mask %s",
+ ip_to_str((guint8*)&src),
+ ip_to_str((guint8*)&mask));
+ } else {
+ ti = proto_tree_add_text ( tree, NullTVB, offset, 12,
+ "IPv4 prefix: %s/%d",
ip_to_str((guint8*)&src),
- ip_to_str((guint8*)&mask) );
+ prefix_len );
+ };
+
ntree = proto_item_add_subtree(ti,
ett_isis_lsp_clv_ip_reachability);
@@ -496,18 +539,14 @@
byte_length = (bit_length + 7) / 8;
memcpy (prefix, &pd[offset+5], byte_length);
pi = proto_tree_add_text (tree, NullTVB, offset, 0,
- "IPv4 prefix: %s /%d",
+ "IPv4 prefix: %s/%d",
ip_to_str (prefix),
bit_length );
subtree = proto_item_add_subtree (pi,
ett_isis_lsp_part_of_clv_ext_ip_reachability);
proto_tree_add_text (subtree, NullTVB, offset, 4,
- "Metric: %d", pntohl (&pd[offset]) );
-
- proto_tree_add_text (subtree, NullTVB, offset+4, 1,
- "Distribution: %s",
- ((ctrl_info & 0x80) == 0) ? "up" : "down" );
+ "Metric: %d, Distribution: %s", pntohl (&pd[offset]), ((ctrl_info & 0x80) == 0) ? "up" : "down" );
proto_tree_add_text (subtree, NullTVB, offset+4, 1,
"Sub_CLV(s): %s",
Index: packet-isis-lsp.h
===================================================================
RCS file: /cvsroot/ethereal/packet-isis-lsp.h,v
retrieving revision 1.6
diff -u -r1.6 packet-isis-lsp.h
--- packet-isis-lsp.h 2001/06/07 19:13:35 1.6
+++ packet-isis-lsp.h 2001/06/17 01:08:46
@@ -61,15 +61,16 @@
#define ISIS_CLV_L1_LSP_AREA_ADDRESS 1
#define ISIS_CLV_L1_LSP_IS_NEIGHBORS 2
#define ISIS_CLV_L1_LSP_ES_NEIGHBORS 3
-#define ISIS_CLV_L1_LSP_EXT_IS_REACHABLE 22
+#define ISIS_CLV_L1_LSP_EXT_IS_REACHABLE 22
#define ISIS_CLV_L1_LSP_IP_INT_REACHABLE 128
#define ISIS_CLV_L1_LSP_NLPID 129
+#define ISIS_CLV_L1_LSP_IP_EXT_REACHABLE 130
#define ISIS_CLV_L1_LSP_IP_INTERFACE_ADDR 132
#define ISIS_CLV_L1_LSP_TE_ROUTER_ID 134
-#define ISIS_CLV_L1_LSP_EXT_IP_REACHABLE 135
+#define ISIS_CLV_L1_LSP_EXT_IP_REACHABLE 135
#define ISIS_CLV_L1_LSP_HOSTNAME 137
-#define ISIS_CLV_L1_LSP_IPv6_INTERFACE_ADDR 232
-#define ISIS_CLV_L1_LSP_IPv6_REACHABLE 236
+#define ISIS_CLV_L1_LSP_IPv6_INTERFACE_ADDR 232
+#define ISIS_CLV_L1_LSP_IPv6_REACHABLE 236
/*
* Note, the spec say 133, but everyone seems to use 10. Any clue on why
* this is would be appreciated!
@@ -84,17 +85,17 @@
#define ISIS_CLV_L2_LSP_IS_NEIGHBORS 2
#define ISIS_CLV_L2_LSP_PARTITION_DIS 4
#define ISIS_CLV_L2_LSP_PREFIX_NEIGHBORS 5
-#define ISIS_CLV_L2_LSP_EXT_IS_REACHABLE 22
+#define ISIS_CLV_L2_LSP_EXT_IS_REACHABLE 22
#define ISIS_CLV_L2_LSP_IP_INT_REACHABLE 128
#define ISIS_CLV_L2_LSP_NLPID 129
#define ISIS_CLV_L2_LSP_IP_EXT_REACHABLE 130
#define ISIS_CLV_L2_LSP_IDRP_INFO 131
#define ISIS_CLV_L2_LSP_IP_INTERFACE_ADDR 132
#define ISIS_CLV_L2_LSP_TE_ROUTER_ID 134
-#define ISIS_CLV_L2_LSP_EXT_IP_REACHABLE 135
+#define ISIS_CLV_L2_LSP_EXT_IP_REACHABLE 135
#define ISIS_CLV_L2_LSP_HOSTNAME 137
-#define ISIS_CLV_L2_LSP_IPv6_INTERFACE_ADDR 232
-#define ISIS_CLV_L2_LSP_IPv6_REACHABLE 236
+#define ISIS_CLV_L2_LSP_IPv6_INTERFACE_ADDR 232
+#define ISIS_CLV_L2_LSP_IPv6_REACHABLE 236
/*
* Note, the spec say 133, but everyone seems to use 10. Any clue on why
* this is would be appreciated!
@@ -113,3 +114,9 @@
const u_char *pd, int offset, int id_length);
#endif /* _PACKET_ISIS_LSP_H */
+
+
+
+
+
+
- Follow-Ups:
- Re: [Ethereal-dev] isis l1 externals support
- From: Guy Harris
- Re: [Ethereal-dev] isis l1 externals support
- Prev by Date: [Ethereal-dev] Patch: Missing initializers fixed and additional warnings
- Next by Date: [Ethereal-dev] Question about strptime
- Previous by thread: Re: [Ethereal-dev] Patch: Missing initializers fixed and additional warnings
- Next by thread: Re: [Ethereal-dev] isis l1 externals support
- Index(es):