From 930d8f763cb3b5580c691981752f3fa536f7e136 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Fri, 18 Jun 2021 15:34:49 -0700 Subject: [PATCH] libpcap: don't generate a fake interface for LINKTYPE_ERF files. The ERF code will generate interfaces based on the ERF records in the file, so don't bother adding an additional dummy interface. (cherry picked from commit d69d1271f08fb4e919447dbfb8a36c2cdfe3e48b) --- wiretap/libpcap.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/wiretap/libpcap.c b/wiretap/libpcap.c index a5ce1303ef..5b7709713f 100644 --- a/wiretap/libpcap.c +++ b/wiretap/libpcap.c @@ -529,25 +529,16 @@ done: if (wth->file_encap == WTAP_ENCAP_ERF) { /*Reset the ERF interface lookup table*/ libpcap->encap_priv = erf_priv_create(); + } else { + /* + * Add an IDB; we don't know how many interfaces were + * involved, so we just say one interface, about which + * we only know the link-layer type, snapshot length, + * and time stamp resolution. + */ + wtap_add_generated_idb(wth); } - /* - * Add an IDB; we don't know how many interfaces were involved, - * so we just say one interface, about which we only know - * the link-layer type, snapshot length, and time stamp - * resolution. - * - * XXX - this will be a bit weird if you're trying to convert - * a LINKTYPE_ERF pcap file to a pcapng file; it'll have a - * placeholder interface added here, *plus* interfaces - * added from the ERF records. Ideally, at some point in - * the future, libpcap will have a more pcapng-friendly API - * for capturing, and the DAG capture code will use it, so that - * if you're capturing on more than one interface, they'll all - * get regular IDBs, with no need for the placeholder. - */ - wtap_add_generated_idb(wth); - return WTAP_OPEN_MINE; }