changelog shortlog tags branches files raw gz bz2 help

Mercurial > hg > plan9front / changeset: devbridge: fix runt packets going through the bridge (thanks cinap)

changeset 6890: f47a9f61f3ed
parent 6889: f8944a8c8647
child 6891: 9ae9d496c4aa
author: mischief <mischief@offblast.org>
date: Sat, 17 Nov 2018 17:23:56 -0800
files: sys/src/9/port/devbridge.c
description: 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.
     1.1--- a/sys/src/9/port/devbridge.c
     1.2+++ b/sys/src/9/port/devbridge.c
     1.3@@ -965,7 +965,7 @@ etherread(void *a)
     1.4 		if(bp == nil)
     1.5 			break;
     1.6 		n = BLEN(bp);
     1.7-		if(port->closed || n < ETHERMINTU){
     1.8+		if(port->closed || n < ETHERHDRSIZE){
     1.9 			freeb(bp);
    1.10 			continue;
    1.11 		}
    1.12@@ -1056,6 +1056,9 @@ etherwrite(Port *port, Block *bp)
    1.13 	epkt = (Etherpkt*)bp->rp;
    1.14 	if(port->type != Ttun || !fragment(epkt, n)) {
    1.15 		if(!waserror()){
    1.16+			/* don't generate small packets */
    1.17+			if(n < ETHERMINTU)
    1.18+				bp = adjustblock(bp, ETHERMINTU);
    1.19 			devtab[port->data[1]->type]->bwrite(port->data[1], bp, 0);
    1.20 			poperror();
    1.21 		}