Commit Graph

183 Commits

Author SHA1 Message Date
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