Commit Graph

114 Commits

Author SHA1 Message Date
Guy Harris 99242affde Revert "Pass all arguments to options as --option=argument."
This reverts commit 137d45f52c.

Don't. Make. The. Argument. To. Your. Extcap. Program. Specific.
Options. Optional. (Unless they're Boolean, in which case we never
pass an argument - we just pass the option if it's true and don't
pass it if it's false.)

Change-Id: I11e4ecaa196fd94c493d51e1f73e90267e1d9b1d
Reviewed-on: https://code.wireshark.org/review/28866
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-07-26 21:43:24 +00:00
Guy Harris 137d45f52c Pass all arguments to options as --option=argument.
For options with optional arguments, the only syntax that's *guaranteed*
to be handled by getopt_long() is --option=argument, not --option
argument.  The BSD/macOS version of getopt_long() only supports the
former, not the latter.

Change-Id: Icfaec9eda49f5a947961251ebd377d7c1684c823
Reviewed-on: https://code.wireshark.org/review/28865
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-07-26 21:29:22 +00:00
Stig Bjørlykke 26be931810 extcap: Fix a potential leak of memory pointed to by 'toolbar_entry'
Initialize toolbar_entry after error checking is done to avoid a
potential memory leak when exiting early from cb_load_interfaces().

Change-Id: I925d9296085964c6d5c3a9ccae85137285bf9220
Reviewed-on: https://code.wireshark.org/review/28060
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2018-06-06 12:39:17 +00:00
Guy Harris d08d0a87c5 Eliminate some unneeded header checks.
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-16 22:03:09 +00:00
Pascal Quantin ac1c1c3e58 extcap.c: fix compilation with gcc 8
extcap.c:228:37: error: cast between incompatible function types from ‘void (*)(iface_toolbar_value *)’ {aka ‘void (*)(struct _iface_toolbar_value *)’} to ‘void (*)(void *, void *)’ [-Werror=cast-function-type]
extcap.c:246:39: error: cast between incompatible function types from ‘void (*)(iface_toolbar_control *)’ {aka ‘void (*)(struct _iface_toolbar_control *)’} to ‘void (*)(void *, void *)’ [-Werror=cast-function-type]
extcap.c:521:32: error: cast between incompatible function types from ‘void (*)(void *)’ to ‘void (*)(void *, void *)’ [-Werror=cast-function-type]
extcap.c:1440:35: error: cast between incompatible function types from ‘void (*)(void *)’ to ‘void (*)(void *, void *)’ [-Werror=cast-function-type]

Change-Id: I2422e9b59c288907882c9ffd57cbae12011f7832
Reviewed-on: https://code.wireshark.org/review/27264
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-05-02 19:33:30 +00:00
Anders bb81bef535 glib: Get rid of GLIB_CHECK_VERSION as we now require 2.32.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-04-16 16:07:46 +00:00
Stig Bjørlykke 89904b6133 extcap: Fix crash in extcap_verify_capture_filter
This fixes a regression issue from g57fed5d1 when freeing the
arguments passed to extcap.

Change-Id: Ic4d6a129569f9e691fd2608e0229342b8b5e9783
Reviewed-on: https://code.wireshark.org/review/26870
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2018-04-11 07:28:17 +00:00
Stig Bjørlykke 1549cc122c extcap: Fix whitespace issues
Change-Id: I70066077a55b094eb2e667d31190ae80c3b97b5f
Reviewed-on: https://code.wireshark.org/review/26871
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2018-04-11 07:27:43 +00:00
Stig Bjørlykke 5d1b5648fa extcap: Always use byte mode in pipes
The original PipeMode parameter to CreateNamedPipe() was wrong but
when running gave a correct value. The changes in g00373a1f tried to fix
this parameter but this gave incorrect values.

Bug: 14532
Change-Id: Ia1e8e9ba54abfcc3bd0856fd715b7c69ee54ccfe
Reviewed-on: https://code.wireshark.org/review/26786
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2018-04-07 18:02:23 +00:00
Roland Knall 485cec5bdf extcap: Fix version request
The original implementation lead to multiple extcap interfaces
being loaded, as well as an error output from the default example.

This fixes both

Change-Id: Icb6fbda7bcb11ed0d14cb683ddcdabdc20a7070d
Reviewed-on: https://code.wireshark.org/review/26773
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2018-04-06 10:41:53 +00:00
Guy Harris 024f75fb3e Fix handling of --extcap-version with an argument.
Not all versions of getopt_long() allow, for an option for which the
argument is optional, --xyzzy {value}; at least some of them, such as
the *BSD/macOS one, require --xyzzy={value}.  Make it so.

Change-Id: I856d9f253535d804c7674d209054bc6ce10ee91d
Reviewed-on: https://code.wireshark.org/review/26772
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-04-06 05:06:18 +00:00
Roland Knall 6124ee2a1c extcap: Reload values on request
Allow certaing elements to be reloaded upon request. The way
this works is, certain elements can be configured to be reloadable.

By doing so, the extcap is asked once more just for the values
list of this item, together with all already set options, and
reloads the available options depending on the response.

Only supported for selector. Radio and Multiselect will need
additional patches, also moving those parts outside of extcap_argument.cpp
might make sense before hand.

Change-Id: I2e9e3d109b334bf878835a7cc9354f468bc22dee
Reviewed-on: https://code.wireshark.org/review/26223
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2018-04-05 09:31:23 +00:00
Roland Knall c2422d7828 extcap: Tell utilities the wireshark version
Add an optional argument to extcap-version, which tells the utilities
the wireshark version and therefore allows them to handle different
versions differently.

If no version is provided, the utility has to assume it is dealing
with a Wireshark 2.x version (default behavior).

Change-Id: I51658300f28f503ca8050d204b73749f1a54df16
Reviewed-on: https://code.wireshark.org/review/26752
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2018-04-05 08:40:04 +00:00
Roland Knall 57fed5d17f extcap: Move extcap_foreach to a GList
Allow for a higher flexibility of the arguments passed to extcap_foreach

Change-Id: I19708ac9d6c2aceecd88d0f691b5155bb8027675
Reviewed-on: https://code.wireshark.org/review/26736
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2018-04-04 18:08:43 +00:00
Gerald Combs 80d652f06e More spawned process handling updates.
Document ws_pipe.h. Define invalid PIDs in one place.

Extcap didn't use stdin before 1a0987904f. Make sure we close it.

Change-Id: I7a69cd9b5137ae82435e64628a22e4d812d58f89
Reviewed-on: https://code.wireshark.org/review/26226
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-03-02 18:07:58 +00:00
Gerald Combs 1a0987904f Generalize our process spawning code.
Move the contents of extcap_spawn to ws_pipe. Rename various extcap_*
prefixes to ws_pipe_*. Open stdin when we spawn processes.

Change-Id: I9286295443ee955bb6328b0ed6f945ee0bb2a798
Reviewed-on: https://code.wireshark.org/review/26216
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-03-02 05:22:20 +00:00
Guy Harris 00373a1fd4 Simplify the mode passed to CreateNamedPipe().
There's one mode you use if byte_mode is true, and another mode you use
if it's false.  My head hurts when I try to pretend to be a top-down
parser for C and feed myself the existing expression, and Visual Studio
Code Analyzer says "are you sure that's what you had in mind?", so I'm
guessing the modes are:

	byte mode: PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT
	not byte mode: PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT

and am just using one test of byte_mode to choose between them.

Put the entire function under an #ifdef, so we can mark the byte_mode
argument as unused on UN*X but not on Windows.

Change-Id: Ib2d0b80f870b1789c1375ccb017bd90e93dca5ce
Reviewed-on: https://code.wireshark.org/review/26201
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-03-01 04:05:03 +00:00
Dario Lombardo 8cd389e161 replace SPDX identifier GPL-2.0+ with GPL-2.0-or-later.
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-02-08 14:57:36 +00:00
Dario Lombardo df45d5b1ac extcap: check preference in extcap_ensure_interface().
Change-Id: I2b854b410e54b9f85ce26212d908c474f4611929
Reviewed-on: https://code.wireshark.org/review/25289
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-01-14 08:33:14 +00:00
Dario Lombardo 73f26e4d24 extcap: check preference in extcap_loaded_interfaces().
Change-Id: Ie1fd214eb8f9d55f1ce400b7227ad9887f05da76
Reviewed-on: https://code.wireshark.org/review/25286
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-01-14 08:33:02 +00:00
Dario Lombardo c1301a4862 extcap: add more checks for extcap disabled.
Change-Id: I914efbb4293518a8a3f8aaa8739c9915c63d941c
Reviewed-on: https://code.wireshark.org/review/25278
Petri-Dish: Roland Knall <rknall@gmail.com>
Reviewed-by: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-01-12 12:14:56 +00:00
Dario Lombardo 22b5ffad86 extcap: add preference to prevent interfaces loading.
Change-Id: Ia5865a40c75e582f28408a0515c5c0b38e43a916
Reviewed-on: https://code.wireshark.org/review/25188
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2018-01-09 09:58:48 +00:00
Guy Harris 6a949ed155 Put special pipe-handling code into libwsutil.
Ask, in a comment, why we're doing PeekNamedPipe() when we're trying
to read everyting in the pipe, up to the EOF, into a string.

On UN*X, do the same "read up to an EOF and then NUL-terminate the
result" stuff that we did on Windows; nothing guarantees that, on all
UN*Xes, in all circumstances, until the end of time, world without end,
amen, we can do one read and get the entire string.

Change-Id: I578802b23fec1051139eaefd9a09fe2a6de06a11
Reviewed-on: https://code.wireshark.org/review/24959
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-12-23 20:43:32 +00:00
Dario Lombardo 271d6c14ef extcap: null terminate the string that will be used in strlen (CID 1364684).
Change-Id: Ie4c7eed2ac24327292af9a45ffc7e4630338a6b4
Reviewed-on: https://code.wireshark.org/review/24948
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-12-23 01:31:31 +00:00
Michael Mann bb5ade02d5 NULL check some g_log statements for extcap.
"Yes, on *most* UN*Xes, that causes "(null)" to be printed, but it causes a crash on at
least some versions of Solaris, so Don't Do It." - Guy Harris

Bug: 14194
Change-Id: Iff0d59803d78b1e87a564e8bcdc5c84af485eea6
Reviewed-on: https://code.wireshark.org/review/24922
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-12-21 01:16:26 +00:00
Gerald Combs 775bbbcded Start using SPDX license identifiers.
A while back Graham pointed out the SPDX project (spdx.org), which is
working on standardizing license specifications:

https://www.wireshark.org/lists/wireshark-dev/201509/msg00119.html

Appendix V of the specification describes a short identifier
(SPDX-License-Identifier) that you can use in place of boilerplate in
your source files:

https://spdx.org/spdx-specification-21-web-version#h.twlc0ztnng3b

Start the conversion process with our top-level C and C++ files.

Change-Id: Iba1d835776714deb6285e2181e8ca17f95221878
Reviewed-on: https://code.wireshark.org/review/24302
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Balint Reczey <balint@balintreczey.hu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-11-09 20:03:51 +00:00
Pascal Quantin c199952f5c extcap: fix parameters save in preferences file
Since g583150198b, extcap_arg structures holds a pointer to the current
preference value. So let's not update its value outside of the prefs API
otherwise the call to prefs_set_string_value() with pref_current done
afterwards will never notify the change and the updated value will not
be written in the preference file.
Moreover update ExtcapArgument::resetValue() method to have an empty
string instead of a NULL pointer. Otherwise prefs_set_string_value()
will not notify the change and save the restored default value in the
preference file either.

Change-Id: Ie70e79d471c75e25705c7654e420a7706ebc4032
Reviewed-on: https://code.wireshark.org/review/23308
Petri-Dish: Pascal Quantin <pascal.quantin@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>
2017-08-31 04:34:39 +00:00
Pascal Quantin fa8a6a3eee extcap: check that argument parameter is not null before adding it to command line
Without this test, we add an argument with an empty parameter

Bug: 14006
Change-Id: I7e5313f652691808735f54b533cf5a7f7adeeae1
Reviewed-on: https://code.wireshark.org/review/23271
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Dario Lombardo <lomato@gmail.com>
2017-08-29 07:44:28 +00:00
Mikael Kanstrup 3b16cc8b21 iface_lists: Access ifaces member by reference
Change access of ifaces elements from by val to by reference.
With this change unnecessary copying of the whole struct is avoided
but even more important is that elements no longer have to be
removed and inserted whenever data is updated.

This change aims to make it more clear that ifaces elements shall
never directly be removed from the array. Instead use function
capture_opts_del_iface

NOTE: Code for GTK UI not updated

Ping-Bug: 13864
Change-Id: I04b65d5ee36526b30d959b8e5a2a48a3c7c4f15b
Reviewed-on: https://code.wireshark.org/review/23204
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-08-28 14:43:13 +00:00
Håkon Øye Amundsen 018f6bff18 extcap: Interface Toolbar support on Windows
Add support for extcap control pipes on Windows.
Improved read loop in InterfaceToolbarReader.
Delay opening control pipes until extcap has opened the fifo pipe.
Make extcap_example.py work on Windows.

Bug: 13833
Change-Id: I4b47d25452637759b8a3be53be48eee5365bc0e4
Reviewed-on: https://code.wireshark.org/review/23211
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-08-28 05:48:01 +00:00
Stig Bjørlykke 4540195025 extcap: Create unique pipe names for each interface
On Windows the pipe names does not get random characters appended.
Add the interface name and pipe type to make it unique.

This partly fixes the issue with capturing from multiple extcap
interfaces on Windows.

Ping-Bug: 13653
Ping-Bug: 13833
Change-Id: I4290b37cf789bf77608993682a803aca29513d28
Reviewed-on: https://code.wireshark.org/review/23158
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-08-23 07:26:18 +00:00
Ahmad Fatoum aca55a29f7 Add hardware timestamping support
pcap provides a pcap_set_tstamp_type function, which can be used to request
hardware timestamps from a supporting kernel.

This patch adds support for aforementioned function as well as two new
command line options to dumpcap, wireshark and tshark:

    --list-time-stamp-types
                             List time stamp types supported for the interface
    --time-stamp-type <type>
                             Change the interface's timestamp method

Name choice mimics those used by tcpdump(1), which already supports this
feature. However, unlike tcpdump, we provide both options unconditionally.
If Wireshark was configured without pcap_set_tstamp_type being available,
--list-time-stamp-types reports an empty list.

Change-Id: I418a4b2b84cb01949cd262aad0ad8427f5ac0652
Signed-off-by: Ahmad Fatoum <ahmad.fatoum@siemens.com>
Reviewed-on: https://code.wireshark.org/review/23113
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-08-22 07:55:26 +00:00
Dario Lombardo f49ae745c1 extcap: use options as they are shown in the dialog.
Bug: 13051
Change-Id: I287a4e1d529cc281aaae4a786010358c108d5f93
Reviewed-on: https://code.wireshark.org/review/22933
Petri-Dish: Roland Knall <rknall@gmail.com>
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-08-15 14:49:41 +00:00
Peter Wu 1c7e393af3 extcap: another round of memory leak fixes
Fix assorted memory leaks. Note that _tool_for_ifname is cleaned up at
exit by extcap_cleanup, but lacked key/value destructors, so add them.
After this, ASAN reports no more extcap memleaks.

Change-Id: Ie5f4b1e2453a0beb52d617670202973839ca1416
Reviewed-on: https://code.wireshark.org/review/22466
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-06-30 05:47:54 +00:00
Michael Mann 6c44f2017c Qt: Add support to verify extcap capture filter
Bug: 11668
Change-Id: Ib218d87c1905e53ffdab4e3dd6f93ba2c3d07c8b
Reviewed-on: https://code.wireshark.org/review/21770
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Roland Knall <rknall@gmail.com>
2017-05-30 18:10:03 +00:00
Martin Mathieson e0ab0b72ae Extcap: use glib-compat for g_list_free_full()
Change-Id: I13e6a465b0e169f2f4ce134df3c873c416737b33
Reviewed-on: https://code.wireshark.org/review/21476
Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-05-03 18:56:22 +00:00
Martin Kaiser acdc0a0230 extcap_free_interface_info: data param is used
The data parameter is used, remove the _U_ qualifier.

Change-Id: I3a3935bae958103da1a7a1abe0636e4781424aa7
Reviewed-on: https://code.wireshark.org/review/21408
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
2017-04-29 12:04:31 +00:00
Stig Bjørlykke 77751c94f1 Qt: Add interface toolbar support
An extcap utility can provide configuration for controls to use in a
GUI interface toolbar.  This controls are bidirectional and can be
used to control the extcap utility while capturing.

This is useful in scenarios where configuration can be done based on
findings in the capture process, setting temporary values or give other
inputs without restarting current capture.

Todo:
- Add support for Windows

Change-Id: Ie15fa67f92eb27d8b73df6bb36f66b9a7d81932d
Reviewed-on: https://code.wireshark.org/review/19982
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2017-04-25 06:19:39 +00:00
Max Dmitrichenko 9e8bc9fee8 extcap: fix memory leak
found by valgrind

Change-Id: I8c5226a08be797ce72ec937138a6681d946fb13c
Reviewed-on: https://code.wireshark.org/review/20720
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Roland Knall <rknall@gmail.com>
2017-04-19 22:32:58 +00:00
Guy Harris bd3196b094 Don't waste time trying to run non-plain file and non-executable files.
Directories, and non-executable files, aren't going to be extcap
executables.

This may not make much of a difference for an installed version of
Wireshark, but it makes a difference if you're running from the build
directory.

Change-Id: Ib9953fa04392dc7a8420ddf28bab9726e6050c12
Reviewed-on: https://code.wireshark.org/review/20752
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-03-27 19:51:26 +00:00
Roland Knall ee9b998d64 extcap: Minor improvements
Add method for searching for tools by ifname and minor improvements
in the interface callback to save time and space

Change-Id: I0073c96fbee846cc5ff6304823fa14564ff36c22
Reviewed-on: https://code.wireshark.org/review/20376
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Roland Knall <rknall@gmail.com>
2017-03-04 07:32:25 +00:00
Roland Knall 1d31986e8d extcap: Create callback structure
To ease development of callbacks and new parameters,
move all parameters for the callback methods to a
struct

Change-Id: I160277acf4d0473897172124f7c7aa744718da9c
Reviewed-on: https://code.wireshark.org/review/20316
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Roland Knall <rknall@gmail.com>
2017-03-01 12:50:01 +00:00
Dario Lombardo 8851c1c56e extcap: remove leak in interface lists.
Change-Id: Ib57292afc88cd32736b78a901385cfdde84c46c9
Reviewed-on: https://code.wireshark.org/review/20297
Reviewed-by: Roland Knall <rknall@gmail.com>
Petri-Dish: Roland Knall <rknall@gmail.com>
Reviewed-by: Dario Lombardo <lomato@gmail.com>
2017-02-27 13:25:59 +00:00
Roland Knall 6dce310305 extcap: Reduce number of scans and storage
Reduce the number of storage arrays and the number
of necessary loads. Also include cleaner methods for
reloading the interfaces and cleanly reload if asked by
the overall system

Change-Id: I529465ec2593d40c955c6cdeaf3a85e3021c0596
Reviewed-on: https://code.wireshark.org/review/20230
Petri-Dish: Roland Knall <rknall@gmail.com>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Reviewed-by: Roland Knall <rknall@gmail.com>
2017-02-22 13:40:33 +00:00
Dario Lombardo 3481ca8733 extcap: destroy hash tables on exit.
Change-Id: Ia6a1d8a45c36aff7f2bea8bde2ed5f308bddd2e1
Reviewed-on: https://code.wireshark.org/review/19919
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: Roland Knall <rknall@gmail.com>
2017-02-03 11:19:15 +00:00
Michael Mann 21a3b8cc71 Internalize struct preference
Move "struct preference" into prefs.c, essentially creating a "private"
structure to handle preferences. The 2 motivating factors were:
1. Better memory management so that clients/users of API don't have to worry
about it.
2. Hide the ugliness of the union stuff and make it transparent to the API.

A few bugs related to preference <-> Decode As integration were fixed
while in the neighborhood.

Change-Id: I509b9a236235d066b139c98222b701475e0ed365
Reviewed-on: https://code.wireshark.org/review/19578
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-01-22 10:43:57 +00:00
Michael Mann 4b3b3f5877 Extcap: Restore previously created preference from hash table, not preference pointer
Change-Id: Ie68a5c6c193f362e78d4f4b1f20edf7747e2313f
Reviewed-on: https://code.wireshark.org/review/19614
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Roland Knall <rknall@gmail.com>
2017-01-12 13:33:49 +00:00
Guy Harris 26430ff647 Include extcap binaries in the count of things to point out during startup.
The GTK+ version, at least, crashes if there are more "doing XXX..."
items put up than the calculated count, so, now that we're putting up
items for extcap binaries, we need to count the extcap binaries.

Clean up some stuff we found doing this (indentation, a _U_ on something
that's used).

Change-Id: I1f88042b64ce4b9ae352de37689677c694e3770b
Reviewed-on: https://code.wireshark.org/review/19549
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-01-04 22:10:48 +00:00
Stig Bjørlykke 07ffcf9042 extcap: Avoid double free of help.
Avoid double free of help when having multiple extcap interfaces.

Ping-Bug: 13218
Change-Id: I6a0d6afd645787f9814c02e84079b4e8763d05f1
Reviewed-on: https://code.wireshark.org/review/19261
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Reviewed-by: Dario Lombardo <lomato@gmail.com>
2016-12-14 14:35:30 +00:00
Dario Lombardo 1c2d224647 extcap: set help for interfaces.
The help statement is in the first sentence, while interfaces are
in others. We need to keep state of it.

Ping-Bug: 13218
Change-Id: Iad1d403d5e8bc34e2489daaa3b14d469d5ee5b5b
Reviewed-on: https://code.wireshark.org/review/19148
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Roland Knall <rknall@gmail.com>
2016-12-14 10:12:43 +00:00