Commit Graph

403 Commits

Author SHA1 Message Date
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
Guy Harris ae8a7c8b19 OS X 10.6.5 is out, and it re-incorporates the libpcap workaround for
the BPF BIOCSRTIMEOUT bug in 64-bit mode, so we don't need to do our own
workaround in 10.6.5 or later.

svn path=/trunk/; revision=34841
2010-11-11 07:34:12 +00:00
Stig Bjørlykke 2cedc69849 Fixed "Compiled with" information in the About box.
svn path=/trunk/; revision=34601
2010-10-21 07:13:43 +00:00
Guy Harris 5770f7fe86 PIPE_READ_TIMEOUT should be in microseconds, not milliseconds.
As it's a constant, we can do the split into seconds and microseconds at
compile time, so do that (so that it works even if we happen to make
PIPE_READ_TIMEOUT >= 1 second).

svn path=/trunk/; revision=34283
2010-09-30 01:40:03 +00:00
Guy Harris 7fab58179a Always use a timeout of 250ms for pipes when not using threads; that way
we know it's < 1s, and don't have to worry about properly setting tv_sec
and tv_usec for select().

Get rid of unneeded pointer variable.

svn path=/trunk/; revision=34282
2010-09-30 01:01:25 +00:00
Gerald Combs a87bdf9660 Turn on ASLR via /DYNAMICBASE and DEP via SetProcessDEPPolicy().
svn path=/trunk/; revision=34137
2010-09-16 19:20:06 +00:00
Sake Blok f17c5ac01f As mentioned on the users-mailinglist[1], it could be useful to have groups read access to the ringbuffer that dumpcap creates. That way, a group of people can access the capture files without having to use root access.
[1]  http://www.wireshark.org/lists/wireshark-users/201008/msg00235.html

svn path=/trunk/; revision=33978
2010-08-28 11:05:51 +00:00
Sake Blok 42a0f16cef We change the owner and group of the first file, so we also want to change owner and group of the rest of the files in the ringbuffer.
svn path=/trunk/; revision=33977
2010-08-28 09:44:18 +00:00
Gerald Combs 5aae07254f Forward-port r33953.
Move the SetDllDirectory calls to ws_init_dll_search_path. If
SetDllDirectory fails, pass the Wireshark program path to
SetCurrentDirectory.

svn path=/trunk/; revision=33958
2010-08-27 19:24:44 +00:00
Gerald Combs b73454e8bd Fix !Windows compilation.
svn path=/trunk/; revision=33917
2010-08-25 00:20:50 +00:00
Gerald Combs ad4ffa5d49 Partial fix for bug 5133. On Windows, call SetDllDirectory at startup if
it's present in Wireshark and dumpcap. This takes care of the airpcap.dll
PoC but we need to load wpcap.dll from a full path. We might want to
call SetDllDirectory from our other executables as well.

svn path=/trunk/; revision=33916
2010-08-24 23:39:29 +00:00
Jörg Mayer 3a8eea122f Add #ifdef HAVE_BPF_IMAGE
around
show_filter_code(capture_options *capture_opts)

To fix a warning about an unused function.


svn path=/trunk/; revision=33519
2010-07-14 13:22:34 +00:00
Guy Harris 6582e265a8 Fix warnings.
svn path=/trunk/; revision=33517
2010-07-14 08:56:35 +00:00
Guy Harris 61ffcf2618 Fix build errors.
svn path=/trunk/; revision=33515
2010-07-14 08:27:26 +00:00
Guy Harris 6a8c39c59f Define print_caps() before we use it.
svn path=/trunk/; revision=33514
2010-07-14 04:31:52 +00:00
Guy Harris b277e17e7b Ensure, at compile time, that the error-message-buffer argument to
open_captur_device() is an array of PCAP_ERRBUF_SIZE chars.  That means
we don't need to pass the size.

Unfortunately, pcap_compile() didn't always take a "const char *" as the
filter string argument, even though it didn't modify the argument; don't
pass it a "const char *".

Don't print the secondary error message if it's empty.

svn path=/trunk/; revision=33513
2010-07-14 04:30:37 +00:00
Guy Harris 31c8eaf95e Define relinquish_all_capabilities() before we use it.
If we get an "XXX is not one of the DLTs supported by this device" error
when we try to set the link-layer header type, don't tell the user to
report it to the Wireshark developers, as that's probably just the
result of them giving a link-layer header type that the device doesn't
support.

svn path=/trunk/; revision=33512
2010-07-14 02:14:54 +00:00
Guy Harris c85fa2cd46 We must also set the link-layer header type before compiling the capture
filter, as that affects the generated code.

svn path=/trunk/; revision=33510
2010-07-14 00:50:25 +00:00
Guy Harris 4d6cb744df Add a "-d" flag to dumpcap, to print out the generated code for the
capture filter in human-readable form.  (Well, readable by humans who
know BPF machine language, at least. :-))

svn path=/trunk/; revision=33509
2010-07-13 23:26:07 +00:00
Jeff Morriss 47e2d75820 Move some code (including the optional objects) into libwsutil
svn path=/trunk/; revision=33012
2010-05-28 20:19:55 +00:00
Guy Harris 80fda10f18 Make -q not a capture option again - it's used by tshark even when not
capturing, and thus even when we build without pcap.

svn path=/trunk/; revision=32988
2010-05-27 01:13:49 +00:00
Guy Harris b0bfae2a85 Don't send ^T output to the standard error if we're a capture child.
Make SIGINFO a restart-the-system-call signal, so reads etc. don't
return an error.

svn path=/trunk/; revision=32968
2010-05-26 04:29:36 +00:00
Guy Harris 7a630c61a1 Add a -q flag to dumpcap, to squelch its reporting of the packet count,
and add support for SIGINFO, so, if your OS supports SIGINFO, you can
get the packet count by typing ^T.

svn path=/trunk/; revision=32958
2010-05-26 00:19:27 +00:00
Guy Harris 71de391514 Pull the big pile of code that handles the
capture-stopping/file-switching operation into a routine.  Move a few
variables into the loop_data structure so that routine can get at them.

svn path=/trunk/; revision=32949
2010-05-25 20:14:22 +00:00
Guy Harris 72ed0558f2 Don't have -M affect -v yet; if we end up, for example, having dumpcap
being the only program that needs to be linked with *pcap, that's when
we'd want to fetch that information, but there might be other libraries
(e.g., the POSIX capabilities library) that it might be linked with but
that programs that use it aren't linked with.

Don't commit to the output formats of -M, as they are, as noted, subject
to change from release to release.

svn path=/trunk/; revision=32904
2010-05-19 23:27:35 +00:00
Guy Harris c1e651802e -S doesn't require an interface, either.
svn path=/trunk/; revision=32883
2010-05-19 02:55:05 +00:00
Guy Harris ccac912244 Regularize indentation a bit.
Let pcap_statustostr()'s result suffice for most PCAP_ERROR_ errors. 
Don't mention the capture device name multiple times in the error
message.  Treat positive returns from pcap_can_set_rfmon() other than 0
or 1 as weird returns, not error returns.

svn path=/trunk/; revision=32882
2010-05-19 02:47:16 +00:00
Guy Harris ece9788353 Squelch an unused-variable warning.
svn path=/trunk/; revision=32856
2010-05-18 03:35:20 +00:00
Guy Harris 0910d319cd Move some routines around, fix and shuffle comments.
svn path=/trunk/; revision=32854
2010-05-18 02:48:51 +00:00
Guy Harris 1bf60839c9 Move get_pcap_linktype() into dumpcap - it's not used elsewhere.
svn path=/trunk/; revision=32853
2010-05-18 02:36:02 +00:00
Guy Harris c58680fd40 Only negative return values from pcap_activate() are errors; positive
return values are success-with-a-warning.

Report those errors with a string.

svn path=/trunk/; revision=32852
2010-05-18 01:48:46 +00:00
Guy Harris e3038273ca Don't write the SP_SUCCESS messages unless -Z was specified.
Add support for a machine-readable "-v" output, which prints only the
pcap version string.

Give a little more information about the machine-readable format, but
note that it's primarily intended for consumption by Wireshark and
TShark and is subject to change.

Properly hyphenate "pcap-ng".

svn path=/trunk/; revision=32851
2010-05-18 00:20:30 +00:00
Guy Harris 14c40a21aa Make -Z always generate machine-readable output, and don't bother
supplying -M along with -Z.  (We keep -M around for debugging use; it's
documented, unlike -Z.)

svn path=/trunk/; revision=32850
2010-05-17 23:56:00 +00:00
Guy Harris 859c6e4d3e If dumpcap is run with -D, don't select a default interface; it's not
necessary.

If it's run with -D and -M, and we found no interfaces, don't treat that
as an error; let the code that reads our output just indicate it as "no
interfaces available", so *its* caller can decide whether to report an
error or not (in some cases in Wireshark, it's obvious that there are no
interfaces, e.g. there aren't any listed on the welcome screen, so
popping up a dialog is pointless).

svn path=/trunk/; revision=32849
2010-05-17 23:13:24 +00:00
Guy Harris 991c5e9898 When dumpcap is run to get an interface list, interface capabilities, or
interface statistics, have its error messages come out as sync-pipe
errors, have it send a sync-pipe "success" message on success, and have
the callers get that message and display it.

svn path=/trunk/; revision=32843
2010-05-17 18:40:23 +00:00
Guy Harris 9307251bb8 Um, no, the problem with the Leopard x86 build is that we first do a
build without libpcap, to make sure that works, and then do a build with
libpcap, to put into a binary release.  It's the former that's failing;
I'll back out the previous change and then work on that.

svn path=/trunk/; revision=32801
2010-05-14 00:49:28 +00:00
Guy Harris 0e54136213 See whether the Leopard x86 buildbot is upset because of the name
if_capabilities_t - it doesn't fail on Snow Leopard, even if I undefine
HAVE_PCAP_CREATE, and doesn't fail on the Leopard PPC buildbot, either.

svn path=/trunk/; revision=32799
2010-05-14 00:10:15 +00:00
Guy Harris 1c18115bd3 Fetch an indication of whether the interface supports capturing in
monitor mode at the same time that we fetch its list of link-layer
types.  Support fetching that list in monitor mode, as the list may be
different in regular and monitor mode.  If the interface supports
monitor mode, when printing the list of link-layer types, indicate
whether they're fetched in monitor mode or not, as tcpdump 4.1.x does.

svn path=/trunk/; revision=32789
2010-05-13 17:37:39 +00:00
Guy Harris 5be9fa156f If we have pcap_open(), and we're *not* opening an rpcap URL, open the
device, don't just execute whatever comes after the open code as an else
clause.

svn path=/trunk/; revision=32761
2010-05-11 20:19:35 +00:00
Guy Harris 55dc4be5ba Include inet_v6defs.h after include the Windows socket headers, so it
knows whether AF_INET6 is needed.

svn path=/trunk/; revision=32722
2010-05-08 01:37:36 +00:00
Guy Harris 3debd13524 Include inet_v6defs.h if needed to declare inet_ntop().
svn path=/trunk/; revision=32720
2010-05-08 01:15:56 +00:00
Guy Harris 547b9e48a2 The default capture buffer size is, in fact, *nominally* 1MB; however,
libpcap/WinPcap and the capture mechanism atop which they run might
either silently limit the buffer size to a smaller value or raise it to
a higher value - that's the part that's platform-dependent.

svn path=/trunk/; revision=32718
2010-05-08 00:39:07 +00:00
Guy Harris 077ff72ac1 As with the list of data link types, so with the list of interfaces; move
the code to print the machine-readable format into dumpcap, and have the
code in capture_opts.c just print the human-readable format.

svn path=/trunk/; revision=32714
2010-05-07 19:24:32 +00:00
Guy Harris 13bf4a0c55 Add routines vfprintf_stderr() and fprintf_stderr() to print to the
standard error and, in Wireshark on Windows, create a console if
necessary.  Have the cmdarg_err routines use them.

Use *fprintf_stderr() to print the output of -L, rather than using
cmdarg_err_cont(), so that we don't get extra newlines in the output (it
should look similar to the output of tcpdump).

svn path=/trunk/; revision=32711
2010-05-07 08:40:02 +00:00
Guy Harris cc05b9250d For TShark and Wireshark, get the list of link-layer types for an
interface by running dumpcap, so that if you need privileges to open an
interface, and dumpcap has those privileges, neither TShark nor
Wireshark need them.

svn path=/trunk/; revision=32710
2010-05-07 08:06:25 +00:00
Guy Harris 4cd5e44340 Oops, -B disappeared from the list of dumpcap options in the change to
support multiple, err, optional options.

svn path=/trunk/; revision=32705
2010-05-07 01:50:22 +00:00
Guy Harris 20cbf81d39 Beginnings of monitor mode support with libpcap 1.x.
svn path=/trunk/; revision=32702
2010-05-07 01:22:33 +00:00
Guy Harris 4c5b8c5277 Instead, say that the default is platform-dependent.
svn path=/trunk/; revision=32701
2010-05-07 00:28:42 +00:00
Guy Harris 96f67d9517 Now that we support -B on various UN*X platforms as well as Windows, we
can no longer state what the default is (it's platform-dependent).

svn path=/trunk/; revision=32700
2010-05-07 00:16:52 +00:00
Guy Harris 7dbbb8c572 Just check for pcap_create(); it first appeared in libpcap 1.0.0, and
pcap_set_buffer_size() did as well, so there aren't any libpcap releases
with pcap_create() but not pcap_set_buffer_size().

Only do one check for pcap_create.

svn path=/trunk/; revision=32695
2010-05-06 23:33:41 +00:00
Gerald Combs 6ee96dc4a4 Fix compilation.
svn path=/trunk/; revision=32694
2010-05-06 23:29:55 +00:00
Anders Broman f9981411f1 Checking in Stigs changes from
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=475
BUT not activating the check for 
pcap_create()
pcap_set_buffer_size()
This should make it possible to build with support for setting the buffersize if not capturing 802.11 traffic.

The code for handling the 'B' option should be OK in any case.

svn path=/trunk/; revision=32688
2010-05-06 18:34:30 +00:00
Gerald Combs f2a66480df Revert r31529. Timing out while waiting for the pcap file header causes
more problems than it solves.

svn path=/trunk/; revision=32544
2010-04-23 17:22:51 +00:00
Guy Harris 7b41a72801 Expand the comment explaining the workaround for the Snow Leopard
timeout bug.

Make the code for the workaround assume any 10.6.x release other than
10.6.2 requires it; that way we don't have to update the code until
either

	1) Apple fixes the bug in a later 10.6.x update

or

	2) Apple comes out with a major release that still has, or
	   reintroduces, the bug.

svn path=/trunk/; revision=32349
2010-04-01 00:27:25 +00:00
Michael Tüxen d87005b114 Enable pcap timeout workaround for Mac OS X 10.6.3, since the bug seems to be
back.

svn path=/trunk/; revision=32348
2010-03-31 23:37:42 +00:00
Guy Harris 2b321eaf56 From Hilko Bengen: support capturing from UNIX-domain sockets.
Update a comment.

svn path=/trunk/; revision=32177
2010-03-13 00:29:30 +00:00
Guy Harris 25d49313cc "capture-pcap-util.h" include <pcap.h>, and <pcap.h>, for better or
worse, has no include-once guards; include it only once.

svn path=/trunk/; revision=32110
2010-03-04 07:19:43 +00:00
Guy Harris 167ab3a98c In Wireshark and TShark, run dumpcap to get interface lists and lists of
link-layer header types for interfaces; if special privileges are
necessary to open capture devices, Wireshark and TShark shouldn't have
those privileges, but dumpcap should.

svn path=/trunk/; revision=32104
2010-03-04 01:12:04 +00:00
Guy Harris cde1496de2 Squelch some compiler warnings.
svn path=/trunk/; revision=32074
2010-03-01 23:43:47 +00:00
Guy Harris 3b845dcce0 Move a routine into dumpcap - it's not used outside dumpcap.
svn path=/trunk/; revision=32042
2010-02-27 23:32:08 +00:00
Gerald Combs 97c480741d If we're using threads, time out when reading the file header.
svn path=/trunk/; revision=31529
2010-01-14 22:45:12 +00:00
Guy Harris 89d7efc44a Only do the 1-second timeout in OS X 10.6 and 10.6.1; the bug is fixed
in 10.6.2.

svn path=/trunk/; revision=31081
2009-11-26 04:17:18 +00:00
Stig Bjørlykke 98024a007f Invert check for getopt: NEED_GETOPT_H -> HAVE_GETOPT_H
Rename getopt.[ch] -> wsgetopt.[ch] to avoid name collision.

svn path=/trunk/; revision=30370
2009-10-06 16:01:18 +00:00
Stig Bjørlykke b82f3a8037 Cast a pointer to avoid a warning.
svn path=/trunk/; revision=30229
2009-10-01 11:09:27 +00:00
Stig Bjørlykke ee37f6194f Initialize magic to avoid a warning about a possible uninitialized read.
svn path=/trunk/; revision=30188
2009-09-29 06:57:11 +00:00
Jeff Morriss af6fca176d Don't use SIGUSR1 to tell dumpcap to exit, use SIGINT: SIGINT is traditionally
used for this purpose and using it also prevents the 2 signals the child gets:
	- the user's Ctrl-C (which is sent as a SIGINT to both *shark and its
	  child dumpcap)
	- the signal *shark generates to shut down the child

from colliding (and running 2 signal handlers in the child).

It might be possible for tshark to not send the signal at all when it gets
SIGINT, but it doesn't do any harm now.

Also, do not call g_log() within the signal handler: doing so can cause
aborts (if g_log is being called by the process when the signal comes, the
2nd entrance into g_log is detected as a recursion).

This fixes https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=2767

svn path=/trunk/; revision=29881
2009-09-13 17:46:10 +00:00
Kovarththanan Rajaratnam 0ef69d922a Use Wireshark/GLib attribute specifiers instead of checking for __GNUC__ explicitly
svn path=/trunk/; revision=29804
2009-09-08 18:02:43 +00:00
Michael Tüxen 4a50092991 Use a timeout of a second for Mac OS X, when building
a 64-bit application. Workaround a bug in Mac OS X...

svn path=/trunk/; revision=29641
2009-08-31 19:13:50 +00:00
Anders Broman 5cba22a89b Make the windows build compile.
svn path=/trunk/; revision=29591
2009-08-28 05:17:14 +00:00
Gerald Combs 3b4fb8e340 Properly set our file descriptor when we're capturing from a pipe on
non-Windows systems.

svn path=/trunk/; revision=29590
2009-08-27 23:55:48 +00:00
Gerald Combs 4812f29640 Check for INVALID_HANDLE_VALUE instead of NULL on Windows. This keeps
us from feeding a NULL pointer to pcap_compile if we can't open our
pipe. Fix up a couple of error messages.

svn path=/trunk/; revision=29587
2009-08-27 15:46:53 +00:00
Bill Meier 1826a02933 Add #include <stdio.h> in a few places for Solaris
svn path=/trunk/; revision=29576
2009-08-27 02:53:13 +00:00
Gerald Combs 4c7f40f3f5 Add a compile-time option to use a separate thread for reading from
pipes. Enable this by default on Windows. Remove code that tried to
use WaitForSingleObject on a pipe (which Windows doesn't support). Use
native file handles and system calls on Windows (which fixes a problem
with partial reads I ran into during testing).

This should fix bug 1759.

svn path=/trunk/; revision=29574
2009-08-26 23:16:37 +00:00
Balint Reczey 98d79569e0 From Rob Leslie <rob@mars.org>:
[PATCH] Fix dumpcap believing error on ^C i.e. pcap_breakloop()
When ^C was pressed during a packet capture, dumpcap believed a pcap
error had occurred.  We check the return value more closely to avoid
this problem.

svn path=/trunk/; revision=29510
2009-08-22 22:49:59 +00:00
Gerald Combs e0ebc32195 Updates to create_tempfile:
- Use g_get_tmp_dir, just like get_tempfile_path.
  - Don't make the caller worry about the path buffer length.

svn path=/trunk/; revision=28915
2009-07-01 23:36:51 +00:00
Gerald Combs 59a767f0b2 Unfortunately, r28452 seems to cause more problems than it fixes. Back
out the change for now.

svn path=/trunk/; revision=28852
2009-06-26 21:25:09 +00:00
Balint Reczey 1f8c72ff25 Set SIGPIPE handler every time the program starts.
This hopefully fixes bug 1740.

svn path=/trunk/; revision=28549
2009-05-31 18:38:28 +00:00
Gerald Combs f7f2a08def From Benjamin Tse via bug 2200:
I've created a new bug rather than reopening 1181 as the scope is constrained
somewhat more.

Basically, when capturing from a named pipe the wireshark display lags by one
packet. This is especially frustrating when the packets arrive at low rates.

tshark is fine. But the packet count in dumpcap also lags by one.

Looking at the code, the problem appears to be in cap_pipe_select(). It
attempts to use WaitForSingleObject() on the named pipe but AFAICT this never
blocks.

I've attached a diff for some code that fixes the issue for me. The semantics
of overlapped IO in Win32 is quite different from the select/read model - hence
the other changes!

I've tested this fix on WinXP, 2k server and 2003 server. I've also checked
that my changes compile on a Freespire box that I have lying around.


From me:

Adapt the changes for dumpcap, which is where the affected code now lives.

svn path=/trunk/; revision=28452
2009-05-22 19:52:30 +00:00
Michael Tüxen 6de58c28f0 Add -n option to dumpcap. It will save the capture files in
pcapng format instead of pcap. The default is to use pcap.

svn path=/trunk/; revision=28170
2009-04-27 08:11:10 +00:00
Michael Tüxen f5547c0d78 Make ringbuffer.[ch] file format agnostic.
Move write routines to dumpcap.c
This is a preparation for pcapng support.

svn path=/trunk/; revision=28155
2009-04-26 15:51:25 +00:00
Gerald Combs e648060f0f Fix the last(?) of the Win64 compilation problems.
svn path=/trunk/; revision=28065
2009-04-16 04:05:39 +00:00
Bill Meier 013db77404 Use wireshark (instead of ether) for temp file name prefix.
svn path=/trunk/; revision=27992
2009-04-08 12:22:12 +00:00
Jaap Keuter 69463d1fd0 From Toralf Förster:
Small cleanup of preprocessor logic.

svn path=/trunk/; revision=27212
2009-01-11 18:16:50 +00:00
Jaap Keuter da34ecd34a From Ronald W. Henderson:
dumpcap should terminate if exactly the maximum number of packets have been captured 
(or greater) as specified by the user: "-c <capture packet count>". The current behavior 
waits until an additional packet is captured until this threshold check occurs.

svn path=/trunk/; revision=27208
2009-01-11 12:26:32 +00:00
Balint Reczey 4942a20da4 From Pavol Rusnak (bug 1740):
Set SA_RESTART flag when setting SIGPIPE handler.

svn path=/trunk/; revision=26851
2008-11-26 12:54:39 +00:00
Stig Bjørlykke 32d411be1d Do not set buffer size for remote interfaces or when using default value.
Do not get link-layer for remote interfaces.

svn path=/trunk/; revision=26683
2008-11-03 21:38:53 +00:00
Stig Bjørlykke 841e3a0a3f Fixed some "ignoring return value" warnings.
This is the last commit to make it compile clean on Ubuntu 8.10.

svn path=/trunk/; revision=26654
2008-10-31 17:43:51 +00:00
Balint Reczey c2ce5dcbf6 Based on patch from Sergio Barjola:
Enable the default action for SIGPIPE
This fixes bug 2888 and 1740

svn path=/trunk/; revision=26621
2008-10-30 11:48:13 +00:00
Guy Harris e8ba2515de The packet counts and drop counts reported by libpcap are unsigned.
Clean up indentation a bit.

svn path=/trunk/; revision=26037
2008-08-19 05:10:16 +00:00
Gerald Combs cb3022d098 If we can't open open an interface in Windows, instead of talking about
specific issues (one of which no longer applies), point the user at the 
wiki.

svn path=/trunk/; revision=25833
2008-07-25 22:29:02 +00:00
Jeff Morriss 83f9ecf96f Move privileges.c and unicode-utils.c from epan to wsutil (so things like
capinfos and dumpcap don't need to depend on libwireshark nor directly pull
in those modules).  Because capinfos and editcap were only being linked with
privileges.c if we had plugins, this allows those programs to be linked when
someone is compiling --without-plugins.

svn path=/trunk/; revision=25640
2008-06-30 17:16:29 +00:00
Guy Harris f8b7863753 Fix some references to the global loop_data structure that weren't
changed in the previous checkin.

svn path=/trunk/; revision=25573
2008-06-24 03:33:51 +00:00
Guy Harris 802d9abf4f Rename the global "ld" structure to "global_ld", to avoid collisions
with the "ld" pointer argument (and to point out that it's a global
variable).

svn path=/trunk/; revision=25554
2008-06-23 21:22:11 +00:00
Guy Harris ee78dbb925 Get rid of the static capture_opts pointer - it collides with parameter
names, as noted by John Smith.

svn path=/trunk/; revision=25542
2008-06-23 20:21:46 +00:00
Guy Harris e731e24b51 capture_opts_print_statistics() has nothing to do with capture options
setting, and is used only in dumpcap.c, and needs to get at information
set by dumpcap's signal handlers so it can respond to ^C; move it to
dumpcap.c, rename it print_statistics_loop(), and make it set ld.go to
TRUE before looping and loop only as long as ld.go is TRUE.

That fixes bug 2592 (at least on Mac OS X, and probably on other UN*Xes;
it should fix it on Windows as well).

svn path=/trunk/; revision=25492
2008-06-20 00:09:47 +00:00
Anders Broman 36d89bb79c Fix some of the Errors/warnings detected by checkapi.
svn path=/trunk/; revision=25368
2008-05-23 05:55:34 +00:00
Jeff Morriss a5cee04fad Move the file utility functions from wiretap to libwsutil so that
libwireshark (and the plugins using those functions) do not depend on
wiretap on Windows.

While doing that, rename the eth_* functions to ws_*.

svn path=/trunk/; revision=25354
2008-05-22 15:46:27 +00:00
Bill Meier 398e06e875 Fix a few typos.
svn path=/trunk/; revision=24724
2008-03-24 18:32:15 +00:00
Gerald Combs ec74de5957 dumpcap.c: Fix a typo.
INSTALL: Add entries for libcap.

svn path=/trunk/; revision=24722
2008-03-24 16:22:30 +00:00
Bill Meier e843df87f6 Fix (aka workaround) for bug #2228.
Essentially: if using libcap, drop capabilities
after doing pcap_open_live. 
See comment in main() for details.

svn path=/trunk/; revision=24716
2008-03-22 19:04:26 +00:00
Gerald Combs c288c1ae05 Don't call cap_set_proc() unless we were started with elevated
privileges.  Otherwise, we might print

dumpcap: cap_set_proc() fail return: Operation not permitted

to stderr.

svn path=/trunk/; revision=24704
2008-03-20 19:18:33 +00:00
Bill Meier 2c07da3195 Fix for handling dumpcap errmsgs when wireshark does 'dumpcap -D -M', etc
svn path=/trunk/; revision=24507
2008-02-29 18:48:29 +00:00
Jeff Morriss 404c087195 Use plain old strcmp() instead of g_ascii_strcasecmp() when searching for -Z.
On glib-1.2 systems g_ascii_strcasecmp() is in libwireshark (which we don't
want to include in dumpcap) and anyway our code should be the only thing
calling dumpcap with "-Z"--so hopefully there's no need for doing a
case-insensitive comparison.

(This is another argument for adding a "utils" library.)

svn path=/trunk/; revision=24462
2008-02-25 20:43:03 +00:00
Bill Meier 8d4f01eea7 Ensure tshark/wireshark always get good err msgs from dumpcap:
1. Clean up dumpcap 'as a child' err msg handling so that:
   - all err msgs are properly formatted when being sent 
     back to the parent.
   - any log Critical, Warning, etc messages
     are sent back to parent and are properly formatted.
2. Change handling of -w <...> slightly in capture_opts.c
   so that wireshark provides a good error message if
   there is a 'write permissions' issue on the file.
   (Previously the error popup said only 
   "Child exited with status 2").
   This fixes bug #2288.

Add some conditionalized DEBUG_CHILD_DUMPCAP code for
   dumpcap debug logging to a file.

svn path=/trunk/; revision=24446
2008-02-23 19:59:38 +00:00
Guy Harris 8d8800f3e9 dumpcap doesn't need stuff declared in capture.h; it just needs what's
declared in capture_opts.h.

svn path=/trunk/; revision=24352
2008-02-16 08:44:33 +00:00
Guy Harris 7eac554d02 One include of epan/unicode-utils.h suffices - and the routines it
declares are called only on Windows.

svn path=/trunk/; revision=24351
2008-02-16 08:38:23 +00:00
Guy Harris 7aa5f3f1ad Directly call capture_loop_packet_cb(), rather than making a pointer to
the callback function part of the loop_data structure - we always call
capture_loop_packet_cb().

svn path=/trunk/; revision=24350
2008-02-16 08:09:56 +00:00
Guy Harris 95f3802ae9 If we don't have libcap, relinquish special privileges just after
opening the capture device.  That somewhat fixes bug 2273, although the
second and subsequent files don't have the right group ownership,
probably because of the problem described in the comment before
relinquish_special_privs_perm().

We should also relinquish special privileges *before* trying to open the
capture pipe, so that we can't open a pipe to which the real user
doesn't have access.

svn path=/trunk/; revision=24347
2008-02-16 03:18:36 +00:00
Guy Harris 4aac1e2c0b Pull capture_loop.c into dumpcap.c, as dumpcap is the only program that
does capturing any more.  (We will be inserting a call to give up
privileges after the pcap_open_live(), which should fix 2273; we're
currently only giving up privileges on platforms with libcap.)

svn path=/trunk/; revision=24345
2008-02-16 02:39:58 +00:00
Bill Meier 8f6398d5ba Fix typo in help text
svn path=/trunk/; revision=24148
2008-01-20 23:12:12 +00:00
Tomas Kukosa 08bbd29c71 Support for RPCAP features in GUI (from Boris Misenov, see Bug 1366)
- retrieving the list of remote PCAP interfaces
  - password authentication support
  - UDP data fransfer
  - packet sampling (available in WinPcap 4.x)
  etc.

fix problem if non-default rpcap port is used

svn path=/trunk/; revision=23750
2007-12-04 11:19:29 +00:00
Bill Meier bfc4f6d466 Rename Windows ConsoleCtrHandlerRoutine --> capture_cleanup to match SVN #23537 change
svn path=/trunk/; revision=23540
2007-11-22 00:33:22 +00:00
Guy Harris d722f061f4 Catch SIGINT, SIGHUP, and SIGTERM on UN*X, so we cleanly exit if, for
example, we're ^C'ed.  This should fix bug 2003.

svn path=/trunk/; revision=23538
2007-11-21 22:49:02 +00:00
Gerald Combs 58914b5248 If libcap is present, have dumpcap use it to drop privileges while
retaining CAP_NET_ADMIN and CAP_NET_RAW.  Update some Makefile
dependencies for dumpcap.

svn path=/trunk/; revision=23511
2007-11-20 16:53:01 +00:00
Gerald Combs 8f05294027 For the Wireshark/TShark -> dumpcap signal pipe on Windows, use a named
pipe instead of stdin.  Add an argument (currently the parent PID) back
to the "-Z" flag and use it to construct the pipe name.  This lets us
pass the parent's stdin handle to dumpcap, which lets us capture from
stdin on Windows.  Add a comment about checking for the parent process.

In capture_loop.c, remove the wait_forever argument from cap_pipe_select()
since it was always FALSE.  Set the timeout under Windows to 250 ms
instead of 250000 ms.

svn path=/trunk/; revision=23279
2007-10-26 16:32:28 +00:00
Guy Harris e8ea45d6ed Make the sync pipe the standard error, not the standard output, of
dumpcap, when using it as a capture child; leave the standard output
alone, in case tshark was told to write the capture to the standard
error.

Get rid of the argument to the "-Z" option to dumpcap; it might not work
on Windows.

svn path=/trunk/; revision=23124
2007-10-10 01:31:36 +00:00
Guy Harris 61e8c424b3 "get_compiled_version_info()" appends to the string text starting with
"with", so we shouldn't put our own "with" in there.

svn path=/trunk/; revision=23037
2007-09-30 22:34:15 +00:00
Guy Harris 322d44d416 Make the "-Z" argument to dumpcap take an argument that's the file
descriptor to use as the sync pipe.  For now, always pass 1, so the sync
pipe is the standard output of dumpcap.

svn path=/trunk/; revision=23025
2007-09-29 01:36:03 +00:00
Guy Harris 6d065e2eb2 Don't hardcode the notion that the sync pipe is the standard output into
sync_pipe_errmsg_to_parent(); have it take the FD for the sync pipe as
an argument.

svn path=/trunk/; revision=23024
2007-09-29 01:15:11 +00:00
Guy Harris 72eed77ed7 We don't use NetSNMP any more.
svn path=/trunk/; revision=23022
2007-09-29 01:01:02 +00:00
Gerald Combs 89a2966ced Add a "-S" flag to dumpcap, which prints out interface statistics. Use
this in the GUI rather than calling pcap_stats() directly. This gets rid
of the last pcap_open_live() call in the GUI code. Update
README.packaging.

svn path=/trunk/; revision=22443
2007-08-02 21:45:27 +00:00
Gerald Combs c02e0c7b4a Remove the "-I" flag from dumpcap, and add a "-M" flag used to specify
that "-D" and "-L" should produce machine-readable output.  Use this to
move an indirect get_pcap_linktype() call from the GUI to dumpcap.

svn path=/trunk/; revision=22367
2007-07-20 21:43:07 +00:00
Gerald Combs e9f1a0b692 One more step in privilege separation.
Add a capture_interface_list(), which works similar to
get_interface_list() except that it forks dumpcap instead of calling
the pcap routines directly.  Use it in the GUI.

Add a "-I" flag to dumpcap, which prints out verbose interface
information.

Tested under Windows and Linux.

svn path=/trunk/; revision=22071
2007-06-11 03:58:58 +00:00
Bill Meier 4009deca1b Output error msgs when using dumpcap from cmd-line (stand-alone);
Also: minor cleanup for capture_loop.c

svn path=/trunk/; revision=20864
2007-02-19 20:25:56 +00:00
Jeff Morriss 0c17bfd3a8 From Eric Hall to fix bug 1289:
http://bugs.wireshark.org/bugzilla/show_bug.cgi?id=1289

Rename 'svnversion' to 'wireshark_svnversion' to resolve a symbol conflict with
GTK 2.10.6 (hmm, shouldn't GTK not be exporting that symbol or at least naming
it so as to prevent such collisions? Well, so should we, so...)

From Andreas Fink: change #ifdef for size_t in airdcap_interop.h to fix
compile on MacOS X.


svn path=/trunk/; revision=20726
2007-02-06 02:27:59 +00:00
Jörg Mayer 23ce819952 Frederic Heem:
Fix some memleaks and overflows.

I haven't committed the changes that are not bug fixes.

svn path=/trunk/; revision=19777
2006-11-02 09:45:12 +00:00
Jaap Keuter 22a949a42f Make dumpcap complile again and other minor improvements.
svn path=/trunk/; revision=19624
2006-10-20 06:24:56 +00:00
Guy Harris 00d8ca2d45 Fix up the changes to put the Portaudio information at the end of the
version string, so the information comes out right for applications that
don't use Portaudio.

Get rid of an extra "with" in the version string for dumpcap.

Get rid of an extra blank after the libpcap version string, and get rid
of an extra newline before it.

Attempt to add more compiler version information and to prettify the
MSVC++ version information (both untested).

svn path=/trunk/; revision=19613
2006-10-19 18:43:12 +00:00
Gerald Combs 9e23f31e5f Add support for reading from stdin under Windows. Based on a patch sent
in last year by Gianluca Varenni.

Add partial support for reading from named pipes (currently disabled).

Move utf_8to16() and utf_16to8() to a separate module (unicode-utils.[ch])
so that we don't have to cut and paste code in dumpcap.c.

Fix up whitespace.

svn path=/trunk/; revision=19291
2006-09-22 21:14:54 +00:00
Guy Harris 594cab8a63 Add to a comment.
svn path=/trunk/; revision=18987
2006-08-21 23:06:40 +00:00
Ulf Lamping 0cfb4a78d6 put utf_16to8 under #ifdef _WIN32, thanks Toralf
svn path=/trunk/; revision=18892
2006-08-13 15:33:23 +00:00
Ulf Lamping f7f96d52dd another place missing a call to utf_16to8(), the about box was showing "Windows XP S", where it should be "Windows XP Service Pack 2"
dumpcap uses this too, so I had to duplicate utf_16to8 there :-(

svn path=/trunk/; revision=18891
2006-08-13 12:12:06 +00:00
Anders Broman f68d6e4c8c Ethereal->Wireshark
svn path=/trunk/; revision=18235
2006-05-28 20:28:20 +00:00
Ronnie Sahlberg 89f022b12b name change
svn path=/trunk/; revision=18197
2006-05-21 05:12:17 +00:00
Guy Harris bd847a5617 Don't report the interface name unconditionally.
svn path=/trunk/; revision=17793
2006-04-03 03:15:29 +00:00
Guy Harris d260003026 Put the low-level sync routines into a common file so they can be shared
by dumpcap and Ethereal (so that, on UN*X, the child process can report
a detailed "can't exec dumpcap" error).

Rename most of the "sync_pipe_XXX_to_parent()" routines, as they're also
in Tethereal, which doesn't have a sync pipe.

svn path=/trunk/; revision=17789
2006-04-03 01:56:53 +00:00
Guy Harris 2de9620eea In Tethereal, don't save to a temporary file if "-w" isn't specified,
even if doing a live capture; just print the packets without saving
them.

In dumpcap:

	default to the capturing the entire packet;

	don't do the "Press any key" stuff when debugging on UN*X;

	do console logging (to the standard error) even when we're
	running as the capture child (the sync pipe should only be the
	standard output, not the standard error).

svn path=/trunk/; revision=17786
2006-04-03 00:52:59 +00:00
Ulf Lamping fe3c3029aa Various code cleanup in the capture pipe stuff
svn path=/trunk/; revision=17714
2006-03-24 02:23:48 +00:00
Ulf Lamping 069b26b2d9 fix bug #803: sync pipe on Win32 wasn't set to binary mode, so error message transport failed between Ethereal and dumpcap.
I've also changed the way the secondary error message is transported from former "header message 0 secondary 0" to "header header message 0 header secondary 0" as that might be a bit more clearer, and I'll need it for further development anyway.

I was using this while debugging and not recognizing the real problem - for about four hours :-(. I'll need this feature when doing the interface (and link layer type) browsing later (transferring this data from dumpcap to Ethereal) to get a full blown privilege seperation.

svn path=/trunk/; revision=17608
2006-03-13 00:30:51 +00:00
Guy Harris cbe69401cc Pass two strings in capture child messages, so the child can send
primary and secondary error messages and let the parent worry about how
to display them.  This means dumpcap doesn't need stub routines for
generating the formatting tags for the primary and secondary messages.

Have a separate message for capture filter errors, so that the parent
can check whether the capture filter looks like a display filter and
report the appropriate message.  This means that dumpcap doesn't need a
stub routine for compiling display filters (a stub routine also means
that Ethereal won't do the check for capture filters that look like
display filters!).

svn path=/trunk/; revision=17465
2006-03-05 03:14:16 +00:00
Ulf Lamping e6fb194094 update some comments, as dumpcap no longer uses console window stuff
svn path=/trunk/; revision=17403
2006-02-25 00:00:33 +00:00
Ulf Lamping 79053183c5 remove dependencies to pcap.h, so getting an idea what needs to be done by dumpcap in addition to the things already done now
various dumpcap related code cleanup: mainly #include's and capture engine related stuff

svn path=/trunk/; revision=17327
2006-02-17 02:18:48 +00:00
Guy Harris 4d8d477018 Move create_tempfile() to tempfile.c out of util.c. This means dumpcap
no longer needs util.c, so it no longer includes routines that use
host_ip_af(), so it no longer needs to define its own host_ip_af().

That also means dumpcap.c no longer needs to include <sys/socket.h>.

svn path=/trunk/; revision=17278
2006-02-12 21:52:18 +00:00
Ulf Lamping 1a7d4a9bf9 freebsd needs to define AF_INET6, seems to need sys/socket.h
svn path=/trunk/; revision=17269
2006-02-12 11:35:02 +00:00
Ulf Lamping cf94760fa4 the point of no return ...
using dumpcap as the capture child for Ethereal.

dumpcap is a plain console application now, even for Win32 (so no WinMain, create_console and special piping stuff reguired). The undocumented command line option -Z will switch dumpcap into "child mode", using binary instead of plain text output messages to communicate with a parent Ethereal.

Ethereal's main.c no longer needs to distinguish between child mode or not, so some simplifying here.

capture_sync.c has to call dumpcap in a "hidden window" mode using CreateProcess instead of spawnvp, otherwise an uggly console window would appear. The handles created by _pipe doesn't seem to be inheritable for this function, using CreatePipe instead.

The file capture_loop.c is only needed by dumpcap, removed from Ethereal link objects.

Some debugging aid added and other minor cleanup done.

svn path=/trunk/; revision=17256
2006-02-11 23:25:11 +00:00
Ulf Lamping e4e8df5e1d remove all calls to exit() from the capture_opts.c and replace them by status return values (0,1 or 2).
This way makes it much easier to debug, e.g. to set a common breakpoint if a command line parameter fails.

svn path=/trunk/; revision=17240
2006-02-10 02:05:30 +00:00
Ulf Lamping c98e18c555 some improvements in the console output handling
svn path=/trunk/; revision=17238
2006-02-10 01:18:24 +00:00
Ulf Lamping 0ce310bd86 minor changes to the usage output
svn path=/trunk/; revision=17009
2006-01-12 00:09:15 +00:00
Ulf Lamping 4f3c493e1d cleanup of exit_main() declaration
svn path=/trunk/; revision=16960
2006-01-05 22:27:25 +00:00
Jörg Mayer 056c408531 __attribute__ noreturn can only be used in function declations.
svn path=/trunk/; revision=16938
2006-01-03 23:43:24 +00:00
Ulf Lamping a2fe0e2b0a add the GCC specific attribute "noreturn" to exit_main()
add an error message if no interfaces could be found (and mention that it might be a privilege problem)

svn path=/trunk/; revision=16924
2005-12-31 10:51:15 +00:00
Ulf Lamping d5265fd7a4 From Jaap Keuter:
Even though dumpcap isn't finished I would like this patch applied in
order to:
1. remove some compiler warnings
2. avoid a seg fault when running dumpcap without parameters as normal
user.

svn path=/trunk/; revision=16922
2005-12-31 10:22:57 +00:00
Jörg Mayer b06bd208d0 warning: function declaration isn't a prototype
svn path=/trunk/; revision=16852
2005-12-18 23:18:06 +00:00
Ulf Lamping fb6554117f some minor fixes: logging and comments fixed
svn path=/trunk/; revision=16819
2005-12-16 07:43:24 +00:00
Ulf Lamping 27b13556ec use capture_opts_trim_iface() instead of duplicated code
various minor code cleanup

svn path=/trunk/; revision=16805
2005-12-15 00:45:29 +00:00
Ulf Lamping 79217bab2e HUGE STEP (hopefully toward the right direction):
remove a lot of redundant code from tethereal and use (move) stuff from capture_loop.c instead.

concentrate common capture related code in capture_opts.c, e.g. trying to find the right interface to capture from (command line option, preference, first usable) instead of duplicating this code over several files.

remove redundant code from dumpcap.c

this also implements command line option -D (and indexed interfaces at -i) for Ethereal and Dumpcap (as we have it in Tethereal already for a while)

svn path=/trunk/; revision=16787
2005-12-13 22:48:58 +00:00
Ulf Lamping 7e3a24418c rename pcap-....c/.h files to capture-pcap-....c/.h
this way, the capture prefix will "logically" group the files together and file browsers will also group them

we may want to move the files into a subdir capture later

svn path=/trunk/; revision=16691
2005-12-06 00:07:13 +00:00
Ulf Lamping 792584c211 no more usage of Ethereal.lib in dumpcap any longer :-)
use capture_opts_trim()
output of command line usage and version "enhanced"

svn path=/trunk/; revision=16684
2005-12-05 21:28:34 +00:00
Jörg Mayer d8c09f7f2e We need AF_INET6 on linux, so include netdb.h if available.
Add dumpcap to svn:ignore.


svn path=/trunk/; revision=16676
2005-12-04 23:50:57 +00:00
Ulf Lamping e829856c0c move the complete functionality of the capture info dialog from capture_loop.c to capture_info.c and call it from capture.c (instead of capture_loop.c).
This way, the capture child don't need to now any of the packet_counter things (no epan/packet.h and all alike).

Currently the capture_info code will always open another wiretap file instance to build it's own counter values. This isn't optimized for now (next step: use data from cf_continue_tail() somehow).

svn path=/trunk/; revision=16669
2005-12-04 02:04:18 +00:00
Ulf Lamping f856dbafa8 split some parts of the packet counting functions into their own files capture_info(.c/.h),
so we can use it from the main program

svn path=/trunk/; revision=16668
2005-12-03 22:38:50 +00:00
Ulf Lamping d2a024af60 split capture.h into capture.h, capture_loop.h and capture_opts.h and place the parts into the corresponding files
svn path=/trunk/; revision=16664
2005-12-03 19:32:54 +00:00
Ulf Lamping a11d07e3f4 fix OPTINIT string, help output and add an exit_main function
svn path=/trunk/; revision=16643
2005-12-01 20:19:30 +00:00
Ulf Lamping 61dc6ad226 dumpcap.c doesn't need to link with file.c!
this fortunately removes *a lot* of dependencies and make the resulting binary a lot smaller (and hopefully faster to load :-)

some more cleanup (like replacing // by /**/)

svn path=/trunk/; revision=16620
2005-11-28 20:51:27 +00:00
Guy Harris 4e4c2942e7 Add support for building dumpcap, and fix dumpcap to build on UN*X.
svn path=/trunk/; revision=16618
2005-11-28 11:40:28 +00:00
Ulf Lamping fc61a1de25 first steps towards a separated capture tool, working title "dumpcap"
personal backup only, not meant for public testing!

I've copied main.c into dumpcap.c and carved out all things not needed

currently won't work as a command line tool, capture_loop.c wants an input pipe
console output is also very ugly and the whole code needs a lot of further cleanup

shouldn't break the unix build as I've only changed the nmake files so far, but who knows ...

svn path=/trunk/; revision=16615
2005-11-28 08:54:52 +00:00