Commit Graph

215 Commits

Author SHA1 Message Date
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
Gerald Combs 11a29504b7 Set the pipe read timeout to 100 milliseconds instead of 100 microseconds.
Should fix bug 5309.

svn path=/trunk/; revision=34938
2010-11-17 23:51:31 +00:00
Chris Maynard 3595bb0293 If pcap_geterr() returns "read error: PacketReceivePacket failed", report that
the "network adapter on which the capture was being done is no longer running".
Fixes bug 2623 reported by Anthony Coulter.

svn path=/trunk/; revision=34915
2010-11-16 21:08:08 +00:00
Chris Maynard b60572a009 Use more meaningful temp file name. Fixes bug 1882.
Template chosen is: wireshark_<iface>_YYYYmmddHHMMSS_XXXXXX ... where
    <iface> is the interface name (or UUID part of the interface if applicable)
    YYYYmmddHHMMSS are as described in "man strftime".
    XXXXXX is a template filled in with random characters.  See "man mkstemp".

svn path=/trunk/; revision=34902
2010-11-16 15:37:37 +00:00