9front - general discussion about 9front
 help / color / mirror / Atom feed
From: Arne Meyer <meyer.arne83@netcologne.de>
To: "9front@9front.org" <9front@9front.org>
Subject: [9front] [PATCH] nusb/ether: Don't pass ethernet fcs to the network stack for smsc and lan78xx
Date: Wed, 5 Jun 2024 18:52:25 +0200 (CEST)	[thread overview]
Message-ID: <340081202.2781657.1717606345938@comcenter.netcologne.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 201 bytes --]

tested on a rpi3 for smsc. the lan78xx is basically the same and openbsd's mue(4) also strips the fcs.
So this should be fine.

I did this patch with git/export, hope I did it correct.

Greetings,
Arne

[-- Attachment #2: nusbether.diff --]
[-- Type: application/octet-stream, Size: 919 bytes --]

From: Arne Meyer <meyer.arne83@netcologne.de>
Date: Wed, 05 Jun 2024 09:22:31 +0000
Subject: [PATCH] nusb/ether: Don't pass ethernet fcs to the network stack for smsc and lan78xx

---
diff 828c577e03e15f59a69bff965893e3a670a8f10f 585b55096bcf7e1e6dbb1152a41daec714fee522
--- a/sys/src/cmd/nusb/ether/lan78xx.c
+++ b/sys/src/cmd/nusb/ether/lan78xx.c
@@ -252,10 +252,11 @@
 			break;
 		if((hd & Rxerror) == 0){
 			if(n == BLEN(b)){
+				b->wr -= 4;
 				etheriq(b);
 				return 0;
 			}
-			etheriq(copyblock(b, n));
+			etheriq(copyblock(b, n - 4));
 		}
 		b->rp = (uchar*)(((uintptr)b->rp + n + 3)&~3);
 	}
--- a/sys/src/cmd/nusb/ether/smsc.c
+++ b/sys/src/cmd/nusb/ether/smsc.c
@@ -228,10 +228,11 @@
 			break;
 		if((hd & Rxerror) == 0){
 			if(n == BLEN(b)){
+				b->wp -= 4;
 				etheriq(b);
 				return 0;
 			}
-			etheriq(copyblock(b, n));
+			etheriq(copyblock(b, n - 4));
 		}
 		b->rp += (n + 3) & ~3;
 	}

                 reply	other threads:[~2024-06-05 16:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=340081202.2781657.1717606345938@comcenter.netcologne.de \
    --to=meyer.arne83@netcologne.de \
    --cc=9front@9front.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).