Make use of the work-arounds for ancient broken TCP peers run-time

conditional (tcp_compat_42).  The kernel config option TCP_COMPAT_42
will still enable this by default, or disable this by default if the
option is not included (i.e. current behavior).  This will be made a
sysctl soon.
This commit is contained in:
thorpej 1998-04-29 05:16:46 +00:00
parent 80c08c1784
commit 13f972a4d6
3 changed files with 39 additions and 36 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: tcp_subr.c,v 1.47 1998/04/13 21:18:19 kml Exp $ */
/* $NetBSD: tcp_subr.c,v 1.48 1998/04/29 05:16:46 thorpej Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@ -111,6 +111,11 @@ int tcp_rttdflt = TCPTV_SRTTDFLT / PR_SLOWHZ;
int tcp_do_rfc1323 = 1;
int tcp_init_win = 1;
int tcp_mss_ifmtu = 0;
#ifdef TCP_COMPAT_42
int tcp_compat_42 = 1;
#else
int tcp_compat_42 = 0;
#endif
#ifndef TCBHASHSIZE
#define TCBHASHSIZE 128
@ -204,11 +209,12 @@ tcp_respond(tp, ti, m, ack, seq, flags)
m = m_gethdr(M_DONTWAIT, MT_HEADER);
if (m == NULL)
return (ENOBUFS);
#ifdef TCP_COMPAT_42
tlen = 1;
#else
tlen = 0;
#endif
if (tcp_compat_42)
tlen = 1;
else
tlen = 0;
m->m_data += max_linkhdr;
*mtod(m, struct tcpiphdr *) = *ti;
ti = mtod(m, struct tcpiphdr *);
@ -830,13 +836,14 @@ tcp_new_iss(tp, len, addin)
#endif
}
#ifdef TCP_COMPAT_42
/*
* limit it to the positive range for really old TCP implementations
*/
if ((int)tcp_iss < 0)
tcp_iss &= 0x7fffffff; /* XXX */
#endif
if (tcp_compat_42) {
/*
* Limit it to the positive range for really old TCP
* implementations.
*/
if ((int)tcp_iss < 0)
tcp_iss &= 0x7fffffff; /* XXX */
}
return tcp_iss;
}
@ -861,5 +868,3 @@ tcp_optlen(tp)
else
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: tcp_timer.c,v 1.33 1998/04/29 03:44:12 kml Exp $ */
/* $NetBSD: tcp_timer.c,v 1.34 1998/04/29 05:16:47 thorpej Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@ -72,8 +72,6 @@
* @(#)tcp_timer.c 8.2 (Berkeley) 5/24/95
*/
#include "opt_tcp_compat_42.h"
#ifndef TUBA_INCLUDE
#include <sys/param.h>
#include <sys/systm.h>
@ -185,10 +183,9 @@ tpgone:
}
#if NRND == 0 /* Do we need to do this when using random() ? */
tcp_iss_seq += TCP_ISSINCR; /* increment iss */
#ifdef TCP_COMPAT_42
if ((int)tcp_iss_seq < 0)
tcp_iss_seq = 0; /* XXX */
#endif
if (tcp_compat_42)
if ((int)tcp_iss_seq < 0)
tcp_iss_seq = 0; /* XXX */
#endif
tcp_now++; /* for timestamps */
if (++syn_cache_last >= tcp_syn_cache_interval) {
@ -391,19 +388,19 @@ tcp_timers(tp, timer)
* correspondent TCP to respond.
*/
tcpstat.tcps_keepprobe++;
#ifdef TCP_COMPAT_42
/*
* The keepalive packet must have nonzero length
* to get a 4.2 host to respond.
*/
(void)tcp_respond(tp, tp->t_template,
(struct mbuf *)NULL, tp->rcv_nxt - 1,
tp->snd_una - 1, 0);
#else
(void)tcp_respond(tp, tp->t_template,
(struct mbuf *)NULL, tp->rcv_nxt,
tp->snd_una - 1, 0);
#endif
if (tcp_compat_42) {
/*
* The keepalive packet must have nonzero
* length to get a 4.2 host to respond.
*/
(void)tcp_respond(tp, tp->t_template,
(struct mbuf *)NULL, tp->rcv_nxt - 1,
tp->snd_una - 1, 0);
} else {
(void)tcp_respond(tp, tp->t_template,
(struct mbuf *)NULL, tp->rcv_nxt,
tp->snd_una - 1, 0);
}
tp->t_timer[TCPT_KEEP] = tcp_keepintvl;
} else
tp->t_timer[TCPT_KEEP] = tcp_keepidle;

View File

@ -1,4 +1,4 @@
/* $NetBSD: tcp_var.h,v 1.41 1998/04/13 21:18:20 kml Exp $ */
/* $NetBSD: tcp_var.h,v 1.42 1998/04/29 05:16:47 thorpej Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@ -397,6 +397,7 @@ extern int tcp_do_rfc1323; /* enabled/disabled? */
extern int tcp_mssdflt; /* default seg size */
extern int tcp_init_win; /* initial window */
extern int tcp_mss_ifmtu; /* take MSS from interface, not in_maxmtu */
extern int tcp_compat_42; /* work around ancient broken TCP peers */
extern int tcp_syn_cache_limit; /* max entries for compressed state engine */
extern int tcp_syn_bucket_limit;/* max entries per hash bucket */
extern int tcp_syn_cache_interval; /* compressed state timer */