summaryrefslogtreecommitdiff
path: root/capture_sync.c
AgeCommit message (Collapse)AuthorFilesLines
2015-11-17Create C handles for pipes before running dumpcap.Guy Harris1-39/+90
If the C handles can't be created, there's no point in running dumpcap. Catch some more possible _open_osfhandle() failures while we're at it. Change-Id: I5b805552630034a1eaea2a6d2bfe6039cd6d7727 Reviewed-on: https://code.wireshark.org/review/11904 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-16Catch failure of _open_osfhandle().Guy Harris1-0/+24
This may at least prevent the crash in bug 11702, by not returning "success" with bogus file handles of -1, if the opens fail due to leaks chewing up all the available slots. More investigation needs to be done to see why we're leaking. Change-Id: Iaa0fdac415ea1047255d64fa8597529ad31d63d1 Reviewed-on: https://code.wireshark.org/review/11889 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-07-22Fix retrieval of data link type supported by remote interfaces with ↵Pascal Quantin1-1/+5
authentication Make use of -A parameter when querying data link types supported by a given interface with dumpcap. Ensure to pass the authentication parameters configured for a remote interface when calling capture_get_if_capabilities() Bug: 11366 Change-Id: I4efea615084a82108e4a12a64e8c46817f30a5c6 Reviewed-on: https://code.wireshark.org/review/9715 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2015-04-06Keep a captured-packet count in a capture_session and use that.Guy Harris1-0/+2
Have the count in a cfile_t structure always reflect the actual number of packets that have been read from the file, rather than, when doing a non-update-list-of-packets-in-real-time capture, falsely increasing the count in the cfile_t to reflect the number of packets captured but not yet read. Have the status bar base its captured-packet count on the count in the capture_session structure, and base the "sorry, no packets were captured" message on the count in the capture_session structure, as we're no longer using the count in the cfile_t structure to count anything in the process of a non-update-list-of-packets-in-real-time capture. That way, we preserve the invariant that the "frames" member of a cfile_t will be non-null if the "count" member is non-zero, fixing bug 6217. It also means we can get rid of cf_set_packet_count(), as we only set the count in the capture-file-reading code. Bug: 6217 Change-Id: I72c0e2c07c30782bad777995370b7c19e1460cc2 Reviewed-on: https://code.wireshark.org/review/7950 Reviewed-by: Guy Harris <guy@alum.mit.edu> (cherry picked from commit 1871fb2b0d9628707661776cfa1b35f210e5e58e) Reviewed-on: https://code.wireshark.org/review/7951
2014-05-23Revert "Allow wtap_read() and wtap_seek_read() to return non-packet records."Guy Harris1-1/+1
This reverts commit c0c480d08c175eed4524ea9e73ec86298f468cf4. A better way to do this is to have the record type be part of struct wtap_pkthdr; that keeps the metadata for the record together and requires fewer API changes. That is in-progress. Change-Id: Ic558f163a48e2c6d0df7f55e81a35a5e24b53bc6 Reviewed-on: https://code.wireshark.org/review/1741 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-05-23Allow wtap_read() and wtap_seek_read() to return non-packet records.Guy Harris1-1/+1
This is the first step towards implementing the mechanisms requestd in bug 8590; currently, we don't return any records other than packet records from libwiretap, and just ignore non-packet records in the rest of Wireshark, but this at least gets the ball rolling. Change-Id: I34a45b54dd361f69fdad1a758d8ca4f42d67d574 Reviewed-on: https://code.wireshark.org/review/1736 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-03-04Remove all $Id$ from top of fileAlexis La Goutte1-2/+0
(Using sed : sed -i '/^ \* \$Id\$/,+1 d') Fix manually some typo (in export_object_dicom.c and crc16-plain.c) Change-Id: I4c1ae68d1c4afeace8cb195b53c715cf9e1227a8 Reviewed-on: https://code.wireshark.org/review/497 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-02-26Fix capture_sync: Assigned value is garbage or undefined (clang analyzer)Hadriel Kaplan1-3/+3
I'm not 100% positive this fix is the right way to handle this condition, but it seems the safest way without changing a lot of other code. Change-Id: Icaa8d6f38bc03177162f046d1e7ca55d87bad6a6 Reviewed-on: https://code.wireshark.org/review/373 Reviewed-by: Evan Huus <eapache@gmail.com> Reviewed-by: Balint Reczey <balint@balintreczey.hu> Tested-by: Balint Reczey <balint@balintreczey.hu>
2014-01-19coverity 281214Martin Kaiser1-6/+8
check the return value of strtok() before passing it to strtoul() (can't be triggered in practice as dumpcap never sends a NULL string) svn path=/trunk/; revision=54847
2013-12-03When including <epan/prefs.h> don't force inclusion of <epan/uat.h>Jakub Zawadzki1-0/+1
svn path=/trunk/; revision=53769
2013-11-17Move the epan/filesystem.c routines to wsutil; they're not specific toGuy Harris1-1/+1
packet dissection, they're specific to the entire Wireshark suite of programs. svn path=/trunk/; revision=53377
2013-10-11Replace a question in a comment with a better explanation (that answers the ↵Jeff Morriss1-3/+2
question). svn path=/trunk/; revision=52550
2013-08-29Handle the 2GiB boundary case of the max filesize autostop condition ↵Chris Maynard1-16/+16
properly so that we avoid overflow conditions and so that we ensure we don't capture more than 2GiB. Also, document the max filesize autostop value of 2GIB as well as indicating that it's truly GiB and not GB. This fixes the problem reported on ask: http://ask.wireshark.org/questions/23891/wireshark-wont-run-with-multiple-capture-files #BACKPORT(1.10) ... not sure about 1.8? svn path=/trunk/; revision=51576
2013-08-24Add a routine to create a dummy signal pipe and pass it to dumpcap whenGerald Combs1-1/+27
gathering interface statistics. This should help dumpcap exit properly if its parent process crashes or is killed. svn path=/trunk/; revision=51502
2013-08-01pass --capture-comment from tshark to dumpcapMartin Kaiser1-0/+5
handle error cases in tshark svn path=/trunk/; revision=51094
2013-07-15Move report_err.{h,c} from epan into wsutil: there's nothing epan-specific ↵Jeff Morriss1-1/+1
there and moving it avoids having to recompile the file for use in editcap and capinfos (which don't link against libwireshark). svn path=/trunk/; revision=50598
2013-06-27MS: list interfaces!Luis Ontanon1-1/+17
svn path=/trunk/; revision=50195
2013-06-27get main_window_update out of the way... pass an update_cb to the ↵Luis Ontanon1-17/+17
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-04From Mike Garratt:Anders Broman1-2/+39
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-05-23No need for those arguments to be pointers to arrays of const pointers,Guy Harris1-15/+15
especially given that we end up freeing what all of those pointers point to. svn path=/trunk/; revision=49542
2013-05-22Fix the Windows side to look for the signal pipe stuff in cap_session.Guy Harris1-3/+3
svn path=/trunk/; revision=49497
2013-05-22Pull the capture-session state information out of capture_opts and putGuy Harris1-32/+47
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-03-25From Michal Labedzki: linktype_val_to_name() returns a string, not aGuy Harris1-3/+1
number, and that string is what's appropriate for the -y command-line argument, so just directly pass it to sync_pipe_add_arg(), and get rid of the now-unnecessary sdlt variable. svn path=/trunk/; revision=48546
2013-03-05it seems that g_free() needs a gpointerMartin Kaiser1-3/+3
using a gconstpointer creates a warning capture_sync.c: In function ‘sync_pipe_open_command’: capture_sync.c:823:13: error: passing argument 1 of ‘g_free’ discards ‘const’ qualifier from pointer target type [-Werror] svn path=/trunk/; revision=48096
2013-03-05Use explicit casts.Anders Broman1-7/+7
svn path=/trunk/; revision=48088
2013-02-28Add a #define for the default capture buffer size and use it.Jeff Morriss1-2/+1
svn path=/trunk/; revision=47942
2013-02-27Increase the default buffer size to 2MB.Anders Broman1-1/+2
svn path=/trunk/; revision=47920
2013-01-14Declare count as ssize_t instead of size_t, since read(), and thus ↵Chris Maynard1-1/+1
ws_read(), can return a negative number. If that were to happen, then assigning the return value to an unsigned variable and then comparing that variable against 0 will yield incorrect/unintended results. Fixes Coverity CID 761910: Negative array index write. svn path=/trunk/; revision=47069
2012-12-29Add a few consts to fix some compiler (GCC) errors.Bill Meier1-1/+1
svn path=/trunk/; revision=46849
2012-12-26Make sure we don't sign-extend the (binary) bytes of the message length.Guy Harris1-1/+1
svn path=/trunk/; revision=46792
2012-12-26Use casts rather than changing the prototype of pipe_convert_header.Evan Huus1-9/+9
It has to be unsigned or else certain headers get misread due to signedness. svn path=/trunk/; revision=46790
2012-12-26Squash some sign-conversion warnings that g++ picks up but gcc doesEvan Huus1-3/+3
not. QtShark now builds warning-free (for me at least). svn path=/trunk/; revision=46786
2012-12-26Fix a bunch of warnings.Guy Harris1-22/+23
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-12Make the "-g" argument to tshark actually work (by passing it to dumpcap).Jeff Morriss1-0/+4
svn path=/trunk/; revision=46515
2012-12-05Fix numerous instances of a variable/parameter name "shadowing" a library ↵Bill Meier1-3/+3
function name; (At least some (gcc ?) compilers give a "shadow" warning for these). svn path=/trunk/; revision=46402
2012-11-05From Bill Parker:Anders Broman1-0/+4
code fails to check/test return value from select() https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7861 svn path=/trunk/; revision=45917
2012-10-11Make sure sync_interface_stats_close calls sync_pipe_kill on allGerald Combs1-0/+7
platforms. This ham-fistedly fixes a delay when moving from the "Capture" item to the "Open" and "Learn" items on the welcome screen in the Qt version. svn path=/trunk/; revision=45475
2012-10-08Add a cast.Gerald Combs1-1/+1
svn path=/trunk/; revision=45407
2012-10-08Log the time we spend waiting for the capture child to exit.Gerald Combs1-1/+13
Add breadcrumbs so that we can switch from g_get_current_time to g_get_real_time when our minimum GLib version is >= 2.28. svn path=/trunk/; revision=45399
2012-09-20We always HAVE_CONFIG_H so don't bother checking whether we have it or not.Jeff Morriss1-3/+1
svn path=/trunk/; revision=45015
2012-08-24Revert r44644 and 44645. g_source_*, g_timeout_, and g_io_* all dependGerald Combs1-1/+0
on the GLib main loop which isn't portable (unless you want to want to manage the main loop yourself). svn path=/trunk/; revision=44655
2012-08-23Move the pipe input routines to the common UI directory.Gerald Combs1-0/+1
svn path=/trunk/; revision=44644
2012-06-28Update Free Software Foundation address.Jakub Zawadzki1-1/+1
(COPYING will be updated in next commit) svn path=/trunk/; revision=43536
2012-06-20Comment back in the body of tb80211_do_set_channel to avoid warnings aboutJörg Mayer1-0/+47
unused parameters. Add the missing functions by applying the skipped patches to capture_sync.[hc] svn path=/trunk/; revision=43414
2012-06-09Undo an accidental portion of the last commit.Chris Maynard1-1/+1
svn path=/trunk/; revision=43173
2012-06-09Be sure to specify FORMAT_MESSAGE_IGNORE_INSERTS in the dwFlags arg to all ↵Chris Maynard1-3/+3
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=43172
2012-04-13From Evan Huus: fix memory leak. Fixes bug 7081.Guy Harris1-0/+3
svn path=/trunk/; revision=42057
2012-03-11If the length is bogus in a message received from the sync pipe, dumpGuy Harris1-2/+3
out all 4 bytes we read, to provide more information about the message that was sent so it's easier to see if something was spewing extra output to the standard output or error in the child. svn path=/trunk/; revision=41489
2012-01-25Third try. This time pipes and stdin are supported and theMichael Tüxen1-0/+2
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-24We need a 3rd try. (After learning how to run the testuite on Windows locally).Michael Tüxen1-2/+0
svn path=/trunk/; revision=40695