nusb/ether: dont forward loopback packets on bridges, remove read nonblocking hack

This commit is contained in:
cinap_lenrek 2017-12-18 20:50:25 +01:00
parent c1eb4b8d68
commit 3e22f7ef1d

View file

@ -58,8 +58,6 @@ struct Dq
Block **qt; Block **qt;
int size; int size;
int nb;
}; };
struct Conn struct Conn
@ -262,12 +260,6 @@ readconndata(Req *r)
d = r->fid->aux; d = r->fid->aux;
qlock(d); qlock(d);
if(d->q==nil && d->nb){
qunlock(d);
r->ofcall.count = 0;
respond(r, nil);
return;
}
r->aux = nil; r->aux = nil;
*d->rt = r; *d->rt = r;
d->rt = (Req**)&r->aux; d->rt = (Req**)&r->aux;
@ -278,18 +270,12 @@ readconndata(Req *r)
static void static void
writeconndata(Req *r) writeconndata(Req *r)
{ {
Dq *d;
void *p; void *p;
int n; int n;
Block *b; Block *b;
d = r->fid->aux;
p = r->ifcall.data; p = r->ifcall.data;
n = r->ifcall.count; n = r->ifcall.count;
if((n == 11) && memcmp(p, "nonblocking", n)==0){
d->nb = 1;
goto out;
}
/* minimum frame length for rtl8150 */ /* minimum frame length for rtl8150 */
if(n < 60) if(n < 60)
@ -315,7 +301,6 @@ writeconndata(Req *r)
etheriq(b, 0); etheriq(b, 0);
out:
r->ofcall.count = r->ifcall.count; r->ofcall.count = r->ifcall.count;
respond(r, nil); respond(r, nil);
} }
@ -725,7 +710,7 @@ etheriq(Block *b, int wire)
qlock(c); qlock(c);
if(!c->used) if(!c->used)
goto next; goto next;
if(c->bridge && !wire && !fromme) if(c->bridge && (tome || !wire && !fromme))
goto next; goto next;
if(c->type > 0 && c->type != t) if(c->type > 0 && c->type != t)
goto next; goto next;