From cefea720340320aca86d31d7703eaf6b38c1f45a Mon Sep 17 00:00:00 2001 From: Michael Mann Date: Wed, 27 Apr 2016 22:21:15 -0400 Subject: Separate out the members of tcp_flow_t structure that are only used for sequence analysis. That way they only need to be allocated if analysis is being done. Inspired by https://www.wireshark.org/lists/wireshark-dev/201604/msg00218.html Ping-Bug: 12367 Change-Id: I797e5b305133d85a2a89688109cc3a218d0a9e88 Reviewed-on: https://code.wireshark.org/review/15138 Petri-Dish: Anders Broman Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman --- epan/dissectors/packet-tcp.h | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'epan/dissectors/packet-tcp.h') diff --git a/epan/dissectors/packet-tcp.h b/epan/dissectors/packet-tcp.h index 9b4cec40db..a9b25dadcc 100644 --- a/epan/dissectors/packet-tcp.h +++ b/epan/dissectors/packet-tcp.h @@ -287,14 +287,12 @@ typedef enum { #define MPTCP_CHECKSUM_MASK 0x80 - -typedef struct _tcp_flow_t { - guint8 static_flags; /* true if base seq set */ - guint32 base_seq; /* base seq number (used by relative sequence numbers)*/ -#define TCP_MAX_UNACKED_SEGMENTS 1000 /* The most unacked segments we'll store */ +/* Information in a flow that is only used when tcp_analyze_seq preference + * is enabled, so save the memory when it isn't + */ +typedef struct tcp_analyze_seq_flow_info_t { 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 */ guint32 lastnondupack; /* frame number of last seen non dupack */ @@ -310,6 +308,14 @@ typedef struct _tcp_flow_t { * distinguish between retransmission, * fast retransmissions and outoforder */ + +} tcp_analyze_seq_flow_info_t; + +typedef struct _tcp_flow_t { + guint8 static_flags; /* true if base seq set */ + guint32 base_seq; /* base seq number (used by relative sequence numbers)*/ +#define TCP_MAX_UNACKED_SEGMENTS 1000 /* The most unacked segments we'll store */ + guint32 fin; /* frame number of the final FIN */ guint32 window; /* last seen window */ gint16 win_scale; /* -1 is we don't know, -2 is window scaling is not used */ gint16 scps_capable; /* flow advertised scps capabilities */ @@ -318,6 +324,8 @@ typedef struct _tcp_flow_t { guint32 push_bytes_sent; /* bytes since the last PSH flag */ gboolean push_set_last; /* tracking last time PSH flag was set */ + tcp_analyze_seq_flow_info_t* tcp_analyze_seq_info; + /* This tcp flow/session contains only one single PDU and should * be reassembled until the final FIN segment. */ -- cgit v1.2.3