aboutsummaryrefslogtreecommitdiffstats
path: root/dumpcap.c
AgeCommit message (Collapse)AuthorFilesLines
2008-03-24Fix a few typos.wmeier1-6/+6
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@24724 f5534014-38df-0310-8fa8-9805f1628bb7
2008-03-24dumpcap.c: Fix a typo.gerald1-3/+3
INSTALL: Add entries for libcap. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@24722 f5534014-38df-0310-8fa8-9805f1628bb7
2008-03-22Fix (aka workaround) for bug #2228.wmeier1-50/+160
Essentially: if using libcap, drop capabilities after doing pcap_open_live. See comment in main() for details. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@24716 f5534014-38df-0310-8fa8-9805f1628bb7
2008-03-20Don't call cap_set_proc() unless we were started with elevatedgerald1-5/+8
privileges. Otherwise, we might print dumpcap: cap_set_proc() fail return: Operation not permitted to stderr. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@24704 f5534014-38df-0310-8fa8-9805f1628bb7
2008-02-29Fix for handling dumpcap errmsgs when wireshark does 'dumpcap -D -M', etc wmeier1-8/+14
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@24507 f5534014-38df-0310-8fa8-9805f1628bb7
2008-02-25Use plain old strcmp() instead of g_ascii_strcasecmp() when searching for -Z.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.) git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@24462 f5534014-38df-0310-8fa8-9805f1628bb7
2008-02-23Ensure tshark/wireshark always get good err msgs from dumpcap:wmeier1-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. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@24446 f5534014-38df-0310-8fa8-9805f1628bb7
2008-02-16dumpcap doesn't need stuff declared in capture.h; it just needs what'sguy1-1/+1
declared in capture_opts.h. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@24352 f5534014-38df-0310-8fa8-9805f1628bb7
2008-02-16One include of epan/unicode-utils.h suffices - and the routines itguy1-2/+0
declares are called only on Windows. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@24351 f5534014-38df-0310-8fa8-9805f1628bb7
2008-02-16Directly call capture_loop_packet_cb(), rather than making a pointer toguy1-11/+6
the callback function part of the loop_data structure - we always call capture_loop_packet_cb(). git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@24350 f5534014-38df-0310-8fa8-9805f1628bb7
2008-02-16If we don't have libcap, relinquish special privileges just afterguy1-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. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@24347 f5534014-38df-0310-8fa8-9805f1628bb7
2008-02-16Pull capture_loop.c into dumpcap.c, as dumpcap is the only program thatguy1-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.) git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@24345 f5534014-38df-0310-8fa8-9805f1628bb7
2008-01-20Fix typo in help textwmeier1-1/+1
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@24148 f5534014-38df-0310-8fa8-9805f1628bb7
2007-12-04Support for RPCAP features in GUI (from Boris Misenov, see Bug 1366)kukosa1-0/+23
- 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 git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@23750 f5534014-38df-0310-8fa8-9805f1628bb7
2007-11-22Rename Windows ConsoleCtrHandlerRoutine --> capture_cleanup to match SVN ↵wmeier1-1/+1
#23537 change git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@23540 f5534014-38df-0310-8fa8-9805f1628bb7
2007-11-21Catch SIGINT, SIGHUP, and SIGTERM on UN*X, so we cleanly exit if, forguy1-1/+48
example, we're ^C'ed. This should fix bug 2003. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@23538 f5534014-38df-0310-8fa8-9805f1628bb7
2007-11-20If libcap is present, have dumpcap use it to drop privileges whilegerald1-0/+70
retaining CAP_NET_ADMIN and CAP_NET_RAW. Update some Makefile dependencies for dumpcap. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@23511 f5534014-38df-0310-8fa8-9805f1628bb7
2007-10-26For the Wireshark/TShark -> dumpcap signal pipe on Windows, use a namedgerald1-8/+44
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. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@23279 f5534014-38df-0310-8fa8-9805f1628bb7
2007-10-10Make the sync pipe the standard error, not the standard output, ofguy1-10/+7
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. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@23124 f5534014-38df-0310-8fa8-9805f1628bb7
2007-09-30"get_compiled_version_info()" appends to the string text starting withguy1-1/+1
"with", so we shouldn't put our own "with" in there. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@23037 f5534014-38df-0310-8fa8-9805f1628bb7
2007-09-29Make the "-Z" argument to dumpcap take an argument that's the fileguy1-7/+10
descriptor to use as the sync pipe. For now, always pass 1, so the sync pipe is the standard output of dumpcap. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@23025 f5534014-38df-0310-8fa8-9805f1628bb7
2007-09-29Don't hardcode the notion that the sync pipe is the standard output intoguy1-1/+1
sync_pipe_errmsg_to_parent(); have it take the FD for the sync pipe as an argument. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@23024 f5534014-38df-0310-8fa8-9805f1628bb7
2007-09-29We don't use NetSNMP any more.guy1-8/+0
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@23022 f5534014-38df-0310-8fa8-9805f1628bb7
2007-08-02Add a "-S" flag to dumpcap, which prints out interface statistics. Usegerald1-5/+16
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. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@22443 f5534014-38df-0310-8fa8-9805f1628bb7
2007-07-20Remove the "-I" flag from dumpcap, and add a "-M" flag used to specifygerald1-13/+17
that "-D" and "-L" should produce machine-readable output. Use this to move an indirect get_pcap_linktype() call from the GUI to dumpcap. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@22367 f5534014-38df-0310-8fa8-9805f1628bb7
2007-06-11One more step in privilege separation.gerald1-10/+20
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. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@22071 f5534014-38df-0310-8fa8-9805f1628bb7
2007-02-19Output error msgs when using dumpcap from cmd-line (stand-alone);wmeier1-16/+25
Also: minor cleanup for capture_loop.c git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@20864 f5534014-38df-0310-8fa8-9805f1628bb7
2007-02-06From Eric Hall to fix bug 1289:morriss1-2/+2
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. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@20726 f5534014-38df-0310-8fa8-9805f1628bb7
2006-11-02Frederic Heem:jmayer1-9/+14
Fix some memleaks and overflows. I haven't committed the changes that are not bug fixes. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@19777 f5534014-38df-0310-8fa8-9805f1628bb7
2006-10-20Make dumpcap complile again and other minor improvements.jake1-6/+10
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@19624 f5534014-38df-0310-8fa8-9805f1628bb7
2006-10-19Fix up the changes to put the Portaudio information at the end of theguy1-2/+1
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). git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@19613 f5534014-38df-0310-8fa8-9805f1628bb7
2006-09-22Add support for reading from stdin under Windows. Based on a patch sentgerald1-46/+0
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. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@19291 f5534014-38df-0310-8fa8-9805f1628bb7
2006-08-21Add to a comment.guy1-0/+1
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@18987 f5534014-38df-0310-8fa8-9805f1628bb7
2006-08-13put utf_16to8 under #ifdef _WIN32, thanks Toralfulfl1-0/+4
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@18892 f5534014-38df-0310-8fa8-9805f1628bb7
2006-08-13another place missing a call to utf_16to8(), the about box was showing ↵ulfl1-0/+43
"Windows XP S", where it should be "Windows XP Service Pack 2" dumpcap uses this too, so I had to duplicate utf_16to8 there :-( git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@18891 f5534014-38df-0310-8fa8-9805f1628bb7
2006-05-28Ethereal->Wiresharketxrab1-4/+4
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@18235 f5534014-38df-0310-8fa8-9805f1628bb7
2006-05-21name changesahlberg1-2/+2
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@18197 f5534014-38df-0310-8fa8-9805f1628bb7
2006-04-03Don't report the interface name unconditionally.guy1-1/+1
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@17793 f5534014-38df-0310-8fa8-9805f1628bb7
2006-04-03Put the low-level sync routines into a common file so they can be sharedguy1-73/+13
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. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@17789 f5534014-38df-0310-8fa8-9805f1628bb7
2006-04-03In Tethereal, don't save to a temporary file if "-w" isn't specified,guy1-43/+45
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). git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@17786 f5534014-38df-0310-8fa8-9805f1628bb7
2006-03-24Various code cleanup in the capture pipe stuffulfl1-11/+2
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@17714 f5534014-38df-0310-8fa8-9805f1628bb7
2006-03-13fix bug #803: sync pipe on Win32 wasn't set to binary mode, so error message ↵ulfl1-39/+42
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. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@17608 f5534014-38df-0310-8fa8-9805f1628bb7
2006-03-05Pass two strings in capture child messages, so the child can sendguy1-49/+49
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!). git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@17465 f5534014-38df-0310-8fa8-9805f1628bb7
2006-02-25update some comments, as dumpcap no longer uses console window stuffulfl1-21/+2
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@17403 f5534014-38df-0310-8fa8-9805f1628bb7
2006-02-17remove dependencies to pcap.h, so getting an idea what needs to be done by ↵ulfl1-55/+101
dumpcap in addition to the things already done now various dumpcap related code cleanup: mainly #include's and capture engine related stuff git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@17327 f5534014-38df-0310-8fa8-9805f1628bb7
2006-02-12Move create_tempfile() to tempfile.c out of util.c. This means dumpcapguy1-26/+0
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>. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@17278 f5534014-38df-0310-8fa8-9805f1628bb7
2006-02-12freebsd needs to define AF_INET6, seems to need sys/socket.hulfl1-0/+4
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@17269 f5534014-38df-0310-8fa8-9805f1628bb7
2006-02-11the point of no return ...ulfl1-175/+16
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. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@17256 f5534014-38df-0310-8fa8-9805f1628bb7
2006-02-10remove all calls to exit() from the capture_opts.c and replace them by ↵ulfl1-5/+9
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. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@17240 f5534014-38df-0310-8fa8-9805f1628bb7
2006-02-10some improvements in the console output handlingulfl1-17/+96
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@17238 f5534014-38df-0310-8fa8-9805f1628bb7