aboutsummaryrefslogtreecommitdiffstats
path: root/extcap.h
AgeCommit message (Collapse)AuthorFilesLines
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>
2017-11-09Start using SPDX license identifiers.Gerald Combs1-13/+1
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-08-31extcap: fix parameters save in preferences filePascal Quantin1-3/+0
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-28extcap: Interface Toolbar support on WindowsHåkon Øye Amundsen1-4/+4
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-23extcap: Create unique pipe names for each interfaceStig Bjørlykke1-7/+3
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-05-30Qt: Add support to verify extcap capture filterMichael Mann1-0/+16
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-04-25Qt: Add interface toolbar supportStig Bjørlykke1-1/+6
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-03-04extcap: Minor improvementsRoland Knall1-0/+7
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-02-22extcap: Reduce number of scans and storageRoland Knall1-2/+8
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-01-04Include extcap binaries in the count of things to point out during startup.Guy Harris1-0/+4
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>
2016-09-12Remove unnecessary extcap_cleanup() declaration.Guy Harris1-4/+0
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-12extcap: Fix misc memory leaks triggered by network interface changesMikael Kanstrup1-0/+9
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-11extcap: fix use-after-free for preferencesPeter Wu1-0/+4
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-07extcap: Add tool-specified helppageRoland Knall1-0/+4
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-07-30extcap: Use stderr to print error messageRoland Knall1-3/+1
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-29extcap: Restore functionality for optionsRoland Knall1-4/+15
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-03-21Fix building without extcap enabledJoão Valverde1-4/+0
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-02-27Replace extcap_interface_list() with append_extcap_interface_list().Guy Harris1-2/+2
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-27Put the extcap interfaces at the *end* of the interface list.Guy Harris1-3/+3
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-11extcap: Convert settings to preference friendly key namesMikael Kanstrup1-0/+3
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-01extcap: Add Save functionality to options dialogRoland Knall1-0/+4
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-01-28extcap: Cleanup complex types and add save optionRoland Knall1-0/+4
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-15extcap: Add list of extcaps to about dialogRoland Knall1-0/+10
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-12extcap: Sort extcap interfaces alphabeticallyRoland Knall1-1/+1
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-05extcap: Add regular expression validation supportRoland Knall1-1/+1
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>
2015-11-05extcap: Provide capture filter to extcap binaryStig Bjørlykke1-0/+1
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-05-05extcap: Implement QT extcap optionsRoland Knall1-0/+11
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-04-13dumpcap: fix opening of pipes on Windows broken since gbed29afPascal Quantin1-0/+3
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>
2014-10-06Convert "4 space tabs" to spaces; Adjust editor modelines.Bill Meier1-10/+10
Change-Id: I8d61d959c79e6aa9875c58680c54a331d18079cc Reviewed-on: https://code.wireshark.org/review/4504 Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-08-24Modify includes of config.h so that out-of-tree builds, i.e. CMakeGraham Bloice1-1/+1
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-21Extcap Capture InterfaceRoland Knall1-0/+90
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>