shithub: riscv

Download patch

ref: 8a1c1c951066705b98b417f26eebcb293e3b549d
parent: 801664db7f4ed740d40f40f93f1aa4dd48e1c329
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Jul 23 18:20:23 EDT 2023

devether: must not loop-back packets from bypass

ethermux() must handle a packet from bypass the same as if it
was received physically (from == nil).

--- a/sys/src/9/port/devether.c
+++ b/sys/src/9/port/devether.c
@@ -202,7 +202,7 @@
 
 	x = nil;
 	type = (pkt->type[0]<<8)|pkt->type[1];
-	dispose = tome || from == nil || port > 0;
+	dispose = tome || from == nil || port > 0 || (*from)->bypass;
 
 	for(fp = ether->f; fp < &ether->f[Ntypes]; fp++){
 		if((f = *fp) == nil)
--- a/sys/src/cmd/nusb/ether/ether.c
+++ b/sys/src/cmd/nusb/ether/ether.c
@@ -796,7 +796,7 @@
 
 	x = nil;
 	type = (pkt->type[0]<<8)|pkt->type[1];
-	dispose = tome || from == nil || port > 0;
+	dispose = tome || from == nil || port > 0 || from->bypass;
 
 	for(c = conn; c < &conn[nconn]; c++){
 		if(!c->used)