From a25418fddcf958c8a585779c7642bb88ceaf3f66 Mon Sep 17 00:00:00 2001 From: mischief Date: Sat, 17 Nov 2018 17:23:56 -0800 Subject: [PATCH] devbridge: fix runt packets going through the bridge (thanks cinap) linux will send small, unpadded arp packets which may arrive over wifi, so allow small packets into the bridge and pad any packets that are too small when going out. --- sys/src/9/port/devbridge.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/src/9/port/devbridge.c b/sys/src/9/port/devbridge.c index bc4537270..3b8ca9037 100644 --- a/sys/src/9/port/devbridge.c +++ b/sys/src/9/port/devbridge.c @@ -965,7 +965,7 @@ etherread(void *a) if(bp == nil) break; n = BLEN(bp); - if(port->closed || n < ETHERMINTU){ + if(port->closed || n < ETHERHDRSIZE){ freeb(bp); continue; } @@ -1056,6 +1056,9 @@ etherwrite(Port *port, Block *bp) epkt = (Etherpkt*)bp->rp; if(port->type != Ttun || !fragment(epkt, n)) { if(!waserror()){ + /* don't generate small packets */ + if(n < ETHERMINTU) + bp = adjustblock(bp, ETHERMINTU); devtab[port->data[1]->type]->bwrite(port->data[1], bp, 0); poperror(); }