aboutsummaryrefslogtreecommitdiffstats
path: root/tshark.c
AgeCommit message (Collapse)AuthorFilesLines
2021-03-15Remove unnecessary inclues of wiretap/pcapng.h.Guy Harris1-1/+0
2021-03-15tap_export_pdu: finish the job of reporting errors.Guy Harris1-1/+1
Provide the pathname of the file, and the frame number, to the error routines.
2021-03-15Add more error-reporting routines that call through a function pointer.Guy Harris1-56/+28
Have routines to report capture-file errors, using libwireshark error codes and strings, that call through a pointer, so they can pop up dialogs in GUI apps, print a message to the standard error on command-line apps, and possibly do something different on server programs. Have init_report_message() take a pointer to structure containing those function pointers, rather than the function pointers themselves, as arguments. Make other API changes to make that work.
2021-03-14tshark, export_pdu: Allow tshark to export PDUs to other file typesJohn Thacker1-6/+4
The export PDU API now allows writing to a different file type. tshark already has a -F flag for the output file type. If that option is given, respect it for export PDU. Also, rec.rec_header.packet_header.pkt_encap expects WTAP encapsulation types, not PCAP encapsulation types, so don't call wtap_wtap_encap_to_pcap_encap(), or else it won't actually write to pcap files, only pcapng (using the wrong sort of encap numbers eventually leads to WTAP_ENCAP_PER_PACKET, which we don't write to non-pcapng.)
2021-03-13tshark: clean u the way the -U option lists available taps.Guy Harris1-9/+13
Allow "-U ?" as well as an empty argument; an empty argument is a bit counterintuitive. Simplify the introductory line of output - asking for a list of taps isn't an error in which the user failed to supply a tap name, it's a case where the user suplied a request for a list of tap names. Just use fprintf() to print the list, and indent the elements of the list, as we do with other lists of valid arguments. List the valid arguments if the user specified an invalid argument as well.
2021-03-13tshark: fix handling of "you're writing to a closed pipe" errors on Windows.Guy Harris1-17/+53
On Windows, a write to a pipe where the read side has been closed apparently may return the Windows error ERROR_BROKEN_PIPE, which the Visual Studio C library maps to EPIPE, or may return the Windows error ERROR_NO_DATA, which the Visual Studio C library maps to EINVAL. So, on Windows, for errors other than the ones for which we're reporting a special error message, check for EINVAL with a *Windows* error of ERROR_NO_DATA and, if that's what we have, don't print an error message; otherwise, print an error message that reports a message based on the Windows error (rather than a relatively uninformative "Invalid argument" error). This should fix issue #16192. Clean up indentation while we're at it.
2021-03-06if_capabilities: Use a structured error msg from dumpcapJoão Valverde1-3/+5
Have dumpcap in child mode return an error message with a primary and secondary string, instead of using stderr. When writing to the console log we ignore the second message to prevent flooding the log with tutorial-like info on permissions.
2021-02-23wiretap: eliminate the pcap/nspcap/pcapng WTAP_FILE_TYPE_SUBTYPE_ values.Guy Harris1-8/+20
Register the pcap and pcapng file types/subtypes rather than hardwiring them into the table. Call the registration routines for them directly, rather than through a generated table; they're always supposed to be there, as some code in Wireshark either writes only one of those formats or defaults to writing one of those formats. Don't run their source code through the registration-routine-finder script. Have the file type/subtype codes for them be directly exported to the libwiretap core, and provide routines to return each of them, to be used by the aforementioned code. When reporting errors with cfile_write_failure_message(), use wtap_dump_file_type_subtype() to get the file type/subtype value for the wtap_dumper to which we're writing, rather than hardcoding it. Have the "export PDU" code capable of supporting arbitrary file types/subtypes, although we currently only use pcapng. Get rid of declarations of now-static can_write_encap and dump_open routines in various headers.
2021-02-21wiretap: have file handlers advertise blocks and options supported.Guy Harris1-3/+6
Instead of a "supports name resolution" Boolean and bitflags for types of comments supported, provide a list of block types that the file type/subtype supports, with each block type having a list of options supported. Indicate whether "supported" means "one instance" or "multiple instances". "Supports" doesn't just mean "can be written", it also means "could be read". Rename WTAP_BLOCK_IF_DESCRIPTION to WTAP_BLOCK_IF_ID_AND_INFO, to indicate that it provides, in addition to information about the interface, an ID (implicitly, in pcapng files, by its ordinal number) that is associated with every packet in the file. Emphasize that in comments - just because your capture file format can list the interfaces on which a capture was done, that doesn't mean it supports this; it doesn't do so if the file doesn't indicate, for every packet, on which of those interfaces it was captured (I'm looking at *you*, Microsoft Network Monitor...). Use APIs to query that information to do what the "does this file type/subtype support name resolution information", "does this file type/subtype support all of these comment types", and "does this file type/subtype support - and require - interface IDs" APIs did. Provide backwards compatibility for Lua. This allows us to eliminate the WTAP_FILE_TYPE_SUBTYPE_ values for IBM's iptrace; do so.
2021-02-19wiretap: eliminate two WTAP_FILE_TYPE_SUBTYPE_ values.Guy Harris1-0/+5
Eliminate WTAP_FILE_TYPE_SUBTYPE_ERF and WTAP_FILE_TYPE_SUBTYPE_SYSTEMD_JOURNAL - instead, fetch the values by name, using wtap_name_to_file_type_subtype(). This requires that wtap_init() be called before epan_init(); that's currently the case, but put in comments to indicate why it must continue to be the case.
2021-02-17wiretap: more work on file type/subtypes.Guy Harris1-24/+22
Provide a wiretap routine to get an array of all savable file type/subtypes, sorted with pcap and pcapng at the top, followed by the other types, sorted either by the name or the description. Use that routine to list options for the -F flag for various commands Rename wtap_get_savable_file_types_subtypes() to wtap_get_savable_file_types_subtypes_for_file(), to indicate that it provides an array of all file type/subtypes in which a given file can be saved. Have it sort all types, other than the default type/subtype and, if there is one, the "other" type (both of which are put at the top), by the name or the description. Don't allow wtap_register_file_type_subtypes() to override any existing registrations; have them always register a new type. In that routine, if there are any emply slots in the table, due to an entry being unregistered, use it rather than allocating a new slot. Don't allow unregistration of built-in types. Rename the "dump open table" to the "file type/subtype table", as it has entries for all types/subtypes, even if we can't write them. Initialize that table in a routine that pre-allocates the GArray before filling it with built-in types/subtypes, so it doesn't keep getting reallocated. Get rid of wtap_num_file_types_subtypes - it's just a copy of the size of the GArray. Don't have wtap_file_type_subtype_description() crash if handed an file type/subtype that isn't a valid array index - just return NULL, as we do with wtap_file_type_subtype_name(). In wtap_name_to_file_type_subtype(), don't use WTAP_FILE_TYPE_SUBTYPE_ names for the backwards-compatibility names - map those names to the current names, and then look them up. This reduces the number of uses of hardwired WTAP_FILE_TYPE_SUBTYPE_ values. Clean up the type of wtap_module_count - it has no need to be a gulong. Have built-in wiretap file handlers register names to be used for their file type/subtypes, rather than building the table in init.lua. Add a new Lua C function get_wtap_filetypes() to construct the wtap_filetypes table, based on the registered names, and use it in init.lua. Add a #define WSLUA_INTERNAL_FUNCTION to register functions intended only for internal use in init.lua, so they can be made available from Lua without being documented. Get rid of WTAP_NUM_FILE_TYPES_SUBTYPES - most code has no need to use it, as it can just request arrays of types, and the space of type/subtype codes can be sparse due to registration in any case, so code has to be careful using it. wtap_get_num_file_types_subtypes() is no longer used, so remove it. It returns the number of elements in the file type/subtype array, which is not necessarily the name of known file type/subtypes, as there may have been some deregistered types, and those types do *not* get removed from the array, they just get cleared so that they're available for future allocation (we don't want the indices of any registered types to changes if another type is deregistered, as those indicates are the type/subtype values, so we can't shrink the array). Clean up white space and remove some comments that shouldn't have been added.
2021-02-14Enable -Wredundant-decls.Guy Harris1-5/+10
Add it to the default list of checks, and fix some errors it causes. (Sadly, it doesn't work in CLang.)
2021-02-13wiretap: file types have a name and a description.Guy Harris1-4/+4
The "short name" is really just the name, used to look it up. The "name" is really a description intended solely for human consumption. Rename the fields, and the functions that access them, to match. The "description" maintained by Lua for file type handlers is used *only* for one debugging message; we should probably just eliminate it. Call it an "internal description" for now.
2021-02-11TShark: Load extcap preferences only when needed.Gerald Combs1-3/+31
In our first pass through our options, look for ones that might require extcap. Call extcap_register_preferences() only when that's the case. Warn about missing extcap preferences only when we've loaded them.
2021-01-30epan: have a routine to register all tap listeners.Guy Harris1-10/+3
Pull the code to register plugin taps, and the loop to register built-in taps, into a single register_all_tap_listeners() routine. This leaves it up to libwireshark, not to the programs using it, to know how to register them.
2021-01-23tshark: Fix typo in comment from ascci to asciiJim Young1-1/+1
2021-01-24tshark: Unconditionally call extcap_register_preferencesEnrique Giraldo1-1/+1
extcap_register_preferences is only called with the -G option (to dump information) and extcap preferences are not loading, loading it unconditionally avoids this, as it is done in the GUI startup.
2021-01-21tshark: prevent multiple -T.Dario Lombardo1-6/+20
Subsequent use of -T option infere to each other creating strange option combinations. Multiple -T are not supported, then prevent them. Fix: #17139.
2020-12-23Replace more g_malloc with g_newMoshe Kaplan1-1/+1
Replace g_malloc with g_new to improve source code readability.
2020-11-23tshark: set cf values when quiet and tempfileUli Heilmeier1-1/+5
When there is no do_dissection cf is missing some variables for cf_close() call. Therefore we have to set them explicitly. Fixes: wireshark/wireshark#17021
2020-10-30add support for compression of capture fileMasaru Tsuchiyama1-0/+1
2020-10-25Revert "Apparently, WS_WIKI_URL() is unworkable not only in C++ but in C."Guy Harris1-2/+2
This reverts commit 5df29254347daab8ab9f530a0b9dfd0b32a40efc. The problem only showed up in tfshark.c, and was caused by tfshark.c using stuff from ui/urls.h but not *including* ui/urls.h.
2020-10-24Apparently, WS_WIKI_URL() is unworkable not only in C++ but in C.Guy Harris1-2/+2
If you use it, GCC 9.3.0 seems to think there's a missing parenthesis somewhere, just as the version of clang++ in my version of Xcode does, even though other versions of GCC don't. I'm clearly missing something obscure about C here; I give up.
2020-10-22editcap, tshark: process IDBs in the middle of input files.Guy Harris1-1/+40
Instead of grabbing the set of IDBs found at open time, have a loop using wtap_get_next_interface_description() to read all unread IDBs run after opening the input file, after reading a packet from the input file, and after getting an EOF on the input file. Add a routine wtap_uses_interface_ids() to check whether the file type and subtype for a dump file uses interface IDs and requires IDBs. If so, in the aforementioned loop, add the IDBs to the dump stream. Add a routine wtap_dump_add_idb() to add IDBs to a dump stream. Have it call a file-format-specific routine to add the IDBs; the only file type that supports it is pcapng, and it 1) writes out the IDB and 2) adds it to the set of IDBs for the stream. Add a wtap_dump_params_init_no_idbs() routine that prevents the IDBs from the input file from being used to initialize the output file; use it in cases where we're using the aforementioned loop to copy over IDBs. Don't require any IDBs to be present when opening a pcapng file for writing; 1) the simplest pcapng file has just an SHB in it, 2) that requirement causes dumps that don't provide IDBs at open time to fail, and 3) the real issue is that we don't want packets with an interface ID not corresponding to a known IDB, and we already have a check for that. (There are some hacks here; eventually, when everything processes the IDBs in such a loop, we may be able to get rid of the "two favors of dump parameter initialization" hack.) Fixes #15844. Addresses the same issue in #15502, but there are other issues there that also need to be addressed. In addition, the merge code also needs to be changed to handle this.
2020-10-14Have WTAP_ERR_INTERNAL include an err_info string giving details.Guy Harris1-12/+17
That way, users won't just see "You got an internal error", the details will be given, so they can report them in a bug.
2020-10-02Clean up URLs.Guy Harris1-2/+3
Add ui/urls.h to define some URLs on various of our websites. Use the GitLab URL for the wiki. Add a macro to generate wiki URLs. Update wiki URLs in comments etc. Use the #defined URL for the docs page in WelcomePage::on_helpLabel_clicked; that removes the last user of topic_online_url(), so get rid of it and swallow it up into topic_action_url().
2020-07-07extcap: Lazily load our interface list.Gerald Combs1-1/+1
Add extcap_ensure_all_interfaces_loaded, which calls extcap_load_interface_list if our interface list is empty. Call it in each of our public functions that require a valid interface list. Clean up the extcap API documentation and note which routines initialize the interface list. In tshark, don't unconditionally call extcap_register_preferences and instead rely on lazy loading. Change-Id: I8493ae5f4d703b0fd767246557d17723bcf207c6 Ping-Bug: 15295 Reviewed-on: https://code.wireshark.org/review/37750 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-07-06Windows: Set our locale to ".UTF-8".Gerald Combs1-3/+10
In each of our executables we were calling "setlocale(LC_ALL, "")" at startup. This told Windows that output was encoded using the current system code page. Unless the code page was 65001 (UTF-8), this was a lie. We write UTF-8 to stdout and stderr, so call "setlocale(LC_ALL, ".UTF-8)" at startup on Windows. This lets the CRT translate our output correctly in more cases. Clarify and expand the OUTPUT section in the tshark man page. Bug: 16649 Change-Id: If93231fe5b332c292946c7f8e5e813e2f543e799 Reviewed-on: https://code.wireshark.org/review/37560 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs <gerald@wireshark.org>
2020-04-08tshark: fix use-after-free while closing a live capture filePeter Wu1-1/+1
wtap_cleanup() clears options which are still in use by the time cf_close calls wtap_close. Be sure to close the capture file first. Bug: 16487 Change-Id: Id9ef1c0321865e9574b69439870a842efb2b209b Fixes: v3.3.0rc0-853-g3662a69036 ("Maintain cf->state, because file cleanup depends on it.") Reviewed-on: https://code.wireshark.org/review/36755 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Guy Harris <gharris@sonic.net>
2020-04-06CMake: remove ENABLE_PCAP_NG_DEFAULT optionPeter Wu1-12/+0
pcapng has been the compile-time default since 2011. If there are any users who would like to use the libpcap format, then they should use runtime options instead (e.g. `tshark -P` or `editcap -F pcap`). Change-Id: I54b70368cdc3ca78bc8617bc488cc687740a1eb9 Reviewed-on: https://code.wireshark.org/review/36721 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <gharris@sonic.net>
2020-03-25Have callback function pointers in a capture_session structure.Guy Harris1-9/+24
Instead of having programs that use the capchild library define functions with known names, with the library routines calling back routines with those names, have function pointers for those callbacks in the capture_session structure, and have capture_session_init() set them. Make the callback routines in TShark and in the ui library static. Change-Id: Ia1ba6119c5ef7708e0f87b8420f200136ba41eae Reviewed-on: https://code.wireshark.org/review/36583 Petri-Dish: Guy Harris <gharris@sonic.net> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <gharris@sonic.net>
2020-03-25Maintain cf->state, because file cleanup depends on it.Guy Harris1-15/+22
If we're capturing to multiple files, whenever we are told about a new file, we must close the old file, so we don't leak file descriptors and wtap structures. Have cf_close() handle the work of closing, the way it does in file.c, and, when we *open* a file, set the state in capture_file to FILE_READ_IN_PROGRESS. Bug: 16457 Change-Id: I04a01c30571b7e3575dee5e7252a59bb1ee8abbc Reviewed-on: https://code.wireshark.org/review/36580 Petri-Dish: Guy Harris <gharris@sonic.net> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <gharris@sonic.net>
2020-03-13tshark: Fix compilation without libpcap.Gerald Combs1-5/+11
Change-Id: Ie238089cc23d1fefb976060b7d4f424da039712d Reviewed-on: https://code.wireshark.org/review/36394 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
2020-03-13Require at least libpcap 0.8/WinPcap 3.1.Guy Harris1-28/+18
2004 called, they want their libpcap/WinPcap back. RHEL 6 initially shipped with libpcap 1.0; even old Enterprise(TM) versions of OSes ship with something shinier than 0.7.x these days. This lets us get rid of a bunch of #ifdefs and workaround code for missing APIs. Change-Id: I862cb027418b0a0c0f45a26979acea82f93f833b Reviewed-on: https://code.wireshark.org/review/36383 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
2020-01-30tshark: remove unnecessary sys/capability.h includePeter Wu1-4/+0
Since dumpcap was split off tshark, tshark never had the need to use file capabilities. Remove the unused header. Change-Id: I76e9d09599a4276d4be5ba105d7c6e28e9dd96da Reviewed-on: https://code.wireshark.org/review/35984 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2019-12-15Reorganize long option valuesJaap Keuter1-7/+4
For long options, without corresponding short options, to be processed they need to be assigned a value, preferably outside of the range of all possible short options. The code in various places tries to stay clear of these low values, but further coordination is missing, easily leading to issues when option processing code gets extended and/or reorganized. This change introduces a single location from where each catagory of command line long option can derive a base value, which should minimize potential option value collisions. Change-Id: Ic8861a347d0050f74002de3aa1fcfb01202866e5 Reviewed-on: https://code.wireshark.org/review/35459 Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl> Petri-Dish: Jaap Keuter <jaap.keuter@xs4all.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2019-11-30Documentation: update (long) cmd line optionsJaap Keuter1-24/+39
Documentation of the Tshark and dumpcap command line options between help text, manual page and user's guide diverged over time. One aspect of this is the implementation of more long options. This change tries to update all documentation to be complete and in sync again. Change-Id: Ie8bee013df8d209080fcf288072774f18f9ff51f Reviewed-on: https://code.wireshark.org/review/35261 Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl> Petri-Dish: Jaap Keuter <jaap.keuter@xs4all.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann <mmann78@netscape.net>
2019-11-11Don't report EPIPE errors writing out packet information.Guy Harris1-0/+17
EPIPE almost certainly means "the next program after us in the pipeline exited before we were finished writing", so this isn't a real error, it just means we're done. (We don't get SIGPIPE because libwireshark ignores SIGPIPE to avoid getting killed if writing to the MaxMind process gets SIGPIPE because that process died.) Presumably either that program exited deliberately (for example, "head -N" read N lines and printed them), in which case there's no error to report, or it terminated due to an error or a signal, in which case *that's* the error and that error has been reported. (We don't do that for EINVAL, as that's presumably a real error. It shows up on Windows in bug 16192, but what we probably want to do there is to, on Windows, use _doserrno, check for the equivalent Windows errors, and, for the default case, convert _doserrno to the appropriate string, using Windows APIs, and report *that* string; the MS C library converts a whole bunch of Windows errors to EINVAL, thus losing information and making it harder to determine what the real error is. Therefore, I'm just marking this with Ping-Bug, as it's only fixing the problem on UN*Xes.) Change-Id: I94c392f478561e29501facd657487716a5882295 Ping-Bug: 16192 Reviewed-on: https://code.wireshark.org/review/35053 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-09-15Move the last of the routines from capture_info.c into ui/capture.c.Guy Harris1-1/+1
That means the packet-count-during-capture stuff is scattered amongst fewer locations. Move capture_info.h into ui; it's now a header that declares routines whose implementations are GUI-platform-dependent. Change-Id: I475815724a4766f6bc2511e67ebae14865e1a9d1 Reviewed-on: https://code.wireshark.org/review/26249 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann <mmann78@netscape.net>
2019-08-24tshark: Warn on overwriting protocol filterMoshe Kaplan1-0/+6
Change-Id: I41a56cf384cda91fa6ed217f7c292f325ec8c07f Reviewed-on: https://code.wireshark.org/review/34345 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-06-09tshark/tfshark: fix error message.Dario Lombardo1-1/+1
Bug: 15825 Change-Id: Iec8dff38dd89e3947f3fe7053e38101c3ad7b1b2 Reviewed-on: https://code.wireshark.org/review/33523 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann <mmann78@netscape.net>
2019-05-02Move the Winsock initialization and cleanup to wsutil routines.Guy Harris1-16/+12
Those routines exist on both Windows and UN*X, but they don't do anything on UN*X (they could if it were ever necessary). That eliminates some #ifdefs, and also means that the gory details of initializing Winsock, including the Winsock version being requested, are buried in one routine. The initialization routine returns NULL on success and a pointer to a g_malloc()ated error message on failure; report the error to the user, along with a "report this to the Wireshark developers" suggestion. That means including wsutil/socket.h, which obviates the need to include some headers for socket APIs, as it includes them for you. Change-Id: I9327bbf25effbb441e4217edc5354a4d5ab07186 Reviewed-on: https://code.wireshark.org/review/33045 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-05-01Windows: Modernize our WSAStartup usage.Gerald Combs1-1/+1
Make sure we link each application that calls WSAStartup with ws2_32.lib. Pass version 2.2 to WSAStartup. Wikipedia says it was introduced in 1996, so we should be OK. Ping-Bug: 15711 Change-Id: I431839e930e7c646669af7373789640b5180ec28 Reviewed-on: https://code.wireshark.org/review/33033 Petri-Dish: Gerald Combs <gerald@wireshark.org> Reviewed-by: Tomasz Moń <desowin@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs <gerald@wireshark.org>
2019-04-061514 is a better initial Buffer size than 1500.Guy Harris1-4/+4
Ethernet packets without the CRC are 1514 bytes long, not 1500 bytes long; using 1514 bytes will avoid a reallocation for a full-sized Ethernet packet. Change-Id: Ie8da3f13bf3df07e23e4478b7dcf84f06dec6a9d Reviewed-on: https://code.wireshark.org/review/32761 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-04-05Have wtap_read() fill in a wtap_rec and Buffer.Guy Harris1-22/+39
That makes it - and the routines that implement it - work more like the seek-read routine. Change-Id: I0cace2d0e4c9ebfc21ac98fd1af1ec70f60a240d Reviewed-on: https://code.wireshark.org/review/32727 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-04-04Reset the terminal color if we're ^C'ed when reading a capture.Guy Harris1-59/+196
Catch signals/ctrl events when we're reading a capture, and stop reading if we get one of those. When we close a print stream, restore the color as appropriate. Change-Id: I3dd936964560fb3902befe0fd2e961f80437ca72 Ping-Bug: 15659 Reviewed-on: https://code.wireshark.org/review/32716 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-04-04Clean file reading code.Guy Harris1-266/+359
Put the pass 1 of a two-pass read, pass 2 of a two-pass read, and only pass of a one-pass read into separate routines, returning success/read error/write error status codes. This makes the processing a bit cleaner, and makes it easier to have the file-reading code catch signals/control events. Change-Id: I58cd9e4b86f219f3afa2dc61b57f41978fc2f853 Reviewed-on: https://code.wireshark.org/review/32711 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-03-31Don't draw the taps if we never got a capture file.Guy Harris1-1/+6
There's nothing to draw. Maybe we should also avoid it if we didn't get any packets. Change-Id: If76f7909f78e66b7302d0ab2caa284ca36c43bfb Reviewed-on: https://code.wireshark.org/review/32649 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-03-26Print extcap plugins with "tshark -G plugins".Guy Harris1-0/+1
This makes it match the "Plugins" tab of the "About" dialog. While we're at it, use the same code to enumerate extcap plugins in that dialog. Change-Id: I50f402a7ab5d83d46baab070d145558ed8f688f4 Reviewed-on: https://code.wireshark.org/review/32589 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-03-18More constification, to squelch warnings.Guy Harris1-1/+1
capture_input_drops() doesn't, and shouldn't, modify or free or... the interface name, so make the pointer to it a const pointer. Change-Id: Iafc5c5dd9939225b3aeb8a8e36c5bdeecc394e12 Reviewed-on: https://code.wireshark.org/review/32465 Reviewed-by: Guy Harris <guy@alum.mit.edu>