ref: 5ff4ea489a87f63ef4b1c6298ae694089ada976c
parent: 639f9e8de7ad75f1c985d2cec2ef8b39b3d73070
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sat May 3 11:17:50 EDT 2025
nusb/ether: reset promiscuous mode only when connection gets closed We used to reset promiscuous mode state of a connection every time a ctl file gets closed. This is wrong and it should only get reset when the refcount (used) drops to zero instead.
--- a/sys/src/cmd/nusb/ether/ether.c
+++ b/sys/src/cmd/nusb/ether/ether.c
@@ -589,18 +589,16 @@
}
free(d);
}
- if(TYPE(fid->qid.path) == Qctl){
- if(c->prom){
- c->prom = 0;
- if(--nprom == 0 && eppromiscuous != nil)
- (*eppromiscuous)(epctl, 0);
- }
- }
if(TYPE(fid->qid.path) == Qdata && c->bridge)
memset(mactab, 0, sizeof(mactab));
if(--c->used == 0){
if(c->bypass)
bypass = nil;
+ if(c->prom){
+ c->prom = 0;
+ if(--nprom == 0 && eppromiscuous != nil)
+ (*eppromiscuous)(epctl, 0);
+ }
}
qunlock(c);
}
--
⑨