hack keepalives for now (for Ultrix, at least)
authorMike Karels <karels@ucbvax.Berkeley.EDU>
Fri, 3 Apr 1987 07:32:36 +0000 (23:32 -0800)
committerMike Karels <karels@ucbvax.Berkeley.EDU>
Fri, 3 Apr 1987 07:32:36 +0000 (23:32 -0800)
SCCS-vsn: sys/netinet/tcp_timer.c 7.3
SCCS-vsn: sys/netinet/tcp_subr.c 7.4

usr/src/sys/netinet/tcp_subr.c
usr/src/sys/netinet/tcp_timer.c

index c76dc07..5f034f6 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)tcp_subr.c  7.3 (Berkeley) %G%
+ *     @(#)tcp_subr.c  7.4 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -102,9 +102,10 @@ tcp_respond(tp, ti, ack, seq, flags)
        tcp_seq ack, seq;
        int flags;
 {
        tcp_seq ack, seq;
        int flags;
 {
-       struct mbuf *m;
+       register struct mbuf *m;
        int win = 0, tlen;
        struct route *ro = 0;
        int win = 0, tlen;
        struct route *ro = 0;
+       extern int tcp_keeplen;
 
        if (tp) {
                win = sbspace(&tp->t_inpcb->inp_socket->so_rcv);
 
        if (tp) {
                win = sbspace(&tp->t_inpcb->inp_socket->so_rcv);
@@ -114,7 +115,8 @@ tcp_respond(tp, ti, ack, seq, flags)
                m = m_get(M_DONTWAIT, MT_HEADER);
                if (m == NULL)
                        return;
                m = m_get(M_DONTWAIT, MT_HEADER);
                if (m == NULL)
                        return;
-               m->m_len = sizeof (struct tcpiphdr) + 1;
+               tlen = tcp_keeplen;
+               m->m_len = sizeof (struct tcpiphdr) + tlen;
                *mtod(m, struct tcpiphdr *) = *ti;
                ti = mtod(m, struct tcpiphdr *);
                flags = TH_ACK;
                *mtod(m, struct tcpiphdr *) = *ti;
                ti = mtod(m, struct tcpiphdr *);
                flags = TH_ACK;
@@ -123,13 +125,13 @@ tcp_respond(tp, ti, ack, seq, flags)
                m_freem(m->m_next);
                m->m_next = 0;
                m->m_off = (int)ti - (int)m;
                m_freem(m->m_next);
                m->m_next = 0;
                m->m_off = (int)ti - (int)m;
+               tlen = 0;
                m->m_len = sizeof (struct tcpiphdr);
 #define xchg(a,b,type) { type t; t=a; a=b; b=t; }
                xchg(ti->ti_dst.s_addr, ti->ti_src.s_addr, u_long);
                xchg(ti->ti_dport, ti->ti_sport, u_short);
 #undef xchg
        }
                m->m_len = sizeof (struct tcpiphdr);
 #define xchg(a,b,type) { type t; t=a; a=b; b=t; }
                xchg(ti->ti_dst.s_addr, ti->ti_src.s_addr, u_long);
                xchg(ti->ti_dport, ti->ti_sport, u_short);
 #undef xchg
        }
-       tlen = 0;
        ti->ti_next = ti->ti_prev = 0;
        ti->ti_x1 = 0;
        ti->ti_len = htons((u_short)(sizeof (struct tcphdr) + tlen));
        ti->ti_next = ti->ti_prev = 0;
        ti->ti_x1 = 0;
        ti->ti_len = htons((u_short)(sizeof (struct tcphdr) + tlen));
index 529a52a..37ddcf7 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)tcp_timer.c 7.2 (Berkeley) %G%
+ *     @(#)tcp_timer.c 7.3 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -114,6 +114,12 @@ tcp_canceltimers(tp)
 
 int    tcp_backoff[TCP_MAXRXTSHIFT+1] =
     { 1, 2, 4, 6, 8, 10, 15, 20, 30, 30, 30, 30, 30 };
 
 int    tcp_backoff[TCP_MAXRXTSHIFT+1] =
     { 1, 2, 4, 6, 8, 10, 15, 20, 30, 30, 30, 30, 30 };
+#ifdef TCP_COMPAT_42
+int    tcp_keeplen = 1;
+#else
+int    tcp_keeplen = 0;
+#endif
+
 /*
  * TCP timer processing.
  */
 /*
  * TCP timer processing.
  */
@@ -215,8 +221,8 @@ tcp_timers(tp, timer)
                         * correspondent TCP to respond.
                         */
                        tcpstat.tcps_keepprobe++;
                         * correspondent TCP to respond.
                         */
                        tcpstat.tcps_keepprobe++;
-                       tcp_respond(tp,
-                           tp->t_template, tp->rcv_nxt, tp->snd_una-1, 0);
+                       tcp_respond(tp, tp->t_template,
+                           tp->rcv_nxt - tcp_keeplen, tp->snd_una - 1, 0);
                }
                tp->t_timer[TCPT_KEEP] = TCPTV_KEEP;
                break;
                }
                tp->t_timer[TCPT_KEEP] = TCPTV_KEEP;
                break;