Commit Graph

115 Commits

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