diff options
author | Markus Friedl <markus@cvs.openbsd.org> | 2004-01-31 19:40:11 +0000 |
---|---|---|
committer | Markus Friedl <markus@cvs.openbsd.org> | 2004-01-31 19:40:11 +0000 |
commit | 5acc69ea30347286938376b652ffd9344ea3775f (patch) | |
tree | 6ca73f15815cb7f1c492c8d18c14ecdabc0e404b | |
parent | a6b0a635844a868ee7cf88c1f0682c1d92064d25 (diff) |
!sack_disable -> sack_enable; ok deraadt@
-rw-r--r-- | sys/netinet/tcp.h | 4 | ||||
-rw-r--r-- | sys/netinet/tcp_input.c | 33 | ||||
-rw-r--r-- | sys/netinet/tcp_output.c | 23 | ||||
-rw-r--r-- | sys/netinet/tcp_subr.c | 4 | ||||
-rw-r--r-- | sys/netinet/tcp_usrreq.c | 14 | ||||
-rw-r--r-- | sys/netinet/tcp_var.h | 4 |
6 files changed, 41 insertions, 41 deletions
diff --git a/sys/netinet/tcp.h b/sys/netinet/tcp.h index ba7742d3a46..bf9e47c7133 100644 --- a/sys/netinet/tcp.h +++ b/sys/netinet/tcp.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp.h,v 1.12 2003/06/02 23:28:14 millert Exp $ */ +/* $OpenBSD: tcp.h,v 1.13 2004/01/31 19:40:09 markus Exp $ */ /* $NetBSD: tcp.h,v 1.8 1995/04/17 05:32:58 cgd Exp $ */ /* @@ -119,6 +119,6 @@ struct tcphdr { #define TCP_NODELAY 0x01 /* don't delay send to coalesce pkts */ #define TCP_MAXSEG 0x02 /* set maximum segment size */ #define TCP_SIGNATURE_ENABLE 0x04 /* enable TCP MD5 signature option */ -#define TCP_SACK_DISABLE 0x300 /* disable SACKs (if enabled by def.) */ +#define TCP_SACK_ENABLE 0x08 /* enable SACKs (if disabled by def.) */ #endif /* _NETINET_TCP_H_ */ diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index a4c52165f0c..2aae18d0f3f 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_input.c,v 1.151 2004/01/29 17:02:56 markus Exp $ */ +/* $OpenBSD: tcp_input.c,v 1.152 2004/01/31 19:40:09 markus Exp $ */ /* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */ /* @@ -945,7 +945,7 @@ after_listen: TCP_TIMER_ARM(tp, TCPT_KEEP, tcp_keepidle); #ifdef TCP_SACK - if (!tp->sack_disable) + if (tp->sack_enable) tcp_del_sackholes(tp, th); /* Delete stale SACK holes */ #endif /* TCP_SACK */ @@ -961,7 +961,7 @@ after_listen: goto drop; #ifdef TCP_SACK - if (!tp->sack_disable) { + if (tp->sack_enable) { tp->rcv_laststart = th->th_seq; /* last rec'vd segment*/ tp->rcv_lastend = th->th_seq + tlen; } @@ -1076,7 +1076,7 @@ after_listen: */ #ifdef TCP_SACK /* Clean receiver SACK report if present */ - if (!tp->sack_disable && tp->rcv_numsacks) + if (tp->sack_enable && tp->rcv_numsacks) tcp_clean_sackreport(tp); #endif /* TCP_SACK */ ++tcpstat.tcps_preddat; @@ -1189,9 +1189,8 @@ after_listen: * also replied with one, then TF_SACK_PERMIT should have * been set in tcp_dooptions(). If it was not, disable SACKs. */ - if (!tp->sack_disable) - if ((tp->t_flags & TF_SACK_PERMIT) == 0) - tp->sack_disable = 1; + if (tp->sack_enable) + tp->sack_enable = tp->t_flags & TF_SACK_PERMIT; #endif #ifdef TCP_ECN /* @@ -1616,7 +1615,7 @@ trimthenstep6: tp->snd_last = tp->snd_max; #endif #ifdef TCP_SACK - if (!tp->sack_disable) { + if (tp->sack_enable) { TCP_TIMER_DISARM(tp, TCPT_REXMT); tp->t_rtttime = 0; #ifdef TCP_ECN @@ -1670,7 +1669,7 @@ trimthenstep6: * while (awnd < cwnd) * sendsomething(); */ - if (!tp->sack_disable) { + if (tp->sack_enable) { if (tp->snd_awnd < tp->snd_cwnd) tcp_output(tp); goto drop; @@ -1696,7 +1695,7 @@ trimthenstep6: * for the other side's cached packets, retract it. */ #if defined(TCP_SACK) - if (!tp->sack_disable) { + if (tp->sack_enable) { if (tp->t_dupacks >= tcprexmtthresh) { /* Check for a partial ACK */ if (tcp_sack_partialack(tp, th)) { @@ -2001,7 +2000,7 @@ dodata: /* XXX */ tp->t_flags |= TF_ACKNOW; } #ifdef TCP_SACK - if (!tp->sack_disable) + if (tp->sack_enable) tcp_update_sack_list(tp); #endif @@ -2249,7 +2248,7 @@ tcp_dooptions(tp, cp, cnt, th, m, iphlen, oi) #ifdef TCP_SACK case TCPOPT_SACK_PERMITTED: - if (tp->sack_disable || optlen!=TCPOLEN_SACK_PERMITTED) + if (!tp->sack_enable || optlen!=TCPOLEN_SACK_PERMITTED) continue; if (th->th_flags & TH_SYN) /* MUST only be set on SYN */ @@ -2532,7 +2531,7 @@ tcp_sack_option(struct tcpcb *tp, struct tcphdr *th, u_char *cp, int optlen) u_char *tmp_cp; struct sackhole *cur, *p, *temp; - if (tp->sack_disable) + if (!tp->sack_enable) return (1); /* Note: TCPOLEN_SACK must be 2*sizeof(tcp_seq) */ @@ -2749,7 +2748,7 @@ tcp_del_sackholes(tp, th) struct tcpcb *tp; struct tcphdr *th; { - if (!tp->sack_disable && tp->t_state != TCPS_LISTEN) { + if (tp->sack_enable && tp->t_state != TCPS_LISTEN) { /* max because this could be an older ack just arrived */ tcp_seq lastack = SEQ_GT(th->th_ack, tp->snd_una) ? th->th_ack : tp->snd_una; @@ -3769,7 +3768,7 @@ syn_cache_get(src, dst, th, hlen, tlen, so, m) goto abort; } #ifdef TCP_SACK - tp->sack_disable = (sc->sc_flags & SCF_SACK_PERMIT) ? 0 : 1; + tp->sack_enable = sc->sc_flags & SCF_SACK_PERMIT; #endif tp->iss = sc->sc_iss; @@ -3964,7 +3963,7 @@ syn_cache_add(src, dst, th, iphlen, so, m, optp, optlen, oi) #endif tb.pf = tp->pf; #ifdef TCP_SACK - tb.sack_disable = tcp_do_sack ? 0 : 1; + tb.sack_enable = tcp_do_sack; #endif tb.t_flags = tcp_do_rfc1323 ? (TF_REQ_SCALE|TF_REQ_TSTMP) : 0; #ifdef TCP_SIGNATURE @@ -4072,7 +4071,7 @@ syn_cache_add(src, dst, th, iphlen, so, m, optp, optlen, oi) * Set SCF_SACK_PERMIT if peer did send a SACK_PERMITTED option * (i.e., if tcp_dooptions() did set TF_SACK_PERMIT). */ - if (!tb.sack_disable && (tb.t_flags & TF_SACK_PERMIT)) + if (tb.sack_enable && (tb.t_flags & TF_SACK_PERMIT)) sc->sc_flags |= SCF_SACK_PERMIT; #endif #ifdef TCP_SIGNATURE diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c index c641a21b21f..e3ae0307342 100644 --- a/sys/netinet/tcp_output.c +++ b/sys/netinet/tcp_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_output.c,v 1.62 2004/01/22 14:38:28 markus Exp $ */ +/* $OpenBSD: tcp_output.c,v 1.63 2004/01/31 19:40:10 markus Exp $ */ /* $NetBSD: tcp_output.c,v 1.16 1997/06/03 16:17:09 kml Exp $ */ /* @@ -143,7 +143,8 @@ struct sackhole * tcp_sack_output(struct tcpcb *tp) { struct sackhole *p; - if (tp->sack_disable) + + if (!tp->sack_enable) return (NULL); p = tp->snd_holes; while (p) { @@ -239,7 +240,7 @@ tcp_output(tp) #endif #if defined(TCP_SACK) && defined(TCP_SIGNATURE) && defined(DIAGNOSTIC) - if (!tp->sack_disable && (tp->t_flags & TF_SIGNATURE)) + if (tp->sack_enable && (tp->t_flags & TF_SIGNATURE)) return (EINVAL); #endif /* defined(TCP_SACK) && defined(TCP_SIGNATURE) && defined(DIAGNOSTIC) */ @@ -264,7 +265,7 @@ again: * snd_nxt. There may be SACK information that allows us to avoid * resending already delivered data. Adjust snd_nxt accordingly. */ - if (!tp->sack_disable && SEQ_LT(tp->snd_nxt, tp->snd_max)) + if (tp->sack_enable && SEQ_LT(tp->snd_nxt, tp->snd_max)) tcp_sack_adjust(tp); #endif off = tp->snd_nxt - tp->snd_una; @@ -273,7 +274,7 @@ again: * But in FACK, sendable data is limited by snd_awnd < snd_cwnd, * regardless of offset. */ - if (!tp->sack_disable && (tp->t_dupacks > tcprexmtthresh)) + if (tp->sack_enable && (tp->t_dupacks > tcprexmtthresh)) win = tp->snd_wnd; else #endif @@ -289,7 +290,7 @@ again: * we're replacing a (future) new transmission with a retransmission * now, and we previously incremented snd_cwnd in tcp_input(). */ - if (!tp->sack_disable && !sendalot) { + if (tp->sack_enable && !sendalot) { if (tp->t_dupacks >= tcprexmtthresh && (p = tcp_sack_output(tp))) { off = p->rxmit - tp->snd_una; @@ -352,7 +353,7 @@ again: * amount of outstanding data (snd_awnd) is >= snd_cwnd, then * do not send data (like zero window conditions) */ - if (!tp->sack_disable && len && SEQ_GT(tp->snd_last, tp->snd_una) && + if (tp->sack_enable && len && SEQ_GT(tp->snd_last, tp->snd_una) && (tp->snd_awnd >= tp->snd_cwnd)) len = 0; #endif /* TCP_FACK */ @@ -560,7 +561,7 @@ send: * SYN ACK, include SACK_PERMIT_HDR option if peer has * already done so. */ - if (!tp->sack_disable && ((flags & TH_ACK) == 0 || + if (tp->sack_enable && ((flags & TH_ACK) == 0 || (tp->t_flags & TF_SACK_PERMIT))) { *((u_int32_t *) (opt + optlen)) = htonl(TCPOPT_SACK_PERMIT_HDR); @@ -632,7 +633,7 @@ send: * Only as many SACKs are sent as are permitted by the maximum options * size. No more than three SACKs are sent. */ - if (!tp->sack_disable && tp->t_state == TCPS_ESTABLISHED && + if (tp->sack_enable && tp->t_state == TCPS_ESTABLISHED && (tp->t_flags & (TF_SACK_PERMIT|TF_NOOPT)) == TF_SACK_PERMIT && tp->rcv_numsacks) { u_int32_t *lp = (u_int32_t *)(opt + optlen); @@ -1034,7 +1035,7 @@ send: } } #ifdef TCP_SACK - if (!tp->sack_disable) { + if (tp->sack_enable) { if (sack_rxmit && (p->rxmit != tp->snd_nxt)) { goto timer; } @@ -1064,7 +1065,7 @@ send: */ #ifdef TCP_SACK timer: - if (!tp->sack_disable && sack_rxmit && + if (tp->sack_enable && sack_rxmit && TCP_TIMER_ISARMED(tp, TCPT_REXMT) == 0 && tp->snd_nxt != tp->snd_max) { TCP_TIMER_ARM(tp, TCPT_REXMT, tp->t_rxtcur); diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index ddd9c25d1ab..662ccc2cc7f 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_subr.c,v 1.74 2004/01/29 11:55:28 markus Exp $ */ +/* $OpenBSD: tcp_subr.c,v 1.75 2004/01/31 19:40:10 markus Exp $ */ /* $NetBSD: tcp_subr.c,v 1.22 1996/02/13 23:44:00 christos Exp $ */ /* @@ -494,7 +494,7 @@ tcp_newtcpcb(struct inpcb *inp) TCP_TIMER_INIT(tp, i); #ifdef TCP_SACK - tp->sack_disable = tcp_do_sack ? 0 : 1; + tp->sack_enable = tcp_do_sack; #endif tp->t_flags = tcp_do_rfc1323 ? (TF_REQ_SCALE|TF_REQ_TSTMP) : 0; tp->t_inpcb = inp; diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index 0b41f64f345..b7130ce067a 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_usrreq.c,v 1.77 2004/01/30 11:33:32 henning Exp $ */ +/* $OpenBSD: tcp_usrreq.c,v 1.78 2004/01/31 19:40:10 markus Exp $ */ /* $NetBSD: tcp_usrreq.c,v 1.20 1996/02/13 23:44:16 christos Exp $ */ /* @@ -563,7 +563,7 @@ tcp_ctloutput(op, so, level, optname, mp) break; #ifdef TCP_SACK - case TCP_SACK_DISABLE: + case TCP_SACK_ENABLE: if (m == NULL || m->m_len < sizeof (int)) { error = EINVAL; break; @@ -580,9 +580,9 @@ tcp_ctloutput(op, so, level, optname, mp) } if (*mtod(m, int *)) - tp->sack_disable = 1; + tp->sack_enable = 1; else - tp->sack_disable = 0; + tp->sack_enable = 0; break; #endif #ifdef TCP_SIGNATURE @@ -600,7 +600,7 @@ tcp_ctloutput(op, so, level, optname, mp) if (*mtod(m, int *)) { tp->t_flags |= TF_SIGNATURE; #ifdef TCP_SACK - tp->sack_disable = 1; + tp->sack_enable = 0; #endif /* TCP_SACK */ } else tp->t_flags &= ~TF_SIGNATURE; @@ -626,8 +626,8 @@ tcp_ctloutput(op, so, level, optname, mp) *mtod(m, int *) = tp->t_maxseg; break; #ifdef TCP_SACK - case TCP_SACK_DISABLE: - *mtod(m, int *) = tp->sack_disable; + case TCP_SACK_ENABLE: + *mtod(m, int *) = tp->sack_enable; break; #endif #ifdef TCP_SIGNATURE diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h index 3a2eb273114..b9639558ae3 100644 --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_var.h,v 1.56 2004/01/29 11:55:28 markus Exp $ */ +/* $OpenBSD: tcp_var.h,v 1.57 2004/01/31 19:40:10 markus Exp $ */ /* $NetBSD: tcp_var.h,v 1.17 1996/02/13 23:44:24 christos Exp $ */ /* @@ -100,7 +100,7 @@ struct tcpcb { tcp_seq iss; /* initial send sequence number */ u_long snd_wnd; /* send window */ #if 1 /*def TCP_SACK*/ - int sack_disable; /* disable SACK for this connection */ + int sack_enable; /* enable SACK for this connection */ int snd_numholes; /* number of holes seen by sender */ struct sackhole *snd_holes; /* linked list of holes (sorted) */ #if 1 /*defined(TCP_SACK) && defined(TCP_FACK)*/ |