further fixes, rn_inithead called with wrong offsets and
authorKeith Sklower <sklower@ucbvax.Berkeley.EDU>
Thu, 14 Jul 1994 09:02:46 +0000 (01:02 -0800)
committerKeith Sklower <sklower@ucbvax.Berkeley.EDU>
Thu, 14 Jul 1994 09:02:46 +0000 (01:02 -0800)
need to store NSAP with net/radix.c conventions for length byte instead of

SCCS-vsn: sys/netiso/tuba_table.c 8.4
SCCS-vsn: sys/netiso/tuba_table.h 8.2

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

index c397363..614728b 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)tuba_table.c        8.3 (Berkeley) %G%
+ *     @(#)tuba_table.c        8.4 (Berkeley) %G%
  */
 #include <sys/param.h>
 #include <sys/systm.h>
  */
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -50,7 +50,7 @@ tuba_timer()
 
 tuba_table_init()
 {
 
 tuba_table_init()
 {
-       rn_inithead((void **)&tuba_tree, 40);
+       rn_inithead((void **)&tuba_tree, 0);
        timeout(tuba_timer, (caddr_t)0, arpt_prune * hz);
 }
 
        timeout(tuba_timer, (caddr_t)0, arpt_prune * hz);
 }
 
@@ -63,19 +63,25 @@ tuba_lookup(siso, wait)
        struct tuba_cache **new;
        int dupentry = 0, sum_a = 0, sum_b = 0, old_size, i;
 
        struct tuba_cache **new;
        int dupentry = 0, sum_a = 0, sum_b = 0, old_size, i;
 
+       siso->siso_nlen++;
        if ((rn = rn_match((caddr_t)&siso->siso_addr, tuba_tree))
             && ((rn->rn_flags & RNF_ROOT) == 0)) {
                tc = (struct tuba_cache *)rn;
                tc->tc_time = time.tv_sec;
        if ((rn = rn_match((caddr_t)&siso->siso_addr, tuba_tree))
             && ((rn->rn_flags & RNF_ROOT) == 0)) {
                tc = (struct tuba_cache *)rn;
                tc->tc_time = time.tv_sec;
-               return (tc->tc_index);
+               i = tc->index;
+       done:   siso->siso_nlen--;
+               return (i);
        }
        if ((tc = (struct tuba_cache *)malloc(sizeof(*tc), M_RTABLE, wait))
        }
        if ((tc = (struct tuba_cache *)malloc(sizeof(*tc), M_RTABLE, wait))
-               == NULL)
-               return (0);
+               == NULL) {
+               i = 0;
+               goto done;
+       }
        bzero((caddr_t)tc, sizeof (*tc));
        bzero((caddr_t)tc, sizeof (*tc));
-       bcopy(siso->siso_data, tc->tc_siso.siso_data,
-               tc->tc_siso.siso_nlen =  siso->siso_nlen);
-       rn_insert(&tc->tc_siso.siso_addr, tuba_tree, &dupentry, tc->tc_nodes);
+       tc->tc_addr = siso->siso_addr;
+       siso->siso_nlen--;
+       tc->tc_siso.siso_addr = siso->siso_addr;
+       rn_insert(&tc->tc_addr, tuba_tree, &dupentry, tc->tc_nodes);
        if (dupentry)
                panic("tuba_lookup 1");
        tc->tc_siso.siso_family = AF_ISO;
        if (dupentry)
                panic("tuba_lookup 1");
        tc->tc_siso.siso_family = AF_ISO;
@@ -99,7 +105,7 @@ tuba_lookup(siso, wait)
        new = (struct tuba_cache **)malloc((unsigned)i, M_RTABLE, wait);
        if (new == 0) {
                tuba_table_size = old_size;
        new = (struct tuba_cache **)malloc((unsigned)i, M_RTABLE, wait);
        if (new == 0) {
                tuba_table_size = old_size;
-               rn_delete(&tc->tc_siso.siso_addr, NULL, tuba_tree);
+               rn_delete(&tc->tc_addr, NULL, tuba_tree);
                free((caddr_t)tc, M_RTABLE);
                return (0);
        }
                free((caddr_t)tc, M_RTABLE);
                return (0);
        }
index a3557cf..34e80e9 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)tuba_table.h        8.1 (Berkeley) %G%
+ *     @(#)tuba_table.h        8.2 (Berkeley) %G%
  */
 
 struct tuba_cache {
  */
 
 struct tuba_cache {
@@ -17,6 +17,7 @@ struct tuba_cache {
        u_short tc_sum;                         /* cksum of nsap inc. length */
        u_short tc_ssum;                        /* swab(tc_sum) */
        struct  sockaddr_iso tc_siso;           /* for responding */
        u_short tc_sum;                         /* cksum of nsap inc. length */
        u_short tc_ssum;                        /* swab(tc_sum) */
        struct  sockaddr_iso tc_siso;           /* for responding */
+       struct  iso_addr tc_addr;
 };
 
 #define ADDCARRY(x)  (x >= 65535 ? x -= 65535 : x)
 };
 
 #define ADDCARRY(x)  (x >= 65535 ? x -= 65535 : x)