Commit Graph

97 Commits

Author SHA1 Message Date
Sake Blok 2ef69333db When doing TCP_SEQ analysis, if the packet is a SYN, then it's
not a lost packet but the tcp ports are being reused. This is often 
seen in load-balanced environments where client ports are preserved 
on the server-side.

We only want to report port reusage once, so the SYN/ACK is excluded 
from TCP_SEQ analysis.

svn path=/trunk/; revision=22762
2007-08-31 15:06:27 +00:00
Jeff Morriss 3f2a49f17c When detecting fast retransmissions or out of order packets, use a 64-bit variable to store the time delta (instead of a 32-bit one). We're counting nanoseconds here, so this allows us to accurately detect differences greater than 4.294 seconds.
svn path=/trunk/; revision=22609
2007-08-23 21:38:15 +00:00
Richard van der Hoff 62569354fe From yin sun <sunyin51@gmail.com> / bug 1722:
When a subdissector on top of TCP set ... DESEGMENT_UNTIL_FIN ... then
the subdissector should receive the whole reassembled TCP stream in tvb.
But the bug is it is missing the last payload from the FIN packet.


svn path=/trunk/; revision=22578
2007-08-21 22:15:17 +00:00
Ronnie Sahlberg 654b6075af bug 1550
add a fix for ack/seq tracking when the tcp is broken and sends a 
non-zero ack field for SYN packets.

add a warning to the dissect pane that illustrates that these are broken 
packets
 


svn path=/trunk/; revision=22267
2007-07-07 22:27:22 +00:00
Michael Tüxen cc8ed4a3c4 From Michael Scharf: Add support for TCP Quickstart.
svn path=/trunk/; revision=22041
2007-06-04 23:27:12 +00:00
Jeff Morriss 00cf2ec89c Frame numbers are unsigned, print them as such
svn path=/trunk/; revision=21443
2007-04-16 04:52:51 +00:00
Tomas Kukosa 155b04eda3 export some desegmentation functions from TCP dissector to reuse them in SSL/TLS desegmentation
svn path=/trunk/; revision=21346
2007-04-06 07:01:01 +00:00
Sebastien Tandel 1382c71a43 First step of TCP dissector refactoring.
I have a dream today.
I have a dream that one day the TCP dissector shall become human-readable. :)

svn path=/trunk/; revision=21297
2007-04-01 16:04:04 +00:00
Sebastien Tandel 3af0bc1b22 From Sake Blok :
Fix for Bug 1136 (TCP Checksum Validation)

TCP cksum 0xffff should not appear in TCP headers. RFC 1624 explains that it
can be generated by a (not-so-good) algorithm for incremental updates to the
tcp-checksum.
New behavior of wireshark when having cksum == 0xffff :
  - use "Checksum: 0xffff [should be 0x0000 (See RFC 1624)]" in the
    packet-detail pane
  - set tcp.checksum_good to FALSE (just like checksum-offload packets)
  - set tcp.checksum_bad to FALSE (just like checksum-offload packets)
  - Generate an expert warning: "TCP Checksum 0xffff instead of 0x0000 (See RFC 1624)"
  - add "[TCP CHECKSUM 0xFFFF]" instead of "[TCP CHECKSUM BAD]" to COL_INFO

svn path=/trunk/; revision=21295
2007-04-01 15:42:08 +00:00
Ronnie Sahlberg d5d5159b6d From Sebastien Tandel
fixes for various compiler warnings

svn path=/trunk/; revision=21210
2007-03-26 11:06:26 +00:00
Ulf Lamping 411249419d fix some more warnings (type casts)
svn path=/trunk/; revision=21141
2007-03-23 00:51:21 +00:00
Ronnie Sahlberg 78ad94c00d Enhance tcp reassembly of the flavor "reassemble one more segment" work properly
for the quite unusual case when we need to do this multiple times in a row for the same PDU.

This fixes the issue reported by Xiaoguang Liu on the mailinglist
where wireshark did not manage to properly reassemble a big HTTP header spanning several (more than two) tcp segments.



svn path=/trunk/; revision=20179
2006-12-20 11:57:31 +00:00
Jeff Morriss 12bf9032cf From Sebastien Tandel: if the TCP dissector is dissecting a fragment of a packet in an ICMP message, put the TCP sequence number in the tree.
svn path=/trunk/; revision=20140
2006-12-16 15:17:43 +00:00
Jaap Keuter 45aa24f1ec Correct comments and examples on get_pdu_len().
svn path=/trunk/; revision=19949
2006-11-21 14:18:46 +00:00
Ronnie Sahlberg 14810dd30c fix so that tcp.pdu.time works again.
it broken in one of the previous bugfixes to tcp

add a function to print an emem tree to the console for easier emem tree debugging


svn path=/trunk/; revision=19877
2006-11-11 22:39:25 +00:00
Ronnie Sahlberg 5a0ba5b0c7 fix for bug 1200
there used to be a bug in tcp reassembly that even if the dissector only asked for x more bytes from the next segment   the entire segment would still be added to reassembly.
this caused some issues when there was a new multisegment pdu that started at the end of the segment   but this bug was fixed when tcp reassembly was refactored semi-recently.


there was also another "bug" in the http reassembly that it would only ask for one more byte at a time when doing reassembly.
this did work well however when we still had the bug in tcp reassembly   but made wireshark become very very very slow once this tcp bug was fixed  since it is very very very slow to reassemble a huge http pdu just one byte at a time.


this patch adds partial support (what we need for http   which does not use tcp_dissect_pdus() ) for the desegmentation flag : DESEGMENT_ONE_MORE_SEGMENT and also to the http dissector   so that reassembly of http headers spanning multiple semgents now become fast again



svn path=/trunk/; revision=19859
2006-11-07 13:19:31 +00:00
Ronnie Sahlberg 2d1bb39121 change the signature for the get_pdu_len() function pointer passed to tcp_dissect_pdus() to also include a packet_info pointer.
there are many reasons why some protocols actually need to be able to access the pinfo structure while determining the pdu size



svn path=/trunk/; revision=19751
2006-10-31 09:29:07 +00:00
Ulf Lamping 68187697a0 make the checksum fields visible for TCP and UDP
svn path=/trunk/; revision=19727
2006-10-29 13:53:07 +00:00
Guy Harris 8487e57880 The TCP options data is a byte array, not a character string.
svn path=/trunk/; revision=19723
2006-10-29 00:06:02 +00:00
Jaap Keuter 590251d66e From Pierre Juhen:
I would like to have a tcp.options field with a name for PMDL output;
I include a patch to packet-tcp.c to provide that.

svn path=/trunk/; revision=19721
2006-10-28 21:32:38 +00:00
Ronnie Sahlberg b9ee517437 by popular request
reintroducing the ACK_RTT   measurement how long it took to ACK a data segment



Gerald   this is a trivially correct patch   can you apply it to the release branch?



svn path=/trunk/; revision=19669
2006-10-24 07:27:32 +00:00
Ronnie Sahlberg cd02551610 add a tcp_tree field to packet_info so that we can access the tree from tcp_dissect_pdus() (and others if need be)
in tcp_dissect_pdus()  add a field ( tcp.pdu.size ) to the tree that displays the pdu size.



svn path=/trunk/; revision=19655
2006-10-22 00:21:40 +00:00
Tomas Kukosa e1e18ea393 update Timestamps Option labels in accordance with RFC1323
svn path=/trunk/; revision=19570
2006-10-17 06:01:54 +00:00
Ronnie Sahlberg d517c305b1 fix for bug 1045
windows in SYN and SYN+ACK packets are not scaled so dont apply window scaling to them when displaying them in the tree


svn path=/trunk/; revision=19186
2006-09-10 14:34:57 +00:00
Ronnie Sahlberg 6d3c94a53a implement support to reassemble tcp sessions until the end of the session (FIN)
add required code to the http (and others) code in req_resp_hdrs.c to signal to tcp
when it wants a session to be reassembled to the FIN.

This is currently done for all HTTP packets where we have a Content-type in the header but no content-length.




svn path=/trunk/; revision=19185
2006-09-10 14:03:08 +00:00
Ulf Lamping ac76ad1c64 tweak some expert infos so they better work with the composite dialog (e.g. remove some minor details)
svn path=/trunk/; revision=19176
2006-09-07 20:35:26 +00:00
Ulf Lamping a0dbf3d7ac mark the "short segment" message field as generated and add an expert_info to it
svn path=/trunk/; revision=19106
2006-08-31 23:00:44 +00:00
Tomas Kukosa c5374442cf flags have only 1 byte
svn path=/trunk/; revision=19086
2006-08-30 10:03:50 +00:00
Ronnie Sahlberg 834647384c get rid of a rotating buffer
svn path=/trunk/; revision=18973
2006-08-21 13:05:18 +00:00
Ronnie Sahlberg 0adb40dbc0 we have to search for multisegments starting PRIOR to the start of the current semgent or elsae it will break for the case when one multisegment ends in this segment there are a few smaller ones completely within this segment and then another segment starts that spans across future segments.
svn path=/trunk/; revision=18964
2006-08-20 05:18:10 +00:00
Ulf Lamping 3ec210b0d1 Don't mark a TCP packet as a "Duplicate ACK" if the flags don't have the ACK flag set (IMHO it's not an ACK in that case). This happens sometimes between FIN and RST packets.
Ronnie, could you check if this change is ok?

svn path=/trunk/; revision=18930
2006-08-16 20:52:51 +00:00
Ronnie Sahlberg 8ce8e719e0 rename some structures and defines from the se_tree to the emem_tree prefix
svn path=/trunk/; revision=18894
2006-08-14 08:29:29 +00:00
Ulf Lamping 974baa0485 slightly extend information about TCP checksum offloading problems (still far from being a real good way to handle this)
svn path=/trunk/; revision=18436
2006-06-12 19:27:05 +00:00
Ronnie Sahlberg 697974ae8d improve the tcp retransmission vs outoforder heuristics to address the issue in PeterBruno's email of may18
dont reply to mailinglist that issue has been resolved since "ethereal" is still in limbo


svn path=/trunk/; revision=18263
2006-05-31 11:15:45 +00:00
Ronnie Sahlberg feab79e328 change a whole bunch of ethereal into wireshark
svn path=/trunk/; revision=18196
2006-05-21 04:49:01 +00:00
Guy Harris 56728f40ed Have "pdu_store_sequencenumber_of_next_pdu()" return the newly-allocated
"struct tcp_multisegment_pdu"; that lets it be used in one case where
the code in it was duplicated.

Make "desegment_tcp()" loop rather than recursing - not all compilers
will necessarily recognize the tail recursion.

Catch heuristic dissectors that reject a packet but also request
(whether deliberately or accidentally) that more data be added.

svn path=/trunk/; revision=18050
2006-05-01 02:32:16 +00:00
Ronnie Sahlberg 0c1d1e600f tcp reassembly updates
use tcp_multisegment_pdu and se_tree_lookup32_le()   to track pdu boundaries for tcp reassembly just as this structure is used for the same purpose when reassembly is not enabled.

get rid of a hashtable and two memchunks we no longer need
tcp_segment_table    tcp_segment_key_chunk and   tcp_segment_address_chunk


This makes tcp reassembly work for out-of-order segments   as well as when reassembly completes in one segment and when the tail of the segment contains the head of the next pdu  which we did not handle before.


tcp reassembly should be much better and efficient now    modulo introduced regressions.




svn path=/trunk/; revision=18046
2006-04-30 10:27:55 +00:00
Ronnie Sahlberg 703869d3d6 tcp analysis updates to prepare for later tcp reassembly updates
now that we have se_tree_lookup32_le   we can do the tracking of pdu boundaries much more efficiently.

track pdu boundaries by a new  tcp_multisegment_pdu  structure that is indexed by sequence numbers and let this structure replace the older tcp_next_pdu structure.

with se_tree_lookup32_le  we no longer need to track segment by segment and can get rid of the two hash tables
tcp_pdu_tracking_table
tcp_pdu_skipping_table
Neither do we need the tree   tcp_pdu_time_table anymore so that one is gone as well.

remove various other functions that are no longer needed due to removing the structure and the tables/tree


this part of the code shoul;d be much more readable now   and also a bit faster



svn path=/trunk/; revision=18024
2006-04-28 09:44:02 +00:00
Ronnie Sahlberg f331077a60 waste a couple of bytes per tcp conversation and make the tree for acked_packets (i.e. packets that have interesting tcp properties such as being retransmissions etc) hang off the per conversation tcpd struct instead of being global.
while this should improve performance by unmeasurably little it does have the sideeffect that once we finish the rewrite   tcp analysis might actually work and work well even for tcp over tcp tunnelling. 

this also means that if you include packet-tcp.h   you also need to include emem.h .




svn path=/trunk/; revision=17681
2006-03-20 10:52:53 +00:00
Ronnie Sahlberg cdf3a2b322 if tcp checksum validation is enabled
and if the checksum is wrong
and if the checksum field is 0x0000

mark the packet as [Checksum Offloaded] and still allow reassembly of
tcp segmetns


since it is most likely just a tco checksum offload engine and not a real checksum error



svn path=/trunk/; revision=17612
2006-03-13 20:50:50 +00:00
Ronnie Sahlberg 27de4cfd39 give se_trees names so that it is easier to debug and to log how often certain trees are accessed
svn path=/trunk/; revision=17587
2006-03-11 13:02:41 +00:00
Gerald Combs f99ad2e895 Handle a null pointer. Fixes bugs 778 and 787.
svn path=/trunk/; revision=17483
2006-03-06 19:49:34 +00:00
Ronnie Sahlberg 8ed89ff326 convert another hashtable for tcp into se_tree
svn path=/trunk/; revision=17470
2006-03-05 05:36:46 +00:00
Ronnie Sahlberg 0881211a12 initial implementation of binary tree support with se allocation scope
this is to test out a basic implementation of binary trees and the api required for the helpers


svn path=/trunk/; revision=17467
2006-03-05 04:01:34 +00:00
Ronnie Sahlberg 2808928c90 make the tcp_acked struct a pointer from the tcpd struct since we might need it hanging around.
only call subdissectors for packets that are NOT keepalives nor zerowindowprobes.


keepalives only contain garbage anyway
and zerowindowproes just contain a single byte of incomplete data so whats the point trying to dissect it further.



svn path=/trunk/; revision=17443
2006-03-02 09:33:49 +00:00
Ronnie Sahlberg f535b4cba1 tcp analysis
RST segments should not be checked for and not marked as
PREVIOUS_SEGMENT_LOST


svn path=/trunk/; revision=17246
2006-02-10 22:24:21 +00:00
Ronnie Sahlberg 63d4b418a6 make sure we actually get the tcpd structure pointer before we pass it as a parameter to a subroutine to dereference it.
fixes bug 719




svn path=/trunk/; revision=17133
2006-01-31 10:27:30 +00:00
Gerald Combs edabe5ed93 Make sure a pointer isn't null before we try to use it. Fixes a current
Buildbot failure.

svn path=/trunk/; revision=17129
2006-01-30 23:29:09 +00:00
Ronnie Sahlberg dab77d86f1 rewrite of the tcp sequence number analysis code to hopefully make it cleaner and easier to maintain and extend.
i have tested it with many captures   but this used to be fragile and delicate code  so there might be some regressions that will need to be addressed once identified.





svn path=/trunk/; revision=17107
2006-01-26 22:50:16 +00:00
Jörg Mayer 1900bf87fc done:
packet-ntp.c: Rather confused and incorrect use of g_snprintf return value
packet-pim.c: whitespace change
packet-icmpv6.c: g_snprintf takes trailing \0 into account, fix off by 1 error
packet-clnp.c: Fix incorrect use of g_snprintf return value
packet-isakmp.c: g_snprintf takes trailing \0 into account
packet-tr.c: Fix incorrect use of g_snprintf return value
packet-radius.c: Fix incorrect use of g_snprintf return value
packet-radius.h: constify a string variable
packet-ldap.c: The return value isn't needed, so don't use it incorrectly
packet-tcp.c: Fix incorrect use of g_snprintf return value
packet-windows-common.c: Remove unneeded DISSECTOR_ASSERT
packet-smb-sidsnooping.c: g_snprintf takes trailing \0 into account
packet-pvfs2.c: g_snprintf takes trailing \0 into account
packet-ptp.c: Remove #include snprintf
packet-ppp.c: Fix incorrect use of g_snprintf return value
packet-ospf.c: Fix incorrect use of g_snprintf return value
packet-mip6.c: snprintf -> g_snprintf
packet-bootp.c: Remove a commented out bad use of g_snprintf
packet-ber.c: snprintf -> g_snprintf, g_snprintf takes trailing \0 into account

2do:

     52 packet-ieee80211.c: 2DO
      2 packet-nfs.c: 2DO - too many side effects
     33 packet-bgp.c: 2DO
     18 packet-dns.c: 2DO
     14 packet-dcm.c: 2DO
     13 packet-x11.c: 2DO
     11 packet-kerberos.c: 2DO
     10 packet-diameter.c: 2DO
      9 packet-snmp.c: 2DO
      9 packet-pgm.c: 2DO
      7 packet-nbns.c: 2DO
      6 packet-fcswils.c: 2DO
      5 packet-wccp.c: 2DO
      5 packet-cops.c: 2DO
      4 packet-wtp.c: 2DO


svn path=/trunk/; revision=17038
2006-01-16 07:59:44 +00:00