Ethereal-dev: Re: [Ethereal-dev] Problem with pinfo->cinfo in dissector

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

From: Guy Harris <gharris@xxxxxxxxx>
Date: Fri, 22 Oct 2004 10:39:08 -0700
Alan wrote:

The cinfo element of the packet_info structure appears to be getting set to null after initial col_add_str to COL_INFO calls. I can't do any
further col_append_str as check_col always returns false.

I.e., during a *single* call to your dissector, the value of pinfo->cinfo *changes* to null? If so, that shouldn't be happening and, as far as I know, that doesn't happen.

I must add this is my first attempt at writing a dissector, I gather the dissector will be called multiple times/multiple passes? It would appear that everything is ok on the first pass as the initial string put into the info column does get set it's adding to it subsequently that is the problem..

There is *NO* guarantee that, on any pass other than the first pass, that pinfo->cinfo will be non-null (and there's no guarantee that, in the future, it will be non-null even on the first pass). You *HAVE* to completely construct the Info column on the first pass, because that's when the Info column's value is put into the packet list.

Note also that there is *NO* guarantee that the "tree" argument to the dissector is non-null on the first pass, which means that *NO* code that sets the column data should be inside

	if (tree != NULL) {
		...
	}

All that code must be *outside* tests for whether "tree" is null.