Commit Graph

618 Commits

Author SHA1 Message Date
Gerald Combs c532bdc7ea Set a capture buffer size only when we have a valid handle.
Fixes the current Windows unit test crash.

Clean up a warning message.

Change-Id: I696e70c7656352d9576c1ad29703298cc7109621
Reviewed-on: https://code.wireshark.org/review/8674
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-05-28 16:53:39 +00:00
Jeff Morriss 187e8f61dc Windows: don't attempt to set the capture buffer size on remote (rpcap) devices.
Also move the code for setting the buffer size on Windows near the code for
setting it when we have pcap_create(): into open_capture_device().

Bug: 9067
Change-Id: Ica45f74b98094958d8bb0a38de23248aaa251d4b
Reviewed-on: https://code.wireshark.org/review/8551
Petri-Dish: Jeff Morriss <jeff.morriss.ws@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
2015-05-28 11:22:04 +00:00
Jeff Morriss 6d5fa70976 is_linux_bonding_device() is only used if we HAVE_PCAP_CREATE so only define it
if we HAVE_PCAP_CREATE.

Change-Id: Ic4eb6e69bde7d244b68a9fd97f66682eda6bdf91
Reviewed-on: https://code.wireshark.org/review/8667
Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
2015-05-28 01:26:12 +00:00
Pascal Quantin 2e8d8e12cd dumpcap: fix opening of pipes on Windows broken since gbed29af
Previous code was assuming that all local pipes were of extcap type. Let's explicitly check for extcap prefix now.

Bug: 10803
Change-Id: If955e77a9ee2af11b553740269964c40273d5177
Reviewed-on: https://code.wireshark.org/review/8013
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-04-13 17:43:40 +00:00
Alexis La Goutte 666f9bcfda dumpcap: fix no previous prototype for ‘is_linux_bonding_device’ [-Wmissing-prototypes]
Change-Id: If0c07232f92fab03f5312a932b925156d53bda4e
Reviewed-on: https://code.wireshark.org/review/7909
Reviewed-by: Evan Huus <eapache@gmail.com>
2015-04-04 17:48:55 +00:00
Alexis La Goutte 33abb91828 dumpcap: fix Resource leak (CID: 129558)
Change-Id: Ia5d91889ad636412f9ed8104818bfbbd311bf99b
Reviewed-on: https://code.wireshark.org/review/7879
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-04-01 21:34:59 +00:00
Guy Harris 7181ae4713 Work around a Linux bonding driver bug (and the lack of a libpcap workaround).
The bonding driver does not properly handle unknown ioctls; it returns
ENODEV rather than ENOTSUP, EOPNOTSUPP, ENOTTY, or a "not supported"
error of that type.  This causes problems detailed in bug 11058.

On Linux, check for bonding devices before checking for monitor-mode
support.

While we're at it, get rid of a commented-out include of
CheckCSourceCompiles (it's presumably already been implicitly included
by other functions that use it).

Bug: 11058
Change-Id: I13035de0650634c51a52f262829b2b6fb86b39e9
Reviewed-on: https://code.wireshark.org/review/7856
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>
2015-03-30 19:44:36 +00:00
Guy Harris 083f6b6e6d Have a #define for whether the capture buffer size can be set.
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>
2015-03-25 03:22:33 +00:00
Guy Harris 29bccdbd12 Don't say "Capturing on..." if we're not capturing on.
Only print the "Capturing on..." message if we're actually capturing,
not if we're printing link-layer types.

Change-Id: Icc554776a6a2826276893acb38f7d700effd5f78
Reviewed-on: https://code.wireshark.org/review/7726
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-03-17 20:36:28 +00:00
Guy Harris 7a14f89f12 Allow multiple -D/-L/-d/-S flags, only allow one -k flag.
Multiple instances of a single flag from -D/-L/-d/-S should behave like
a single instance of that flag; -D plus -L, for example, is not
supported, but -D plus another -D should be.  -k, however, takes an
argument, and we only support one.

Change-Id: I8baced346fbffd75f8d768497213f67bb9a0555f
Reviewed-on: https://code.wireshark.org/review/7723
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-03-17 20:11:40 +00:00
Guy Harris 8197c769ea Update an error message to reflect all the run-dumpcap-and-quit arguments.
Change-Id: I3c270279b4ea044919de5497d373c283ea87c5bf
Reviewed-on: https://code.wireshark.org/review/7709
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-03-16 20:58:01 +00:00
Gerald Combs cac102eee3 Change a lot of http:// URLs to https://.
Most of our sites are now HTTPS-only. Update URLs accordingly. Update
other URLs while we're at it. Remove or comment out dead links.

Change-Id: I7c4f323e6585d22760bb90bf28fc0faa6b893a33
Reviewed-on: https://code.wireshark.org/review/7621
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-03-10 19:30:50 +00:00
Gerald Combs 95382c3afb Suppress a bunch of cast-qual warnings.
Squelch

    warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]

similar to g630f54f.

Change strtod to g_ascii_strtod to squelch a checkAPIs error.

Change-Id: Ib2d26ef89f08827a5adc07e35eaf876cd7b8d14e
Reviewed-on: https://code.wireshark.org/review/7269
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-02-20 04:04:15 +00:00
Bill Meier e88a11f5c9 (Trivial) Fix printf-related 'Mismatch on sign' warnings
Found by MSVC2013 Code Analysis

Change-Id: I58063946dd558e98308c87b36eeac0ddbe1a6e79
Reviewed-on: https://code.wireshark.org/review/7045
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2015-02-09 18:57:14 +00:00
Dario Lombardo b8f040c42e Dumpcap: avoid collecting stats on nf* interfaces.
On Linux nf* interfaces don't collect stats properly and don't allows multiple connections.

Change-Id: I69d8f343017d77bda313de7d2c501fab542f2e9b
Bug: 10886
Reviewed-on: https://code.wireshark.org/review/6796
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-02-03 23:35:20 +00:00
Guy Harris 760aa14b79 Use g_strdup_printf(), rather than a fixed-length buffer, for the app name.
Change-Id: Ie6034e229f37278fce44b2fddad9250dfb5bc6c8
Reviewed-on: https://code.wireshark.org/review/6286
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-03 22:01:15 +00:00
Guy Harris 27be466c9b Do the full string in get_{compiled,runtime}_version_info().
Have them start the string with "Compiled" or "Running on", and return
the string when done.

Change-Id: Ic4d290c963621fa0385dc5aab766fd4ad31d3810
Reviewed-on: https://code.wireshark.org/review/6155
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-31 06:29:11 +00:00
Guy Harris c1f30471ca Move the version_info.c stuff to wsutil/ws_version_info.c.
Change-Id: I3a5c7e219974bfb924819b43b4d445eaf00e5bde
Reviewed-on: https://code.wireshark.org/review/6153
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-31 03:41:02 +00:00
Dario Lombardo 63ebe918d9 Removed duplicated #include lines
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-28 00:02:39 +00:00
Guy Harris 20503c7047 Check for getopt_long(), not getopt().
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-25 01:11:10 +00:00
Stephen Fisher 2d8ec49ffa Move twelve show_version() functions from the varoius programs and
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-12-24 16:51:45 +00:00
Guy Harris cd93af0ed1 Oops, we also need to worry about pcap_get_tstamp_precision().
Change-Id: I60a1f671ba313c59ca1999ab703ee11370608758
Reviewed-on: https://code.wireshark.org/review/5123
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-11-05 02:09:14 +00:00
Guy Harris 78492d9dd2 Cope with newer Xcode not having the 10.6 SDK.
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-11-05 01:50:00 +00:00
Guy Harris 9f2a87803b Get rid of unnecessary includes of ctype.h.
Change-Id: Ibf9385715b85186f5c7289165acea7233b3fabde
Reviewed-on: https://code.wireshark.org/review/4804
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-10-18 00:06:19 +00:00
Guy Harris 96835181e4 Pass the global capture options to open_capture_device().
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-29 00:10:52 +00:00
Guy Harris 392c41ce30 Add support for getting nanosecond time stamp resolution when capturing.
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-28 23:29:05 +00:00
Gerald Combs ea6fa049c9 Update the simple dialog code.
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-09-25 22:02:43 +00:00
Graham Bloice 97546165fa Modify includes of config.h so that out-of-tree builds, i.e. CMake
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-24 08:04: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
Joerg Mayer 657d5f9ce3 - Fix the whitespace fix
- 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-05 21:53:33 +00:00
Bill Meier f3dd7fe1eb Fix whitespace/indentation to match editor modelines.
Change-Id: I3445ae22f10584582d465bf632942e016f5f70ca
Reviewed-on: https://code.wireshark.org/review/3452
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-08-05 20:42:21 +00:00
Guy Harris 4028f56709 Clean up indentation (get rid of tabs).
Change-Id: I14917737db30c80af2d40e40efd79ceb6aea79f8
Reviewed-on: https://code.wireshark.org/review/3170
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-07-22 23:57:02 +00:00
Guy Harris f6ce0cdacd Get rid of NO_INTERFACES_FOUND - it's not an error.
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-22 23:53:49 +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 a1ec6693eb Clean up printf() argument list.
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-03 08:58:22 +00:00
Guy Harris b4ce352539 Make --help and --version information a bit more uniform.
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-03 08:46:01 +00:00
Guy Harris 6b3391c60a Regularize the help output of programs.
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-03 02:29:54 +00:00
Guy Harris 66c342ed59 Regularize the first line of version output.
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-07-03 02:03:35 +00:00
Guy Harris b33512b704 Move capture_session.h to capchild; what it declares is defined there.
Change-Id: I8b1407839390b7ac0b45bf6f583c1a509073f002
Reviewed-on: https://code.wireshark.org/review/2709
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-30 05:09:31 +00:00
Guy Harris fe42762f23 Move some more stuff into wsutil.
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-29 23:03:24 +00:00
Guy Harris adf6b1a8df For capchild headers, include <capchild/XXX.h>.
Change-Id: I780c69ee637dcd9846756a2e2d6a35baf02d826d
Reviewed-on: https://code.wireshark.org/review/2594
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-24 00:28:08 +00:00
Guy Harris 1d92195de8 Have individual programs get libpcap and libz version info.
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-23 21:56:42 +00:00
Guy Harris c46329c27b Add a routine to return a version string including VCS information.
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-22 01:06:25 +00:00
Guy Harris a1112249fa Move get_os_version_info() to libwsutil.
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-21 18:02:32 +00:00
Guy Harris 43443af0ac Move get_copyright_info() to wsutil.
Change-Id: I75c1c747cd2b4a9845c659636582d54b2caecf1a
Reviewed-on: https://code.wireshark.org/review/2510
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-21 17:33:05 +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 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
AndersBroman aa3a968eb6 Profiling show that g_log() takes a lot of CPU even when logging isn't
active.

Change-Id: I242f8e98a77861c0174e432c7026964babae7299
Reviewed-on: https://code.wireshark.org/review/1565
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-05-08 19:58:52 +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
Hadriel Kaplan c875dc8597 Fix dumpcap.c: Assigned value is garbage or undefined (clang analyzer)
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-27 17:57:02 +00:00
Gerald Combs f966980937 Replace "svn" with "git" all over the place.
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-02-07 23:03:03 +00:00
Martin Kaiser c852f994ea From Toralf Förster
fix format strings for signed integers

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

svn path=/trunk/; revision=54835
2014-01-17 20:06:39 +00:00
Anders Broman 90ea235292 Fix [-Wmissing-prototypes]
svn path=/trunk/; revision=54834
2014-01-17 19:35:57 +00:00
Jakub Zawadzki 064082e68a Change G_GINT64_CONSTANT(xxxxU) to G_GUINT64_CONSTANT(xxxx)
svn path=/trunk/; revision=54314
2013-12-20 22:39:32 +00:00
Bill Meier 87e2aa3383 From "bd": Fix " Wireshark stops showing new packets but dumpcap keeps 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-17 15:02:47 +00:00
Chris Maynard 93f15d640c Specify SI units for the max filesize autostop condition. For now, keep the capture buffer size in IEC units, but document it as such.
#BACKPORT(1.10, 1.8(?))

svn path=/trunk/; revision=53728
2013-12-02 19:17:12 +00:00
Jakub Zawadzki d99fdfda63 Replace macros: BSWAP16, BSWAP32, BSWAP64 with glib-version.
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-29 19:21:20 +00:00
Guy Harris b5e698553e Report the interface when an open or an attempt to set the link-layer
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-26 03:13:16 +00:00
Jakub Zawadzki c9b2ee3768 include <wsutil/pint.h> only when needed.
svn path=/trunk/; revision=53196
2013-11-09 15:44:29 +00:00
Anders Broman 996b07a814 Print if_dropped
svn path=/trunk/; revision=53080
2013-11-04 19:38:20 +00:00
Guy Harris b06876390d Rename routines that write pcap-ng files to "pcapng_xxx" rather than
"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-29 20:53:13 +00:00
Guy Harris c42263f28a We always write to a FILE *, so:
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-09-29 20:26:25 +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
Gerald Combs a75499aae0 Check our recently-added signal pipe in statistics mode.
svn path=/trunk/; revision=51519
2013-08-25 22:41:54 +00:00
Anders Broman 71f7093cf3 Output a warning about kernel BPF JIT compiler beeing activated.
svn path=/trunk/; revision=51488
2013-08-23 05:25:30 +00:00
Anders Broman f9aaaebdc8 Output a warning about kernel BPF JIT compiler beeing activated.
svn path=/trunk/; revision=51487
2013-08-23 05:21:25 +00:00
Martin Kaiser 9e7ce8b817 fix compiler warning on Debian wheezy (gcc 4.7.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-22 18:49:31 +00:00
Guy Harris 347ea71bae Only enable the Linux kernel BPF JIT compiler if we're on Linux.
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-22 17:36:30 +00:00
Anders Broman 5928ded2b4 Enable Kernel BPF JIT compiler from dumpcap.
svn path=/trunk/; revision=51472
2013-08-22 17:20:09 +00:00
Guy Harris da7c920853 I guess Solaris's getopt_long() "struct option" declaration doesn't have
enough cowbell^wconst; throw in a comment to squelch warnings.

svn path=/trunk/; revision=51351
2013-08-14 01:21:13 +00:00
Alexis La Goutte a1abe1540b Fix error when build with clang 3.0
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-08-10 21:27:26 +00:00
Chris Maynard 1a0b16d176 Trivial: Wrap text at column 80.
svn path=/trunk/; revision=51012
2013-07-29 15:45:36 +00:00
Martin Kaiser 9e33a6bade if we capture on multiple interfaces, the output file will be pcapn-ng
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-27 16:48:06 +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 a585b45343 use capture_comment from the capture_options structure
when we write the SHB

svn path=/trunk/; revision=50944
2013-07-27 16:16:57 +00:00
Martin Kaiser 14c82477bf use getopt_long() in dumpcap
for now, there's no long options, this is just a first test to see if
things compile everywhere...

svn path=/trunk/; revision=50877
2013-07-24 20:42:39 +00:00
Chris Maynard 91ecc2334f "man inet_pton" only says that it returns a negative value, zero or a postive value, and not specifically -1, 0, or 1, so even though we know that's what wsutil's inet_pton will return, we shouldn't test against those exact values.
svn path=/trunk/; revision=50670
2013-07-16 16:23:31 +00:00
Chris Maynard 42b09314b0 C++ style comments are not allowed in ISO C90. (Fixes the rest of them now that I noticed, "this will be reported only once per input file")
svn path=/trunk/; revision=50613
2013-07-15 15:51:45 +00:00
Chris Maynard e7e260b4fc Trivial: C++ style comments are not allowed in ISO C90.
svn path=/trunk/; revision=50612
2013-07-15 15:48:10 +00:00
Luis Ontanon 0bdc0efc46 get main_window_update out of the way... pass an update_cb to the capture_sync stuff
... as per the XXX comment removed from tshark.c this was a mess to keep the linker
happy... I couldn't!

I did this without even understanding whether calling main_window_update was realy
necessary in most cases. I guess nothing or more specific update cbs would be best.


svn path=/trunk/; revision=50188
2013-06-27 17:10:50 +00:00
Jeff Morriss bbf6a3766e Move tempfile.{h,c} into wsutil.
svn path=/trunk/; revision=50163
2013-06-26 01:14:35 +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
Guy Harris 39779a7bee Send the output of the -D and -L options to the standard output rather
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-04-25 05:47:11 +00:00
Anders Broman 26ddabf0d7 From Michal Labedzki:
Fix some compilation errors in dumpcap/plugins


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

svn path=/trunk/; revision=48413
2013-03-19 05:09:37 +00:00
Michael Tüxen da07699dd3 Make the memory limit (in bytes or packets) used for storing packets
configurable via command line options and print specific drop numbers
at the end. This allows to tune the buffering when using multiple
threads.
This also fixes a logic arrow in enforcing the limits.
The patch for the enhanced counters is from Anders Broman.


svn path=/trunk/; revision=48223
2013-03-10 11:57:40 +00:00
Anders Broman 85973068cc From beroset:
remove C++ incompatibilities

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

svn path=/trunk/; revision=48038
2013-03-03 17:14:19 +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
Anders Broman 1a4fb17e13 Update the text of dumpcap -h, default buffer size should be 2 MB.
svn path=/trunk/; revision=47935
2013-02-28 06:37:41 +00:00
Bill Meier 4d9850f689 it's ==> its
svn path=/trunk/; revision=47894
2013-02-26 01:43:39 +00:00
Gerald Combs bd4cffae58 When any of our executables start on Windows create or open a "Wireshark
is running" mutex. Have the NSIS installer check for this mutex and ask
the user to close Wireshark if it's found. While not perfect this makes
the WinSparkle update process much less annoying.

svn path=/trunk/; revision=47758
2013-02-20 01:19:42 +00:00
Anders Broman e90f414a72 svn path=/trunk/; revision=47210 2013-01-22 08:28:46 +00:00
Guy Harris 05825b02cd Add some routines to wsutil to, at least on some platforms, add
information to crash dumps and the like.  (Currently, we only handle OS
X's CrashReporter, but we should do this on other platforms where this
information can be added and would be helpful.)

White space tweaks.

svn path=/trunk/; revision=47104
2013-01-15 21:54:41 +00:00
Michael Mann 18580d6703 Allow pcap/pcapng format to be written to more than just a file (FILE*). Gives more flexibility if needed.
WRITE_DATA macro replaced and applied consistently throughout pcapio.c

svn path=/trunk/; revision=46891
2013-01-02 04:01:22 +00:00
Anders Broman 8106e33188 Make dumpcap build on Windows
svn path=/trunk/; revision=46788
2012-12-26 15:02:32 +00:00
Guy Harris 8ed7a73e22 Fix a bunch of warnings.
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-26 05:57:06 +00:00
Guy Harris e0ed1bddab More whitespace cleanups.
svn path=/trunk/; revision=46716
2012-12-23 09:54:05 +00:00
Michael Tüxen 644f8485da Add support for writing per packet comments when using pcapng.
Not actually used with this commit, which just brings in the
infrastructure.


svn path=/trunk/; revision=46715
2012-12-23 09:25:42 +00:00
Guy Harris bb846842f8 Fix indentation.
svn path=/trunk/; revision=46712
2012-12-23 06:52:50 +00:00
Guy Harris 0ddce65214 fclose() and fflush() are standard C routines, so there's no need for
our own wrappers.  (pcapio.c isn't using wrappers around, for example,
fwrite().)

svn path=/trunk/; revision=46640
2012-12-20 20:00:06 +00:00
Michael Tüxen 9a2f4c8e9d Don't use an pcap structures in pcapio.[ch].
Currently, pcapio is only used by dumpcap, which is only compiled
if there is pcap support. However, making pcapio independent from
libpcap allows it also to be used from text2pcap, which does not
rely on libpcap.

svn path=/trunk/; revision=46637
2012-12-20 15:20:10 +00:00
Michael Tüxen 7e84abf005 Add ws_fclose(), ws_fflush(), and ws_fdopen() to the fileutils.
Retire libpcap_fdopen(), libpcap_dump_flush(), and libpcap_dump_close().

svn path=/trunk/; revision=46636
2012-12-20 14:53:09 +00:00
Michael Tüxen 10dbe80c65 Add support for writing the flags option in the enhanced
packet block (pcapng).

svn path=/trunk/; revision=46619
2012-12-19 20:27:12 +00:00
Anders Broman 2977bde9f1 - Make dumpcap build with the new bundle.
- Use the correct bundle id for GTK3

svn path=/trunk/; revision=46586
2012-12-18 11:58:22 +00:00
Jeff Morriss 20211340e5 Make the "-g" argument to tshark actually work (by passing it to dumpcap).
svn path=/trunk/; revision=46515
2012-12-12 03:25:35 +00:00
Jeff Morriss 05ee001d73 Document the "-g" option to dumpcap.
Add that option to tshark, too, and document it.

The option can't be given to Wireshark because the GUI already has a "-g"
(goto packet).

svn path=/trunk/; revision=46513
2012-12-12 02:07:08 +00:00
Stephen Fisher 0537be2e5e Change variable "devname" to "devicename" in numerous places to avoid
to avoid -Wshadow warnings about conflicting with BSD's devname()
function.


svn path=/trunk/; revision=46494
2012-12-10 23:53:09 +00:00
Bill Meier 552323e7fb Fix a number of [-Wshadow] warnings;
Also: Do some minor whitespace changes

svn path=/trunk/; revision=46182
2012-11-25 18:35:41 +00:00
Guy Harris bd976ae6c0 On UN*X, if an interface has a description, use it as the "friendly
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-22 06:02:49 +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
Guy Harris 03f4fa5223 Make the "Invalid capture filter" message resemble that of other programs.
svn path=/trunk/; revision=46107
2012-11-21 16:05:21 +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
Bill Meier 68aeb27b90 (Trivial): update a comment.
svn path=/trunk/; revision=45287
2012-10-03 15:42:41 +00:00
Jeff Morriss 3551a86c36 We always HAVE_CONFIG_H so don't bother checking whether we have it or not.
svn path=/trunk/; revision=45015
2012-09-20 01:29:52 +00:00
Evan Huus bcf6e79573 Convert inpkts_to_sync_pipe and report_packet_count() to use unsigned ints
consistently. Cleans up some cppcheck warnings about signed/unsigned mismatches
in format strings.

svn path=/trunk/; revision=44818
2012-09-09 13:57:43 +00:00
Michael Tüxen 11c86ec476 Update recv/drop counters also when no threads are used.
This should fix
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7523

svn path=/trunk/; revision=43981
2012-07-25 07:08:20 +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 2851255f53 Don't supply a fallback error message for pcap_open() unless it actually
fails.

This may clear up the problem most recently reported in bug 7021 after
the crash was fixed, where the capture starts successfully but an error
dialog pops up.

svn path=/trunk/; revision=43501
2012-06-27 05:13:06 +00:00
Jörg Mayer 2b6b0656c2 Pontus Fuchs via bug 6973:
Add last piece of the wireless toolbar: Use dumpcap to actually set
the channel.

svn path=/trunk/; revision=43466
2012-06-24 19:45:49 +00:00
Jörg Mayer 3685b4db6f Remove some trailing whitespace
svn path=/trunk/; revision=43425
2012-06-21 13:23:45 +00:00
Michael Tüxen 1b0a5c58e2 Fix compilation on FreeBSD.
svn path=/trunk/; revision=43343
2012-06-18 21:50:59 +00:00
Chris Maynard c3dadc73f3 Fix Coverity CID 708961: Resource leak, by closing the socket if the connect() fails. While there, print a human-readable error message on Windows like we do for other platforms. Lastly, be sure to specify FORMAT_MESSAGE_IGNORE_INSERTS in the dwFlags arg to all FormatMessage() calls where FORMAT_MESSAGE_FROM_SYSTEM is also specified. (Ref: http://blogs.msdn.com/b/oldnewthing/archive/2007/11/28/6564257.aspx)
svn path=/trunk/; revision=43171
2012-06-09 03:36:15 +00:00
Chris Maynard 11204066a8 Some minimal documentation of remote capture interface formats for both rpcap and the new TCP feature from bug 2788.
svn path=/trunk/; revision=43156
2012-06-08 13:55:14 +00:00
Chris Maynard 74f85a07c0 Add another cast to make Windows buildbots happy.
svn path=/trunk/; revision=43155
2012-06-08 13:23:14 +00:00
Anders Broman 14c0648ce4 Add a cast.
svn path=/trunk/; revision=43154
2012-06-08 12:27:22 +00:00
Anders Broman 6a1f6be63b From Alexey Neyman Forward ported by Michael Mann:
Allow captures over TCP connections.

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

svn path=/trunk/; revision=43153
2012-06-08 11:54:26 +00:00
Chris Maynard 6272bd1578 In cap_pipe_open_live(), be sure to call ws_close(fd) before returning due to a couple of error condtions. Fixes Coverity CID 702395 Resource leak.
svn path=/trunk/; revision=42844
2012-05-25 01:32:26 +00:00
Guy Harris fb8054f131 Expand a comment.
Clear the struct sigaction *before* we fill in any fields in it.

svn path=/trunk/; revision=42706
2012-05-18 04:06:35 +00:00
Gerald Combs bdb614e264 Fix a bunch of uninitialized variables found by Coverity Scan. CIDs
702403, 702404, 702405, 702406, 702407, 702408, 702409, 702410, 702411,
and 702412.

svn path=/trunk/; revision=42658
2012-05-16 16:29:12 +00:00
Bill Meier 9d4b7ad9fe From Evan Huus:
In get_capture_device_open_failure_messages() in dumpcap.c, there are some
 statements that should have been guarded by ifdefs, causing a little
 unnecessary work on some platforms, and a bunch of unused-variable warnings
 from static analyzers. The patch fixes the problem.

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

svn path=/trunk/; revision=42454
2012-05-07 00:49:39 +00:00
Michael Tüxen e08a45d705 Set also the pcap buffer, if the default of 1 MB is used. This bug was
reported by Guy.

svn path=/trunk/; revision=42246
2012-04-25 21:19:31 +00:00
Michael Tüxen 3c866b04d0 Report the packets captured and the packets dropped (either by libpcap or by dumpcap).
svn path=/trunk/; revision=42245
2012-04-25 21:09:33 +00:00
Michael Tüxen 8ea1984ddc Allow writing ISB with given recv/drop counters.
No functional change by this commit.

svn path=/trunk/; revision=42242
2012-04-25 20:50:38 +00:00
Michael Tüxen d2526de5f8 Fix the packet counters.
This fixes the inconsistencies reported on the command line by dumpcap
as indicated by
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7191

svn path=/trunk/; revision=42236
2012-04-25 17:43:44 +00:00
Michael Tüxen 0fe7859ca4 Fix locking problem.
svn path=/trunk/; revision=42235
2012-04-25 16:05:29 +00:00
Guy Harris 04cd90e99e From Evan Huus: add a missing free. Fixes bug 7092.
svn path=/trunk/; revision=42070
2012-04-14 17:45:03 +00:00
Guy Harris 5ef71a27ff Fix tpo.
svn path=/trunk/; revision=41941
2012-04-04 19:46:45 +00:00
Guy Harris 43ca745bb9 Work around that WinPcap bug for another pcap_open() call.
svn path=/trunk/; revision=41938
2012-04-04 19:26:07 +00:00
Guy Harris 9c781b0939 Work around WinPcap bug wherein pcap_open() returns -1 without putting
an error message into errbuf (the bug has been reported to
winpcap-bugs).

Should fix bug 6922.

svn path=/trunk/; revision=41937
2012-04-04 19:13:39 +00:00
Anders Broman ba7c0cb1b9 From Jose Pedro Oliveira:
dumpcap.c: code cleaning 
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6718

svn path=/trunk/; revision=41535
2012-03-13 15:27:22 +00:00
Anders Broman cbde63643e From Jose Pedro Oliveira:
Enforce the modelines in dumpcap.c and in pcapio.c

svn path=/trunk/; revision=41505
2012-03-12 15:40:57 +00:00
Guy Harris 6486942282 Fix function name in debugging message.
svn path=/trunk/; revision=41488
2012-03-11 19:59:08 +00:00
Gerald Combs 7a8df2f485 In pcapng.c use the units per second value from the interface instead of
the default.

Add support for reading nseclibpcap files to dumpcap.

svn path=/trunk/; revision=41455
2012-03-10 00:24:42 +00:00
Anders Broman bb71a9c96a Forward interface_opts.descr (currently empty) when writing IDB:s
svn path=/trunk/; revision=41454
2012-03-09 15:29:35 +00:00
Anders Broman 9d03324d91 From Jose Pedro Oliveira: Make dumpcap write the if_tsresol option (using the default value) https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6718
svn path=/trunk/; revision=41444
2012-03-09 05:02:27 +00:00
Gerald Combs 57eeea4b20 Add a note about using GetSystemTimePreciseAsFileTime.
svn path=/trunk/; revision=41382
2012-03-06 21:11:31 +00:00
Guy Harris 26f694ddee Fix comment.
svn path=/trunk/; revision=41347
2012-03-05 06:43:44 +00:00
Anders Broman ad6640344f From Jose Pedro Oliveira: Fix typos
svn path=/trunk/; revision=41330
2012-03-03 16:17:20 +00:00
Gerald Combs 8334ec2b43 Another small commit to test migration.
svn path=/trunk/; revision=41251
2012-03-01 02:18:35 +00:00
Gerald Combs 380f3f54a7 Add a comment noting that we need to add support for files with
nanosecond timestamps. (Also test the recent anonymous repository
migration.)

svn path=/trunk/; revision=41248
2012-02-29 20:32:12 +00:00
Michael Tüxen 050c0a14c9 Don't use deprecated API on glib 2.31.18 and higher.
This should fix
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6884

svn path=/trunk/; revision=41247
2012-02-29 18:04:23 +00:00
Michael Tüxen 412c5a903c As discussed with Anders: Only write a single ISB at the end. Proivde
start/end time in the ISBs.

svn path=/trunk/; revision=41160
2012-02-23 12:57:17 +00:00
Anders Broman 8fff390455 - Write ISB(s) at start and end of capture.
- Read all options.
- Prepare to write ISB.

svn path=/trunk/; revision=41137
2012-02-22 14:41:02 +00:00
Anders Broman af2100d4c3 Expand the API for ISB:s
svn path=/trunk/; revision=41136
2012-02-22 10:01:16 +00:00
Michael Tüxen f7dc80cb18 Whitespace changes.
svn path=/trunk/; revision=41124
2012-02-21 18:01:01 +00:00
Michael Tüxen 41df09c92a Whitespace changes.
svn path=/trunk/; revision=41115
2012-02-21 16:28:42 +00:00
Anders Broman 1cf19ea95f From Jose Pedro Oliveira:
dumpcap: only free os_version_str after the
libpcap_write_interface_description_block() calls.

svn path=/trunk/; revision=41114
2012-02-21 16:14:57 +00:00
Anders Broman 5df11d41bb Extend libpcap_write_interface_description_block() wiyh more options
all exept os curently unused.

svn path=/trunk/; revision=41108
2012-02-21 13:35:04 +00:00
Anders Broman ce86c08b58 From Jose Pedro Oliveira shb_os value: get_os_version_info() instead of get_runtime_version_info()
svn path=/trunk/; revision=41095
2012-02-21 05:52:50 +00:00
Anders Broman 29a14da188 Jose Pedro Oliveira: get_os_version_info() is more apropriate for shb_os
svn path=/trunk/; revision=41086
2012-02-20 21:17:43 +00:00
Michael Tüxen 68204c94a4 From Anders: Add support for options in the SHB.
From me: Some whitespace changes.

svn path=/trunk/; revision=41026
2012-02-14 17:07:52 +00:00
Anders Broman e553c70fe8 From Michael Mann:
help page update (pcapng is now the default file format).

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

svn path=/trunk/; revision=40658
2012-01-23 07:48:53 +00:00
Guy Harris 3864d5d19d Add an additional DONT_HAVE_PCAP return value from get_interface_list()
and capture_interface_list().  Return it if, on Windows, we ask for the
interface list but don't have WinPcap installed.  Handle it like
CANT_GET_INTERFACE_LIST.

svn path=/trunk/; revision=40334
2011-12-29 22:49:49 +00:00
Guy Harris 21f5ea24e4 Just hard-code the error for "can't load WinPcap"; the one that
cant_load_winpcap_err() has some redundant gunk in it.

svn path=/trunk/; revision=40333
2011-12-29 22:06:22 +00:00
Guy Harris 71c7f43d37 On Windows, if we can't open a capture device, check whether WinPcap is
loaded and, if not, report that as the problem, rather than suggesting
that you didn't specify the proper interface.

svn path=/trunk/; revision=40332
2011-12-29 21:59:24 +00:00
Guy Harris d892f00916 Show a "Capturing on ..." message similar to TShark.
svn path=/trunk/; revision=39989
2011-11-22 19:07:49 +00:00
Guy Harris 939feef06f If we're not running as a child process, report the interfaces on which
we're capturing.  (We do not require a -i flag; the message could be
useful if you don't specify the interface, as it lets you know which
interface was chosen, which might not be the interface you'd think it
would be.  Yes, that's arguably a libpcap bug, which I plan to look at;
it should probably try to figure out which interfaces are "active" if
possible, and prefer those.)

Use cmdarg_err() for invalid capture filters and other capture errors.

svn path=/trunk/; revision=39983
2011-11-22 10:08:26 +00:00
Guy Harris 46575653fd Don't set variables if we don't look at them later. All praise Clang
Cat.

svn path=/trunk/; revision=39876
2011-11-16 02:18:30 +00:00
Gerald Combs aa0c9c965c Try to fix the GLib thread API deprecations listed in bug 6552.
svn path=/trunk/; revision=39776
2011-11-09 23:43:50 +00:00
Stig Bjørlykke 612dcc3c6b As reported by Michael Speck:
Removed last occurrences of USE_THREADS.

svn path=/trunk/; revision=39775
2011-11-09 20:45:06 +00:00
Gerald Combs 7d442f4c22 Change the use of threads from "mostly always, depending on your
configure options and Gtk+ and GLib versions" to "always".

svn path=/trunk/; revision=39751
2011-11-07 23:42:53 +00:00
Chris Maynard 367cb50bd3 Minor formatting changes to the dumpcap -h output.
svn path=/trunk/; revision=39166
2011-09-27 18:19:23 +00:00
Bill Meier a58121db53 Fix vi "modeline" so it works;
See https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5748


svn path=/trunk/; revision=39076
2011-09-21 16:44:10 +00:00
Bill Meier 9c6aca43f2 Windows: GetTickCount() returns a DWORD (not a time_t);
Fixes a problem on Windows wherein specifying a capture file
time duration for autostop or file-switching would stop
working after some period of time.

The reason:
GetTickCount returns DWORD (unsigned int) which
 wraps "every 49.7 days";

and: The GetTickCount() return value was being stored in a time_t which is
 int64 on Windows;

thus:
 The test for elapsed time (using signed integers) didn't work correctly after
 the time had wrapped.

Fixes Bug #6280: https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6280


svn path=/trunk/; revision=38921
2011-09-07 18:25:54 +00:00
Stephen Fisher dc3c5c8b63 Attempt to fix coverity id 1212: MISSING_BREAK by inserting "FALLTHROUGH"
comment.


svn path=/trunk/; revision=38785
2011-08-29 21:36:48 +00:00
Jeff Morriss bf95c7b5e4 Fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5608 :
getopt() can/should normally be found in unistd.h, so:

- When testing for getopt(), define that we HAVE_GETOPT instead of
  HAVE_GETOPT_H (to avoid confusion).
- Don't attempt to include getopt.h: not all OS's have it (for example,
  Solaris 9 does not).
- (All the places which need getopt already include unistd.h (if we have it).)

If this breaks things on some OS, we might need (a real) HAVE_GETOPT_H check.

svn path=/trunk/; revision=38437
2011-08-09 21:02:10 +00:00
Jörg Mayer c15ff441c6 Replace deprecated glib functions.
In order to compile the whole project with -DG_DISABLE_DEPRECATED
the mate plugin needs to replace its usage of GMemChunk.
All other places should be clean.

svn path=/trunk/; revision=38392
2011-08-07 18:15:45 +00:00
Michael Tüxen 52f555d857 Use the threads based workaround only on windows (with thread support enabled),
since the workaround is only intended to work on windows.

svn path=/trunk/; revision=38059
2011-07-16 12:45:47 +00:00
Michael Tüxen c481dda78c Fix compilation on non-windows platforms defining USE_THREADS.
svn path=/trunk/; revision=38044
2011-07-15 14:31:27 +00:00
Michael Tüxen c51aafc3aa Handle the case where dumpcap is compiled without thread support, which
is the default.

svn path=/trunk/; revision=38043
2011-07-15 12:20:00 +00:00
Gerald Combs a533d70be0 On Windows enable threads everywhere instead of just in dumpcap. If
threads are enabled use them to check the recent file list. Fixes bug
3810.

svn path=/trunk/; revision=38033
2011-07-14 23:18:02 +00:00
Guy Harris da461f18ad Alas, the libpcap API didn't use "void *" where it should have; squelch
some warnings from Clang.

svn path=/trunk/; revision=37934
2011-07-08 02:02:37 +00:00
Chris Maynard 91f30ab64f From Jakub Zawadzki via bug 6002: Don't set state to STATE_EXPECT_DATA if there's no data to read.
Reference: https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6002


svn path=/trunk/; revision=37924
2011-07-06 16:22:11 +00:00
Gerald Combs 9661c3fdde Disable DEBUG_CHILD_DUMPCAP.
svn path=/trunk/; revision=37864
2011-07-02 15:44:17 +00:00
Jakub Zawadzki 5c801f3820 Revert r37857, r37861
svn path=/trunk/; revision=37862
2011-07-01 22:26:02 +00:00
Jakub Zawadzki fafa84d23e Try to get more information about AV.
svn path=/trunk/; revision=37861
2011-07-01 22:00:59 +00:00
Jakub Zawadzki aeb81605de Catch system exceptions from pcap_open_live() :)
svn path=/trunk/; revision=37857
2011-07-01 20:07:34 +00:00
Michael Tüxen be3a756582 Add paranoid debug output in open_capture_device().
svn path=/trunk/; revision=37847
2011-06-30 21:02:11 +00:00
Gerald Combs 031a28f65e Log the success or failure of pcap_open/pcap_create/pcap_open_live.
svn path=/trunk/; revision=37846
2011-06-30 20:17:26 +00:00
Gerald Combs f04a525e79 Temporarily enable dumpcap debugging.
svn path=/trunk/; revision=37844
2011-06-30 17:41:46 +00:00
Stig Bjørlykke 8443bbbf75 Replace all strerror() with g_strerror().
Remove our local strerror implementation.
Mark strerror as locale unsafe API.

This fixes bug 5715.

svn path=/trunk/; revision=37812
2011-06-28 09:00:11 +00:00
Gerald Combs 710c5d67f7 Update suite-clopts.sh to match dumpcap's error output. Add a comment
to dumpcap.c about keeping the errors synced.

svn path=/trunk/; revision=37805
2011-06-27 16:09:49 +00:00
Michael Tüxen 4bc67de4ea Report the correct interface when there is a problem with a capture filter.
This patch is from Irene Ruengeler.

svn path=/trunk/; revision=37804
2011-06-27 12:13:15 +00:00
Michael Tüxen 2c8c178f71 Improve the report of illegal capture filters. Also show the interface description.
svn path=/trunk/; revision=37802
2011-06-27 11:30:39 +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
Gerald Combs 23659efce6 Add pcap_options to the pcap_queue elements. This lets us keep interface
IDs in one place and fixes a bug which resulted in only writing
interface ID 0 to NG enhanced packet blocks.

svn path=/trunk/; revision=37773
2011-06-23 18:54:07 +00:00
Gerald Combs 8d88f3a790 Make pcap-ng the default. Add a compile-time option to prefer pcap-ng or
pcap.  Add a "-P" capture option which tries to use pcap instead of
pcap-ng ("-P" seemed to be the best option but we may want to use a
different letter).

Update the documentation and release notes.

svn path=/trunk/; revision=37696
2011-06-17 17:52:31 +00:00
Guy Harris 5ed5745664 Sigh. Cast away a warning.
svn path=/trunk/; revision=37676
2011-06-15 21:22:30 +00:00
Guy Harris 2bada9a24f Constify some arguments.
Technically, %p must be given a void * as an argument (although the
representation of pointers on all platforms we deal with is the same for
all pointed-to types).

svn path=/trunk/; revision=37675
2011-06-15 20:21:45 +00:00
Jakub Zawadzki f6bda7f43a Remove not used cap_pipe_err_str.
svn path=/trunk/; revision=37662
2011-06-13 15:28:37 +00:00
Michael Tüxen 71325b8ac2 When doing remote capturing using WinPCap, dumpcap crashes inside the WinPCap
library when no capture filter is used. Then cfilter is NULL and 
capture_loop_init_filter() does not call compile_capture_filter() and
pcap_setfilter(). Providing an empty string instead of NULL works around
the problem.

svn path=/trunk/; revision=37588
2011-06-07 12:23:15 +00:00
Michael Tüxen 8f8f0e9ad6 Get rid of has_cfilter to simplify the handling of multiple interfaces.
svn path=/trunk/; revision=37478
2011-05-31 14:49:21 +00:00
Michael Tüxen 6516aa9864 Improve handling of command line errors.
svn path=/trunk/; revision=37477
2011-05-31 14:45:55 +00:00
Michael Tüxen 31c756a6d1 Initialize pcap using an empty array instead of NULL. So no special
check is needed.

svn path=/trunk/; revision=37445
2011-05-28 12:48:21 +00:00
Stig Bjørlykke 54356d4ccb Initialize global_ld.pcaps before we setup signal handlers, which
uses this list to cleanup.

svn path=/trunk/; revision=37425
2011-05-27 06:52:32 +00:00
Gerald Combs ebc0c3e33f Don't call g_log(); as the comment indicates it can cause problems.
svn path=/trunk/; revision=37418
2011-05-26 23:20:35 +00:00
Gerald Combs 093fce7576 Don't call pcap_breakloop() if we're not capturing anything. Fixes a
crash found by Stig.

Add debugging output to capture_cleanup_handler() on non-Windows
systems.

svn path=/trunk/; revision=37417
2011-05-26 22:12:27 +00:00
Chris Maynard a4f53c991c Append received percentage after received/dropped counts.
svn path=/trunk/; revision=37415
2011-05-26 20:05:11 +00:00
Michael Tüxen 1e70d66184 Provide consistent counters for received and dropped packets.
svn path=/trunk/; revision=37414
2011-05-26 19:22:16 +00:00
Michael Tüxen 90ddc2f3b1 Fix the handling of pipes on Windows platforms.
This should fix
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5939

svn path=/trunk/; revision=37413
2011-05-26 18:12:41 +00:00
Chris Maynard 77c9577a29 Change "captured/dropped" terminology to "received/dropped". Also, unless
we're a capture child, always report the final caputure count regardless of the
'quiet' setting.  This ensures that each interface prints its statistics on a
new line, rather than the first one being printed on the same line as the
packet count in the case when we're not 'quiet'.

svn path=/trunk/; revision=37410
2011-05-26 14:33:55 +00:00
Gerald Combs a24687ce8e Move the Windows argument list conversion code to a common routine.
svn path=/trunk/; revision=37372
2011-05-24 00:07:56 +00:00
Michael Tüxen bfb7d262e8 Use appropriate temporary filename when capturing from multiple interfaces.
svn path=/trunk/; revision=37344
2011-05-21 20:57:00 +00:00
Michael Tüxen 17dd51831f As suggested on the dev list: Use pcapng and threads
when capturing on multiple interfaces even if not specified
on the command line.

svn path=/trunk/; revision=37343
2011-05-21 18:51:25 +00:00
Gerald Combs 9be282951b Pass a pcap_options * instead of a pcap_options **.
svn path=/trunk/; revision=37341
2011-05-21 00:10:57 +00:00
Michael Tüxen eb3ebb5412 Drop privileges after opening all pcap devices, not after the first one...
svn path=/trunk/; revision=37311
2011-05-19 20:48:58 +00:00
Michael Tüxen b51eba6e47 Actually use the defaults from the last commit message.
... and switch off debug output.

svn path=/trunk/; revision=37285
2011-05-19 05:51:52 +00:00
Michael Tüxen e960be113f Add a queue and byte limit to the capture queue. Current default
values: 1000 packets, 1 MB. Should be made configurable via
command line options.

svn path=/trunk/; revision=37284
2011-05-19 05:49:46 +00:00
Guy Harris 91200c27a3 Dear GLib Developers:
Thank you very much for using "gulong" rather than "gsize" as the
"buffer length" argument to g_snprintf(), the fact that the
corresponding argument to snprintf() is a size_t nonwithstanding. 
Developers building for LLP64 platforms such as Win32 greatly appreciate
this decision.

svn path=/trunk/; revision=37195
2011-05-17 00:08:47 +00:00
Michael Tüxen 55f70620c0 Add support for capturing from multiple interfaces.
This patch is basedon work done by Irene Ruengeler.

This feature is considered experimental at the moment.
However, you need to use the -t command line option
to use the feature. When not providing it, the old
method will be used.

svn path=/trunk/; revision=37191
2011-05-16 21:56:12 +00:00
Chris Maynard 36506f2f55 #include <conio.h> when compiling under Windows with DEBUG_DUMPCAP defined.
svn path=/trunk/; revision=37187
2011-05-16 19:56:27 +00:00
Michael Tüxen 37b16db8f2 Use correct variable...
svn path=/trunk/; revision=37180
2011-05-16 16:27:42 +00:00
Michael Tüxen 64297b9be0 Fix compilation on windows (hopefully).
svn path=/trunk/; revision=37179
2011-05-16 15:25:33 +00:00
Michael Tüxen 70ae440e15 Make remote capturing settings a per interface thing. You can now
configure that you want to capture on multiple remote interfaces
on mulitple hosts.
Improve some #ifdef mess in dumpcap.

svn path=/trunk/; revision=37178
2011-05-16 15:19:54 +00:00
Michael Tüxen 122452f864 Make pcap samping a per interface setting.
Use consistent naming of variables on capture_options.
Make pcap sampling independent of remote capturing, since
it seems to work local pcap devices using winpcap (at
least that is what the documentation says).

svn path=/trunk/; revision=37176
2011-05-16 14:12:35 +00:00
Michael Tüxen 9a2ba01e85 Don't use debug output.
BTW: Why does compilation fail with it being enabled?

svn path=/trunk/; revision=37173
2011-05-16 00:19:47 +00:00
Michael Tüxen 2d2815b5d1 Fix compilation on Windows (hopefully).
svn path=/trunk/; revision=37172
2011-05-15 23:41:21 +00:00
Michael Tüxen 03d7987ba6 Change internal data structures to store and handle mulitple
pcap devices / pipes to capture from and open and close them.
However, capturing currently happens only on the last specified
interface.
So this does not add user visible functionality except that
some bugs are fixed. For example a crash when capturing on
a pipe and saving in pcapng format.

svn path=/trunk/; revision=37171
2011-05-15 22:54:52 +00:00
Michael Tüxen 520750df8a Fix a copy/paste error.
svn path=/trunk/; revision=37122
2011-05-13 13:04:13 +00:00
Michael Tüxen cfe3d2d0da Get -L and -d working with multiple interface. Internally get some functions
using the array of interface data.
Improve output of -L by printing the interface name.

svn path=/trunk/; revision=37120
2011-05-13 11:28:51 +00:00
Michael Tüxen 108e75ab4a Add a comment what needs to be changed when adopting wireshark and tshark.
svn path=/trunk/; revision=37111
2011-05-13 05:14:00 +00:00
Michael Tüxen c64c481e06 Add support for multiple interfaces when processing the -L option.
This is based on work of Irene Ruengeler.

svn path=/trunk/; revision=37098
2011-05-12 19:25:44 +00:00
Michael Tüxen 3501febf60 Initialize the glib thread system on all platforms, not only on Windows.
This requires to be linked against a different library. This is only
required for dumpcap, but the configure files currently doesn't check
this in a target specific way. So use these libs for all binaries.

svn path=/trunk/; revision=37095
2011-05-12 18:55:24 +00:00
Michael Tüxen a58caaf6f7 Add some more details (name of the interface and number of captured packets)
to the message showed when dumpcap is finishing.

This patch is the first one of a series which will add support for
capturing on multiple interfaces to dumpcap.

This patch is based on work of Irene Ruengeler.

svn path=/trunk/; revision=37094
2011-05-12 18:03:04 +00:00
Jeff Morriss c3f165c779 Forgot to remove my editor's tabs before committing...
svn path=/trunk/; revision=37002
2011-05-05 21:41:51 +00:00
Jeff Morriss 1792f8e3a6 Apply rev 14059 to non-Windows: update the display with new packets every 500
msec (instead of every 1000msec).

svn path=/trunk/; revision=36999
2011-05-05 20:46:02 +00:00
Jakub Zawadzki 5969e0e1c1 Add return instructions for system without support for G_GNUC_NORETURN (e.g. some older gcc compilers).
Reported by Anders Broman on -dev list.

svn path=/trunk/; revision=36797
2011-04-22 07:15:45 +00:00
Guy Harris 4fdcc5c180 Rename ws_stat to ws_stat64, and make it take a pointer to a ws_statb64
as an argument, along the lines of ws_fstat64, and, on Windows, make it
use _wstati64, to handle 64-bit file sizes.

svn path=/trunk/; revision=36547
2011-04-10 20:59:10 +00:00
Bill Meier f09b320711 Fix a comment; Use consistent indentatation & formatting.
svn path=/trunk/; revision=36225
2011-03-21 16:57:11 +00:00
Bill Meier 80b7f99b1c Fix Bug #5716: "dumpcap: -q option behavior doesn't match documentation"
Rework code slightly to print "Packets captured: " at 'dumpcap -q ...' exit.
Also: SigInfo now prints: "Packets captured:  n" iso "n Packets captured".

svn path=/trunk/; revision=36052
2011-02-24 19:26:38 +00:00
Gerald Combs a6bbdaa849 Fix some dead code and zero division issues found by Clang scan-build.
In convert_string_case() use g_utf8_strup() instead of converting each
character by hand. Hopefully this won't cause any unexpected changes in
behavior.

svn path=/trunk/; revision=36006
2011-02-18 22:43:48 +00:00
Guy Harris b4f663a29b On Windows, try putting __declspec(noreturn) in front of declarations of
routines that don't return.  (This requires that some files include
config.h to get WS_MSVC_NORETURN declared properly.)

svn path=/trunk/; revision=35989
2011-02-17 23:11:49 +00:00
Gerald Combs 3bc1fc3802 On Windows, convert all of our command-line arguments from UTF-16 to
UTF-8 where we don't already do so. In Wireshark use g_utf16_to_utf8
instead of utf_16to8. This should fix bug 5520.

svn path=/trunk/; revision=35411
2011-01-06 23:28:58 +00:00
Jaap Keuter 3656ecb823 Free dumpcap from linking to wiretap.
svn path=/trunk/; revision=35353
2011-01-04 07:06:01 +00:00
Gerald Combs 155e17c603 Add a comment about the pipe read timeout on Windows.
svn path=/trunk/; revision=34947
2010-11-18 17:29:02 +00:00