Wireshark-dev: [Wireshark-dev] Patch to conversation.c

Date Prev · Date Next · Thread Prev · Thread Next
From: "Peter Johansson" <Peter.Johansson@xxxxxxxxxxxx>
Date: Mon, 31 Jul 2006 17:51:21 +0200 (CEST)
Hi,

the supplied patch fixes a problem where the options value should really
be used from the conversation found (using
conversation_lookup_hashtable(...) to create a new conversation based on
the already stored conversation template (the CONVERSATION_TEMPLATE bit is
set in the stored conversation) rather from the options argument passed to
the function(s).

This solves a problem that otherwise shows itself where
"DISSECTOR_ASSERT(!(conv->options & CONVERSATION_TEMPLATE) && "Use the
conversation_create_from_template function when the CONVERSATION_TEMPLATE
bit is set in the options mask");" fails sometimes.

/ Regards, Peter
Index: C:/wireshark-win32-libs/epan/conversation.c
===================================================================
--- C:/wireshark-win32-libs/epan/conversation.c	(revision 18807)
+++ C:/wireshark-win32-libs/epan/conversation.c	(working copy)
@@ -790,9 +790,9 @@
           * don't get packets in a given direction coming from more than one
           * address, unless the CONVERSATION_TEMPLATE option is set.)
           */
-         if (!(options & NO_ADDR_B) && ptype != PT_UDP)
+         if (!(conversation->options & NO_ADDR_B) && ptype != PT_UDP)
          {
-            if(!(options & CONVERSATION_TEMPLATE))
+            if(!(conversation->options & CONVERSATION_TEMPLATE))
             {
                conversation_set_addr2(conversation, addr_b);
             }
@@ -829,7 +829,7 @@
              * conversation.
              */
             if (ptype != PT_UDP) {
-               if(!(options & CONVERSATION_TEMPLATE))
+               if(!(conversation->options & CONVERSATION_TEMPLATE))
                {
                   conversation_set_addr2(conversation, addr_a);
                }
@@ -881,9 +881,9 @@
           * get packets in a given direction coming from more than one port,
           * unless the CONVERSATION_TEMPLATE option is set.)
           */
-         if (!(options & NO_PORT_B) && ptype != PT_UDP)
+         if (!(conversation->options & NO_PORT_B) && ptype != PT_UDP)
          {
-            if(!(options & CONVERSATION_TEMPLATE))
+            if(!(conversation->options & CONVERSATION_TEMPLATE))
             {
                conversation_set_port2(conversation, port_b);
             }
@@ -921,7 +921,7 @@
              */
             if (ptype != PT_UDP)
             {
-               if(!(options & CONVERSATION_TEMPLATE))
+               if(!(conversation->options & CONVERSATION_TEMPLATE))
                {
                   conversation_set_port2(conversation, port_a);
                }
@@ -963,11 +963,11 @@
        */
       if (ptype != PT_UDP)
       {
-         if(!(options & CONVERSATION_TEMPLATE))
+         if(!(conversation->options & CONVERSATION_TEMPLATE))
          {
-            if (!(options & NO_ADDR_B))
+            if (!(conversation->options & NO_ADDR_B))
                conversation_set_addr2(conversation, addr_b);
-            if (!(options & NO_PORT_B))
+            if (!(conversation->options & NO_PORT_B))
                conversation_set_port2(conversation, port_b);
          }
          else