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.
This commit is contained in:
parent
fbfa249c63
commit
a25418fddc
|
@ -965,7 +965,7 @@ etherread(void *a)
|
||||||
if(bp == nil)
|
if(bp == nil)
|
||||||
break;
|
break;
|
||||||
n = BLEN(bp);
|
n = BLEN(bp);
|
||||||
if(port->closed || n < ETHERMINTU){
|
if(port->closed || n < ETHERHDRSIZE){
|
||||||
freeb(bp);
|
freeb(bp);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1056,6 +1056,9 @@ etherwrite(Port *port, Block *bp)
|
||||||
epkt = (Etherpkt*)bp->rp;
|
epkt = (Etherpkt*)bp->rp;
|
||||||
if(port->type != Ttun || !fragment(epkt, n)) {
|
if(port->type != Ttun || !fragment(epkt, n)) {
|
||||||
if(!waserror()){
|
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);
|
devtab[port->data[1]->type]->bwrite(port->data[1], bp, 0);
|
||||||
poperror();
|
poperror();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue