X-Git-Url: http://git.sameswireless.fr/l2tpns.git/blobdiff_plain/5fef66669724a4f255df81ba3b6b6064f8737fea..3e2e05dd19885f9e2f7e605c58ef650c970874c8:/ppp.c diff --git a/ppp.c b/ppp.c index 036292a..ee299cb 100644 --- a/ppp.c +++ b/ppp.c @@ -1946,7 +1946,7 @@ void processmpin(sessionidt s, tunnelidt t, uint8_t *p, uint16_t l) // return if a lost fragment is found if (!(this_fragmentation->fragment[begin_index].length)) - return; // assembling frame failed + goto discard_lost_frames; // assembling frame failed // get the end of his frame while (this_fragmentation->fragment[end_index].length) { @@ -1957,7 +1957,7 @@ void processmpin(sessionidt s, tunnelidt t, uint8_t *p, uint16_t l) // return if a lost fragment is found if (!(this_fragmentation->fragment[end_index].length)) - return; // assembling frame failed + goto discard_lost_frames; // assembling frame failed // assemble the packet //assemble frame, process it, reset fragmentation @@ -2012,7 +2012,7 @@ discard_lost_frames: uint16_t index = M_index; uint8_t end_or_hole_found = 0; - for (;;) + while (index != this_fragmentation->start_index) { fragmentt *this_frag; @@ -2022,17 +2022,23 @@ discard_lost_frames: // before a MP_BEGIN, there must be a MP_END if (front_frag->length && (front_frag->flags & MP_BEGIN)) + { end_or_hole_found = 1; + end_index = index; + } + } - index = (index + (MAXFRAGNUM-1)) & MAXFRAGNUM_MASK; - this_frag = &this_fragmentation->frag[index]; + index = (index + (MAXFRAGNUM-1)) & MAXFRAGNUM_MASK; + this_frag = &this_fragmentation->frag[index]; + if (!end_or_hole_found) + { // we are a hole or a MP_END if (!this_frag->length || (this_frag->flags & MP_END)) + { end_or_hole_found = 1; - - if (end_or_hole_found) end_index = index; + } } if (end_or_hole_found) @@ -2040,9 +2046,6 @@ discard_lost_frames: this_frag->flags = 0; this_frag->length = 0; } - - if (index == this_fragmentation->start_index) - break; } this_fragmentation->start_index = (end_index + 1) & MAXFRAGNUM_MASK;