summaryrefslogtreecommitdiffstats
path: root/sys/netinet/tcp_usrreq.c
diff options
context:
space:
mode:
authorolah <olah@FreeBSD.org>1995-11-03 22:08:13 +0000
committerolah <olah@FreeBSD.org>1995-11-03 22:08:13 +0000
commit7c2efeb6de92a9b5d6911dfda4c8ed821646c2ec (patch)
tree9b3a8e7df4e0197a04c16458af0e284ac3f222fe /sys/netinet/tcp_usrreq.c
parentad9443ce5263b62609a136c4850ff5d752101015 (diff)
downloadFreeBSD-src-7c2efeb6de92a9b5d6911dfda4c8ed821646c2ec.zip
FreeBSD-src-7c2efeb6de92a9b5d6911dfda4c8ed821646c2ec.tar.gz
Fix a logical error in T/TCP: when we actively open a connection, we
have to decide whether to send a CC or CCnew option in our SYN segment depending on the contents of our TAO cache. This decision has to be made once when the connection starts. The earlier code delayed this decision until the segment was assembled in tcp_output() and retransmitted SYN segments could have different CC options. Reviewed by: Richard Stevens, davidg, wollman
Diffstat (limited to 'sys/netinet/tcp_usrreq.c')
-rw-r--r--sys/netinet/tcp_usrreq.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c
index ab4c5c9..1b05f16 100644
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* From: @(#)tcp_usrreq.c 8.2 (Berkeley) 1/3/94
- * $Id: tcp_usrreq.c,v 1.16 1995/09/13 17:54:03 wollman Exp $
+ * $Id: tcp_usrreq.c,v 1.17 1995/10/29 21:30:25 olah Exp $
*/
#include <sys/param.h>
@@ -407,6 +407,8 @@ tcp_connect(tp, nam)
struct sockaddr_in *sin = mtod(nam, struct sockaddr_in *);
struct sockaddr_in *ifaddr;
int error;
+ struct rmxp_tao *taop;
+ struct rmxp_tao tao_noncached;
if (inp->inp_lport == 0) {
error = in_pcbbind(inp, NULL);
@@ -459,7 +461,24 @@ tcp_connect(tp, nam)
tp->t_timer[TCPT_KEEP] = TCPTV_KEEP_INIT;
tp->iss = tcp_iss; tcp_iss += TCP_ISSINCR/2;
tcp_sendseqinit(tp);
+
+ /*
+ * Generate a CC value for this connection and
+ * check whether CC or CCnew should be used.
+ */
+ if ((taop = tcp_gettaocache(tp->t_inpcb)) == NULL) {
+ taop = &tao_noncached;
+ bzero(taop, sizeof(*taop));
+ }
+
tp->cc_send = CC_INC(tcp_ccgen);
+ if (taop->tao_ccsent != 0 &&
+ CC_GEQ(tp->cc_send, taop->tao_ccsent)) {
+ taop->tao_ccsent = tp->cc_send;
+ } else {
+ taop->tao_ccsent = 0;
+ tp->t_flags |= TF_SENDCCNEW;
+ }
return 0;
}
OpenPOWER on IntegriCloud