checkpoint further progress, still doesn't connect tho.
authorKeith Sklower <sklower@ucbvax.Berkeley.EDU>
Fri, 6 Nov 1992 07:00:41 +0000 (23:00 -0800)
committerKeith Sklower <sklower@ucbvax.Berkeley.EDU>
Fri, 6 Nov 1992 07:00:41 +0000 (23:00 -0800)
SCCS-vsn: sys/netiso/tuba_subr.c 7.7
SCCS-vsn: sys/netiso/tuba_table.c 7.5
SCCS-vsn: sys/netiso/tuba_table.h 7.5
SCCS-vsn: sys/netiso/tuba_usrreq.c 7.5

usr/src/sys/netiso/tuba_subr.c
usr/src/sys/netiso/tuba_table.c
usr/src/sys/netiso/tuba_table.h
usr/src/sys/netiso/tuba_usrreq.c

index 191007d..9b7a6d2 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)tuba_subr.c 7.6 (Berkeley) %G%
+ *     @(#)tuba_subr.c 7.7 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
 #include <netiso/iso_var.h>
 #include <netiso/tuba_table.h>
 
 #include <netiso/iso_var.h>
 #include <netiso/tuba_table.h>
 
-static struct  sockaddr_iso null_siso = { sizeof(null_siso), AF_ISO, };
-extern struct  isopcb tuba_isopcb;
-extern int     tuba_table_size;
-extern int     tcppcbcachemiss, tcppredack, tcppreddat, tcprexmtthresh;
-extern struct  inpcb *tcp_last_inpcb;
-extern struct  tcpiphdr tcp_saveti;
+static struct  sockaddr_iso null_siso = { sizeof(null_siso), AF_ISO, };
+extern int     tuba_table_size;
+extern int     tcppcbcachemiss, tcppredack, tcppreddat, tcprexmtthresh;
+extern struct  tcpiphdr tcp_saveti;
+struct inpcb   *tuba_last_inpcb;
+struct inpcb   tuba_inpcb;
+struct isopcb  tuba_isopcb;
 /*
  * Tuba initialization
  */
 /*
  * Tuba initialization
  */
@@ -55,6 +56,7 @@ tuba_init()
 #define TUBAHDRSIZE (3 /*LLC*/ + 9 /*CLNP Fixed*/ + 42 /*Addresses*/ \
                     + 6 /*CLNP Segment*/ + 20 /*TCP*/)
 
 #define TUBAHDRSIZE (3 /*LLC*/ + 9 /*CLNP Fixed*/ + 42 /*Addresses*/ \
                     + 6 /*CLNP Segment*/ + 20 /*TCP*/)
 
+       tuba_inpcb.inp_next = tuba_inpcb.inp_prev = &tuba_inpcb;
        tuba_isopcb.isop_next = tuba_isopcb.isop_prev = &tuba_isopcb;
        tuba_isopcb.isop_faddr = &tuba_isopcb.isop_sfaddr;
        tuba_isopcb.isop_laddr = &tuba_isopcb.isop_sladdr;
        tuba_isopcb.isop_next = tuba_isopcb.isop_prev = &tuba_isopcb;
        tuba_isopcb.isop_faddr = &tuba_isopcb.isop_sfaddr;
        tuba_isopcb.isop_laddr = &tuba_isopcb.isop_sladdr;
@@ -81,97 +83,48 @@ tuba_getaddr(error, sum, siso, index)
        } else
                *error = 1;
 }
        } else
                *error = 1;
 }
-int tuba_noisy = 1;
 
 tuba_output(m, tp)
        register struct mbuf *m;
        struct tcpcb *tp;
 {
        struct isopcb *isop;
 
 tuba_output(m, tp)
        register struct mbuf *m;
        struct tcpcb *tp;
 {
        struct isopcb *isop;
-       register struct tcpiphdr *n, *h;
-       struct mbuf *p = m_gethdr(M_DONTWAIT, MT_DATA);
-       u_long sum = 0, i = 0, k1, k2, k3, k4, k5, lindex, findex, len;
+       register struct tcpiphdr *n;
+       u_long sum, i;
 
 
-       if ((m->m_flags & M_PKTHDR) == 0)
-               panic("tuba_output");
-       if (p == 0)
-               panic("tuba_output 2");
-       m = m_pullup(m, 40);
-       if (m == 0) {
-               printf("heisenberg hit us\n");
-               (void)m_free(p);
-               return (ENOBUFS);
-       }
-       n = mtod(m, struct tcpiphdr *);
-       h = mtod(p, struct tcpiphdr *);
-       lindex = n->ti_src.s_addr;
-       findex = n->ti_dst.s_addr;
-       len = m->m_pkthdr.len;
-       bzero((caddr_t)h, sizeof(*h));
-       h->ti_pr = ISOPROTO_TCP;
-       h->ti_dst.s_addr = findex;
-       h->ti_src.s_addr = lindex;
-       h->ti_len = htons((u_short)len - 20);
-       m->m_data += 20;
-       m->m_len -= 20;
-       k1 = in_cksum(m, len - 20);
-       p->m_len = 20;
-       p->m_next = m;
-       k2 = in_cksum(p, 20);
-       k3 = in_cksum(p, len);
-       m->m_data -= 20;
-       m->m_len += 20;
-
-       if (tuba_noisy) {
-               printf("old ti_sum is 0x%x\n", n->ti_sum);
-               printf("in_cksum for old TCP part is 0x%x\n", k1);
-               printf("in_cksum for ph(idx) is 0x%x\n", k2);
-               printf("in_cksum for ph + TCP is 0x%x\n", k3);
-       }
        if (tp == 0 || (n = tp->t_template) == 0 || 
            (isop = (struct isopcb *)tp->t_tuba_pcb) == 0) {
                isop = &tuba_isopcb;
                n = mtod(m, struct tcpiphdr *);
        if (tp == 0 || (n = tp->t_template) == 0 || 
            (isop = (struct isopcb *)tp->t_tuba_pcb) == 0) {
                isop = &tuba_isopcb;
                n = mtod(m, struct tcpiphdr *);
-               tuba_getaddr(&i, &sum, tuba_isopcb.isop_faddr, findex);
-               tuba_getaddr(&i, &sum, tuba_isopcb.isop_laddr, lindex);
+               i = sum = 0;
+               tuba_getaddr(&i, &sum, tuba_isopcb.isop_faddr,
+                               n->ti_dst.s_addr);
+               tuba_getaddr(&i, &sum, tuba_isopcb.isop_laddr,
+                               n->ti_src.s_addr);
                goto adjust;
        }
        if (n->ti_sum == 0) {
                goto adjust;
        }
        if (n->ti_sum == 0) {
-               tuba_getaddr(&i, &sum, (struct sockaddr_iso *)0, findex);
-               tuba_getaddr(&i, &sum, (struct sockaddr_iso *)0, lindex);
+               i = sum = 0;
+               tuba_getaddr(&i, &sum, (struct sockaddr_iso *)0,
+                               n->ti_dst.s_addr);
+               tuba_getaddr(&i, &sum, (struct sockaddr_iso *)0,
+                               n->ti_src.s_addr);
                n->ti_sum = sum;
                n = mtod(m, struct tcpiphdr *);
        adjust:
                if (i) {
                        m_freem(m);
                n->ti_sum = sum;
                n = mtod(m, struct tcpiphdr *);
        adjust:
                if (i) {
                        m_freem(m);
-                       (void)m_free(p);
                        return (EADDRNOTAVAIL);
                }
                REDUCE(n->ti_sum, n->ti_sum + (0xffff ^ sum));
        }
                        return (EADDRNOTAVAIL);
                }
                REDUCE(n->ti_sum, n->ti_sum + (0xffff ^ sum));
        }
-       h->ti_dst.s_addr = tuba_table[findex]->tc_sum_in;
-       h->ti_src.s_addr = tuba_table[lindex]->tc_sum_in;
        m->m_len -= sizeof (struct ip);
        m->m_pkthdr.len -= sizeof (struct ip);
        m->m_data += sizeof (struct ip);
        m->m_len -= sizeof (struct ip);
        m->m_pkthdr.len -= sizeof (struct ip);
        m->m_data += sizeof (struct ip);
-       k1 = in_cksum(m, len - 20);
-       k2 = in_cksum(p, 20);
-       k3 = in_cksum(p, len);
-       REDUCE(k4, h->ti_dst.s_addr + h->ti_src.s_addr + h->ti_len 
-                       + ntohs((u_short)ISOPROTO_TCP) + (0xffff ^ k1));
-       k4 = 0xffff ^ k4;
-       if (tuba_noisy) {
-               printf("new ti_sum is 0x%x\n", n->ti_sum);
-               printf("adjustment is 0x%x\n", sum);
-               printf("in_cksum for new TCP part is 0x%x\n", k1);
-               printf("in_cksum for ph(EIDSUM) is 0x%x\n", k2);
-               printf("in_cksum for ph + TCP is 0x%x\n", k3);
-               printf("calculated in the funky way is 0x%x\n", k4);
-       }
-       (void)m_free(p);
        return (clnp_output(m, isop, m->m_pkthdr.len, 0));
 }
 
        return (clnp_output(m, isop, m->m_pkthdr.len, 0));
 }
 
+
 tuba_refcnt(isop, delta)
        struct isopcb *isop;
 {
 tuba_refcnt(isop, delta)
        struct isopcb *isop;
 {
@@ -230,8 +183,6 @@ tuba_pcbconnect(inp, nam)
        return (error);
 }
 
        return (error);
 }
 
-tuba_badcksum() {} /* XXX - to set breakpoints */
-
 /*
  * CALLED FROM:
  *     clnp's input routine, indirectly through the protosw.
 /*
  * CALLED FROM:
  *     clnp's input routine, indirectly through the protosw.
@@ -336,18 +287,17 @@ tuba_tcpinput(m, src, dst, clnp_len, ce_bit)
        ti->ti_len = htons((u_short)tlen);
        if (ti->ti_sum = in_cksum(m, m->m_pkthdr.len)) {
                tcpstat.tcps_rcvbadsum++;
        ti->ti_len = htons((u_short)tlen);
        if (ti->ti_sum = in_cksum(m, m->m_pkthdr.len)) {
                tcpstat.tcps_rcvbadsum++;
-               tuba_badcksum();
                goto drop;
        }
                goto drop;
        }
-       if (tuba_noisy)
-               printf("Hurray!\n");
        ti->ti_src.s_addr = findex;
        ti->ti_dst.s_addr = lindex;
        /*
         * Now include the rest of TCP input
         */
 #define TUBA_INCLUDE
        ti->ti_src.s_addr = findex;
        ti->ti_dst.s_addr = lindex;
        /*
         * Now include the rest of TCP input
         */
 #define TUBA_INCLUDE
-#define in_pcbconnect  tuba_pcbconnect
+#define        in_pcbconnect   tuba_pcbconnect
+#define        tcb             tuba_inpcb
+#define tcp_last_inpcb tuba_last_inpcb
 
 #include <netinet/tcp_input.c>
 }
 
 #include <netinet/tcp_input.c>
 }
index c836631..0ee0f47 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)tuba_table.c        7.4 (Berkeley) %G%
+ *     @(#)tuba_table.c        7.5 (Berkeley) %G%
  */
 #include <sys/param.h>
 #include <sys/systm.h>
  */
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -79,9 +79,9 @@ tuba_lookup(isoa, wait)
                == NULL)
                return (0);
        bzero((caddr_t)tc, sizeof (*tc));
                == NULL)
                return (0);
        bzero((caddr_t)tc, sizeof (*tc));
-       bcopy((caddr_t)EID, (caddr_t)&tc->tc_addr, 1 + EID[0]);
-       rn_insert((caddr_t)&tc->tc_addr, tuba_tree->rnh_treetop,
-               &dupentry, tc->tc_nodes);
+       bcopy((caddr_t)EID, (caddr_t)&tc->tc_EID, sizeof(EID));
+       bcopy((caddr_t)isoa, (caddr_t)&tc->tc_addr, 1 + isoa->isoa_len);
+       rn_insert(tc->tc_EID, tuba_tree->rnh_treetop, &dupentry, tc->tc_nodes);
        if (dupentry)
                panic("tuba_lookup 1");
        tc->tc_time = time.tv_sec;
        if (dupentry)
                panic("tuba_lookup 1");
        tc->tc_time = time.tv_sec;
index 7a7737c..6c627b6 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)tuba_table.h        7.4 (Berkeley) %G%
+ *     @(#)tuba_table.h        7.5 (Berkeley) %G%
  */
 
 struct tuba_cache {
  */
 
 struct tuba_cache {
@@ -16,7 +16,8 @@ struct tuba_cache {
        int     tc_index;
        u_short tc_sum_in;                      /* for inbound cksum */
        u_short tc_sum_out;                     /* for outbound cksum */
        int     tc_index;
        u_short tc_sum_in;                      /* for inbound cksum */
        u_short tc_sum_out;                     /* for outbound cksum */
-       struct  iso_addr tc_addr;
+       struct  iso_addr tc_addr;               /* so you can respond */
+       char    tc_EID[7];                      /* what counts for lookups */
 };
 
 #define ADDCARRY(x)  (x >= 65535 ? x -= 65535 : x)
 };
 
 #define ADDCARRY(x)  (x >= 65535 ? x -= 65535 : x)
index a3b9822..1b90f94 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)tuba_usrreq.c       7.4 (Berkeley) %G%
+ *     @(#)tuba_usrreq.c       7.5 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -43,8 +43,8 @@
  * TCP protocol interface to socket abstraction.
  */
 extern char *tcpstates[];
  * TCP protocol interface to socket abstraction.
  */
 extern char *tcpstates[];
-extern struct inpcb tcb;
-struct isopcb tuba_isopcb;
+extern struct inpcb tuba_inpcb;
+extern struct isopcb tuba_isopcb;
 
 /*
  * Process a TCP user request for TCP tb.  If this is a send request
 
 /*
  * Process a TCP user request for TCP tb.  If this is a send request
@@ -108,6 +108,9 @@ tuba_usrreq(so, req, m, nam, control)
                        iso_pcbdetach(isop);
                } else {
                        inp = sotoinpcb(so);
                        iso_pcbdetach(isop);
                } else {
                        inp = sotoinpcb(so);
+                       remque(inp);
+                       insque(inp, &tuba_inpcb);
+                       inp->inp_head = &tuba_inpcb;
                        tp = intotcpcb(inp);
                        if (tp == 0)
                                panic("tuba_usrreq 3");
                        tp = intotcpcb(inp);
                        if (tp == 0)
                                panic("tuba_usrreq 3");