aboutsummaryrefslogtreecommitdiffstats
path: root/tshark.c
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2011-06-20 23:31:26 +0000
committerGerald Combs <gerald@wireshark.org>2011-06-20 23:31:26 +0000
commit4d603719d021936bc90c926f449989f0f6695627 (patch)
tree3845500655c387c851d83257bd2befe49e4d0ee5 /tshark.c
parent61915bdfb1f8f36fd312b42b348266a2155ed01a (diff)
Have mergecap, tshark, and editcap write pcap-ng files by default. This
is mainly an attempt to fix the currently-broken "test.sh" step on the XP buildbot. If this causes too many problems we might want to have suite-capture.sh:capture_step_snapshot pass "-P" to dumpcap instead. svn path=/trunk/; revision=37736
Diffstat (limited to 'tshark.c')
-rw-r--r--tshark.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/tshark.c b/tshark.c
index df50bc44f0..6ef57c63f9 100644
--- a/tshark.c
+++ b/tshark.c
@@ -818,7 +818,11 @@ main(int argc, char *argv[])
gboolean capture_option_specified = FALSE;
#endif
gboolean quiet = FALSE;
+#ifdef PCAP_NG_DEFAULT
+ int out_file_type = WTAP_FILE_PCAPNG;
+#else
int out_file_type = WTAP_FILE_PCAP;
+#endif
gboolean out_file_name_res = FALSE;
gchar *cf_name = NULL, *rfilter = NULL;
#ifdef HAVE_PCAP_OPEN_DEAD
@@ -1525,8 +1529,8 @@ main(int argc, char *argv[])
if (global_capture_opts.saving_to_file) {
/* They specified a "-w" flag, so we'll be saving to a capture file. */
- /* When capturing, we only support writing libpcap format. */
- if (out_file_type != WTAP_FILE_PCAP) {
+ /* When capturing, we only support writing pcap or pcap-ng format. */
+ if (out_file_type != WTAP_FILE_PCAP && out_file_type != WTAP_FILE_PCAPNG) {
cmdarg_err("Live captures can only be saved in libpcap format.");
return 1;
}
@@ -2621,7 +2625,11 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type,
gboolean filtering_tap_listeners;
guint tap_flags;
+#ifdef PCAP_NG_DEFAULT
+ linktype = WTAP_ENCAP_PER_PACKET;
+#else
linktype = wtap_file_encap(cf->wth);
+#endif
if (save_file != NULL) {
/* Get a string that describes what we're writing to */
save_file_string = output_file_description(save_file);
@@ -2646,7 +2654,7 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type,
case WTAP_ERR_UNSUPPORTED_ENCAP:
case WTAP_ERR_ENCAP_PER_PACKET_UNSUPPORTED:
cmdarg_err("The capture file being read can't be written in "
- "that format.");
+ "the format \"%s\".", wtap_encap_short_string(linktype));
break;
case WTAP_ERR_CANT_OPEN: