aboutsummaryrefslogtreecommitdiffstats
path: root/dumpcap.c
AgeCommit message (Collapse)AuthorFilesLines
2010-03-13From Hilko Bengen: support capturing from UNIX-domain sockets.Guy Harris1-16/+74
Update a comment. svn path=/trunk/; revision=32177
2010-03-04"capture-pcap-util.h" include <pcap.h>, and <pcap.h>, for better orGuy Harris1-3/+2
worse, has no include-once guards; include it only once. svn path=/trunk/; revision=32110
2010-03-04In Wireshark and TShark, run dumpcap to get interface lists and lists ofGuy Harris1-0/+20
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-01Squelch some compiler warnings.Guy Harris1-9/+9
svn path=/trunk/; revision=32074
2010-02-27Move a routine into dumpcap - it's not used outside dumpcap.Guy Harris1-0/+20
svn path=/trunk/; revision=32042
2010-01-14If we're using threads, time out when reading the file header.Gerald Combs1-5/+26
svn path=/trunk/; revision=31529
2009-11-26Only do the 1-second timeout in OS X 10.6 and 10.6.1; the bug is fixedGuy Harris1-1/+32
in 10.6.2. svn path=/trunk/; revision=31081
2009-10-06Invert check for getopt: NEED_GETOPT_H -> HAVE_GETOPT_HStig Bjørlykke1-3/+4
Rename getopt.[ch] -> wsgetopt.[ch] to avoid name collision. svn path=/trunk/; revision=30370
2009-10-01Cast a pointer to avoid a warning.Stig Bjørlykke1-1/+1
svn path=/trunk/; revision=30229
2009-09-29Initialize magic to avoid a warning about a possible uninitialized read.Stig Bjørlykke1-1/+1
svn path=/trunk/; revision=30188
2009-09-13Don't use SIGUSR1 to tell dumpcap to exit, use SIGINT: SIGINT is traditionallyJeff Morriss1-38/+17
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-08Use Wireshark/GLib attribute specifiers instead of checking for __GNUC__ ↵Kovarththanan Rajaratnam1-14/+9
explicitly svn path=/trunk/; revision=29804
2009-08-31Use a timeout of a second for Mac OS X, when buildingMichael Tüxen1-0/+4
a 64-bit application. Workaround a bug in Mac OS X... svn path=/trunk/; revision=29641
2009-08-28Make the windows build compile.Anders Broman1-0/+2
svn path=/trunk/; revision=29591
2009-08-27Properly set our file descriptor when we're capturing from a pipe onGerald Combs1-0/+1
non-Windows systems. svn path=/trunk/; revision=29590
2009-08-27Check for INVALID_HANDLE_VALUE instead of NULL on Windows. This keepsGerald Combs1-11/+10
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-27Add #include <stdio.h> in a few places for SolarisBill Meier1-1/+1
svn path=/trunk/; revision=29576
2009-08-26Add a compile-time option to use a separate thread for reading fromGerald Combs1-140/+346
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-22From Rob Leslie <rob@mars.org>:Balint Reczey1-1/+4
[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-07-01Updates to create_tempfile:Gerald Combs1-2/+2
- 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-06-26Unfortunately, r28452 seems to cause more problems than it fixes. BackGerald Combs1-146/+25
out the change for now. svn path=/trunk/; revision=28852
2009-05-31Set SIGPIPE handler every time the program starts.Balint Reczey1-11/+1
This hopefully fixes bug 1740. svn path=/trunk/; revision=28549
2009-05-22From Benjamin Tse via bug 2200:Gerald Combs1-25/+146
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-04-27Add -n option to dumpcap. It will save the capture files inMichael Tüxen1-9/+53
pcapng format instead of pcap. The default is to use pcap. svn path=/trunk/; revision=28170
2009-04-26Make ringbuffer.[ch] file format agnostic.Michael Tüxen1-10/+31
Move write routines to dumpcap.c This is a preparation for pcapng support. svn path=/trunk/; revision=28155
2009-04-16Fix the last(?) of the Win64 compilation problems.Gerald Combs1-13/+13
svn path=/trunk/; revision=28065
2009-04-08Use wireshark (instead of ether) for temp file name prefix.Bill Meier1-1/+1
svn path=/trunk/; revision=27992
2009-01-11From Toralf Förster:Jaap Keuter1-2/+1
Small cleanup of preprocessor logic. svn path=/trunk/; revision=27212
2009-01-11From Ronald W. Henderson:Jaap Keuter1-8/+7
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
2008-11-26From Pavol Rusnak (bug 1740):Balint Reczey1-0/+1
Set SA_RESTART flag when setting SIGPIPE handler. svn path=/trunk/; revision=26851
2008-11-03Do not set buffer size for remote interfaces or when using default value.Stig Bjørlykke1-1/+2
Do not get link-layer for remote interfaces. svn path=/trunk/; revision=26683
2008-10-31Fixed some "ignoring return value" warnings.Stig Bjørlykke1-2/+4
This is the last commit to make it compile clean on Ubuntu 8.10. svn path=/trunk/; revision=26654
2008-10-30Based on patch from Sergio Barjola:Balint Reczey1-0/+10
Enable the default action for SIGPIPE This fixes bug 2888 and 1740 svn path=/trunk/; revision=26621
2008-08-19The packet counts and drop counts reported by libpcap are unsigned.Guy Harris1-5/+5
Clean up indentation a bit. svn path=/trunk/; revision=26037
2008-07-25If we can't open open an interface in Windows, instead of talking aboutGerald Combs1-13/+2
specific issues (one of which no longer applies), point the user at the wiki. svn path=/trunk/; revision=25833
2008-06-30Move privileges.c and unicode-utils.c from epan to wsutil (so things likeJeff Morriss1-2/+2
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-24Fix some references to the global loop_data structure that weren'tGuy Harris1-6/+8
changed in the previous checkin. svn path=/trunk/; revision=25573
2008-06-23Rename the global "ld" structure to "global_ld", to avoid collisionsGuy Harris1-50/+53
with the "ld" pointer argument (and to point out that it's a global variable). svn path=/trunk/; revision=25554
2008-06-23Get rid of the static capture_opts pointer - it collides with parameterGuy Harris1-19/+18
names, as noted by John Smith. svn path=/trunk/; revision=25542
2008-06-20capture_opts_print_statistics() has nothing to do with capture optionsGuy Harris1-1/+95
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-05-23Fix some of the Errors/warnings detected by checkapi.Anders Broman1-1/+1
svn path=/trunk/; revision=25368
2008-05-22Move the file utility functions from wiretap to libwsutil so thatJeff Morriss1-8/+8
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-03-24Fix a few typos.Bill Meier1-6/+6
svn path=/trunk/; revision=24724
2008-03-24dumpcap.c: Fix a typo.Gerald Combs1-3/+3
INSTALL: Add entries for libcap. svn path=/trunk/; revision=24722
2008-03-22Fix (aka workaround) for bug #2228.Bill Meier1-50/+160
Essentially: if using libcap, drop capabilities after doing pcap_open_live. See comment in main() for details. svn path=/trunk/; revision=24716
2008-03-20Don't call cap_set_proc() unless we were started with elevatedGerald Combs1-5/+8
privileges. Otherwise, we might print dumpcap: cap_set_proc() fail return: Operation not permitted to stderr. svn path=/trunk/; revision=24704
2008-02-29Fix for handling dumpcap errmsgs when wireshark does 'dumpcap -D -M', etc Bill Meier1-8/+14
svn path=/trunk/; revision=24507
2008-02-25Use plain old strcmp() instead of g_ascii_strcasecmp() when searching for -Z.Jeff Morriss1-12/+8
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-23Ensure tshark/wireshark always get good err msgs from dumpcap:Bill Meier1-38/+108
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-16dumpcap doesn't need stuff declared in capture.h; it just needs what'sGuy Harris1-1/+1
declared in capture_opts.h. svn path=/trunk/; revision=24352