|
|
|
@ -1,4 +1,4 @@
|
|
|
|
/* Copyright (C) 2007-2021 Open Information Security Foundation
|
|
|
|
/* Copyright (C) 2007-2022 Open Information Security Foundation
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* You can copy, redistribute or modify this Program under the terms of
|
|
|
|
* You can copy, redistribute or modify this Program under the terms of
|
|
|
|
* the GNU General Public License version 2 as published by the Free
|
|
|
|
* the GNU General Public License version 2 as published by the Free
|
|
|
|
@ -39,11 +39,11 @@ static void FrameDebug(const char *prefix, const Frames *frames, const Frame *fr
|
|
|
|
} else if (frames != NULL) {
|
|
|
|
} else if (frames != NULL) {
|
|
|
|
type_name = AppLayerParserGetFrameNameById(frames->ipproto, frames->alproto, frame->type);
|
|
|
|
type_name = AppLayerParserGetFrameNameById(frames->ipproto, frames->alproto, frame->type);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SCLogDebug("[%s] %p: frame: %p type %u/%s id %" PRIi64 " flags %02x rel_offset:%" PRIi64
|
|
|
|
SCLogDebug("[%s] %p: frame:%p type:%u/%s id:%" PRIi64 " flags:%02x offset:%" PRIu64
|
|
|
|
", len:%" PRIi64 ", events:%u %u/%u/%u/%u",
|
|
|
|
", len:%" PRIi64 ", events:%u %u/%u/%u/%u",
|
|
|
|
prefix, frames, frame, frame->type, type_name, frame->id, frame->flags,
|
|
|
|
prefix, frames, frame, frame->type, type_name, frame->id, frame->flags, frame->offset,
|
|
|
|
frame->rel_offset, frame->len, frame->event_cnt, frame->events[0], frame->events[1],
|
|
|
|
frame->len, frame->event_cnt, frame->events[0], frame->events[1], frame->events[2],
|
|
|
|
frame->events[2], frame->events[3]);
|
|
|
|
frame->events[3]);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -84,16 +84,13 @@ Frame *FrameGetByIndex(Frames *frames, const uint32_t idx)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// TODO review rel_offset logic. App-layer passes STREAM_APP_PROGRESS as
|
|
|
|
static Frame *FrameNew(Frames *frames, uint64_t offset, int64_t len)
|
|
|
|
// offset, but I think we're using rel_offset relative to BASE_PROGRESS
|
|
|
|
|
|
|
|
// here which changes only on slide.
|
|
|
|
|
|
|
|
static Frame *FrameNew(Frames *frames, int64_t rel_offset, int64_t len)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
BUG_ON(frames == NULL);
|
|
|
|
BUG_ON(frames == NULL);
|
|
|
|
|
|
|
|
|
|
|
|
if (frames->cnt < FRAMES_STATIC_CNT) {
|
|
|
|
if (frames->cnt < FRAMES_STATIC_CNT) {
|
|
|
|
Frame *frame = &frames->sframes[frames->cnt];
|
|
|
|
Frame *frame = &frames->sframes[frames->cnt];
|
|
|
|
frames->sframes[frames->cnt].rel_offset = rel_offset;
|
|
|
|
frames->sframes[frames->cnt].offset = offset;
|
|
|
|
frames->sframes[frames->cnt].len = len;
|
|
|
|
frames->sframes[frames->cnt].len = len;
|
|
|
|
frames->sframes[frames->cnt].id = ++frames->base_id;
|
|
|
|
frames->sframes[frames->cnt].id = ++frames->base_id;
|
|
|
|
frames->cnt++;
|
|
|
|
frames->cnt++;
|
|
|
|
@ -110,7 +107,7 @@ static Frame *FrameNew(Frames *frames, int64_t rel_offset, int64_t len)
|
|
|
|
BUG_ON(frames->cnt != FRAMES_STATIC_CNT + 1);
|
|
|
|
BUG_ON(frames->cnt != FRAMES_STATIC_CNT + 1);
|
|
|
|
|
|
|
|
|
|
|
|
frames->dyn_size = 8;
|
|
|
|
frames->dyn_size = 8;
|
|
|
|
frames->dframes[0].rel_offset = rel_offset;
|
|
|
|
frames->dframes[0].offset = offset;
|
|
|
|
frames->dframes[0].len = len;
|
|
|
|
frames->dframes[0].len = len;
|
|
|
|
frames->dframes[0].id = ++frames->base_id;
|
|
|
|
frames->dframes[0].id = ++frames->base_id;
|
|
|
|
return &frames->dframes[0];
|
|
|
|
return &frames->dframes[0];
|
|
|
|
@ -147,7 +144,7 @@ static Frame *FrameNew(Frames *frames, int64_t rel_offset, int64_t len)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
frames->cnt++;
|
|
|
|
frames->cnt++;
|
|
|
|
frames->dframes[dyn_cnt].rel_offset = rel_offset;
|
|
|
|
frames->dframes[dyn_cnt].offset = offset;
|
|
|
|
frames->dframes[dyn_cnt].len = len;
|
|
|
|
frames->dframes[dyn_cnt].len = len;
|
|
|
|
frames->dframes[dyn_cnt].id = ++frames->base_id;
|
|
|
|
frames->dframes[dyn_cnt].id = ++frames->base_id;
|
|
|
|
return &frames->dframes[dyn_cnt];
|
|
|
|
return &frames->dframes[dyn_cnt];
|
|
|
|
@ -180,19 +177,15 @@ static void AppLayerFrameDumpForFrames(const char *prefix, const Frames *frames)
|
|
|
|
SCLogDebug("prefix: %s", prefix);
|
|
|
|
SCLogDebug("prefix: %s", prefix);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static inline uint64_t FrameLeftEdge(
|
|
|
|
static inline uint64_t FrameLeftEdge(const TcpStream *stream, const Frame *frame)
|
|
|
|
const TcpStream *stream, const Frame *frame, const int64_t base_offset)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
const int64_t app_progress = STREAM_APP_PROGRESS(stream);
|
|
|
|
const int64_t app_progress = STREAM_APP_PROGRESS(stream);
|
|
|
|
BUG_ON(base_offset > app_progress);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const int64_t frame_offset = base_offset + frame->rel_offset;
|
|
|
|
const int64_t frame_offset = frame->offset;
|
|
|
|
const int64_t frame_data = app_progress - frame_offset;
|
|
|
|
const int64_t frame_data = app_progress - frame_offset;
|
|
|
|
|
|
|
|
|
|
|
|
SCLogDebug("base_offset %" PRIi64 ", app_progress %" PRIi64, base_offset, app_progress);
|
|
|
|
|
|
|
|
SCLogDebug("frame_offset %" PRIi64 ", frame_data %" PRIi64 ", frame->len %" PRIi64,
|
|
|
|
SCLogDebug("frame_offset %" PRIi64 ", frame_data %" PRIi64 ", frame->len %" PRIi64,
|
|
|
|
frame_offset, frame_data, frame->len);
|
|
|
|
frame_offset, frame_data, frame->len);
|
|
|
|
BUG_ON(frame_offset < 0);
|
|
|
|
|
|
|
|
BUG_ON(frame_offset > app_progress);
|
|
|
|
BUG_ON(frame_offset > app_progress);
|
|
|
|
|
|
|
|
|
|
|
|
/* length unknown, make sure to have at least 2500 */
|
|
|
|
/* length unknown, make sure to have at least 2500 */
|
|
|
|
@ -240,19 +233,19 @@ static inline uint64_t FrameLeftEdge(
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* [ stream ]
|
|
|
|
* [ stream ]
|
|
|
|
* [ frame ...........]
|
|
|
|
* [ frame ...........]
|
|
|
|
* rel_offset: 2
|
|
|
|
* offset: 2
|
|
|
|
* len: 19
|
|
|
|
* len: 19
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Slide:
|
|
|
|
* Slide:
|
|
|
|
* [ stream ]
|
|
|
|
* [ stream ]
|
|
|
|
* [ frame .... .]
|
|
|
|
* [ frame .... .]
|
|
|
|
* rel_offset: -10
|
|
|
|
* offset: 2
|
|
|
|
* len: 19
|
|
|
|
* len: 19
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Slide:
|
|
|
|
* Slide:
|
|
|
|
* [ stream ]
|
|
|
|
* [ stream ]
|
|
|
|
* [ frame ........... ]
|
|
|
|
* [ frame ........... ]
|
|
|
|
* rel_offset: -16
|
|
|
|
* offset: 2
|
|
|
|
* len: 19
|
|
|
|
* len: 19
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
static int FrameSlide(const char *ds, Frames *frames, const TcpStream *stream, const uint32_t slide)
|
|
|
|
static int FrameSlide(const char *ds, Frames *frames, const TcpStream *stream, const uint32_t slide)
|
|
|
|
@ -272,8 +265,7 @@ static int FrameSlide(const char *ds, Frames *frames, const TcpStream *stream, c
|
|
|
|
if (i < FRAMES_STATIC_CNT) {
|
|
|
|
if (i < FRAMES_STATIC_CNT) {
|
|
|
|
Frame *frame = &frames->sframes[i];
|
|
|
|
Frame *frame = &frames->sframes[i];
|
|
|
|
FrameDebug("slide(s)", frames, frame);
|
|
|
|
FrameDebug("slide(s)", frames, frame);
|
|
|
|
if (frame->len >= 0 &&
|
|
|
|
if (frame->len >= 0 && frame->offset + frame->len <= next_base) {
|
|
|
|
frame->rel_offset + frame->len <= (int64_t)slide) { // TODO check seems off
|
|
|
|
|
|
|
|
// remove by not incrementing 'x'
|
|
|
|
// remove by not incrementing 'x'
|
|
|
|
SCLogDebug("removing %p id %" PRIi64, frame, frame->id);
|
|
|
|
SCLogDebug("removing %p id %" PRIi64, frame, frame->id);
|
|
|
|
FrameClean(frame);
|
|
|
|
FrameClean(frame);
|
|
|
|
@ -281,18 +273,17 @@ static int FrameSlide(const char *ds, Frames *frames, const TcpStream *stream, c
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
Frame *nframe = &frames->sframes[x];
|
|
|
|
Frame *nframe = &frames->sframes[x];
|
|
|
|
FrameCopy(nframe, frame);
|
|
|
|
FrameCopy(nframe, frame);
|
|
|
|
nframe->rel_offset -= slide; /* turns negative if start if before window */
|
|
|
|
|
|
|
|
if (frame != nframe) {
|
|
|
|
if (frame != nframe) {
|
|
|
|
FrameClean(frame);
|
|
|
|
FrameClean(frame);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
le = MIN(le, FrameLeftEdge(stream, nframe, next_base));
|
|
|
|
le = MIN(le, FrameLeftEdge(stream, nframe));
|
|
|
|
x++;
|
|
|
|
x++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
const uint16_t o = i - FRAMES_STATIC_CNT;
|
|
|
|
const uint16_t o = i - FRAMES_STATIC_CNT;
|
|
|
|
Frame *frame = &frames->dframes[o];
|
|
|
|
Frame *frame = &frames->dframes[o];
|
|
|
|
FrameDebug("slide(d)", frames, frame);
|
|
|
|
FrameDebug("slide(d)", frames, frame);
|
|
|
|
if (frame->len >= 0 && frame->rel_offset + frame->len <= (int64_t)slide) {
|
|
|
|
if (frame->len >= 0 && frame->offset + frame->len <= next_base) {
|
|
|
|
// remove by not incrementing 'x'
|
|
|
|
// remove by not incrementing 'x'
|
|
|
|
SCLogDebug("removing %p id %" PRIi64, frame, frame->id);
|
|
|
|
SCLogDebug("removing %p id %" PRIi64, frame, frame->id);
|
|
|
|
FrameClean(frame);
|
|
|
|
FrameClean(frame);
|
|
|
|
@ -305,11 +296,10 @@ static int FrameSlide(const char *ds, Frames *frames, const TcpStream *stream, c
|
|
|
|
nframe = &frames->sframes[x];
|
|
|
|
nframe = &frames->sframes[x];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
FrameCopy(nframe, frame);
|
|
|
|
FrameCopy(nframe, frame);
|
|
|
|
nframe->rel_offset -= slide; /* turns negative if start is before window */
|
|
|
|
|
|
|
|
if (frame != nframe) {
|
|
|
|
if (frame != nframe) {
|
|
|
|
FrameClean(frame);
|
|
|
|
FrameClean(frame);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
le = MIN(le, FrameLeftEdge(stream, nframe, next_base));
|
|
|
|
le = MIN(le, FrameLeftEdge(stream, nframe));
|
|
|
|
x++;
|
|
|
|
x++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -390,8 +380,8 @@ void FramesFree(Frames *frames)
|
|
|
|
Frame *AppLayerFrameNewByPointer(Flow *f, const StreamSlice *stream_slice,
|
|
|
|
Frame *AppLayerFrameNewByPointer(Flow *f, const StreamSlice *stream_slice,
|
|
|
|
const uint8_t *frame_start, const int64_t len, int dir, uint8_t frame_type)
|
|
|
|
const uint8_t *frame_start, const int64_t len, int dir, uint8_t frame_type)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
SCLogDebug("stream_slice offset %" PRIu64, stream_slice->offset);
|
|
|
|
SCLogDebug("frame_start:%p stream_slice->input:%p stream_slice->offset:%" PRIu64, frame_start,
|
|
|
|
SCLogDebug("frame_start %p stream_slice->input %p", frame_start, stream_slice->input);
|
|
|
|
stream_slice->input, stream_slice->offset);
|
|
|
|
|
|
|
|
|
|
|
|
/* workarounds for many (unit|fuzz)tests not handling TCP data properly */
|
|
|
|
/* workarounds for many (unit|fuzz)tests not handling TCP data properly */
|
|
|
|
#if defined(UNITTESTS) || defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION)
|
|
|
|
#if defined(UNITTESTS) || defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION)
|
|
|
|
@ -418,23 +408,19 @@ Frame *AppLayerFrameNewByPointer(Flow *f, const StreamSlice *stream_slice,
|
|
|
|
if (frames_container == NULL)
|
|
|
|
if (frames_container == NULL)
|
|
|
|
return NULL;
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
|
|
TcpStream *stream;
|
|
|
|
|
|
|
|
TcpSession *ssn = f->protoctx;
|
|
|
|
|
|
|
|
Frames *frames;
|
|
|
|
Frames *frames;
|
|
|
|
if (dir == 0) {
|
|
|
|
if (dir == 0) {
|
|
|
|
frames = &frames_container->toserver;
|
|
|
|
frames = &frames_container->toserver;
|
|
|
|
stream = &ssn->client;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
frames = &frames_container->toclient;
|
|
|
|
frames = &frames_container->toclient;
|
|
|
|
stream = &ssn->server;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int64_t abs_frame_offset = stream_slice->offset + (int64_t)ptr_offset;
|
|
|
|
uint64_t abs_frame_offset = stream_slice->offset + ptr_offset;
|
|
|
|
int64_t rel_offset = abs_frame_offset - STREAM_BASE_OFFSET(stream);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Frame *r = FrameNew(frames, rel_offset, len);
|
|
|
|
Frame *r = FrameNew(frames, abs_frame_offset, len);
|
|
|
|
if (r != NULL) {
|
|
|
|
if (r != NULL) {
|
|
|
|
r->type = frame_type;
|
|
|
|
r->type = frame_type;
|
|
|
|
|
|
|
|
FrameDebug("new_by_ptr", frames, r);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return r;
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -487,42 +473,15 @@ Frame *AppLayerFrameNewByRelativeOffset(Flow *f, const StreamSlice *stream_slice
|
|
|
|
if (frames_container == NULL)
|
|
|
|
if (frames_container == NULL)
|
|
|
|
return NULL;
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
|
|
TcpStream *stream;
|
|
|
|
|
|
|
|
TcpSession *ssn = f->protoctx;
|
|
|
|
|
|
|
|
Frames *frames;
|
|
|
|
Frames *frames;
|
|
|
|
if (dir == 0) {
|
|
|
|
if (dir == 0) {
|
|
|
|
frames = &frames_container->toserver;
|
|
|
|
frames = &frames_container->toserver;
|
|
|
|
stream = &ssn->client;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
frames = &frames_container->toclient;
|
|
|
|
frames = &frames_container->toclient;
|
|
|
|
stream = &ssn->server;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const uint64_t base = STREAM_BASE_OFFSET(stream);
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
|
|
|
|
const uint64_t app = STREAM_APP_PROGRESS(stream);
|
|
|
|
|
|
|
|
const uint64_t app_offset = app - base;
|
|
|
|
|
|
|
|
const uint64_t slice_offset = stream_slice->offset - base;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SCLogDebug("app %" PRIu64 ", base %" PRIu64 ", slice %" PRIu64, app, base, slice_offset);
|
|
|
|
|
|
|
|
SCLogDebug("app_offset %" PRIu64 ", slice_offset %" PRIu64, app_offset, slice_offset);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
const uint64_t frame_abs_offset = (uint64_t)frame_start_rel + stream_slice->offset;
|
|
|
|
const uint64_t frame_abs_offset = (uint64_t)frame_start_rel + stream_slice->offset;
|
|
|
|
const uint64_t frame_base_offset = frame_abs_offset - base;
|
|
|
|
Frame *r = FrameNew(frames, frame_abs_offset, len);
|
|
|
|
|
|
|
|
|
|
|
|
SCLogDebug("frame_start_rel %u frame_abs_offset %" PRIu64 ", frame_base_offset %" PRIu64,
|
|
|
|
|
|
|
|
frame_start_rel, frame_abs_offset, frame_base_offset);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int64_t rel_offset = frame_base_offset;
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
|
|
|
|
const char *type_name = AppLayerParserGetFrameNameById(f->proto, f->alproto, frame_type);
|
|
|
|
|
|
|
|
SCLogDebug("flow %p direction %s frame offset %u rel_offset %" PRIi64 " (abs %" PRIu64
|
|
|
|
|
|
|
|
") starting at %" PRIu64 " len %" PRIi64 " (offset %" PRIu64 ") type %u/%s",
|
|
|
|
|
|
|
|
f, dir == 0 ? "toserver" : "toclient", frame_start_rel, rel_offset, frame_abs_offset,
|
|
|
|
|
|
|
|
frame_abs_offset, len, stream_slice->offset, frame_type, type_name);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Frame *r = FrameNew(frames, rel_offset, len);
|
|
|
|
|
|
|
|
if (r != NULL) {
|
|
|
|
if (r != NULL) {
|
|
|
|
r->type = frame_type;
|
|
|
|
r->type = frame_type;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -563,25 +522,18 @@ Frame *AppLayerFrameNewByAbsoluteOffset(Flow *f, const StreamSlice *stream_slice
|
|
|
|
if (frames_container == NULL)
|
|
|
|
if (frames_container == NULL)
|
|
|
|
return NULL;
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
|
|
TcpSession *ssn = f->protoctx;
|
|
|
|
|
|
|
|
TcpStream *stream;
|
|
|
|
|
|
|
|
Frames *frames;
|
|
|
|
Frames *frames;
|
|
|
|
if (dir == 0) {
|
|
|
|
if (dir == 0) {
|
|
|
|
stream = &ssn->client;
|
|
|
|
|
|
|
|
frames = &frames_container->toserver;
|
|
|
|
frames = &frames_container->toserver;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
stream = &ssn->server;
|
|
|
|
|
|
|
|
frames = &frames_container->toclient;
|
|
|
|
frames = &frames_container->toclient;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const uint64_t frame_start_rel = frame_start - STREAM_BASE_OFFSET(stream);
|
|
|
|
SCLogDebug("flow %p direction %s frame type %u offset %" PRIu64 " len %" PRIi64
|
|
|
|
#ifdef DEBUG
|
|
|
|
" (slice offset %" PRIu64 ")",
|
|
|
|
SCLogDebug("flow %p direction %s frame type %u offset %" PRIu64 " (abs %" PRIu64
|
|
|
|
f, dir == 0 ? "toserver" : "toclient", frame_type, frame_start, len,
|
|
|
|
") starting at %" PRIu64 " len %" PRIi64 " (offset %" PRIu64 ")",
|
|
|
|
stream_slice->offset);
|
|
|
|
f, dir == 0 ? "toserver" : "toclient", frame_type, frame_start_rel, frame_start,
|
|
|
|
Frame *r = FrameNew(frames, frame_start, len);
|
|
|
|
frame_start, len, stream_slice->offset);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
Frame *r = FrameNew(frames, (uint32_t)frame_start_rel, len);
|
|
|
|
|
|
|
|
if (r != NULL) {
|
|
|
|
if (r != NULL) {
|
|
|
|
r->type = frame_type;
|
|
|
|
r->type = frame_type;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -667,7 +619,7 @@ static inline bool FrameIsDone(
|
|
|
|
if (frame->len < 0)
|
|
|
|
if (frame->len < 0)
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
const int64_t frame_abs_offset = (int64_t)abs_offset + frame->rel_offset;
|
|
|
|
const int64_t frame_abs_offset = frame->offset;
|
|
|
|
const int64_t frame_right_edge = frame_abs_offset + frame->len;
|
|
|
|
const int64_t frame_right_edge = frame_abs_offset + frame->len;
|
|
|
|
if ((uint64_t)frame_right_edge <= abs_right_edge) {
|
|
|
|
if ((uint64_t)frame_right_edge <= abs_right_edge) {
|
|
|
|
SCLogDebug("frame %p id %" PRIi64 " is done", frame, frame->id);
|
|
|
|
SCLogDebug("frame %p id %" PRIi64 " is done", frame, frame->id);
|
|
|
|
@ -700,7 +652,7 @@ static void FramePrune(Frames *frames, const TcpStream *stream, const bool eof)
|
|
|
|
FrameClean(frame);
|
|
|
|
FrameClean(frame);
|
|
|
|
removed++;
|
|
|
|
removed++;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
const uint64_t fle = FrameLeftEdge(stream, frame, STREAM_BASE_OFFSET(stream));
|
|
|
|
const uint64_t fle = FrameLeftEdge(stream, frame);
|
|
|
|
le = MIN(le, fle);
|
|
|
|
le = MIN(le, fle);
|
|
|
|
SCLogDebug("le %" PRIu64 ", frame fle %" PRIu64, le, fle);
|
|
|
|
SCLogDebug("le %" PRIu64 ", frame fle %" PRIu64, le, fle);
|
|
|
|
Frame *nframe = &frames->sframes[x];
|
|
|
|
Frame *nframe = &frames->sframes[x];
|
|
|
|
@ -721,7 +673,7 @@ static void FramePrune(Frames *frames, const TcpStream *stream, const bool eof)
|
|
|
|
FrameClean(frame);
|
|
|
|
FrameClean(frame);
|
|
|
|
removed++;
|
|
|
|
removed++;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
const uint64_t fle = FrameLeftEdge(stream, frame, STREAM_BASE_OFFSET(stream));
|
|
|
|
const uint64_t fle = FrameLeftEdge(stream, frame);
|
|
|
|
le = MIN(le, fle);
|
|
|
|
le = MIN(le, fle);
|
|
|
|
SCLogDebug("le %" PRIu64 ", frame fle %" PRIu64, le, fle);
|
|
|
|
SCLogDebug("le %" PRIu64 ", frame fle %" PRIu64, le, fle);
|
|
|
|
Frame *nframe;
|
|
|
|
Frame *nframe;
|
|
|
|
|