Commit Graph

55 Commits

Author SHA1 Message Date
Bill Meier bfc4f6d466 Rename Windows ConsoleCtrHandlerRoutine --> capture_cleanup to match SVN #23537 change
svn path=/trunk/; revision=23540
2007-11-22 00:33:22 +00:00
Guy Harris d722f061f4 Catch SIGINT, SIGHUP, and SIGTERM on UN*X, so we cleanly exit if, for
example, we're ^C'ed.  This should fix bug 2003.

svn path=/trunk/; revision=23538
2007-11-21 22:49:02 +00:00
Gerald Combs 58914b5248 If libcap is present, have dumpcap use it to drop privileges while
retaining CAP_NET_ADMIN and CAP_NET_RAW.  Update some Makefile
dependencies for dumpcap.

svn path=/trunk/; revision=23511
2007-11-20 16:53:01 +00:00
Gerald Combs 8f05294027 For the Wireshark/TShark -> dumpcap signal pipe on Windows, use a named
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.

svn path=/trunk/; revision=23279
2007-10-26 16:32:28 +00:00
Guy Harris e8ea45d6ed Make the sync pipe the standard error, not the standard output, of
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.

svn path=/trunk/; revision=23124
2007-10-10 01:31:36 +00:00
Guy Harris 61e8c424b3 "get_compiled_version_info()" appends to the string text starting with
"with", so we shouldn't put our own "with" in there.

svn path=/trunk/; revision=23037
2007-09-30 22:34:15 +00:00
Guy Harris 322d44d416 Make the "-Z" argument to dumpcap take an argument that's the file
descriptor to use as the sync pipe.  For now, always pass 1, so the sync
pipe is the standard output of dumpcap.

svn path=/trunk/; revision=23025
2007-09-29 01:36:03 +00:00
Guy Harris 6d065e2eb2 Don't hardcode the notion that the sync pipe is the standard output into
sync_pipe_errmsg_to_parent(); have it take the FD for the sync pipe as
an argument.

svn path=/trunk/; revision=23024
2007-09-29 01:15:11 +00:00
Guy Harris 72eed77ed7 We don't use NetSNMP any more.
svn path=/trunk/; revision=23022
2007-09-29 01:01:02 +00:00
Gerald Combs 89a2966ced Add a "-S" flag to dumpcap, which prints out interface statistics. Use
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.

svn path=/trunk/; revision=22443
2007-08-02 21:45:27 +00:00
Gerald Combs c02e0c7b4a Remove the "-I" flag from dumpcap, and add a "-M" flag used to specify
that "-D" and "-L" should produce machine-readable output.  Use this to
move an indirect get_pcap_linktype() call from the GUI to dumpcap.

svn path=/trunk/; revision=22367
2007-07-20 21:43:07 +00:00
Gerald Combs e9f1a0b692 One more step in privilege separation.
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.

svn path=/trunk/; revision=22071
2007-06-11 03:58:58 +00:00
Bill Meier 4009deca1b Output error msgs when using dumpcap from cmd-line (stand-alone);
Also: minor cleanup for capture_loop.c

svn path=/trunk/; revision=20864
2007-02-19 20:25:56 +00:00
Jeff Morriss 0c17bfd3a8 From Eric Hall to fix bug 1289:
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.


svn path=/trunk/; revision=20726
2007-02-06 02:27:59 +00:00
Jörg Mayer 23ce819952 Frederic Heem:
Fix some memleaks and overflows.

I haven't committed the changes that are not bug fixes.

svn path=/trunk/; revision=19777
2006-11-02 09:45:12 +00:00
Jaap Keuter 22a949a42f Make dumpcap complile again and other minor improvements.
svn path=/trunk/; revision=19624
2006-10-20 06:24:56 +00:00
Guy Harris 00d8ca2d45 Fix up the changes to put the Portaudio information at the end of the
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).

svn path=/trunk/; revision=19613
2006-10-19 18:43:12 +00:00
Gerald Combs 9e23f31e5f Add support for reading from stdin under Windows. Based on a patch sent
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.

svn path=/trunk/; revision=19291
2006-09-22 21:14:54 +00:00
Guy Harris 594cab8a63 Add to a comment.
svn path=/trunk/; revision=18987
2006-08-21 23:06:40 +00:00
Ulf Lamping 0cfb4a78d6 put utf_16to8 under #ifdef _WIN32, thanks Toralf
svn path=/trunk/; revision=18892
2006-08-13 15:33:23 +00:00
Ulf Lamping f7f96d52dd another place missing a call to utf_16to8(), the about box was showing "Windows XP S", where it should be "Windows XP Service Pack 2"
dumpcap uses this too, so I had to duplicate utf_16to8 there :-(

svn path=/trunk/; revision=18891
2006-08-13 12:12:06 +00:00
Anders Broman f68d6e4c8c Ethereal->Wireshark
svn path=/trunk/; revision=18235
2006-05-28 20:28:20 +00:00
Ronnie Sahlberg 89f022b12b name change
svn path=/trunk/; revision=18197
2006-05-21 05:12:17 +00:00
Guy Harris bd847a5617 Don't report the interface name unconditionally.
svn path=/trunk/; revision=17793
2006-04-03 03:15:29 +00:00
Guy Harris d260003026 Put the low-level sync routines into a common file so they can be shared
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.

svn path=/trunk/; revision=17789
2006-04-03 01:56:53 +00:00
Guy Harris 2de9620eea In Tethereal, don't save to a temporary file if "-w" isn't specified,
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).

svn path=/trunk/; revision=17786
2006-04-03 00:52:59 +00:00
Ulf Lamping fe3c3029aa Various code cleanup in the capture pipe stuff
svn path=/trunk/; revision=17714
2006-03-24 02:23:48 +00:00
Ulf Lamping 069b26b2d9 fix bug #803: sync pipe on Win32 wasn't set to binary mode, so error message 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.

svn path=/trunk/; revision=17608
2006-03-13 00:30:51 +00:00
Guy Harris cbe69401cc Pass two strings in capture child messages, so the child can send
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!).

svn path=/trunk/; revision=17465
2006-03-05 03:14:16 +00:00
Ulf Lamping e6fb194094 update some comments, as dumpcap no longer uses console window stuff
svn path=/trunk/; revision=17403
2006-02-25 00:00:33 +00:00
Ulf Lamping 79053183c5 remove dependencies to pcap.h, so getting an idea what needs to be done by dumpcap in addition to the things already done now
various dumpcap related code cleanup: mainly #include's and capture engine related stuff

svn path=/trunk/; revision=17327
2006-02-17 02:18:48 +00:00
Guy Harris 4d8d477018 Move create_tempfile() to tempfile.c out of util.c. This means dumpcap
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>.

svn path=/trunk/; revision=17278
2006-02-12 21:52:18 +00:00
Ulf Lamping 1a7d4a9bf9 freebsd needs to define AF_INET6, seems to need sys/socket.h
svn path=/trunk/; revision=17269
2006-02-12 11:35:02 +00:00
Ulf Lamping cf94760fa4 the point of no return ...
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.

svn path=/trunk/; revision=17256
2006-02-11 23:25:11 +00:00
Ulf Lamping e4e8df5e1d remove all calls to exit() from the capture_opts.c and replace them by 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.

svn path=/trunk/; revision=17240
2006-02-10 02:05:30 +00:00
Ulf Lamping c98e18c555 some improvements in the console output handling
svn path=/trunk/; revision=17238
2006-02-10 01:18:24 +00:00
Ulf Lamping 0ce310bd86 minor changes to the usage output
svn path=/trunk/; revision=17009
2006-01-12 00:09:15 +00:00
Ulf Lamping 4f3c493e1d cleanup of exit_main() declaration
svn path=/trunk/; revision=16960
2006-01-05 22:27:25 +00:00
Jörg Mayer 056c408531 __attribute__ noreturn can only be used in function declations.
svn path=/trunk/; revision=16938
2006-01-03 23:43:24 +00:00
Ulf Lamping a2fe0e2b0a add the GCC specific attribute "noreturn" to exit_main()
add an error message if no interfaces could be found (and mention that it might be a privilege problem)

svn path=/trunk/; revision=16924
2005-12-31 10:51:15 +00:00
Ulf Lamping d5265fd7a4 From Jaap Keuter:
Even though dumpcap isn't finished I would like this patch applied in
order to:
1. remove some compiler warnings
2. avoid a seg fault when running dumpcap without parameters as normal
user.

svn path=/trunk/; revision=16922
2005-12-31 10:22:57 +00:00
Jörg Mayer b06bd208d0 warning: function declaration isn't a prototype
svn path=/trunk/; revision=16852
2005-12-18 23:18:06 +00:00
Ulf Lamping fb6554117f some minor fixes: logging and comments fixed
svn path=/trunk/; revision=16819
2005-12-16 07:43:24 +00:00
Ulf Lamping 27b13556ec use capture_opts_trim_iface() instead of duplicated code
various minor code cleanup

svn path=/trunk/; revision=16805
2005-12-15 00:45:29 +00:00
Ulf Lamping 79217bab2e HUGE STEP (hopefully toward the right direction):
remove a lot of redundant code from tethereal and use (move) stuff from capture_loop.c instead.

concentrate common capture related code in capture_opts.c, e.g. trying to find the right interface to capture from (command line option, preference, first usable) instead of duplicating this code over several files.

remove redundant code from dumpcap.c

this also implements command line option -D (and indexed interfaces at -i) for Ethereal and Dumpcap (as we have it in Tethereal already for a while)

svn path=/trunk/; revision=16787
2005-12-13 22:48:58 +00:00
Ulf Lamping 7e3a24418c rename pcap-....c/.h files to capture-pcap-....c/.h
this way, the capture prefix will "logically" group the files together and file browsers will also group them

we may want to move the files into a subdir capture later

svn path=/trunk/; revision=16691
2005-12-06 00:07:13 +00:00
Ulf Lamping 792584c211 no more usage of Ethereal.lib in dumpcap any longer :-)
use capture_opts_trim()
output of command line usage and version "enhanced"

svn path=/trunk/; revision=16684
2005-12-05 21:28:34 +00:00
Jörg Mayer d8c09f7f2e We need AF_INET6 on linux, so include netdb.h if available.
Add dumpcap to svn:ignore.


svn path=/trunk/; revision=16676
2005-12-04 23:50:57 +00:00
Ulf Lamping e829856c0c move the complete functionality of the capture info dialog from capture_loop.c to capture_info.c and call it from capture.c (instead of capture_loop.c).
This way, the capture child don't need to now any of the packet_counter things (no epan/packet.h and all alike).

Currently the capture_info code will always open another wiretap file instance to build it's own counter values. This isn't optimized for now (next step: use data from cf_continue_tail() somehow).

svn path=/trunk/; revision=16669
2005-12-04 02:04:18 +00:00
Ulf Lamping f856dbafa8 split some parts of the packet counting functions into their own files capture_info(.c/.h),
so we can use it from the main program

svn path=/trunk/; revision=16668
2005-12-03 22:38:50 +00:00