logical host handling, fix up some cruft, ...
authorBill Joy <root@ucbvax.Berkeley.EDU>
Wed, 10 Mar 1982 09:40:41 +0000 (01:40 -0800)
committerBill Joy <root@ucbvax.Berkeley.EDU>
Wed, 10 Mar 1982 09:40:41 +0000 (01:40 -0800)
SCCS-vsn: sys/deprecated/netimp/if_imphost.h 4.5
SCCS-vsn: sys/deprecated/netimp/if_imphost.c 4.6

usr/src/sys/deprecated/netimp/if_imphost.c
usr/src/sys/deprecated/netimp/if_imphost.h

index 8aacfb0..48fc64d 100644 (file)
@@ -1,4 +1,4 @@
-/*     if_imphost.c    4.5     82/02/21        */
+/*     if_imphost.c    4.6     82/03/09        */
 
 #include "imp.h"
 #if NIMP > 0
 
 #include "imp.h"
 #if NIMP > 0
@@ -32,11 +32,12 @@ hostlookup(addr)
        register int hash = HOSTHASH(addr);
 
 COUNT(HOSTLOOKUP);
        register int hash = HOSTHASH(addr);
 
 COUNT(HOSTLOOKUP);
+       addr.s_lh = 0;
        for (m = hosts; m; m = m->m_next) {
                hp = &mtod(m, struct hmbuf *)->hm_hosts[hash];
                if (hp->h_refcnt == 0)
                        continue;
        for (m = hosts; m; m = m->m_next) {
                hp = &mtod(m, struct hmbuf *)->hm_hosts[hash];
                if (hp->h_refcnt == 0)
                        continue;
-               if (hp->h_addr.s_addr == addr.s_addr)    
+               if (hp->h_addr.s_addr == addr.s_addr)
                        return (hp);
        }
        return (0);
                        return (hp);
        }
        return (0);
@@ -56,6 +57,7 @@ hostenter(addr)
        register int hash = HOSTHASH(addr);
 
 COUNT(HOSTENTER);
        register int hash = HOSTHASH(addr);
 
 COUNT(HOSTENTER);
+       addr.s_lh = 0;
        mprev = &hosts;
        while (m = *mprev) {
                hp = &mtod(m, struct hmbuf *)->hm_hosts[hash];
        mprev = &hosts;
        while (m = *mprev) {
                hp = &mtod(m, struct hmbuf *)->hm_hosts[hash];
@@ -127,8 +129,10 @@ COUNT(HOSTRESET);
                hp = hm->hm_hosts; 
                lp = hp + HPMBUF;
                while (hm->hm_count != 0 && hp < lp) {
                hp = hm->hm_hosts; 
                lp = hp + HPMBUF;
                while (hm->hm_count != 0 && hp < lp) {
-                       if (hp->h_addr.s_net == net)
+                       if (hp->h_addr.s_net == net) {
+                               hp->h_refcnt = 0;
                                hostrelease(mtod(m, struct hmbuf *), hp);
                                hostrelease(mtod(m, struct hmbuf *), hp);
+                       }
                        hp++;
                }
        }
                        hp++;
                }
        }
index 0a41ea8..2a35c35 100644 (file)
@@ -1,4 +1,4 @@
-/*     if_imphost.h    4.4     82/02/21        */
+/*     if_imphost.h    4.5     82/03/09        */
 
 /*
  * Host structure used with IMP's.
 
 /*
  * Host structure used with IMP's.
@@ -37,23 +37,24 @@ struct host {
  */
 #define        HOST_ENQUE(hp, m) { \
        register struct mbuf *n; \
  */
 #define        HOST_ENQUE(hp, m) { \
        register struct mbuf *n; \
-       hp->h_qcnt++; \
-       if ((n = hp->h_q) == 0) \
-               hp->h_q = m->m_act = m; \
+       (hp)->h_qcnt++; \
+       if ((n = (hp)->h_q) == 0) \
+               (hp)->h_q = (m)->m_act = (m); \
        else { \
        else { \
-               m->m_act = n->m_act; \
-               hp->h_q = n->m_act = m; \
+               (m)->m_act = n->m_act; \
+               (hp)->h_q = n->m_act = (m); \
        } \
 }
 #define        HOST_DEQUE(hp, m) { \
        } \
 }
 #define        HOST_DEQUE(hp, m) { \
-       if (m = hp->h_q) { \
-               if (m->m_act == m) \
-                       hp->h_q = 0; \
+       if ((m) = (hp)->h_q) { \
+               if ((m)->m_act == (m)) \
+                       (hp)->h_q = 0; \
                else { \
                else { \
-                       m = m->m_act; \
-                       hp->h_q->m_act = m->m_act; \
+                       (m) = (m)->m_act; \
+                       (hp)->h_q->m_act = (m)->m_act; \
                } \
                } \
-               hp->h_qcnt--; \
+               (hp)->h_qcnt--; \
+               (m)->m_act = 0; \
        } \
 }
 
        } \
 }