diff options
Diffstat (limited to 'wiretap/file_access.c')
-rw-r--r-- | wiretap/file_access.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/wiretap/file_access.c b/wiretap/file_access.c index 54adc1e5d3..795a1ba77e 100644 --- a/wiretap/file_access.c +++ b/wiretap/file_access.c @@ -2291,10 +2291,19 @@ wtap_dump_init_dumper(int file_type_subtype, wtap_compression_type compression_t g_array_append_val(wdh->interface_data, descr); } } - } else { + } else if (params->encap != WTAP_ENCAP_NONE) { int snaplen; - // XXX IDBs should be optional. + // Generate a fake IDB if we don't have one, unless the + // file encapsulation is none. (WTAP_ENCAP_NONE either + // means that there are no interfaces, or they will be + // provided later when reading the file in single-pass mode.) + // + // XXX File types should provide their own IDBs (possibly + // fake ones generated by wtap_add_generated_idb()), in + // order to support being used as inputs for mergecap where + // pcapng is the output. This doesn't work for files with + // WTAP_ENCAP_PER_PACKET. descr = wtap_block_create(WTAP_BLOCK_IF_ID_AND_INFO); descr_mand = (wtapng_if_descr_mandatory_t*)wtap_block_get_mandatory_data(descr); descr_mand->wtap_encap = params->encap; |