Ethereal-dev: Re: [ethereal-dev] dup xid in rpc dissector after applying display filter

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

From: Guy Harris <guy@xxxxxxxxxx>
Date: Wed, 17 Nov 1999 14:18:35 -0800 (PST)
> The requirement that "XXX_init_protocol()" calls be added by hand, as
> necessary, is a bit of a botch.  Protocols should, if they need an init
> routine, call a routine to register that init routine, and, in all
> places where init routines should be called, the Ethereal infrastructure
> should call all registered init routines (right now, that's in
> "open_cap_file()" and "colorize_packets()" - yes, "colorize_packets()";
> "filter_packet()" calls it, because most of the code path for colorizing
> and filtering is the same).
> 
> I'll look at implementing that.

Done.

There's now a "register_init_routine()" routine; the register routine
for a protocol should, if that protocol has an "init" routine, call
"register_init_routine()", passing it a pointer to its "init" routine. 
I changed the existing dissectors (AFS, NCP, SMB, and ONC RPC) to do
that.

The routines in the list of routines so registered are now called when a
new capture file is opened *and* when a filtering or colorizing pass
over the packets is about to be done.

In addition, I made the ONC RPC "init" routine zero out the table of RPC
calls, so that it completely erases any state from the previous
dissection pass - it wasn't doing that, and "rpc_call_lookup()" assumes
the list has at least one entry in it, and if there was an entry left
around from the last dissection pass, it'd be found, and possibly cause
a packet to be falsely marked as a duplicate (I saw that a couple of
times when testing my changes).