diff options
author | Guy Harris <guy@alum.mit.edu> | 2017-04-12 13:52:07 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2017-04-12 23:33:37 +0000 |
commit | 847c25c5a7e7c5653870c4bd60625da1c64c86f1 (patch) | |
tree | 386b51025493bda76c077334293d931eded5afdf /sharkd.c | |
parent | 74f9b279e9888b0449b569a1c474351ccc991d5e (diff) | |
download | wireshark-847c25c5a7e7c5653870c4bd60625da1c64c86f1.tar.gz |
Prime the epan_dissect_t with postdissector wanted fields if necessary.
This makes sure that postdissectors that indicate that they need certain
fields in the first pass will get them.
While we're at it:
Fix the field-fetching code in TRANSUM not to assume it got any
instances of the field being fetched.
Rename process_packet_first_pass() in sharkd to process_packet(), as
it's the only routine in sharkd that processes packets.
Rename process_packet() in tshark and tfshark to
process_packet_single_pass(), as it's what's used if we're only doing
one-pass analysis.
Clean up comments and whitespace.
Change-Id: I3769af952c66f5ca4b68002ad6213858ab9cab9b
Reviewed-on: https://code.wireshark.org/review/21063
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'sharkd.c')
-rw-r--r-- | sharkd.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -271,7 +271,7 @@ sharkd_epan_new(capture_file *cf) } static gboolean -process_packet_first_pass(capture_file *cf, epan_dissect_t *edt, +process_packet(capture_file *cf, epan_dissect_t *edt, gint64 offset, struct wtap_pkthdr *whdr, const guchar *pd) { @@ -307,6 +307,10 @@ process_packet_first_pass(capture_file *cf, epan_dissect_t *edt, if (cf->dfcode) epan_dissect_prime_with_dfilter(edt, cf->dfcode); + /* This is the first and only pass, so prime the epan_dissect_t + with the fields postdissectors want on the first pass. */ + prime_epan_dissect_with_postdissector_wanted_fields(edt); + frame_data_set_before_dissect(&fdlocal, &cf->elapsed_time, &ref, prev_dis); if (ref == &fdlocal) { @@ -385,7 +389,7 @@ load_cap_file(capture_file *cf, int max_packet_count, gint64 max_byte_count) } while (wtap_read(cf->wth, &err, &err_info, &data_offset)) { - if (process_packet_first_pass(cf, edt, data_offset, wtap_phdr(cf->wth), + if (process_packet(cf, edt, data_offset, wtap_phdr(cf->wth), wtap_buf_ptr(cf->wth))) { /* Stop reading if we have the maximum number of packets; * When the -c option has not been used, max_packet_count |