That matches my code exactly..
the call to the subdissector is inside the 'if (tree)'
brace.
Hmm.. I can fix that easily in RFC1006 but it may be
more tricky in OSISP. I need to process the protocol's
data without adding to the tree.. lots of checks for
tree, I guess..
Thanks / Martin
--- Guy Harris <gharris@xxxxxxxxxxxx> wrote:
> On Mon, Feb 19, 2001 at 03:12:55PM -0600, Jeff
> Foster wrote:
> > From: Martin Thomas
> [mailto:martin_a_thomas@xxxxxxxxx]
> > Sent: Monday, February 19, 2001 3:11 PM
> >
> > > Like this?
> > >
> > > pinfo->current_proto = "RFC1006";
> > > if ( check_col( pinfo->fd, COL_PROTOCOL ) ) {
> > > col_set_str( pinfo->fd, COL_PROTOCOL,
> "RFC1006" );
> > >
> > > I'll take out the check_col and try it again..
> >
> > No. You want the column check.
> >
> > What I mean is something like this..
> >
> > if ( tree) {
> > pinfo->current_proto = "RFC1006";
> > if ( check_col( pinfo->fd, COL_PROTOCOL ) ) {
> > col_set_str( pinfo->fd, COL_PROTOCOL,
> "RFC1006" );
> >
> > In that case you will see your problem.
>
> Actually, as his problem was, as I remember, that
> the Protocol column
> was showing "RFC1006", not that it wasn't showing
> "RFC1006", the
> incorrect code is probably more like the following:
>
> if (tree) {
> new_tvb = tvb_new_subset(tvb, offset, -1, -1);
> dissect_ositp(new_tvb, pinfo, tree);
> }
>
> That code should not be put inside an "if".
>
> Note that, if the code looks like that, this means
> that "offset" must
> *NOT* be modified, prior to that, inside an "if"
> checking "tree":
>
> if (tree) {
> proto_tree_add_item(tree, hf_whatever, tvb,
> offset, FALSE);
> offset += 2;
> }
>
> Instead, the code must do
>
> if (tree)
> proto_tree_add_item(tree, hf_whatever, tvb,
> offset, FALSE);
> offset += 2;
>
> so that "offset" has the correct value regardless of
> whether "tree" is
> set.
>
> See "packet-gre.c" for an example of how to step an
> "offset" variable in
> a non-leaf-node dissector (that being one dissector
> I fixed to call the
> sub-dissector regardless of whether "tree" is null
> or not).
>
> _______________________________________________
> Ethereal-dev mailing list
> Ethereal-dev@xxxxxxxxxxxx
>
http://www.ethereal.com/mailman/listinfo/ethereal-dev
__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35
a year! http://personal.mail.yahoo.com/