Hi,
Desegmentation was only working with relative sequence numbers if overflow.
Didier
Index: packet-tcp.c
===================================================================
RCS file: /cvsroot/ethereal/packet-tcp.c,v
retrieving revision 1.171
diff -u -r1.171 packet-tcp.c
--- packet-tcp.c 28 Jan 2003 23:56:40 -0000 1.171
+++ packet-tcp.c 17 Feb 2003 07:23:45 -0000
@@ -163,11 +163,11 @@
};
/* Idea for gt: either x > y, or y is much bigger (assume wrap) */
-#define GT_SEQ(x, y) ((gint32)(y - x) < 0)
-#define LT_SEQ(x, y) ((gint32)(x - y) < 0)
-#define GE_SEQ(x, y) ((gint32)(y - x) <= 0)
-#define LE_SEQ(x, y) ((gint32)(x - y) <= 0)
-#define EQ_SEQ(x, y) (x == y)
+#define GT_SEQ(x, y) ((gint32)((y) - (x)) < 0)
+#define LT_SEQ(x, y) ((gint32)((x) - (y)) < 0)
+#define GE_SEQ(x, y) ((gint32)((y) - (x)) <= 0)
+#define LE_SEQ(x, y) ((gint32)((x) - (y)) <= 0)
+#define EQ_SEQ(x, y) ((x) == (y))
static GMemChunk *tcp_acked_chunk = NULL;
static int tcp_acked_count = 5000; /* one for almost every other segment in the capture */
@@ -1040,7 +1040,7 @@
tcp_fragment_table,
seq - tsk->start_seq,
nxtseq - seq,
- (nxtseq < (tsk->start_seq + tsk->tot_len)) );
+ (LT_SEQ (nxtseq,tsk->start_seq + tsk->tot_len)) );
if(!ipfd_head){
/* fragment_add() returned NULL, This means that
@@ -1105,7 +1105,7 @@
* Note that the last segment may include more than what
* we needed.
*/
- if(nxtseq >= (tsk->start_seq + tsk->tot_len)){
+ if(GE_SEQ(nxtseq, tsk->start_seq + tsk->tot_len)){
/*
* OK, this is the last segment.
* Let's call the subdissector with the desegmented
@@ -1305,7 +1305,7 @@
tcp_fragment_table,
tsk->seq - tsk->start_seq,
nxtseq - tsk->start_seq,
- (nxtseq < tsk->start_seq + tsk->tot_len));
+ LT_SEQ (nxtseq, tsk->start_seq + tsk->tot_len));
/* this is the next segment in the sequence we want */
new_tsk = g_mem_chunk_alloc(tcp_segment_key_chunk);