Deleted Added
full compact
tcp_input.c (274300) tcp_input.c (274421)
1/*-
2 * Copyright (c) 1982, 1986, 1988, 1990, 1993, 1994, 1995
3 * The Regents of the University of California. All rights reserved.
4 * Copyright (c) 2007-2008,2010
5 * Swinburne University of Technology, Melbourne, Australia.
6 * Copyright (c) 2009-2010 Lawrence Stewart <lstewart@freebsd.org>
7 * Copyright (c) 2010 The FreeBSD Foundation
8 * Copyright (c) 2010-2011 Juniper Networks, Inc.

--- 34 unchanged lines hidden (view full) ---

43 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
44 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
45 * SUCH DAMAGE.
46 *
47 * @(#)tcp_input.c 8.12 (Berkeley) 5/24/95
48 */
49
50#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1982, 1986, 1988, 1990, 1993, 1994, 1995
3 * The Regents of the University of California. All rights reserved.
4 * Copyright (c) 2007-2008,2010
5 * Swinburne University of Technology, Melbourne, Australia.
6 * Copyright (c) 2009-2010 Lawrence Stewart <lstewart@freebsd.org>
7 * Copyright (c) 2010 The FreeBSD Foundation
8 * Copyright (c) 2010-2011 Juniper Networks, Inc.

--- 34 unchanged lines hidden (view full) ---

43 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
44 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
45 * SUCH DAMAGE.
46 *
47 * @(#)tcp_input.c 8.12 (Berkeley) 5/24/95
48 */
49
50#include <sys/cdefs.h>
51__FBSDID("$FreeBSD: head/sys/netinet/tcp_input.c 274300 2014-11-08 19:38:34Z ae $");
51__FBSDID("$FreeBSD: head/sys/netinet/tcp_input.c 274421 2014-11-12 09:57:15Z glebius $");
52
53#include "opt_ipfw.h" /* for ipfw_fwd */
54#include "opt_inet.h"
55#include "opt_inet6.h"
56#include "opt_ipsec.h"
57#include "opt_tcpdebug.h"
58
59#include <sys/param.h>

--- 1680 unchanged lines hidden (view full) ---

1740 &tcp_savetcp, 0);
1741#endif
1742 if (tp->snd_una == tp->snd_max)
1743 tcp_timer_activate(tp, TT_REXMT, 0);
1744 else if (!tcp_timer_active(tp, TT_PERSIST))
1745 tcp_timer_activate(tp, TT_REXMT,
1746 tp->t_rxtcur);
1747 sowwakeup(so);
52
53#include "opt_ipfw.h" /* for ipfw_fwd */
54#include "opt_inet.h"
55#include "opt_inet6.h"
56#include "opt_ipsec.h"
57#include "opt_tcpdebug.h"
58
59#include <sys/param.h>

--- 1680 unchanged lines hidden (view full) ---

1740 &tcp_savetcp, 0);
1741#endif
1742 if (tp->snd_una == tp->snd_max)
1743 tcp_timer_activate(tp, TT_REXMT, 0);
1744 else if (!tcp_timer_active(tp, TT_PERSIST))
1745 tcp_timer_activate(tp, TT_REXMT,
1746 tp->t_rxtcur);
1747 sowwakeup(so);
1748 if (so->so_snd.sb_cc)
1748 if (sbavail(&so->so_snd))
1749 (void) tcp_output(tp);
1750 goto check_delack;
1751 }
1752 } else if (th->th_ack == tp->snd_una &&
1753 tlen <= sbspace(&so->so_rcv)) {
1754 int newsize = 0; /* automatic sockbuf scaling */
1755
1756 /*

--- 764 unchanged lines hidden (view full) ---

2521 (tp->t_dupacks - tp->snd_limited) *
2522 tp->t_maxseg;
2523 /*
2524 * Only call tcp_output when there
2525 * is new data available to be sent.
2526 * Otherwise we would send pure ACKs.
2527 */
2528 SOCKBUF_LOCK(&so->so_snd);
1749 (void) tcp_output(tp);
1750 goto check_delack;
1751 }
1752 } else if (th->th_ack == tp->snd_una &&
1753 tlen <= sbspace(&so->so_rcv)) {
1754 int newsize = 0; /* automatic sockbuf scaling */
1755
1756 /*

--- 764 unchanged lines hidden (view full) ---

2521 (tp->t_dupacks - tp->snd_limited) *
2522 tp->t_maxseg;
2523 /*
2524 * Only call tcp_output when there
2525 * is new data available to be sent.
2526 * Otherwise we would send pure ACKs.
2527 */
2528 SOCKBUF_LOCK(&so->so_snd);
2529 avail = so->so_snd.sb_cc -
2529 avail = sbavail(&so->so_snd) -
2530 (tp->snd_nxt - tp->snd_una);
2531 SOCKBUF_UNLOCK(&so->so_snd);
2532 if (avail > 0)
2533 (void) tcp_output(tp);
2534 sent = tp->snd_max - oldsndmax;
2535 if (sent > tp->t_maxseg) {
2536 KASSERT((tp->t_dupacks == 2 &&
2537 tp->snd_limited == 0) ||

--- 118 unchanged lines hidden (view full) ---

2656 /*
2657 * Let the congestion control algorithm update congestion
2658 * control related information. This typically means increasing
2659 * the congestion window.
2660 */
2661 cc_ack_received(tp, th, CC_ACK);
2662
2663 SOCKBUF_LOCK(&so->so_snd);
2530 (tp->snd_nxt - tp->snd_una);
2531 SOCKBUF_UNLOCK(&so->so_snd);
2532 if (avail > 0)
2533 (void) tcp_output(tp);
2534 sent = tp->snd_max - oldsndmax;
2535 if (sent > tp->t_maxseg) {
2536 KASSERT((tp->t_dupacks == 2 &&
2537 tp->snd_limited == 0) ||

--- 118 unchanged lines hidden (view full) ---

2656 /*
2657 * Let the congestion control algorithm update congestion
2658 * control related information. This typically means increasing
2659 * the congestion window.
2660 */
2661 cc_ack_received(tp, th, CC_ACK);
2662
2663 SOCKBUF_LOCK(&so->so_snd);
2664 if (acked > so->so_snd.sb_cc) {
2665 tp->snd_wnd -= so->so_snd.sb_cc;
2664 if (acked > sbavail(&so->so_snd)) {
2665 tp->snd_wnd -= sbavail(&so->so_snd);
2666 mfree = sbcut_locked(&so->so_snd,
2666 mfree = sbcut_locked(&so->so_snd,
2667 (int)so->so_snd.sb_cc);
2667 (int)sbavail(&so->so_snd));
2668 ourfinisacked = 1;
2669 } else {
2670 mfree = sbcut_locked(&so->so_snd, acked);
2671 tp->snd_wnd -= acked;
2672 ourfinisacked = 0;
2673 }
2674 /* NB: sowwakeup_locked() does an implicit unlock. */
2675 sowwakeup_locked(so);

--- 109 unchanged lines hidden (view full) ---

2785 TCPS_HAVERCVDFIN(tp->t_state) == 0) {
2786 /*
2787 * This is a kludge, but if we receive and accept
2788 * random urgent pointers, we'll crash in
2789 * soreceive. It's hard to imagine someone
2790 * actually wanting to send this much urgent data.
2791 */
2792 SOCKBUF_LOCK(&so->so_rcv);
2668 ourfinisacked = 1;
2669 } else {
2670 mfree = sbcut_locked(&so->so_snd, acked);
2671 tp->snd_wnd -= acked;
2672 ourfinisacked = 0;
2673 }
2674 /* NB: sowwakeup_locked() does an implicit unlock. */
2675 sowwakeup_locked(so);

--- 109 unchanged lines hidden (view full) ---

2785 TCPS_HAVERCVDFIN(tp->t_state) == 0) {
2786 /*
2787 * This is a kludge, but if we receive and accept
2788 * random urgent pointers, we'll crash in
2789 * soreceive. It's hard to imagine someone
2790 * actually wanting to send this much urgent data.
2791 */
2792 SOCKBUF_LOCK(&so->so_rcv);
2793 if (th->th_urp + so->so_rcv.sb_cc > sb_max) {
2793 if (th->th_urp + sbavail(&so->so_rcv) > sb_max) {
2794 th->th_urp = 0; /* XXX */
2795 thflags &= ~TH_URG; /* XXX */
2796 SOCKBUF_UNLOCK(&so->so_rcv); /* XXX */
2797 goto dodata; /* XXX */
2798 }
2799 /*
2800 * If this segment advances the known urgent pointer,
2801 * then mark the data stream. This should not happen

--- 5 unchanged lines hidden (view full) ---

2807 * the urgent pointer points to the last octet
2808 * of urgent data. We continue, however,
2809 * to consider it to indicate the first octet
2810 * of data past the urgent section as the original
2811 * spec states (in one of two places).
2812 */
2813 if (SEQ_GT(th->th_seq+th->th_urp, tp->rcv_up)) {
2814 tp->rcv_up = th->th_seq + th->th_urp;
2794 th->th_urp = 0; /* XXX */
2795 thflags &= ~TH_URG; /* XXX */
2796 SOCKBUF_UNLOCK(&so->so_rcv); /* XXX */
2797 goto dodata; /* XXX */
2798 }
2799 /*
2800 * If this segment advances the known urgent pointer,
2801 * then mark the data stream. This should not happen

--- 5 unchanged lines hidden (view full) ---

2807 * the urgent pointer points to the last octet
2808 * of urgent data. We continue, however,
2809 * to consider it to indicate the first octet
2810 * of data past the urgent section as the original
2811 * spec states (in one of two places).
2812 */
2813 if (SEQ_GT(th->th_seq+th->th_urp, tp->rcv_up)) {
2814 tp->rcv_up = th->th_seq + th->th_urp;
2815 so->so_oobmark = so->so_rcv.sb_cc +
2815 so->so_oobmark = sbavail(&so->so_rcv) +
2816 (tp->rcv_up - tp->rcv_nxt) - 1;
2817 if (so->so_oobmark == 0)
2818 so->so_rcv.sb_state |= SBS_RCVATMARK;
2819 sohasoutofband(so);
2820 tp->t_oobflags &= ~(TCPOOB_HAVEDATA | TCPOOB_HADDATA);
2821 }
2822 SOCKBUF_UNLOCK(&so->so_rcv);
2823 /*

--- 857 unchanged lines hidden ---
2816 (tp->rcv_up - tp->rcv_nxt) - 1;
2817 if (so->so_oobmark == 0)
2818 so->so_rcv.sb_state |= SBS_RCVATMARK;
2819 sohasoutofband(so);
2820 tp->t_oobflags &= ~(TCPOOB_HAVEDATA | TCPOOB_HADDATA);
2821 }
2822 SOCKBUF_UNLOCK(&so->so_rcv);
2823 /*

--- 857 unchanged lines hidden ---