Commit Graph

92 Commits

Author SHA1 Message Date
Bill Meier 1b8b2a8aa8 Add editor modelines; Adjust whitespace as needed.
Change-Id: I4da7b335d905dbca10bbce03aa88e1cdeeb1f8ad
Reviewed-on: https://code.wireshark.org/review/4626
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-10-12 18:58:32 +00:00
Tomasz Moń 20795925ff Update capture_opts in extcap_cleanup().
This fixes redundant extcap_pid handle close that could occur in
capture_opts_del_iface() which resulted in unhandled exception on
Windows.

Change-Id: I06b680fcb65cd6fd854a25fb1b01248dce3251a1
Reviewed-on: https://code.wireshark.org/review/4447
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Roland Knall <rknall@gmail.com>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2014-10-04 11:17:01 +00:00
Tomasz Moń 06926aed88 Wait for extcap to connect to pipe on Windows.
This prevents dumpcap from failing with timeout exceeded error message
with some extcaps (especially those that display UAC screen) by making
sure that extcap connects to pipe before dumpcap is even started.

Change-Id: I549da9217c7f4ae89509330ca4fa613a119a9523
Reviewed-on: https://code.wireshark.org/review/4428
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Roland Knall <rknall@gmail.com>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2014-10-04 11:12: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
Guy Harris 35b4487538 Handle empty interface lists when the list changes.
Don't assume that a change to the interface list is from a non-empty
interface list to a different non-empty interface list.

Change-Id: I94054ca0cf2661704aff1869385aa2155c19677d
Reviewed-on: https://code.wireshark.org/review/3193
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-07-25 03:00:43 +00:00
Graham Bloice e11db2ea03 Rename parameter if_index to stop clang warning:
capture_opts.c:1017:61: error: declaration of 'index' shadows a global declaration [-Werror=shadow]

Change-Id: Ie409b4fa7abeb85e460bea398735cdc98d9034b1
Reviewed-on: https://code.wireshark.org/review/3041
Reviewed-by: Graham Bloice <graham.bloice@trihedral.com>
2014-07-14 14:25:36 +00:00
Martin Kaiser 55733ea170 fix scan_local_interfaces()
when we delete an interface from all_ifaces, delete it from ifaces as well
remove its selected status if it was selected

at the moment, an interface that was used for capturing before will
never be removed from the list of interfaces even if it becomes
unavailable as it remains in ifaces and will be re-added to all_ifaces
in scan_local_interfaces()

new helper function capture_opts_del_iface() to delete an entry from ifaces and
free all its components

Change-Id: Ie3271a7ed086367e511d3a971f3b68cfc014115d
Reviewed-on: https://code.wireshark.org/review/2965
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-07-12 14:06:03 +00:00
Irene Ruengeler c7b45d0a7d GTK Remote Capturing
Move the GTK files necessary for managing the recnet remote host from capture_dlg.c to recent.c in order to use them in QT, too.

Change-Id: I3f3fd31ce928162de08c6db7309ef2a9b1e97760
Reviewed-on: https://code.wireshark.org/review/2955
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-07-11 04:29:46 +00:00
Martin Kaiser fdc7e5af28 better description of ifaces and all_ifaces
Change-Id: I148beb52574b0f7d990722901b72653c71026cb8
Reviewed-on: https://code.wireshark.org/review/2939
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
Tested-by: Martin Kaiser <wireshark@kaiser.cx>
2014-07-08 13:26:40 +00:00
Guy Harris 9e6487f247 Move utility routines for capturing into a libcaputils static library.
Some of those routines are used only in dumpcap; others are used in
TShark and Wireshark as well.

Change-Id: I9d92483f2fcff57a7d8b6bf6bdf2870505d19fb7
Reviewed-on: https://code.wireshark.org/review/2841
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-07-04 07:25:26 +00:00
Guy Harris 213189ef9e Move the routines to talk to dumpcap into a static libcapchild.
This pulls some stuff out of the top-level directory, and means we don't
have to build them once for every program using them.

Change-Id: I37b31fed20f2d5c3563ecd2bae9fd86af70afff5
Reviewed-on: https://code.wireshark.org/review/2591
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-23 23:58:29 +00:00
Guy Harris b2622e1194 Move the "capture-comment" long option to LONGOPT_CAPTURE_COMMON.
Change-Id: I55884d48911de307cde52accfebbda69f2989526
Reviewed-on: https://code.wireshark.org/review/2505
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-20 23:43:41 +00:00
Guy Harris b3885a9387 Fix builds without pcap.
Change-Id: I6c67f9ea9d115a8396af0904ef9a73d2c528dcaa
Reviewed-on: https://code.wireshark.org/review/2498
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-20 21:51:34 +00:00
Guy Harris 85ad72c61b Add long names for -a, -b, and -p.
(The name for -p matches what's in the tcpdump trunk.)

Change-Id: If4f1824518aee1f0213f140d884db9c676dd15c4
Reviewed-on: https://code.wireshark.org/review/2497
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-20 21:48:10 +00:00
Guy Harris cc4710ac5f Also define LONGOPT_CAPTURE_COMMON as nothing if we don't have pcap.
While we're at it, simplify the #ifdefs and #defines in capture_opts.h -
don't do the same tests twice.

Change-Id: I2079167f31789470ef77120054d769d5914745e3
Reviewed-on: https://code.wireshark.org/review/2496
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-20 21:39:08 +00:00
Guy Harris 5537c53f37 "-d" isn't common to all capturing programs, it's dumpcap-specific.
Change-Id: I827615d45051c9d66407516b311d3de448de6d07
Reviewed-on: https://code.wireshark.org/review/2495
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-20 21:32:21 +00:00
Guy Harris 26bbee3fad Add some long options for capture short options.
The names match tcpdump trunk's names for the corresponding options.

Also have capture_opts.h provide a #define for the part of the short
option string that corresponds to the capture short options that all our
programs that take capture short options take (those are largely the
ones we have in common with tcpdump).

Change-Id: Ia209425959c801725850b56a7d63441ee99b5001
Reviewed-on: https://code.wireshark.org/review/2492
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-20 21:00:16 +00:00
Guy Harris 312ed10900 Add --help and --version long options.
Also, make the convention for long-only options be that their
case-statement values start at 128, so they avoid colliding with any
ASCII code points, including control characters.

Make the tables of long options "static const" while we're at it, and
get rid of unnecessary casts.

Change-Id: I55702a85e9bc078b1cd0f2803ebb68a710405bab
Reviewed-on: https://code.wireshark.org/review/2491
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-20 19:19:47 +00:00
Irene Ruengeler df8c4bf264 Capture Interfaces Dialog:
- allow to change the interface options in the table
- save the options to preferences when the dialog is left
- add a field for setting a capture filter for all selected interfaces
- add a "Compile BPF" button and a window to show the compiled filter output
- try to address Alexis' and Evan's comments

Change-Id: Ic1272e29183ec80e2d2f4b3e494c79dabe2c3b6f
Reviewed-on: https://code.wireshark.org/review/1946
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-06-12 05:54:59 +00:00
Alexis La Goutte 296591399f Remove all $Id$ from top of file
(Using sed : sed -i '/^ \* \$Id\$/,+1 d')

Fix manually some typo (in export_object_dicom.c and crc16-plain.c)

Change-Id: I4c1ae68d1c4afeace8cb195b53c715cf9e1227a8
Reviewed-on: https://code.wireshark.org/review/497
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-04 14:27:33 +00:00
Roland Knall 5f78d0f4f1 Fix ui/iface_lists.c - type attribute is not copied
temp is a clone of the local if_info, but the type
 attribute is not copied correctly

 Additionally, the if_type member is exposed via the 
 capture options

Change-Id: Id53f0dfd1e127921e1b89bbf78cb431ee257a96c
Reviewed-on: https://code.wireshark.org/review/404
Reviewed-by: Roland Knall <rknall@gmail.com>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-03-02 09:53:40 +00:00
Guy Harris 945d6d049c Add a comment about the "default options".
svn path=/trunk/; revision=53590
2013-11-26 02:25:20 +00:00
Michael Mann 36e13a4c55 Bugfix "Restart the running live capture" when using multiple files makes a long filename. Bug 2274 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=2274)
Yes this solution leaks memory, but I think the handful of bytes leaked is worth fixing this nuisance.  Won't backport until leak is fixed though.

svn path=/trunk/; revision=52793
2013-10-23 15:31:48 +00:00
Chris Maynard bc654875f0 Handle the 2GiB boundary case of the max filesize autostop condition properly so that we avoid overflow conditions and so that we ensure we don't capture more than 2GiB. Also, document the max filesize autostop value of 2GIB as well as indicating that it's truly GiB and not GB.
This fixes the problem reported on ask: http://ask.wireshark.org/questions/23891/wireshark-wont-run-with-multiple-capture-files

#BACKPORT(1.10) ... not sure about 1.8?

svn path=/trunk/; revision=51576
2013-08-29 18:15:13 +00:00
Martin Kaiser 6c5e16185d add --capture-comment to tshark
make sure that getopt() does not permute tshark's argv[] array

svn path=/trunk/; revision=51089
2013-08-01 20:57:47 +00:00
Guy Harris b50424fad8 Clean up indentation.
svn path=/trunk/; revision=50953
2013-07-27 21:23:19 +00:00
Martin Kaiser 82ea635aa6 command line option --capture-comment for dumpcap
svn path=/trunk/; revision=50945
2013-07-27 16:25:08 +00:00
Martin Kaiser e04a12af8c add capture_comment to the capture_options structure
svn path=/trunk/; revision=50943
2013-07-27 16:13:29 +00:00
Anders Broman 78e334b845 From Mike Garratt:
Friendly Names support causing unnecessary delay when Wireshark starts.

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8034

svn path=/trunk/; revision=49752
2013-06-04 04:36:19 +00:00
Guy Harris 8596d17d7f Pull the capture-session state information out of capture_opts and put
it into a separate capture_session structure.  capture_opts should
contain only user-specified option information (and stuff directly
derived from it, such as the "capturing from a pipe" flag).

svn path=/trunk/; revision=49493
2013-05-22 07:44:28 +00:00
Guy Harris 1ca63098ac Rename capture_opts_trim_iface() to
capture_opts_default_iface_if_necessary(), to reflect what it actually
does.

svn path=/trunk/; revision=49491
2013-05-22 04:49:31 +00:00
Guy Harris c1d34d4be6 On OS X, get the interface type from the System Configuration framework.
svn path=/trunk/; revision=49486
2013-05-22 01:19:18 +00:00
Irene Rüngeler 44e6a88b13 Add interface options preferences.
svn path=/trunk/; revision=48275
2013-03-13 12:38:08 +00:00
Irene Rüngeler cb42bc9fec Add buffersize and snap length to the preferences.
svn path=/trunk/; revision=48163
2013-03-07 09:16:55 +00:00
Jeff Morriss d0992bf8cd Add a #define for the default capture buffer size and use it.
svn path=/trunk/; revision=47942
2013-02-28 15:27:56 +00:00
Guy Harris d415d3d87c On error, have capture_opts_trim_iface() return the exit status that
should be used (on success, have it return 0).  Exit with that exit
status; if the problem is that we couldn't get the interface list or if
there are no interfaces in that list, return 2, as that's not a
command-line syntax error.

svn path=/trunk/; revision=46108
2012-11-21 17:14:54 +00:00
Anders Broman 28474fe8ef From Mike Garratt:
Friendly Names for interfaces on Windows

Notes on the changes the patch covers:
* if_info_t struct: addition of friendly_name
* Dumpcap Interface list format changes:
  + Win32: "dumpcap -D" shows friendly_name in place of descript if known
  + All: machine interface "dumpcap -D -Z none" includes friendly_name in the
list in addition to the existing parameters
* interface_options struct: addition of console_display_name
  + When an interface name is displayed in a console, it will typically be the
console_display_name (instead of name). 
  + console_display_name is used as the basis of the autogenerated temp
filenames
  + console_display_name is typically set to the friendly_name if known,
otherwise it is set to the interface name
* Enhancements to capture_opts_add_iface_opt() (the function which process -i
options).
  + Can now specify the interface using its name and friendly_name
  + Interface name matching is case insenstive
  + Name matching first attempts exact matching, then falls back to prefix
matching
    (e.g. dumpcap -i local)
  + Validates interface names, instead of blindly sending them off to
winpcap/libpcap
  + Interface specification by number is still supported.
* capture_opts_trim_iface() has been refactored:
  + Instead of repeating a decent chunk of the cost in
capture_opts_add_iface_opt(), it calls capture_opts_trim_iface() to specify the
interface.
* introduction of capture_win_ifnames.[ch] (windows only code)
  + Implements static function GetInterfaceFriendlyNameFromDeviceGuid() - a
windows version independant function to convert an interface guid into its
friendly name.  Uses published api functions on windows vista and higher, but
falls back to unpublished API functions on older windows releases.
  + void get_windows_interface_friendlyname(/* IN */ char
*interface_devicename, /* OUT */char **interface_friendlyname); - extracts the
GUID from the interface_devicename, then uses
GetInterfaceFriendlyNameFromDeviceGuid() to do the resolution
* Auto temp filename generation:
  + Now uses wireshark_pcapng_* or  wireshark_pcap_* depending on file format
  + Basis temp filename format on console_display_name
  + Win32: if console_display_name is a windows interface guid, extracts
numbers from GUID here (instead of in interface option processing) 

GUI CHANGES:
* Dialog that displays when you click the "Manage Interfaces" button (within
Capture Options dialog) has been renamed from "Add new interfaces" to
"Interface Management"
* ui/gtk/capture_dlg.c: new_interfaces_w variable renamed to
interface_management_w
* Win32: Local Interfaces tab on Interface Management dialog, shows includes
friendly name as far left column
* Interface Management dialog defaults to larger size on win32 - so it fits
without resizing local interfaces tab
* Interface Management dialog now saves preferences when you click the apply
button (local hidden interfaces was not persisting across restarts)
* Tweaks: "Interface Details" dialog (Interface list->Capture Interfaces ->
Details):
  + "Friendly Name" renamed to "NDIS Friendly Name"
  + Added "OS Friendly Name" to the top of the list
* Win32: The "Capture Interfaces" dialog now shows the friendly name instead of
device guid
* Welcome screen:
  + The height of the interface list scrollbox dynamically adjusts & updates to
the number visible interfaces.
    Up to 10 interfaces can be listed without a scroll bar, the minimum height
is for 2 interfaces. 
  + Win32: now shows just the Friendly Name if known - in place of
"Interfacename_Guid:(Description)"

svn path=/trunk/; revision=46083
2012-11-19 20:07:27 +00:00
Gerald Combs ff2977fdd6 It looks like we haven't inserted anything into the cap_settings_history
hash table since r40715. Remove it and its associated functions.

C++-ize iface_lists.h.

svn path=/trunk/; revision=44197
2012-08-01 23:35:18 +00:00
Jakub Zawadzki bf81b42e1e Update Free Software Foundation address.
(COPYING will be updated in next commit)

svn path=/trunk/; revision=43536
2012-06-28 22:56:06 +00:00
Guy Harris 7f5162352f scan_local_interfaces() isn't in capture_opts.c; don't declare it in
capture_opts.h.  (It arguably belongs somewhere other than in a file in
ui/gtk, but, if so, move it there, e.g. to something in ui.)

svn path=/trunk/; revision=41712
2012-03-21 06:31:39 +00:00
Guy Harris 3af7f28931 capture_opts_add_iface_opt() is not used outside capture_opts.c; make it
static.

svn path=/trunk/; revision=41494
2012-03-12 02:53:21 +00:00
Guy Harris 1a5e1acdf3 Actually, you only have monitor mode support if you have pcap_create() -
without pcap_create() and pcap_activate() you don't have any API to turn
it on.

svn path=/trunk/; revision=40725
2012-01-25 19:40:22 +00:00
Bill Meier 36209e8773 Fix error when building QtShark:
...\capture_opts.h(94) : error C2461: 'remote_host' : constructor syntax missing formal parameters


svn path=/trunk/; revision=40723
2012-01-25 18:03:50 +00:00
Michael Tüxen 14b1a44c0f Third try. This time pipes and stdin are supported and the
test scripts are passed.

Use a global list containing all interfaces and only change
properties of the entries when changes are made in the GUI.
Do not misuse the list of interfaces specified on the command
line anymore.

This patch does not provide any new functionality, it just
provides the base for future extensions like removing
remote interface, mulitple airpcap devices and multiple
pipes.

This patch was provided by Irene Ruengeler.

svn path=/trunk/; revision=40715
2012-01-25 13:04:32 +00:00
Michael Tüxen 4fece25e7f We need a 3rd try. (After learning how to run the testuite on Windows locally).
svn path=/trunk/; revision=40695
2012-01-24 17:12:56 +00:00
Michael Tüxen 08d6785412 Second try. This time pipes and stdin are supported.
Use a global list containing all interfaces and only change
properties of the entries when changes are made in the GUI.
Do not misuse the list of interfaces specified on the command
line anymore.

This patch does not provide any new functionality, it just
provides the base for future extensions like removing
remote interface, mulitple airpcap devices and multiple
pipes.

This patch was provided by Irene Ruengeler.


svn path=/trunk/; revision=40693
2012-01-24 16:05:26 +00:00
Gerald Combs 6b178bd415 Add 'extern "C"' wrappers and #include guards to various header files.
svn path=/trunk/; revision=40321
2011-12-29 00:08:47 +00:00
Michael Tüxen c219f2eea5 Back out infrastructure change. We missed supporting
stdin and pipes.




svn path=/trunk/; revision=39498
2011-10-20 19:44:40 +00:00
Michael Tüxen 95ae2fe13a Use a global list containing all interfaces and only change
properties of the entries when changes are made in the GUI.
Do not misuse the list of interfaces specified on the command
line anymore.

This patch does not provide any new functionality, it just
provides the base for future extensions like removing
remote interface, mulitple airpcap devices and multiple
pipes.

This patch was provided by Irene Ruengeler.

svn path=/trunk/; revision=39495
2011-10-20 18:17:54 +00:00
Michael Tüxen 421dafd2de Get rid of old non-interface specific settings which are now interface
specifc. This finalizes the change of the infrastructure.
This patch is based on work by Irene Ruengeler.

svn path=/trunk/; revision=37794
2011-06-27 00:09:03 +00:00