aboutsummaryrefslogtreecommitdiffstats
path: root/dumpcap.c
AgeCommit message (Collapse)AuthorFilesLines
2011-02-17On Windows, try putting __declspec(noreturn) in front of declarations ofGuy Harris1-1/+1
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-01-06On Windows, convert all of our command-line arguments from UTF-16 toGerald Combs1-0/+13
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-04Free dumpcap from linking to wiretap.Jaap Keuter1-32/+8
svn path=/trunk/; revision=35353
2010-11-18Add a comment about the pipe read timeout on Windows.Gerald Combs1-0/+4
svn path=/trunk/; revision=34947
2010-11-17Set the pipe read timeout to 100 milliseconds instead of 100 microseconds.Gerald Combs1-3/+1
Should fix bug 5309. svn path=/trunk/; revision=34938
2010-11-16If pcap_geterr() returns "read error: PacketReceivePacket failed", report thatChris Maynard1-1/+2
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-16Use more meaningful temp file name. Fixes bug 1882.Chris Maynard1-1/+35
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-11OS X 10.6.5 is out, and it re-incorporates the libpcap workaround forGuy Harris1-15/+10
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-10-21Fixed "Compiled with" information in the About box.Stig Bjørlykke1-1/+1
svn path=/trunk/; revision=34601
2010-09-30PIPE_READ_TIMEOUT should be in microseconds, not milliseconds.Guy Harris1-6/+7
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-30Always use a timeout of 250ms for pipes when not using threads; that wayGuy Harris1-10/+19
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-16Turn on ASLR via /DYNAMICBASE and DEP via SetProcessDEPPolicy().Gerald Combs1-1/+1
svn path=/trunk/; revision=34137
2010-08-28As mentioned on the users-mailinglist[1], it could be useful to have groups ↵Sake Blok1-3/+6
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-28We change the owner and group of the first file, so we also want to change ↵Sake Blok1-0/+7
owner and group of the rest of the files in the ringbuffer. svn path=/trunk/; revision=33977
2010-08-27Forward-port r33953.Gerald Combs1-6/+5
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-25Fix !Windows compilation.Gerald Combs1-1/+3
svn path=/trunk/; revision=33917
2010-08-24Partial fix for bug 5133. On Windows, call SetDllDirectory at startup ifGerald Combs1-0/+7
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-07-14Add #ifdef HAVE_BPF_IMAGEJörg Mayer1-0/+2
around show_filter_code(capture_options *capture_opts) To fix a warning about an unused function. svn path=/trunk/; revision=33519
2010-07-14Fix warnings.Guy Harris1-4/+8
svn path=/trunk/; revision=33517
2010-07-14Fix build errors.Guy Harris1-3/+7
svn path=/trunk/; revision=33515
2010-07-14Define print_caps() before we use it.Guy Harris1-18/+17
svn path=/trunk/; revision=33514
2010-07-14Ensure, at compile time, that the error-message-buffer argument toGuy Harris1-12/+12
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-14Define relinquish_all_capabilities() before we use it.Guy Harris1-16/+24
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-14We must also set the link-layer header type before compiling the captureGuy Harris1-31/+39
filter, as that affects the generated code. svn path=/trunk/; revision=33510
2010-07-13Add a "-d" flag to dumpcap, to print out the generated code for theGuy Harris1-146/+254
capture filter in human-readable form. (Well, readable by humans who know BPF machine language, at least. :-)) svn path=/trunk/; revision=33509
2010-05-28Move some code (including the optional objects) into libwsutilJeff Morriss1-3/+3
svn path=/trunk/; revision=33012
2010-05-27Make -q not a capture option again - it's used by tshark even when notGuy Harris1-5/+9
capturing, and thus even when we build without pcap. svn path=/trunk/; revision=32988
2010-05-26Don't send ^T output to the standard error if we're a capture child.Guy Harris1-6/+10
Make SIGINFO a restart-the-system-call signal, so reads etc. don't return an error. svn path=/trunk/; revision=32968
2010-05-26Add a -q flag to dumpcap, to squelch its reporting of the packet count,Guy Harris1-5/+89
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-25Pull the big pile of code that handles theGuy Harris1-129/+101
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-19Don't have -M affect -v yet; if we end up, for example, having dumpcapGuy Harris1-40/+17
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-S doesn't require an interface, either.Guy Harris1-10/+15
svn path=/trunk/; revision=32883
2010-05-19Regularize indentation a bit.Guy Harris1-164/+148
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-18Squelch an unused-variable warning.Guy Harris1-0/+2
svn path=/trunk/; revision=32856
2010-05-18Move some routines around, fix and shuffle comments.Guy Harris1-24/+24
svn path=/trunk/; revision=32854
2010-05-18Move get_pcap_linktype() into dumpcap - it's not used elsewhere.Guy Harris1-0/+123
svn path=/trunk/; revision=32853
2010-05-18Only negative return values from pcap_activate() are errors; positiveGuy Harris1-3/+8
return values are success-with-a-warning. Report those errors with a string. svn path=/trunk/; revision=32852
2010-05-18Don't write the SP_SUCCESS messages unless -Z was specified.Guy Harris1-29/+60
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-17Make -Z always generate machine-readable output, and don't botherGuy Harris1-14/+26
supplying -M along with -Z. (We keep -M around for debugging use; it's documented, unlike -Z.) svn path=/trunk/; revision=32850
2010-05-17If dumpcap is run with -D, don't select a default interface; it's notGuy Harris1-12/+30
necessary. If it's run with -D and -M, and we found no interfaces, don't treat that as an error; let the code that reads our output just indicate it as "no interfaces available", so *its* caller can decide whether to report an error or not (in some cases in Wireshark, it's obvious that there are no interfaces, e.g. there aren't any listed on the welcome screen, so popping up a dialog is pointless). svn path=/trunk/; revision=32849
2010-05-17When dumpcap is run to get an interface list, interface capabilities, orGuy Harris1-2/+11
interface statistics, have its error messages come out as sync-pipe errors, have it send a sync-pipe "success" message on success, and have the callers get that message and display it. svn path=/trunk/; revision=32843
2010-05-14Um, no, the problem with the Leopard x86 build is that we first do aGuy Harris1-4/+4
build without libpcap, to make sure that works, and then do a build with libpcap, to put into a binary release. It's the former that's failing; I'll back out the previous change and then work on that. svn path=/trunk/; revision=32801
2010-05-14See whether the Leopard x86 buildbot is upset because of the nameGuy Harris1-4/+4
if_capabilities_t - it doesn't fail on Snow Leopard, even if I undefine HAVE_PCAP_CREATE, and doesn't fail on the Leopard PPC buildbot, either. svn path=/trunk/; revision=32799
2010-05-13Fetch an indication of whether the interface supports capturing inGuy Harris1-26/+120
monitor mode at the same time that we fetch its list of link-layer types. Support fetching that list in monitor mode, as the list may be different in regular and monitor mode. If the interface supports monitor mode, when printing the list of link-layer types, indicate whether they're fetched in monitor mode or not, as tcpdump 4.1.x does. svn path=/trunk/; revision=32789
2010-05-11If we have pcap_open(), and we're *not* opening an rpcap URL, open theGuy Harris1-14/+24
device, don't just execute whatever comes after the open code as an else clause. svn path=/trunk/; revision=32761
2010-05-08Include inet_v6defs.h after include the Windows socket headers, so itGuy Harris1-4/+4
knows whether AF_INET6 is needed. svn path=/trunk/; revision=32722
2010-05-08Include inet_v6defs.h if needed to declare inet_ntop().Guy Harris1-0/+4
svn path=/trunk/; revision=32720
2010-05-08The default capture buffer size is, in fact, *nominally* 1MB; however,Guy Harris1-1/+1
libpcap/WinPcap and the capture mechanism atop which they run might either silently limit the buffer size to a smaller value or raise it to a higher value - that's the part that's platform-dependent. svn path=/trunk/; revision=32718
2010-05-07As with the list of data link types, so with the list of interfaces; moveGuy Harris1-2/+95
the code to print the machine-readable format into dumpcap, and have the code in capture_opts.c just print the human-readable format. svn path=/trunk/; revision=32714
2010-05-07Add routines vfprintf_stderr() and fprintf_stderr() to print to theGuy Harris1-0/+21
standard error and, in Wireshark on Windows, create a console if necessary. Have the cmdarg_err routines use them. Use *fprintf_stderr() to print the output of -L, rather than using cmdarg_err_cont(), so that we don't get extra newlines in the output (it should look similar to the output of tcpdump). svn path=/trunk/; revision=32711