Commit Graph

46 Commits

Author SHA1 Message Date
j.novak@netsystem.cz 0c0f731c92 extcap: Fix of handling default values 2023-02-06 18:29:25 +00:00
Tomasz Moń d0a9de2af1
capture: Stop extcaps before dumpcap
Send SIGTERM on UNIX systems to all extcap processes when user requests
capture stop. Wait up to 30 seconds for extcaps to finish. If extcaps do
not finish in time, send SIGKILL to remaining extcaps.

Do not call TerminateProcess() on Windows in the same place where UNIX
SIGTERM is sent. Instead schedule extcap termination timeout to happen
as soon as control returns back to the event loop.

There is no universally agreed replacement for SIGTERM on Windows, so
just keep things simple (forcefully terminate like always) until we
have agreed on something.
2022-08-13 20:23:51 +02:00
Tomasz Moń 0bca2419d6
extcap: Do not drain stderr on process exit
Extcap child watch callback assumed that the stderr pipe is broken.
However the stdout and stderr pipes are not necessarily broken if the
child process spawned new processes that inherited standard handles.

Do not drain stderr in busy loop to prevent UI freeze. Stop capture
session only when all extcap watches are removed. Remove stdout and
stderr watches on capture stop timer (30 seconds) expiration, even if
the pipes are not broken.

Do not rely only on 0 bytes read to cease reading stdout and stderr.
Stop reading if the status is anything else than G_IO_STATUS_NORMAL
(especially it can be G_IO_STATUS_EOF).
2022-08-12 06:50:09 +02:00
Tomasz Moń c1861ad1cc
extcap: Close capture session after extcap finishes
Wait up to 30 seconds for extcap process to finish after closing pipes.
The wait is achieved in non-blocking fashion, i.e. the UI is completely
responsive during the wait. Only actions related to capture process like
capture control, file open, save, export are inactive during the wait.

On Windows extcap child watch callback gets called immediately as the
process is forcefully terminated. Prior to this change the extcap was
forcefully terminated on Windows anyway.

The wait is possible on UNIX systems if extcap does handle SIGPIPE and
SIGTERM signals. The defaults handlers for SIGPIPE and SIGTERM simply
terminate the process so for large number of extcaps there is no change.
If extcap does not finish within 30 seconds, it is forcefully terminated
using SIGKILL signal.
2022-08-10 06:18:15 +02:00
Moshe Kaplan fd5b5e3149 extcap: Add header files to Doxygen
Add @file markers for extcap
headers so that Doxygen will
generate documentation for them.
2021-11-30 08:29:39 +00:00
João Valverde 5f79503d67 Fix config.h include order
The header "config.h" needs to be the first header included in the
source file, no exceptions.
2021-09-20 20:16:52 +01:00
Alexis La Goutte 8ede837188 extcap(.h): fix empty paragraph passed to '@return' command [-Wdocumentation]
Change-Id: Icadc5fdf9a1e1eaed50e0199a9610c3dd84497e1
Reviewed-on: https://code.wireshark.org/review/37947
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-07-24 12:54:32 +00:00
Gerald Combs 9c53ac0187 extcap: Lazily load our interface list.
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-07 05:28:29 +00:00
Guy Harris 20800366dd HTTPS (almost) everywhere.
Change all wireshark.org URLs to use https.

Fix some broken links while we're at it.

Change-Id: I161bf8eeca43b8027605acea666032da86f5ea1c
Reviewed-on: https://code.wireshark.org/review/34089
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-07-26 18:44:40 +00:00
Tomasz Moń c0a49d7237 extcap: Do not use global pipe handle on Windows
Make extcap_create_pipe() static.

Change-Id: I06a0af2dcf9fb4a51b4f7ba6ee7c57e7a52c5e97
Reviewed-on: https://code.wireshark.org/review/33250
Petri-Dish: Pascal Quantin <pascal@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Pascal Quantin <pascal@wireshark.org>
2019-06-10 23:03:09 +00:00
Guy Harris 5dfde7ff83 Print extcap plugins with "tshark -G plugins".
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-26 21:53:20 +00:00
Peter Wu 6d9bc4bd65 extcap: discover interfaces in a parallel
Split interface discovery in three stages: discover available programs
(extcap_get_extcap_paths), obtain outputs for each (extcap_run_all) and
processing of the output (process_new_extcap). The second step is most
expensive, do it in parallel in multiple threads.

extcap_foreach used to call extcap_if_exists, but as "cb_info.ifname" is
always NULL for interface discovery, it would always pass. Remove this
check and all other unused functions.

This saves 100ms startup time on Linux with 7 extcap tools.

Change-Id: I511e491d3b23c0a7f2fe2447842e87a9bd75adbe
Ping-Bug: 15295
Reviewed-on: https://code.wireshark.org/review/30766
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-11-22 20:54:41 +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 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
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
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
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
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
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
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 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
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
Guy Harris f2d6d07498 Remove unnecessary extcap_cleanup() declaration.
That wasn't sufficient to avoid #ifdeffing calls to extcap_cleanup(), as
this header wasn't even being included if HAVE_EXTCAP wasn't defined,
hence change I18c855e13281013a6277c1f38eeac92e74d52b34 was necessary.

It's probably best that this not be included if HAVE_EXTCAP isn't
defined, so as to catch *other* references to functions etc. that aren't
available without extcap.

Change-Id: I5c4ad331b6df93bbbcd28ad3b9815e4cd226039a
Reviewed-on: https://code.wireshark.org/review/17666
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-09-12 16:45:49 +00:00
Mikael Kanstrup c64762d33c extcap: Fix misc memory leaks triggered by network interface changes
Valgrind reports plenty of misc memory leaks in extcap after the network
interface list has changed or is refreshed. Errors can be seen by
starting Wireshark with Valgrind's memcheck tool and bringing a network
interface up and down a few times with:

ifconfig eth0 up
ifconfig eth0 down

Change-Id: I90f53847071854b7d02facb39b7a380732de79b4
Reviewed-on: https://code.wireshark.org/review/17606
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2016-09-12 12:13:41 +00:00
Peter Wu 583150198b extcap: fix use-after-free for preferences
In commit v2.3.0rc0-117-g485bc45 (backported to v2.2.0rc0-44-g66721ca),
extcap_prefs_dynamic_vals and extcap_cleanup were added in an attempt to
address dangling pointers.

Unfortunately it is not sufficient:

 - A pointer to the preference value is stored in extcap_arg and passed
   to the prefs API, but this extcap_arg structure can become invalid
   which result in use-after-free whenever the preference is accessed.
 - On exit, a use-after-free occurs in prefs_cleanup when the preference
   value is being checked.

As the preference subsystem actually manages the memory for the string
value and consumers should only provide a pointer where the value can be
stored, convert the char* field in extcap to char**. This has as
additional benefit that values are not limited to 256 bytes anymore.

extcap_cleanup is moved after epan_cleanup to ensure that prefs_cleanup
does not operate on dangling pointers.

Crash is reproducible under ASAN with: tshark -i randpkt

Ping-Bug: 12183
Change-Id: Ibf1ba1102a5633aa085dc278a12ffc05a4f4a34b
Reviewed-on: https://code.wireshark.org/review/17631
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Roland Knall <rknall@gmail.com>
2016-09-11 08:33:42 +00:00
Roland Knall ee1a4109cf extcap: Add tool-specified helppage
Allow the tool to provide a link to a helppage, displayed
by clicking on help in the configuration dialog.

The URL will be opened using an URL based service, therefore local
as well as remote URLs are possible.

Change-Id: I58b30244e97919d5cf6892faf96536ddc30fb5a7
Reviewed-on: https://code.wireshark.org/review/17549
Reviewed-by: Roland Knall <rknall@gmail.com>
2016-09-07 09:09:30 +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 52dd4fb633 Fix building without extcap enabled
Using cmake -DENABLE_EXTCAP=no or ./configure --without-extcap.

Some documentation fixes too.

Change-Id: Iebf9c843d67e10a32de1a62904de8f88b872ec99
Reviewed-on: https://code.wireshark.org/review/14522
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-03-21 17:10:21 +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
Mikael Kanstrup 7a1eca1726 extcap: Convert settings to preference friendly key names
Preferences are only allowed to contain lowercase ASCII letters,
numbers, underscores or dot characters. Create a utility function
to convert an extcap setting to its equivalent preference key and
use it wherever conversion from setting to preference key is needed.

Bug: 12064
Change-Id: I39bbac7de5f0f905bd41c54257fa997a3b32442d
Reviewed-on: https://code.wireshark.org/review/13687
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Roland Knall <rknall@gmail.com>
2016-02-11 06:40:16 +00:00
Roland Knall 927ffaa794 extcap: Add Save functionality to options dialog
This patch creates the functionality of saving all parameters
for extcap devices in the general preference section.

For now, multiselect and fileselect do not save their values
but patches for this will be provided in the future

Also, all preferences are stored as strings to make handling
easier. This might change in the future, but for the first version
it will stick.

Restore to Defaults is not implemented as of yet, and will be
in a future version, once the preference storing is finalized

Bug: 11666
Change-Id: I178346405146d2e43f4f3481c05c92c0b3595af5
Reviewed-on: https://code.wireshark.org/review/13451
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-02-01 12:12:41 +00:00
Roland Knall 97a1a50e20 extcap: Cleanup complex types and add save option
Cleanup handling of complex data types and use only
glib defined datatypes while handling argument values.

Add a save parameter, which (additionally) can set, that
a parameter is not saved in a configuration file. Passwords
are by default not saved, which may be overwritten using
this parameter

Change-Id: I67eff0f3286170f082d532e806a39511c40df647
Reviewed-on: https://code.wireshark.org/review/13573
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>
2016-01-28 14:51:14 +00:00
Roland Knall 75ff25f285 extcap: Add list of extcaps to about dialog
Adds the list of available extcaps to the plugin list in the
About dialog of Wireshark (Qt only). To do this, and additional
sentence is provided in the extcap arguments list, which allows
for additional information to be passed (as of right now, just
version and display is used)

Additionally, cleans up the code when using g_free.

Bug: 11683
Change-Id: I04a958e2b73c9a707ab1cb4f2fc8345833a854a9
Reviewed-on: https://code.wireshark.org/review/13224
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Reviewed-by: Roland Knall <rknall@gmail.com>
2016-01-15 11:30:39 +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
Roland Knall cfd5457ec0 extcap: Add regular expression validation support
Regular expressions follow the Qt Regex syntax, which is
 formulated after the Perl Regex syntax. A more detailed
 overview of the possible rules can be found at:
 http://doc.qt.io/qt-4.8/qregexp.html

 If a required option is present, even the double-click on
 the interface will first start the options dialog (Qt only)

 Required fields are marked bold and put first in the dialog.
 Additionally if validation failes (which it will if a required
 field is kept empty, but also if a non-required textfield is
 violating the defined regex), the label of the field is marked
 with red.

Change-Id: If04a1146d0dfa778332ab2a39122c7a6ee1e93d2
Reviewed-on: https://code.wireshark.org/review/12914
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>
2016-01-05 14:41:12 +00:00
Stig Bjørlykke 9c0d550a4a extcap: Provide capture filter to extcap binary
Added the option --extcap-capture-filter to extcap to send the capture filter
from the main screen to the extcap binary.

Change-Id: I75f0d7dbec810551225377f9221053298488cdd5
Reviewed-on: https://code.wireshark.org/review/11423
Reviewed-by: Roland Knall <rknall@gmail.com>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2015-11-05 07:42:35 +00:00
Roland Knall 5727ebe689 extcap: Implement QT extcap options
Implementing a button in the interface list, to bring up
 the extcap options dialog, as well as a dialog, which will
 be generated depending on the selected extcap options.

Change-Id: I1733dc6a8c1a121089a9c353aff10bc4a53e86de
Reviewed-on: https://code.wireshark.org/review/8224
Petri-Dish: Michal Labedzki <michal.labedzki@tieto.com>
Reviewed-by: Roland Knall <rknall@gmail.com>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2015-05-05 09:35:10 +00:00
Pascal Quantin 2e8d8e12cd dumpcap: fix opening of pipes on Windows broken since gbed29af
Previous code was assuming that all local pipes were of extcap type. Let's explicitly check for extcap prefix now.

Bug: 10803
Change-Id: If955e77a9ee2af11b553740269964c40273d5177
Reviewed-on: https://code.wireshark.org/review/8013
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>
2015-04-13 17:43:40 +00:00
Bill Meier 5051ae1cbe Convert "4 space tabs" to spaces; Adjust editor modelines.
Change-Id: I8d61d959c79e6aa9875c58680c54a331d18079cc
Reviewed-on: https://code.wireshark.org/review/4504
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-10-06 18:29:40 +00:00
Graham Bloice 97546165fa Modify includes of config.h so that out-of-tree builds, i.e. CMake
don't pick up the in-tree copy.

Change-Id: I7ec473876cdba1a025c52362d7f6adc62d24ce71
Reviewed-on: https://code.wireshark.org/review/3798
Petri-Dish: Graham Bloice <graham.bloice@trihedral.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Roland Knall <rknall@gmail.com>
Reviewed-by: Graham Bloice <graham.bloice@trihedral.com>
2014-08-24 08:04:08 +00:00
Roland Knall bed29af46d Extcap Capture Interface
Extcap is a plugin interface, which allows for the usage
 of external capture interfaces via pipes using a predefined
 configuration language which results in a graphical gui.

 This implementation seeks for a generic implementation,
 which results in a seamless integration with the current
 system, and does add all external interfaces as simple
 interfaces.

 Windows Note: Due to limitations with GTK and Windows,
 a gspawn-winXX-helper.exe, respective gspawn-winXX-helper-console.exe
 is needed, which is part of any GTK windows installation.

 The default installation directory from the build is an extcap
 subdirectory underneath the run directory. The folder used by
 extcap may be viewed in the folders tab of the about dialog.

 The default installation directory for extcap plugins with
 a pre-build or installer version of wireshark is the extcap
 subdirectory underneath the main wireshark directory.

 For more information see:

  http://youtu.be/Nn84T506SwU
  bug #9009

 Also take a look in doc/extcap_example.py for a Python-example
 and in extcap.pod for the arguments grammer.

 Todo:
   - Integrate with Qt - currently no GUI is generated, but
     the interfaces are still usable

Change-Id: I4f1239b2f1ebd8b2969f73af137915f5be1ce50f
Signed-off-by: Mike Ryan <mikeryan+wireshark@lacklustre.net>
Signed-off-by: Mike Kershaw <dragorn@kismetwireless.net>
Signed-off-by: Roland Knall <rknall@gmail.com>
Reviewed-on: https://code.wireshark.org/review/359
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-08-21 03:34:02 +00:00