file: Count OPT_PKT_DROPCOUNT

Add the block option OPT_PKT_DROPCOUNT to cf->drops. This will
show the number of dropped packets in the status bar, and in the
Capture File Properties dialog if the capture does not have a
Interface Statistics Block.
This commit is contained in:
Stig Bjørlykke 2025-06-17 13:07:27 +02:00
parent a0863f4f37
commit 97afd107b7

11
file.c
View File

@ -1324,9 +1324,16 @@ read_record(capture_file *cf, wtap_rec *rec, dfilter_t *dfcode,
fdata = frame_data_sequence_add(cf->provider.frames, &fdlocal);
cf->count++;
if (rec->block != NULL)
if (rec->block != NULL) {
uint64_t dropcount = 0;
cf->packet_comment_count += wtap_block_count_option(rec->block, OPT_COMMENT);
cf->f_datalen = offset + fdlocal.cap_len;
if (wtap_block_get_uint64_option_value(rec->block, OPT_PKT_DROPCOUNT, &dropcount) == WTAP_OPTTYPE_SUCCESS) {
cf->drops_known = true;
cf->drops += (uint32_t)dropcount;
}
}
cf->f_datalen = offset + fdlocal.cap_len;
// Should we check if the frame data is a duplicate, and thus, ignore
// this frame?