aboutsummaryrefslogtreecommitdiffstats
path: root/dumpcap.c
AgeCommit message (Collapse)AuthorFilesLines
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
2013-08-23Output a warning about kernel BPF JIT compiler beeing activated.Anders Broman1-0/+6
svn path=/trunk/; revision=51487
2013-08-22fix compiler warning on Debian wheezy (gcc 4.7.2)Martin Kaiser1-1/+2
dumpcap.c:193:10: error: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Werror=unused-result] for some reason, using (void)write(fd, ...) did not do the trick svn path=/trunk/; revision=51476
2013-08-22Only enable the Linux kernel BPF JIT compiler if we're on Linux.Guy Harris1-10/+22
Unless we're going to do something if that fails, there's no point in having enable_kernel_bpf_jit_compiler() return a success/failure indication. Fix indentation. svn path=/trunk/; revision=51475
2013-08-22Enable Kernel BPF JIT compiler from dumpcap.Anders Broman1-0/+21
svn path=/trunk/; revision=51472
2013-08-14I guess Solaris's getopt_long() "struct option" declaration doesn't haveGuy Harris1-1/+1
enough cowbell^wconst; throw in a comment to squelch warnings. svn path=/trunk/; revision=51351
2013-08-10Fix error when build with clang 3.0Alexis La Goutte1-2/+2
dumpcap.c:3981:88: error: implicit conversion loses integer precision: 'const __suseconds_t' (aka 'const long') to 'guint32' (aka 'unsigned int') [-Werror,-Wshorten-64-to-32] phdr->ts.tv_sec, phdr->ts.tv_usec, ~~~~~~~~~^~~~~~~ dumpcap.c:3989:73: error: implicit conversion loses integer precision: 'const __suseconds_t' (aka 'const long') to 'guint32' (aka 'unsigned int') [-Werror,-Wshorten-64-to-32] phdr->ts.tv_sec, phdr->ts.tv_usec, ~~~~~~~~~^~~~~~~ svn path=/trunk/; revision=51250
2013-07-29Trivial: Wrap text at column 80.Chris Maynard1-1/+2
svn path=/trunk/; revision=51012
2013-07-27if we capture on multiple interfaces, the output file will be pcapn-ngMartin Kaiser1-5/+6
even if we enforce pcap ouput format via -P in such a case, we *can* write a capture comment to the output file svn path=/trunk/; revision=50948
2013-07-27command line option --capture-comment for dumpcapMartin Kaiser1-1/+10
svn path=/trunk/; revision=50945
2013-07-27use capture_comment from the capture_options structureMartin Kaiser1-1/+9
when we write the SHB svn path=/trunk/; revision=50944
2013-07-24use getopt_long() in dumpcapMartin Kaiser1-1/+5
for now, there's no long options, this is just a first test to see if things compile everywhere... svn path=/trunk/; revision=50877