git: 9front

Download patch

ref: b1109ec7df8dae0a0aa45e1cb39f2f15071e643f
parent: 14cbac61c8b5f690b2d402f58a27b6ec2c112aa9
author: mischief <mischief@offblast.org>
date: Sat Nov 17 12:23:56 EST 2018

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.

--- a/sys/src/9/port/devbridge.c
+++ b/sys/src/9/port/devbridge.c
@@ -965,7 +965,7 @@
 		if(bp == nil)
 			break;
 		n = BLEN(bp);
-		if(port->closed || n < ETHERMINTU){
+		if(port->closed || n < ETHERHDRSIZE){
 			freeb(bp);
 			continue;
 		}
@@ -1056,6 +1056,9 @@
 	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();
 		}
--