Commit Graph

250 Commits

Author SHA1 Message Date
Martin Kaiser e04a12af8c add capture_comment to the capture_options structure
svn path=/trunk/; revision=50943
2013-07-27 16:13:29 +00:00
Luis Ontanon c780d97411 forgot from the las commit...
svn path=/trunk/; revision=50191
2013-06-27 17:27:41 +00:00
Anders Broman 78e334b845 From Mike Garratt:
Friendly Names support causing unnecessary delay when Wireshark starts.

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8034

svn path=/trunk/; revision=49752
2013-06-04 04:36:19 +00:00
Guy Harris 8596d17d7f Pull the capture-session state information out of capture_opts and put
it into a separate capture_session structure.  capture_opts should
contain only user-specified option information (and stuff directly
derived from it, such as the "capturing from a pipe" flag).

svn path=/trunk/; revision=49493
2013-05-22 07:44:28 +00:00
Guy Harris 1ca63098ac Rename capture_opts_trim_iface() to
capture_opts_default_iface_if_necessary(), to reflect what it actually
does.

svn path=/trunk/; revision=49491
2013-05-22 04:49:31 +00:00
Guy Harris 13a80ce39f Don't fill in err_str if we're not going to use it.
(This helps flag capture_interface_list() calls that should perhaps be
checked to see whether an error should be reported if they fail.)

svn path=/trunk/; revision=49281
2013-05-13 23:23:33 +00:00
Guy Harris 1f1e288b42 Eliminate some includes of ui/simple_dialog.h by files that don't use
anything from it.

svn path=/trunk/; revision=49278
2013-05-13 22:52:46 +00:00
Guy Harris 39779a7bee Send the output of the -D and -L options to the standard output rather
than the standard error.

In Wireshark on Windows, create a console before doing so and destroy it
before exiting.  Don't do that in TShark or dumpcap, as those are
console-mode programs on Windows.

This should fix bug 8609 and still allow "wireshark -D" and "wireshark
-L" to work when the standard output isn't redirected.

svn path=/trunk/; revision=49025
2013-04-25 05:47:11 +00:00
Irene Rüngeler 44e6a88b13 Add interface options preferences.
svn path=/trunk/; revision=48275
2013-03-13 12:38:08 +00:00
Jeff Morriss d0992bf8cd Add a #define for the default capture buffer size and use it.
svn path=/trunk/; revision=47942
2013-02-28 15:27:56 +00:00
Anders Broman 6cbcb0d94d Increase the default buffer size to 2MB.
svn path=/trunk/; revision=47920
2013-02-27 20:38:43 +00:00
Guy Harris 8ed7a73e22 Fix a bunch of warnings.
Cast away some implicit 64-bit-to-32-bit conversion errors due to use of
sizeof.

Cast away some implicit 64-bit-to-32-bit conversion errors due to use of
strtol() and strtoul().

Change some data types to avoid those implicit conversion warnings.

When assigning a constant to a float, make sure the constant isn't a
double, by appending "f" to the constant.

Constify a bunch of variables, parameters, and return values to
eliminate warnings due to strings being given const qualifiers.  Cast
away those warnings in some cases where an API we don't control forces
us to do so.

Enable a bunch of additional warnings by default.  Note why at least
some of the other warnings aren't enabled.

randpkt.c and text2pcap.c are used to build programs, so they don't need
to be in EXTRA_DIST.

If the user specifies --enable-warnings-as-errors, add -Werror *even if
the user specified --enable-extra-gcc-flags; assume they know what
they're doing and are willing to have the compile fail due to the extra
GCC warnings being treated as errors.

svn path=/trunk/; revision=46748
2012-12-26 05:57:06 +00:00
Jeff Morriss 20211340e5 Make the "-g" argument to tshark actually work (by passing it to dumpcap).
svn path=/trunk/; revision=46515
2012-12-12 03:25:35 +00:00
Guy Harris bd976ae6c0 On UN*X, if an interface has a description, use it as the "friendly
name".  If it doesn't have a description, on OS X, use the System
Configuration framework to attempt to get a "friendly name" for
interfaces.

If a loopback device doesn't have a friendly name, give it "Loopback" as
the friendly name.

Move the "turn a CFString into a mallocated C string" routine into
common code, as it's used in more than one place.

svn path=/trunk/; revision=46131
2012-11-22 06:02:49 +00:00
Guy Harris ca74add1c9 In capture_opts_add_iface_opt(), only *require* us to get the interface
list if the user specified a number; otherwise, if we couldn't get the
list, just use what the user specified, so they can specify interfaces
in order to test them to see why they're not showing up in the list.

svn path=/trunk/; revision=46112
2012-11-21 18:11:57 +00:00
Guy Harris 4c019d6807 If we don't find the specified interface name in the list, use it
anyway, so that, for example, if an interface doesn't show up in the
list for some reason, the user can try specifying it explicitly for
testing purposes.

svn path=/trunk/; revision=46109
2012-11-21 17:33:02 +00:00
Guy Harris d415d3d87c On error, have capture_opts_trim_iface() return the exit status that
should be used (on success, have it return 0).  Exit with that exit
status; if the problem is that we couldn't get the interface list or if
there are no interfaces in that list, return 2, as that's not a
command-line syntax error.

svn path=/trunk/; revision=46108
2012-11-21 17:14:54 +00:00
Guy Harris fbaac1330a We don't use get_windows_interface_friendlyname() in capture_opts.c, so
we don't need to include capture_win_ifnames.h.

Clean up white space.

svn path=/trunk/; revision=46095
2012-11-20 01:12:57 +00:00
Jeff Morriss 92aff2d548 Failure to find the interface should cause *shark to exit with a status of 1, not 2.
svn path=/trunk/; revision=46089
2012-11-19 21:41:40 +00:00
Jeff Morriss 89c33a8266 As suggested by Evan: just make the variable a size_t instead of casting away the warning.
svn path=/trunk/; revision=46088
2012-11-19 21:32:39 +00:00
Jeff Morriss 06efe50e5f I'm pretty confident the string length will fit in 32 bits; cast away the "possible loss of data" warning on the Win64 build.
svn path=/trunk/; revision=46087
2012-11-19 21:00:44 +00:00
Anders Broman 28474fe8ef From Mike Garratt:
Friendly Names for interfaces on Windows

Notes on the changes the patch covers:
* if_info_t struct: addition of friendly_name
* Dumpcap Interface list format changes:
  + Win32: "dumpcap -D" shows friendly_name in place of descript if known
  + All: machine interface "dumpcap -D -Z none" includes friendly_name in the
list in addition to the existing parameters
* interface_options struct: addition of console_display_name
  + When an interface name is displayed in a console, it will typically be the
console_display_name (instead of name). 
  + console_display_name is used as the basis of the autogenerated temp
filenames
  + console_display_name is typically set to the friendly_name if known,
otherwise it is set to the interface name
* Enhancements to capture_opts_add_iface_opt() (the function which process -i
options).
  + Can now specify the interface using its name and friendly_name
  + Interface name matching is case insenstive
  + Name matching first attempts exact matching, then falls back to prefix
matching
    (e.g. dumpcap -i local)
  + Validates interface names, instead of blindly sending them off to
winpcap/libpcap
  + Interface specification by number is still supported.
* capture_opts_trim_iface() has been refactored:
  + Instead of repeating a decent chunk of the cost in
capture_opts_add_iface_opt(), it calls capture_opts_trim_iface() to specify the
interface.
* introduction of capture_win_ifnames.[ch] (windows only code)
  + Implements static function GetInterfaceFriendlyNameFromDeviceGuid() - a
windows version independant function to convert an interface guid into its
friendly name.  Uses published api functions on windows vista and higher, but
falls back to unpublished API functions on older windows releases.
  + void get_windows_interface_friendlyname(/* IN */ char
*interface_devicename, /* OUT */char **interface_friendlyname); - extracts the
GUID from the interface_devicename, then uses
GetInterfaceFriendlyNameFromDeviceGuid() to do the resolution
* Auto temp filename generation:
  + Now uses wireshark_pcapng_* or  wireshark_pcap_* depending on file format
  + Basis temp filename format on console_display_name
  + Win32: if console_display_name is a windows interface guid, extracts
numbers from GUID here (instead of in interface option processing) 

GUI CHANGES:
* Dialog that displays when you click the "Manage Interfaces" button (within
Capture Options dialog) has been renamed from "Add new interfaces" to
"Interface Management"
* ui/gtk/capture_dlg.c: new_interfaces_w variable renamed to
interface_management_w
* Win32: Local Interfaces tab on Interface Management dialog, shows includes
friendly name as far left column
* Interface Management dialog defaults to larger size on win32 - so it fits
without resizing local interfaces tab
* Interface Management dialog now saves preferences when you click the apply
button (local hidden interfaces was not persisting across restarts)
* Tweaks: "Interface Details" dialog (Interface list->Capture Interfaces ->
Details):
  + "Friendly Name" renamed to "NDIS Friendly Name"
  + Added "OS Friendly Name" to the top of the list
* Win32: The "Capture Interfaces" dialog now shows the friendly name instead of
device guid
* Welcome screen:
  + The height of the interface list scrollbox dynamically adjusts & updates to
the number visible interfaces.
    Up to 10 interfaces can be listed without a scroll bar, the minimum height
is for 2 interfaces. 
  + Win32: now shows just the Friendly Name if known - in place of
"Interfacename_Guid:(Description)"

svn path=/trunk/; revision=46083
2012-11-19 20:07:27 +00:00
Jeff Morriss 3551a86c36 We always HAVE_CONFIG_H so don't bother checking whether we have it or not.
svn path=/trunk/; revision=45015
2012-09-20 01:29:52 +00:00
Irene Rüngeler bb1e018dc7 Fix for bug #7634. Print 'unspecified' in case a string is NULL.
svn path=/trunk/; revision=44512
2012-08-15 08:08:17 +00:00
Jakub Zawadzki bf81b42e1e Update Free Software Foundation address.
(COPYING will be updated in next commit)

svn path=/trunk/; revision=43536
2012-06-28 22:56:06 +00:00
ruengeler ea68381088 Remove lines that are not needed.
svn path=/trunk/; revision=42208
2012-04-23 13:47:45 +00:00
ruengeler 0819722ad8 Fix bug #7178 reported by aparan
svn path=/trunk/; revision=42206
2012-04-23 12:34:16 +00:00
Guy Harris fa64659e93 Closing a capture file has nothing to do with the list of interfaces on
which to do a live capture; don't clear the latter list when closing the
capture file.

collect_ifaces() should clear out the existing list of interfaces before
filling that list up with the interfaces selected by the user.  In
addition, when it frees up interfaces in that list, it should free up
the strings attached to those interfaces.

svn path=/trunk/; revision=41517
2012-03-13 03:48:27 +00:00
Guy Harris 3af7f28931 capture_opts_add_iface_opt() is not used outside capture_opts.c; make it
static.

svn path=/trunk/; revision=41494
2012-03-12 02:53:21 +00:00
Guy Harris 6f3ee54d62 Add a comment to indicate what collect_ifaces() does.
svn path=/trunk/; revision=41490
2012-03-11 20:01:11 +00:00
Guy Harris 1a5e1acdf3 Actually, you only have monitor mode support if you have pcap_create() -
without pcap_create() and pcap_activate() you don't have any API to turn
it on.

svn path=/trunk/; revision=40725
2012-01-25 19:40:22 +00:00
Jeff Morriss 91b873184f monitor_mode_enabled is only available on WIN32 or if we HAVE_PCAP_CREATE.
svn path=/trunk/; revision=40717
2012-01-25 14:29:09 +00:00
Michael Tüxen 14b1a44c0f Third try. This time pipes and stdin are supported and the
test scripts are passed.

Use a global list containing all interfaces and only change
properties of the entries when changes are made in the GUI.
Do not misuse the list of interfaces specified on the command
line anymore.

This patch does not provide any new functionality, it just
provides the base for future extensions like removing
remote interface, mulitple airpcap devices and multiple
pipes.

This patch was provided by Irene Ruengeler.

svn path=/trunk/; revision=40715
2012-01-25 13:04:32 +00:00
Michael Tüxen 4fece25e7f We need a 3rd try. (After learning how to run the testuite on Windows locally).
svn path=/trunk/; revision=40695
2012-01-24 17:12:56 +00:00
Michael Tüxen 08d6785412 Second try. This time pipes and stdin are supported.
Use a global list containing all interfaces and only change
properties of the entries when changes are made in the GUI.
Do not misuse the list of interfaces specified on the command
line anymore.

This patch does not provide any new functionality, it just
provides the base for future extensions like removing
remote interface, mulitple airpcap devices and multiple
pipes.

This patch was provided by Irene Ruengeler.


svn path=/trunk/; revision=40693
2012-01-24 16:05:26 +00:00
Guy Harris 3864d5d19d Add an additional DONT_HAVE_PCAP return value from get_interface_list()
and capture_interface_list().  Return it if, on Windows, we ask for the
interface list but don't have WinPcap installed.  Handle it like
CANT_GET_INTERFACE_LIST.

svn path=/trunk/; revision=40334
2011-12-29 22:49:49 +00:00
Michael Tüxen c219f2eea5 Back out infrastructure change. We missed supporting
stdin and pipes.




svn path=/trunk/; revision=39498
2011-10-20 19:44:40 +00:00
Michael Tüxen 95ae2fe13a Use a global list containing all interfaces and only change
properties of the entries when changes are made in the GUI.
Do not misuse the list of interfaces specified on the command
line anymore.

This patch does not provide any new functionality, it just
provides the base for future extensions like removing
remote interface, mulitple airpcap devices and multiple
pipes.

This patch was provided by Irene Ruengeler.

svn path=/trunk/; revision=39495
2011-10-20 18:17:54 +00:00
Gerald Combs db240c2b5e Replace "-Q" with "WIRESHARK_QUIT_AFTER_CAPTURE" as discussed in bug 6256.
svn path=/trunk/; revision=38784
2011-08-29 21:16:29 +00:00
Michael Tüxen f98587d686 Undo the checking of command line interfaces. It might the a pipe...
svn path=/trunk/; revision=38146
2011-07-21 17:30:42 +00:00
Michael Tüxen 91df20357a Make sure that the interfaces listed in ifaces really exist.
Some protection code in capture / options.
Obtained from Irene Ruengeler.


svn path=/trunk/; revision=38142
2011-07-21 15:23:46 +00:00
Gerald Combs 8cbaab380e Having a non-NULL capture_opts->save_file might make us crash less.
svn path=/trunk/; revision=37983
2011-07-11 22:51:46 +00:00
Gerald Combs 5467d67f2a In version_info.c, assume we always have the "matches" operator. In
capture_opts.c, assume our output filename has been passed through
arg_list_utf_16to8().

svn path=/trunk/; revision=37974
2011-07-11 19:15:57 +00:00
Guy Harris 4bdb1926c5 Oops, indented one of the "Promiscuous" ones.
svn path=/trunk/; revision=37850
2011-06-30 23:34:53 +00:00
Guy Harris 88f7858de3 Line up the colons.
svn path=/trunk/; revision=37849
2011-06-30 22:41:54 +00:00
Guy Harris bf89288f87 It's not made from semolina. :-)
svn path=/trunk/; revision=37848
2011-06-30 22:21:16 +00:00
Michael Tüxen 185305aea6 Cleanup.
svn path=/trunk/; revision=37840
2011-06-30 06:31:52 +00:00
Michael Tüxen 52abc59011 Code cleanup.
svn path=/trunk/; revision=37820
2011-06-28 16:57:42 +00:00
Michael Tüxen 421dafd2de Get rid of old non-interface specific settings which are now interface
specifc. This finalizes the change of the infrastructure.
This patch is based on work by Irene Ruengeler.

svn path=/trunk/; revision=37794
2011-06-27 00:09:03 +00:00
Gerald Combs 8d88f3a790 Make pcap-ng the default. Add a compile-time option to prefer pcap-ng or
pcap.  Add a "-P" capture option which tries to use pcap instead of
pcap-ng ("-P" seemed to be the best option but we may want to use a
different letter).

Update the documentation and release notes.

svn path=/trunk/; revision=37696
2011-06-17 17:52:31 +00:00
Michael Tüxen 29c8afa6d3 Really print the rpcap username when logging, not
the rpcap password.
This only affects remote capturing.

svn path=/trunk/; revision=37681
2011-06-16 07:33:24 +00:00
Michael Tüxen 8f8f0e9ad6 Get rid of has_cfilter to simplify the handling of multiple interfaces.
svn path=/trunk/; revision=37478
2011-05-31 14:49:21 +00:00
Michael Tüxen d37d757dbc It is not an error (anymore) to specify multiple capture filters.
This was
wireshark -i lo0 -f sctp -i en0 -f udp -k
will work.

svn path=/trunk/; revision=37287
2011-05-19 11:58:18 +00:00
Michael Tüxen 70ae440e15 Make remote capturing settings a per interface thing. You can now
configure that you want to capture on multiple remote interfaces
on mulitple hosts.
Improve some #ifdef mess in dumpcap.

svn path=/trunk/; revision=37178
2011-05-16 15:19:54 +00:00
Michael Tüxen 122452f864 Make pcap samping a per interface setting.
Use consistent naming of variables on capture_options.
Make pcap sampling independent of remote capturing, since
it seems to work local pcap devices using winpcap (at
least that is what the documentation says).

svn path=/trunk/; revision=37176
2011-05-16 14:12:35 +00:00
Michael Tüxen 448fdb60b3 * Fix a bug when printing a pointer.
* Remove number_of_ifaces, since ifaces->len can be used instead.

svn path=/trunk/; revision=37174
2011-05-16 00:55:04 +00:00
Michael Tüxen cfe3d2d0da Get -L and -d working with multiple interface. Internally get some functions
using the array of interface data.
Improve output of -L by printing the interface name.

svn path=/trunk/; revision=37120
2011-05-13 11:28:51 +00:00
Michael Tüxen a80b7e5fea Use the same default value for the snaplen in the new array as in the
old way.

svn path=/trunk/; revision=37113
2011-05-13 06:04:28 +00:00
Michael Tüxen 2d6cd58f91 Add support for handling multiple interfaces as command line
parameters. An array of interface specific data is handled
in addition to the current way.
This change should not have any effect right now, it will
be used by dumpcap when supporting multiple interfaces
(and tshark/wireshark... in the future).


svn path=/trunk/; revision=37082
2011-05-12 16:54:16 +00:00
Michael Tüxen 93377f5236 Another whitespace cleanup.
svn path=/trunk/; revision=37076
2011-05-12 12:06:19 +00:00
Michael Tüxen 4b303018d1 Clean up some indentation. A purely whitespace change.
svn path=/trunk/; revision=37073
2011-05-12 10:58:14 +00:00
Guy Harris fb3f152076 Back out Jeff Morris's change to make the autostop file size 64-bit - it
didn't change the GUI code for setting the autostop file size, and that
broke the build.

svn path=/trunk/; revision=36552
2011-04-11 01:30:36 +00:00
Guy Harris 4ad4d3e678 Jeff Morris's change to make the autostop file size 64-bit. Fixes bug
5691.

svn path=/trunk/; revision=36551
2011-04-11 00:01:08 +00:00
Guy Harris 4fdcc5c180 Rename ws_stat to ws_stat64, and make it take a pointer to a ws_statb64
as an argument, along the lines of ws_fstat64, and, on Windows, make it
use _wstati64, to handle 64-bit file sizes.

svn path=/trunk/; revision=36547
2011-04-10 20:59:10 +00:00
Chris Maynard 42d40ee494 Use fprintf_stderr() instead of printf() so "wireshark -D" works (on Windows).
svn path=/trunk/; revision=36387
2011-03-28 22:10:41 +00:00
Michael Tüxen 5da016099a Make HAVE_PCAP_REMOTE and HAVE_PCAP_SETSAMPLING independent
as in other places of the code. Such that this is consistently
used. While there, clean up some whitespaces.

This fix was provided by Irene Ruengeler which testing
remote capturing (with multiple interfaces).

svn path=/trunk/; revision=36112
2011-03-01 17:29:09 +00:00
Stephen Fisher 390927ce12 Follow up to rev 34073: Since "-b files:0" is no longer necessary to
override the default of turning on a multiple file ring buffer, require
a positive integer to be specified for the files value.


svn path=/trunk/; revision=34082
2010-09-08 18:47:14 +00:00
Sake Blok f17c5ac01f As mentioned on the users-mailinglist[1], it could be useful to have groups 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-28 11:05:51 +00:00
Gerald Combs 8598c522b2 Set RINGBUFFER_MAX_NUM_FILES to 100000. Use it to generate file names.
Add RINGBUFFER_WARN_NUM_FILES and use it to print a warning. Print
warnings when we change the number of ringbuffer files.

svn path=/trunk/; revision=32998
2010-05-27 18:00:46 +00:00
Guy Harris 80fda10f18 Make -q not a capture option again - it's used by tshark even when not
capturing, and thus even when we build without pcap.

svn path=/trunk/; revision=32988
2010-05-27 01:13:49 +00:00
Guy Harris 7a630c61a1 Add a -q flag to dumpcap, to squelch its reporting of the packet count,
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-26 00:19:27 +00:00
Guy Harris 9307251bb8 Um, no, the problem with the Leopard x86 build is that we first do a
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-14 00:49:28 +00:00
Guy Harris 0e54136213 See whether the Leopard x86 buildbot is upset because of the name
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-14 00:10:15 +00:00
Guy Harris 1c18115bd3 Fetch an indication of whether the interface supports capturing in
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-13 17:37:39 +00:00
Guy Harris dc09d61a92 Prune some includes.
svn path=/trunk/; revision=32721
2010-05-08 01:18:12 +00:00
Guy Harris 077ff72ac1 As with the list of data link types, so with the list of interfaces; move
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-07 19:24:32 +00:00
Guy Harris 13bf4a0c55 Add routines vfprintf_stderr() and fprintf_stderr() to print to the
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
2010-05-07 08:40:02 +00:00
Guy Harris cc05b9250d For TShark and Wireshark, get the list of link-layer types for an
interface by running dumpcap, so that if you need privileges to open an
interface, and dumpcap has those privileges, neither TShark nor
Wireshark need them.

svn path=/trunk/; revision=32710
2010-05-07 08:06:25 +00:00
Guy Harris 9a84de8932 Handle -I in the options processing.
svn path=/trunk/; revision=32703
2010-05-07 01:25:53 +00:00
Guy Harris 7dbbb8c572 Just check for pcap_create(); it first appeared in libpcap 1.0.0, and
pcap_set_buffer_size() did as well, so there aren't any libpcap releases
with pcap_create() but not pcap_set_buffer_size().

Only do one check for pcap_create.

svn path=/trunk/; revision=32695
2010-05-06 23:33:41 +00:00
Anders Broman f9981411f1 Checking in Stigs changes from
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=475
BUT not activating the check for 
pcap_create()
pcap_set_buffer_size()
This should make it possible to build with support for setting the buffersize if not capturing 802.11 traffic.

The code for handling the 'B' option should be OK in any case.

svn path=/trunk/; revision=32688
2010-05-06 18:34:30 +00:00
Guy Harris f05fb51aba Squelch some compiler warnings.
svn path=/trunk/; revision=32111
2010-03-04 09:37:05 +00:00
Guy Harris 167ab3a98c In Wireshark and TShark, run dumpcap to get interface lists and lists of
link-layer header types for interfaces; if special privileges are
necessary to open capture devices, Wireshark and TShark shouldn't have
those privileges, but dumpcap should.

svn path=/trunk/; revision=32104
2010-03-04 01:12:04 +00:00
Bill Meier e4d6610bd5 Fix various gcc -Wshadow warnings.
svn path=/trunk/; revision=31729
2010-01-29 16:09:25 +00:00
Michael Tüxen 6de58c28f0 Add -n option to dumpcap. It will save the capture files in
pcapng format instead of pcap. The default is to use pcap.

svn path=/trunk/; revision=28170
2009-04-27 08:11:10 +00:00
Guy Harris 1514fcff5f Have the minimum snapshot length be 1 byte, and have a snapshot length
of 0 mean 65535, similar to what tcpdump does.

Fixes bug 2731.

svn path=/trunk/; revision=27526
2009-02-23 19:00:30 +00:00
Guy Harris 44f8cae6ab If we don't have any of the pcap_datalink_XXX_to_YYY routines,
substitute our own (I wrote them all, so I can steal them from the
BSD-licensed libpcap if I want :-)).  This means that
linktype_name_to_val() and linktype_val_to_name() are always available,
and we don't need to #ifdef use of them.

Use pcap_datalink_val_to_description() to get the description for a
particular DLT_ value, rather than mapping the DLT_ value to a
WTAP_ENCAP_ value and getting the description for the latter.

svn path=/trunk/; revision=27074
2008-12-21 23:22:12 +00:00
Stig Bjørlykke 483f45be1c Use correct type when printing remote_port.
svn path=/trunk/; revision=26676
2008-11-03 12:09:11 +00:00
Stig Bjørlykke ee2b7fd393 Fix some "format not a string literal and no format arguments" warnings.
svn path=/trunk/; revision=26642
2008-10-31 10:30:17 +00:00
Stig Bjørlykke 2eb5983b47 Do not only update the argument name, but also where it's used.
svn path=/trunk/; revision=25566
2008-06-23 21:58:16 +00:00
Guy Harris 2a6564dea9 Rename a variable to avoid collisions with a global variable, as noted
by John Smith.

svn path=/trunk/; revision=25549
2008-06-23 20:34:18 +00:00
Guy Harris e731e24b51 capture_opts_print_statistics() has nothing to do with capture options
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
2008-06-20 00:09:47 +00:00
Jeff Morriss a5cee04fad Move the file utility functions from wiretap to libwsutil so that
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
2008-05-22 15:46:27 +00:00
Gerald Combs 20186d4947 If we have pcap_open, call it instead of pcap_open_live, otherwise we might
crash. The changes to trigcap.c haven't been tested, but _should_ work.

svn path=/trunk/; revision=25279
2008-05-12 19:41:32 +00:00
Ulf Lamping 151c5b47b5 replace confusing #if checking for GlIB2.6.0 by #if GLIB_CHECK_VERSION(2,6,0)
svn path=/trunk/; revision=24855
2008-04-09 04:57:47 +00:00
Bill Meier 8d4f01eea7 Ensure tshark/wireshark always get good err msgs from dumpcap:
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
2008-02-23 19:59:38 +00:00
Stig Bjørlykke ad5e6ad06b Removed some more "statement not reached" warnings.
svn path=/trunk/; revision=24283
2008-02-07 12:52:08 +00:00
Tomas Kukosa 08bbd29c71 Support for RPCAP features in GUI (from Boris Misenov, see Bug 1366)
- 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

svn path=/trunk/; revision=23750
2007-12-04 11:19:29 +00:00
Ulf Lamping 879d656537 as "advertised" some days ago:
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-09-25 21:55:06 +00:00
Gerald Combs 92802883a6 Change the "--enable-setuid-install" option to install dumpcap and TShark
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-30 00:24:40 +00:00
Bill Meier 66e9ce1c9d capture_opts_log: use dummy string if iface_desc is NULL;
This fixes dumpcap crash on Windows 

svn path=/trunk/; revision=22707
2007-08-28 17:47:39 +00:00
Jeff Morriss 2f77efce7d Fix bug http://bugs.wireshark.org/bugzilla/show_bug.cgi?id=1757 :
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-22 16:30:16 +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
Stephen Fisher 6e2511a28b Fix bug #1665 / From Nikns Siankin:
Fix compilation on OpenBSD.  This needs to go into 0.99.6 release.


svn path=/trunk/; revision=22188
2007-06-25 18:59:43 +00:00
Gerald Combs f60e81aaac Fix compilation under VS6 (hopefully without breaking compilation
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-11 18:26:09 +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
Guy Harris cc22748169 Have the routines to get interface lists take a pointer to a "gchar *"
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-21 23:45:36 +00:00
Ulf Lamping 2cbce84d41 Win32: MSVC > 6 doesn't work well with Unicode filenames!
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-12 03:05:28 +00:00
Ulf Lamping 894f6cd603 from Laurent Rabret:
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-03 02:50:22 +00:00
Bill Meier 38a246630f From Pierre Juhen: patch to correct the bug 1220
svn path=/trunk/; revision=20254
2007-01-01 16:58:03 +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
Guy Harris a28b428aff Go back to setting the capture filter to an empty string when we start;
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-26 18:36:09 +00:00
Guy Harris fde1140905 Initialize the cfilter field of a capture_opts structure to a null
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-08-21 23:28:19 +00:00
Gerald Combs 8958bab6de Tethereal/tethereal -> TShark/tshark.
svn path=/trunk/; revision=18268
2006-05-31 17:38:42 +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
Ulf Lamping e291c857cd prepare to list the IP addresses in the command line interfaces list output
svn path=/trunk/; revision=17950
2006-04-21 22:40:33 +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 f8d7cbf654 remove some XXX markers in comments which are no (longer) ToDo items
svn path=/trunk/; revision=17715
2006-03-24 02:40:59 +00:00
Guy Harris a8f261dba7 A "-b" argument must have a : in it, as it has to specify a criterion
type and value, separated by a :.

svn path=/trunk/; revision=17438
2006-03-01 01:54:46 +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
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 545110c939 fix #661
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-12 22:38:37 +00:00
Ulf Lamping 15f9051029 move output_to_pipe flag from tethereal's loop_data into capture_opts, so it can be used by dumpcap (capture_loop.c) as well
svn path=/trunk/; revision=16972
2006-01-07 01:29:45 +00:00
Ulf Lamping cee67cb78b Win32 bugfix: peeking the signal_pipe at capture_loop start seems to be unreliable
Instead, simply keep the signal_pipe setting directly from the command line which is working well

svn path=/trunk/; revision=16833
2005-12-17 00:19:47 +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 e1ee12bc71 add capture_opts_trim(), as this sequence is used three times now (will replace the other appearances later) ...
svn path=/trunk/; revision=16683
2005-12-05 21:26:01 +00:00
Ulf Lamping d2a024af60 split capture.h into capture.h, capture_loop.h and capture_opts.h and place the parts into the corresponding files
svn path=/trunk/; revision=16664
2005-12-03 19:32:54 +00:00
Guy Harris 2f7fd680e2 Handle "-G" only in Tethereal - it doesn't work in Ethereal, and isn't
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-17 05:59:21 +00:00
Ulf Lamping 65a12455f8 including io.h isn't needed
svn path=/trunk/; revision=16486
2005-11-12 10:01:35 +00:00
Ulf Lamping 4443681a9e fix Ethereal so command line capture parameter will work with kilobytes (again)
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-10-07 03:34:27 +00:00
Ulf Lamping ec246cae54 fix #148: (win32 only) use command line parameter -B to set capture buffer size
svn path=/trunk/; revision=14484
2005-05-30 04:46:25 +00:00
Ulf Lamping 5d404864f2 use the log features of the GLib to have verbose output of the capturing 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-05-26 17:50:27 +00:00
Ulf Lamping 4852c618d8 add a state member to the capture_opts, and set it according to the capture engine
svn path=/trunk/; revision=14205
2005-04-27 19:43:02 +00:00
Ulf Lamping 7e9cedfed8 capture engine:
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-12 21:44:55 +00:00
Ulf Lamping 7b7f7e7f9a Win32 only bugfix: as using TerminateProcess is the brute force way and 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-04-10 16:43:22 +00:00
Ulf Lamping 0b132c9b1d bugfixes: bring non real-time captures back to former behaviour, other minor fixes
svn path=/trunk/; revision=13961
2005-03-28 21:05:53 +00:00
Ulf Lamping b64ebb05c2 fix Solaris build (I've removed O_BINARY)
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-28 16:14:34 +00:00
Ulf Lamping 9d6ac60cef remove capture_child flag from capture_opts as it's no longer required
svn path=/trunk/; revision=13954
2005-03-28 15:31:13 +00:00
Ulf Lamping daa67c79ba a lot more capture engine code cleanup
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-28 14:39:31 +00:00
Guy Harris d11694e340 The "cf" field of a "capture_options" structure is a "void *" and, in
practice, it points to a "capture_file" structure; print it with "%p",
not "%s".

svn path=/trunk/; revision=13952
2005-03-28 03:08:29 +00:00
Ulf Lamping 7e78ef354e major capture engine rework: use two task model for EVERY capture mode
rework of the -b command line parameter (for Ethereal and Tethereal)

svn path=/trunk/; revision=13949
2005-03-28 00:19:02 +00:00
Guy Harris 343810d95a Move "get_natural_int()" and "get_positive_int()" from "capture_opts.c"
to "clopts_common.c", make them not static, and use them in "gtk/main.c".

svn path=/trunk/; revision=13541
2005-02-27 21:15:30 +00:00
Luis Ontanon c348bbdf91 avoid capture stopping after just 1 packet in tethereal,
- in capture_opts_init() set capture_opts->autostop_packets to 0 instead of one.


svn path=/trunk/; revision=13500
2005-02-24 21:22:51 +00:00
Guy Harris 8718e20103 Include <string.h> and <ctype.h> to get the appropriate functions
declared and macros defined.

Pass all the necessary arguments to "get_natural_int()".

svn path=/trunk/; revision=13490
2005-02-24 05:39:59 +00:00
Ulf Lamping b6ab688e0a pass child capture filename to parent process (name currently unused) and some fork_child cleanup
svn path=/trunk/; revision=13482
2005-02-23 22:04:31 +00:00
Ulf Lamping 72547c8d02 use the applications name (currently "ethereal" or "tethereal") in capture_opts, instead of hardcoded "ethereal" for both.
svn path=/trunk/; revision=13476
2005-02-23 08:34:12 +00:00
Ulf Lamping d643a55488 move capture_opts related things (init, command line, ...) from capture.c to a new file capture_opts.c and let both ethereal and tethereal use it.
svn path=/trunk/; revision=13474
2005-02-23 01:01:19 +00:00