Fix reassembly when packet spawns >2 frames
@@ -334,7 +334,10 @@ func (l *ReassemblyList) tryReassemble(from *list.Element) {
var to *list.Element
for e := from.Next(); e != nil; e = e.Next() {
currFrame := e.Value.(*FrameBuf)
- if currFrame.seqNr == prevSeqNr+1 {
+ if currFrame.seqNr != prevSeqNr+1 {
+ // Missing frame. Cannot reassemble packet yet.
+ break
+ }
prevSeqNr = currFrame.seqNr
// Add number of bytes contained in this frame. This potentially adds
// too much, but we are only using it to detect whether we potentially
@@ -353,9 +356,6 @@ func (l *ReassemblyList) tryReassemble(from *list.Element) {
break
}
}
- // Missing frame. Cannot reassemble packet yet.
- break
- }
if to != nil {
l.collectAndWrite(from, to)
}
