first listing
authorBill Joy <wnj@ucbvax.Berkeley.EDU>
Mon, 9 Nov 1981 08:36:55 +0000 (00:36 -0800)
committerBill Joy <wnj@ucbvax.Berkeley.EDU>
Mon, 9 Nov 1981 08:36:55 +0000 (00:36 -0800)
SCCS-vsn: sys/vax/vax/in_cksum.c 1.8
SCCS-vsn: sys/netinet/tcp_fsm.h 4.3
SCCS-vsn: sys/netinet/tcp_usrreq.c 1.26

usr/src/sys/netinet/tcp_usrreq.c
usr/src/sys/vax/vax/in_cksum.c

index e6fbd69..dfe68ea 100644 (file)
@@ -1,19 +1,35 @@
-/* tcp_usrreq.c 1.25 81/11/04 */
+/* tcp_usrreq.c 1.26 81/11/08 */
 
 #include "../h/param.h"
 #include "../h/systm.h"
 #include "../h/mbuf.h"
 #include "../h/socket.h"
 
 #include "../h/param.h"
 #include "../h/systm.h"
 #include "../h/mbuf.h"
 #include "../h/socket.h"
-#include "../inet/inet.h"
-#include "../inet/inet_systm.h"
-#include "../inet/imp.h"
-#include "../inet/ip.h"
-#include "../inet/tcp.h"
+#include "../h/socketvar.h"
+#include "../h/protosw.h"
+#include "../net/inet.h"
+#include "../net/inet_systm.h"
+#include "../net/imp.h"
+#include "../net/ip.h"
+#include "../net/tcp.h"
 #define TCPFSTAB
 #ifdef TCPDEBUG
 #define TCPSTATES
 #endif
 #define TCPFSTAB
 #ifdef TCPDEBUG
 #define TCPSTATES
 #endif
-#include "../inet/tcp_fsm.h"
+#include "../net/tcp_fsm.h"
+#include "../net/tcp_var.h"
+#include "/usr/include/errno.h"
+
+struct tcb *tcp_attach();
+
+/*
+ * Tcp initialization
+ */
+tcp_init()
+{
+
+       tcp_iss = 1;            /* wrong */
+       tcb.tcb_next = tcb.tcb_prev = (struct tcb *)&tcb;
+}
 
 /*
  * Tcp finite state machine entries for timer and user generated
 
 /*
  * Tcp finite state machine entries for timer and user generated
  */
 
 /*
  */
 
 /*
- * Tcp protocol timeout routine called once per second.
+ * Tcp protocol timeout routine called every 500 ms.
  * Updates the timers in all active tcb's and
  * causes finite state machine actions if timers expire.
  */
  * Updates the timers in all active tcb's and
  * causes finite state machine actions if timers expire.
  */
-tcp_timeo()
+tcp_slowtimo()
 {
        register struct tcb *tp;
        int s = splnet();
 {
        register struct tcb *tp;
        int s = splnet();
-       register u_char *tmp;
+       register short *tmp;
        register int i;
 COUNT(TCP_TIMEO);
 
        /*
         * Search through tcb's and update active timers.
         */
        register int i;
 COUNT(TCP_TIMEO);
 
        /*
         * Search through tcb's and update active timers.
         */
-       for (tp = tcb.tcb_next; tp != (struct tcb *)&tcb; tp = tp->tcb_next) {
+       tp = tcb.tcb_next;
+       for (; tp != (struct tcb *)&tcb; tp = tp->tcb_hd.tcb_next) {
                tmp = &tp->t_init;
                for (i = 0; i < TNTIMERS; i++) {
                        if (*tmp && --*tmp == 0)
                tmp = &tp->t_init;
                for (i = 0; i < TNTIMERS; i++) {
                        if (*tmp && --*tmp == 0)
-                               tcp_usrreq(ISTIMER, i, tp, 0);
+                               tcp_usrreq(tp->t_socket, PRU_SLOWTIMO, 0, i);
                        tmp++;
                }
                tp->t_xmt++;
        }
                        tmp++;
                }
                tp->t_xmt++;
        }
-       tcp_iss += ISSINCR;             /* increment iss */
-       timeout(tcp_timeo, 0, hz);      /* reschedule every second */
+       tcp_iss += ISSINCR/2;           /* increment iss */
        splx(s);
 }
 
        splx(s);
 }
 
@@ -60,7 +76,7 @@ COUNT(TCP_TIMEO);
 tcp_tcancel(tp)
        struct tcb *tp;
 {
 tcp_tcancel(tp)
        struct tcb *tp;
 {
-       register u_char *tmp = &tp->t_init;
+       register short *tmp = &tp->t_init;
        register int i;
 
        for (i = 0; i < TNTIMERS; i++)
        register int i;
 
        for (i = 0; i < TNTIMERS; i++)
@@ -72,61 +88,82 @@ tcp_tcancel(tp)
  * then m is the mbuf chain of send data.  If this is a timer expiration
  * (called from the software clock routine), then timertype tells which timer.
  */
  * then m is the mbuf chain of send data.  If this is a timer expiration
  * (called from the software clock routine), then timertype tells which timer.
  */
-tcp_usrreq(input, timertype, tp, m)
-       int input, timertype;
-       register struct tcb *tp;
+tcp_usrreq(so, req, m, addr)
+       struct socket *so;
+       int req;
        struct mbuf *m;
        struct mbuf *m;
+       caddr_t addr;
 {
 {
+       register struct tcb *tp = (struct tcb *)so->so_pcb;
        int s = splnet();
        register int nstate;
 #ifdef TCPDEBUG
        struct tcp_debug tdb;
 #endif
        int s = splnet();
        register int nstate;
 #ifdef TCPDEBUG
        struct tcp_debug tdb;
 #endif
+       int error = 0;
 COUNT(TCP_USRREQ);
 
 COUNT(TCP_USRREQ);
 
-       nstate = tp->t_state;
-       tp->tc_flags &= ~TC_NET_KEEP;
+       if (tp) {
+               nstate = tp->t_state;
+               tp->tc_flags &= ~TC_NET_KEEP;
+       } else 
+               if (req != PRU_ATTACH)
+                       return (ENOTCONN);
 #ifdef KPROF
 #ifdef KPROF
-       acounts[nstate][input]++;
+       acounts[nstate][req]++;
 #endif
 #ifdef TCPDEBUG
 #endif
 #ifdef TCPDEBUG
-       if ((tp->t_ucb->uc_flags & UDEBUG) || tcpconsdebug) {
-               tdb_setup(tp, (struct th *)0, input, &tdb);
+       if (tp && ((tp->t_socket->so_options & SO_DEBUG) || tcpconsdebug)) {
+               tdb_setup(tp, (struct th *)0, req, &tdb);
                tdb.td_tim = timertype;
        } else
                tdb.td_tod = 0;
 #endif
                tdb.td_tim = timertype;
        } else
                tdb.td_tod = 0;
 #endif
-       switch (input) {
+       switch (req) {
 
        /*
 
        /*
-        * Passive open.  Create a tcp control block
-        * and enter listen state.
+        * Attach a tcp control block to this socket.
+        * TCP is not multicast, so this is possible
+        * only if no connection currently exists.
         */
         */
-       case IUOPENA:
-               if (nstate != 0 && nstate != CLOSED)
-                       goto bad;
-               tcp_open(tp, PASSIVE);
-               nstate = LISTEN;
+       case PRU_ATTACH:
+               if (tp)
+                       error = EISCONN;
+               else
+                       tp = tcp_attach(so, &error);
+               nstate = CLOSED;
                break;
 
        /*
                break;
 
        /*
-        * Active open.  Create a tcp control block,
-        * send a SYN and enter SYN_SENT state.
+        * Detach the TCP from this socket.  This
+        * is possible only if a connection currently exists.
         */
         */
-       case IUOPENR:
+       case PRU_DETACH:
+               so->so_pcb = 0;
+               break;
+
+       /*
+        * Form connection: send a SYN.
+        */
+       case PRU_CONNECT:
                if (nstate != 0 && nstate != CLOSED)
                        goto bad;
                if (nstate != 0 && nstate != CLOSED)
                        goto bad;
-               tcp_open(tp, ACTIVE);
                tcp_sndctl(tp);
                nstate = SYN_SENT;
                break;
 
                tcp_sndctl(tp);
                nstate = SYN_SENT;
                break;
 
+       case PRU_DISCONNECT:
+               so->so_pcb = 0;
+               tcp_destroy(tp);
+               break;
+
        /*
        /*
-        * Tcp close call.  Can be generated by a user ioctl (half-close),
+        * Declare no further transmissions.
+        * Can be generated by a user ioctl (half-close),
         * or when higher level close occurs, if a close hasn't happened
         * already.
         */
         * or when higher level close occurs, if a close hasn't happened
         * already.
         */
-       case IUCLOSE:
+       case PRU_SHUTDOWN:
                switch (nstate) {
 
                /*
                switch (nstate) {
 
                /*
@@ -136,7 +173,6 @@ COUNT(TCP_USRREQ);
                 */
                case LISTEN:
                case SYN_SENT:
                 */
                case LISTEN:
                case SYN_SENT:
-                       tcp_close(tp, UCLOSED);
                        nstate = CLOSED;
                        break;
 
                        nstate = CLOSED;
                        break;
 
@@ -174,7 +210,6 @@ COUNT(TCP_USRREQ);
                case CLOSING:
                case LAST_ACK:
                case RCV_WAIT:
                case CLOSING:
                case LAST_ACK:
                case RCV_WAIT:
-                       to_user(tp->t_ucb, UCLSERR);
                        break;
 
                default:
                        break;
 
                default:
@@ -182,24 +217,6 @@ COUNT(TCP_USRREQ);
                }
                break;
 
                }
                break;
 
-       /*
-        * TCP Timer processing.
-        * Timers should expire only on open connections
-        * not in LISTEN state.
-        */
-       case ISTIMER:
-               switch (nstate) {
-
-               case 0:
-               case CLOSED:
-               case LISTEN:
-                       goto bad;
-
-               default:
-                       nstate = tcp_timers(tp, timertype);
-               }
-               break;
-
        /*
         * User notification of more window availability after
         * reading out data.  This should not happen before a connection
        /*
         * User notification of more window availability after
         * reading out data.  This should not happen before a connection
@@ -210,18 +227,16 @@ COUNT(TCP_USRREQ);
         * out of the TCP buffers after foreign close) and there
         * is no more data, institute a close.
         */
         * out of the TCP buffers after foreign close) and there
         * is no more data, institute a close.
         */
-       case IURECV:
+       case PRU_RCVD:
                if (nstate < ESTAB || nstate == CLOSED)
                        goto bad;
                tcp_sndwin(tp);
                if ((tp->tc_flags&TC_FIN_RCVD) &&
                    (tp->tc_flags&TC_USR_CLOSED) == 0 &&
                    rcv_empty(tp))
                if (nstate < ESTAB || nstate == CLOSED)
                        goto bad;
                tcp_sndwin(tp);
                if ((tp->tc_flags&TC_FIN_RCVD) &&
                    (tp->tc_flags&TC_USR_CLOSED) == 0 &&
                    rcv_empty(tp))
-                       to_user(tp, UCLOSED);
-               if (nstate == RCV_WAIT && rcv_empty(tp)) {
-                       tcp_close(tp, UCLOSED);
+                       tcp_error(tp, ESHUTDOWN);
+               if (nstate == RCV_WAIT && rcv_empty(tp))
                        nstate = CLOSED;
                        nstate = CLOSED;
-               }
                break;
 
        /*
                break;
 
        /*
@@ -230,7 +245,7 @@ COUNT(TCP_USRREQ);
         * Allowed only on ESTAB connection and after FIN from
         * foreign peer.
         */
         * Allowed only on ESTAB connection and after FIN from
         * foreign peer.
         */
-       case IUSEND:
+       case PRU_SEND:
                switch (nstate) {
 
                case ESTAB:
                switch (nstate) {
 
                case ESTAB:
@@ -241,7 +256,8 @@ COUNT(TCP_USRREQ);
                default:
                        if (nstate < ESTAB)
                                goto bad;
                default:
                        if (nstate < ESTAB)
                                goto bad;
-                       to_user(tp, UCLSERR);
+                       m_freem(m);
+                       /* tcp_user(tp, UCLSERR); */
                        break;
                }
                break;
                        break;
                }
                break;
@@ -252,7 +268,7 @@ COUNT(TCP_USRREQ);
         * then we need to send an RST.  In any case we then 
         * enter closed state.
         */
         * then we need to send an RST.  In any case we then 
         * enter closed state.
         */
-       case IUABORT:
+       case PRU_ABORT:
                if (nstate == 0 || nstate == CLOSED)
                        break;
                switch (nstate) {
                if (nstate == 0 || nstate == CLOSED)
                        break;
                switch (nstate) {
@@ -271,7 +287,6 @@ COUNT(TCP_USRREQ);
                        /* fall into ... */
 
                default:
                        /* fall into ... */
 
                default:
-                       tcp_close(tp, UABORT);
                        nstate = CLOSED;
                }
                break;
                        nstate = CLOSED;
                }
                break;
@@ -280,18 +295,41 @@ COUNT(TCP_USRREQ);
         * Network down entry.  Discard the tcb and force
         * the state to be closed, ungracefully.
         */
         * Network down entry.  Discard the tcb and force
         * the state to be closed, ungracefully.
         */
-       case INCLEAR:
+       case PRU_CLEAR:
                if (nstate == 0 || nstate == CLOSED)
                        break;
                if (nstate == 0 || nstate == CLOSED)
                        break;
-               tcp_close(tp, UNETDWN);
                nstate = CLOSED;
                break;
 
                nstate = CLOSED;
                break;
 
+       /*
+        * Ioctl on protocols.
+        */
+       case PRU_CONTROL:
+               break;
+
+       /*
+        * TCP Timer processing.
+        * Timers should expire only on open connections
+        * not in LISTEN state.
+        */
+       case PRU_SLOWTIMO:
+               switch (nstate) {
+
+               case 0:
+               case CLOSED:
+               case LISTEN:
+                       goto bad;
+
+               default:
+                       nstate = tcp_timers(tp, (int)addr);
+               }
+               break;
+
        default:
                panic("tcp_usrreq");
        bad:
                printf("tcp: bad state: tcb=%x state=%d input=%d\n",
        default:
                panic("tcp_usrreq");
        bad:
                printf("tcp: bad state: tcb=%x state=%d input=%d\n",
-                   tp, tp->t_state, input);
+                   tp, tp->t_state, req);
                nstate = EFAILEC;
                break;
        }
                nstate = EFAILEC;
                break;
        }
@@ -318,25 +356,30 @@ COUNT(TCP_USRREQ);
        splx(s);
 }
 
        splx(s);
 }
 
+tcp_sense()
+{
+
+}
+
 /*
  * Open routine, called to initialize newly created tcb fields.
  */
 /*
  * Open routine, called to initialize newly created tcb fields.
  */
-tcp_open(tp, mode)
-       register struct tcb *tp;
-       int mode;
+struct tcb *
+tcp_attach(so)
+       register struct socket *so;
 {
 {
-       register struct ucb *up = tp->t_ucb;
-COUNT(TCP_OPEN);
+       register struct tcb *tp;
+COUNT(TCP_ATTACH);
 
        /*
         * Link in tcb queue and make
         * initialize empty reassembly queue.
         */
 
        /*
         * Link in tcb queue and make
         * initialize empty reassembly queue.
         */
-       tp->tcb_next = tcb.tcb_next;
-       tcb.tcb_next->tcb_prev = tp;
-       tp->tcb_prev = (struct tcb *)&tcb;
+       tp->tcb_hd.tcb_next = tcb.tcb_next;
+       tcb.tcb_next->tcb_hd.tcb_prev = tp;
+       tp->tcb_hd.tcb_prev = (struct tcb *)&tcb;
        tcb.tcb_next = tp;
        tcb.tcb_next = tp;
-       tp->t_rcv_next = tp->t_rcv_prev = (struct th *)tp;
+       tp->tcb_hd.seg_next = tp->tcb_hd.seg_prev = (struct th *)tp;
 
        /*
         * Initialize sequence numbers and
 
        /*
         * Initialize sequence numbers and
@@ -348,84 +391,60 @@ COUNT(TCP_OPEN);
            tp->iss = tcp_iss;
        tp->snd_off = tp->iss + 1;
        tcp_iss += (ISSINCR >> 1) + 1;
            tp->iss = tcp_iss;
        tp->snd_off = tp->iss + 1;
        tcp_iss += (ISSINCR >> 1) + 1;
-
-       /*
-        * Set timeout for open.
-        * SHOULD THIS BE A HIGHER LEVEL FUNCTION!?! THINK SO.
-        */
-       if (up->uc_timeo)
-               tp->t_init = up->uc_timeo;
-       else if (mode == ACTIVE)
-               tp->t_init = T_INIT;
-       /* else
-               tp->t_init = 0; */
-       up->uc_timeo = 0;                               /* ### */
 }
 
 /*
 }
 
 /*
- * Internal close of a connection, shutting down the tcb.
+ * Destroy a tcb.
  */
  */
-tcp_close(tp, state)
+tcp_detach(tp)
        register struct tcb *tp;
        register struct tcb *tp;
-       short state;
 {
 {
-       register struct ucb *up = tp->t_ucb;
+       register struct socket *so = tp->t_socket;
        register struct th *t;
        register struct mbuf *m;
        register struct th *t;
        register struct mbuf *m;
-COUNT(TCP_CLOSE);
+COUNT(TCP_DETACH);
 
        /*
         * Remove from tcb queue and cancel timers.
         */
 
        /*
         * Remove from tcb queue and cancel timers.
         */
-       tp->tcb_prev->tcb_next = tp->tcb_next;
-       tp->tcb_next->tcb_prev = tp->tcb_prev;
+       tp->tcb_hd.tcb_prev->tcb_hd.tcb_next = tp->tcb_hd.tcb_next;
+       tp->tcb_hd.tcb_next->tcb_hd.tcb_prev = tp->tcb_hd.tcb_prev;
        tcp_tcancel(tp);
 
        /*
         * Discard all buffers.
         */
        tcp_tcancel(tp);
 
        /*
         * Discard all buffers.
         */
-       for (t = tp->t_rcv_next; t != (struct th *)tp; t = t->t_next)
+       for (t = tp->tcb_hd.seg_next; t != (struct th *)tp; t = t->t_next)
                m_freem(dtom(t));
                m_freem(dtom(t));
-       if (up->uc_rbuf) {
-               m_freem(up->uc_rbuf);
-               up->uc_rbuf = NULL;
-       }
-       up->uc_rcc = 0;
-       if (up->uc_sbuf) {
-               m_freem(up->uc_sbuf);
-               up->uc_sbuf = NULL;
-       }
-       up->uc_ssize = 0;
-       for (m = tp->t_rcv_unack; m != NULL; m = m->m_act) {
+       if (so->so_rcv.sb_mb)
+           { m_freem(so->so_rcv.sb_mb); so->so_rcv.sb_mb = 0; }
+       so->so_rcv.sb_cc = 0; so->so_rcv.sb_mbcnt = 0;
+       if (so->so_snd.sb_mb)
+           { m_freem(so->so_snd.sb_mb); so->so_rcv.sb_mb = 0; }
+       so->so_snd.sb_cc = 0; so->so_snd.sb_mbcnt = 0;
+
+       for (m = tp->seg_unack; m; m = m->m_act)
                m_freem(m);
                m_freem(m);
-               tp->t_rcv_unack = NULL;
+       tp->seg_unack = 0;
+
+       /*
+        * Free routing table entry.
+        */
+       if (tp->t_host) {
+               h_free(tp->t_host);
+               tp->t_host = 0;
        }
 
        /*
         * Free tcp send template, the tcb itself,
        }
 
        /*
         * Free tcp send template, the tcb itself,
-        * the routing table entry, and the space we had reserved
-        * in the meory pool.
+        * and the space we had reserved in the meory pool.
         */
        if (tp->t_template) {
                m_free(dtom(tp->t_template));
                tp->t_template = 0;
        }
        wmemfree((caddr_t)tp, 1024);
         */
        if (tp->t_template) {
                m_free(dtom(tp->t_template));
                tp->t_template = 0;
        }
        wmemfree((caddr_t)tp, 1024);
-       up->uc_pcb = 0;
-       if (up->uc_host) {
-               h_free(up->uc_host);
-               up->uc_host = 0;
-       }
-       m_release(up->uc_snd + (up->uc_rhiwat/MSIZE) + 2);
-
-       /*
-        * If user has initiated close (via close call), delete ucb
-        * entry, otherwise just wakeup so user can issue close call
-        */
-       if (tp->tc_flags&TC_USR_ABORT)                  /* ### */
-               up->uc_proc = NULL;                     /* ### */
-       else                                            /* ### */
-               to_user(up, state);                     /* ### */
+       m_release(so->so_rcv.sb_hiwat + so->so_snd.sb_hiwat + 2 * MSIZE);
 }
 
 /*
 }
 
 /*
@@ -436,20 +455,20 @@ tcp_usrsend(tp, m0)
        struct mbuf *m0;
 {
        register struct mbuf *m, *n;
        struct mbuf *m0;
 {
        register struct mbuf *m, *n;
-       register struct ucb *up = tp->t_ucb;
+       register struct socket *so = tp->t_socket;
        register off;
        seq_t last;
 COUNT(TCP_USRSEND);
 
        last = tp->snd_off;
        for (m = n = m0; m != NULL; m = m->m_next) {
        register off;
        seq_t last;
 COUNT(TCP_USRSEND);
 
        last = tp->snd_off;
        for (m = n = m0; m != NULL; m = m->m_next) {
-               up->uc_ssize++;
+               so->so_snd.sb_mbcnt++;
                if (m->m_off > MMAXOFF)
                if (m->m_off > MMAXOFF)
-                       up->uc_ssize += NMBPG;
+                       so->so_snd.sb_mbcnt += NMBPG;
                last += m->m_len;
        }
                last += m->m_len;
        }
-       if ((m = up->uc_sbuf) == NULL)
-               up->uc_sbuf = n;
+       if ((m = so->so_snd.sb_mb) == NULL)
+               so->so_snd.sb_mb = n;
        else {
                while (m->m_next != NULL) {
                        m = m->m_next;
        else {
                while (m->m_next != NULL) {
                        m = m->m_next;
@@ -464,15 +483,15 @@ COUNT(TCP_USRSEND);
                                      (caddr_t)((int)m + off), n->m_len);
                                m->m_len += n->m_len;
                                off += n->m_len;
                                      (caddr_t)((int)m + off), n->m_len);
                                m->m_len += n->m_len;
                                off += n->m_len;
-                               up->uc_ssize--;
+                               so->so_snd.sb_mbcnt--;
                                n = m_free(n);
                        }
                }
                m->m_next = n;
        }
                                n = m_free(n);
                        }
                }
                m->m_next = n;
        }
-       if (up->uc_flags & UEOL)
+       if (tp->t_options & TO_EOL)
                tp->snd_end = last;
                tp->snd_end = last;
-       if (up->uc_flags & UURG) {
+       if (tp->t_options & TO_URG) {
                tp->snd_urp = last+1;
                tp->tc_flags |= TC_SND_URG;
        }
                tp->snd_urp = last+1;
                tp->tc_flags |= TC_SND_URG;
        }
@@ -493,7 +512,7 @@ COUNT(TCP_TIMERS);
 
        case TINIT:             /* initialization timer */
                if ((tp->tc_flags&TC_SYN_ACKED) == 0) {         /* 35 */
 
        case TINIT:             /* initialization timer */
                if ((tp->tc_flags&TC_SYN_ACKED) == 0) {         /* 35 */
-                       tcp_close(tp, UINTIMO);
+/* XXX */              /* tcp_close(tp, UINTIMO); */
                        return (CLOSED);
                }
                return (SAME);
                        return (CLOSED);
                }
                return (SAME);
@@ -507,7 +526,7 @@ COUNT(TCP_TIMERS);
                         * and can close if no data left for user.
                         */
                        if (rcv_empty(tp)) {
                         * and can close if no data left for user.
                         */
                        if (rcv_empty(tp)) {
-                               tcp_close(tp, UCLOSED);         /* 14 */
+/* XXX */                      /* tcp_close(tp, UCLOSED); */   /* 14 */
                                return (CLOSED);
                        }
                        return (RCV_WAIT);                      /* 17 */
                                return (CLOSED);
                        }
                        return (RCV_WAIT);                      /* 17 */
@@ -523,7 +542,7 @@ COUNT(TCP_TIMERS);
        case TREXMT:            /* retransmission timer */
                if (tp->t_rexmt_val > tp->snd_una) {            /* 34 */
                        /*
        case TREXMT:            /* retransmission timer */
                if (tp->t_rexmt_val > tp->snd_una) {            /* 34 */
                        /*
-                        * Set up for a retransmission, increase rexmt time
+                        * Set so for a retransmission, increase rexmt time
                         * in case of multiple retransmissions.
                         */
                        tp->snd_nxt = tp->snd_una;
                         * in case of multiple retransmissions.
                         */
                        tp->snd_nxt = tp->snd_una;
@@ -537,12 +556,12 @@ COUNT(TCP_TIMERS);
 
        case TREXMTTL:          /* retransmit too long */
                if (tp->t_rtl_val > tp->snd_una)                /* 36 */
 
        case TREXMTTL:          /* retransmit too long */
                if (tp->t_rtl_val > tp->snd_una)                /* 36 */
-                       to_user(tp->t_ucb, URXTIMO);
+/* XXX */              /* to_user(tp->t_socket, URXTIMO); */;
                /*
                 * If user has already closed, abort the connection.
                 */
                if (tp->tc_flags & TC_USR_CLOSED) {
                /*
                 * If user has already closed, abort the connection.
                 */
                if (tp->tc_flags & TC_USR_CLOSED) {
-                       tcp_close(tp, URXTIMO);
+/* XXX */              /* tcp_close(tp, URXTIMO); */
                        return (CLOSED);
                }
                return (SAME);
                        return (CLOSED);
                }
                return (SAME);
@@ -558,17 +577,14 @@ COUNT(TCP_TIMERS);
        panic("tcp_timers");
 }
 
        panic("tcp_timers");
 }
 
-/* THIS ROUTINE IS A CROCK */
-to_user(up, state)
-       register struct ucb *up;
-       register short state;
+tcp_error(so, errno)
+       struct socket *so;
+       int errno;
 {
 COUNT(TO_USER);
 
 {
 COUNT(TO_USER);
 
-       up->uc_state |= state;
-       netwakeup(up);
-       if (state == UURGENT)
-               psignal(up->uc_proc, SIGURG);
+       so->so_error = errno;
+       sowakeup(so);
 }
 
 #ifdef TCPDEBUG
 }
 
 #ifdef TCPDEBUG
index ed0926b..9bf1cfb 100644 (file)
@@ -1,9 +1,9 @@
-/* in_cksum.c 1.7 81/10/29 */
+/* inet_cksum.c 1.7 81/10/29 */
 
 #include <sys/types.h>
 #include "../h/mbuf.h"
 
 #include <sys/types.h>
 #include "../h/mbuf.h"
-#include "../inet/inet.h"
-#include "../inet/inet_systm.h"
+#include "../net/inet.h"
+#include "../net/inet_systm.h"
 
 /*
  * Network primitives; this file varies per-cpu,
 
 /*
  * Network primitives; this file varies per-cpu,
@@ -16,7 +16,7 @@
  * code and should be rewritten for each CPU
  * to be as fast as possible.
  */
  * code and should be rewritten for each CPU
  * to be as fast as possible.
  */
-cksum(m, len)
+inet_cksum(m, len)
        register struct mbuf *m;
        register int len;
 {
        register struct mbuf *m;
        register int len;
 {
@@ -24,7 +24,7 @@ cksum(m, len)
        register int sum = 0;           /* known to be r8 */
        register u_short *w;            /* known to be r7 */
        register int mlen = 0;
        register int sum = 0;           /* known to be r8 */
        register u_short *w;            /* known to be r7 */
        register int mlen = 0;
-COUNT(CKSUM);
+COUNT(INET_CKSUM);
 
        for (;;) {
                w = (u_short *)((int)m + m->m_off);
 
        for (;;) {
                w = (u_short *)((int)m + m->m_off);