Ethereal-dev: Re: [Ethereal-dev] packet-giop.c enhancements: ServiceContexts, RTCORBA prioriti

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

From: Craig Rodrigues <rodrigc@xxxxxxxxx>
Date: Thu, 13 Feb 2003 12:07:46 -0500
On Thu, Feb 13, 2003 at 10:38:44AM +0100, Bernd Becker wrote:
> Hi Craig,
> 
> your patch works fine with the GIOP captures I have tried (Visibroker 
> traffic mainly).
> 
> A couple of changes though (mainly errors that were there before your 
> patch):
> 
> - correct bitmask for hf_giop_iop_vscid and  hf_giop_iop_scid, reflecting 
> the change
>  to a 24bit vendor id and 8 bit service id
> - set the length of the "Service Context List" tree correctly after 
> dissecting. The
>  length was just being set to the end of the tvb
> - do not exit the loop through the Service Context List with return if the 
> sequence length
>  is 0, continue the loop instead. This should fix a problem reported by 
> Mika Korpela.
>  (see   http://www.ethereal.com/lists/ethereal-dev/200205/msg00234.html )
>  I never really tested this though, because I don't have a capture with a 
> Service Context
>  List with more than one element.


Thanks for raising these issues.  I believe the attached patch
addresses all of them.


-- 
Craig Rodrigues        
http://home.attbi.com/~rodrigc
rodrigc@xxxxxxxxx
Index: packet-giop.c
===================================================================
RCS file: /cvsroot/ethereal/packet-giop.c,v
retrieving revision 1.66
diff -u -u -r1.66 packet-giop.c
--- packet-giop.c	13 Feb 2003 01:23:35 -0000	1.66
+++ packet-giop.c	13 Feb 2003 17:05:05 -0000
@@ -4185,13 +4185,13 @@
 
     { &hf_giop_iop_vscid,
      { "VSCID", "giop.iiop.vscid",
-       FT_UINT32, BASE_HEX, NULL, 0xfffff000, "", HFILL }
+       FT_UINT32, BASE_HEX, NULL, 0xffffff00, "", HFILL }
     }
     ,
 
     { &hf_giop_iop_scid,
      { "SCID", "giop.iiop.scid",
-       FT_UINT32, BASE_HEX, NULL, 0x00000fff, "", HFILL }
+       FT_UINT32, BASE_HEX, NULL, 0x000000ff, "", HFILL }
     }
     ,
 
@@ -4732,14 +4732,14 @@
 
   /* create a subtree */
 
+  seqlen = get_CDR_ulong(tvb,offset,stream_is_be,boundary);
   if (ptree) {
-    tf = proto_tree_add_text (ptree, tvb, *offset, -1, "ServiceContextList");
+    tf = proto_tree_add_text (ptree, tvb, *offset - sizeof(seqlen), sizeof(seqlen), "ServiceContextList");
     tree = proto_item_add_subtree (tf, ett_giop_scl);
   }
 
   /* Get sequence length (number of elements) */
 
-  seqlen = get_CDR_ulong(tvb,offset,stream_is_be,boundary);
   if (tree) {
     proto_tree_add_uint(tree,hf_giop_sequence_length,tvb,
 			*offset-sizeof(seqlen),4,seqlen);
@@ -4755,7 +4755,7 @@
   for (i=0; i<seqlen; i++) {
 
     context_id = get_CDR_ulong(tvb,offset,stream_is_be,boundary);
-    vscid = context_id & 0xffffff00; /* vendor info, top 24 bits */
+    vscid = (context_id & 0xffffff00) >> 8; /* vendor info, top 24 bits */
     scid = context_id  & 0x000000ff; /* standard service info, lower 8 bits */
     service_context_name = match_strval(scid, service_context_ids);
 
@@ -4773,21 +4773,22 @@
     if( vscid != 0 || scid > max_service_context_id ) {
         decode_UnknownServiceContext(tvb, tree, offset, stream_is_be, boundary,
 	                             vscid, scid); 
-        return;
-    }
-
-    if (tree) {
-      tf_st1 = proto_tree_add_text (tree, tvb, *offset, -1, service_context_name);
-      sub_tree1 = proto_item_add_subtree (tf_st1, ett_giop_scl_st1);
+        continue;
     }
 
+    temp_offset = *offset;
     /* get sequence length, new endianness and boundary for encapsulation */
     seqlen_cd = get_CDR_encap_info(tvb, sub_tree1, offset,
 			       stream_is_be, boundary,
 			       &encapsulation_is_be , &encapsulation_boundary);
 
+    if (tree) {
+      tf_st1 = proto_tree_add_text (tree, tvb, temp_offset, sizeof(seqlen_cd) + seqlen_cd , service_context_name);
+      sub_tree1 = proto_item_add_subtree (tf_st1, ett_giop_scl_st1);
+    }
+
     if (seqlen_cd == 0)
-        return;
+        continue;
 
     /* See CORBA 3.0.2 standard, section Section 15.3.3 "Encapsulation",
      * for how CDR types can be marshalled into a sequence<octet>.