ip/ethermedium: drop short packets instead of producing negative size blocks
on usb ethernet, it can happen that we read truncated packets smaller than the ethernet header size. this produces a warning in pullupblock() later like: "pullup negative length packet, called from 0xf0199e46"
This commit is contained in:
parent
202be57bb9
commit
bf048d94c3
1 changed files with 8 additions and 6 deletions
|
@ -354,11 +354,12 @@ etherread4(void *a)
|
|||
nexterror();
|
||||
}
|
||||
ifc->in++;
|
||||
bp->rp += ifc->m->hsize;
|
||||
if(ifc->lifc == nil)
|
||||
if(ifc->lifc == nil || BLEN(bp) <= ifc->m->hsize)
|
||||
freeb(bp);
|
||||
else
|
||||
else {
|
||||
bp->rp += ifc->m->hsize;
|
||||
ipiput4(er->f, ifc, bp);
|
||||
}
|
||||
runlock(ifc);
|
||||
poperror();
|
||||
}
|
||||
|
@ -393,11 +394,12 @@ etherread6(void *a)
|
|||
nexterror();
|
||||
}
|
||||
ifc->in++;
|
||||
bp->rp += ifc->m->hsize;
|
||||
if(ifc->lifc == nil)
|
||||
if(ifc->lifc == nil || BLEN(bp) <= ifc->m->hsize)
|
||||
freeb(bp);
|
||||
else
|
||||
else {
|
||||
bp->rp += ifc->m->hsize;
|
||||
ipiput6(er->f, ifc, bp);
|
||||
}
|
||||
runlock(ifc);
|
||||
poperror();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue