stream/bool: Use bool for StreamTcpInlineMode

pull/9829/head
Jeff Lucovsky 2 years ago committed by Victor Julien
parent 9bd2b7425d
commit 2016d68f41

@ -779,7 +779,7 @@ static inline uint64_t GetLeftEdge(Flow *f, TcpSession *ssn, TcpStream *stream)
if (use_raw) {
uint64_t raw_progress = STREAM_RAW_PROGRESS(stream);
if (StreamTcpInlineMode() == TRUE) {
if (StreamTcpInlineMode()) {
uint32_t chunk_size = (stream == &ssn->client) ?
stream_config.reassembly_toserver_chunk_size :
stream_config.reassembly_toclient_chunk_size;
@ -834,14 +834,14 @@ static inline uint64_t GetLeftEdge(Flow *f, TcpSession *ssn, TcpStream *stream)
last_ack_abs += (stream->last_ack - stream->base_seq);
}
/* in IDS mode we shouldn't see the base_seq pass last_ack */
DEBUG_VALIDATE_BUG_ON(last_ack_abs < left_edge && StreamTcpInlineMode() == FALSE && !f->ffr &&
DEBUG_VALIDATE_BUG_ON(last_ack_abs < left_edge && !StreamTcpInlineMode() && !f->ffr &&
ssn->state < TCP_CLOSED);
left_edge = MIN(left_edge, last_ack_abs);
/* if we're told to look for overlaps with different data we should
* consider data that is ack'd as well. Injected packets may have
* been ack'd or injected packet may be too late. */
if (StreamTcpInlineMode() == FALSE && check_overlap_different_data) {
if (!StreamTcpInlineMode() && check_overlap_different_data) {
const uint32_t window = stream->window ? stream->window : 4096;
if (window < left_edge)
left_edge -= window;

@ -421,7 +421,7 @@ uint64_t StreamTcpGetAcked(const TcpStream *stream)
uint64_t StreamDataRightEdge(const TcpStream *stream, const bool eof)
{
uint64_t right_edge = STREAM_BASE_OFFSET(stream) + stream->segs_right_edge - stream->base_seq;
if (!eof && StreamTcpInlineMode() == FALSE) {
if (!eof && !StreamTcpInlineMode()) {
right_edge = MIN(GetAbsLastAck(stream), right_edge);
}
return right_edge;
@ -430,7 +430,7 @@ uint64_t StreamDataRightEdge(const TcpStream *stream, const bool eof)
uint64_t StreamTcpGetUsable(const TcpStream *stream, const bool eof)
{
uint64_t right_edge = StreamingBufferGetConsecutiveDataRightEdge(&stream->sb);
if (!eof && StreamTcpInlineMode() == FALSE) {
if (!eof && !StreamTcpInlineMode()) {
right_edge = MIN(GetAbsLastAck(stream), right_edge);
}
return right_edge;
@ -496,7 +496,7 @@ static int StreamTcpReassemblyConfig(bool quiet)
if (overlap_diff_data) {
StreamTcpReassembleConfigEnableOverlapCheck();
}
if (StreamTcpInlineMode() == TRUE) {
if (StreamTcpInlineMode()) {
StreamTcpReassembleConfigEnableOverlapCheck();
}
@ -1189,7 +1189,7 @@ static inline uint32_t AdjustToAcked(const Packet *p,
uint32_t adjusted = data_len;
/* get window of data that is acked */
if (StreamTcpInlineMode() == FALSE) {
if (!StreamTcpInlineMode()) {
SCLogDebug("ssn->state %s", StreamTcpStateAsString(ssn->state));
if (data_len == 0 || ((ssn->state < TCP_CLOSED ||
(ssn->state == TCP_CLOSED &&
@ -1481,7 +1481,7 @@ bool StreamReassembleRawHasDataReady(TcpSession *ssn, Packet *p)
STREAMTCP_STREAM_FLAG_DISABLE_RAW))
return false;
if (StreamTcpInlineMode() == FALSE) {
if (!StreamTcpInlineMode()) {
const uint64_t segs_re_abs =
STREAM_BASE_OFFSET(stream) + stream->segs_right_edge - stream->base_seq;
if (STREAM_RAW_PROGRESS(stream) == segs_re_abs) {
@ -1860,7 +1860,7 @@ int StreamReassembleRaw(TcpSession *ssn, const Packet *p,
uint64_t *progress_out, bool respect_inspect_depth)
{
/* handle inline separately as the logic is very different */
if (StreamTcpInlineMode() == TRUE) {
if (StreamTcpInlineMode()) {
return StreamReassembleRawInline(ssn, p, Callback, cb_data, progress_out);
}

@ -6851,9 +6851,9 @@ int StreamTcpBypassEnabled(void)
* \retval 0 no
* \retval 1 yes
*/
int StreamTcpInlineMode(void)
bool StreamTcpInlineMode(void)
{
return (stream_config.flags & STREAMTCP_INIT_FLAG_INLINE) ? 1 : 0;
return (stream_config.flags & STREAMTCP_INIT_FLAG_INLINE);
}

@ -191,7 +191,7 @@ void StreamTcpSessionCleanup(TcpSession *ssn);
void StreamTcpStreamCleanup(TcpStream *stream);
/* check if bypass is enabled */
int StreamTcpBypassEnabled(void);
int StreamTcpInlineMode(void);
bool StreamTcpInlineMode(void);
int TcpSessionPacketSsnReuse(const Packet *p, const Flow *f, const void *tcp_ssn);

Loading…
Cancel
Save