Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: Re: [Wireshark-dev] tshark option for reassembled fragment output

From: Jeff Morriss <jeff.morriss.ws@xxxxxxxxx>
Date: Fri, 08 Mar 2013 18:20:12 -0500
Sorry, I've been lazy about catching up on this long thread.

Christopher Maynard wrote:
I think there is a difference between displaying the packets matching the filter
and saving the packets matching the filter to another pcap file.  In the former
case, Wireshark does not display packets that don't match the display filter; I
think tshark should behave the same way.

Yes, an important point.

Only when you save packets off to another pcap file do the dependencies also get
saved using Wireshark.  That's what I think tshark should do here as well.

And currently Wireshark does not allow you *NOT* to save those dependencies -
From Jeff's commit message, "Also, this behavior is always the case: you can't
save the displayed packets without their dependencies (I don't see why this
would be desirable)."  So, tshark might as well act similarly.  I suggest
dispensing with the -Y option and just save all packet dependencies when using
the -2 and -w <outfile> options.  Displaying packets should not change.

Note that someone did find a use case for not saving those dependencies: for when Wireshark got the dependencies wrong (due to, in that case, packet duplication):

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7667


Other random thoughts based on what I've read in this thread:

Read filters used to be (most?) commonly used when capturing: want to save only 1/1000th of the traffic and capture filters aren't powerful enough? Use a Read filter. But that's been broken for a long time though (since PrivSep came in; see bug 2234). See the recent question about that on -users too.


I agree tshark should try to be consistent with itself rather than trying to fake consistency with the GUI. We've had a lot of questions over the years about why tshark is different and usually the "it's doing one pass" logic explains it easily enough. (Honestly I've viewed tshark's 2-pass mode as an interesting experiment: I think it was thrown in as an experiment and only added to the documentation for completeness--completeness which was probably premature given the state of the code.)


Don't forget that tshark is limited to 1 pass when it's reading from a pipe (which is a common use case); making 2-pass the default would probably annoy a lot of users who do that.