Version in question: $Id: conversation.c 11400 2004-07-18 00:24:25Z guy $
The supplied patch solves a problem where a call to find_conversation(...)
(conversation.c) would change a conversation created with options set to
(NO_ADDR2 | NO_PORT2).
I found the problem when I noticed that connections made to an IP address,
port number pair I had created a conversation for did not always get
dissected by my dissector but only by the tcp dissector even though this
worked a few captured frames before.
My dissector detects that a data connection will be established to IP
192.168.169.2, port 2441 (similar to FTP data connections). I therefor add
a conversation with no 2nd address nor 2nd port (NO_ADDR2 | NO_PORT2). The
first new connection made to IP 192.168.169.2, port 2441 is established
from, say, 192.168.169.128, port 1234. When dissecting more frames, the
call to find_conversation from packet-tcp's try_conversation_dissector
will change the conversation <192.168.169.2, 2441, 0, 0> to
<192.168.169.2, 2441, 192.168.169.128, 1234> (why does find_conversation
change a conversation at all, what have I missed?). This means that any
additional connections made to <192.168.169.2, 2441> will not be decoded
by the dissector for which the conversation was initially created since
they will not match the second part of the conversation which has changed
to <192.168.169.128, 1234>.
I believe to have found the source of the problem in conversation.c's
implementation of conversation_set_addr2(...) and
conversation_set_port2(...) (see the attached patch).
Please verify that my changes in conversation.c does not break any changes
to a conversation that really should take place before commiting.
/ Regards, Peter
--- conversation.c.original Sun Jul 18 02:24:26 2004
+++ \ethereal-win32-libs\epan\conversation.c Fri Nov 12 16:22:58 2004
@@ -491,9 +491,9 @@
conversation_set_port2(conversation_t *conv, guint32 port)
{
/*
- * If the port 2 value is not wildcarded, don't set it.
+ * If the port 2 value is wildcarded, don't set it.
*/
- if ((!(conv->options & NO_PORT2)) || (conv->options & NO_PORT2_FORCE))
+ if ((conv->options & NO_PORT2) || (conv->options & NO_PORT2_FORCE))
return;
if (conv->options & NO_ADDR2) {
@@ -522,9 +522,9 @@
conversation_set_addr2(conversation_t *conv, address *addr)
{
/*
- * If the address 2 value is not wildcarded, don't set it.
+ * If the address 2 value is wildcarded, don't set it.
*/
- if (!(conv->options & NO_ADDR2))
+ if (conv->options & NO_ADDR2)
return;
if (conv->options & NO_PORT2) {