cleanup of header files
authorBill Joy <wnj@ucbvax.Berkeley.EDU>
Fri, 30 Oct 1981 12:28:14 +0000 (04:28 -0800)
committerBill Joy <wnj@ucbvax.Berkeley.EDU>
Fri, 30 Oct 1981 12:28:14 +0000 (04:28 -0800)
SCCS-vsn: sys/netinet/ip.h 1.5
SCCS-vsn: sys/netinet/ip_input.c 1.9
SCCS-vsn: sys/netinet/ip_output.c 1.5
SCCS-vsn: sys/kern/uipc_mbuf.c 1.5
SCCS-vsn: sys/vax/vax/in_cksum.c 1.7
SCCS-vsn: sys/netinet/tcp.h 1.9
SCCS-vsn: sys/netinet/tcp_input.c 1.7
SCCS-vsn: sys/netinet/tcp_usrreq.c 1.14

usr/src/sys/kern/uipc_mbuf.c
usr/src/sys/netinet/ip.h
usr/src/sys/netinet/ip_input.c
usr/src/sys/netinet/ip_output.c
usr/src/sys/netinet/tcp.h
usr/src/sys/netinet/tcp_input.c
usr/src/sys/netinet/tcp_usrreq.c
usr/src/sys/vax/vax/in_cksum.c

index a648bdb..4d66862 100644 (file)
@@ -1,4 +1,4 @@
-/* uipc_mbuf.c 1.4 81/10/28 */
+/* uipc_mbuf.c 1.5 81/10/29 */
 
 #include "../h/param.h"
 #include "../h/dir.h"
 
 #include "../h/param.h"
 #include "../h/dir.h"
@@ -8,9 +8,10 @@
 #include "../h/cmap.h"
 #include "../h/map.h"
 #include "../h/mbuf.h"
 #include "../h/cmap.h"
 #include "../h/map.h"
 #include "../h/mbuf.h"
-#include "../bbnnet/net.h"
-#include "../bbnnet/tcp.h"
-#include "../bbnnet/ip.h"
+#include "../inet/inet.h"
+#include "../inet/inet_systm.h"
+#include "../inet/tcp.h"
+#include "../inet/ip.h"
 #include "../h/vm.h"
 
 struct mbuf *
 #include "../h/vm.h"
 
 struct mbuf *
@@ -62,7 +63,7 @@ COUNT(M_FREEM);
        if (m == NULL)
                return (0);
        cnt = 0;
        if (m == NULL)
                return (0);
        cnt = 0;
-       s = spl_imp();
+       s = splimp();
        do {
                MFREE(m, n);
                cnt++;
        do {
                MFREE(m, n);
                cnt++;
@@ -87,10 +88,10 @@ COUNT(MBUFINIT);
                m++;
        }
        pg_alloc(3);
                m++;
        }
        pg_alloc(3);
-       netcb.n_pages = 4;
-       netcb.n_bufs = 32;
-       netcb.n_lowat = 16;
-       netcb.n_hiwat = 32;
+       mbstat.m_pages = 4;
+       mbstat.m_bufs = 32;
+       mbstat.m_lowat = 16;
+       mbstat.m_hiwat = 32;
 }
 
 pg_alloc(n)
 }
 
 pg_alloc(n)
@@ -111,14 +112,14 @@ COUNT(PG_ALLOC);
                return (0);
        vmaccess(&Netmap[j], (caddr_t)m, k);
        bufs = n << 3;
                return (0);
        vmaccess(&Netmap[j], (caddr_t)m, k);
        bufs = n << 3;
-       s = spl_imp();
+       s = splimp();
        for (j=0; j < bufs; j++) {
                m->m_off = 0;
                m_free(m);
                m++;
        }
        splx(s);
        for (j=0; j < bufs; j++) {
                m->m_off = 0;
                m_free(m);
                m++;
        }
        splx(s);
-       netcb.n_pages += n;
+       mbstat.m_pages += n;
        return (1);
 }
 
        return (1);
 }
 
@@ -132,8 +133,8 @@ m_expand()
        int need, needp, needs;
 
 COUNT(M_EXPAND);
        int need, needp, needs;
 
 COUNT(M_EXPAND);
-       needs = need = netcb.n_hiwat - netcb.n_bufs;    /* #bufs to add */
-       needp = need >> 3;                              /* #pages to add */
+       needs = need = mbstat.m_hiwat - mbstat.m_bufs;
+       needp = need >> 3;
        if (pg_alloc(needp))
                return (1);
        for (i=0; i < needp; i++, need-=NMBPG)
        if (pg_alloc(needp))
                return (1);
        for (i=0; i < needp; i++, need-=NMBPG)
@@ -141,38 +142,18 @@ COUNT(M_EXPAND);
                        goto steal;
        return (need < needs);
 steal:
                        goto steal;
        return (need < needs);
 steal:
-       fp = netcb.n_ip_tail;           /* ip reass.q */
-       while (need > 0 && fp) {
-               q = fp->iqx.ip_next;    /* free mbufs assoc. w/chain */
-               while (q != (struct ip *)fp) {
-                       need -= m_freem(dtom(q));
-                       q = q->ip_next;
-               }
-               ip_freef(fp);           /* free header */
-               fp = netcb.n_ip_tail;
-       }
-       tp = netcb.n_tcb_tail;          /* ->tcbs */
-       while (need > 0 && tp != NULL) {
-               m = tp->t_rcv_unack;
-               while (m != NULL) {
-                       n = m->m_act;
-                       need -= m_freem(m);
-                       m = n;
-               }
-               tp->t_rcv_unack = NULL;
-               tp = tp->t_tcb_prev;
-       }
+#ifdef notdef
+       /* free fragments */
+       /* free unacks */
+#endif
        return (need < needs);
 }
 
 #ifdef notdef
 m_relse()
 {
        return (need < needs);
 }
 
 #ifdef notdef
 m_relse()
 {
-       int free;
-
 COUNT(M_RELSE);
 COUNT(M_RELSE);
-       free = (netcb.n_bufs - netcb.n_hiwat) >> 3;    /* # excess free pages */
-       return;
+
 }
 #endif
 
 }
 #endif
 
index 3f7642d..6de5adf 100644 (file)
@@ -1,10 +1,23 @@
-/* ip.h 1.4 81/10/28 */
+/* ip.h 1.5 81/10/29 */
 
 
+/*
+ * Definitions for internet protocol version 4.
+ * Per RFC 791, September 1981.
+ */
+#define        IPVERSION       4
+
+/*
+ * Structure of an internet header, naked of options.
+ *
+ * SHOULD MAKE A VERSION OF THIS FOR KERNEL SO USER
+ * VERSION CAN BE union FREE AND INITIALIZABLE.
+ */
 struct ip {
        u_char  ip_hl:4,                /* header length */
                ip_v:4;                 /* version */
        u_char  ip_tos;                 /* type of service */
 struct ip {
        u_char  ip_hl:4,                /* header length */
                ip_v:4;                 /* version */
        u_char  ip_tos;                 /* type of service */
-#define        ip_mff  ip_tos                  /* more fragments flag (input) */
+/* we copy the IP_MF to ip_tos on input */
+#define        ip_mff  ip_tos                  /* more fragments flag */
 /* by rights, ip_len should be a u_short, but this makes operations */
 /* on it very dangerous as comparisons become unsigned and comparing */
 /* against negative numbers then fails... we don't expect any > 32767 */
 /* by rights, ip_len should be a u_short, but this makes operations */
 /* on it very dangerous as comparisons become unsigned and comparing */
 /* against negative numbers then fails... we don't expect any > 32767 */
@@ -13,12 +26,11 @@ struct ip {
        u_short ip_id;                  /* identification */
 /* ip_off should also, by rights, be u_short, ala ip_len */
        short   ip_off;                 /* fragment offset field */
        u_short ip_id;                  /* identification */
 /* ip_off should also, by rights, be u_short, ala ip_len */
        short   ip_off;                 /* fragment offset field */
-#define        ip_df 0x4000                    /* dont fragment flag */
-#define        ip_mf 0x2000                    /* more fragments flag (output) */
+#define        IP_DF 0x4000                    /* dont fragment flag */
+#define        IP_MF 0x2000                    /* more fragments flag */
        u_char  ip_ttl;                 /* time to live */
        u_char  ip_p;                   /* protocol */
        u_short ip_sum;                 /* checksum */
        u_char  ip_ttl;                 /* time to live */
        u_char  ip_p;                   /* protocol */
        u_short ip_sum;                 /* checksum */
-#define        ip_end  ip_sum                  /* fragment end */
        union {
                struct socket ip_s;     /* source address */
                struct ip *ip_nxt;      /* next fragment */
        union {
                struct socket ip_s;     /* source address */
                struct ip *ip_nxt;      /* next fragment */
@@ -34,23 +46,82 @@ struct ip {
 };
 
 /*
 };
 
 /*
- * Ip reassembly queue.
+ * Definitions for options.
+ */
+#define        IPOPT_COPIED(o)         ((o)&0x80)
+#define        IPOPT_CLASS(o)          ((o)&0x40)
+#define        IPOPT_NUMBER(o)         ((o)&0x3f)
+
+#define        IPOPT_CONTROL           0x00
+#define        IPOPT_RESERVED1         0x10
+#define        IPOPT_DEBMEAS           0x20
+#define        IPOPT_RESERVED2         0x30
+
+#define        IPOPT_EOL               0               /* end of option list */
+#define        IPOPT_NOP               1               /* no operation */
+
+#define        IPOPT_RR                7               /* record packet route */
+#define        IPOPT_TS                68              /* timestamp */
+#define        IPOPT_SECURITY          130             /* provide s,c,h,tcc */
+#define        IPOPT_LSRR              131             /* loose source route */
+#define        IPOPT_SATID             136             /* satnet id */
+#define        IPOPT_SSRR              137             /* strict source route */
+
+/*
+ * Time stamp option structure.
+ */
+struct ip_timestamp {
+       u_char  ipt_code;               /* IPOPT_TS */
+       u_char  ipt_len;                /* size of structure (variable) */
+       u_char  ipt_ptr;                /* index of current entry */
+       u_char  ipt_flg:4,              /* flags, see below */
+               ipt_oflw:4;             /* overflow counter */
+       union {
+               n_long  ipt_time[1];
+               struct  ipt_ta {
+                       struct socket ipt_addr;
+                       n_long ipt_time;
+               } ipt_ta[1];
+       }
+};
+
+/* flag bits for ipt_flg */
+#define        IPOPT_TS_TSONLY         0               /* timestamps only */
+#define        IPOPT_TS_TSANDADDR      1               /* timestamps and addresses */
+#define        IPOPT_TS_PRESPEC        2               /* specified modules only */
+
+/* bits for security (not byte swapped) */
+#define        IPOPT_SECUR_UNCLASS     0x0000
+#define        IPOPT_SECUR_CONFID      0xf135
+#define        IPOPT_SECUR_EFTO        0x789a
+#define        IPOPT_SECUR_MMMM        0xbc4d
+#define        IPOPT_SECUR_RESTR       0xaf13
+#define        IPOPT_SECUR_SECRET      0xd788
+#define        IPOPT_SECUR_TOPSECRET   0x6bc5
+
+/*
+ * Ip reassembly queue structure.  Each fragment
+ * being reassambled is attached to one of these structures.
+ * They are timed out after ipq_ttl drops to 0, and may also
+ * be reclaimed if memory becomes tight.
  */
 struct ipq {
  */
 struct ipq {
-       struct  ip iqx;         /* dummy ip element for top of list */
-       struct  ipq *iq_next;   /* -> next chain on q */
-       struct  ipq *iq_prev;   /* -> prev chain on q */
-       struct  ip iqh;         /* fragment header */
+       struct  ipq *next,*prev;        /* to other reass headers */
+       u_char  ipq_ttl;                /* time for reass q to live */
+       u_char  ipq_p;                  /* protocol of this fragment */
+       u_short ipq_id;                 /* sequence id for reassembly */
+       struct  ip *ipq_next,*ipq_prev; /* to ip headers of fragments */
+       struct  socket ipq_src,ipq_dst;
 };
 
 };
 
-#define        IPVERSION       4               /* internet protocol version number */
-#define        IPLOLINK        155             /* internet link numbers */
-#define        IPHILINK        158
-#define        IPLINK          IPLOLINK
+/*
+ * Internet implementation parameters.
+ */
 #define        MAXTTL          255             /* maximum time to live (seconds) */
 #define        MAXTTL          255             /* maximum time to live (seconds) */
+#define        IPFRAGTTL       15              /* time to live for frag chains */
 
 
-#define        ip_bswap(p) { \
-       p->ip_len = ntohs(p->ip_len); \
-       p->ip_id = ntohs(p->ip_id); \
-       p->ip_off = ntohs(p->ip_off); }
-
+#ifdef KERNEL
+struct ipq     ipq;                    /* ip reass. queue */
+struct ipq     *ip_freef();
+u_short        ip_id;                          /* ip packet ctr, for ids */
+#endif
index 77a6814..09c45ef 100644 (file)
@@ -1,4 +1,4 @@
-/* ip_input.c 1.8 81/10/28 */
+/* ip_input.c 1.9 81/10/29 */
 
 #include "../h/param.h"
 #include "../h/systm.h"
 
 #include "../h/param.h"
 #include "../h/systm.h"
@@ -373,7 +373,7 @@ ip_dooptions(ip)
 {
        register u_char *cp;
        int opt, optlen, cnt, s;
 {
        register u_char *cp;
        int opt, optlen, cnt, s;
-       struct inet_addr *sp;
+       struct socket *sp;
 
        cp = (u_char *)(ip + 1);
        cnt = (ip->ip_hl << 2) - sizeof (struct ip);
 
        cp = (u_char *)(ip + 1);
        cnt = (ip->ip_hl << 2) - sizeof (struct ip);
@@ -394,7 +394,7 @@ ip_dooptions(ip)
                case IPOPT_SSRR:
                        if (cp[2] < 4 || cp[2] > optlen - 3)
                                break;
                case IPOPT_SSRR:
                        if (cp[2] < 4 || cp[2] > optlen - 3)
                                break;
-                       sp = (struct inet_addr *)(cp+cp[2]);
+                       sp = (struct socket *)(cp+cp[2]);
                        if (n_lhost.s_addr == *(u_long *)sp) {
                                if (opt == IPOPT_SSRR) {
                                        /* make sure *sp directly accessible*/
                        if (n_lhost.s_addr == *(u_long *)sp) {
                                if (opt == IPOPT_SSRR) {
                                        /* make sure *sp directly accessible*/
@@ -414,7 +414,7 @@ ip_dooptions(ip)
                                cp[3] += 0x10;
                                break;
                        }
                                cp[3] += 0x10;
                                break;
                        }
-                       sp = (struct inet_addr *)(cp+cp[2]);
+                       sp = (struct socket *)(cp+cp[2]);
                        switch (cp[3] & 0xf) {
 
                        case IPOPT_TS_TSONLY:
                        switch (cp[3] & 0xf) {
 
                        case IPOPT_TS_TSONLY:
index 41ecfad..96a51b3 100644 (file)
@@ -1,13 +1,14 @@
-/* ip_output.c 1.5 81/10/26 */
+/* ip_output.c 1.5 81/10/29 */
 
 #include "../h/param.h"
 
 #include "../h/param.h"
-#include "../bbnnet/net.h"
-#include "../bbnnet/mbuf.h"
-#include "../bbnnet/host.h"
-#include "../bbnnet/tcp.h"
-#include "../bbnnet/ip.h"
-#include "../bbnnet/imp.h"
-#include "../bbnnet/ucb.h"
+#include "../h/mbuf.h"
+#include "../h/socket.h"
+#include "../inet/inet.h"
+#include "../inet/inet_systm.h"
+#include "../inet/imp.h"
+#include "../inet/inet_host.h"
+#include "../inet/ip.h"
+#include "../inet/tcp.h"
 
 ip_output(mp)
        struct mbuf *mp;
 
 ip_output(mp)
        struct mbuf *mp;
@@ -27,12 +28,12 @@ COUNT(IP_OUTPUT);
         */
        p->ip_v = IPVERSION;
        p->ip_hl = hlen >> 2;
         */
        p->ip_v = IPVERSION;
        p->ip_hl = hlen >> 2;
-       p->ip_off = 0 | (p->ip_off & ip_df);
+       p->ip_off = 0 | (p->ip_off & IP_DF);
        p->ip_ttl = MAXTTL;
        p->ip_ttl = MAXTTL;
-       p->ip_id = netcb.n_ip_cnt++;
+       p->ip_id = ip_id++;
 
        if (p->ip_len > MTU) {          /* must fragment */
 
        if (p->ip_len > MTU) {          /* must fragment */
-               if (p->ip_off & ip_df)
+               if (p->ip_off & IP_DF)
                        return (0);
                max = MTU - hlen;       /* maximum data length in fragment */
                len = p->ip_len - hlen; /* data length */
                        return (0);
                max = MTU - hlen;       /* maximum data length in fragment */
                len = p->ip_len - hlen; /* data length */
@@ -57,7 +58,7 @@ COUNT(IP_OUTPUT);
                        }
 
                        if (i < max || m == NULL) {     /* last fragment */
                        }
 
                        if (i < max || m == NULL) {     /* last fragment */
-                               p->ip_off = p->ip_off & ~ip_mf;
+                               p->ip_off = p->ip_off &~ IP_MF;
                                p->ip_len = i + hlen;
                                break;
 
                                p->ip_len = i + hlen;
                                break;
 
@@ -68,7 +69,7 @@ COUNT(IP_OUTPUT);
                                if ((mm = m_get(1)) == NULL)    /* no more bufs */
                                        return(0);
 
                                if ((mm = m_get(1)) == NULL)    /* no more bufs */
                                        return(0);
 
-                               p->ip_off |= ip_mf;
+                               p->ip_off |= IP_MF;
 
                                /* terminate fragment at 8 byte boundary (round down) */
 
 
                                /* terminate fragment at 8 byte boundary (round down) */
 
@@ -142,7 +143,9 @@ COUNT(IP_SEND);
           necessary byte-swapping  */
 
        p->ip_sum = 0;
           necessary byte-swapping  */
 
        p->ip_sum = 0;
-       ip_bswap(p);
+       p->ip_len = htons(p->ip_len);
+       p->ip_id = htons(p->ip_id);
+       p->ip_off = htons(p->ip_off);
        p->ip_sum = cksum(m, sizeof(struct ip));
 
        m->m_off -= L1822;              /* -> 1822 leader */
        p->ip_sum = cksum(m, sizeof(struct ip));
 
        m->m_off -= L1822;              /* -> 1822 leader */
@@ -154,7 +157,7 @@ COUNT(IP_SEND);
 
        /* put output message on queue */
 
 
        /* put output message on queue */
 
-       s = spl_imp();
+       s = splimp();
        if (imp_stat.outq_head != NULL)
                imp_stat.outq_tail->m_act = m;
        else
        if (imp_stat.outq_head != NULL)
                imp_stat.outq_tail->m_act = m;
        else
@@ -199,6 +202,6 @@ COUNT(IP_SETUP);
        ip->ip_p = up->uc_lolink;
        ip->ip_len = len + sizeof(struct ip);
 
        ip->ip_p = up->uc_lolink;
        ip->ip_len = len + sizeof(struct ip);
 
-       ip->ip_src.s_addr = netcb.n_lhost.s_addr;
+       ip->ip_src.s_addr = n_lhost.s_addr;
         ip->ip_dst.s_addr = up->uc_host->h_addr.s_addr;
 }
         ip->ip_dst.s_addr = up->uc_host->h_addr.s_addr;
 }
index 23d0373..5d4fd4c 100644 (file)
@@ -1,7 +1,9 @@
-/* tcp.h 1.8 81/10/29 */
+/* tcp.h 1.9 81/10/29 */
 
 /*
 
 /*
- * Tcp header (fits over ip header).
+ * Tcp header.  Fits over the ip header after option removed.
+ *
+ * SHOULD MAKE A CLEAN HEADER FOR USE BY USERS.
  */
 struct th {
        struct  th *t_next;             /* -> next tcp on rcv chain */
  */
 struct th {
        struct  th *t_next;             /* -> next tcp on rcv chain */
@@ -102,6 +104,15 @@ struct tcb {
        u_char  t_xmt;                  /* round trip transmission time */
 };
 
        u_char  t_xmt;                  /* round trip transmission time */
 };
 
+/*
+ * TCP timers.
+ */
+#define        TINIT           1
+#define        TREXMT          2
+#define        TREXMTTL        3
+#define        TPERSIST        4
+#define        TFINACK         5
+
 /*
  * Tcp machine predicates
  */
 /*
  * Tcp machine predicates
  */
@@ -119,6 +130,9 @@ struct tcb {
     (((x)->tc_flags&TC_USR_ABORT) || \
       ((x)->t_ucb->uc_rbuf == NULL && (x)->t_rcv_next == (x)->t_rcv_prev))
 
     (((x)->tc_flags&TC_USR_ABORT) || \
       ((x)->t_ucb->uc_rbuf == NULL && (x)->t_rcv_next == (x)->t_rcv_prev))
 
+/*
+ * THESE NEED TO BE JUSTIFIED!
+ */
 #define        ISSINCR         128             /* increment for iss each second */
 #define        TCPROTO         6               /* TCP-4 protocol number */
 #define        TCPSIZE         20              /* size of TCP leader (bytes) */
 #define        ISSINCR         128             /* increment for iss each second */
 #define        TCPROTO         6               /* TCP-4 protocol number */
 #define        TCPSIZE         20              /* size of TCP leader (bytes) */
@@ -149,11 +163,17 @@ struct tcp_debug {
        u_short td_lno;                 /* length */
        u_char  td_flg;                 /* message flags */
 };
        u_short td_lno;                 /* length */
        u_char  td_flg;                 /* message flags */
 };
+#endif
+
 #ifdef KERNEL
 #ifdef KERNEL
-int    tcpconsdebug;           /* set to 1 traces on console */
+struct tcb *tcb_head, *tcb_tail;       /* tcp tcb list */
+seq_t  tcp_iss;                        /* tcp initial send seq # */
+int    tcpconsdebug;                   /* set to 1 traces on console */
+#ifdef TCPDEBUG
 struct tcp_debug tcp_debug[TDBSIZE];
 struct tcp_debug tcp_debug[TDBSIZE];
-int    tdbx;                   /* rotating index into tcp_debug */
 #endif
 #endif
+int    tdbx;                   /* rotating index into tcp_debug */
+struct th *tcp_template();
 #endif
 
 #define        SEQ_LT(a,b)     ((int)((a)-(b)) < 0)
 #endif
 
 #define        SEQ_LT(a,b)     ((int)((a)-(b)) < 0)
index 46a8b38..10d2ea0 100644 (file)
@@ -1,18 +1,16 @@
-/* tcp_input.c 1.6 81/10/29 */
+/* tcp_input.c 1.7 81/10/29 */
 
 #include "../h/param.h"
 #include "../h/systm.h"
 
 #include "../h/param.h"
 #include "../h/systm.h"
-#include "../bbnnet/net.h"
-#include "../bbnnet/mbuf.h"
-#include "../bbnnet/host.h"
-#include "../bbnnet/imp.h"
-#include "../bbnnet/ucb.h"
-#include "../bbnnet/tcp.h"
-#include "../bbnnet/ip.h"
-#include "../h/dir.h"
-#include "../h/user.h"
-#include "../h/inode.h"
-#include "../bbnnet/fsm.h"
+#include "../h/mbuf.h"
+#include "../h/socket.h"
+#include "../inet/inet.h"
+#include "../inet/inet_systm.h"
+#include "../inet/imp.h"
+#include "../inet/inet_host.h"
+#include "../inet/ip.h"
+#include "../inet/tcp.h"
+#include "../inet/tcp_fsm.h"
 
 extern int nosum;
 
 
 extern int nosum;
 
@@ -62,11 +60,11 @@ COUNT(TCP_INPUT);
        /*
         * Find tcb for message (SHOULDN'T USE LINEAR SEARCH!)
         */
        /*
         * Find tcb for message (SHOULDN'T USE LINEAR SEARCH!)
         */
-       for (tp = netcb.n_tcb_head; tp != 0; tp = tp->t_tcb_next)
+       for (tp = tcb_head; tp != 0; tp = tp->t_tcb_next)
                if (tp->t_lport == lport && tp->t_fport == fport &&
                    tp->t_ucb->uc_host->h_addr.s_addr == n->t_s.s_addr)
                        goto found;
                if (tp->t_lport == lport && tp->t_fport == fport &&
                    tp->t_ucb->uc_host->h_addr.s_addr == n->t_s.s_addr)
                        goto found;
-       for (tp = netcb.n_tcb_head; tp != 0; tp = tp->t_tcb_next)
+       for (tp = tcb_head; tp != 0; tp = tp->t_tcb_next)
                if (tp->t_lport == lport &&
                    (tp->t_fport==fport || tp->t_fport==0) &&
                    (tp->t_ucb->uc_host->h_addr.s_addr == n->t_s.s_addr ||
                if (tp->t_lport == lport &&
                    (tp->t_fport==fport || tp->t_fport==0) &&
                    (tp->t_ucb->uc_host->h_addr.s_addr == n->t_s.s_addr ||
@@ -159,7 +157,7 @@ goodseg:
         */
        up = tp->t_ucb;
        if (up->uc_rcc > up->uc_rhiwat && 
         */
        up = tp->t_ucb;
        if (up->uc_rcc > up->uc_rhiwat && 
-            && n->t_len != 0 && netcb.n_bufs < netcb.n_lowat) {
+            && n->t_len != 0 && mbstat.m_bufs < mbstat.m_lowat) {
                mp->m_act = (struct mbuf *)0;
                if ((m = tp->t_rcv_unack) != NULL) {
                        while (m->m_act != NULL)
                mp->m_act = (struct mbuf *)0;
                if ((m = tp->t_rcv_unack) != NULL) {
                        while (m->m_act != NULL)
index 7a676c9..97a13f5 100644 (file)
@@ -1,18 +1,19 @@
-/* tcp_usrreq.c 1.13 81/10/29 */
+/* tcp_usrreq.c 1.14 81/10/29 */
 
 #include "../h/param.h"
 #include "../h/systm.h"
 
 #include "../h/param.h"
 #include "../h/systm.h"
-#include "../bbnnet/net.h"
-#include "../bbnnet/mbuf.h"
-#include "../bbnnet/tcp.h"
-#include "../bbnnet/ip.h"
-#include "../bbnnet/imp.h"
-#include "../bbnnet/ucb.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"
 #define TCPFSTAB
 #ifdef TCPDEBUG
 #define TCPSTATES
 #endif
 #define TCPFSTAB
 #ifdef TCPDEBUG
 #define TCPSTATES
 #endif
-#include "../bbnnet/fsm.h"
+#include "../inet/tcp_fsm.h"
 
 tcp_timeo()
 {
 
 tcp_timeo()
 {
@@ -23,7 +24,7 @@ COUNT(TCP_TIMEO);
        /*
         * Search through tcb's and update active timers.
         */
        /*
         * Search through tcb's and update active timers.
         */
-       for (tp = netcb.n_tcb_head; tp != NULL; tp = tp->t_tcb_next) {
+       for (tp = tcb_head; tp != NULL; tp = tp->t_tcb_next) {
                if (tp->t_init != 0 && --tp->t_init == 0)
                        tcp_usrreq(ISTIMER, TINIT, tp, 0);
                if (tp->t_rexmt != 0 && --tp->t_rexmt == 0)
                if (tp->t_init != 0 && --tp->t_init == 0)
                        tcp_usrreq(ISTIMER, TINIT, tp, 0);
                if (tp->t_rexmt != 0 && --tp->t_rexmt == 0)
@@ -36,7 +37,7 @@ COUNT(TCP_TIMEO);
                        tcp_usrreq(ISTIMER, TFINACK, tp, 0);
                tp->t_xmt++;
        }
                        tcp_usrreq(ISTIMER, TFINACK, tp, 0);
                tp->t_xmt++;
        }
-       netcb.n_iss += ISSINCR;         /* increment iss */
+       tcp_iss += ISSINCR;             /* increment iss */
        timeout(tcp_timeo, 0, hz);      /* reschedule every second */
        splx(s);
 }
        timeout(tcp_timeo, 0, hz);      /* reschedule every second */
        splx(s);
 }
@@ -179,13 +180,13 @@ COUNT(T_OPEN);
 
        /* enqueue the tcb */
 
 
        /* enqueue the tcb */
 
-       if (netcb.n_tcb_head == NULL) {
-               netcb.n_tcb_head = tp;
-               netcb.n_tcb_tail = tp;
+       if (tcb_head == NULL) {
+               tcb_head = tp;
+               tcb_tail = tp;
        } else {
        } else {
-               tp->t_tcb_next = netcb.n_tcb_head;
-               netcb.n_tcb_head->t_tcb_prev = tp;
-               netcb.n_tcb_head = tp;
+               tp->t_tcb_next = tcb_head;
+               tcb_head->t_tcb_prev = tp;
+               tcb_head = tp;
        }
 
        /* initialize non-zero tcb fields */
        }
 
        /* initialize non-zero tcb fields */
@@ -194,9 +195,9 @@ COUNT(T_OPEN);
        tp->t_rcv_prev = (struct th *)tp;
        tp->t_xmtime = T_REXMT;
        tp->snd_end = tp->seq_fin = tp->snd_nxt = tp->snd_hi =
        tp->t_rcv_prev = (struct th *)tp;
        tp->t_xmtime = T_REXMT;
        tp->snd_end = tp->seq_fin = tp->snd_nxt = tp->snd_hi =
-                     tp->snd_una = tp->iss = netcb.n_iss;
+                     tp->snd_una = tp->iss = tcp_iss;
        tp->snd_off = tp->iss + 1;
        tp->snd_off = tp->iss + 1;
-       netcb.n_iss += (ISSINCR >> 1) + 1;
+       tcp_iss += (ISSINCR >> 1) + 1;
 
        /* set timeout for open */
 
 
        /* set timeout for open */
 
@@ -223,11 +224,11 @@ COUNT(T_CLOSE);
        /* delete tcb */
 
        if (tp->t_tcb_prev == NULL)
        /* delete tcb */
 
        if (tp->t_tcb_prev == NULL)
-               netcb.n_tcb_head = tp->t_tcb_next;
+               tcb_head = tp->t_tcb_next;
        else
                tp->t_tcb_prev->t_tcb_next = tp->t_tcb_next;
        if (tp->t_tcb_next == NULL)
        else
                tp->t_tcb_prev->t_tcb_next = tp->t_tcb_next;
        if (tp->t_tcb_next == NULL)
-               netcb.n_tcb_tail = tp->t_tcb_prev;
+               tcb_tail = tp->t_tcb_prev;
        else
                tp->t_tcb_next->t_tcb_prev = tp->t_tcb_prev;
 
        else
                tp->t_tcb_next->t_tcb_prev = tp->t_tcb_prev;
 
@@ -250,6 +251,10 @@ COUNT(T_CLOSE);
                m_freem(m);
                tp->t_rcv_unack = NULL;
        }
                m_freem(m);
                tp->t_rcv_unack = NULL;
        }
+       if (up->uc_template) {
+               m_free(dtom(up->uc_template));
+               up->uc_template = 0;
+       }
        m = dtom(tp);
        m->m_off = 0;
        m_free(m);
        m = dtom(tp);
        m->m_off = 0;
        m_free(m);
@@ -257,8 +262,8 @@ COUNT(T_CLOSE);
 
        /* lower buffer allocation and decrement host entry */
 
 
        /* lower buffer allocation and decrement host entry */
 
-       netcb.n_lowat -= up->uc_snd + (up->uc_rhiwat/MSIZE) + 2;
-       netcb.n_hiwat = 2 * netcb.n_lowat;
+       mbstat.m_lowat -= up->uc_snd + (up->uc_rhiwat/MSIZE) + 2;
+       mbstat.m_hiwat = 2 * mbstat.m_lowat;
        if (up->uc_host != NULL) {
                h_free(up->uc_host);
                up->uc_host = NULL;
        if (up->uc_host != NULL) {
                h_free(up->uc_host);
                up->uc_host = NULL;
index ecc7f14..ed0926b 100644 (file)
@@ -1,9 +1,9 @@
-/* in_cksum.c 1.6 81/10/28 */
+/* in_cksum.c 1.7 81/10/29 */
 
 #include <sys/types.h>
 
 #include <sys/types.h>
-#include "../bbnnet/net.h"
-#include "../bbnnet/mbuf.h"
-#include "../bbnnet/count.h"
+#include "../h/mbuf.h"
+#include "../inet/inet.h"
+#include "../inet/inet_systm.h"
 
 /*
  * Network primitives; this file varies per-cpu,
 
 /*
  * Network primitives; this file varies per-cpu,