Ethereal-dev: Re: [Ethereal-dev] Problem with info column change

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

From: "Olivier Biot" <ethereal@xxxxxxxxxx>
Date: Sun, 19 Dec 2004 12:28:19 +0100
I also think this is an if(tree) issue.

Quoting from README.developer:

/* A protocol dissector can be called in 2 different ways:

(a) Operational dissection

 In this mode, Ethereal is only interested in the way protocols
 interact, protocol conversations are created, packets are reassembled
 and handed over to higher-level protocol dissectors.
 This way Ethereal does not build a so-called "protocol tree".

(b) Detailed dissection

 In this mode, Ethereal is also interested in all details of a given
 protocol, so a "protocol tree" is created.

  Ethereal distinguishes between the 2 modes with the proto_tree pointer:
(a) <=> tree == NULL
(b) <=> tree != NULL

  In the interest of speed, if "tree" is NULL, avoid building a
  protocol tree and adding stuff to it, or even looking at any packet
  data needed only if you're building the protocol tree, if possible.

  Note, however, that you must fill in column information, create
  conversations, reassemble packets, build any other persistent state
  needed for dissection, and call subdissectors regardless of whether
  "tree" is NULL or not.  This might be inconvenient to do without
  doing most of the dissection work; the routines for adding items to
  the protocol tree can be passed a null protocol tree pointer, in
  which case they'll return a null item pointer, and
  "proto_item_add_subtree()" returns a null tree pointer if passed a
  null item pointer, so, if you're careful not to dereference any null
  tree or item pointers, you can accomplish this by doing all the
  dissection work.  This might not be as efficient as skipping that
  work if you're not building a protocol tree, but if the code would
  have a lot of tests whether "tree" is null if you skipped that work,
  you might still be better off just doing all that work regardless of
  whether "tree" is null or not. */

Best regards,

Olivier
----- Original Message ----- From: Martin Regner

Joerg Mayer wrote:
I'm trying to add the SSID to the COL_INFO field but for some reason
it is never appended. It looks like the check always returns false,
but this doesen't make sense.

Hints anyone?

My guess is that there is one or more if(tree) check somewhere in the code that makes that add_tagged_field() is never
called during the first phase
of dissecting. If you remove those if(tree) checks it will probably work.

If I remember correct first time the dissector is called in Ethereal check_col(pinfo->cinfo,COL_INFO) is TRUE, but tree
is NULL if there is no display/color filter applied.

http://www.dragoninc.on.ca/mail-archives/ethereal-dev/2002-01/0411.html