From 417a3d4aab027fe329d7793593ee0b91955c6718 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Wed, 29 Jun 1994 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1994-06-29 --- pc/devether.c | 3 ++- port/netif.c | 7 +++++++ port/netif.h | 3 ++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/pc/devether.c b/pc/devether.c index 43f1421dd95b5f52c9f4f4519295a4201f845b4a..f7ac3e9bf45f7dff8200961cf7ba4f5c02fb4f30 100644 --- a/pc/devether.c +++ b/pc/devether.c @@ -114,7 +114,8 @@ etherwloop(Ether *ctlr, Etherpkt *pkt, long len) int s, different; different = memcmp(pkt->d, pkt->s, sizeof(pkt->s)); - if(different && memcmp(pkt->d, ctlr->bcast, sizeof(pkt->d))) + if(different && memcmp(pkt->d, ctlr->bcast, sizeof(pkt->d)) + && ctlr->prom==0 && ctlr->all==0) return 0; s = splhi(); diff --git a/port/netif.c b/port/netif.c index 45744dd2f824ddc32298231633aca19d6111806f..81b80e9d726833186552236622cc802fa51b2b85 100644 --- a/port/netif.c +++ b/port/netif.c @@ -213,6 +213,8 @@ netifwrite(Netif *nif, Chan *c, void *a, long n) f = nif->f[NETID(c->qid.path)]; if(p = matchtoken(buf, "connect")){ f->type = atoi(p); + if(f->type < 0) + nif->all++; } else if(matchtoken(buf, "promiscuous")){ f->prom = 1; nif->prom++; @@ -266,6 +268,11 @@ netifclose(Netif *nif, Chan *c) (*nif->promiscuous)(nif->arg, 0); qunlock(nif); } + if(f->type < 0){ + qlock(nif); + --(nif->all); + qunlock(nif); + } f->owner[0] = 0; f->type = 0; qclose(f->in); diff --git a/port/netif.h b/port/netif.h index ad19214dee7d0e530232d4a9d11e821467f39bb6..bd6acd794107014c3e2d8bcea089a492e38ed26e 100644 --- a/port/netif.h +++ b/port/netif.h @@ -57,7 +57,8 @@ struct Netif int alen; /* address length */ uchar addr[Nmaxaddr]; uchar bcast[Nmaxaddr]; - int prom; + int prom; /* number of promiscuous opens */ + int all; /* number of -1 multiplexors */ /* statistics */ int misses;