As we might use cf->lnk_t while a capture is in progress, we need up

update it after each burst of packets.  (This is broken - we should have
cf->lnk_t be WTAP_ENCAP_PER_PACKET in all capture file formats that can
handle more than one packet type, and, in order to support writing out
*some* such files in formats that can only handle one packet type, just
use the type of the first packet when doing a one-pass operation and
gather up all the packet types in a multi-pass operation.)

svn path=/trunk/; revision=43048
This commit is contained in:
Guy Harris 2012-06-03 23:38:11 +00:00
parent dbfb305368
commit 0b835b8cb6
1 changed files with 6 additions and 4 deletions

10
file.c
View File

@ -838,6 +838,10 @@ cf_continue_tail(capture_file *cf, volatile int to_read, int *err)
to_read--;
}
/* Update the file encapsulation; it might have changed based on the
packets we've read. */
cf->lnk_t = wtap_file_encap(cf->wth);
/* Cleanup and release all dfilter resources */
if (dfcode != NULL){
dfilter_free(dfcode);
@ -956,10 +960,8 @@ cf_finish_tail(capture_file *cf, int *err)
* don't need after the sequential run-through of the packets. */
postseq_cleanup_all_protocols();
/* Set the file encapsulation type now; we don't know what it is until
we've looked at all the packets, as we don't know until then whether
there's more than one type (and thus whether it's
WTAP_ENCAP_PER_PACKET). */
/* Update the file encapsulation; it might have changed based on the
packets we've read. */
cf->lnk_t = wtap_file_encap(cf->wth);
if (*err != 0) {