aboutsummaryrefslogtreecommitdiffstats
path: root/caputils
AgeCommit message (Collapse)AuthorFilesLines
2017-06-05Allow bigger snapshot lengths for D-Bus captures.Guy Harris1-8/+8
Use WTAP_MAX_PACKET_SIZE_STANDARD, set to 256KB, for everything except for D-Bus captures. Use WTAP_MAX_PACKET_SIZE_DBUS, set to 128MB, for them, because that's the largest possible D-Bus message size. See https://bugs.freedesktop.org/show_bug.cgi?id=100220 for an example of the problems caused by limiting the snapshot length to 256KB for D-Bus. Have a snapshot length of 0 in a capture_file structure mean "there is no snapshot length for the file"; we don't need the has_snap field in that case, a value of 0 mean "no, we don't have a snapshot length". In dumpcap, start out with a pipe buffer size of 2KB, and grow it as necessary. When checking for a too-big packet from a pipe, check against the appropriate maximum - 128MB for DLT_DBUS, 256KB for everything else. Change-Id: Ib2ce7a0cf37b971fbc0318024fd011e18add8b20 Reviewed-on: https://code.wireshark.org/review/21952 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-06-03capture-pcap-util.c: fix a typoPascal Quantin1-1/+1
Change-Id: I674d02be665afc331e266725c0a0cbc0a33d9403 Reviewed-on: https://code.wireshark.org/review/21926 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2017-06-03Fix typo.Guy Harris1-1/+1
Change-Id: If4ac286fed29635ec085f9671c77abf6ed22766d Reviewed-on: https://code.wireshark.org/review/21919 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-06-03If has_snaplen isn't set, don't set the snapshot length with ↵Guy Harris1-9/+34
pcap_create()/pcap_activate(). Just let libpcap pick the snapshot length; that way, for link-layer types that need a really large snapshot length, such as D-Bus (which requires 128MB for the largest messages), it can pick that, but can otherwise pick something that doesn't require as much memory, e.g. 256KB. For pcap_open_live() and pcap_open(), which don't have a way of saying "give me what's appropriate", pick 256KB. Change-Id: Idef5694f7dfa85eaf3a61d6ca7a17d263c417431 Reviewed-on: https://code.wireshark.org/review/21917 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-05-12Include caputils/capture-wpcap.h whether HAVE_LIBPCAP is defined or not.Guy Harris1-1/+2
It declares what's defined here, so always include it. Change-Id: I1d7d5ed071e6f2d53af9ff147ede18b05b98ecd1 Reviewed-on: https://code.wireshark.org/review/21616 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-05-12Don't include headers that depend on pcap if you don't have it.Guy Harris1-5/+5
Change-Id: I17234ef60411f922678b900a6ac4fb264b9ce431 Reviewed-on: https://code.wireshark.org/review/21614 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-05-11Put the HAVE_REMOTE hack into wsutil/wspcap.h, and include that file.Guy Harris3-39/+3
Have a header file that defines HAVE_REMOTE if HAVE_PCAP_REMOTE is defined, and then includes pcap.h. Replace all other includes of pcap.h, and the definition of HAVE_REMOTE, with includes of that file. Check for anything other than wspcap.h including pcap.h in checkAPIs.pl. Change-Id: I3cbee8208944ad6f006f568b3fe3134e10b2a883 Reviewed-on: https://code.wireshark.org/review/21605 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-05-11Force HAVE_REMOTE to be defined when including pcap.h with remote support.Guy Harris3-0/+36
WinPcap made the mistake of having stuff in its public header fines depend on a configuration #define, HAVE_REMOTE; this means that we need to forcibly define it when building with remote capture support. The tip of the libpcap master branch does not have that botch; hopefully future versions of libpcap-for-Windows will be based on that libpcap and thus lack that botch as well. Defining HAVE_REMOTE in config.h is not the right fix, as it makes it look like a *Wireshark* configuration option that code in Wireshark should test, rather than a *WinPcap* configuration option that the pcap.h that ships with the WinPcap SDK should have been changed, as part of the build process, to correctly define or not, so that users of WinPcap don't have to define it themselves. Change-Id: I62d1eca6d3c900d0dcc9fbc011db77f595a86313 Reviewed-on: https://code.wireshark.org/review/21593 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-05-11Note whether we found remote pcap support in libpcap.Guy Harris1-0/+6
Change-Id: Ida20f7164d3132a72fdd6547905cd0af4e451917 Reviewed-on: https://code.wireshark.org/review/21590 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-04-05A bunch of "{Mac} OS X" -> "macOS" changes.Guy Harris4-6/+6
Avoid anachronisms, however; there was no "macOS 10.0" or even "OS X 10.0", for example. It was "Mac OS X" until 10.8 (although 10.7 was sometimes called "OS X" and sometimes called "Mac OS X"), and it was "OS X" from 10.8 to 10.11. Change-Id: Ie4a848997dcc6c45c2245c1fb84ec526032375c3 Reviewed-on: https://code.wireshark.org/review/20933 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-03-07Don't close the pcap_t in get_data_link_types().Guy Harris1-4/+14
1) Its caller closes it, and closing a closed pcap_t can cause Bad Things to happen. 2) We're trying to get an error string from it after we're closing it, which won't work well, either. While we're at it, don't use pcap_statustostr() if we don't have it (we have it iff we have pcap_create()). Change-Id: Ieded1e3ae78aea4e0970cf582e780c2846fe9dd5 Reviewed-on: https://code.wireshark.org/review/20443 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-02-22g_malloc -> g_malloc0 where not all struct elements are initialized orJoerg Mayer2-3/+2
when combined with memset. Change-Id: I5148a65bee6d4d00c140113ffb1e228adefae93f Reviewed-on: https://code.wireshark.org/review/20251 Reviewed-by: Jörg Mayer <jmayer@loplof.de>
2017-02-22Clean up the get_if_capabilities_ routines a bit.Guy Harris1-20/+9
Allocate the interface capabilities structure only if we succeed in getting a pcap_t handle for it. For remote devices, explicitly set caps->can_set_rfmon and caps->data_link_types, to be a little bit more like what we do for local devices. Change-Id: I985c05f85f165fce4dfe0392569ec51ed1eeb91e Reviewed-on: https://code.wireshark.org/review/20242 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-02-22Make sure we zero out the newly allocated list, otherwise g_list append mayJoerg Mayer1-1/+1
dereference ->next containing an arbitrary value. Bug: 13418 Change-Id: I240bc03e652ede557083379cc81b81ae83d720e5 Reviewed-on: https://code.wireshark.org/review/20235 Reviewed-by: Jörg Mayer <jmayer@loplof.de>
2017-02-20Yell at the user less.Gerald Combs1-1/+1
Our user-facing messages should have a helpful (or at the very least neutral) tone. In English, exclamation points are neither. Replace a bunch of them with periods. Change-Id: I29c3b2f84c25e06aae5b559860224559053a0378 Reviewed-on: https://code.wireshark.org/review/20189 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-12-19Don't use PCAP_ERROR if it's not known to be defined.Guy Harris1-1/+1
The introduction of pcap_list_datalinks() predates the introduction of PCAP_ERROR, so the presence of pcap_list_datalinks() doesn't guarantee that PCAP_ERROR is defined. Change the use of PCAP_ERROR when checking the result of pcap_list_datalinks() to just check for -1. Change-Id: Id8229b7aebd02eaf3701983f9343503397af4fb3 Reviewed-on: https://code.wireshark.org/review/19351 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-10-22Fix the #defines for the presence of structure names.Guy Harris1-1/+1
AC_CHECK_MEMBER() and AC_CHECK_MEMBERS() use a standard name for the {structurename} being the name of the structure type, complete with "struct" if a typedef wasn't used, and with all letters mapped to upper case, and with {membername} being the name of the structure member, with all letters mapped to upper case. check_struct_has_member() lets you choose the name; choose the same name that the autoconf macros use, and fix the code to check for them. Change-Id: Ifb3cf65e7e94907ad0a2f8aacca0c21a531f0c5b Reviewed-on: https://code.wireshark.org/review/18382 Petri-Dish: Guy Harris <guy@alum.mit.edu> Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-09-30cmake: make WERROR_COMMON_FLAGS a normal stringPeter Wu1-7/+18
Instead of checking for the boolean "FALSE", just set an empty string. This avoids the need to check for WERROR_COMMON_FLAGS before using it. The transformation is the same for all files, remove "if (WERROR_COMMON_FLAGS)" and "endif()", reindent and add quotes (since we have a string here and not a list). Modelines have been added where missing. Change-Id: I0ab05ae507c51fa77336d49a99a226399cc81b92 Reviewed-on: https://code.wireshark.org/review/17997 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt> Reviewed-by: Dario Lombardo <lomato@gmail.com> Tested-by: Dario Lombardo <lomato@gmail.com>
2016-09-28Use g_slist_prepend, it should be faster if there's a lot of IP addressesAndersBroman2-2/+12
Change-Id: I3861c0af24523315db6889b22ec93159174ba86f Reviewed-on: https://code.wireshark.org/review/17966 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>
2016-09-08Fix the signature of the stub version of ws80211_set_freq().Guy Harris1-1/+1
Change-Id: I5f0da4fb5d8d452f3cff3d37e0749dde8e98b600 Reviewed-on: https://code.wireshark.org/review/17587 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-09-08dumpcap: change types.Dario Lombardo2-3/+3
Change-Id: I6520971e607623dadcb3ae392ce264bf49c621bd Reviewed-on: https://code.wireshark.org/review/17499 Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-09-06caputils: add conditional unused (_U_).Dario Lombardo1-1/+5
Change-Id: I50ccedd876bf78961397b55e5a707c98900f7b9f Reviewed-on: https://code.wireshark.org/review/17457 Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2016-09-06Allow a lot more C99 featuresPeter Wu1-2/+0
Flexible array members are supported by gcc, clang and even MSVC2013. Note, so far it was only used in the Windows-specific airpcap.h. Trailing commas in enum declaration are already in use since for these dissectors (commit ID is the first occurrence): epan/dissectors/packet-gluster.h v2.1.0rc0-1070-g3b706ba epan/dissectors/packet-ipv6.c v2.1.2rc0-81-ge07b4aa epan/dissectors/packet-netlink.h v2.3.0rc0-389-gc0ab12b epan/dissectors/packet-netlink-netfilter.c v2.3.0rc0-239-g1767e08 epan/dissectors/packet-netlink-route.c v2.3.0rc0-233-g2a80b40 epan/dissectors/packet-quic.c v2.3.0rc0-457-gfa320f8 Inline functions using the "inline" keyword are supported via all glib versions we support (if it is missing, glib will define a suitable inline macro). Other c99 functions listed in the README.developer document were found to be compatible with GCC 4.4.7, Clang 3.4.2 and MSVC 2013. Change-Id: If5bab03bfd8577b15a24bedf08c03bdfbf34317a Reviewed-on: https://code.wireshark.org/review/17421 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-08-23CMake: Allow setting per target compiler warningsJoão Valverde1-0/+1
Setting our compiler warning flags in CMAKE_C_FLAGS does not allow using different flags per target. Allow for that possibility by setting the internal WS_WARNINGS_{C,CXX}_FLAGS and using the COMPILE_OPTIONS property to set them. This change is just setting mechanism and there should be no difference in generated warnings. The check_X_compiler_flag cmake test is changed to test each flag individually. We need a list, not a space separated string, and the aggregate test is not significant. Change-Id: I59fc5cd7e130c7a5e001c598e3df3e13f83a6a25 Reviewed-on: https://code.wireshark.org/review/17150 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-06-30Remove Makefile.common filesJoão Valverde2-63/+25
Now that nmake build system has been removed they are not needed anymore. Change-Id: I88075f955bb4349185859c1af4be22e53de5850f Reviewed-on: https://code.wireshark.org/review/16050 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-06-15Remove Nmake build systemPascal Quantin2-86/+1
Change-Id: I3bd474f3cda9667dec66426b5729449953df3e61 Reviewed-on: https://code.wireshark.org/review/15777 Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Jörg Mayer <jmayer@loplof.de> Reviewed-by: Balint Reczey <balint@balintreczey.hu>
2016-06-06*_stdup_printf -> strdup for "single string only" formatting.Michael Mann1-2/+2
Done for performance improvements. This could probably be done in checkAPIs.pl, but this was just a quick manual check with grepping. Change-Id: I91ff102cb528bb00fa2f65489de53890e7e46f2d Reviewed-on: https://code.wireshark.org/review/15751 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl>
2016-06-03Move npf_sys_is_running() from wsutil to caputils.Guy Harris2-1/+45
It has nothing to do with controlling privileges; it only tests whether the NPF or Npcap service (driver) is running, so it belongs in caputils. While we're at it, fix its signature (in C, a function with no arguments must have "void" as the argument list, for backwards compatibility with pre-function-prototype C), and close the handles it opens, so we don't have open handles leaked. Change-Id: Ia99e99d81617ed2e8cda2c44e53061b4502a2b58 Reviewed-on: https://code.wireshark.org/review/15714 Petri-Dish: Guy Harris <guy@alum.mit.edu> Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-05-22Reapply "ws80211: Disable shorten-64-to-32."João Valverde1-0/+3
Disable shorten-64-to-32 in ws80211_create_on_demand_interface, which calls NLA_PUT_STRING, which passes the output of strlen to an int parameter. NLA_PUT_STRING is defined in netlink/attr.h so there's not much we can do to fix it directly. By Gerald in b8f90de70efa2d271274fbb48df12737f6eddd12. Change-Id: Ifb92244423fcb2cc267f8fcefb7a2700a7b7c0ea Reviewed-on: https://code.wireshark.org/review/15522 Reviewed-by: João Valverde <j@v6e.pt>
2016-05-22Revert "ws80211: Disable shorten-64-to-32."João Valverde1-3/+0
This reverts commit b8f90de70efa2d271274fbb48df12737f6eddd12. Change-Id: Ic7eaf288d1937a986c2ec85ba43a94ac20b6e12e Reviewed-on: https://code.wireshark.org/review/15520 Reviewed-by: João Valverde <j@v6e.pt>
2016-05-02Add checkAPI calls to CMake.Graham Bloice1-0/+17
This generates a top level target, checkAPI, that is excluded from the ALL build target, so must be run separately. On Windows using a Visual Studio generator, call msbuild /p:Configuration=RelWithDebInfo checkAPI.vcxproj Change-Id: I44a57c564dcfc75499463b942436f4b920a82478 Reviewed-on: https://code.wireshark.org/review/14873 Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Graham Bloice <graham.bloice@trihedral.com>
2016-04-04Include ws_diag_control.h in config.hJoão Valverde2-4/+3
Change-Id: Ia394071710ecda3b0e6686a51fbca45a8ff20317 Reviewed-on: https://code.wireshark.org/review/14749 Petri-Dish: João Valverde <j@v6e.pt> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt>
2016-04-02Use AC_CHECK_MEMBERSJoão Valverde1-1/+1
Change-Id: I18779ad869c97a6ddd12e39fe2f7a1f7b0c8cf56 Reviewed-on: https://code.wireshark.org/review/14754 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt>
2016-03-08Add EditorConfig settings for most C filesJoão Valverde2-0/+22
Change-Id: I02e6d71290bbdf7504437b0d670955b3686b6b52 Reviewed-on: https://code.wireshark.org/review/14360 Reviewed-by: João Valverde <j@v6e.pt>
2016-03-01dumpcap: Add support for 802.11ac monitor modesMikael Kanstrup2-8/+95
Add dumpcap support for configuring 80MHz, 80+80MHz, 160MHz monitor modes via nl80211. Change-Id: I2ae8955670c2a9b5051e2223d45ce522459f2c5f Reviewed-on: https://code.wireshark.org/review/13964 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-02-22caputils: fix crash when calling 'dumpcap -i' without having WinPcap installedPascal Quantin1-1/+2
Add a test on err_str buffer presence before trying to use it, like what is done in other code paths. Bug: 12143 Change-Id: I30ae49a33224dc190c202637767df9d7de2c0f2b Reviewed-on: https://code.wireshark.org/review/14074 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: Alexis La Goutte <alexis.lagoutte@gmail.com>
2016-02-21autotools: Improve libnl configuration and dependencyJoão Valverde1-1/+1
Change-Id: I3de7c2a6292a2f3fc57fdb849c23c3b31f6e4a13 Reviewed-on: https://code.wireshark.org/review/14052 Petri-Dish: João Valverde <j@v6e.pt> Reviewed-by: Peter Wu <peter@lekensteyn.nl> Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt>
2016-02-21autotools: Use pkg-config autoconf macros for GLib/GTKJoão Valverde1-0/+2
Remove mostly obsolete aclocal macros. Make GTK build flags a strict superset of GLib flags. Use GTK build variables for GTK GUI and GLib elsewhere. Add dependency flags explicitly instead of using WS_CPPFLAGS. Some minor improvements and fixes for missing/unnecessary variables (no impact on our test builds). Change-Id: I3e1f067a875f79d6516c1fa7af986f17a7a6b671 Reviewed-on: https://code.wireshark.org/review/14005 Reviewed-by: João Valverde <j@v6e.pt>
2016-02-18Remove some {-I,/I} flags.Guy Harris2-6/+2
They should not be necessary. Change-Id: I9246d86862392c65839c18d13d8634bcf510d55e Reviewed-on: https://code.wireshark.org/review/13992 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-02-18Don't add the wiretap directory to the list of include directories.Guy Harris2-3/+2
If you include something from the wiretap directory, always precede it with wiretap/. Fix some includes of files in the top-level directory to use a path relative to the current directory, not relative to the wiretap directory. This makes it a bit clearer what's being included. Change-Id: Ib99655a13c6006cf6c3112e9d4db6f47df9aff54 Reviewed-on: https://code.wireshark.org/review/13990 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-02-16ws80211: Replace some whitespaces with tabsMikael Kanstrup1-8/+8
File had both whitespaces and tabs for indentation. Replace whitespace indentation with tabs. This is the same indentation mode as ws80211.c file uses. Change-Id: I46bbd675f5089eb502b489fdfd70f30510bc95ef Reviewed-on: https://code.wireshark.org/review/13963 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-02-15Add some casts to void * to fix (pedantic) argument mismatch notesJoão Valverde1-1/+1
Change-Id: I63e46285b4c6676d4ae57196b85fbad89964898c Reviewed-on: https://code.wireshark.org/review/13933 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-01-28autotools: Don't use "user variables" to set build flagsJoão Valverde1-9/+4
GNU coding standards recommend against it and automake is designed around it. This allows overriding the global build flags using AM_CFLAGS, etc., or per object flags, something that is difficult or impossible currently because of automake precedence rules. Change-Id: I3f1ea12e560af5a46b2f04b342b1882bbf123f12 Reviewed-on: https://code.wireshark.org/review/13455 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-01-13Fix some memory leaks in ws80211_utilsMikael Kanstrup1-0/+4
Valgrind report memleaks like these when using the wireless toolbar to create a monitor interface and/or changing channel: 4,168 (72 direct, 4,096 indirect) bytes in 1 blocks are definitely lost in loss record 31 of 32 at 0x4C2CC70: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x5BD0742: ??? (in /lib/x86_64-linux-gnu/libnl-3.so.200.16.1) by 0x116308: ws80211_create_on_demand_interface (ws80211_utils.c:699) by 0x116308: ws80211_set_freq (ws80211_utils.c:729) by 0x10D70E: set_80211_channel (dumpcap.c:4262) by 0x10D70E: main (dumpcap.c:4935) 4,168 (72 direct, 4,096 indirect) bytes in 1 blocks are definitely lost in loss record 32 of 32 at 0x4C2CC70: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x5BD0742: ??? (in /lib/x86_64-linux-gnu/libnl-3.so.200.16.1) by 0x116400: ws80211_set_freq (ws80211_utils.c:733) by 0x10D70E: set_80211_channel (dumpcap.c:4262) by 0x10D70E: main (dumpcap.c:4935) Change-Id: Ia1de630859d96653310fbb3efebdc439ebf107b8 Reviewed-on: https://code.wireshark.org/review/13237 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-01-07pcap_list_datalinks() failing is an error.Guy Harris1-10/+15
Return an error string if that happens. If it doesn't fail, it will return a value >= 1; it will never return 0, so don't check for that. Change-Id: I6d7ee2683c1ceae73e9d9d61c0a6e6d30b2c4400 Reviewed-on: https://code.wireshark.org/review/13100 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-07Clean up #ifdeffed code.Guy Harris1-40/+40
We only need is_linux_bonding_device() if we have pcap_create(). We need get_data_link_types() regardless of whether we have pcap_create() or not. Change-Id: I035f8ddcd57c0424662a2029f928bffa969a3f6c Reviewed-on: https://code.wireshark.org/review/13099 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-07Don't declare libpcap wrappers if we're not building with libpcap.Guy Harris1-3/+3
Few of these functions exist if we're not building with libpcap. Change-Id: Icead80bc1993a229341fb4fcba6f1e5901c610ee Reviewed-on: https://code.wireshark.org/review/13097 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-07Move more capture device handling to the caputils library.Guy Harris5-23/+834
Move the code to open capture devices and get properties of capture devices there, joining the code to get a list of capture devices. This lets us do a better job of handling pcap_create() in WinPcap, including handling both WinPcap with pcap_create() and WinPcap without pcap_create() at run time, just in case somebody tries using WinPcap 3.x with a Wireshark built with WinPcap 4.x. It also could make it easier to use libpcap/WinPcap directly in Wireshark and TShark, if we have versions of libpcap/WinPcap that run small helper utilities to do privileged functions, allowing programs using them never to need elevated privileges themselves. That might make it easier to fix some issues with running TShark when not saving to a file (we could avoid the file entirely) and with delays when stopping a capture in Wireshark (Wireshark could stop writing to the file as soon as you click the stop button, rather than letting dumpcap do so when the signal gets to it). It might also make it easier to handle future versions of libpcap/WinPcap that support using pcap_create()/pcap_activate() for remote captures, and other future extensions to libpcap/WinPcap. Rename some XXX_linktype routines to XXX_datalink to indicate that they work with DLT_ values rather than LINKTYPE_ values; future versions of libpcap might use LINKTYPE_ values in newer APIs. Check for pcap_create() on all platforms in CMake. Change-Id: Ia12e1692c96ec945c07a135d246958771a29c817 Reviewed-on: https://code.wireshark.org/review/13062 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-06[WINPCAP] First step to be able to use pcap_create()AndersBroman1-0/+100
Change-Id: Id95640db0e647a696b39ccbfabc8cf2922df1407 Reviewed-on: https://code.wireshark.org/review/13051 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-01-06Remove unnecessary #ifdef and includes.Guy Harris1-7/+0
We don't check HAVE_LIBPCAP elsewhere, and we do use GLib functions, but don't use the GLib dynamic-loading APIs ourselves, and don't appear to use anything from libpcap or libwiretap, so include only <glib.h> and include it unconditionally. Change-Id: I97f06f56b7d87c671c0aaea1a0e60f2df7adfbd1 Reviewed-on: https://code.wireshark.org/review/13067 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Guy Harris <guy@alum.mit.edu>