View | Details | Raw Unified | Return to bug 264257 | Differences between
and this patch

Collapse All | Expand All

(-)b/sys/netinet/tcp_output.c (-1 / +21 lines)
Lines 60-65 __FBSDID("$FreeBSD$"); Link Here
60
#include <sys/socket.h>
60
#include <sys/socket.h>
61
#include <sys/socketvar.h>
61
#include <sys/socketvar.h>
62
#include <sys/sysctl.h>
62
#include <sys/sysctl.h>
63
#include <sys/syslog.h>
63
#include <sys/stats.h>
64
#include <sys/stats.h>
64
65
65
#include <net/if.h>
66
#include <net/if.h>
Lines 1577-1582 tcp_output(struct tcpcb *tp) Link Here
1577
		tp->snd_nxt += len;
1578
		tp->snd_nxt += len;
1578
		if (SEQ_GT(tp->snd_nxt, tp->snd_max)) {
1579
		if (SEQ_GT(tp->snd_nxt, tp->snd_max)) {
1579
			tp->snd_max = tp->snd_nxt;
1580
			tp->snd_max = tp->snd_nxt;
1581
			struct socket *so = tp->t_inpcb->inp_socket;
1582
			tcp_seq top = tp->snd_una + sbused(&so->so_snd);
1583
			KASSERT(SEQ_LEQ(tp->snd_max, top+1),
1584
				("%s: snd_max beyond so_snd", __func__));
1585
			if (SEQ_GT(tp->snd_max, top + 1)) {
1586
				log(LOG_CRIT,"%s#%d: snd_max %u > so_snd+1 %u adjusting.\n",
1587
					__func__, __LINE__, tp->snd_max, top + 1);
1588
				tp->snd_max = top + 1;
1589
			}
1580
			/*
1590
			/*
1581
			 * Time this transmission if not a retransmission and
1591
			 * Time this transmission if not a retransmission and
1582
			 * not currently timing anything.
1592
			 * not currently timing anything.
Lines 1652-1659 tcp_output(struct tcpcb *tp) Link Here
1652
			++xlen;
1662
			++xlen;
1653
			tp->t_flags |= TF_SENTFIN;
1663
			tp->t_flags |= TF_SENTFIN;
1654
		}
1664
		}
1655
		if (SEQ_GT(tp->snd_nxt + xlen, tp->snd_max))
1665
		if (SEQ_GT(tp->snd_nxt + xlen, tp->snd_max)) {
1656
			tp->snd_max = tp->snd_nxt + xlen;
1666
			tp->snd_max = tp->snd_nxt + xlen;
1667
			struct socket *so = tp->t_inpcb->inp_socket;
1668
			tcp_seq top = tp->snd_una + sbused(&so->so_snd);
1669
			KASSERT(SEQ_LEQ(tp->snd_max, top + 1),
1670
			    ("%s: snd_max beyond so_snd", __func__));
1671
			if (SEQ_GT(tp->snd_max, top + 1)) {
1672
				log(LOG_CRIT,"%s#%d: snd_max %u > so_snd+1 %u adjusting.\n",
1673
					__func__, __LINE__, tp->snd_max, top + 1);
1674
				tp->snd_max = top + 1;
1675
			}
1676
		}
1657
	}
1677
	}
1658
	if ((error == 0) &&
1678
	if ((error == 0) &&
1659
	    (TCPS_HAVEESTABLISHED(tp->t_state) &&
1679
	    (TCPS_HAVEESTABLISHED(tp->t_state) &&
(-)b/sys/netinet/tcp_sack.c (-8 / +41 lines)
Lines 879-886 tcp_sack_partialack(struct tcpcb *tp, struct tcphdr *th) Link Here
879
			highdata--;
879
			highdata--;
880
		if (th->th_ack != highdata) {
880
		if (th->th_ack != highdata) {
881
			tp->snd_fack = th->th_ack;
881
			tp->snd_fack = th->th_ack;
882
			(void)tcp_sackhole_insert(tp, SEQ_MAX(th->th_ack,
882
			struct socket *so = tp->t_inpcb->inp_socket;
883
			    highdata - maxseg), highdata, NULL);
883
			tcp_seq top = tp->snd_una + sbused(&so->so_snd);
884
			KASSERT(SEQ_LEQ(highdata, top),
885
				("%s: rescue.end > so_snd, NEEDFIN:%d SENTFIN:%d\n",
886
				__func__, (tp->t_flags & TF_NEEDFIN) != 0,
887
				(tp->t_flags & TF_SENTFIN) != 0));
888
			if (SEQ_GT(highdata, top)) {
889
				log(LOG_CRIT,"%s#%d: rescue (%u-%u) > so_snd %u skipping.\n",
890
					__func__, __LINE__,
891
					SEQ_MAX(th->th_ack, highdata - maxseg),
892
					highdata, top);
893
			} else
894
				(void)tcp_sackhole_insert(tp, SEQ_MAX(th->th_ack,
895
				    highdata - maxseg), highdata, NULL);
884
		}
896
		}
885
	}
897
	}
886
	(void) tp->t_fb->tfb_tcp_output(tp);
898
	(void) tp->t_fb->tfb_tcp_output(tp);
Lines 937-948 tcp_sack_output(struct tcpcb *tp, int *sack_bytes_rexmt) Link Here
937
	INP_WLOCK_ASSERT(tp->t_inpcb);
949
	INP_WLOCK_ASSERT(tp->t_inpcb);
938
	*sack_bytes_rexmt = tp->sackhint.sack_bytes_rexmit;
950
	*sack_bytes_rexmt = tp->sackhint.sack_bytes_rexmit;
939
	hole = tp->sackhint.nexthole;
951
	hole = tp->sackhint.nexthole;
940
	if (hole == NULL || SEQ_LT(hole->rxmit, hole->end))
952
	if (hole == NULL)
941
		goto out;
953
		return (hole);
942
	while ((hole = TAILQ_NEXT(hole, scblink)) != NULL) {
954
	if (SEQ_GEQ(hole->rxmit, hole->end)) {
943
		if (SEQ_LT(hole->rxmit, hole->end)) {
955
		for (;;) {
944
			tp->sackhint.nexthole = hole;
956
			hole = TAILQ_NEXT(hole, scblink);
945
			break;
957
			if (hole == NULL)
958
				return (hole);
959
			if (SEQ_LT(hole->rxmit, hole->end)) {
960
				tp->sackhint.nexthole = hole;
961
				break;
962
			}
963
		}
964
	}
965
	{
966
		struct socket *so = tp->t_inpcb->inp_socket;
967
		tcp_seq top = tp->snd_una + sbused(&so->so_snd);
968
		KASSERT(SEQ_LT(hole->start, hole->end), ("%s: hole.start >= hole.end", __func__));
969
		KASSERT(SEQ_LEQ(hole->start, top), ("%s: hole.start >= so_snd", __func__));
970
		KASSERT(SEQ_LEQ(hole->end,   top), ("%s: hole.end >= so_snd", __func__));
971
		KASSERT(SEQ_LEQ(hole->rxmit, top), ("%s: hole.rxmit >= so_snd", __func__));
972
		if (SEQ_GEQ(hole->start, hole->end) ||
973
		    SEQ_GT(hole->start, top) ||
974
		    SEQ_GT(hole->end,   top) ||
975
		    SEQ_GT(hole->rxmit, top)) {
976
			log(LOG_CRIT,"%s#%d: invalid SACK hole (%u-%u,%u) vs so_snd %u ignoring.\n",
977
					__func__, __LINE__, hole->start, hole->end, hole->rxmit, top);
978
			return (NULL);
946
		}
979
		}
947
	}
980
	}
948
out:
981
out:

Return to bug 264257