Skip to content

Commit

Permalink
flow: move fields around to fill memory holes
Browse files Browse the repository at this point in the history
This brings us down from 2 holes of 2 bytes and 4 bytes to one hole of 5
bytes.
There may be more room for improvement.
  • Loading branch information
inashivb committed Dec 5, 2024
1 parent 5042439 commit 4584f91
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/flow.h
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,9 @@ typedef struct Flow_

bool elephant;

uint8_t flow_end_flags;
/* coccinelle: Flow:flow_end_flags:FLOW_END_FLAG_ */

/** flow tenant id, used to setup flow timeout and stream pseudo
* packets with the correct tenant id set */
uint32_t tenant_id;
Expand All @@ -446,16 +449,6 @@ typedef struct Flow_
#error Enable FLOWLOCK_RWLOCK or FLOWLOCK_MUTEX
#endif

/** protocol specific data pointer, e.g. for TcpSession */
void *protoctx;

/** mapping to Flow's protocol specific protocols for timeouts
and state and free functions. */
uint8_t protomap;

uint8_t flow_end_flags;
/* coccinelle: Flow:flow_end_flags:FLOW_END_FLAG_ */

AppProto alproto; /**< \brief application level protocol */
AppProto alproto_ts;
AppProto alproto_tc;
Expand All @@ -467,14 +460,21 @@ typedef struct Flow_
* STARTTLS. */
AppProto alproto_expect;

uint8_t min_ttl_toserver;
uint8_t max_ttl_toserver;

/** detection engine ctx version used to inspect this flow. Set at initial
* inspection. If it doesn't match the currently in use de_ctx, the
* stored sgh ptrs are reset. */
uint32_t de_ctx_version;

/** ttl tracking */
uint8_t min_ttl_toserver;
uint8_t max_ttl_toserver;
/** protocol specific data pointer, e.g. for TcpSession */
void *protoctx;

/** mapping to Flow's protocol specific protocols for timeouts
and state and free functions. */
uint8_t protomap;

uint8_t min_ttl_toclient;
uint8_t max_ttl_toclient;

Expand Down

0 comments on commit 4584f91

Please sign in to comment.