From 94daac47a198604080fb419f5adca43782163a05 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Tue, 3 Aug 1999 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1999-08-03 --- ip/ipifc.c | 13 ++++++++++--- port/devbridge.c | 8 +++++--- port/devroot.c | 2 +- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/ip/ipifc.c b/ip/ipifc.c index a194490e0a94a98f7596d28eb09d58d2bd6d2002..54778e0dd2b5302e2eaba2f79475d1f6b5ccc69a 100644 --- a/ip/ipifc.c +++ b/ip/ipifc.c @@ -1244,6 +1244,7 @@ ipifcregisterproxy(Fs *f, Ipifc *ifc, uchar *ip) Conv **cp, **e; Ipifc *nifc; Iplifc *lifc; + Medium *m; uchar net[IPaddrlen]; /* register the address on any network that will proxy for us */ @@ -1252,16 +1253,22 @@ ipifcregisterproxy(Fs *f, Ipifc *ifc, uchar *ip) if(*cp == nil) continue; nifc = (Ipifc*)(*cp)->ptcl; - if(nifc->m->areg == nil) - continue; if(nifc == ifc) continue; + + rlock(nifc); + m = nifc->m; + if(m == nil || m->areg == nil){ + runlock(nifc); + continue; + } for(lifc = nifc->lifc; lifc; lifc = lifc->next){ maskip(ip, lifc->mask, net); if(ipcmp(net, lifc->remote) == 0){ - (*nifc->m->areg)(nifc, ip); + (*m->areg)(nifc, ip); break; } } + runlock(nifc); } } diff --git a/port/devbridge.c b/port/devbridge.c index b6f3ec81968310ed08406e18cc751f9f314a229e..7eefe8785b17e36c791839549301c441e8c45ddd 100644 --- a/port/devbridge.c +++ b/port/devbridge.c @@ -799,7 +799,7 @@ etherread(void *a) Block *bp, *bp2; Etherpkt *ep; Centry *ce; - +static uchar tribble[Eaddrlen] = {0x00, 0xd1, 0x80, 0xaa, 0xbb, 0x07}; qlock(b); port->readp = up; /* hide identity under a rock for unbind */ @@ -841,8 +841,10 @@ etherread(void *a) if(ce == nil) { b->miss++; port->inunknown++; - bp2 = bp; bp = nil; - ethermultiwrite(b, bp2, port); + if(port->type != Tether || memcmp(ep->s, tribble, Eaddrlen) == 0) { + bp2 = bp; bp = nil; + ethermultiwrite(b, bp2, port); + } } else if (ce->port != port->id) { b->hit++; bp2 = bp; bp = nil; diff --git a/port/devroot.c b/port/devroot.c index a2df3d8f377cdda2951ca67dda58d697c22e491f..dd299f09b5749fb2cdc7d76220f06efba897d2f1 100644 --- a/port/devroot.c +++ b/port/devroot.c @@ -76,7 +76,7 @@ addrootfile(char *name, uchar *contents, ulong len) static void addrootdir(char *name) { - addroot(name, nil, 0, CHDIR); + addroot(name, nil, 0, CHDIR|0555); } static void