aboutsummaryrefslogtreecommitdiffstats
path: root/capture_opts.c
AgeCommit message (Collapse)AuthorFilesLines
2007-09-25as "advertised" some days ago:Ulf Lamping1-1/+0
rewrite the tshark capture code almost completely, to use dumpcap instead of it's own pcap functionality. This works on Win32 and should work on unix/linux (but I'm not sure here). Some stuff needs to be cleaned up, some more may need to be rewritten to specifically work with unix/win32. Futher work needs to be done at: 1. read filters (simply document current behaviour?) 2. event loop polling 3. privileges 4. code cleanup (e.g. in capture_loop.c) Be prepared that tshark might not work as before / expected at least in the next days! svn path=/trunk/; revision=22969
2007-08-30Change the "--enable-setuid-install" option to install dumpcap and TSharkGerald Combs1-0/+4
setuid instead of Wireshark. Remove the "DANGEROUS" notices, but leave it disabled by default. Whine if the user runs Wireshark or TShark as root. Add a preference to disable the whining. Add a "setuid-root" script that can be used to switch dumpcap and TShark's setuid-ness on and off for development and testing. Update the release notes and README.packaging. svn path=/trunk/; revision=22733
2007-08-28capture_opts_log: use dummy string if iface_desc is NULL;Bill Meier1-1/+3
This fixes dumpcap crash on Windows svn path=/trunk/; revision=22707
2007-08-22Fix bug http://bugs.wireshark.org/bugzilla/show_bug.cgi?id=1757 :Jeff Morriss1-0/+14
Try to call get_interface_descriptive_name() as little as possible (storing the result in capture_opts) to avoid a performance hit during live capture (especially if you have lots of interfaces) and to avoid leaking memory. One issue with this is that capture_opts.c cannot (without adding significant dependencies) set the iface_descr so readers of that field (only gtk/main.c and tshark.c) use a macro to (set if not already set and) get the value of that field. svn path=/trunk/; revision=22587
2007-08-02Add a "-S" flag to dumpcap, which prints out interface statistics. UseGerald Combs1-0/+92
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-07-20Remove the "-I" flag from dumpcap, and add a "-M" flag used to specifyGerald Combs1-15/+35
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-06-25Fix bug #1665 / From Nikns Siankin:Stephen Fisher1-0/+4
Fix compilation on OpenBSD. This needs to go into 0.99.6 release. svn path=/trunk/; revision=22188
2007-06-11Fix compilation under VS6 (hopefully without breaking compilationGerald Combs1-13/+20
anywhere else). Instead of using getaddrinfo() and getnameinfo(), promote inet_pton.c and inet_ntop.c to the top level and use those routines instead. (It's 2007, for crying out loud. Why is this even an issue?) svn path=/trunk/; revision=22075
2007-06-11One more step in privilege separation.Gerald Combs1-29/+67
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-01-21Have the routines to get interface lists take a pointer to a "gchar *"Guy Harris1-24/+18
as an argument, and, on an error, if they have an error message, have them set that "gchar *" to point to a g_malloc()ed string containing the error message, rather than taking a pointer to a buffer for that message as an argument. That's more like what's done in Wiretap, and doesn't impose an upper limit on the lengths of those error messages. If that pointer is null, don't allocate the message string and return it. Have that error message already have the "cant_get" processing applied to it, so nobody other than those routines need to call the "cant_get" routines to process the error messages. Have get_airpcap_interface_list() explicitly set "*err" to the appropriate error code. Clean up indentation. svn path=/trunk/; revision=20521
2007-01-12Win32: MSVC > 6 doesn't work well with Unicode filenames!Ulf Lamping1-1/+1
fix this, by providing required functions in the new file file_util.c - it's mostly copied from GLib (g_open alike - that take UTF8 as filename format but don't use msvcrt.dll V6 for this as the glib files do) "link" to these functions in file_util.h: #define eth_open eth_stdio_open revert changes (from SVN 20282) throughout the code related to these file functions which were introduced with the first tries of MSVC 2005 ... Hopefully I've done everything right with the new file_util.c ... svn path=/trunk/; revision=20402
2007-01-03from Laurent Rabret:Ulf Lamping1-1/+1
I posted a patch about 1.5 years ago for the formerly Ethereal to successfully compiled with Visual > 6. I have always successfully used this patched Ethereal/Wireshark compiled with VS 2003 and have just checked when compiled with Visual C++ 2005 Express svn path=/trunk/; revision=20282
2007-01-01From Pierre Juhen: patch to correct the bug 1220Bill Meier1-3/+3
svn path=/trunk/; revision=20254
2006-11-02Frederic Heem:Jörg Mayer1-0/+2
Fix some memleaks and overflows. I haven't committed the changes that are not bug fixes. svn path=/trunk/; revision=19777
2006-08-26Go back to setting the capture filter to an empty string when we start;Guy Harris1-2/+3
that obviates the need to check for a null capture filter string, and fixes bug 1055. Keep track of whether it was set from the command line, though, so we can catch attempts to set the filter more than once, and attempts to set it when we're not capturing. Clean up white space. svn path=/trunk/; revision=19047
2006-08-21Initialize the cfilter field of a capture_opts structure to a nullGuy Harris1-3/+5
pointer, so we can determine whether a capture filter has been set or not. Use that to check in TShark whether the user specified a filter with "-f" or not, rather than using the no-longer-set "capture_filter_specified" variable. Also, check for multiple "-f" options. If no capture filter is specified, use a null string, to work around broken versions of Linux libpcap. svn path=/trunk/; revision=18989
2006-05-31Tethereal/tethereal -> TShark/tshark.Gerald Combs1-1/+1
svn path=/trunk/; revision=18268
2006-05-28Ethereal->WiresharkAnders Broman1-1/+1
svn path=/trunk/; revision=18235
2006-05-21name changeRonnie Sahlberg1-2/+2
svn path=/trunk/; revision=18197
2006-04-21prepare to list the IP addresses in the command line interfaces list outputUlf Lamping1-0/+24
svn path=/trunk/; revision=17950
2006-04-03In Tethereal, don't save to a temporary file if "-w" isn't specified,Guy Harris1-10/+13
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-03-24remove some XXX markers in comments which are no (longer) ToDo itemsUlf Lamping1-4/+4
svn path=/trunk/; revision=17715
2006-03-01A "-b" argument must have a : in it, as it has to specify a criterionGuy Harris1-1/+1
type and value, separated by a :. svn path=/trunk/; revision=17438
2006-02-17remove dependencies to pcap.h, so getting an idea what needs to be done by ↵Ulf Lamping1-11/+8
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-11the point of no return ...Ulf Lamping1-72/+2
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-10remove all calls to exit() from the capture_opts.c and replace them by ↵Ulf Lamping1-23/+39
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-01-12fix #661Ulf Lamping1-0/+5
Win32: convert filenames coming in from command line parameters from locale (current code page) into utf8 encoding This must also be done for the other command line tools like tethereal, editcap and alike ... svn path=/trunk/; revision=17025
2006-01-07move output_to_pipe flag from tethereal's loop_data into capture_opts, so it ↵Ulf Lamping1-0/+65
can be used by dumpcap (capture_loop.c) as well svn path=/trunk/; revision=16972
2005-12-17Win32 bugfix: peeking the signal_pipe at capture_loop start seems to be ↵Ulf Lamping1-0/+1
unreliable Instead, simply keep the signal_pipe setting directly from the command line which is working well svn path=/trunk/; revision=16833
2005-12-13HUGE STEP (hopefully toward the right direction):Ulf Lamping1-2/+191
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-05add capture_opts_trim(), as this sequence is used three times now (will ↵Ulf Lamping1-0/+17
replace the other appearances later) ... svn path=/trunk/; revision=16683
2005-12-03split capture.h into capture.h, capture_loop.h and capture_opts.h and place ↵Ulf Lamping1-0/+1
the parts into the corresponding files svn path=/trunk/; revision=16664
2005-11-17Handle "-G" only in Tethereal - it doesn't work in Ethereal, and isn'tGuy Harris1-26/+27
necessary there. Add a "cmdarg_err()" routine to report command-line option errors; it creates a console if necessary, and prints the command name and the trailing newline. Also add "cmdarg_err_cont()", which also creates a console if necessary, and prints a trailing newline but no command name; it's used to continue the message. Use those, rather than "g_warning()", for errors. That means that we no longer need to pass the command name to various command-line argument parsing routines. svn path=/trunk/; revision=16526
2005-11-12including io.h isn't neededUlf Lamping1-4/+0
svn path=/trunk/; revision=16486
2005-10-07fix Ethereal so command line capture parameter will work with kilobytes (again)Ulf Lamping1-2/+2
remove Byte(s) from the dropdown list of filesizes, this doesn't make sense replace 1000 with 1024, as all (modern?) file managers are based on 1024 bytes for a kilobyte (the old KB vs. KiB controversy) svn path=/trunk/; revision=16149
2005-05-30fix #148: (win32 only) use command line parameter -B to set capture buffer sizeUlf Lamping1-0/+5
svn path=/trunk/; revision=14484
2005-05-26use the log features of the GLib to have verbose output of the capturing ↵Ulf Lamping1-26/+26
engine, e.g. GLib provides different domains for different submodules. Output more verbose than warning level will be disabled by default (just like before). use the console_log_handler in main.c for win32 AND unix now Currently use the log for the capturing engine (only), as I desperately needed a log output for debugging. svn path=/trunk/; revision=14438
2005-04-27add a state member to the capture_opts, and set it according to the capture ↵Ulf Lamping1-0/+1
engine svn path=/trunk/; revision=14205
2005-04-12capture engine: Ulf Lamping1-0/+1
add a new feature to clear the currently captured packets and restart the capture with the previous parameters various code cleanup and minor bugfixes Win32: use millisecond resolution in capture_loop, to smooth screen update a bit (500ms instead of 1000ms) svn path=/trunk/; revision=14059
2005-04-10Win32 only bugfix: as using TerminateProcess is the brute force way and ↵Ulf Lamping1-8/+68
sometimes clipped packets in the middle, now using a pipe called signal_pipe from the parent to the child for this. On unix we're using kill() for this, which simply signals the child, but this isn't available on win32. svn path=/trunk/; revision=14040
2005-03-28bugfixes: bring non real-time captures back to former behaviour, other minor ↵Ulf Lamping1-1/+1
fixes svn path=/trunk/; revision=13961
2005-03-28fix Solaris build (I've removed O_BINARY)Ulf Lamping1-4/+4
rename sync_mode to real_time_mode, as we using sync_mode all the time now, so the name is misleading svn path=/trunk/; revision=13956
2005-03-28remove capture_child flag from capture_opts as it's no longer requiredUlf Lamping1-2/+0
svn path=/trunk/; revision=13954
2005-03-28a lot more capture engine code cleanupUlf Lamping1-5/+0
most notably: - moved opening of safe_file to the capture child (capture_loop.c) - removed save_file_fd from capture_opts (no longer need to have it global) svn path=/trunk/; revision=13953
2005-03-28The "cf" field of a "capture_options" structure is a "void *" and, inGuy Harris1-1/+1
practice, it points to a "capture_file" structure; print it with "%p", not "%s". svn path=/trunk/; revision=13952
2005-03-28major capture engine rework: use two task model for EVERY capture modeUlf Lamping1-13/+46
rework of the -b command line parameter (for Ethereal and Tethereal) svn path=/trunk/; revision=13949
2005-02-27Move "get_natural_int()" and "get_positive_int()" from "capture_opts.c"Guy Harris1-44/+1
to "clopts_common.c", make them not static, and use them in "gtk/main.c". svn path=/trunk/; revision=13541
2005-02-24avoid capture stopping after just 1 packet in tethereal,Luis Ontanon1-1/+1
- in capture_opts_init() set capture_opts->autostop_packets to 0 instead of one. svn path=/trunk/; revision=13500
2005-02-24Include <string.h> and <ctype.h> to get the appropriate functionsGuy Harris1-2/+5
declared and macros defined. Pass all the necessary arguments to "get_natural_int()". svn path=/trunk/; revision=13490
2005-02-23pass child capture filename to parent process (name currently unused) and ↵Ulf Lamping1-0/+2
some fork_child cleanup svn path=/trunk/; revision=13482