Ethereal-dev: [Ethereal-dev] isis domain-wide-distribution 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: Thu, 7 Jun 2001 15:00:50 +0200
ethereal developers,

pls find attached a patch to support rfc2966 for is-is.
also cleaned up much of the IP_INT_REACH TLV parsing.

patched to display TLV #22 in Mbps rather than in bytes
per second, like on routers embedded diagnostic tools.

/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-metric-type-tcpdump.1500
? hannes-isis-metric-type-l1-tcpdump.1500
Index: packet-isis-lsp.c
===================================================================
RCS file: /cvsroot/ethereal/packet-isis-lsp.c,v
retrieving revision 1.14
diff -u -r1.14 packet-isis-lsp.c
--- packet-isis-lsp.c	2001/05/23 18:44:59	1.14
+++ packet-isis-lsp.c	2001/06/07 12:55:35
@@ -414,24 +414,42 @@
 			memcpy(&src, &pd[offset+4], 4);
 			memcpy(&mask, &pd[offset+8], 4);
 			ti = proto_tree_add_text ( tree, NullTVB, offset, 12, 
-				"IP prefix: %s (%s) : %s",
-				get_hostname(src), ip_to_str((guint8*)&src),
+				"IPv4 prefix: %s : %s",
+				ip_to_str((guint8*)&src),
 				ip_to_str((guint8*)&mask) );
 			ntree = proto_item_add_subtree(ti, 
 				ett_isis_lsp_clv_ip_reachability);
 
 			proto_tree_add_text (ntree, NullTVB, offset, 1,
-				"Default Metric: %s %s %d:%d",
-				ISIS_LSP_CLV_METRIC_SUPPORTED(pd[offset]) ? "External" : "Internal",
-				ISIS_LSP_CLV_METRIC_RESERVED(pd[offset]) ? "(reserved bit != 0)" : "",
+				"Default Metric: %d, %s, Distribution: %s",
 				ISIS_LSP_CLV_METRIC_VALUE(pd[offset]),
-				pd[offset] );
-			dissect_metric ( ntree, offset + 1, pd[offset+1], 
-				"Delay", FALSE );
-			dissect_metric ( ntree, offset + 2, pd[offset+2], 
-				"Expense",FALSE );
-			dissect_metric ( ntree, offset + 3, pd[offset+3], 
-				"Error", FALSE );
+				ISIS_LSP_CLV_METRIC_IE(pd[offset]) ? "External" : "Internal",
+				ISIS_LSP_CLV_METRIC_UPDOWN(pd[offset]) ? "down" : "up");
+
+
+			if (ISIS_LSP_CLV_METRIC_SUPPORTED(pd[offset+1])) {
+			  proto_tree_add_text (ntree, NullTVB, offset+1, 1, "Delay Metric:   Not supported");
+					       } else {
+                          proto_tree_add_text (ntree, NullTVB, offset+1, 1, "Delay Metric:   %d, %s",
+					       ISIS_LSP_CLV_METRIC_VALUE(pd[offset+1]),
+					       ISIS_LSP_CLV_METRIC_IE(pd[offset+1]) ? "External" : "Internal");
+					       }
+
+                        if (ISIS_LSP_CLV_METRIC_SUPPORTED(pd[offset+2])) {
+                          proto_tree_add_text (ntree, NullTVB, offset+2, 1, "Expense Metric: Not supported");
+			} else {
+                          proto_tree_add_text (ntree, NullTVB, offset+2, 1, "Exense Metric:  %d, %s",
+                                               ISIS_LSP_CLV_METRIC_VALUE(pd[offset+2]),
+					       ISIS_LSP_CLV_METRIC_IE(pd[offset+2]) ? "External" : "Internal");
+			}
+
+                        if (ISIS_LSP_CLV_METRIC_SUPPORTED(pd[offset+3])) {
+                          proto_tree_add_text (ntree, NullTVB, offset+3, 1, "Error Metric:   Not supported");
+			} else {
+                          proto_tree_add_text (ntree, NullTVB, offset+3, 1, "Error Metric:   %d, %s",
+                                               ISIS_LSP_CLV_METRIC_VALUE(pd[offset+3]),
+					       ISIS_LSP_CLV_METRIC_IE(pd[offset+3]) ? "External" : "Internal");
+			}
 		}
 		offset += 12;
 		length -= 12;
@@ -845,15 +863,40 @@
 			}
 			ntree = proto_item_add_subtree(ti, 
 				ett_isis_lsp_clv_is_neighbors);
-			dissect_metric ( ntree, offset, pd[offset], "Default", 
-				TRUE );
-			dissect_metric ( ntree, offset + 1, pd[offset+1], 
-				"Delay", FALSE );
-			dissect_metric ( ntree, offset + 2, pd[offset+2], 
-				"Expense",FALSE );
-			dissect_metric ( ntree, offset + 3, pd[offset+3], 
-				"Error", FALSE );
 
+
+
+                        proto_tree_add_text (ntree, NullTVB, offset, 1,
+					     "Default Metric: %d, %s",
+					     ISIS_LSP_CLV_METRIC_VALUE(pd[offset]),
+					     ISIS_LSP_CLV_METRIC_IE(pd[offset]) ? "External" : "Internal");
+					    
+			if (ISIS_LSP_CLV_METRIC_SUPPORTED(pd[offset+1])) {
+                          proto_tree_add_text (ntree, NullTVB, offset+1, 1, "Delay Metric:   Not supported");
+			} else {
+                          proto_tree_add_text (ntree, NullTVB, offset+1, 1, "Delay Metric:   %d, %s",
+                                             ISIS_LSP_CLV_METRIC_VALUE(pd[offset+1]),
+					     ISIS_LSP_CLV_METRIC_IE(pd[offset+1]) ? "External" : "Internal");
+			}
+
+
+                        if (ISIS_LSP_CLV_METRIC_SUPPORTED(pd[offset+2])) {
+                          proto_tree_add_text (ntree, NullTVB, offset+2, 1, "Expense Metric: Not supported");
+                        } else {
+                          proto_tree_add_text (ntree, NullTVB, offset+2, 1, "Expense Metric: %d, %s",
+					       ISIS_LSP_CLV_METRIC_VALUE(pd[offset+2]),
+					       ISIS_LSP_CLV_METRIC_IE(pd[offset+2]) ? "External" : "Internal");
+                        }
+
+                        if (ISIS_LSP_CLV_METRIC_SUPPORTED(pd[offset+3])) {
+                          proto_tree_add_text (ntree, NullTVB, offset+3, 1, "Error Metric:   Not supported");
+                        } else {
+                          proto_tree_add_text (ntree, NullTVB, offset+3, 1, "Error Metric:   %d, %s",
+					       ISIS_LSP_CLV_METRIC_VALUE(pd[offset+3]),
+					       ISIS_LSP_CLV_METRIC_IE(pd[offset+3]) ? "External" : "Internal");
+                        }
+	 
+			
 /* this is redundant information
 			Proto_tree_add_text ( ntree, NullTVB, offset + 4, id_length, 
 				"Neighbour ID: %s",
@@ -1002,7 +1045,7 @@
 	ui = pntohl (&pd[offset]);
 	memcpy (&bw, &ui, 4);
 	proto_tree_add_text (tree, NullTVB, offset-2, 6,
-		"Maximum link bandwidth : %f bytes/second", bw );
+		"Maximum link bandwidth : %.2f Mbps", bw*8/1000000 );
 }
 
 /*
@@ -1029,7 +1072,7 @@
 	ui = pntohl (&pd[offset]);
 	memcpy (&bw, &ui, 4);
 	proto_tree_add_text (tree, NullTVB, offset-2, 6,
-		"Reservable link bandwidth: %f bytes/second", bw );
+		"Reservable link bandwidth: %.2f Mbps", bw*8/1000000 );
 }
 
 /*
@@ -1063,7 +1106,7 @@
 		ui = pntohl (&pd[offset]);
 		memcpy (&bw, &ui, 4);
 		proto_tree_add_text (ntree, NullTVB, offset+4*i, 4,
-			"priority level %d: %f bytes/second", i, bw );
+			"priority level %d: %.2f Mbps", i, bw*8/1000000 );
 	}
 }
 
@@ -1408,7 +1451,7 @@
 			inx++;
 		}
 		if (!some) { 
-			strcat ( sbuf, "<none set!>" );
+			strcat ( sbuf, "default-only" );
 		}
 		proto_tree_add_text(lsp_tree, NullTVB, offset + 18, 1, 
 			"Type block(0x%02x): P:%d, Supported metric(s): %s, OL:%d, istype:%s",
Index: packet-isis-lsp.h
===================================================================
RCS file: /cvsroot/ethereal/packet-isis-lsp.h,v
retrieving revision 1.5
diff -u -r1.5 packet-isis-lsp.h
--- packet-isis-lsp.h	2001/05/14 18:40:15	1.5
+++ packet-isis-lsp.h	2001/06/07 12:55:36
@@ -50,7 +50,9 @@
 #define ISIS_LSP_TYPE_LEVEL_2		3
 
 #define ISIS_LSP_CLV_METRIC_SUPPORTED(x)	((x)&0xf0)
+#define ISIS_LSP_CLV_METRIC_IE(x)               ((x)&0x20)
 #define ISIS_LSP_CLV_METRIC_RESERVED(x)		((x)&0x40)
+#define ISIS_LSP_CLV_METRIC_UPDOWN(x)           ((x)&0x40)
 #define ISIS_LSP_CLV_METRIC_VALUE(x)		((x)&0x3f)
 
 /*