Commit Graph

439 Commits

Author SHA1 Message Date
Chris Maynard 91ecc2334f "man inet_pton" only says that it returns a negative value, zero or a postive value, and not specifically -1, 0, or 1, so even though we know that's what wsutil's inet_pton will return, we shouldn't test against those exact values.
svn path=/trunk/; revision=50670
2013-07-16 16:23:31 +00:00
Chris Maynard 42b09314b0 C++ style comments are not allowed in ISO C90. (Fixes the rest of them now that I noticed, "this will be reported only once per input file")
svn path=/trunk/; revision=50613
2013-07-15 15:51:45 +00:00
Chris Maynard e7e260b4fc Trivial: C++ style comments are not allowed in ISO C90.
svn path=/trunk/; revision=50612
2013-07-15 15:48:10 +00:00
Luis Ontanon 0bdc0efc46 get main_window_update out of the way... pass an update_cb to the capture_sync stuff
... as per the XXX comment removed from tshark.c this was a mess to keep the linker
happy... I couldn't!

I did this without even understanding whether calling main_window_update was realy
necessary in most cases. I guess nothing or more specific update cbs would be best.


svn path=/trunk/; revision=50188
2013-06-27 17:10:50 +00:00
Jeff Morriss bbf6a3766e Move tempfile.{h,c} into wsutil.
svn path=/trunk/; revision=50163
2013-06-26 01:14:35 +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 c1d34d4be6 On OS X, get the interface type from the System Configuration framework.
svn path=/trunk/; revision=49486
2013-05-22 01:19:18 +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
Anders Broman 26ddabf0d7 From Michal Labedzki:
Fix some compilation errors in dumpcap/plugins


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

svn path=/trunk/; revision=48413
2013-03-19 05:09:37 +00:00
Michael Tüxen da07699dd3 Make the memory limit (in bytes or packets) used for storing packets
configurable via command line options and print specific drop numbers
at the end. This allows to tune the buffering when using multiple
threads.
This also fixes a logic arrow in enforcing the limits.
The patch for the enhanced counters is from Anders Broman.


svn path=/trunk/; revision=48223
2013-03-10 11:57:40 +00:00
Anders Broman 85973068cc From beroset:
remove C++ incompatibilities

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

svn path=/trunk/; revision=48038
2013-03-03 17:14:19 +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 1a4fb17e13 Update the text of dumpcap -h, default buffer size should be 2 MB.
svn path=/trunk/; revision=47935
2013-02-28 06:37:41 +00:00
Bill Meier 4d9850f689 it's ==> its
svn path=/trunk/; revision=47894
2013-02-26 01:43:39 +00:00
Gerald Combs bd4cffae58 When any of our executables start on Windows create or open a "Wireshark
is running" mutex. Have the NSIS installer check for this mutex and ask
the user to close Wireshark if it's found. While not perfect this makes
the WinSparkle update process much less annoying.

svn path=/trunk/; revision=47758
2013-02-20 01:19:42 +00:00
Anders Broman e90f414a72 svn path=/trunk/; revision=47210 2013-01-22 08:28:46 +00:00
Guy Harris 05825b02cd Add some routines to wsutil to, at least on some platforms, add
information to crash dumps and the like.  (Currently, we only handle OS
X's CrashReporter, but we should do this on other platforms where this
information can be added and would be helpful.)

White space tweaks.

svn path=/trunk/; revision=47104
2013-01-15 21:54:41 +00:00
Michael Mann 18580d6703 Allow pcap/pcapng format to be written to more than just a file (FILE*). Gives more flexibility if needed.
WRITE_DATA macro replaced and applied consistently throughout pcapio.c

svn path=/trunk/; revision=46891
2013-01-02 04:01:22 +00:00
Anders Broman 8106e33188 Make dumpcap build on Windows
svn path=/trunk/; revision=46788
2012-12-26 15:02:32 +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
Guy Harris e0ed1bddab More whitespace cleanups.
svn path=/trunk/; revision=46716
2012-12-23 09:54:05 +00:00
Michael Tüxen 644f8485da Add support for writing per packet comments when using pcapng.
Not actually used with this commit, which just brings in the
infrastructure.


svn path=/trunk/; revision=46715
2012-12-23 09:25:42 +00:00
Guy Harris bb846842f8 Fix indentation.
svn path=/trunk/; revision=46712
2012-12-23 06:52:50 +00:00
Guy Harris 0ddce65214 fclose() and fflush() are standard C routines, so there's no need for
our own wrappers.  (pcapio.c isn't using wrappers around, for example,
fwrite().)

svn path=/trunk/; revision=46640
2012-12-20 20:00:06 +00:00
Michael Tüxen 9a2f4c8e9d Don't use an pcap structures in pcapio.[ch].
Currently, pcapio is only used by dumpcap, which is only compiled
if there is pcap support. However, making pcapio independent from
libpcap allows it also to be used from text2pcap, which does not
rely on libpcap.

svn path=/trunk/; revision=46637
2012-12-20 15:20:10 +00:00
Michael Tüxen 7e84abf005 Add ws_fclose(), ws_fflush(), and ws_fdopen() to the fileutils.
Retire libpcap_fdopen(), libpcap_dump_flush(), and libpcap_dump_close().

svn path=/trunk/; revision=46636
2012-12-20 14:53:09 +00:00
Michael Tüxen 10dbe80c65 Add support for writing the flags option in the enhanced
packet block (pcapng).

svn path=/trunk/; revision=46619
2012-12-19 20:27:12 +00:00
Anders Broman 2977bde9f1 - Make dumpcap build with the new bundle.
- Use the correct bundle id for GTK3

svn path=/trunk/; revision=46586
2012-12-18 11:58:22 +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
Jeff Morriss 05ee001d73 Document the "-g" option to dumpcap.
Add that option to tshark, too, and document it.

The option can't be given to Wireshark because the GUI already has a "-g"
(goto packet).

svn path=/trunk/; revision=46513
2012-12-12 02:07:08 +00:00
Stephen Fisher 0537be2e5e Change variable "devname" to "devicename" in numerous places to avoid
to avoid -Wshadow warnings about conflicting with BSD's devname()
function.


svn path=/trunk/; revision=46494
2012-12-10 23:53:09 +00:00
Bill Meier 552323e7fb Fix a number of [-Wshadow] warnings;
Also: Do some minor whitespace changes

svn path=/trunk/; revision=46182
2012-11-25 18:35:41 +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 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 03f4fa5223 Make the "Invalid capture filter" message resemble that of other programs.
svn path=/trunk/; revision=46107
2012-11-21 16:05:21 +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
Bill Meier 68aeb27b90 (Trivial): update a comment.
svn path=/trunk/; revision=45287
2012-10-03 15:42:41 +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
Evan Huus bcf6e79573 Convert inpkts_to_sync_pipe and report_packet_count() to use unsigned ints
consistently. Cleans up some cppcheck warnings about signed/unsigned mismatches
in format strings.

svn path=/trunk/; revision=44818
2012-09-09 13:57:43 +00:00
Michael Tüxen 11c86ec476 Update recv/drop counters also when no threads are used.
This should fix
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7523

svn path=/trunk/; revision=43981
2012-07-25 07:08:20 +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
Guy Harris 2851255f53 Don't supply a fallback error message for pcap_open() unless it actually
fails.

This may clear up the problem most recently reported in bug 7021 after
the crash was fixed, where the capture starts successfully but an error
dialog pops up.

svn path=/trunk/; revision=43501
2012-06-27 05:13:06 +00:00
Jörg Mayer 2b6b0656c2 Pontus Fuchs via bug 6973:
Add last piece of the wireless toolbar: Use dumpcap to actually set
the channel.

svn path=/trunk/; revision=43466
2012-06-24 19:45:49 +00:00
Jörg Mayer 3685b4db6f Remove some trailing whitespace
svn path=/trunk/; revision=43425
2012-06-21 13:23:45 +00:00
Michael Tüxen 1b0a5c58e2 Fix compilation on FreeBSD.
svn path=/trunk/; revision=43343
2012-06-18 21:50:59 +00:00
Chris Maynard c3dadc73f3 Fix Coverity CID 708961: Resource leak, by closing the socket if the connect() fails. While there, print a human-readable error message on Windows like we do for other platforms. Lastly, be sure to specify FORMAT_MESSAGE_IGNORE_INSERTS in the dwFlags arg to all FormatMessage() calls where FORMAT_MESSAGE_FROM_SYSTEM is also specified. (Ref: http://blogs.msdn.com/b/oldnewthing/archive/2007/11/28/6564257.aspx)
svn path=/trunk/; revision=43171
2012-06-09 03:36:15 +00:00
Chris Maynard 11204066a8 Some minimal documentation of remote capture interface formats for both rpcap and the new TCP feature from bug 2788.
svn path=/trunk/; revision=43156
2012-06-08 13:55:14 +00:00
Chris Maynard 74f85a07c0 Add another cast to make Windows buildbots happy.
svn path=/trunk/; revision=43155
2012-06-08 13:23:14 +00:00
Anders Broman 14c0648ce4 Add a cast.
svn path=/trunk/; revision=43154
2012-06-08 12:27:22 +00:00
Anders Broman 6a1f6be63b From Alexey Neyman Forward ported by Michael Mann:
Allow captures over TCP connections.

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

svn path=/trunk/; revision=43153
2012-06-08 11:54:26 +00:00
Chris Maynard 6272bd1578 In cap_pipe_open_live(), be sure to call ws_close(fd) before returning due to a couple of error condtions. Fixes Coverity CID 702395 Resource leak.
svn path=/trunk/; revision=42844
2012-05-25 01:32:26 +00:00
Guy Harris fb8054f131 Expand a comment.
Clear the struct sigaction *before* we fill in any fields in it.

svn path=/trunk/; revision=42706
2012-05-18 04:06:35 +00:00
Gerald Combs bdb614e264 Fix a bunch of uninitialized variables found by Coverity Scan. CIDs
702403, 702404, 702405, 702406, 702407, 702408, 702409, 702410, 702411,
and 702412.

svn path=/trunk/; revision=42658
2012-05-16 16:29:12 +00:00
Bill Meier 9d4b7ad9fe From Evan Huus:
In get_capture_device_open_failure_messages() in dumpcap.c, there are some
 statements that should have been guarded by ifdefs, causing a little
 unnecessary work on some platforms, and a bunch of unused-variable warnings
 from static analyzers. The patch fixes the problem.

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

svn path=/trunk/; revision=42454
2012-05-07 00:49:39 +00:00
Michael Tüxen e08a45d705 Set also the pcap buffer, if the default of 1 MB is used. This bug was
reported by Guy.

svn path=/trunk/; revision=42246
2012-04-25 21:19:31 +00:00
Michael Tüxen 3c866b04d0 Report the packets captured and the packets dropped (either by libpcap or by dumpcap).
svn path=/trunk/; revision=42245
2012-04-25 21:09:33 +00:00
Michael Tüxen 8ea1984ddc Allow writing ISB with given recv/drop counters.
No functional change by this commit.

svn path=/trunk/; revision=42242
2012-04-25 20:50:38 +00:00
Michael Tüxen d2526de5f8 Fix the packet counters.
This fixes the inconsistencies reported on the command line by dumpcap
as indicated by
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7191

svn path=/trunk/; revision=42236
2012-04-25 17:43:44 +00:00
Michael Tüxen 0fe7859ca4 Fix locking problem.
svn path=/trunk/; revision=42235
2012-04-25 16:05:29 +00:00
Guy Harris 04cd90e99e From Evan Huus: add a missing free. Fixes bug 7092.
svn path=/trunk/; revision=42070
2012-04-14 17:45:03 +00:00
Guy Harris 5ef71a27ff Fix tpo.
svn path=/trunk/; revision=41941
2012-04-04 19:46:45 +00:00
Guy Harris 43ca745bb9 Work around that WinPcap bug for another pcap_open() call.
svn path=/trunk/; revision=41938
2012-04-04 19:26:07 +00:00
Guy Harris 9c781b0939 Work around WinPcap bug wherein pcap_open() returns -1 without putting
an error message into errbuf (the bug has been reported to
winpcap-bugs).

Should fix bug 6922.

svn path=/trunk/; revision=41937
2012-04-04 19:13:39 +00:00
Anders Broman ba7c0cb1b9 From Jose Pedro Oliveira:
dumpcap.c: code cleaning 
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6718

svn path=/trunk/; revision=41535
2012-03-13 15:27:22 +00:00
Anders Broman cbde63643e From Jose Pedro Oliveira:
Enforce the modelines in dumpcap.c and in pcapio.c

svn path=/trunk/; revision=41505
2012-03-12 15:40:57 +00:00
Guy Harris 6486942282 Fix function name in debugging message.
svn path=/trunk/; revision=41488
2012-03-11 19:59:08 +00:00
Gerald Combs 7a8df2f485 In pcapng.c use the units per second value from the interface instead of
the default.

Add support for reading nseclibpcap files to dumpcap.

svn path=/trunk/; revision=41455
2012-03-10 00:24:42 +00:00
Anders Broman bb71a9c96a Forward interface_opts.descr (currently empty) when writing IDB:s
svn path=/trunk/; revision=41454
2012-03-09 15:29:35 +00:00
Anders Broman 9d03324d91 From Jose Pedro Oliveira: Make dumpcap write the if_tsresol option (using the default value) https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6718
svn path=/trunk/; revision=41444
2012-03-09 05:02:27 +00:00
Gerald Combs 57eeea4b20 Add a note about using GetSystemTimePreciseAsFileTime.
svn path=/trunk/; revision=41382
2012-03-06 21:11:31 +00:00
Guy Harris 26f694ddee Fix comment.
svn path=/trunk/; revision=41347
2012-03-05 06:43:44 +00:00
Anders Broman ad6640344f From Jose Pedro Oliveira: Fix typos
svn path=/trunk/; revision=41330
2012-03-03 16:17:20 +00:00
Gerald Combs 8334ec2b43 Another small commit to test migration.
svn path=/trunk/; revision=41251
2012-03-01 02:18:35 +00:00
Gerald Combs 380f3f54a7 Add a comment noting that we need to add support for files with
nanosecond timestamps. (Also test the recent anonymous repository
migration.)

svn path=/trunk/; revision=41248
2012-02-29 20:32:12 +00:00
Michael Tüxen 050c0a14c9 Don't use deprecated API on glib 2.31.18 and higher.
This should fix
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6884

svn path=/trunk/; revision=41247
2012-02-29 18:04:23 +00:00
Michael Tüxen 412c5a903c As discussed with Anders: Only write a single ISB at the end. Proivde
start/end time in the ISBs.

svn path=/trunk/; revision=41160
2012-02-23 12:57:17 +00:00
Anders Broman 8fff390455 - Write ISB(s) at start and end of capture.
- Read all options.
- Prepare to write ISB.

svn path=/trunk/; revision=41137
2012-02-22 14:41:02 +00:00
Anders Broman af2100d4c3 Expand the API for ISB:s
svn path=/trunk/; revision=41136
2012-02-22 10:01:16 +00:00
Michael Tüxen f7dc80cb18 Whitespace changes.
svn path=/trunk/; revision=41124
2012-02-21 18:01:01 +00:00
Michael Tüxen 41df09c92a Whitespace changes.
svn path=/trunk/; revision=41115
2012-02-21 16:28:42 +00:00
Anders Broman 1cf19ea95f From Jose Pedro Oliveira:
dumpcap: only free os_version_str after the
libpcap_write_interface_description_block() calls.

svn path=/trunk/; revision=41114
2012-02-21 16:14:57 +00:00
Anders Broman 5df11d41bb Extend libpcap_write_interface_description_block() wiyh more options
all exept os curently unused.

svn path=/trunk/; revision=41108
2012-02-21 13:35:04 +00:00
Anders Broman ce86c08b58 From Jose Pedro Oliveira shb_os value: get_os_version_info() instead of get_runtime_version_info()
svn path=/trunk/; revision=41095
2012-02-21 05:52:50 +00:00
Anders Broman 29a14da188 Jose Pedro Oliveira: get_os_version_info() is more apropriate for shb_os
svn path=/trunk/; revision=41086
2012-02-20 21:17:43 +00:00
Michael Tüxen 68204c94a4 From Anders: Add support for options in the SHB.
From me: Some whitespace changes.

svn path=/trunk/; revision=41026
2012-02-14 17:07:52 +00:00
Anders Broman e553c70fe8 From Michael Mann:
help page update (pcapng is now the default file format).

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

svn path=/trunk/; revision=40658
2012-01-23 07:48:53 +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
Guy Harris 21f5ea24e4 Just hard-code the error for "can't load WinPcap"; the one that
cant_load_winpcap_err() has some redundant gunk in it.

svn path=/trunk/; revision=40333
2011-12-29 22:06:22 +00:00
Guy Harris 71c7f43d37 On Windows, if we can't open a capture device, check whether WinPcap is
loaded and, if not, report that as the problem, rather than suggesting
that you didn't specify the proper interface.

svn path=/trunk/; revision=40332
2011-12-29 21:59:24 +00:00
Guy Harris d892f00916 Show a "Capturing on ..." message similar to TShark.
svn path=/trunk/; revision=39989
2011-11-22 19:07:49 +00:00
Guy Harris 939feef06f If we're not running as a child process, report the interfaces on which
we're capturing.  (We do not require a -i flag; the message could be
useful if you don't specify the interface, as it lets you know which
interface was chosen, which might not be the interface you'd think it
would be.  Yes, that's arguably a libpcap bug, which I plan to look at;
it should probably try to figure out which interfaces are "active" if
possible, and prefer those.)

Use cmdarg_err() for invalid capture filters and other capture errors.

svn path=/trunk/; revision=39983
2011-11-22 10:08:26 +00:00
Guy Harris 46575653fd Don't set variables if we don't look at them later. All praise Clang
Cat.

svn path=/trunk/; revision=39876
2011-11-16 02:18:30 +00:00
Gerald Combs aa0c9c965c Try to fix the GLib thread API deprecations listed in bug 6552.
svn path=/trunk/; revision=39776
2011-11-09 23:43:50 +00:00
Stig Bjørlykke 612dcc3c6b As reported by Michael Speck:
Removed last occurrences of USE_THREADS.

svn path=/trunk/; revision=39775
2011-11-09 20:45:06 +00:00
Gerald Combs 7d442f4c22 Change the use of threads from "mostly always, depending on your
configure options and Gtk+ and GLib versions" to "always".

svn path=/trunk/; revision=39751
2011-11-07 23:42:53 +00:00
Chris Maynard 367cb50bd3 Minor formatting changes to the dumpcap -h output.
svn path=/trunk/; revision=39166
2011-09-27 18:19:23 +00:00
Bill Meier a58121db53 Fix vi "modeline" so it works;
See https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5748


svn path=/trunk/; revision=39076
2011-09-21 16:44:10 +00:00
Bill Meier 9c6aca43f2 Windows: GetTickCount() returns a DWORD (not a time_t);
Fixes a problem on Windows wherein specifying a capture file
time duration for autostop or file-switching would stop
working after some period of time.

The reason:
GetTickCount returns DWORD (unsigned int) which
 wraps "every 49.7 days";

and: The GetTickCount() return value was being stored in a time_t which is
 int64 on Windows;

thus:
 The test for elapsed time (using signed integers) didn't work correctly after
 the time had wrapped.

Fixes Bug #6280: https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6280


svn path=/trunk/; revision=38921
2011-09-07 18:25:54 +00:00
Stephen Fisher dc3c5c8b63 Attempt to fix coverity id 1212: MISSING_BREAK by inserting "FALLTHROUGH"
comment.


svn path=/trunk/; revision=38785
2011-08-29 21:36:48 +00:00
Jeff Morriss bf95c7b5e4 Fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5608 :
getopt() can/should normally be found in unistd.h, so:

- When testing for getopt(), define that we HAVE_GETOPT instead of
  HAVE_GETOPT_H (to avoid confusion).
- Don't attempt to include getopt.h: not all OS's have it (for example,
  Solaris 9 does not).
- (All the places which need getopt already include unistd.h (if we have it).)

If this breaks things on some OS, we might need (a real) HAVE_GETOPT_H check.

svn path=/trunk/; revision=38437
2011-08-09 21:02:10 +00:00
Jörg Mayer c15ff441c6 Replace deprecated glib functions.
In order to compile the whole project with -DG_DISABLE_DEPRECATED
the mate plugin needs to replace its usage of GMemChunk.
All other places should be clean.

svn path=/trunk/; revision=38392
2011-08-07 18:15:45 +00:00
Michael Tüxen 52f555d857 Use the threads based workaround only on windows (with thread support enabled),
since the workaround is only intended to work on windows.

svn path=/trunk/; revision=38059
2011-07-16 12:45:47 +00:00
Michael Tüxen c481dda78c Fix compilation on non-windows platforms defining USE_THREADS.
svn path=/trunk/; revision=38044
2011-07-15 14:31:27 +00:00
Michael Tüxen c51aafc3aa Handle the case where dumpcap is compiled without thread support, which
is the default.

svn path=/trunk/; revision=38043
2011-07-15 12:20:00 +00:00
Gerald Combs a533d70be0 On Windows enable threads everywhere instead of just in dumpcap. If
threads are enabled use them to check the recent file list. Fixes bug
3810.

svn path=/trunk/; revision=38033
2011-07-14 23:18:02 +00:00
Guy Harris da461f18ad Alas, the libpcap API didn't use "void *" where it should have; squelch
some warnings from Clang.

svn path=/trunk/; revision=37934
2011-07-08 02:02:37 +00:00
Chris Maynard 91f30ab64f From Jakub Zawadzki via bug 6002: Don't set state to STATE_EXPECT_DATA if there's no data to read.
Reference: https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6002


svn path=/trunk/; revision=37924
2011-07-06 16:22:11 +00:00
Gerald Combs 9661c3fdde Disable DEBUG_CHILD_DUMPCAP.
svn path=/trunk/; revision=37864
2011-07-02 15:44:17 +00:00
Jakub Zawadzki 5c801f3820 Revert r37857, r37861
svn path=/trunk/; revision=37862
2011-07-01 22:26:02 +00:00
Jakub Zawadzki fafa84d23e Try to get more information about AV.
svn path=/trunk/; revision=37861
2011-07-01 22:00:59 +00:00
Jakub Zawadzki aeb81605de Catch system exceptions from pcap_open_live() :)
svn path=/trunk/; revision=37857
2011-07-01 20:07:34 +00:00
Michael Tüxen be3a756582 Add paranoid debug output in open_capture_device().
svn path=/trunk/; revision=37847
2011-06-30 21:02:11 +00:00
Gerald Combs 031a28f65e Log the success or failure of pcap_open/pcap_create/pcap_open_live.
svn path=/trunk/; revision=37846
2011-06-30 20:17:26 +00:00
Gerald Combs f04a525e79 Temporarily enable dumpcap debugging.
svn path=/trunk/; revision=37844
2011-06-30 17:41:46 +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
Gerald Combs 710c5d67f7 Update suite-clopts.sh to match dumpcap's error output. Add a comment
to dumpcap.c about keeping the errors synced.

svn path=/trunk/; revision=37805
2011-06-27 16:09:49 +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 2c8c178f71 Improve the report of illegal capture filters. Also show the interface description.
svn path=/trunk/; revision=37802
2011-06-27 11:30:39 +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 23659efce6 Add pcap_options to the pcap_queue elements. This lets us keep interface
IDs in one place and fixes a bug which resulted in only writing
interface ID 0 to NG enhanced packet blocks.

svn path=/trunk/; revision=37773
2011-06-23 18:54:07 +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
Guy Harris 5ed5745664 Sigh. Cast away a warning.
svn path=/trunk/; revision=37676
2011-06-15 21:22:30 +00:00
Guy Harris 2bada9a24f Constify some arguments.
Technically, %p must be given a void * as an argument (although the
representation of pointers on all platforms we deal with is the same for
all pointed-to types).

svn path=/trunk/; revision=37675
2011-06-15 20:21:45 +00:00
Jakub Zawadzki f6bda7f43a Remove not used cap_pipe_err_str.
svn path=/trunk/; revision=37662
2011-06-13 15:28:37 +00:00
Michael Tüxen 71325b8ac2 When doing remote capturing using WinPCap, dumpcap crashes inside the WinPCap
library when no capture filter is used. Then cfilter is NULL and 
capture_loop_init_filter() does not call compile_capture_filter() and
pcap_setfilter(). Providing an empty string instead of NULL works around
the problem.

svn path=/trunk/; revision=37588
2011-06-07 12:23:15 +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 6516aa9864 Improve handling of command line errors.
svn path=/trunk/; revision=37477
2011-05-31 14:45:55 +00:00
Michael Tüxen 31c756a6d1 Initialize pcap using an empty array instead of NULL. So no special
check is needed.

svn path=/trunk/; revision=37445
2011-05-28 12:48:21 +00:00
Stig Bjørlykke 54356d4ccb Initialize global_ld.pcaps before we setup signal handlers, which
uses this list to cleanup.

svn path=/trunk/; revision=37425
2011-05-27 06:52:32 +00:00
Gerald Combs ebc0c3e33f Don't call g_log(); as the comment indicates it can cause problems.
svn path=/trunk/; revision=37418
2011-05-26 23:20:35 +00:00
Gerald Combs 093fce7576 Don't call pcap_breakloop() if we're not capturing anything. Fixes a
crash found by Stig.

Add debugging output to capture_cleanup_handler() on non-Windows
systems.

svn path=/trunk/; revision=37417
2011-05-26 22:12:27 +00:00
Chris Maynard a4f53c991c Append received percentage after received/dropped counts.
svn path=/trunk/; revision=37415
2011-05-26 20:05:11 +00:00
Michael Tüxen 1e70d66184 Provide consistent counters for received and dropped packets.
svn path=/trunk/; revision=37414
2011-05-26 19:22:16 +00:00
Michael Tüxen 90ddc2f3b1 Fix the handling of pipes on Windows platforms.
This should fix
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5939

svn path=/trunk/; revision=37413
2011-05-26 18:12:41 +00:00
Chris Maynard 77c9577a29 Change "captured/dropped" terminology to "received/dropped". Also, unless
we're a capture child, always report the final caputure count regardless of the
'quiet' setting.  This ensures that each interface prints its statistics on a
new line, rather than the first one being printed on the same line as the
packet count in the case when we're not 'quiet'.

svn path=/trunk/; revision=37410
2011-05-26 14:33:55 +00:00
Gerald Combs a24687ce8e Move the Windows argument list conversion code to a common routine.
svn path=/trunk/; revision=37372
2011-05-24 00:07:56 +00:00
Michael Tüxen bfb7d262e8 Use appropriate temporary filename when capturing from multiple interfaces.
svn path=/trunk/; revision=37344
2011-05-21 20:57:00 +00:00
Michael Tüxen 17dd51831f As suggested on the dev list: Use pcapng and threads
when capturing on multiple interfaces even if not specified
on the command line.

svn path=/trunk/; revision=37343
2011-05-21 18:51:25 +00:00
Gerald Combs 9be282951b Pass a pcap_options * instead of a pcap_options **.
svn path=/trunk/; revision=37341
2011-05-21 00:10:57 +00:00
Michael Tüxen eb3ebb5412 Drop privileges after opening all pcap devices, not after the first one...
svn path=/trunk/; revision=37311
2011-05-19 20:48:58 +00:00
Michael Tüxen b51eba6e47 Actually use the defaults from the last commit message.
... and switch off debug output.

svn path=/trunk/; revision=37285
2011-05-19 05:51:52 +00:00
Michael Tüxen e960be113f Add a queue and byte limit to the capture queue. Current default
values: 1000 packets, 1 MB. Should be made configurable via
command line options.

svn path=/trunk/; revision=37284
2011-05-19 05:49:46 +00:00
Guy Harris 91200c27a3 Dear GLib Developers:
Thank you very much for using "gulong" rather than "gsize" as the
"buffer length" argument to g_snprintf(), the fact that the
corresponding argument to snprintf() is a size_t nonwithstanding. 
Developers building for LLP64 platforms such as Win32 greatly appreciate
this decision.

svn path=/trunk/; revision=37195
2011-05-17 00:08:47 +00:00
Michael Tüxen 55f70620c0 Add support for capturing from multiple interfaces.
This patch is basedon work done by Irene Ruengeler.

This feature is considered experimental at the moment.
However, you need to use the -t command line option
to use the feature. When not providing it, the old
method will be used.

svn path=/trunk/; revision=37191
2011-05-16 21:56:12 +00:00
Chris Maynard 36506f2f55 #include <conio.h> when compiling under Windows with DEBUG_DUMPCAP defined.
svn path=/trunk/; revision=37187
2011-05-16 19:56:27 +00:00
Michael Tüxen 37b16db8f2 Use correct variable...
svn path=/trunk/; revision=37180
2011-05-16 16:27:42 +00:00
Michael Tüxen 64297b9be0 Fix compilation on windows (hopefully).
svn path=/trunk/; revision=37179
2011-05-16 15:25:33 +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