Deleted Added
full compact
tcp_output.c (180535) tcp_output.c (181056)
1/*-
2 * Copyright (c) 1982, 1986, 1988, 1990, 1993, 1995
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * @(#)tcp_output.c 8.4 (Berkeley) 5/24/95
30 */
31
32#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1982, 1986, 1988, 1990, 1993, 1995
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * @(#)tcp_output.c 8.4 (Berkeley) 5/24/95
30 */
31
32#include <sys/cdefs.h>
33__FBSDID("$FreeBSD: head/sys/netinet/tcp_output.c 180535 2008-07-15 10:32:35Z rpaulo $");
33__FBSDID("$FreeBSD: head/sys/netinet/tcp_output.c 181056 2008-07-31 15:10:09Z rpaulo $");
34
35#include "opt_inet.h"
36#include "opt_inet6.h"
37#include "opt_ipsec.h"
38#include "opt_mac.h"
39#include "opt_tcpdebug.h"
40
41#include <sys/param.h>

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

872 * Fill in fields, remembering maximum advertised
873 * window for use in delaying messages about window sizes.
874 * If resending a FIN, be sure not to use a new sequence number.
875 */
876 if (flags & TH_FIN && tp->t_flags & TF_SENTFIN &&
877 tp->snd_nxt == tp->snd_max)
878 tp->snd_nxt--;
879 /*
34
35#include "opt_inet.h"
36#include "opt_inet6.h"
37#include "opt_ipsec.h"
38#include "opt_mac.h"
39#include "opt_tcpdebug.h"
40
41#include <sys/param.h>

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

872 * Fill in fields, remembering maximum advertised
873 * window for use in delaying messages about window sizes.
874 * If resending a FIN, be sure not to use a new sequence number.
875 */
876 if (flags & TH_FIN && tp->t_flags & TF_SENTFIN &&
877 tp->snd_nxt == tp->snd_max)
878 tp->snd_nxt--;
879 /*
880 * If we are starting a connection, send ECN setup
881 * SYN packet. If we are on a retransmit, we may
882 * resend those bits a number of times as per
883 * RFC 3168.
884 */
885 if (tp->t_state == TCPS_SYN_SENT && tcp_do_ecn) {
886 if (tp->t_rxtshift >= 1) {
887 if (tp->t_rxtshift <= tcp_ecn_maxretries)
888 flags |= TH_ECE|TH_CWR;
889 } else
890 flags |= TH_ECE|TH_CWR;
891 }
892
893 if (tp->t_state == TCPS_ESTABLISHED &&
894 (tp->t_flags & TF_ECN_PERMIT)) {
895 /*
896 * If the peer has ECN, mark data packets with
897 * ECN capable transmission (ECT).
898 * Ignore pure ack packets, retransmissions and window probes.
899 */
900 if (len > 0 && SEQ_GEQ(tp->snd_nxt, tp->snd_max) &&
901 !((tp->t_flags & TF_FORCEDATA) && len == 1)) {
902#ifdef INET6
903 if (isipv6)
904 ip6->ip6_flow |= htonl(IPTOS_ECN_ECT0 << 20);
905 else
906#endif
907 ip->ip_tos |= IPTOS_ECN_ECT0;
908 tcpstat.tcps_ecn_ect0++;
909 }
910
911 /*
912 * Reply with proper ECN notifications.
913 */
914 if (tp->t_flags & TF_ECN_SND_CWR) {
915 flags |= TH_CWR;
916 tp->t_flags &= ~TF_ECN_SND_CWR;
917 }
918 if (tp->t_flags & TF_ECN_SND_ECE)
919 flags |= TH_ECE;
920 }
921
922 /*
880 * If we are doing retransmissions, then snd_nxt will
881 * not reflect the first unsent octet. For ACK only
882 * packets, we do not want the sequence number of the
883 * retransmitted packet, we want the sequence number
884 * of the next unsent octet. So, if there is no data
885 * (and no SYN or FIN), use snd_max instead of snd_nxt
886 * when filling in ti_seq. But if we are in persist
887 * state, snd_max might reflect one byte beyond the

--- 525 unchanged lines hidden ---
923 * If we are doing retransmissions, then snd_nxt will
924 * not reflect the first unsent octet. For ACK only
925 * packets, we do not want the sequence number of the
926 * retransmitted packet, we want the sequence number
927 * of the next unsent octet. So, if there is no data
928 * (and no SYN or FIN), use snd_max instead of snd_nxt
929 * when filling in ti_seq. But if we are in persist
930 * state, snd_max might reflect one byte beyond the

--- 525 unchanged lines hidden ---