Deleted Added
full compact
tcp_output.c (293284) tcp_output.c (293910)
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 293284 2016-01-07 00:14:42Z glebius $");
33__FBSDID("$FreeBSD: head/sys/netinet/tcp_output.c 293910 2016-01-14 10:22:45Z glebius $");
34
35#include "opt_inet.h"
36#include "opt_inet6.h"
37#include "opt_ipsec.h"
38#include "opt_tcpdebug.h"
39
40#include <sys/param.h>
41#include <sys/systm.h>

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

747 hdrlen = sizeof (struct tcpiphdr);
748
749 /*
750 * Compute options for segment.
751 * We only have to care about SYN and established connection
752 * segments. Options for SYN-ACK segments are handled in TCP
753 * syncache.
754 */
34
35#include "opt_inet.h"
36#include "opt_inet6.h"
37#include "opt_ipsec.h"
38#include "opt_tcpdebug.h"
39
40#include <sys/param.h>
41#include <sys/systm.h>

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

747 hdrlen = sizeof (struct tcpiphdr);
748
749 /*
750 * Compute options for segment.
751 * We only have to care about SYN and established connection
752 * segments. Options for SYN-ACK segments are handled in TCP
753 * syncache.
754 */
755 to.to_flags = 0;
755 if ((tp->t_flags & TF_NOOPT) == 0) {
756 if ((tp->t_flags & TF_NOOPT) == 0) {
756 to.to_flags = 0;
757 /* Maximum segment size. */
758 if (flags & TH_SYN) {
759 tp->snd_nxt = tp->iss;
760 to.to_mss = tcp_mssopt(&tp->t_inpcb->inp_inc);
761 to.to_flags |= TOF_MSS;
762#ifdef TCP_RFC7413
763 /*
764 * Only include the TFO option on the first

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

1228 * If no urgent pointer to send, then we pull
1229 * the urgent pointer to the left edge of the send window
1230 * so that it doesn't drift into the send window on sequence
1231 * number wraparound.
1232 */
1233 tp->snd_up = tp->snd_una; /* drag it along */
1234
1235#ifdef TCP_SIGNATURE
757 /* Maximum segment size. */
758 if (flags & TH_SYN) {
759 tp->snd_nxt = tp->iss;
760 to.to_mss = tcp_mssopt(&tp->t_inpcb->inp_inc);
761 to.to_flags |= TOF_MSS;
762#ifdef TCP_RFC7413
763 /*
764 * Only include the TFO option on the first

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

1228 * If no urgent pointer to send, then we pull
1229 * the urgent pointer to the left edge of the send window
1230 * so that it doesn't drift into the send window on sequence
1231 * number wraparound.
1232 */
1233 tp->snd_up = tp->snd_una; /* drag it along */
1234
1235#ifdef TCP_SIGNATURE
1236 if (tp->t_flags & TF_SIGNATURE) {
1236 if (to.to_flags & TOF_SIGNATURE) {
1237 int sigoff = to.to_signature - opt;
1238 tcp_signature_compute(m, 0, len, optlen,
1239 (u_char *)(th + 1) + sigoff, IPSEC_DIR_OUTBOUND);
1240 }
1241#endif
1242
1243 /*
1244 * Put TCP length in extended header, and then

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

1708 *optp++ = TCPOLEN_TIMESTAMP;
1709 to->to_tsval = htonl(to->to_tsval);
1710 to->to_tsecr = htonl(to->to_tsecr);
1711 bcopy((u_char *)&to->to_tsval, optp, sizeof(to->to_tsval));
1712 optp += sizeof(to->to_tsval);
1713 bcopy((u_char *)&to->to_tsecr, optp, sizeof(to->to_tsecr));
1714 optp += sizeof(to->to_tsecr);
1715 break;
1237 int sigoff = to.to_signature - opt;
1238 tcp_signature_compute(m, 0, len, optlen,
1239 (u_char *)(th + 1) + sigoff, IPSEC_DIR_OUTBOUND);
1240 }
1241#endif
1242
1243 /*
1244 * Put TCP length in extended header, and then

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

1708 *optp++ = TCPOLEN_TIMESTAMP;
1709 to->to_tsval = htonl(to->to_tsval);
1710 to->to_tsecr = htonl(to->to_tsecr);
1711 bcopy((u_char *)&to->to_tsval, optp, sizeof(to->to_tsval));
1712 optp += sizeof(to->to_tsval);
1713 bcopy((u_char *)&to->to_tsecr, optp, sizeof(to->to_tsecr));
1714 optp += sizeof(to->to_tsecr);
1715 break;
1716#ifdef TCP_SIGNATURE
1716 case TOF_SIGNATURE:
1717 {
1718 int siglen = TCPOLEN_SIGNATURE - 2;
1719
1720 while (!optlen || optlen % 4 != 2) {
1721 optlen += TCPOLEN_NOP;
1722 *optp++ = TCPOPT_NOP;
1723 }
1724 if (TCP_MAXOLEN - optlen < TCPOLEN_SIGNATURE)
1725 continue;
1726 optlen += TCPOLEN_SIGNATURE;
1727 *optp++ = TCPOPT_SIGNATURE;
1728 *optp++ = TCPOLEN_SIGNATURE;
1729 to->to_signature = optp;
1730 while (siglen--)
1731 *optp++ = 0;
1732 break;
1733 }
1717 case TOF_SIGNATURE:
1718 {
1719 int siglen = TCPOLEN_SIGNATURE - 2;
1720
1721 while (!optlen || optlen % 4 != 2) {
1722 optlen += TCPOLEN_NOP;
1723 *optp++ = TCPOPT_NOP;
1724 }
1725 if (TCP_MAXOLEN - optlen < TCPOLEN_SIGNATURE)
1726 continue;
1727 optlen += TCPOLEN_SIGNATURE;
1728 *optp++ = TCPOPT_SIGNATURE;
1729 *optp++ = TCPOLEN_SIGNATURE;
1730 to->to_signature = optp;
1731 while (siglen--)
1732 *optp++ = 0;
1733 break;
1734 }
1735#endif
1734 case TOF_SACK:
1735 {
1736 int sackblks = 0;
1737 struct sackblk *sack = (struct sackblk *)to->to_sacks;
1738 tcp_seq sack_seq;
1739
1740 while (!optlen || optlen % 4 != 2) {
1741 optlen += TCPOLEN_NOP;

--- 66 unchanged lines hidden ---
1736 case TOF_SACK:
1737 {
1738 int sackblks = 0;
1739 struct sackblk *sack = (struct sackblk *)to->to_sacks;
1740 tcp_seq sack_seq;
1741
1742 while (!optlen || optlen % 4 != 2) {
1743 optlen += TCPOLEN_NOP;

--- 66 unchanged lines hidden ---