Commit Graph

80 Commits

Author SHA1 Message Date
Sake Blok 3803e00367 Add option to use wall-clock intervals
Add the "interval" option to "-b". Each new capture starts at the
exact start of a time interval. For instance, using -b interval:3600
will start a new capture file at each whole hour.

Changed the duration option in the GUI interfaces to use the new
interval option.

Change-Id: I0180c43843f5d2f0c2f50153c9ce42ac7fa5aeae
Reviewed-on: https://code.wireshark.org/review/22428
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Sake Blok <sake.blok@SYN-bit.nl>
2017-07-03 16:41:37 +00:00
Guy Harris 2814e3c9cd If has_snaplen isn't set, don't set the snapshot length with pcap_create()/pcap_activate().
Just let libpcap pick the snapshot length; that way, for link-layer
types that need a really large snapshot length, such as D-Bus (which
requires 128MB for the largest messages), it can pick that, but can
otherwise pick something that doesn't require as much memory, e.g.
256KB.

For pcap_open_live() and pcap_open(), which don't have a way of saying
"give me what's appropriate", pick 256KB.

Change-Id: Idef5694f7dfa85eaf3a61d6ca7a17d263c417431
Reviewed-on: https://code.wireshark.org/review/21917
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-06-03 17:15:17 +00:00
Guy Harris 2c44a7f930 Clean up handling of enabled/disabled protocols/heuristic dissectors.
Add a "report a warning message" routine to the "report_err" code in
libwsutil, and rename files and routines appropriately, as they don't
only handle errors any more.

Have a routine read_enabled_and_disabled_protos() that reads all the
files that enable or disable protocols or heuristic dissectors, enables
and disables them based on the contents of those files, and reports
errors itself (as warnings) using the new "report a warning message"
routine.  Fix that error reporting to report separately on the disabled
protocols, enabled protocols, and heuristic dissectors files.

Have a routine to set up the enabled and disabled protocols and
heuristic dissectors from the command-line arguments, so it's done the
same way in all programs.

If we try to enable or disable an unknown heuristic dissector via a
command-line argument, report an error.

Update a bunch of comments.

Update the name of disabled_protos_cleanup(), as it cleans up
information for disabled *and* enabled protocols and for heuristic
dissectors.

Support the command-line flags to enable and disable protocols and
heuristic dissectors in tfshark.

Change-Id: I9b8bd29947cccdf6dc34a0540b5509ef941391df
Reviewed-on: https://code.wireshark.org/review/20966
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-04-08 20:40:08 +00:00
Joerg Mayer 2890e415bb Fix various compile warnings turning error on Linux with gcc6 when
compiling with HAVE_PCAP_REMOTE (and ENABLE_ECHLD)

Change-Id: If5524f2d3dcacca9c82a46167480c8436dd8b1b2
Reviewed-on: https://code.wireshark.org/review/20615
Petri-Dish: Jörg Mayer <jmayer@loplof.de>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Jörg Mayer <jmayer@loplof.de>
2017-03-19 12:27:12 +00:00
Joerg Mayer e18ad46ad0 Don't use identical log messages for non-identical error cases.
Change-Id: Ia80f112bef5f0c10e54223d3b57570fa53f7e867
Reviewed-on: https://code.wireshark.org/review/20216
Reviewed-by: Jörg Mayer <jmayer@loplof.de>
2017-02-20 23:12:16 +00:00
Gerald Combs d84577fe1a Yell at the user less.
Our user-facing messages should have a helpful (or at the very least
neutral) tone. In English, exclamation points are neither. Replace a
bunch of them with periods.

Change-Id: I29c3b2f84c25e06aae5b559860224559053a0378
Reviewed-on: https://code.wireshark.org/review/20189
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-02-20 16:53:17 +00:00
Guy Harris b3068a0d1b Fix a comment to match we-run-on-Windows-too reality.
Change-Id: I68a299afd1d8228e7c842f66ffd3b4ee1ffb3798
Reviewed-on: https://code.wireshark.org/review/20014
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-02-08 02:21:44 +00:00
Roland Knall 67bfdf2871 capchild: Fix loading of extcap with no winpcap.dll
If the loading of the physical interface list failed, no extcap
interfaces will be loaded as well. Fix that, so that we search for
the extcap interfaces, even when no other interfaces have been found

Change-Id: Ib8e86f1f8d2a1565724ef3532d41ecea3ceddb55
Reviewed-on: https://code.wireshark.org/review/18352
Reviewed-by: Roland Knall <rknall@gmail.com>
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Dario Lombardo <lomato@gmail.com>
2016-10-21 11:55:26 +00:00
Peter Wu 534787e402 cmake: make WERROR_COMMON_FLAGS a normal string
Instead of checking for the boolean "FALSE", just set an empty string.
This avoids the need to check for WERROR_COMMON_FLAGS before using it.

The transformation is the same for all files, remove
"if (WERROR_COMMON_FLAGS)" and "endif()", reindent and add quotes (since
we have a string here and not a list).

Modelines have been added where missing.

Change-Id: I0ab05ae507c51fa77336d49a99a226399cc81b92
Reviewed-on: https://code.wireshark.org/review/17997
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
Reviewed-by: Dario Lombardo <lomato@gmail.com>
Tested-by: Dario Lombardo <lomato@gmail.com>
2016-09-30 20:08:02 +00:00
Mikael Kanstrup 00c862e405 capchild: Support optional 802.11 channel parameters
Document the the 802.11 set channel function and its parameters.
Add support for optional parameters.

Bug: 12896
Change-Id: I95966f99149aa9c1502d97b5707dcc8c2f5b26e8
Reviewed-on: https://code.wireshark.org/review/17699
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-09-23 06:01:27 +00:00
Dario Lombardo 2e40242636 capture_sync: use ws_strtou function.
Change-Id: Ic128a7f1afd85f6b737392ff76b40d54cbdd8971
Reviewed-on: https://code.wireshark.org/review/17523
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2016-09-21 16:41:36 +00:00
João Valverde 640382c743 CMake: Allow setting per target compiler warnings
Setting our compiler warning flags in CMAKE_C_FLAGS does not allow
using different flags per target.

Allow for that possibility by setting the internal WS_WARNINGS_{C,CXX}_FLAGS
and using the COMPILE_OPTIONS property to set them.

This change is just setting mechanism and there should be no difference
in generated warnings.

The check_X_compiler_flag cmake test is changed to test each flag individually.
We need a list, not a space separated string, and the aggregate test is not
significant.

Change-Id: I59fc5cd7e130c7a5e001c598e3df3e13f83a6a25
Reviewed-on: https://code.wireshark.org/review/17150
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
2016-08-23 21:33:09 +00:00
Roland Knall c611eded22 extcap: Use stderr to print error message
This patch reads out the stderr messages from an extcap
utility and displays it to an user. It was tested on Qt
but not on GTK, but should work their as well.

On Mac OS/X and Windows the child_watch does not behave
as it was intended. Therefore in extcap_cleanup, the callbacks
are called manually, if and only if, they have not been
called already.

The reason why it displays two error messages is, that
by the time the first one is being displayed, glib has not
returned from the spawned process on Linux yet. So there
is no way to add the stderr correctly, and putting a handler
to stderr into interface_opts will lead to memory errors,
cause then the code tries to access memory outside of its
protection.

Bug: 11892
Change-Id: I2db60dd480fed3e01428b91a705057e4f088bd15
Reviewed-on: https://code.wireshark.org/review/12954
Reviewed-by: Roland Knall <rknall@gmail.com>
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-07-30 21:15:39 +00:00
Roland Knall 485bc456c5 extcap: Restore functionality for options
Allow stored options to be restored to their default values. This
adds a global cleanup method for extcap and globally defined
preference values, which fixes the parameter problem with windows

Change-Id: I48e0cf846ef81f4732d652c6a2ad0020db5df08e
Reviewed-on: https://code.wireshark.org/review/13741
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Roland Knall <rknall@gmail.com>
2016-07-29 03:15:54 +00:00
João Valverde a16d401b25 Remove Makefile.common files
Now that nmake build system has been removed they are not needed anymore.

Change-Id: I88075f955bb4349185859c1af4be22e53de5850f
Reviewed-on: https://code.wireshark.org/review/16050
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
2016-06-30 11:04:17 +00:00
Roland Knall 79836fa23a wsutil: Move Win32 helper routines from capchild
Move error handling and argument quoting routines from
capchild to wsutil, as those methods will be used by
extcap_spawn as well.

Change-Id: I2c4515fefd5aecad317fcdaefa721734288f792c
Reviewed-on: https://code.wireshark.org/review/16123
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
Reviewed-by: Roland Knall <rknall@gmail.com>
2016-06-25 15:06:27 +00:00
Pascal Quantin 6baa1b544c Remove Nmake build system
Change-Id: I3bd474f3cda9667dec66426b5729449953df3e61
Reviewed-on: https://code.wireshark.org/review/15777
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Jörg Mayer <jmayer@loplof.de>
Reviewed-by: Balint Reczey <balint@balintreczey.hu>
2016-06-15 19:21:57 +00:00
Michael Mann 57ef06e242 *_stdup_printf -> strdup for "single string only" formatting.
Done for performance improvements.

This could probably be done in checkAPIs.pl, but this was just
a quick manual check with grepping.

Change-Id: I91ff102cb528bb00fa2f65489de53890e7e46f2d
Reviewed-on: https://code.wireshark.org/review/15751
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl>
2016-06-06 06:03:58 +00:00
Graham Bloice 2e23b506c7 Add checkAPI calls to CMake.
This generates a top level target, checkAPI, that is
excluded from the ALL build target, so must be run separately.

On Windows using a Visual Studio generator, call
msbuild /p:Configuration=RelWithDebInfo checkAPI.vcxproj

Change-Id: I44a57c564dcfc75499463b942436f4b920a82478
Reviewed-on: https://code.wireshark.org/review/14873
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Graham Bloice <graham.bloice@trihedral.com>
2016-05-02 12:01:24 +00:00
Gerald Combs 455c30a54b Win32: Make sure we zero out PROCESS_INFORMATION.
Make sure we zero our PROCESS_INFORMATION struct before passing it to
CreateProcess.

Change-Id: Ib42320965bb7b2d37a9fc106d78ace02153e48d2
Reviewed-on: https://code.wireshark.org/review/15154
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2016-04-29 00:38:40 +00:00
Gerald Combs 91b154236b Win32: Pass a mutable string to CreateProcess.
CreateProcess can modify its second (lpCommandLine) argument. Don't
pass it the output of utf_8to16.

Constify the return value of utf_8to16.

Change-Id: I0d4361396e90c88a4ab2a3f2f0e058230e897fdf
Reviewed-on: https://code.wireshark.org/review/15155
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2016-04-28 23:50:28 +00:00
Gerald Combs b16166c36a Revert "Windows: Wait for dumpcap to initialize."
This didn't fix the test failures.

This reverts commit e5f4c5c8a8.

Change-Id: I0cff5eff88d2b49806797cef83338dbbace42a4c
Reviewed-on: https://code.wireshark.org/review/15135
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2016-04-28 00:12:31 +00:00
Gerald Combs e5f4c5c8a8 Windows: Wait for dumpcap to initialize.
As the MSDN documentation says, "CreateProcess returns without waiting
for the new process to finish its initialization." Add an SP_INIT sync
pipe indicator on Windows and use it in dumpcap to signal to its parent
that it has started up.

Change-Id: I88a4c158871dbe2dd6eba13434e92c5d4b1c2e4b
Reviewed-on: https://code.wireshark.org/review/15132
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2016-04-27 23:11:34 +00:00
Gerald Combs cf6501eb45 Windows: Remove the need for _CRT_NONSTDC_NO_DEPRECATE.
Replace some function calls with their non-deprecated equivalents so
that we can remove _CRT_NONSTDC_NO_DEPRECATE from CMakeLists.txt and
config.nmake.

Leave _CRT_SECURE_NO_DEPRECATE in place. Removing it failed with 145
warnings and 72 errors.

Note that we could probably improve startup performance by using wmem
in diam_dict.*.

Change-Id: I6e130003de838aebedbdd1aa78c50de8a339ddcb
Reviewed-on: https://code.wireshark.org/review/14883
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-04-13 02:16:20 +00:00
Mikael Kanstrup 9f27e5d7d1 dumpcap: Add support for 802.11ac monitor modes
Add dumpcap support for configuring 80MHz, 80+80MHz, 160MHz monitor
modes via nl80211.

Change-Id: I2ae8955670c2a9b5051e2223d45ce522459f2c5f
Reviewed-on: https://code.wireshark.org/review/13964
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-03-01 15:23:44 +00:00
Guy Harris cdb7a7a25d Fix appending the list of remote interfaces.
Don't assume if_list is non-null when append_remote_list() is called; it
won't be, if we didn't find any local interfaces.  Have
append_remote_list() return the final if_list value, and assign it to
if_list.

Change-Id: I05586d5b034f3d61aa38a20f6c6d2c69117b367e
Reviewed-on: https://code.wireshark.org/review/14191
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-02-27 02:04:00 +00:00
Guy Harris 842a9b5100 Replace extcap_interface_list() with append_extcap_interface_list().
Pull the "rebuild the list of extcap interfaces and, optionally, return
a list of if_infos for them" into a separate
extcap_reload_interface_list() routine, call it in the cases where we
don't want the if_infos list, and have append_extcap_interface_list()
call it, asking it for the if_infos list, and then append the interfaces
to that list.

Change-Id: I07478ab133859484b3e0916144971639f961224b
Reviewed-on: https://code.wireshark.org/review/14189
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-02-27 01:04:33 +00:00
Guy Harris 60f87ca919 Put the extcap interfaces at the *end* of the interface list.
The list should start with the native local interfaces, as returned by
pcap, so that we default to the interface pcap gives first, rather than
to whatever extcap interface happens to be at the beginning.

This also means that, if we're only calling extcap_interface_list() to
regenerate our internal data structures, we don't bother allocating -
and leaking! - a list of if_info structures.

Change-Id: Ida651b5b081883f118a300b9f57403f2dc5c4363
Ping-Bug: 12183
Reviewed-on: https://code.wireshark.org/review/14187
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-02-27 00:37:22 +00:00
João Valverde f0fb79d534 autotools: Use pkg-config autoconf macros for GLib/GTK
Remove mostly obsolete aclocal macros. Make GTK build flags a strict superset
of GLib flags. Use GTK build variables for GTK GUI and GLib elsewhere. Add
dependency flags explicitly instead of using WS_CPPFLAGS.

Some minor improvements and fixes for missing/unnecessary variables (no impact
on our test builds).

Change-Id: I3e1f067a875f79d6516c1fa7af986f17a7a6b671
Reviewed-on: https://code.wireshark.org/review/14005
Reviewed-by: João Valverde <j@v6e.pt>
2016-02-21 07:51:55 +00:00
João Valverde 8bee8bad81 Add inet_pton/inet_ntop interface to libwsutil
Change-Id: Ifc344ed33f2f7ca09a6912a5adb49dc35f07c81f
Reviewed-on: https://code.wireshark.org/review/13881
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
2016-02-19 15:55:09 +00:00
Guy Harris 50a9165831 Remove some {-I,/I} flags.
They should not be necessary.

Change-Id: I9246d86862392c65839c18d13d8634bcf510d55e
Reviewed-on: https://code.wireshark.org/review/13992
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-02-18 14:38:19 +00:00
Guy Harris b32a5ee98c Don't add the wiretap directory to the list of include directories.
If you include something from the wiretap directory, always precede it
with wiretap/.

Fix some includes of files in the top-level directory to use a path
relative to the current directory, not relative to the wiretap
directory.

This makes it a bit clearer what's being included.

Change-Id: Ib99655a13c6006cf6c3112e9d4db6f47df9aff54
Reviewed-on: https://code.wireshark.org/review/13990
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-02-18 12:55:26 +00:00
João Valverde 265a41e14d autotools: Don't use "user variables" to set build flags
GNU coding standards recommend against it and automake is designed
around it.

This allows overriding the global build flags using AM_CFLAGS, etc.,
or per object flags, something that is difficult or impossible currently
because of automake precedence rules.

Change-Id: I3f1ea12e560af5a46b2f04b342b1882bbf123f12
Reviewed-on: https://code.wireshark.org/review/13455
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
2016-01-28 18:13:48 +00:00
Alexis La Goutte 80d7250e36 capture_sync(.h): fix api reference
The following parameters of sync_pipe_start(capture_options *capture_opts, capture_session *cap_session, struct _info_data *cap_data, void(*update_cb)(void)) are not documented:
  parameter 'cap_data'

Change-Id: I3733c51eddbe94e9c0d680dd8436265b7878d70c
Reviewed-on: https://code.wireshark.org/review/13545
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-01-26 09:09:46 +00:00
Roland Knall 645516b041 extcap: Sort extcap interfaces alphabetically
The interface list is not sorted at all, leading to
a very chaotic list. This sorts it alphabetically, as
well as correct a type in extcap_init_interfaces.

Bug: 11998
Change-Id: Ib5381a1761e8f07f9ba7996b3e6276da063b3932
Reviewed-on: https://code.wireshark.org/review/13220
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Roland Knall <rknall@gmail.com>
2016-01-12 11:07:35 +00:00
Michael Mann 444dfda793 Allow "capture info data" to not be a singleton.
It was buried as a static variable in capture_info.c, and functions were refactored to allow a pointer to the info_data_t structure to be passed in. TShark and GTK will have their own single (global) copy of the structure, while it opens up Qt to have multiple instances.

Change-Id: Ic2d7a2ad574de43f457cb18b194d6bc3fffb6120
Reviewed-on: https://code.wireshark.org/review/12691
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-12-19 14:22:56 +00:00
Mikael Kanstrup 479ab3bcdc Fix memory leak in capture_get_if_capabilities
Valgrind reports memory leaks like these:
154 bytes in 10 blocks are possibly lost in loss record 8,660 of 11,855
  at 0x4C2B6CD: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
  by 0xBD9EA38: g_malloc (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.3200.4)
  by 0xBDB3358: g_strndup (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.3200.4)
  by 0xBDB49AD: g_strsplit (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.3200.4)
  by 0x502291: capture_get_if_capabilities (capture_ifinfo.c:269)
  by 0x50A4CC: scan_local_interfaces (iface_lists.c:186)
  by 0x4C4BBD: refresh_local_interface_lists (capture_dlg.c:6117)
  by 0x504EC8: iface_mon_handler2 (iface_monitor.c:113)
  by 0xC9ADF1D: ??? (in /lib/libnl-3.so.200.3.0)
  by 0xC56DF19: ??? (in /usr/lib/libnl-route-3.so.200.3.0)
  by 0xC9ABE5E: nl_cache_parse (in /lib/libnl-3.so.200.3.0)
  by 0xC9AF5CA: nl_msg_parse (in /lib/libnl-3.so.200.3.0)

Under certain conditions raw_list variable was not freed properly.

Change-Id: Ibbaf0d67d983ee6912cfc9dc1a3169bc773b03c9
Reviewed-on: https://code.wireshark.org/review/12112
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-11-25 13:13:58 +00:00
Balint Reczey c297df134b More spelling fixes found by lintian
Change-Id: Id218dec9e5a721d6c63fd34962ffe50b6ab8dd56
Reviewed-on: https://code.wireshark.org/review/11946
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Reviewed-by: Diederik de Groot <dkgroot@talon.nl>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-11-20 05:47:29 +00:00
Guy Harris bdea0d4504 Check for ECHILD, not for "not ECHILD".
That makes the logic a bit clearer (and puts the "unexpected other
error" case at the end, where it should be).

Put all the errno checks inside an else clause, making it clearer that
it runs only if waitpid() returned -1.

Add comments, including comments explaining why just driving on after
getting EINTR should be OK.

Change-Id: Iaa1b151393fcec8b4f5bd560ef913a224400932b
Reviewed-on: https://code.wireshark.org/review/11951
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-18 19:40:36 +00:00
Stephan Kappertz 5c49facc4f Error from waitpid(): Fix Code is unreachable
Change-Id: Ib93bd7d62eb16177cfdcb82148c97a64f6e497b4
Reviewed-on: https://code.wireshark.org/review/11939
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-18 18:40:25 +00:00
Gerald Combs 527e032b80 Win32: Try to fix handle leaks in capture_sync.
If CreateProcess succeeds, close our child's primary thread handle. As
the PROCESS_INFORMATION page at
https://msdn.microsoft.com/en-us/library/windows/desktop/ms684873.aspx
says,

    If the function succeeds, be sure to call the CloseHandle function
    to close the hProcess and hThread handles when you are finished with
    them. Otherwise, when the child process exits, the system cannot
    clean up the process structures for the child process because the
    parent process still has open handles to the child process.

Closing the handle immediately doesn't seem to do any harm here, but
add a note that we might want to store it and close it later.

In sync_interface_stats_open, close our message and data descriptors
after calling sync_pipe_wait_for_child.

Ping-Bug: 11702
Change-Id: I56e0625fdceb66fba822c2dc83e07d40844329a7
Reviewed-on: https://code.wireshark.org/review/11882
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-11-17 08:19:44 +00:00
Pascal Quantin 167874a62b Extcap: allow Wireshark to list extcap interfaces even when WinPcap / Npcap is not installed
Bug: 11715
Change-Id: I4a043c4a298506d51cb6bf8b97aac787113a7dfa
Reviewed-on: https://code.wireshark.org/review/11869
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Guenter Ebermann <guenter.ebermann@googlemail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-11-17 08:17:38 +00:00
Guy Harris 14c35c31d8 Create C handles for pipes before running dumpcap.
If the C handles can't be created, there's no point in running dumpcap.

Catch some more possible _open_osfhandle() failures while we're at it.

Change-Id: I2b955378705fc932f8d383804e908e95a957be44
Ping-Bug: 11702
Reviewed-on: https://code.wireshark.org/review/11890
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-17 08:08:44 +00:00
Guy Harris 9ec2cbb1c2 Catch failure of _open_osfhandle().
This may at least prevent the crash in bug 11702, by not returning
"success" with bogus file handles of -1, if the opens fail due to
leaks chewing up all the available slots.  More investigation needs to
be done to see why we're leaking.

Change-Id: I89ecff4b03bca140f05c838e1e2604a03409f803
Ping-Bug: 11702
Reviewed-on: https://code.wireshark.org/review/11881
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-16 21:40:33 +00:00
Guy Harris 0162e54075 Clean up includes of unistd.h, fcntl.h, and sys/stat.h.
Have wsutil/file_util.h include them on UN*X, just as it includes io.h
on Windows, so we can have a rule of "if you do file operations, include
<wsutil/file_util.h> and use the routines in it".

Remove includes of unistd.h, fcntl.h, and sys/stat.h that aren't
necessary (whether because of the addition of them to wsutil/file_util.h
or because they weren't needed in the first place).

Change-Id: Ie241dd74deff284e39a5f690a297dbb6e1dc485f
Reviewed-on: https://code.wireshark.org/review/11619
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-07 21:52:23 +00:00
Gerald Combs b05803db4b CMake: Add /WX
Add "/WX" to the Visual C++ compiler flags if DISABLE_WERROR is off,
similar to config.nmake.

We haven't compiled C++ code with -Wshorten-64-to-32 for quite 
some time so there's no need to add -Wno-shorten-64-to-32 in
ui/qt/CMakeLists.txt.

Additionally, squelch

----
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\algorithm(3050) : warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data (.\rpc_service_response_time_dialog.cpp)
        C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\algorithm(3065) : see reference to function template instantiation 'void std::_Median<_RanIt,bool(__cdecl *)(const QString &,const QString &)>(_RanIt,_RanIt,_RanIt,_Pr)' being compiled
        with
        [
            _RanIt=QList<QString>::iterator
,            _Pr=bool (__cdecl *)(const QString &,const QString &)
        ]
        C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\algorithm(3127) : see reference to function template instantiation 'std::pair<_RanIt,_RanIt> std::_Unguarded_partition<_RanIt,bool(__cdecl *)(const QString &,const QString &)>(_RanIt,_RanIt,_Pr)' being compiled
        with
        [
            _RanIt=QList<QString>::iterator
,            _Pr=bool (__cdecl *)(const QString &,const QString &)
        ]
        C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\algorithm(3157) : see reference to function template instantiation 'void std::_Sort<_Iter,int,bool(__cdecl *)(const QString &,const QString &)>(_RanIt,_RanIt,_Diff,_Pr)' being compiled
        with
        [
            _Iter=QList<QString>::iterator
,            _RanIt=QList<QString>::iterator
,            _Diff=int
,            _Pr=bool (__cdecl *)(const QString &,const QString &)
        ]
        .\rpc_service_response_time_dialog.cpp(130) : see reference to function template instantiation 'void std::sort<QList<QString>::iterator,bool(__cdecl *)(const QString &,const QString &)>(_RanIt,_RanIt,_Pr)' being compiled
        with
        [
            _RanIt=QList<QString>::iterator
,            _Pr=bool (__cdecl *)(const QString &,const QString &)
        ]
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\algorithm(3051) : warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data (.\rpc_service_response_time_dialog.cpp)
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\algorithm(3052) : warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data (.\rpc_service_response_time_dialog.cpp)
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\algorithm(3053) : warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data (.\rpc_service_response_time_dialog.cpp)
----

in both rpc_service_response_time_dialog.cpp and wireshark_application.cpp
so that we'll compile successfully.

Change-Id: I457bcede99dcb1f3c1001f1f559c4901bb000357
Reviewed-on: https://code.wireshark.org/review/10533
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-10-16 21:32:22 +00:00
Peter Wu c647faa8a9 Fix various memleaks
Found by starting Wireshark within an empty profile, opening
Preferences, search for Protocol "IEEE 802.11" (because it has radio
buttons), then close everything again.

Many fixes are trivial, but the various recent_read_* functions in
recent.c were changed to return a boolean such that the result can
always be checked even if errno==0.

QButtonGroup leak was hinted by Clang Static Analyzer, all other
memleaks were found using ASAN/LSan.

Change-Id: Ia73f5d4c09d92f22e72377be59e23342f8ad7211
Reviewed-on: https://code.wireshark.org/review/10776
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2015-10-04 15:45:02 +00:00
Pascal Quantin 6452caa3b3 Fix retrieval of data link type supported by remote interfaces with authentication
Make use of -A parameter when querying data link types supported by a given interface with dumpcap.
Ensure to pass the authentication parameters configured for a remote interface when calling capture_get_if_capabilities()

Bug: 11366
Change-Id: I4efea615084a82108e4a12a64e8c46817f30a5c6
Reviewed-on: https://code.wireshark.org/review/9690
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-07-22 07:10:10 +00:00
Peter Wu 305d983442 capchild: fix uninitialized data pointer on failure
Fixes a crash / heisenbug in wireshark-qt on startup:

    ==26808==ERROR: AddressSanitizer: attempting free on address which was not malloc()-ed: 0x7fff8cf3bf70 in thread T0
        #0 0x7f42ce3b66da in __interceptor_free /build/gcc-multilib/src/gcc-5-20150519/libsanitizer/asan/asan_malloc_linux.cc:28
        #1 0x842847 in WirelessFrame::setChannel() ui/qt/wireless_frame.cpp:257
        #2 0x842bf5 in WirelessFrame::on_channelComboBox_activated(int) ui/qt/wireless_frame.cpp:282
        #3 0x84407d in WirelessFrame::timerEvent(QTimerEvent*) ui/qt/wireless_frame.cpp:134
        #4 0x7f42ba94ea92 in QObject::event(QEvent*) (/usr/lib/libQt5Core.so.5+0x2b0a92)
        #5 0x7f42bb6218ea in QWidget::event(QEvent*) (/usr/lib/libQt5Widgets.so.5+0x1948ea)
        #6 0x7f42bb71c16d in QFrame::event(QEvent*) (/usr/lib/libQt5Widgets.so.5+0x28f16d)
        #7 0x7f42bb5df62b in QApplicationPrivate::notify_helper(QObject*, QEvent*) (/usr/lib/libQt5Widgets.so.5+0x15262b)
        #8 0x7f42bb5e4d0f in QApplication::notify(QObject*, QEvent*) (/usr/lib/libQt5Widgets.so.5+0x157d0f)
        #9 0x7f42ba91d57a in QCoreApplication::notifyInternal(QObject*, QEvent*) (/usr/lib/libQt5Core.so.5+0x27f57a)
        #10 0x7f42ba973b1c in QTimerInfoList::activateTimers() (/usr/lib/libQt5Core.so.5+0x2d5b1c)
        #11 0x7f42ba974020  (/usr/lib/libQt5Core.so.5+0x2d6020)
        #12 0x7f42cdde7a16 in g_main_context_dispatch (/usr/lib/libglib-2.0.so.0+0x49a16)
        #13 0x7f42cdde7c6f  (/usr/lib/libglib-2.0.so.0+0x49c6f)
        #14 0x7f42cdde7d1b in g_main_context_iteration (/usr/lib/libglib-2.0.so.0+0x49d1b)
        #15 0x7f42ba974cfe in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (/usr/lib/libQt5Core.so.5+0x2d6cfe)
        #16 0x56c8ba in main_window_update wireshark-qt.cpp:128
        #17 0xe4b612 in sync_pipe_open_command capchild/capture_sync.c:972
        #18 0xe4b823 in sync_pipe_run_command_actual capchild/capture_sync.c:1034
        #19 0xe4c590 in sync_pipe_run_command capchild/capture_sync.c:1211
        #20 0xe4e9a5 in sync_if_capabilities_open capchild/capture_sync.c:1356
        #21 0xe48b7a in capture_get_if_capabilities capchild/capture_ifinfo.c:249
        #22 0xdf539a in scan_local_interfaces ui/iface_lists.c:186
        #23 0xdf6a65 in fill_in_local_interfaces ui/iface_lists.c:405
        #24 0x56e49d in main wireshark-qt.cpp:1154
        #25 0x7f42b81c178f in __libc_start_main (/usr/lib/libc.so.6+0x2078f)
        #26 0x56ba58 in _start (wireshark+0x56ba58)

    AddressSanitizer can not describe address in more detail (wild memory access suspected).
    SUMMARY: AddressSanitizer: bad-free /build/gcc-multilib/src/gcc-5-20150519/libsanitizer/asan/asan_malloc_linux.cc:28 __interceptor_free

Change-Id: I63744261096b3cfd0eddcf75bcf85103a3f0788d
Reviewed-on: https://code.wireshark.org/review/9220
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2015-06-29 22:48:33 +00:00
Gerald Combs ece4b01f21 Add the wireless toolbar.
Add the wireless toolbar to the Qt UI.

Start adding AirPcap support to ui/80211_utils. Add FCS validation
routines to ws80211_utils.

Move a bunch of AirPcap routines that require epan from caputils to
ui/gtk. They were required for driver key management, which we'll
leave to the AirPcap Control Panel in the Qt UI.

Move frequency-utils to wsutil.

Change-Id: I44446758046621d183f5c2ba9f6526bf01e084f1
Reviewed-on: https://code.wireshark.org/review/8910
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-06-16 03:45:54 +00:00