aboutsummaryrefslogtreecommitdiffstats
path: root/capture_opts.c
AgeCommit message (Collapse)AuthorFilesLines
2015-11-04Don't include stuff from libwireshark.Guy Harris1-3/+0
Dumpcap captures packets, and supports the usual capture options, so it needs this, but it does *not* link with libwireshark (deliberately, so that the libwireshark code isn't linked into a program that might run with special privileges), so we must not depend on anything in libwireshark. Change-Id: Id975fd6a83a4b2a493c67493e41e69b784a050aa Reviewed-on: https://code.wireshark.org/review/11546 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-04Don't include "file.h" if you don't need it.Guy Harris1-0/+2
It ends up dragging in libwireshark headers, which programs not linking with libwireshark shouldn't do. In particular, including <epan/address.h> causes some functions that refer to libwireshark functions to be defined if the compiler doesn't handle "static inline" the way GCC does, and you end up requiring libwireshark even though you shouldn't require it. Move plurality() to wsutil/str_util.h, so that non-libwireshark code can get it without include epan/packet.h. Fix includes as necessary. Change-Id: Ie4819719da4c2b349f61445112aa419e99b977d3 Reviewed-on: https://code.wireshark.org/review/11545 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-04-13Fix extcap interface capture with tsharkPascal Quantin1-2/+28
Extcap parameters must be saved when doing the interface number/name matching, otherwise extcap program is not launched and pipe is not created Change-Id: Iaa0c9ad145049ee6e7a285dfca904ceb0baf417f Reviewed-on: https://code.wireshark.org/review/8017 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-03-25Have a #define for whether the capture buffer size can be set.Guy Harris1-6/+6
It can be set if either 1) this is Windows (where we're assumed to be using WinPcap, which includes calls to set the buffer size) or 2) we have pcap_create() (in which case we also have pcap_set_buffer_size(), at least in a normal libpcap release). Use that rather than testing "defined(_WIN32) || defined(HAVE_PCAP_CREATE)"; that makes it a bit more obvious what's being tested. Change-Id: Id9f8455019d19206b04dd6820a748cb97ae5ad12 Reviewed-on: https://code.wireshark.org/review/7816 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-10-17Get rid of some no-longer-necessary casts.Guy Harris1-4/+4
g_ascii_isXXX() can be handed a char value safely; they won't try to use it as an index into a table before checking it. Change-Id: Icf80163fb5f9dccd0b97917e318b1db0bf3e0cf8 Reviewed-on: https://code.wireshark.org/review/4801 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-10-17Don't use ctype.h routines.Guy Harris1-5/+4
That avoids locale dependency and handles possibly-signed chars(which we weren't always doing before). Change-Id: I89e50678abb8c3e535081c92ca25bc1bab672c68 Reviewed-on: https://code.wireshark.org/review/4798 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-10-12Add editor modelines; Adjust whitespace as needed.Bill Meier1-223/+236
Change-Id: I4da7b335d905dbca10bbce03aa88e1cdeeb1f8ad Reviewed-on: https://code.wireshark.org/review/4626 Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-10-04Update capture_opts in extcap_cleanup().Tomasz Moń1-4/+4
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-08-26Extcap: prevent a GLib assert when interface_opts.extcap_args is NULLPascal Quantin1-1/+2
I was able to trigger it when trying to change the options of extcap_example.py interface Change-Id: I9ecff51d47b3ef6e178637b31d49af46a1928acd Reviewed-on: https://code.wireshark.org/review/3822 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.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/+36
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-07-22Get rid of NO_INTERFACES_FOUND - it's not an error.Guy Harris1-9/+3
It just means "pcap didn't give me any interfaces, and didn't report an error". Hopefully, in the future, there will be pcap APIs that distinguish between the (admittedly unlikely, these days) case of "there really *are* no interfaces on which *anybody* can capture" and "you don't have sufficient permission to capture", and we can report the latter as an error. (Given that pcap supports more than just "regular interfaces", though, there are cases where you don't have permission to capture on those but you have permission to capture raw USB traffic, for example, so perhaps what's really needed is per-interface indications of permissions.) Change-Id: I7b8abb0829e8502f5259c95e8af31655f79d36a1 Reviewed-on: https://code.wireshark.org/review/3169 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-07-14Rename parameter if_index to stop clang warning:Graham Bloice1-3/+3
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-12fix scan_local_interfaces()Martin Kaiser1-12/+23
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-04Move utility routines for capturing into a libcaputils static library.Guy Harris1-2/+3
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-06-30Move capture_ui_utils.[ch] to libui.Guy Harris1-1/+0
Change-Id: Id0f3d4d60a1acc7aa64fd3737b8f16df5bca4e5a Reviewed-on: https://code.wireshark.org/review/2708 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-29Move some more stuff into wsutil.Guy Harris1-2/+2
Move the routines to parse numerical command-line arguments there. Make cmdarg_err() and cmdarg_err_cont() routines in wsutil that just call routines specified by a call to cmdarg_err_init(), and have programs supply the appropriate routines to it. Change-Id: Ic24fc758c0e647f4ff49eb91673529bcb9587b01 Reviewed-on: https://code.wireshark.org/review/2704 Reviewed-by: Evan Huus <eapache@gmail.com> Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-24For capchild headers, include <capchild/XXX.h>.Guy Harris1-1/+1
Change-Id: I780c69ee637dcd9846756a2e2d6a35baf02d826d Reviewed-on: https://code.wireshark.org/review/2594 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-03-04Remove all $Id$ from top of fileAlexis La Goutte1-2/+0
(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-02Fix ui/iface_lists.c - type attribute is not copiedRoland Knall1-0/+3
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>
2013-12-03When including <epan/prefs.h> don't force inclusion of <epan/uat.h>Jakub Zawadzki1-0/+1
svn path=/trunk/; revision=53769
2013-12-02Specify SI units for the max filesize autostop condition. For now, keep the ↵Chris Maynard1-2/+2
capture buffer size in IEC units, but document it as such. #BACKPORT(1.10, 1.8(?)) svn path=/trunk/; revision=53728
2013-11-26Add a comment explaining what settingGuy Harris1-1/+1
capture_opts->default_options.linktype to -1 means. svn path=/trunk/; revision=53591
2013-10-23Bugfix "Restart the running live capture" when using multiple files makes a ↵Michael Mann1-0/+1
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-08-29Handle the 2GiB boundary case of the max filesize autostop condition ↵Chris Maynard1-2/+2
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-07-27only one --capture-comment option may be given to dumpcapMartin Kaiser1-0/+4
svn path=/trunk/; revision=50946
2013-07-27command line option --capture-comment for dumpcapMartin Kaiser1-0/+3
svn path=/trunk/; revision=50945
2013-07-27add capture_comment to the capture_options structureMartin Kaiser1-0/+1
svn path=/trunk/; revision=50943
2013-06-27forgot from the las commit...Luis Ontanon1-2/+2
svn path=/trunk/; revision=50191
2013-06-04From Mike Garratt:Anders Broman1-0/+6
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-05-22Pull the capture-session state information out of capture_opts and putGuy Harris1-19/+1
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-22Rename capture_opts_trim_iface() toGuy Harris1-2/+5
capture_opts_default_iface_if_necessary(), to reflect what it actually does. svn path=/trunk/; revision=49491
2013-05-13Don't fill in err_str if we're not going to use it.Guy Harris1-1/+1
(This helps flag capture_interface_list() calls that should perhaps be checked to see whether an error should be reported if they fail.) svn path=/trunk/; revision=49281
2013-05-13Eliminate some includes of ui/simple_dialog.h by files that don't useGuy Harris1-1/+0
anything from it. svn path=/trunk/; revision=49278
2013-04-25Send the output of the -D and -L options to the standard output ratherGuy Harris1-12/+11
than the standard error. In Wireshark on Windows, create a console before doing so and destroy it before exiting. Don't do that in TShark or dumpcap, as those are console-mode programs on Windows. This should fix bug 8609 and still allow "wireshark -D" and "wireshark -L" to work when the standard output isn't redirected. svn path=/trunk/; revision=49025
2013-03-13Add interface options preferences.Irene Rüngeler1-0/+1
svn path=/trunk/; revision=48275
2013-02-28Add a #define for the default capture buffer size and use it.Jeff Morriss1-1/+1
svn path=/trunk/; revision=47942
2013-02-27Increase the default buffer size to 2MB.Anders Broman1-1/+1
svn path=/trunk/; revision=47920
2012-12-26Fix a bunch of warnings.Guy Harris1-1/+1
Cast away some implicit 64-bit-to-32-bit conversion errors due to use of sizeof. Cast away some implicit 64-bit-to-32-bit conversion errors due to use of strtol() and strtoul(). Change some data types to avoid those implicit conversion warnings. When assigning a constant to a float, make sure the constant isn't a double, by appending "f" to the constant. Constify a bunch of variables, parameters, and return values to eliminate warnings due to strings being given const qualifiers. Cast away those warnings in some cases where an API we don't control forces us to do so. Enable a bunch of additional warnings by default. Note why at least some of the other warnings aren't enabled. randpkt.c and text2pcap.c are used to build programs, so they don't need to be in EXTRA_DIST. If the user specifies --enable-warnings-as-errors, add -Werror *even if the user specified --enable-extra-gcc-flags; assume they know what they're doing and are willing to have the compile fail due to the extra GCC warnings being treated as errors. svn path=/trunk/; revision=46748
2012-12-12Make the "-g" argument to tshark actually work (by passing it to dumpcap).Jeff Morriss1-7/+11
svn path=/trunk/; revision=46515
2012-11-22On UN*X, if an interface has a description, use it as the "friendlyGuy Harris1-5/+5
name". If it doesn't have a description, on OS X, use the System Configuration framework to attempt to get a "friendly name" for interfaces. If a loopback device doesn't have a friendly name, give it "Loopback" as the friendly name. Move the "turn a CFString into a mallocated C string" routine into common code, as it's used in more than one place. svn path=/trunk/; revision=46131
2012-11-21In capture_opts_add_iface_opt(), only *require* us to get the interfaceGuy Harris1-75/+88
list if the user specified a number; otherwise, if we couldn't get the list, just use what the user specified, so they can specify interfaces in order to test them to see why they're not showing up in the list. svn path=/trunk/; revision=46112
2012-11-21If we don't find the specified interface name in the list, use itGuy Harris1-3/+11
anyway, so that, for example, if an interface doesn't show up in the list for some reason, the user can try specifying it explicitly for testing purposes. svn path=/trunk/; revision=46109
2012-11-21On error, have capture_opts_trim_iface() return the exit status thatGuy Harris1-15/+11
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-20We don't use get_windows_interface_friendlyname() in capture_opts.c, soGuy Harris1-32/+36
we don't need to include capture_win_ifnames.h. Clean up white space. svn path=/trunk/; revision=46095
2012-11-19Failure to find the interface should cause *shark to exit with a status of ↵Jeff Morriss1-1/+1
1, not 2. svn path=/trunk/; revision=46089
2012-11-19As suggested by Evan: just make the variable a size_t instead of casting ↵Jeff Morriss1-2/+2
away the warning. svn path=/trunk/; revision=46088
2012-11-19I'm pretty confident the string length will fit in 32 bits; cast away the ↵Jeff Morriss1-11/+11
"possible loss of data" warning on the Win64 build. svn path=/trunk/; revision=46087
2012-11-19From Mike Garratt:Anders Broman1-96/+124
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-09-20We always HAVE_CONFIG_H so don't bother checking whether we have it or not.Jeff Morriss1-3/+1
svn path=/trunk/; revision=45015