Ethereal-dev: [ethereal-dev] [PATCH] ospf bugs

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Michael Rozhavsky <mike@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 13 Jul 2000 17:39:25 +0300 (IDT)
Hi,

there are two errors in parsing of OSPF packets

1) DD flags in Database Description packets are translated incorrectly
2) Summary-LSA metric is not displayed

The attached patch fixes both of above problems.


P.S. thank you for great work!

--

      Rozhavsky Michael
Index: packet-ospf.c
===================================================================
RCS file: /cvsroot/ethereal/packet-ospf.c,v
retrieving revision 1.24
diff -u -r1.24 packet-ospf.c
--- packet-ospf.c	2000/05/31 05:07:28	1.24
+++ packet-ospf.c	2000/07/13 14:34:03
@@ -308,8 +308,8 @@
 
 	flags_offset=0;
 	if(( ospf_dbd.flags & OSPF_DBD_FLAG_MS ) == OSPF_DBD_FLAG_MS){
-	    strcpy( (char *)(flags + flags_offset), "_I_");
-	    flags_offset+=1;
+	    strcpy( (char *)(flags + flags_offset), "_MS_");
+	    flags_offset+=4;
 	}
 	if(( ospf_dbd.flags & OSPF_DBD_FLAG_M ) == OSPF_DBD_FLAG_M){
 	    strcpy((char *) (flags + flags_offset), "_M_");
@@ -660,6 +660,7 @@
 
     /* data structures for the summary and ASBR LSAs */
     e_ospf_summary_lsa 	summary_lsa;
+    guint32             metric;
 
     /* data structures for the AS-External LSA */
     e_ospf_asexternal_lsa       asext_lsa;
@@ -828,6 +829,11 @@
                 memcpy(&summary_lsa, &pd[offset], sizeof(e_ospf_summary_lsa));
                 proto_tree_add_text(ospf_lsa_tree, NullTVB, offset, 4, "Netmask: %s", 
                                                  ip_to_str((guint8 *) &(summary_lsa.network_mask)));
+		/* this routine returns only the TOS 0 metric (even if there are more TOS metrics) */
+		memcpy(&metric, &pd[offset+4], 4);
+		metric = ntohl(metric) & 0x00ffffff ;
+		proto_tree_add_text(ospf_lsa_tree, NullTVB, offset + 5, 3, "Metric: %d", metric);
+				                 
                 /* returns only the TOS 0 metric (even if there are more TOS metrics) */
                 break;
             case(OSPF_LSTYPE_ASEXT):