new syslog
[unix-history] / usr / src / sys / deprecated / netimp / if_imphost.c
index 70dea2b..23ead64 100644 (file)
@@ -1,4 +1,10 @@
-/*     if_imphost.c    4.19    83/06/13        */
+/*
+ * Copyright (c) 1982 Regents of the University of California.
+ * All rights reserved.  The Berkeley software License Agreement
+ * specifies the terms and conditions for redistribution.
+ *
+ *     @(#)if_imphost.c        6.7 (Berkeley) %G%
+ */
 
 #include "imp.h"
 #if NIMP > 0
 
 #include "imp.h"
 #if NIMP > 0
  * from the IMP protocol code (if_imp.c), or
  * interlocks with the code at splimp.
  */
  * from the IMP protocol code (if_imp.c), or
  * interlocks with the code at splimp.
  */
-#include "../h/param.h"
-#include "../h/mbuf.h"
+#include "param.h"
+#include "mbuf.h"
+#include "syslog.h"
 
 #include "../netinet/in.h"
 #include "../netinet/in_systm.h"
 
 
 #include "../netinet/in.h"
 #include "../netinet/in_systm.h"
 
-#include "../netimp/if_imp.h"
-#include "../netimp/if_imphost.h"
+#include "if_imp.h"
+#include "if_imphost.h"
 
 /*
  * Head of host table hash chains.
 
 /*
  * Head of host table hash chains.
@@ -114,18 +121,20 @@ hostfree(hp)
  * Reset a given network's host entries.
  */
 hostreset(net)     
  * Reset a given network's host entries.
  */
 hostreset(net)     
-       int net;
+       u_long net;
 {
        register struct mbuf *m;
        register struct host *hp, *lp;
        struct hmbuf *hm;
 {
        register struct mbuf *m;
        register struct host *hp, *lp;
        struct hmbuf *hm;
+       struct mbuf *mnext;
 
 
-       for (m = hosts; m; m = m->m_next) {
+       for (m = hosts; m; m = mnext) {
+               mnext = m->m_next;
                hm = mtod(m, struct hmbuf *);
                hp = hm->hm_hosts; 
                lp = hp + HPMBUF;
                while (hm->hm_count > 0 && hp < lp) {
                hm = mtod(m, struct hmbuf *);
                hp = hm->hm_hosts; 
                lp = hp + HPMBUF;
                while (hm->hm_count > 0 && hp < lp) {
-                       if (hp->h_addr.s_net == net) {
+                       if (in_netof(hp->h_addr) == net) {
                                hp->h_flags &= ~HF_INUSE;
                                hostrelease(hp);
                        }
                                hp->h_flags &= ~HF_INUSE;
                                hostrelease(hp);
                        }
@@ -157,6 +166,7 @@ hostrelease(hp)
                hp->h_q = 0;
        }
        hp->h_flags = 0;
                hp->h_q = 0;
        }
        hp->h_flags = 0;
+       hp->h_rfnm = 0;
        if (--mtod(mh, struct hmbuf *)->hm_count)
                return;
        mprev = &hosts;
        if (--mtod(mh, struct hmbuf *)->hm_count)
                return;
        mprev = &hosts;
@@ -196,17 +206,22 @@ hostslowtimo()
        register struct mbuf *m;
        register struct host *hp, *lp;
        struct hmbuf *hm;
        register struct mbuf *m;
        register struct host *hp, *lp;
        struct hmbuf *hm;
+       struct mbuf *mnext;
        int s = splimp();
 
        int s = splimp();
 
-       for (m = hosts; m; m = m->m_next) {
+       for (m = hosts; m; m = mnext) {
+               mnext = m->m_next;
                hm = mtod(m, struct hmbuf *);
                hp = hm->hm_hosts; 
                lp = hp + HPMBUF;
                for (; hm->hm_count > 0 && hp < lp; hp++) {
                hm = mtod(m, struct hmbuf *);
                hp = hm->hm_hosts; 
                lp = hp + HPMBUF;
                for (; hm->hm_count > 0 && hp < lp; hp++) {
-                       if (hp->h_flags & HF_INUSE)
-                               continue;
-                       if (hp->h_timer && --hp->h_timer == 0)
+                       if (hp->h_timer && --hp->h_timer == 0) {
+                               if (hp->h_rfnm)
+                                   log(LOG_WARNING,
+                                       "imp?: host %x, lost %d rfnms\n",
+                                       ntohl(hp->h_addr.s_addr), hp->h_rfnm);
                                hostrelease(hp);
                                hostrelease(hp);
+                       }
                }
        }
        splx(s);
                }
        }
        splx(s);