Commit Graph

155 Commits

Author SHA1 Message Date
Guy Harris c73c44cf4b Get rid of unnecessary assignment (the code below it always assigns a
value to the variable).  Praise be to Clang Cat.

svn path=/trunk/; revision=39877
2011-11-16 02:43:58 +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
Guy Harris 40a863f8bf Fix prematurely-terminated comment.
svn path=/trunk/; revision=38696
2011-08-24 02:37:36 +00:00
Guy Harris 898334c7a5 Fix a comment; this includes describing an additional way in which we
could fail to open the capture file.

svn path=/trunk/; revision=38695
2011-08-24 02:25:08 +00:00
Michael Tüxen 2ab112d5dd Hopefully fix
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6256.

svn path=/trunk/; revision=38694
2011-08-23 23:10:50 +00:00
Michael Tüxen 4e255f1398 Fix Windows build.
svn path=/trunk/; revision=38352
2011-08-05 08:26:07 +00:00
Michael Tüxen f924ea67ca Simplification suggested by Guy.
svn path=/trunk/; revision=38351
2011-08-05 08:11:27 +00:00
Michael Tüxen 7f895c681b Generate the capure sync pipe correctly.
Fix obtained from Irene Ruengeler.

svn path=/trunk/; revision=38349
2011-08-05 07:10:20 +00:00
Stig Bjørlykke 8443bbbf75 Replace all strerror() with g_strerror().
Remove our local strerror implementation.
Mark strerror as locale unsafe API.

This fixes bug 5715.

svn path=/trunk/; revision=37812
2011-06-28 09:00:11 +00:00
Michael Tüxen df70b4c15c Fix the bug reported by Guy. Now
tshark -i en0 icmpp
returns a correct error message.


svn path=/trunk/; revision=37806
2011-06-27 19:07:36 +00:00
Michael Tüxen 4bc67de4ea Report the correct interface when there is a problem with a capture filter.
This patch is from Irene Ruengeler.

svn path=/trunk/; revision=37804
2011-06-27 12:13:15 +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
Bill Meier aaa723e538 Fix gcc 4.6 "set but not used [-Wunused-but-set-variable]" warnings;
Also: whitespace cleanup.

svn path=/trunk/; revision=37603
2011-06-07 23:03:12 +00:00
Michael Tüxen c6c2577bbc Fix the capturing from the GUI. Honor the iface variable.
The next step is to retire the iface variable and use
the ifaces array only. This should simplify things and
fix the cases, where you start wireshark with command
line arguments and also use the GUI.

svn path=/trunk/; revision=37342
2011-05-21 13:22:38 +00:00
Michael Tüxen 8b701e108a In case we have no interface information in the array, use the global value.
This fixes https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5935.

svn path=/trunk/; revision=37307
2011-05-19 20:20:35 +00:00
Michael Tüxen 3a2a342fc4 Move the debug output for the generated command line arguments to the correct place.
svn path=/trunk/; revision=37276
2011-05-19 04:30:05 +00:00
Martin Mathieson 2baa82a136 Only declare a variable if its going to be used.
svn path=/trunk/; revision=37273
2011-05-19 01:09:05 +00:00
Guy Harris d391f403da We don't have the ability to set the capture buffer size on all platforms.
svn path=/trunk/; revision=37255
2011-05-18 19:29:47 +00:00
Michael Tüxen b031b9643a Use the interface specific parameter array.
This enables the capturing from mulitple interfaces using 
tshark and wireshark (at the command line).
(tshark -i lo0 -i en0) or (wireshark -k -i lo0 -i en0)
works. You can capture from multiple remote and local
interfaces.

Based on work from Irene Ruengeler.

svn path=/trunk/; revision=37248
2011-05-18 18:02:30 +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 1b9e4d5c00 STATUS_UNWIND_CONSOLIDATE "should not happen", so don't include it -
we'd have to include some other headers to get it defined.

Get rid of the include of Winbase.h - it doesn't define
STATUS_UNWIND_CONSOLIDATE, and it's not necessary.

svn path=/trunk/; revision=33413
2010-07-02 08:52:35 +00:00
Guy Harris 949b2a2dc8 Include <Winbase.h> to get error statuses.
svn path=/trunk/; revision=33412
2010-07-02 08:41:19 +00:00
Guy Harris 01b72bb5d1 Attempt to detect when dumpcap dies due to an exception and report that
appropriately.

svn path=/trunk/; revision=33411
2010-07-02 08:39:08 +00:00
Guy Harris f2e12f5fb3 Have sync_pipe_wait_for_child() return the child's exit status on
Windows, just as we do on UN*X.

svn path=/trunk/; revision=33410
2010-07-02 04:11:04 +00:00
Guy Harris b0b7697dea From Petr Lautrbach: when capturing, return the exit status of dumpcap,
so we give a non-zero exit status for invalid interfaces or capture
filters.

From me: don't exit immediately if dumpcap failed, print out information
from taps and the like.

svn path=/trunk/; revision=33393
2010-07-01 00:12:16 +00:00
Guy Harris 391b5127d6 Clean up the error reporting. An EOF from the sync pipe when capturing
is just an indication that the capture child exited; don't treat it as
an error, unless the child process exits with an abnormal status.
 
As tshark sends a "stop capture" indication to the child when it's
^C'ed, the child will exit and we'll get an EOF from the capture pipe;
don't make SIGINT etc. interrupt system calls, so they don't cause reads
from the capture pipe to get EINTR errors.

svn path=/trunk/; revision=32986
2010-05-27 00:48:08 +00:00
Stig Bjørlykke b9bf692c3e Untabify.
svn path=/trunk/; revision=32970
2010-05-26 07:19:42 +00:00
Guy Harris 5c27494bd6 Don't report EINTR - it might be from a ^C.
Do report the error string for other read errors, though.

svn path=/trunk/; revision=32969
2010-05-26 05:33:57 +00:00
Guy Harris 26bf53f0b1 Use the right system call name.
svn path=/trunk/; revision=32965
2010-05-26 02:34:12 +00:00
Guy Harris d0ac88186d If dumpcap exits abnormally, report the error.
svn path=/trunk/; revision=32964
2010-05-26 02:32:19 +00:00
Guy Harris bcba2a44e3 Fix comments.
svn path=/trunk/; revision=32885
2010-05-19 03:49:52 +00:00
Guy Harris 414399b572 Fix some errors. Use FormatMessageA(), as we need the string in ASCII.
svn path=/trunk/; revision=32857
2010-05-18 05:32:29 +00:00
Guy Harris 964383bf1c Add a routine to convert Win32 error statuses into strings, and use it
when generating error messages.

The error code from CreatePipe() is gotten by calling GetLastError();
it's not in errno.

Clean up indentation a bit.

svn path=/trunk/; revision=32855
2010-05-18 03:29:45 +00:00
Guy Harris 14c40a21aa Make -Z always generate machine-readable output, and don't bother
supplying -M along with -Z.  (We keep -M around for debugging use; it's
documented, unlike -Z.)

svn path=/trunk/; revision=32850
2010-05-17 23:56:00 +00:00
Guy Harris 03d408abcb Update a comment.
svn path=/trunk/; revision=32844
2010-05-17 18:41:48 +00:00
Guy Harris 991c5e9898 When dumpcap is run to get an interface list, interface capabilities, or
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-17 18:40:23 +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 6ace737ae4 Add monitor mode support to TShark.
svn path=/trunk/; revision=32704
2010-05-07 01:46:38 +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 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
Guy Harris 0bd0d5939a Fix a typo.
svn path=/trunk/; revision=32080
2010-03-02 00:39:41 +00:00
Bill Meier e4d6610bd5 Fix various gcc -Wshadow warnings.
svn path=/trunk/; revision=31729
2010-01-29 16:09:25 +00:00
Jeff Morriss af6fca176d Don't use SIGUSR1 to tell dumpcap to exit, use SIGINT: SIGINT is traditionally
used for this purpose and using it also prevents the 2 signals the child gets:
	- the user's Ctrl-C (which is sent as a SIGINT to both *shark and its
	  child dumpcap)
	- the signal *shark generates to shut down the child

from colliding (and running 2 signal handlers in the child).

It might be possible for tshark to not send the signal at all when it gets
SIGINT, but it doesn't do any harm now.

Also, do not call g_log() within the signal handler: doing so can cause
aborts (if g_log is being called by the process when the signal comes, the
2nd entrance into g_log is detected as a recursion).

This fixes https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=2767

svn path=/trunk/; revision=29881
2009-09-13 17:46:10 +00:00
Stig Bjørlykke a61e285004 Added a preference to capture in Pcap-NG from GUI.
svn path=/trunk/; revision=28740
2009-06-15 16:36:02 +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 32d411be1d Do not set buffer size for remote interfaces or when using default value.
Do not get link-layer for remote interfaces.

svn path=/trunk/; revision=26683
2008-11-03 21:38:53 +00:00