Skip to content

Commit

Permalink
var: Use 16-bit container for type
Browse files Browse the repository at this point in the history
Issue: 6855: Match sigmatch type field in var and bit structs
  • Loading branch information
jlucovsky committed Nov 1, 2024
1 parent 3a7eef8 commit 2f8e456
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/flow-bit.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
#include "util-var.h"

typedef struct FlowBit_ {
uint8_t type; /* type, DETECT_FLOWBITS in this case */
uint8_t pad[3];
uint16_t type; /* type, DETECT_FLOWBITS in this case */
uint8_t pad[2];
uint32_t idx; /* name idx */
GenericVar *next; /* right now just implement this as a list,
* in the long run we have think of something
Expand Down
5 changes: 3 additions & 2 deletions src/flow-var.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,14 @@ typedef struct FlowVarTypeInt_ {

/** Generic Flowvar Structure */
typedef struct FlowVar_ {
uint8_t type; /* type, DETECT_FLOWVAR in this case */
uint16_t type; /* type, DETECT_FLOWVAR in this case */
uint8_t datatype;
uint16_t keylen;
uint8_t pad;
uint32_t idx; /* name idx */
GenericVar *next; /* right now just implement this as a list,
* in the long run we have think of something
* faster. */
uint16_t keylen;
union {
FlowVarTypeStr fv_str;
FlowVarTypeInt fv_int;
Expand Down
8 changes: 4 additions & 4 deletions src/util-var.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ enum VarTypes {

/** \todo see ticket #6855. The type field should be 16 bits. */
typedef struct GenericVar_ {
uint8_t type; /**< variable type, uses detection sm_type */
uint8_t pad[3];
uint16_t type; /**< variable type, uses detection sm_type */
uint8_t pad[2];
uint32_t idx;
struct GenericVar_ *next;
} GenericVar;

typedef struct XBit_ {
uint8_t type; /* type, DETECT_XBITS in this case */
uint8_t pad[3];
uint16_t type; /* type, DETECT_XBITS in this case */
uint8_t pad[2];
uint32_t idx; /* name idx */
GenericVar *next;
uint32_t expire;
Expand Down

0 comments on commit 2f8e456

Please sign in to comment.