diff options
author | Jeff Morriss <jeff.morriss.ws@gmail.com> | 2015-10-12 18:04:01 -0400 |
---|---|---|
committer | Jeff Morriss <jeff.morriss.ws@gmail.com> | 2015-10-14 13:44:06 +0000 |
commit | 58ef8e0be53353d87b91afad1c37120822c2c69e (patch) | |
tree | 2129b7b0b001ff2c7930c4711511c952407133a7 | |
parent | 8c824ba671b6ea0b1a90cde057c67035e85390b5 (diff) | |
download | wireshark-58ef8e0be53353d87b91afad1c37120822c2c69e.tar.gz |
TCP: only store up to 1000 unacked segments (in each direction).
If we're seeing only one side of a conversation (we're not seeing any ACKs)
then things get really, really slow as the number of unacked segments grows.
1000 is, of course, an arbitrary limit.
Bug: 11589
Change-Id: I42652965b736da50122c722e6ac386c4d481e57f
Reviewed-on: https://code.wireshark.org/review/10971
Petri-Dish: Jeff Morriss <jeff.morriss.ws@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
(cherry picked from commit 065c4646a631690896c9b45cadc4cc2d012255d8)
Reviewed-on: https://code.wireshark.org/review/11013
Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
-rw-r--r-- | epan/dissectors/packet-tcp.c | 8 | ||||
-rw-r--r-- | epan/dissectors/packet-tcp.h | 4 |
2 files changed, 9 insertions, 3 deletions
diff --git a/epan/dissectors/packet-tcp.c b/epan/dissectors/packet-tcp.c index 8831e07996..8e3473d769 100644 --- a/epan/dissectors/packet-tcp.c +++ b/epan/dissectors/packet-tcp.c @@ -1247,11 +1247,14 @@ finished_fwd: finished_checking_retransmission_type: nextseq = seq+seglen; - if (seglen || flags&(TH_SYN|TH_FIN)) { - /* add this new sequence number to the fwd list */ + if ((seglen || flags&(TH_SYN|TH_FIN)) && tcpd->fwd->segment_count < TCP_MAX_UNACKED_SEGMENTS) { + /* Add this new sequence number to the fwd list. But only if there + * aren't "too many" unacked segements (e.g., we're not seeing the ACKs). + */ ual = wmem_new(wmem_file_scope(), tcp_unacked_t); ual->next=tcpd->fwd->segments; tcpd->fwd->segments=ual; + tcpd->fwd->segment_count++; ual->frame=pinfo->fd->num; ual->seq=seq; ual->ts=pinfo->fd->abs_ts; @@ -1354,6 +1357,7 @@ finished_checking_retransmission_type: } wmem_free(wmem_file_scope(), ual); ual = tmpual; + tcpd->rev->segment_count--; } /* how many bytes of data are there in flight after this frame diff --git a/epan/dissectors/packet-tcp.h b/epan/dissectors/packet-tcp.h index c753474653..8103c32aa8 100644 --- a/epan/dissectors/packet-tcp.h +++ b/epan/dissectors/packet-tcp.h @@ -153,7 +153,9 @@ struct tcp_multisegment_pdu { typedef struct _tcp_flow_t { gboolean base_seq_set; /* true if base seq set */ guint32 base_seq; /* base seq number (used by relative sequence numbers)*/ - tcp_unacked_t *segments; +#define TCP_MAX_UNACKED_SEGMENTS 1000 /* The most unacked segments we'll store */ + tcp_unacked_t *segments;/* List of segments for which we haven't seen an ACK */ + guint16 segment_count; /* How many unacked segments we're currently storing */ guint32 fin; /* frame number of the final FIN */ guint32 lastack; /* last seen ack */ nstime_t lastacktime; /* Time of the last ack packet */ |