aboutsummaryrefslogtreecommitdiffstats
path: root/dumpcap.c
AgeCommit message (Collapse)AuthorFilesLines
2019-03-24Add routines to return "Please report this as a bug" message strings.Guy Harris1-15/+8
(Routines, so that if we internationalize strings not in the Qt code, this can return the appropriately translated version.) Change-Id: I1c169d79acde2f0545af7af2a737883d58f52509 Reviewed-on: https://code.wireshark.org/review/32549 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-03-14dumpcap: Initialize the stats variableVasil Velichkov1-6/+1
This fixes several "Use of uninitialised value" and "Conditional jump or move depends on uninitialised value(s)" errors detected by valgrind. Change-Id: I682bd4a1d2e5ef23969baf34b3e438fcd7499bd5 Reviewed-on: https://code.wireshark.org/review/32397 Reviewed-by: Anders Broman <a.broman58@gmail.com> Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-03-10Dumpcap: Set a bigger IO buffer (64KiB).Anders Broman1-2/+27
Set a bigger IO buffer to avoid syscall overhead. See https://github.com/the-tcpdump-group/libpcap/issues/792 Change-Id: If370da5ab2b70a9d0c925dd7c4c5c135c675c3f6 Reviewed-on: https://code.wireshark.org/review/31326 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-02-08Convert WinPcap references to Npcap.Gerald Combs1-6/+6
Convert WinPcap references and URLs in error messages and the FAQ to their Npcap equivalents. Remove some obsolete FAQ entries. Change-Id: I695d358a2c9cff0939f4ea84ba02d4c62ad7dd01 Reviewed-on: https://code.wireshark.org/review/31943 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs <gerald@wireshark.org>
2019-01-26dumpcap: fix memory leak in ringbuffer modePeter Wu1-7/+20
'save_file' is used both for holding the -w command-line argument as well as the current filename that is being written. In ringbuffer mode, the former is already freed while the latter changes after rotation. Be sure to free all ringbuffer filenames on exit. Fixes test failures due to ASAN reporting memory leaks for: test_dumpcap_ringbuffer_filesize test_dumpcap_pcapng_single_in_multi_out test_dumpcap_pcapng_multi_in_multi_out test_dumpcap_ringbuffer_packets Change-Id: Ib817d8340275d7afa7e149dcfbbc59ed78293c34 Reviewed-on: https://code.wireshark.org/review/31739 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-01-24dumpcap: fix memleak if multi_files_on is enabledPeter Wu1-2/+0
Capture tests fail under ASAN due to leaking capture_opts->save_file. Since v2.9.0rc0-1493-g787d61c0a4, capture_opts_cleanup takes care of freeing "save_file", so avoid clearing the pointer. Change-Id: Ice90efe0959cc8016f47db20970bd2397909e28d Reviewed-on: https://code.wireshark.org/review/31727 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2019-01-18ebhscr: increasing ebhscr snaplenPantar Ana1-0/+9
Change-Id: Ie033196c099927912b1e7849299e786dc8416923 Reviewed-on: https://code.wireshark.org/review/31554 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-01-02cli_main: remove real_main from stack traces for non-WindowsPeter Wu1-1/+1
Restore the "main" name since that is used everywhere else except for Windows. On Windows, "main" is renamed via a macro to avoid a conflict with "wmain" and to allow it to be called in cli_main.c. For those wondering, GUI applications (such as Qt) have a different entry point, namely WinMain. In Qt5, src/winmain/qtmain_win.cpp defines WinMain, but seems to convert its arguments from Unicode to CP_ACP (ASCII). It might not support UTF-8, but I did not verify this. Change-Id: I93fa59324eb2ef95a305b08fc5ba34d49cc73bf0 Reviewed-on: https://code.wireshark.org/review/31208 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-01-01Move some command-line-oriented routines from wsutil to ui.Guy Harris1-2/+2
cmdarg_err() is for reporting errors for command-line programs and command-line errors in GUI programs; it's not something for any of the Wireshark libraries to use. The various routines for parsing numerical command-line arguments are not for general use, they're just for use when parsing arguments. Change-Id: I100bd4a55ab8ee4497f41d9651b0c5670e6c1e7f Reviewed-on: https://code.wireshark.org/review/31281 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-12-31Improve capture-on-pipe error messages.Guy Harris1-7/+26
Add "Please report this to us" and "Please report this to whoever wrote the program that's writing to the pipe" secondary error messages. Use the latter for most of the errors, as the most likely cause is that the program writing to the pipe is messing up somehow. If we don't recoginze the first 4 bytes of the file, say "Data written to the pipe is neither in a supported pcap format nor in pcapng format." - it's not necessarily a pcap file. Speak of "pcap" rather than "libpcap" format - it's not completely tied to libpcap (although two of the libraries not called "libpcap" that read it are basically libpcap+a Windows driver+a library for the Windows driver, at this point), and the suffix generally used it ".pcap". Change-Id: Ifb5518af5cade788294c93a7ac416893f57f6bc8 Reviewed-on: https://code.wireshark.org/review/31273 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-12-31Use size_t, not int, for sizes.Guy Harris1-60/+89
Change-Id: I421acce006692d6415a3d647b262843d38858cf7 Reviewed-on: https://code.wireshark.org/review/31272 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-12-29Add interface name when outputting packets dropped.Michael Mann1-4/+3
Add interface name (colon delimited) to SP_DROPS ('D') message so when dropped packets are outputted, they include the interface name for clarity. Bug: 13498 Change-Id: I68cdde4f20a574580f089dc5096d815cde5d3357 Reviewed-on: https://code.wireshark.org/review/31218 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-12-18writecap: rename pcapng_write_session_block to _section_blockJaap Keuter1-1/+1
The pcapng file format specification speaks of a secion block, not a session block. Let the function name reflect the proper name of the block it writes. Change-Id: Id399fae3648c93f4750fedaa297b18f95f2bb96f Signed-off-by: Jaap Keuter <jaap.keuter@xs4all.nl> Reviewed-on: https://code.wireshark.org/review/31099 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-12-13Move more version-info-related stuff to version_info.c.Guy Harris1-30/+6
Have a ws_init_version_info() routine that, given an application name string: constructs the app-name-and-version-information string, and saves it; adds the initial crash information on platforms that support it, and saves it. Have show_version() use the saved information and take no arguments. Add a show_help_header() routine to print the header for --help command-line options, given a description of the application; it prints the application name and version information, the description, and the "See {wireshark.org URL}" line. Use those routines in various places, including providing the "application name" string in pcapng SHBs. Change-Id: I0042a8fcc91aa919ad5c381a8b8674a007ce66df Reviewed-on: https://code.wireshark.org/review/31029 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-12-13Put the main() and wmain() routines for CLI programs into a separate file.Guy Harris1-22/+2
That means that code is only in one place, rather than having copies of it in each of those programs. CLI programs that, on Windows, should get UTF-8 arguments rather than arguments in the local code page should: include the top-level cli_main.h header; define the main function as real_main(); be built with the top-level cli_main.c file. On UN*X, cli_main.c has a main() program, and just passes the arguments on to real_main(). On Windows, cli_main.c has a wmain() function that converts the UTF-16 arguments it's handed to UTF-8 arguments, using WideCharToMultiByte() so that it doesn't use any functions other than those provided by the system, and then calls real_main() with the argument count and UTF-8 arguments. Change-Id: I8b11f01dbc5c63fce599d1bef9ad96cd92c3c01e Reviewed-on: https://code.wireshark.org/review/31017 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-11-27Dumpcap: Adjust pcapng headers when we write them.Gerald Combs1-31/+25
When we capture from multiple interfaces, we won't necessarily write our IDBs in the same order we read them. This means that we need to call pcapng_adjust_block when we write packets, not when we read them. Otherwise we might map a given capture source's local interface number to the wrong global IDB entry. Bug: 15311 Change-Id: Ia787d7f167dcd18d432020a715e2321f4060b851 Reviewed-on: https://code.wireshark.org/review/30798 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-11-16Dumpcap: Fix writing SHBs and IDBs.Gerald Combs1-154/+277
If we have a single capture source and that capture source is pcapng and we're writing a pcapng file, do the following: - Pass its SHB and IDBs through unmodified. Don't save or write command line interface IDBs. - Save the most recent SHB and IDBs so that we can write them when we're writing multiple output files. If we have multiple capture sources, do the following: - Write Dumpcap's SHB. - Keep a global list of IDBs, consisting of both command line interfaces and IDBs read from pcapng sources. - When reading an EPB or ISB, remap its local interface number to its corresponding global number. Add Dumpcap pcapng section tests. Make the application IDs in the "many_interfaces" captures unique. Change-Id: I2005934c1f83d839727421960005f106d6c682dd Reviewed-on: https://code.wireshark.org/review/30085 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-11-15Dumpcap: Update our pipe closed logic.Gerald Combs1-10/+12
Check for pipe status only when we no longer have packets. This keeps us from flushing packets that we should have written. Change-Id: I714f52597da792a0b228b5e1a1dd3a993dc93681 Reviewed-on: https://code.wireshark.org/review/30651 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-11-14Dumpcap: Make sure we set our pipe error status.Gerald Combs1-10/+20
Make sure cap_pipe_read_data_bytes sets pcap_src->cap_pipe_err if it encounters an error or EOF. This fixes a regression introduced in ga51b3d1d16. Have it return -1 or the number of bytes read similar to read(2). Explicitly treat its return value as a signed integer. Change-Id: I3de92859eee45e8d4a24a8c8309a816ef1b7924a Reviewed-on: https://code.wireshark.org/review/30639 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-11-14Dumpcap: Don't let individual pipes stop our capture.Gerald Combs1-13/+23
If a capture source is a pipe and it reaches the end of its input, don't stop capturing globally since we might have other active interfaces. We do need to stop capturing if all of our interfaces are pipes and none of them are open, so add a check to do so. Change-Id: Id7f950349e72113c9b4bfeee4f0a9c8a97aefe8c Reviewed-on: https://code.wireshark.org/review/30615 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-11-14Dumpcap: Move packet dequeueing code to a common routine.Gerald Combs1-50/+46
Dequeue and write packets in capture_loop_dequeue_packet. This ensures that we properly handle pcapng packets both inside our capture loop and after it's finished. Change-Id: Iacc980c90481b1378761eac83d8044aaddabfdc2 Reviewed-on: https://code.wireshark.org/review/30609 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-11-10capture_loop_write_pcapng_cb() shouldn't be called if use_pcapng is false.Guy Harris1-3/+5
If it *is* called when global_capture_opts.use_pcapng is false, don't just silently drop the packet on the floor, abort. Change-Id: Idb8f8e4c4ba231cfe674a81da34bf46e00f8247c Reviewed-on: https://code.wireshark.org/review/30562 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-11-10Dumpcap: Move the "just wrote one packet" logic to one place.Gerald Combs1-32/+33
Add capture_loop_wrote_one_packet, which increments the appropriate counters and checks for autostop and ring buffer conditions. Call it when we write a pcap or pcapng packet. This fixes `-b packets:NUM` for pcapng output. Change-Id: Ie2bdd725fbee59c1ae10b05be84ae9a3a6d80111 Reviewed-on: https://code.wireshark.org/review/30561 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-11-09Dumpcap+Qt: Add support for `-a packets:NUM` and `-b packets:NUM`.Gerald Combs1-64/+69
Add the ability to rotate files after a specified number of packets (`-b packets:NUM`). Move some condition checks to capture_loop_write_packet_cb. Add `-a packets:NUM` in order to be consistent. It is functionally equivalent to the `-c` flag. Add a corresponding "packets" option to the Capture Interfaces dialog Output tab. Add initial tests for autostop and ringbuffer conditions. Change-Id: I66eb968927ed287deb8edb96db96d7c73526c257 Reviewed-on: https://code.wireshark.org/review/30534 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-11-01Move condition logic to dumpcap.cGerald Combs1-67/+52
Move the condition logic from capture_stop_conditions.c to dumpcap.c. Remove capture_stop_conditions.[ch] and conditions.[ch]. Switch duration values to doubles. Change-Id: Ifa74fb13ec8fc923b0721597a6cf071d72069ea0 Reviewed-on: https://code.wireshark.org/review/30440 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-10-21Dumpcap: Swap bytes only for pcap sources.Gerald Combs1-44/+30
Instead of trying to byte swap all of pcapng's block types, refuse to handle pcapng sources that have a different byte order. Rename cap_pipe_adjust_header to cap_pipe_adjust_pcap_header. Change-Id: I2615da57ba9d3fc365c631dc191f7767a284d460 Reviewed-on: https://code.wireshark.org/review/30235 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: James Ko <jim.list@hotmail.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
2018-10-08Bring back arg_list_utf_16to8(), but have it just do UTF-16-to-UTF-8 mapping.Guy Harris1-7/+4
Call it from wmain() in the command-line tools, passing it the input argument count and vector, and call it from main() in Wireshark, after getting a UTF-16 argument vector from passing the result of GetCommandLineW() to CommandLineToArgvW(). Change-Id: I0e51703c0a6c92f7892d196e700ab437bd702514 Reviewed-on: https://code.wireshark.org/review/30063 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-10-07Use wsetargv.obj, and wmain() rather than main(), on Windows.Guy Harris1-3/+21
Doing so for command-line programs means that the argument list doesn't ever get converted to the local code page; converting to the local code page can mangle file names that *can't* be converted to the local code page. Furthermore, code that uses setargv.obj rather than wsetargv.obj has issues in some versions of Windows 10; see bug 15151. That means that converting the argument list to UTF-8 is a bit simpler - we don't need to call GetCommandLineW() or CommandLineToArgvW(), we just loop over the UTF-16LE argument strings in argv[]. While we're at it, note in Wireshark's main() why we discard argv on Windows (Qt does the same "convert-to-the-local-code-page" stuff); that means we *do* need to call GetCommandLineW() and CommandLineToArgvW() in main() (i.e., we duplicate what Qt's WinMain() does, but converting to UTF-8 rather than to the local code page). Change-Id: I35b57c1b658fb3e9b0c685097afe324e9fe98649 Ping-Bug: 15151 Reviewed-on: https://code.wireshark.org/review/30051 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-10-06Fix Windows dumpcap -i TCP@James Ko1-30/+51
Reading from a TCP socket in Windows must not change read state variables to values required by cap_thread_read on pipes. Bug: 15149 Change-Id: I1efa9288b5954dc4a18b2c68772c54a098a224e7 Reviewed-on: https://code.wireshark.org/review/29894 Reviewed-by: Peter Wu <peter@lekensteyn.nl> Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-10-01Add a systemd Journal Export extcap.Gerald Combs1-1/+1
Add an sdjournal extcap, which reads journal entries using the sd-journal API and dumps them as journal Export Format records. Change-Id: I17ccfa88ab5d053c16c869cd26e580d84022502e Reviewed-on: https://code.wireshark.org/review/29479 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-09-28dumpcap: fix some warnings and add some debugsJames Ko1-26/+66
Ping-Bug: 15149 Change-Id: Ifa530fbdcbffbc188343c03fc7b518325a511f5f Reviewed-on: https://code.wireshark.org/review/29906 Petri-Dish: Guy Harris <guy@alum.mit.edu> 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>
2018-08-13Put the interface descrptions into the IDB when capturing to pcapng.Guy Harris1-15/+49
capture_opts_add_iface_opt(), when called in a program acting as a capture child, will fetch the description for the interface, and will also generate a "display name" for the interface. In the process, we clean up capture_opts_add_iface_opt() a bit, combining duplicate code. We rename console_display_name to just display_name, as it may also be used in the title bar of Wireshark when capturing. Change-Id: Ifd18955bb3cb41df4c0ed4362d4854068c825b96 Reviewed-on: https://code.wireshark.org/review/29117 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-08-12More comment cleanup.Guy Harris1-5/+5
Change-Id: I0fac7351d204eac1ca5f00fb2f19d275d4d5767c Reviewed-on: https://code.wireshark.org/review/29101 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-08-12Improve comments.Guy Harris1-1/+10
Change-Id: Icce916d6d465f80e06ed45e4d5bd98362d63a26a Reviewed-on: https://code.wireshark.org/review/29097 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-08-12Clean up temporary filename generation.Guy Harris1-12/+6
Don't put identical code in both arms of a conditional - move it out of the conditional. Doing that with one line of code means that the conditional is now *itself* duplicated in both arms of a conditional, so move it out, too. Change-Id: I07c1d00e7d0053684aa2ef74b460eb008b145015 Reviewed-on: https://code.wireshark.org/review/29093 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-06-11Give more detailed information about capture permissions on Debian.Guy Harris1-2/+13
Indicate what you're supposed to do when running dpkg-reconfigure wireshark-common, and indicate that you have to run it as root using sudo. Emphasize in README.Debian, and indicate in the permission failure secondary message, that you have to add users to the "wireshark" group after doing that, and that a user may have to log out and log in again to make this change take effect. Bug: 14847 Change-Id: Ia83ff8e92bd2f00b6c3779272322a40201416da0 Reviewed-on: https://code.wireshark.org/review/28206 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-06-11Offer a permissions suggestion for macOS.Guy Harris1-0/+6
If the user installed from the wireshark.org package, perhaps they chose not to install the "Set capture permissions on startup" item. Suggest that they choose otherwise. Change-Id: Ic5053da9cb6e54e7a7b1aa5a9dd59a1a84ddee16 Reviewed-on: https://code.wireshark.org/review/28197 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-06-10Improve the secondary error messages for pcap errors.Guy Harris1-61/+106
On Windows, if WinPcap isn't installed, warn about that for errors other than failed attempts to start capturing. On HP-UX, if we appear to have an old version of libpcap, warn about that for errors other than failed attempts to start capturing. If we know the error is a permissions problem, don't make suggestions appropriate to other problems. If we know the error is *not* a permissions problem, don't make suggestions appropriate to permissions problems. For permissions problems, or possible permissions problems, on Linux, suggest doing dpkg-reconfigure wireshark-common if you've installed from a package on Debian or a Debian derivative such as Ubuntu. Change-Id: If4aac0343095ac0b984eebc21853920c3b6d3c63 Ping-Bug: 14847 Reviewed-on: https://code.wireshark.org/review/28189 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-16Eliminate some unneeded header checks.Guy Harris1-3/+1
sys/stat.h and sys/types.h date back to V7 UNIX, so they should be present on all UN*Xes, and we're assuming they're available on Windows, so, unless and until we ever support platforms that are neither UN*Xes nor Windows, we don't need to check for them. Remove the CMake checks for them, remove the HAVE_ values from cmakeconfig.h.in, and remove all tests for the HAVE_ values. Change-Id: I90bb2aab37958553673b03b52f4931d3b304b9d0 Reviewed-on: https://code.wireshark.org/review/27603 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-05-12Report the appropriate secondary message for ENOSPC and EDQUOT.Guy Harris1-15/+31
Don't tell the user that, if they run out of space or go over their disk quote, they should report that as a Wireshark bug; instead, tell them that they're going to need to free up some space or do the capture to a different file system. Clean up some argument types, and get rid of tabs in indentation, while we're at it. Change-Id: I7839f38c14253a114e7e02e762243df5e09682ef Ping-Bug: 14677 Reviewed-on: https://code.wireshark.org/review/27472 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-04-16glib: Get rid of GLIB_CHECK_VERSION as we now require 2.32.0Anders1-51/+0
Change-Id: Ie95cf37f9cd283545693e290340a7489cc989c95 Reviewed-on: https://code.wireshark.org/review/26970 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-08replace SPDX identifier GPL-2.0+ with GPL-2.0-or-later.Dario Lombardo1-1/+1
The first is deprecated, as per https://spdx.org/licenses/. Change-Id: I8e21e1d32d09b8b94b93a2dc9fbdde5ffeba6bed Reviewed-on: https://code.wireshark.org/review/25661 Petri-Dish: Anders Broman <a.broman58@gmail.com> Petri-Dish: Dario Lombardo <lomato@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-01-16dumpcap: remove dead code (CID: 1188011).Dario Lombardo1-5/+0
Change-Id: I55149733ae420d32c6dd86c3c61baef57cc2082f Reviewed-on: https://code.wireshark.org/review/24996 Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-01-08Do not automatically enable the linux kernel's BPF JIT compilerJon DeVree1-33/+4
The default value of kernel.unprivileged_bpf_disabled is 0 which means this is enabling the BPF JIT compiler for unprivileged users. Given that this is a known attack vector for Spectre variant 1 (CVE-2017-5753) this is not a setting that a utility should be tampering with. Tshark's and dumpcap's help message is changed by Balint Reczey to suggest enabling BPF manually after considering security-related implications. Change-Id: I1cc34cbd6e84485eba9dee79a8700aa388354885 Signed-off-by: Balint Reczey <balint.reczey@canonical.com> Bug: 14313 Reviewed-on: https://code.wireshark.org/review/25192 Reviewed-by: Balint Reczey <balint@balintreczey.hu> Petri-Dish: Balint Reczey <balint@balintreczey.hu> Reviewed-by: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-01-08extcap: remove conditional compilation.Dario Lombardo1-17/+1
Change-Id: Ia54bba388755cf27a343fe6d69d244bf1ab897f9 Reviewed-on: https://code.wireshark.org/review/25186 Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Roland Knall <rknall@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-12-24Fix build and thread runtime compat with older GLibPeter Wu1-4/+3
CentOS 6 ships with glib 2.28.8 which do not support g_ptr_array_new_full (make-taps/make-dissectors) and need to link with wsutil for glib-compat. g_thread_new was only introduced with GLib 2.32 (not 2.31), so adjust the check accordingly. Abort in case thread creation fails (as documented). Properly initialize threads or it will abort on runtime (this also requires linking epan with gthreads in CMake, autotools already includes it with GLIB_LIBS). Change-Id: Ie81d6df7b3b26aaa4eb25e23719a220755e2c13c Reviewed-on: https://code.wireshark.org/review/24978 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Reviewed-by: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-12-17Log output updates.Gerald Combs1-52/+1
Add a Qt message handler that calls g_log. Add milliseconds to the g_log_message_handler timestamp. Change-Id: I5b1c1d902b6b05cd8daa01741b19d6c2048dfb9a Reviewed-on: https://code.wireshark.org/review/24865 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-12-05dumpcap.c: cap_pipe_read() returns a ssize_t whatever the platform (CID 1424899)Pascal Quantin1-4/+6
Change-Id: I9c157e1ed7264d787c26ca60bbbe32edfc99bff8 Reviewed-on: https://code.wireshark.org/review/24706 Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-12-01dumpcap: enable capture of pcapng from pipeJames Ko1-116/+750
Reads pcapng blocks from a pipe. Section header blocks are parsed for endianess. All other blocks only have the general block header parsed for type and length, and then endianess converted if necessary. Outputs all blocks using the original endianess format so none of the other block types or options require parsing. Change-Id: I2f4f0175013d8fc2cda42a63e7deacad537951e3 Bug: 11370 Reviewed-on: https://code.wireshark.org/review/24536 Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-11-29Threads: Set lifetimes and add a compatibility routine.Gerald Combs1-8/+0
Join the protocol registration threads so that they call g_thread_unref which in turn detaches/terminates the thread. This gets rid of many TSan and DRD errors here. The remaining ones appear to be false positives. Add g_thread_new to glib-compat (untested). Change-Id: I4beb6746ed08656715cf7870ac63ff80cf1ef871 Reviewed-on: https://code.wireshark.org/review/24619 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>