diff options
author | Guy Harris <guy@alum.mit.edu> | 2018-02-19 13:06:16 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2018-02-19 21:06:58 +0000 |
commit | cf2a29f0838699e16d273b50bde02fa9c33795d5 (patch) | |
tree | 7dd5b91f40811b33f73008957669d3049cc3b862 /tshark.c | |
parent | e2d5c537df39f35628c25e148f2a9238b74e1a45 (diff) |
Check whether to do dissection after starting taps.
One reason to do dissection is if a tap requires it, so we have to check
after starting the taps.
Change-Id: Ic7910449c3f85df2a52065e789986d970d13c253
Reviewed-on: https://code.wireshark.org/review/25904
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'tshark.c')
-rw-r--r-- | tshark.c | 42 |
1 files changed, 29 insertions, 13 deletions
@@ -645,6 +645,25 @@ about_folders(void) } +static gboolean +must_do_dissection(dfilter_t *rfcode, dfilter_t *dfcode, + gchar *volatile pdu_export_arg) +{ + /* We have to dissect each packet if: + + we're printing information about each packet; + + we're using a read filter on the packets; + + we're using a display filter on the packets; + + we're exporting PDUs; + + we're using any taps that need dissection. */ + return print_packet_info || rfcode || dfcode || pdu_export_arg || + tap_listeners_require_dissection() || dissect_color; +} + int main(int argc, char *argv[]) { @@ -1980,19 +1999,6 @@ main(int argc, char *argv[]) } } - /* We have to dissect each packet if: - - we're printing information about each packet; - - we're using a read filter on the packets; - - we're using a display filter on the packets; - - we're exporting PDUs; - - we're using any taps that need dissection. */ - do_dissection = print_packet_info || rfcode || dfcode || pdu_export_arg || - tap_listeners_require_dissection() || dissect_color; tshark_debug("tshark: do_dissection = %s", do_dissection ? "TRUE" : "FALSE"); if (cf_name) { @@ -2015,6 +2021,11 @@ main(int argc, char *argv[]) filter. */ start_requested_stats(); + /* Do we need to do dissection of packets? That depends on, among + other things, what taps are listening, so determine that after + starting the statistics taps. */ + do_dissection = must_do_dissection(rfcode, dfcode, pdu_export_arg); + /* Process the packets in the file */ tshark_debug("tshark: invoking process_cap_file() to process the packets"); TRY { @@ -2161,6 +2172,11 @@ main(int argc, char *argv[]) filter. */ start_requested_stats(); + /* Do we need to do dissection of packets? That depends on, among + other things, what taps are listening, so determine that after + starting the statistics taps. */ + do_dissection = must_do_dissection(rfcode, dfcode, pdu_export_arg); + /* * XXX - this returns FALSE if an error occurred, but it also * returns FALSE if the capture stops because a time limit |