diff options
author | Guy Harris <guy@alum.mit.edu> | 2018-02-18 12:39:34 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2018-02-18 20:40:47 +0000 |
commit | 22dc113852fb512f81c68ae1eb6914f27f616f12 (patch) | |
tree | 8ac452c3072b28c7a16d31f6950f8eb95b0943bc /tshark.c | |
parent | d9d6106044065ed748748ba2135a9ac3cd6c5108 (diff) |
Don't start command-line taps until we've opened a file or started capturing.
We shouldn't do so until we have something on which to compute
statistics and until we're in file scope, as the taps may use
file-scoped memory, given that statistics pertain to a file.
Change-Id: Ifb568480a3cbbd4dc891015b3bb42da1511ca514
Reviewed-on: https://code.wireshark.org/review/25887
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'tshark.c')
-rw-r--r-- | tshark.c | 24 |
1 files changed, 19 insertions, 5 deletions
@@ -1780,11 +1780,6 @@ main(int argc, char *argv[]) line that their preferences have changed. */ prefs_apply_all(); - /* At this point MATE will have registered its field array so we can - have a tap filter with one of MATE's late-registered fields as part - of the filter. We can now process all the "-z" arguments. */ - start_requested_stats(); - /* We can also enable specified taps for export object */ start_exportobjects(); @@ -2012,6 +2007,14 @@ main(int argc, char *argv[]) goto clean_exit; } + /* Start statistics taps; we do so after successfully opening the + capture file, so we know we have something to compute stats + on, and after registering all dissectors, so that MATE will + have registered its field array so we can have a tap filter + with one of MATE's late-registered fields as part of the + filter. */ + start_requested_stats(); + /* Process the packets in the file */ tshark_debug("tshark: invoking process_cap_file() to process the packets"); TRY { @@ -2147,6 +2150,17 @@ main(int argc, char *argv[]) } tshark_debug("tshark: performing live capture"); + + /* Start statistics taps; we should only do so after the capture + started successfully, so we know we have something to compute + stats, but we currently don't check for that - see below. + + We do so after registering all dissectors, so that MATE will + have registered its field array so we can have a tap filter + with one of MATE's late-registered fields as part of the + filter. */ + start_requested_stats(); + /* * XXX - this returns FALSE if an error occurred, but it also * returns FALSE if the capture stops because a time limit |