BSD 4_3_Reno release
[unix-history] / usr / src / sys / netinet / tcp_output.c
index f1f6e7d..aef4809 100644 (file)
@@ -2,9 +2,22 @@
  * Copyright (c) 1982, 1986, 1988, 1990 Regents of the University of California.
  * All rights reserved.
  *
  * Copyright (c) 1982, 1986, 1988, 1990 Regents of the University of California.
  * All rights reserved.
  *
- * %sccs.include.redist.c%
+ * Redistribution is only permitted until one year after the first shipment
+ * of 4.4BSD by the Regents.  Otherwise, redistribution and use in source and
+ * binary forms are permitted provided that: (1) source distributions retain
+ * this entire copyright notice and comment, and (2) distributions including
+ * binaries display the following acknowledgement:  This product includes
+ * software developed by the University of California, Berkeley and its
+ * contributors'' in the documentation or other materials provided with the
+ * distribution and in all advertising materials mentioning features or use
+ * of this software.  Neither the name of the University nor the names of
+ * its contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
  *
- *     @(#)tcp_output.c        7.22 (Berkeley) %G%
+ *     @(#)tcp_output.c        7.21 (Berkeley) 6/28/90
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -151,11 +164,14 @@ again:
         * window, then want to send a window update to peer.
         */
        if (win > 0) {
         * window, then want to send a window update to peer.
         */
        if (win > 0) {
-               long adv = win - (tp->rcv_adv - tp->rcv_nxt);
+               int adv = win - (tp->rcv_adv - tp->rcv_nxt);
 
 
-               if (adv >= (long) (2 * tp->t_maxseg))
+               /* this was:                                    XXX
+                * if (so->so_rcv.sb_cc == 0 && adv >= 2 * tp->t_maxseg)
+                */
+               if (adv >= 2 * tp->t_maxseg)
                        goto send;
                        goto send;
-               if (2 * adv >= (long) so->so_rcv.sb_hiwat)
+               if (2 * adv >= so->so_rcv.sb_hiwat)
                        goto send;
        }
 
                        goto send;
        }
 
@@ -267,6 +283,11 @@ send:
                m->m_data += max_linkhdr;
                m->m_len = hdrlen;
                if (len <= MHLEN - hdrlen - max_linkhdr) {
                m->m_data += max_linkhdr;
                m->m_len = hdrlen;
                if (len <= MHLEN - hdrlen - max_linkhdr) {
+                       m_copydata(so->so_snd.sb_mb, off, (int) len,
+                           mtod(m, caddr_t) + hdrlen);
+                       m->m_len += len;
+               } else {
+                       m->m_next = m_copy(so->so_snd.sb_mb, off, (int) len);
                        if (m->m_next == 0)
                                len = 0;
                }
                        if (m->m_next == 0)
                                len = 0;
                }
@@ -328,8 +349,6 @@ send:
                win = TCP_MAXWIN;
        if (win < (long)(tp->rcv_adv - tp->rcv_nxt))
                win = (long)(tp->rcv_adv - tp->rcv_nxt);
                win = TCP_MAXWIN;
        if (win < (long)(tp->rcv_adv - tp->rcv_nxt))
                win = (long)(tp->rcv_adv - tp->rcv_nxt);
-       if (win > IP_MAXPACKET)
-               win = IP_MAXPACKET;
        ti->ti_win = htons((u_short)win);
        if (SEQ_GT(tp->snd_up, tp->snd_nxt)) {
                ti->ti_urp = htons((u_short)(tp->snd_up - tp->snd_nxt));
        ti->ti_win = htons((u_short)win);
        if (SEQ_GT(tp->snd_up, tp->snd_nxt)) {
                ti->ti_urp = htons((u_short)(tp->snd_up - tp->snd_nxt));
@@ -421,16 +440,11 @@ send:
        ((struct ip *)ti)->ip_ttl = tp->t_inpcb->inp_ip.ip_ttl; /* XXX */
        ((struct ip *)ti)->ip_tos = tp->t_inpcb->inp_ip.ip_tos; /* XXX */
 #if BSD >= 43
        ((struct ip *)ti)->ip_ttl = tp->t_inpcb->inp_ip.ip_ttl; /* XXX */
        ((struct ip *)ti)->ip_tos = tp->t_inpcb->inp_ip.ip_tos; /* XXX */
 #if BSD >= 43
-#if BSD>=43
        error = ip_output(m, tp->t_inpcb->inp_options, &tp->t_inpcb->inp_route,
            so->so_options & SO_DONTROUTE);
 #else
        error = ip_output(m, (struct mbuf *)0, &tp->t_inpcb->inp_route, 
            so->so_options & SO_DONTROUTE);
        error = ip_output(m, tp->t_inpcb->inp_options, &tp->t_inpcb->inp_route,
            so->so_options & SO_DONTROUTE);
 #else
        error = ip_output(m, (struct mbuf *)0, &tp->t_inpcb->inp_route, 
            so->so_options & SO_DONTROUTE);
-#endif
-#else
-       error = ip_output(m, (struct mbuf *)0, &tp->t_inpcb->inp_route, 
-                         so->so_options & SO_DONTROUTE);
 #endif
        if (error) {
 out:
 #endif
        if (error) {
 out: