Commit Graph

66 Commits

Author SHA1 Message Date
John Thacker 0e93070745 follow: Add function for sub stream id to registration
When dissectors register for Follow Stream, have them register a
function for finding the next valid sub stream id for a given
stream and substream id pair. This function is NULL if the dissector
does not use sub stream IDs.

Use this function in follow_stream_dialog to update the sub stream
id widget (and use the absence of the function to disable and hide
the widget.) Use this function in the CLI tap-follow to determine
whether to parse a sub stream id from the command line options.

This removes the dependencies on epan/dissectors from the Qt
follow_stream_dialog, and gets us closer to having dissectors
being able to register for Follow Stream without having to update
anything in the common source code.
2023-01-05 05:04:33 +00:00
John Thacker 2762c64010 follow: Have followers register their stream count function
Instead of having the UI have to know about each type of follow
stream, and how to retrieve its total number of streams, have
each follow type register a function that returns the total
number of stream. (The function can be NULL, for protocols like
SIP that do not use this.)

This gets us closer to making follow stream registration generic.
2022-09-14 00:03:07 +00:00
Roland Knall 2cf938cfa8 tap: Adding flags for tap_packet
This allows flags to be passed by the registering listener
to the collection of information
2022-06-10 05:46:15 +00:00
Nardi Ivan 3cb302f05b HTTP2, QUIC: fix "Follow Stream"
"Follow Stream" functionality assumes that all data in a single packet
belongs to the same stream. That is not true for HTTP2 and QUIC, where
we end up having data from unrelated streams.

Filter out the unwanted data directly in the protocol dissector code with
a custom `tap_handler` (as TCP already does).

Close #16093
2021-09-13 15:13:10 +00:00
Toff 2df04e5bb0 Follow stream: Modify YAML format, add timestamps and peers
Modify YAML output format so it includes information about peers and
absolute timestamps for each packet.
This also adds yaml output to tshark: -z follow,tcp,yaml,X
2021-05-25 08:09:31 +00:00
Guy Harris 20800366dd HTTPS (almost) everywhere.
Change all wireshark.org URLs to use https.

Fix some broken links while we're at it.

Change-Id: I161bf8eeca43b8027605acea666032da86f5ea1c
Reviewed-on: https://code.wireshark.org/review/34089
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-07-26 18:44:40 +00:00
Guy Harris 2d41b15495 Add a "failed" return for tap packet routines.
This allows taps that can fail to report an error and fail; a failed
tap's packet routine won't be called again, so they don't have to keep
track of whether they've failed themselves.

We make the return value from the packet routine an enum.

Don't have a separate type for the per-packet routine for "follow" taps;
they're expected to act like tap packet routines, so just use the type
for tap packet routines.

One tap packet routine returned -1; that's not a valid return value, and
wasn't one before this change (the return value was a boolean), so
presume the intent was "don't redraw".

Another tap routine's early return, without doing any work, returned
TRUE; this is presumably an error (no work done, no need to redraw), so
presumably it should be "don't redraw".

Clean up some white space while we're at it.

Change-Id: Ia7d2b717b2cace4b13c2b886e699aa4d79cc82c8
Reviewed-on: https://code.wireshark.org/review/31283
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-01-01 05:03:42 +00:00
Peter Wu c40c26c04c Follow Stream: ensure linear performance with many packets
Reverse the payload chunks list to achieve a running time of O(n) rather
than O(n²) for insertion of all chunks. Executing a RelWithDebInfo+ASAN
build with `tshark -r chargen-session.pcapng.gz -qz follow,tcp,hex,0`
previously took 11m5s to complete, but now finishes in 16 seconds.

Tested using a capture file with 152k TCP packets (from bug 11777).
Backport note: must update ui/gtk/follow_stream.c too.

Change-Id: Icf70d45f33d4399e53209fb6199d3809608c8d99
Reviewed-on: https://code.wireshark.org/review/28595
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-07-06 07:24:46 +00:00
Dario Lombardo 55c68ee69c epan: use SPDX indentifiers.
Skipping dissectors dir for now.

Change-Id: I717b66bfbc7cc81b83f8c2cbc011fcad643796aa
Reviewed-on: https://code.wireshark.org/review/25694
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-08 19:29:45 +00:00
Michael Mann bc2b135677 Add follow "types" by protocol short name, not filter name
This is what the GUI is expecting.

Change-Id: Ia51800fc7df2f978cf727dc326254b28d01ac9a2
Reviewed-on: https://code.wireshark.org/review/20126
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2017-02-16 07:53:49 +00:00
Michael Mann 9e2366a2e5 Don't duplicate memory for key values when passing into wmem_tree_insert_string.
Change-Id: Ib9d8f23faa7a9f83a975396a1be8f85078223feb
Reviewed-on: https://code.wireshark.org/review/20024
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-02-09 00:19:36 +00:00
Michael Mann c5483f4213 Switch follow (tables) to use wmem_tree_t instead of (sorted) GSList.
Change-Id: Iabf354d2533ae429c002b115c5de33b592019997
Reviewed-on: https://code.wireshark.org/review/20018
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-02-08 14:24:54 +00:00
Dario Lombardo f2c0248c28 follow-stream: add cleanup function.
Change-Id: Icfe7de118bc49da57f537601c2f256e4a028b4e2
Reviewed-on: https://code.wireshark.org/review/19680
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-01-20 04:12:50 +00:00
Michael Mann ab075d3563 Use g_slist_find_custom instead of g_slist_nth when just looking for item in list.
Change-Id: Ida3c5d5826f0ca01a25052a67f1460ff4686008f
Reviewed-on: https://code.wireshark.org/review/19513
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-01-02 23:16:34 +00:00
Michael Mann 66fa31415f tcp: Fix Follow TCP tap data and when its tapped.
Use the model from the 2.0 branch and earlier that only "tapped" the
follow data in a single location. This fixes duplicate data for
reassembled data and handles out-of-order packets.

Bug: 12855
Change-Id: I5268f13e3c08e9271acf026b859de693ad794c94
Reviewed-on: https://code.wireshark.org/review/18368
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2016-11-10 20:48:18 +00:00
Stig Bjørlykke 8498c39ed6 Bring back packet_num in "Follow Stream"
The packet_num was left uninitialized after refactoring "Follow Stream".

Ping-Bug: 11988
Change-Id: Iaea2560c8417503de59ddb0337cd023bcbcbbfee
Reviewed-on: https://code.wireshark.org/review/13872
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2016-02-10 10:09:39 +00:00
Michael Mann c62547b951 Refactor "Follow Stream" functionality on all GUI interfaces.
Create a "registration" system for Follow functionality so most of the work can be abstracted into a dissector and GUI can just be responsible for "display".
This also removes the global variables in follow.c to open up multithreading possibilities.

TCP, UDP and HTTP all have the same "tap interface" for Follow functionality (passing a tvb with byte data to "follow"). SSL still has it's own behavior, so Follow structures have to take that into account.

TShark through the Follow registration now has support for HTTP.

The only thing possibly missing is dynamic menu generation to further reduce explicit knowledge of Follow "type" (and rely on registration)

Bug: 11988
Change-Id: I559d9ee1312406ad0986d4dce9fa67ea2103b339
Reviewed-on: https://code.wireshark.org/review/13161
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-01-12 15:08:18 +00:00
João Valverde f410121cf2 Remove some unnecessary dependencies and cleanup some code
No need for the GTK dependency on dissectors/packet-ipv6.h.

Add the stream_addr typedef in follow.h to make some code simpler.

Change-Id: I1cf906f58734a90263141362f2da33a140f93533
Reviewed-on: https://code.wireshark.org/review/13063
Reviewed-by: João Valverde <j@v6e.pt>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-01-07 01:09:35 +00:00
Michael Mann 57acc227f0 KISS the Follow TCP functionality.
[KISS - Keep It Simple, Stupid]
Convert the Follow TCP functionality to use a tap from the TCP dissector that passes the tvb of the payload.  This makes things A LOT simpler, but relies on the TCP dissector to make all decisions.
The "tap" logic passes tvb data
1. Before calls to process_tcp_payload
2. Before hf_tcp_segment_data fields (that aren't retransmissions or otherwise handled)

Follow up patches will be necessary to clean up all of the supporting "follow" functionality that is now useless.

Bug: 6925
Bug: 9780
Change-Id: I4e7f5d453519be839de39a109bafa899b9987139
Reviewed-on: https://code.wireshark.org/review/13038
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-01-06 13:35:45 +00:00
Michael Mann 1fed5fef9a Add HTTP Follow stream
This automatically detects and decompresses HTTP along a TCP stream through the use of taps.

Bug: 3528
Change-Id: I8ab832d509700d0da8eabf3c3e514d8511c598d3
Reviewed-on: https://code.wireshark.org/review/13009
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-01-03 13:36:18 +00:00
Gerald Combs 86fe2be4dc Use address functions instead of ADDRESS macros in asn1 and epan
Replace CMP_ADDRESS, COPY_ADDRESS, et al with their lower-case
equivalents in the asn1 and epan directories.

Change-Id: I4043b0931d4353d60cffbd829e30269eb8d08cf4
Reviewed-on: https://code.wireshark.org/review/11200
Petri-Dish: Michal Labedzki <michal.labedzki@tieto.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-10-22 11:45:56 +00:00
Alexis La Goutte da8c79dc7c ui/follow: fix The 'find_addr[UDP_STREAM]' variable is assigned values twice successively. Perhaps this is a mistake. Found by PVS Studio (V519)
Yes, there is a mistake !

Change-Id: I6c6c67300c0e05d3ede00be27f675cc8b15bb439
Reviewed-on: https://code.wireshark.org/review/8794
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2015-06-06 17:11:45 +00:00
Guy Harris 44e7ce54ff Remove some apparently-unnecessary includes of emem.h.
Change-Id: Ib7d1b587b439ff21ec6b7f1756ce6ccf25b66f80
Reviewed-on: https://code.wireshark.org/review/6635
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-18 20:19:05 +00:00
Pascal Quantin 0d414e5d7f Add ability to follow UDP stream by index
-z "follow,udp" tshark cli command now supports a stream index
It is now possible to select the UDP stream displayed in Qt GUI (like for TCP)

Change-Id: Ia367f36ea4f60db0fddb997a7e0903c09e172f2d
Reviewed-on: https://code.wireshark.org/review/6083
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2014-12-29 22:17:47 +00:00
Michael Mann 1d598bbff7 Replace ip6_to_str and ip6_guint8_to_str with address_to_str and tvb_ip_to_str.
Change-Id: I1d258923a7a63539ec8456d3e306bca5016a1e4b
Reviewed-on: https://code.wireshark.org/review/6060
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-12-28 14:09:27 +00:00
Michael Mann 3d3f97320b Replace ip_to_str with [ep_]address_to_str and tvb_ip_to_str.
Change-Id: I40d0c8253743183aecef252040b7dd6742ae5c71
Reviewed-on: https://code.wireshark.org/review/5934
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-12-26 21:17:10 +00:00
Bill Meier 23e78cd6bd Add editor modelines; Adjust whitespace as needed.
Change-Id: I3dc57f4c2ca57585103e3b71503ac4c332903e50
Reviewed-on: https://code.wireshark.org/review/4594
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-10-10 14:50:08 +00:00
Pascal Quantin d1d5caaf25 Fix tshark -z follow,tcp stats regression when TCP stream index is > 0
With tshark stats are being configured before the file gets loaded and the number of TCP streams are computed

Bug: 9541
Change-Id: I42c2891124f1781b05967d5f071ad40df2d6d9f5
Reviewed-on: https://code.wireshark.org/review/1598
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2014-05-12 05:20:45 +00:00
Pavel Karneliuk 47d296709d replace comparing sequence numbers of TCP segments with wrap-firendly XX_SEQ macros; replace tabs with 2 whitespace indentations
Change-Id: I8af522cc34863501195d0a79db5c0ab4135246a8
Reviewed-on: https://code.wireshark.org/review/907
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-04-01 15:44:10 +00:00
Pavel Karneliuk 0b5f26b67d fix comparing a sequence number of TCP fragment when its value wraps over uint32_t limit
Change-Id: I0ff939e2d1265a2d9380c83f8f538bb43b0dadf9
Reviewed-on: https://code.wireshark.org/review/875
Reviewed-by: Pavel Karneliuk <pavel_karneliuk@epam.com>
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-04-01 15:42:51 +00:00
Alexis La Goutte 296591399f Remove all $Id$ from top of file
(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-03-04 14:27:33 +00:00
Bill Meier 11b5c15fdb Remove trailing whitespace
Change-Id: I8116f63ff88687c8db3fd6e8e23b22ab2f759af0
Reviewed-on: https://code.wireshark.org/review/385
Reviewed-by: Bill Meier <wmeier@newsguy.com>
Tested-by: Bill Meier <wmeier@newsguy.com>
2014-02-25 20:46:49 +00:00
Guy Harris afc159eaf3 Don't cast away constness.
svn path=/trunk/; revision=54798
2014-01-14 18:19:31 +00:00
Michael Mann 237c580bd7 Replace packet_info->ipproto with packet_info->layers loop to determine TCP/UDP.
svn path=/trunk/; revision=53503
2013-11-22 02:49:00 +00:00
Gerald Combs 22389d7295 Set our IPv6 status when we set addresses.
svn path=/trunk/; revision=53440
2013-11-19 20:30:31 +00:00
Gerald Combs 190bdc32de Add packet information and selection to the Follow Stream dialog.
Collect packet numbers when following streams so that we can correlate
text positions with packets. Add a FollowStreamText class so that we can
track mouse events. Add a hint label that shows the packet under the
cursor along with packet counts and the number of "turns".

Add the packet number to the C array dump. Note that dumping to YAML
might be useful for Scapy users.

svn path=/trunk/; revision=53314
2013-11-14 17:37:40 +00:00
Gerald Combs b0063a025b Highlight selected sequence diagram items.
Create a new dialog each time the user follows a stream. A lot of the
follow code seems to assume one and only one dialog so there are likely
outstanding bugs.

Don't use the global cfile (should we deprecate its usage?). We want to
move closer to multiple documents, not further away.

Clean up after ourselves. Free our payload list and unlink our temp
file. Make a bunch of gchar*s QStrings. Make sure our destructor gets
called and use it.

Make member variable and method names more consistent.

svn path=/trunk/; revision=53306
2013-11-13 22:18:01 +00:00
Pascal Quantin 7652baa0c6 From doh via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9112 :
Fix incorrect "bytes missing in capture file" in "check_fragments"

svn path=/trunk/; revision=53257
2013-11-11 20:04:27 +00:00
Jakub Zawadzki 1899903f69 Include <epan/to_str.h> only when needed.
svn path=/trunk/; revision=53189
2013-11-09 13:41:10 +00:00
Jörg Mayer 029e258225 Explicitly include emem.h where it is needed
svn path=/trunk/; revision=51997
2013-09-13 08:16:50 +00:00
Guy Harris 5d87a8c461 WS_DLL_PUBLIC is now always WS_DLL_PUBLIC_NOEXTERN with "extern" added;
just define WS_DLL_PUBLIC_NOEXTERN inside the ifdefs, and define
WS_DLL_PUBLIC as WS_DLL_PUBLIC_NOEXTERN followed by "extern".

Then rename WS_DLL_PUBLIC_NOEXTERN to WS_DLL_PUBLIC_DEF, to clarify that
it's what should be used for definitions; at least on Windows, you
*have* to use it when declaring arrays without a size, and, whilst you
might be able to use WS_DLL_PUBLIC for definitions of functions and
perhaps data definitions other than no-size arrays, it might be clearer
to rename WS_DLL_PUBLIC to WS_DLL_PUBLIC_DECL and use it only for
declarations.

svn path=/trunk/; revision=50334
2013-07-03 01:43:39 +00:00
Bill Meier 0df5a9390d From beroset:
remove C++ incompatibilities
 https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8416 attachment #10397

svn path=/trunk/; revision=48438
2013-03-20 01:18:10 +00:00
Balint Reczey 1ebdb2e521 Export libwireshark symbols using WS_DLL_PUBLIC define
Also remove old WS_VAR_IMPORT define and related Makefile magic
everywhere in the project.

svn path=/trunk/; revision=47992
2013-03-01 23:53:11 +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
Bill Meier 7cd0417af5 Fix numerous instances of a variable/parameter name "shadowing" a library function name;
(At least some (gcc ?) compilers give a "shadow" warning for these).

svn path=/trunk/; revision=46402
2012-12-05 15:56:36 +00:00
Jeff Morriss 3729335973 We always HAVE_CONFIG_H so don't bother checking whether we have it or not.
svn path=/trunk/; revision=45016
2012-09-20 01:48:30 +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
Anders Broman 8d4f6fc794 From QA Cafe:
Add support to follow UDP and TCP streams like wireshark does. UDP streams are
selected with IP address/port pairs. TCP stream are selected with either the
stream index or IP address/port pairs.

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

svn path=/trunk/; revision=40852
2012-02-05 10:39:12 +00:00
Sake Blok 796564ed90 Repair "Follow TCP Stream" which got broken by my change in SVN 38056
Mental note: Try to not do half work ;-)


svn path=/trunk/; revision=38065
2011-07-17 11:08:02 +00:00
Bill Meier 9d663d7081 Fix various gcc -Wshadow warnings.
svn path=/trunk/; revision=31720
2010-01-28 18:45:46 +00:00