aboutsummaryrefslogtreecommitdiffstats
path: root/dumpcap.c
Commit message (Collapse)AuthorAgeFilesLines
* If we're using threads, time out when reading the file header.Gerald Combs2010-01-141-5/+26
| | | | svn path=/trunk/; revision=31529
* Only do the 1-second timeout in OS X 10.6 and 10.6.1; the bug is fixedGuy Harris2009-11-261-1/+32
| | | | | | in 10.6.2. svn path=/trunk/; revision=31081
* Invert check for getopt: NEED_GETOPT_H -> HAVE_GETOPT_HStig Bjørlykke2009-10-061-3/+4
| | | | | | Rename getopt.[ch] -> wsgetopt.[ch] to avoid name collision. svn path=/trunk/; revision=30370
* Cast a pointer to avoid a warning.Stig Bjørlykke2009-10-011-1/+1
| | | | svn path=/trunk/; revision=30229
* Initialize magic to avoid a warning about a possible uninitialized read.Stig Bjørlykke2009-09-291-1/+1
| | | | svn path=/trunk/; revision=30188
* Don't use SIGUSR1 to tell dumpcap to exit, use SIGINT: SIGINT is traditionallyJeff Morriss2009-09-131-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
* Use Wireshark/GLib attribute specifiers instead of checking for __GNUC__ ↵Kovarththanan Rajaratnam2009-09-081-14/+9
| | | | | | explicitly svn path=/trunk/; revision=29804
* Use a timeout of a second for Mac OS X, when buildingMichael Tüxen2009-08-311-0/+4
| | | | | | a 64-bit application. Workaround a bug in Mac OS X... svn path=/trunk/; revision=29641
* Make the windows build compile.Anders Broman2009-08-281-0/+2
| | | | svn path=/trunk/; revision=29591
* Properly set our file descriptor when we're capturing from a pipe onGerald Combs2009-08-271-0/+1
| | | | | | non-Windows systems. svn path=/trunk/; revision=29590
* Check for INVALID_HANDLE_VALUE instead of NULL on Windows. This keepsGerald Combs2009-08-271-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
* Add #include <stdio.h> in a few places for SolarisBill Meier2009-08-271-1/+1
| | | | svn path=/trunk/; revision=29576
* Add a compile-time option to use a separate thread for reading fromGerald Combs2009-08-261-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
* From Rob Leslie <rob@mars.org>:Balint Reczey2009-08-221-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
* Updates to create_tempfile:Gerald Combs2009-07-011-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
* Unfortunately, r28452 seems to cause more problems than it fixes. BackGerald Combs2009-06-261-146/+25
| | | | | | out the change for now. svn path=/trunk/; revision=28852
* Set SIGPIPE handler every time the program starts.Balint Reczey2009-05-311-11/+1
| | | | | | This hopefully fixes bug 1740. svn path=/trunk/; revision=28549
* From Benjamin Tse via bug 2200:Gerald Combs2009-05-221-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
* Add -n option to dumpcap. It will save the capture files inMichael Tüxen2009-04-271-9/+53
| | | | | | pcapng format instead of pcap. The default is to use pcap. svn path=/trunk/; revision=28170
* Make ringbuffer.[ch] file format agnostic.Michael Tüxen2009-04-261-10/+31
| | | | | | | Move write routines to dumpcap.c This is a preparation for pcapng support. svn path=/trunk/; revision=28155
* Fix the last(?) of the Win64 compilation problems.Gerald Combs2009-04-161-13/+13
| | | | svn path=/trunk/; revision=28065
* Use wireshark (instead of ether) for temp file name prefix.Bill Meier2009-04-081-1/+1
| | | | svn path=/trunk/; revision=27992
* From Toralf Förster:Jaap Keuter2009-01-111-2/+1
| | | | | | Small cleanup of preprocessor logic. svn path=/trunk/; revision=27212
* From Ronald W. Henderson:Jaap Keuter2009-01-111-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
* From Pavol Rusnak (bug 1740):Balint Reczey2008-11-261-0/+1
| | | | | | Set SA_RESTART flag when setting SIGPIPE handler. svn path=/trunk/; revision=26851
* Do not set buffer size for remote interfaces or when using default value.Stig Bjørlykke2008-11-031-1/+2
| | | | | | Do not get link-layer for remote interfaces. svn path=/trunk/; revision=26683
* Fixed some "ignoring return value" warnings.Stig Bjørlykke2008-10-311-2/+4
| | | | | | This is the last commit to make it compile clean on Ubuntu 8.10. svn path=/trunk/; revision=26654
* Based on patch from Sergio Barjola:Balint Reczey2008-10-301-0/+10
| | | | | | | Enable the default action for SIGPIPE This fixes bug 2888 and 1740 svn path=/trunk/; revision=26621
* The packet counts and drop counts reported by libpcap are unsigned.Guy Harris2008-08-191-5/+5
| | | | | | Clean up indentation a bit. svn path=/trunk/; revision=26037
* If we can't open open an interface in Windows, instead of talking aboutGerald Combs2008-07-251-13/+2
| | | | | | | specific issues (one of which no longer applies), point the user at the wiki. svn path=/trunk/; revision=25833
* Move privileges.c and unicode-utils.c from epan to wsutil (so things likeJeff Morriss2008-06-301-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
* Fix some references to the global loop_data structure that weren'tGuy Harris2008-06-241-6/+8
| | | | | | changed in the previous checkin. svn path=/trunk/; revision=25573
* Rename the global "ld" structure to "global_ld", to avoid collisionsGuy Harris2008-06-231-50/+53
| | | | | | | with the "ld" pointer argument (and to point out that it's a global variable). svn path=/trunk/; revision=25554
* Get rid of the static capture_opts pointer - it collides with parameterGuy Harris2008-06-231-19/+18
| | | | | | names, as noted by John Smith. svn path=/trunk/; revision=25542
* capture_opts_print_statistics() has nothing to do with capture optionsGuy Harris2008-06-201-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
* Fix some of the Errors/warnings detected by checkapi.Anders Broman2008-05-231-1/+1
| | | | svn path=/trunk/; revision=25368
* Move the file utility functions from wiretap to libwsutil so thatJeff Morriss2008-05-221-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
* Fix a few typos.Bill Meier2008-03-241-6/+6
| | | | svn path=/trunk/; revision=24724
* dumpcap.c: Fix a typo.Gerald Combs2008-03-241-3/+3
| | | | | | INSTALL: Add entries for libcap. svn path=/trunk/; revision=24722
* Fix (aka workaround) for bug #2228.Bill Meier2008-03-221-50/+160
| | | | | | | | Essentially: if using libcap, drop capabilities after doing pcap_open_live. See comment in main() for details. svn path=/trunk/; revision=24716
* Don't call cap_set_proc() unless we were started with elevatedGerald Combs2008-03-201-5/+8
| | | | | | | | | | privileges. Otherwise, we might print dumpcap: cap_set_proc() fail return: Operation not permitted to stderr. svn path=/trunk/; revision=24704
* Fix for handling dumpcap errmsgs when wireshark does 'dumpcap -D -M', etc Bill Meier2008-02-291-8/+14
| | | | svn path=/trunk/; revision=24507
* Use plain old strcmp() instead of g_ascii_strcasecmp() when searching for -Z.Jeff Morriss2008-02-251-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
* Ensure tshark/wireshark always get good err msgs from dumpcap:Bill Meier2008-02-231-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
* dumpcap doesn't need stuff declared in capture.h; it just needs what'sGuy Harris2008-02-161-1/+1
| | | | | | declared in capture_opts.h. svn path=/trunk/; revision=24352
* One include of epan/unicode-utils.h suffices - and the routines itGuy Harris2008-02-161-2/+0
| | | | | | declares are called only on Windows. svn path=/trunk/; revision=24351
* Directly call capture_loop_packet_cb(), rather than making a pointer toGuy Harris2008-02-161-11/+6
| | | | | | | the callback function part of the loop_data structure - we always call capture_loop_packet_cb(). svn path=/trunk/; revision=24350
* If we don't have libcap, relinquish special privileges just afterGuy Harris2008-02-161-3/+5
| | | | | | | | | | | | | 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
* Pull capture_loop.c into dumpcap.c, as dumpcap is the only program thatGuy Harris2008-02-161-14/+1844
| | | | | | | | 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
* Fix typo in help textBill Meier2008-01-201-1/+1
| | | | svn path=/trunk/; revision=24148