aboutsummaryrefslogtreecommitdiffstats
path: root/tshark.c
diff options
context:
space:
mode:
authorMichael Tüxen <tuexen@fh-muenster.de>2012-02-21 17:19:45 +0000
committerMichael Tüxen <tuexen@fh-muenster.de>2012-02-21 17:19:45 +0000
commit2764d9977ba25c6cbbcc47135c42e4a86d5ab401 (patch)
tree6492a44609026eae105fe3fb33011b22a7c32092 /tshark.c
parentacb9414db942b3ca0c584646fbef137e538f3ed4 (diff)
Use wtap_dump_open_ng() in tshark.
svn path=/trunk/; revision=41123
Diffstat (limited to 'tshark.c')
-rw-r--r--tshark.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/tshark.c b/tshark.c
index 08f8956448..3707f08004 100644
--- a/tshark.c
+++ b/tshark.c
@@ -2677,9 +2677,17 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type,
char *save_file_string = NULL;
gboolean filtering_tap_listeners;
guint tap_flags;
+ wtapng_section_t *shb_hdr;
+ wtapng_iface_descriptions_t *idb_inf;
+ shb_hdr = wtap_file_get_shb_info(cf->wth);
+ idb_inf = wtap_file_get_idb_info(cf->wth);
#ifdef PCAP_NG_DEFAULT
- linktype = WTAP_ENCAP_PER_PACKET;
+ if (idb_inf->number_of_interfaces > 0) {
+ linktype = WTAP_ENCAP_PER_PACKET;
+ } else {
+ linktype = wtap_file_encap(cf->wth);
+ }
#else
linktype = wtap_file_encap(cf->wth);
#endif
@@ -2693,16 +2701,8 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type,
/* Snapshot length of input file not known. */
snapshot_length = WTAP_MAX_PACKET_SIZE;
}
- /*
- * XXX
- * As long as we don't use wtap_dump_open_ng(), we can't use
- * WTAP_ENCAP_PER_PACKET since there is no way to write out
- * an IDB.
- * So overwrite the above assignment for now!
- */
- linktype = wtap_file_encap(cf->wth);
- pdh = wtap_dump_open(save_file, out_file_type, linktype, snapshot_length,
- FALSE /* compressed */, &err);
+ pdh = wtap_dump_open_ng(save_file, out_file_type, linktype, snapshot_length,
+ FALSE /* compressed */, shb_hdr, idb_inf, &err);
if (pdh == NULL) {
/* We couldn't set up to write to the capture file. */