X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/02a10311decbb485ee780badd520034d60ebf0c3..3f1d78415e324b577aa30b313aed7777952a87fe:/usr/src/sys/deprecated/netimp/if_imphost.c diff --git a/usr/src/sys/deprecated/netimp/if_imphost.c b/usr/src/sys/deprecated/netimp/if_imphost.c index 70dea2ba46..23ead64916 100644 --- a/usr/src/sys/deprecated/netimp/if_imphost.c +++ b/usr/src/sys/deprecated/netimp/if_imphost.c @@ -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 @@ -10,14 +16,15 @@ * 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 "../netimp/if_imp.h" -#include "../netimp/if_imphost.h" +#include "if_imp.h" +#include "if_imphost.h" /* * Head of host table hash chains. @@ -114,18 +121,20 @@ hostfree(hp) * 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; + 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) { - if (hp->h_addr.s_net == net) { + if (in_netof(hp->h_addr) == net) { hp->h_flags &= ~HF_INUSE; hostrelease(hp); } @@ -157,6 +166,7 @@ hostrelease(hp) hp->h_q = 0; } hp->h_flags = 0; + hp->h_rfnm = 0; 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; + struct mbuf *mnext; 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++) { - 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); + } } } splx(s);