projects
/
l2tpns.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
MPPP: Discard fragments even when reassembling failed
[l2tpns.git]
/
ppp.c
diff --git
a/ppp.c
b/ppp.c
index
036292a
..
ee299cb
100644
(file)
--- 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 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)
{
// 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 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
// 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;
uint16_t index = M_index;
uint8_t end_or_hole_found = 0;
-
for (;;
)
+
while (index != this_fragmentation->start_index
)
{
fragmentt *this_frag;
{
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))
// 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_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))
// we are a hole or a MP_END
if (!this_frag->length || (this_frag->flags & MP_END))
+ {
end_or_hole_found = 1;
end_or_hole_found = 1;
-
- if (end_or_hole_found)
end_index = index;
end_index = index;
+ }
}
if (end_or_hole_found)
}
if (end_or_hole_found)
@@
-2040,9
+2046,6
@@
discard_lost_frames:
this_frag->flags = 0;
this_frag->length = 0;
}
this_frag->flags = 0;
this_frag->length = 0;
}
-
- if (index == this_fragmentation->start_index)
- break;
}
this_fragmentation->start_index = (end_index + 1) & MAXFRAGNUM_MASK;
}
this_fragmentation->start_index = (end_index + 1) & MAXFRAGNUM_MASK;