diff options
author | Guy Harris <guy@alum.mit.edu> | 2012-02-16 18:58:40 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2012-02-16 18:58:40 +0000 |
commit | 55001ef1989ef30f1cab74e513193e11a4344d7f (patch) | |
tree | fe72535c08298fbb0d41cb5d6491eb221913dc5e | |
parent | 149f655c58229153e7045ea5a4cb91bf54299b7d (diff) |
With the WTAP_ERR_UNSUPPORTED error, Wiretap supplies a string giving
the details of what in particular is unsupported; report it in TShark
and Wireshark.
Handle WTAP_ERR_RANDOM_OPEN_PIPE in TShark.
Handle WTAP_ERR_COMPRESSION_NOT_SUPPORTED in TShark, and have its error
message in Wireshark not speak of gzip, in case we support compressed
output in other formats in the future.
If we see a second section header block in a pcap-NG file, don't report
it as "the file is corrupted", report it as "the file uses a feature we
don't support", as that's the case - and don't free up the interface
data array, as the file remains open, and Wireshark might still try to
access the packets we were able to read.
svn path=/trunk/; revision=41041
-rw-r--r-- | file.c | 10 | ||||
-rw-r--r-- | tshark.c | 15 | ||||
-rw-r--r-- | wiretap/pcapng.c | 4 |
3 files changed, 25 insertions, 4 deletions
@@ -688,6 +688,14 @@ cf_read(capture_file *cf, gboolean from_save) if any. */ switch (err) { + case WTAP_ERR_UNSUPPORTED: + g_snprintf(errmsg_errno, sizeof(errmsg_errno), + "The capture file contains record data that TShark doesn't support.\n(%s)", + err_info); + g_free(err_info); + errmsg = errmsg_errno; + break; + case WTAP_ERR_UNSUPPORTED_ENCAP: g_snprintf(errmsg_errno, sizeof(errmsg_errno), "The capture file has a packet with a network type that Wireshark doesn't support.\n(%s)", @@ -3996,7 +4004,7 @@ cf_open_failure_alert_box(const char *filename, int err, gchar *err_info, case WTAP_ERR_COMPRESSION_NOT_SUPPORTED: simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, - "Gzip compression not supported by this file type."); + "This file type cannot be written as a compressed file."); break; case WTAP_ERR_DECOMPRESS: @@ -2911,6 +2911,12 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type, #endif switch (err) { + case WTAP_ERR_UNSUPPORTED: + cmdarg_err("The file \"%s\" contains record data that TShark doesn't support.\n(%s)", + cf->filename, err_info); + g_free(err_info); + break; + case WTAP_ERR_UNSUPPORTED_ENCAP: cmdarg_err("The file \"%s\" has a packet with a network type that TShark doesn't support.\n(%s)", cf->filename, err_info); @@ -3617,6 +3623,11 @@ cf_open_error_message(int err, gchar *err_info, gboolean for_writing, errmsg = "The file \"%s\" is a \"special file\" or socket or other non-regular file."; break; + case WTAP_ERR_RANDOM_OPEN_PIPE: + /* Seen only when opening a capture file for reading. */ + errmsg = "The file \"%s\" is a pipe or FIFO; TShark can't read pipe or FIFO files in two-pass mode."; + break; + case WTAP_ERR_FILE_UNKNOWN_FORMAT: /* Seen only when opening a capture file for reading. */ errmsg = "The file \"%s\" isn't a capture file in a format TShark understands."; @@ -3693,6 +3704,10 @@ cf_open_error_message(int err, gchar *err_info, gboolean for_writing, errmsg = "A full header couldn't be written to the file \"%s\"."; break; + case WTAP_ERR_COMPRESSION_NOT_SUPPORTED: + errmsg = "This file type cannot be written as a compressed file."; + break; + case WTAP_ERR_DECOMPRESS: /* Seen only when opening a capture file for reading. */ g_snprintf(errmsg_errno, sizeof(errmsg_errno), diff --git a/wiretap/pcapng.c b/wiretap/pcapng.c index 5a038f66a3..32611c4257 100644 --- a/wiretap/pcapng.c +++ b/wiretap/pcapng.c @@ -587,9 +587,7 @@ pcapng_read_section_header_block(FILE_T fh, gboolean first_block, g_free(option_content); if (pn->interface_data != NULL) { - g_array_free(pn->interface_data, TRUE); - pn->interface_data = NULL; - *err = WTAP_ERR_BAD_FILE; + *err = WTAP_ERR_UNSUPPORTED; *err_info = g_strdup_printf("pcapng: multiple section header blocks not supported."); return 0; } |