summaryrefslogtreecommitdiff
path: root/epan
diff options
context:
space:
mode:
authorMatthieu Coudron <mattator@gmail.com>2014-11-18 19:33:53 +0100
committerEvan Huus <eapache@gmail.com>2014-11-25 02:47:20 +0000
commit4f8a6ec8669fe0b9b2ac642ab99cc853498e4721 (patch)
tree730a13723ca11da4c3d569885113ef21903365fa /epan
parentd5713e2040fc47a52651c09f1e373b531d3d370e (diff)
downloadwireshark-4f8a6ec8669fe0b9b2ac642ab99cc853498e4721.tar.gz
TCP: fix wrongly set base_seq when ISN is 0 and tcp_relative_seq is
enabled tcp_analysis::base_seq could be set several times when the TCP ISN was set to 0, thus inducing some undesired wraps such as 0-1 Bug: 10713 Change-Id: I69a0dfe677e93bf51015bf7a39ebf888631b12a4 Reviewed-on: https://code.wireshark.org/review/5387 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Evan Huus <eapache@gmail.com>
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-tcp.c8
-rw-r--r--epan/dissectors/packet-tcp.h5
2 files changed, 7 insertions, 6 deletions
diff --git a/epan/dissectors/packet-tcp.c b/epan/dissectors/packet-tcp.c
index 7f89b96143..b3aeb20bf4 100644
--- a/epan/dissectors/packet-tcp.c
+++ b/epan/dissectors/packet-tcp.c
@@ -1040,8 +1040,9 @@ tcp_analyze_sequence_number(packet_info *pinfo, guint32 seq, guint32 ack, guint3
* event that the SYN or SYN/ACK packet is not seen
* (this solves bug 1542)
*/
- if(tcpd->fwd->base_seq==0) {
+ if(tcpd->fwd->base_seq_set == FALSE) {
tcpd->fwd->base_seq = (flags & TH_SYN) ? seq : seq-1;
+ tcpd->fwd->base_seq_set = TRUE;
}
/* Only store reverse sequence if this isn't the SYN
@@ -1055,8 +1056,9 @@ tcp_analyze_sequence_number(packet_info *pinfo, guint32 seq, guint32 ack, guint3
* other packets the ISN is unknown, so ack-1 is
* as good a guess as ack.
*/
- if( (tcpd->rev->base_seq==0) && (flags & TH_ACK) ) {
+ if( (tcpd->rev->base_seq_set==FALSE) && (flags & TH_ACK) ) {
tcpd->rev->base_seq = ack-1;
+ tcpd->rev->base_seq_set = TRUE;
}
if( flags & TH_ACK ) {
@@ -4336,7 +4338,7 @@ dissect_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* mission later.
*/
if(tcpd && ((tcph->th_flags&(TH_SYN|TH_ACK))==TH_SYN) &&
- (tcpd->fwd->base_seq!=0) &&
+ (tcpd->fwd->base_seq_set == TRUE) &&
(tcph->th_seq!=tcpd->fwd->base_seq) ) {
if (!(pinfo->fd->flags.visited)) {
conv=conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0);
diff --git a/epan/dissectors/packet-tcp.h b/epan/dissectors/packet-tcp.h
index b502527da6..f1b34738a1 100644
--- a/epan/dissectors/packet-tcp.h
+++ b/epan/dissectors/packet-tcp.h
@@ -151,9 +151,8 @@ struct tcp_multisegment_pdu {
};
typedef struct _tcp_flow_t {
- guint32 base_seq; /* base seq number (used by relative sequence numbers)
- * or 0 if not yet known.
- */
+ gboolean base_seq_set; /* true if base seq set */
+ guint32 base_seq; /* base seq number (used by relative sequence numbers)*/
tcp_unacked_t *segments;
guint32 fin; /* frame number of the final FIN */
guint32 lastack; /* last seen ack */