[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ns] Bug in FullTcp advance_bytes



Hello.

I believe there is a bug in the FullTcp::advance_bytes function in
ns-2.1b8. When the connection is in the SYN_SENT state, new application
data is not queued but dropped instead. This causes loss of data in the
simulated TCP stream (which should never happen).

This problem was adequately described before by Matthew Caesar in his
posting of 2 Dec 2000, which apparently got ignored.
See http://www.isi.edu/nsnam/archive/ns-users/webarch/2000/msg05904.html

I modified the advance_bytes function to make it queue data even in the
SYN_SENT state, and this removes the problem for me. However, I'm not sure
that my patch is correct (simulates real TCP semantics) or complete (maybe
something should be done about the SYN_RECEIVED state for example ?).

The patch below is for ns-2.1b8. I would appreciate it if a more
experienced ns-2 hacker could look into this.

--- tcp-full.cc.orig	Thu Jun 14 17:12:51 2001
+++ tcp-full.cc	Tue Jun 19 13:51:19 2001
@@ -343,6 +343,11 @@
 			curseq_ = iss_;
 		curseq_ += nb;
 		send_much(0, REASON_NORMAL, maxburst_);
+	} else if (state_ == TCPS_SYN_SENT) {
+		/* Hope this fixes a bug */
+		if (curseq_ < iss_)
+			curseq_ = iss_;
+		curseq_ += nb;
 	}
 	return;
 }
--- end patch

Bye,
  Joris.