aboutsummaryrefslogtreecommitdiffstats
path: root/dumpcap.c
AgeCommit message (Collapse)AuthorFilesLines
2014-12-28Removed duplicated #include linesDario Lombardo1-1/+0
Change-Id: I9cafa3cd5c74121168777d8c656e7e94e89efd3c Reviewed-on: https://code.wireshark.org/review/6065 Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2014-12-25Check for getopt_long(), not getopt().Guy Harris1-1/+1
We support three types of platforms: 1) UN*Xes that have both getopt() and getopt_long(); 2) UN*Xes that have getopt() but not getopt_long(); 3) Windows, which has neither. Checking for getopt_long() lets us distinguish between 1) and 2) and build getopt_long() for them. Change-Id: Iaf0f142f9bebaa2eed2128d544ec9786711def45 Reviewed-on: https://code.wireshark.org/review/6045 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-24Move twelve show_version() functions from the varoius programs andStephen Fisher1-15/+1
Wireshark UI files into a single one in wsutil. Change-Id: I0a64f0cc8106bd681bd185289c36272c4c43baad Reviewed-on: https://code.wireshark.org/review/6026 Reviewed-by: Stephen Fisher <sfisher@sdf.org>
2014-11-05Oops, we also need to worry about pcap_get_tstamp_precision().Guy Harris1-1/+1
Change-Id: I60a1f671ba313c59ca1999ab703ee11370608758 Reviewed-on: https://code.wireshark.org/review/5123 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-11-05Cope with newer Xcode not having the 10.6 SDK.Guy Harris1-12/+3
The latest Xcode, as of today, has only 10.9 and 10.10 SDKs, which means that, if we build Wireshark and request a deployment minimum release of 10.6, we'll be building against an SDK in which libpcap has routines that aren't available in 10.6 and that doesn't use weak linking for them, so the resulting binary won't actually work on 10.6. Use the run-time loader to find those routines (currently, only pcap_set_tstamp_precision()) and call them only if we find them. On other UN*Xes, we still assume that we'll be running only on the release against which we were built and newer releases. Change-Id: Iab20d86fe3be4b299cfb6e25c1f95dc6e1581661 Reviewed-on: https://code.wireshark.org/review/5120 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-10-18Get rid of unnecessary includes of ctype.h.Guy Harris1-1/+0
Change-Id: Ibf9385715b85186f5c7289165acea7233b3fabde Reviewed-on: https://code.wireshark.org/review/4804 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-09-29Pass the global capture options to open_capture_device().Guy Harris1-3/+8
If we support setting the time stamp precision, we need it to determine whether we're writing a pcap-ng file so we know whether to request nanosecond precision or not. Change-Id: I7df19c1afbe1ba90c40c49aef79f6f88ce5df29b Reviewed-on: https://code.wireshark.org/review/4359 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-09-28Add support for getting nanosecond time stamp resolution when capturing.Guy Harris1-0/+31
If we have pcap_set_tstamp_precision(), use it to request nanosecond time stamp resolution *if* we're writing a pcap-ng file; any code that reads those files and can't handle nanosecond time stamp resolution is broken and needs to be fixed. If we're writing a pcap file, don't ask for nanosecond resolution time stamps, as that requires a different magic number for pcap files, and not all code that reads pcap files can handle that. (Unlike pcap-ng, where the ability to have non-microsecond time stamp resolution was present from Day One, it's a relatively recent addition to pcap.) We could add a command-line option/GUI option for that, like the option recent versions of tcpdump have, if it matters. Change-Id: I8fa464eb929feecb9a70be70712502c9f0cc5270 Reviewed-on: https://code.wireshark.org/review/4355 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-09-25Update the simple dialog code.Gerald Combs1-7/+7
Rename simple_dialog_qt.{cpp,h} to simple_dialog.{cpp,h}. Make it a subclass of QMessageBox. Queue messages at startup similar to GTK+. Move the GTK+-specific simple_dialog declarations to gtk/simple_dialog.h. Don't yell at the user so much. Replace exclamation points with periods. Change-Id: I1cc771106222d5e06f1f52d67ac29d6dc367cce4 Reviewed-on: https://code.wireshark.org/review/4288 Reviewed-by: Gerald Combs <gerald@wireshark.org>
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-11/+18
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-05- Fix the whitespace fixJoerg Mayer1-1/+1
- Also, trying to commit this "properly" gave this message: Error: Found prohibited APIs in dumpcap.c: strncpy,htons,strerror,open How does this happen? Why does gerrit accept this stuff in case a user does not have the (current) hooks installed? Change-Id: I692d053dcd9221aee31ed2780170c0671b856264 Reviewed-on: https://code.wireshark.org/review/3454 Reviewed-by: Jörg Mayer <jmayer@loplof.de>
2014-08-05Fix whitespace/indentation to match editor modelines.Bill Meier1-11/+11
Change-Id: I3445ae22f10584582d465bf632942e016f5f70ca Reviewed-on: https://code.wireshark.org/review/3452 Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-07-22Clean up indentation (get rid of tabs).Guy Harris1-1/+1
Change-Id: I14917737db30c80af2d40e40efd79ceb6aea79f8 Reviewed-on: https://code.wireshark.org/review/3170 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-07-22Get rid of NO_INTERFACES_FOUND - it's not an error.Guy Harris1-18/+8
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-04Move utility routines for capturing into a libcaputils static library.Guy Harris1-38/+10
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-03Clean up printf() argument list.Guy Harris1-2/+4
Splitting %s from \n makes it clearer that the %s's in question take arguments that already include a newline, and that the subsequent \n adds a blank line. Change-Id: I5bac8ca80b42f7de980ad29480042cae3166ff7e Reviewed-on: https://code.wireshark.org/review/2797 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-07-03Make --help and --version information a bit more uniform.Guy Harris1-9/+57
Have --version print the version number, the copyright information, the "compiled with" information, the "running on/with" information, and the compiler information. Have --help print the version number, a one-line summary of what the program does, a reference to http://www.wireshark.org for more information, a Usage: line, and a list of command-line options. This means programs doing that don't need to include version.h; that's left up to get_ws_vcs_version_info() to do. Change-Id: Idac641bc10e4dfd04c9914d379b3a3e0cc5ca8cb Reviewed-on: https://code.wireshark.org/review/2794 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-07-03Regularize the help output of programs.Guy Harris1-15/+7
Only print to the standard output, and only give the version information, if a "print help" command-line option is specified. Otherwise, leave out the version information, and print to the standard error. Leave out the copyright information; it's extra cruft, and http://www.gnu.org/prep/standards/html_node/_002d_002dhelp.html doesn't say anything about it (and bash, at least, doesn't print it). Change-Id: Ic5029ccf96e096453f3bd38383cc2dd355542e8a Reviewed-on: https://code.wireshark.org/review/2789 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-07-03Regularize the first line of version output.Guy Harris1-5/+5
For Wireshark, say "Wireshark", not "wireshark". For other programs, put "(Wireshark)" after the program name, as per http://www.gnu.org/prep/standards/html_node/_002d_002dversion.html ("If the program is a subsidiary part of a larger package, mention the package name in parentheses, like this"). Change-Id: I68558f64cfa6ee4423e42f3d6b120633ef1b2716 Reviewed-on: https://code.wireshark.org/review/2788 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-30Move capture_session.h to capchild; what it declares is defined there.Guy Harris1-1/+1
Change-Id: I8b1407839390b7ac0b45bf6f583c1a509073f002 Reviewed-on: https://code.wireshark.org/review/2709 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-29Move some more stuff into wsutil.Guy Harris1-18/+12
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-2/+2
Change-Id: I780c69ee637dcd9846756a2e2d6a35baf02d826d Reviewed-on: https://code.wireshark.org/review/2594 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-23Have individual programs get libpcap and libz version info.Guy Harris1-1/+18
That way, the code that constructs the runtime version string doesn't itself have to call libpcap and libz, and could be usable in programs that don't call them. While we're at it, add "with" to the run-time version information for GnuTLS and libgcrypt, to match the compile-time version information, and add the version information from libwireshark to TShark. Change-Id: I3726a027d032270b032292da9314c1cec535dcd2 Reviewed-on: https://code.wireshark.org/review/2587 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-22Add a routine to return a version string including VCS information.Guy Harris1-8/+9
Add a routine get_ws_vcs_version_info() that, for builds from a tree checked out from Wireshark's version control system, returns a string that includes both the Wireshark version number and an indication of what particular VCS version was checked out, and just returns Wireshark's version number for other builds. Use that routine rather than manually gluing VERSION and the Git version number together. ("vcs", not "git", just in case we do something bizarre or mercurial some day. :-)) Change-Id: Ie5c6dc83b9d3f56655eaef30fec3ec9916b6320d Reviewed-on: https://code.wireshark.org/review/2529 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-21Move get_os_version_info() to libwsutil.Guy Harris1-0/+1
This mean we also have to move CFString_to_C_string() there for OS X. Change-Id: Ic91ad872e9d5290cf34f842503ededd5452e4337 Reviewed-on: https://code.wireshark.org/review/2511 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-21Move get_copyright_info() to wsutil.Guy Harris1-0/+1
Change-Id: I75c1c747cd2b4a9845c659636582d54b2caecf1a Reviewed-on: https://code.wireshark.org/review/2510 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-20Move the "capture-comment" long option to LONGOPT_CAPTURE_COMMON.Guy Harris1-1/+0
Change-Id: I55884d48911de307cde52accfebbda69f2989526 Reviewed-on: https://code.wireshark.org/review/2505 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-20Fix builds without pcap.Guy Harris1-1/+1
Change-Id: I6c67f9ea9d115a8396af0904ef9a73d2c528dcaa Reviewed-on: https://code.wireshark.org/review/2498 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-20"-d" isn't common to all capturing programs, it's dumpcap-specific.Guy Harris1-0/+6
Change-Id: I827615d45051c9d66407516b311d3de448de6d07 Reviewed-on: https://code.wireshark.org/review/2495 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-20Add some long options for capture short options.Guy Harris1-21/+2
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-20Add --help and --version long options.Guy Harris1-3/+5
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-05-08Profiling show that g_log() takes a lot of CPU even when logging isn'tAndersBroman1-0/+2
active. Change-Id: I242f8e98a77861c0174e432c7026964babae7299 Reviewed-on: https://code.wireshark.org/review/1565 Reviewed-by: Anders Broman <a.broman58@gmail.com>
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-02-27Fix dumpcap.c: Assigned value is garbage or undefined (clang analyzer)Hadriel Kaplan1-1/+6
Change-Id: I61dbf5e1e206b1c0d2e594bfba38e83e51e8f09c Reviewed-on: https://code.wireshark.org/review/371 Reviewed-by: Evan Huus <eapache@gmail.com> Tested-by: Evan Huus <eapache@gmail.com>
2014-02-07Replace "svn" with "git" all over the place.Gerald Combs1-5/+5
Rename "SVNPATH" to "GITBRANCH" since that seems more appropriate. Rename "svnversion.h" to "version.h" as Evan suggested. Update some URLs. In make-version.pl, make sure we don't set an improper upstream branch name. Use the number of commits + short hash from `git describe` for package names by default. Change-Id: I922bba8d83eabdf49284a119f55b4076bc469b96 Reviewed-on: https://code.wireshark.org/review/139 Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-01-17From Toralf FörsterMartin Kaiser1-2/+2
fix format strings for signed integers https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9637 svn path=/trunk/; revision=54835
2014-01-17Fix [-Wmissing-prototypes]Anders Broman1-1/+1
svn path=/trunk/; revision=54834
2013-12-20Change G_GINT64_CONSTANT(xxxxU) to G_GUINT64_CONSTANT(xxxx)Jakub Zawadzki1-1/+1
svn path=/trunk/; revision=54314
2013-12-17From "bd": Fix " Wireshark stops showing new packets but dumpcap keeps ↵Bill Meier1-2/+2
writing them to the temp file" https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9571 From me: Fixed in a slightly different manner than sugested in the patch attached to the bug. svn path=/trunk/; revision=54181
2013-12-02Specify SI units for the max filesize autostop condition. For now, keep the ↵Chris Maynard1-7/+7
capture buffer size in IEC units, but document it as such. #BACKPORT(1.10, 1.8(?)) svn path=/trunk/; revision=53728
2013-11-29Replace macros: BSWAP16, BSWAP32, BSWAP64 with glib-version.Jakub Zawadzki1-9/+8
XXX, people are not aware that expression of this macros might be evaluated multiple times, like: - BSWAP16(tvb_get_letohs(tvb, off)) : \ + GUINT16_SWAP_LE_BE(tvb_get_letohs(tvb, off)) : \ Should be tvb_get_ntohs() called? svn path=/trunk/; revision=53653
2013-11-26Report the interface when an open or an attempt to set the link-layerGuy Harris1-16/+8
header type fails, as we might be capturing on more than one interface. Report the failing interface name in single quotes in some places where we weren't doing so, for stylistic consistency. svn path=/trunk/; revision=53593
2013-11-09include <wsutil/pint.h> only when needed.Jakub Zawadzki1-0/+1
svn path=/trunk/; revision=53196
2013-11-04Print if_droppedAnders Broman1-7/+12
svn path=/trunk/; revision=53080
2013-09-29Rename routines that write pcap-ng files to "pcapng_xxx" rather thanGuy Harris1-44/+44
"libpcap_xxx". Rename the low-level write routine in pcapio.c to write_to_file(), as it's used for both pcap and pcap-ng files. svn path=/trunk/; revision=52275
2013-09-29We always write to a FILE *, so:Guy Harris1-9/+9
make libpcap_write_to_file() static; don't pass it as an argument to write routines, just have them call it directly; make the handle argument a FILE *. Make the data length argument to libpcap_write_to_file() a size_t, as that's what, for example, fwrite() takes as a size argument. svn path=/trunk/; revision=52274
2013-08-29Handle the 2GiB boundary case of the max filesize autostop condition ↵Chris Maynard1-3/+7
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-25Check our recently-added signal pipe in statistics mode.Gerald Combs1-0/+4
svn path=/trunk/; revision=51519
2013-08-23Output a warning about kernel BPF JIT compiler beeing activated.Anders Broman1-1/+1
svn path=/trunk/; revision=51488