aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap
diff options
context:
space:
mode:
authorMichal Ruprich <michalruprich@gmail.com>2019-10-23 10:52:00 +0200
committerAnders Broman <a.broman58@gmail.com>2019-10-24 07:06:53 +0000
commit67ebeee25143c4246b23286952ef0d6955511c2c (patch)
tree5c86af34a27937a0b91d503d37076ece445d973a /wiretap
parenteb4e83d5891165ca1f958cf57641200a8cb5a0b4 (diff)
wiretap: no "drop_count" in pcapng format
When using wiretap to create a pcapng file, the drop_count field from the wtap_packet_header in wiretap/wtap.h is not being dumped to the file in pcapng_write_enhanced_packet_block function. Bug: 16062 Change-Id: Id9b8dbd1f7406e019fab00ff7a4167ab27543f62 Reviewed-on: https://code.wireshark.org/review/34836 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'wiretap')
-rw-r--r--wiretap/pcapng.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/wiretap/pcapng.c b/wiretap/pcapng.c
index ce43c098ac..2f1a9ee2fe 100644
--- a/wiretap/pcapng.c
+++ b/wiretap/pcapng.c
@@ -3231,6 +3231,10 @@ pcapng_write_enhanced_packet_block(wtap_dumper *wdh, const wtap_rec *rec,
have_options = TRUE;
options_total_length = options_total_length + 8;
}
+ if (rec->presence_flags & WTAP_HAS_DROP_COUNT) {
+ have_options = TRUE;
+ options_total_length = options_total_length + 12;
+ }
if (have_options) {
/* End-of options tag */
options_total_length += 4;
@@ -3354,6 +3358,17 @@ pcapng_write_enhanced_packet_block(wtap_dumper *wdh, const wtap_rec *rec,
wdh->bytes_dumped += 4;
pcapng_debug("pcapng_write_enhanced_packet_block: Wrote Options packet flags: %x", rec->rec_header.packet_header.pack_flags);
}
+ if (rec->presence_flags & WTAP_HAS_DROP_COUNT) {
+ option_hdr.type = OPT_EPB_DROPCOUNT;
+ option_hdr.value_length = 8;
+ if (!wtap_dump_file_write(wdh, &option_hdr, 4, err))
+ return FALSE;
+ wdh->bytes_dumped += 4;
+ if (!wtap_dump_file_write(wdh, &rec->rec_header.packet_header.drop_count, 8, err))
+ return FALSE;
+ wdh->bytes_dumped += 8;
+ pcapng_debug("pcapng_write_enhanced_packet_block: Wrote Options drop count: %" G_GINT64_MODIFIER "u", rec->rec_header.packet_header.drop_count);
+ }
/* Write end of options if we have options */
if (have_options) {
if (!wtap_dump_file_write(wdh, &zero_pad, 4, err))