Ethereal-dev: [Ethereal-dev] Patch for OSPF dissector

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

From: Motonori Shindo <mshindo@xxxxxxxxxxx>
Date: Tue, 14 May 2002 02:19:40 +0900 (JST)
Hi,

Please find attached patch to fix the following two problems in OSPF
dissector:

 1) OSPF Link State Request packet in V2 has 4-octets LS type field 
    whereas 2-octets MBZ and 2-octets LS type field in V3.

 2) 6th argument to proto_tree_add_item() has to be boolean value.

Regards,

=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=
 +----+----+     
 |.. .|    |     Motonori Shindo
 |_~__|    |     
 | .. |~~_~|     Sr. Systems Engineer
 | .  |    |     CoSine Communications Inc.
 +----+----+     
 C o S i n e     e-mail:  mshindo@xxxxxxxxxxxxx 
Communications
=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=

Index: packet-ospf.c
===================================================================
RCS file: /cvsroot/ethereal/packet-ospf.c,v
retrieving revision 1.64
diff -u -r1.64 packet-ospf.c
--- packet-ospf.c	2002/05/11 22:22:11	1.64
+++ packet-ospf.c	2002/05/13 16:28:49
@@ -800,19 +800,17 @@
 				 "Link State Request"); 
 	ospf_lsr_tree = proto_item_add_subtree(ti, ett_ospf_lsr);
       
-        reserved = tvb_get_guint8(tvb, offset);
-        proto_tree_add_text(ospf_lsr_tree, tvb, offset, 1,
-           (reserved == 0 ? "Reserved: %u" : "Reserved: %u (incorrect, should be 0)"),
-				reserved);
-
         switch ( version ) {
 
     	    case OSPF_VERSION_2:
  	        ls_type = tvb_get_ntohl(tvb, offset);
   	        proto_tree_add_item(ospf_lsr_tree, ospf_filter[OSPFF_LS_TYPE], 
-				    tvb, offset, 4, ls_type);
+				    tvb, offset, 4, FALSE);
 	        break;
     	    case OSPF_VERSION_3:
+ 	        reserved = tvb_get_ntohs(tvb, offset);
+ 	        proto_tree_add_text(ospf_lsr_tree, tvb, offset, 2,
+ 	            (reserved == 0 ? "Reserved: %u" :  "Reserved: %u (incorrect, should be 0)"), reserved);
  	        ls_type = tvb_get_ntohs(tvb, offset+2);
 	        proto_tree_add_text(ospf_lsr_tree, tvb, offset+2, 2, "LS Type: %s (0x%04x)",
 			    val_to_str(ls_type, v3_ls_type_vals, "Unknown"),
@@ -1205,7 +1203,7 @@
 			tvb_get_ntohs(tvb, offset));
     dissect_ospf_options(tvb, offset + 2, ospf_lsa_tree, OSPF_VERSION_2);
     proto_tree_add_item(ospf_lsa_tree, ospf_filter[OSPFF_LS_TYPE], tvb, 
-			offset + 3, 1, ls_type); 
+			offset + 3, 1, FALSE); 
     proto_tree_add_item_hidden(ospf_lsa_tree, 
 			       ospf_filter[ospf_ls_type_to_filter(ls_type)], tvb, 
 			       offset + 3, 1, FALSE); 
This message has been 'sanitized'.  This means that potentially
dangerous content has been rewritten or removed.  The following
log describes which actions were taken.

Sanitizer (start="1021310400"):
  Replaced MIME boundary: >>--Next_Part--<<
                    with: >>MIMEStream=_0+504_0324244480582460_38613429712<<
  Writer (pos="1213"):
    Total modifications so far: 1

  Part (pos="1259"):
    SanitizeFile (filename="unnamed.txt", mimetype="Text/Plain"):
      Match (rule="2"):
        Enforced policy: accept

  Part (pos="2009"):
    SanitizeFile (filename="ospf.diff", mimetype="Text/Plain"):
      Match (rule="2"):
        Enforced policy: accept


Anomy 0.0.0 : Sanitizer.pm
$Id: Sanitizer.pm,v 1.54 2002/02/15 16:59:07 bre Exp $