suricata
output-eve-stream.c
Go to the documentation of this file.
1 /* Copyright (C) 2023-2024 Open Information Security Foundation
2  *
3  * You can copy, redistribute or modify this Program under the terms of
4  * the GNU General Public License version 2 as published by the Free
5  * Software Foundation.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * version 2 along with this program; if not, write to the Free Software
14  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15  * 02110-1301, USA.
16  */
17 
18 /**
19  * \file
20  */
21 
22 #include "suricata-common.h"
23 #include "packet.h"
24 #include "detect.h"
25 #include "flow.h"
26 #include "conf.h"
27 
28 #include "threads.h"
29 #include "tm-threads.h"
30 #include "threadvars.h"
31 #include "util-debug.h"
32 
33 #include "decode-ipv4.h"
34 #include "detect-parse.h"
35 #include "detect-engine.h"
36 #include "detect-engine-mpm.h"
37 #include "detect-reference.h"
38 
39 #include "output.h"
40 #include "output-json.h"
41 #include "output-json-flow.h"
42 #include "output-eve-stream.h"
43 
44 #include "stream-tcp.h"
45 
46 #include "util-unittest-helper.h"
48 #include "util-privs.h"
49 #include "util-print.h"
50 #include "util-proto-name.h"
51 #include "util-logopenfile.h"
52 #include "util-buffer.h"
53 
54 #include "action-globals.h"
55 
56 #define MODULE_NAME "EveStreamLog"
57 
58 typedef struct EveStreamOutputCtx_ {
59  uint16_t trigger_flags; /**< presence of flags in packet trigger logging. 0xffff for all. */
62 
63 typedef struct EveStreamLogThread_ {
67 
68 static TmEcode EveStreamLogThreadInit(ThreadVars *t, const void *initdata, void **data)
69 {
71  if (unlikely(aft == NULL))
72  return TM_ECODE_FAILED;
73 
74  if (initdata == NULL) {
75  SCLogDebug("Error getting context for EveLogDrop. \"initdata\" argument NULL");
76  goto error_exit;
77  }
78 
79  /** Use the Output Context (file pointer and mutex) */
80  aft->stream_ctx = ((OutputCtx *)initdata)->data;
81  aft->ctx = CreateEveThreadCtx(t, aft->stream_ctx->eve_ctx);
82  if (!aft->ctx) {
83  goto error_exit;
84  }
85 
86  *data = (void *)aft;
87  return TM_ECODE_OK;
88 
89 error_exit:
90  SCFree(aft);
91  return TM_ECODE_FAILED;
92 }
93 
94 static TmEcode EveStreamLogThreadDeinit(ThreadVars *t, void *data)
95 {
97  if (aft == NULL) {
98  return TM_ECODE_OK;
99  }
100 
101  FreeEveThreadCtx(aft->ctx);
102 
103  /* clear memory */
104  memset(aft, 0, sizeof(*aft));
105 
106  SCFree(aft);
107  return TM_ECODE_OK;
108 }
109 
110 static void EveStreamOutputCtxFree(EveStreamOutputCtx *ctx)
111 {
112  if (ctx != NULL) {
113  SCFree(ctx);
114  }
115 }
116 
117 static void EveStreamLogDeInitCtxSub(OutputCtx *output_ctx)
118 {
120 
121  EveStreamOutputCtx *ctx = output_ctx->data;
122  SCFree(ctx);
123  SCLogDebug("cleaning up sub output_ctx %p", output_ctx);
124  SCFree(output_ctx);
125 }
126 
127 static uint16_t SetFlag(SCConfNode *conf, const char *opt, const uint16_t inflag)
128 {
129  const char *v = SCConfNodeLookupChildValue(conf, opt);
130  if (v != NULL && SCConfValIsTrue(v)) {
131  return inflag;
132  }
133  return 0;
134 }
135 
136 static OutputInitResult EveStreamLogInitCtxSub(SCConfNode *conf, OutputCtx *parent_ctx)
137 {
138  OutputInitResult result = { NULL, false };
139  OutputJsonCtx *ajt = parent_ctx->data;
140 
141  EveStreamOutputCtx *ctx = SCCalloc(1, sizeof(*ctx));
142  if (ctx == NULL)
143  return result;
144 
145  OutputCtx *output_ctx = SCCalloc(1, sizeof(OutputCtx));
146  if (unlikely(output_ctx == NULL)) {
147  EveStreamOutputCtxFree(ctx);
148  return result;
149  }
150 
151  if (conf) {
152  // TODO add all flags
153 
154  ctx->trigger_flags |= SetFlag(conf, "event-set", STREAM_PKT_FLAG_EVENTSET);
155  ctx->trigger_flags |= SetFlag(conf, "state-update", STREAM_PKT_FLAG_STATE_UPDATE);
156  ctx->trigger_flags |=
157  SetFlag(conf, "spurious-retransmission", STREAM_PKT_FLAG_SPURIOUS_RETRANSMISSION);
158  ctx->trigger_flags |= SetFlag(conf, "tcp-session-reuse", STREAM_PKT_FLAG_TCP_SESSION_REUSE);
159 
160  ctx->trigger_flags |= SetFlag(conf, "all", 0xFFFF);
161  SCLogDebug("trigger_flags %04x", ctx->trigger_flags);
162  }
163  ctx->eve_ctx = ajt;
164 
165  output_ctx->data = ctx;
166  output_ctx->DeInit = EveStreamLogDeInitCtxSub;
167 
168  result.ctx = output_ctx;
169  result.ok = true;
170 
171  SCLogWarning("eve.stream facility is EXPERIMENTAL and can change w/o notice");
172  return result;
173 }
174 
175 void EveAddFlowTcpStreamFlags(const TcpStream *stream, const char *name, SCJsonBuilder *jb)
176 {
177  SCJbOpenArray(jb, name);
178  if (stream->flags & STREAMTCP_STREAM_FLAG_HAS_GAP)
179  SCJbAppendString(jb, "has_gap");
181  SCJbAppendString(jb, "noreassembly");
183  SCJbAppendString(jb, "keepalive");
185  SCJbAppendString(jb, "depth_reached");
187  SCJbAppendString(jb, "trigger_raw");
189  SCJbAppendString(jb, "timestamp");
191  SCJbAppendString(jb, "zero_timestamp");
193  SCJbAppendString(jb, "appproto_detection_completed");
195  SCJbAppendString(jb, "appproto_detection_skipped");
197  SCJbAppendString(jb, "new_raw_disabled");
199  SCJbAppendString(jb, "disable_raw");
201  SCJbAppendString(jb, "rst_recv");
202  SCJbClose(jb);
203 }
204 
205 void EveAddFlowTcpFlags(const TcpSession *ssn, const char *name, SCJsonBuilder *jb)
206 {
207  SCJbOpenObject(jb, "flags");
208 
209  SCJbOpenArray(jb, name);
211  SCJbAppendString(jb, "midstream");
212  }
214  SCJbAppendString(jb, "midstream_established");
215  }
217  SCJbAppendString(jb, "midstream_synack");
218  }
220  SCJbAppendString(jb, "timestamp");
221  }
223  SCJbAppendString(jb, "server_wscale");
224  }
226  SCJbAppendString(jb, "closed_by_rst");
227  }
228  if (ssn->flags & STREAMTCP_FLAG_4WHS) {
229  SCJbAppendString(jb, "4whs");
230  }
232  SCJbAppendString(jb, "detect_evasion_attempt");
233  }
235  SCJbAppendString(jb, "client_sackok");
236  }
238  SCJbAppendString(jb, "sackok");
239  }
241  SCJbAppendString(jb, "3whs_confirmed");
242  }
244  SCJbAppendString(jb, "app_layer_disabled");
245  }
247  SCJbAppendString(jb, "bypass");
248  }
250  SCJbAppendString(jb, "tcp_fast_open");
251  }
253  SCJbAppendString(jb, "tfo_data_ignored");
254  }
255  SCJbClose(jb);
256  SCJbClose(jb);
257 }
258 
259 static void LogStreamSB(const StreamingBuffer *sb, SCJsonBuilder *js)
260 {
261  SCJbSetUint(js, "sb_region_size", sb->region.buf_size);
262 }
263 
264 static void LogStream(const TcpStream *stream, SCJsonBuilder *js)
265 {
266  SCJbSetUint(js, "isn", stream->isn);
267  SCJbSetUint(js, "next_seq", stream->next_seq);
268  SCJbSetUint(js, "last_ack", stream->last_ack);
269  SCJbSetUint(js, "next_win", stream->next_win);
270  if (!(stream->flags & STREAMTCP_STREAM_FLAG_NOREASSEMBLY)) {
271  SCJbSetUint(js, "base_seq", stream->base_seq);
272  SCJbSetUint(js, "segs_right_edge", stream->segs_right_edge);
273  }
274  SCJbSetUint(js, "window", stream->window);
275  SCJbSetUint(js, "wscale", stream->wscale);
276 
277  EveAddFlowTcpStreamFlags(stream, "flags", js);
278 
279  TcpSegment *s;
280  uint32_t segs = 0;
281  RB_FOREACH(s, TCPSEG, (struct TCPSEG *)&stream->seg_tree)
282  {
283  segs++;
284  }
285  SCJbSetUint(js, "seg_cnt", segs);
286  LogStreamSB(&stream->sb, js);
287 }
288 
289 /**
290  * \brief Log the stream packets
291  *
292  * \param tv Pointer the current thread variables
293  * \param data Pointer to the EveStreamLogThread struct
294  * \param p Pointer the packet which is being logged
295  *
296  * \retval 0 on success
297  */
298 static int EveStreamLogger(ThreadVars *tv, void *thread_data, const Packet *p)
299 {
300  EveStreamLogThread *td = thread_data;
302 
304  JsonAddrInfoInit(p, LOG_DIR_PACKET, &addr, &ctx->eve_ctx->cfg);
305 
306  SCJsonBuilder *js = CreateEveHeader(p, LOG_DIR_PACKET, "stream_tcp", &addr, ctx->eve_ctx);
307  if (unlikely(js == NULL))
308  return TM_ECODE_OK;
309 
310  if (p->flow != NULL) {
311  if (p->flowflags & FLOW_PKT_TOSERVER) {
312  SCJbSetString(js, "direction", "to_server");
313  } else {
314  SCJbSetString(js, "direction", "to_client");
315  }
316  }
317 
318  SCJbOpenObject(js, "stream_tcp");
319  SCJbOpenObject(js, "packet");
320 
321  if (PacketIsIPv4(p)) {
322  const IPV4Hdr *ip4h = PacketGetIPv4(p);
323  SCJbSetUint(js, "len", IPV4_GET_RAW_IPLEN(ip4h));
324  SCJbSetUint(js, "tos", IPV4_GET_RAW_IPTOS(ip4h));
325  SCJbSetUint(js, "ttl", IPV4_GET_RAW_IPTTL(ip4h));
326  SCJbSetUint(js, "ipid", IPV4_GET_RAW_IPID(ip4h));
327  } else if (PacketIsIPv6(p)) {
328  const IPV6Hdr *ip6h = PacketGetIPv6(p);
329  SCJbSetUint(js, "len", IPV6_GET_RAW_PLEN(ip6h));
330  SCJbSetUint(js, "tc", IPV6_GET_RAW_CLASS(ip6h));
331  SCJbSetUint(js, "hoplimit", IPV6_GET_RAW_HLIM(ip6h));
332  SCJbSetUint(js, "flowlbl", IPV6_GET_RAW_FLOW(ip6h));
333  }
334  if (PacketIsTCP(p)) {
335  const TCPHdr *tcph = PacketGetTCP(p);
336  SCJbSetUint(js, "tcpseq", TCP_GET_RAW_SEQ(tcph));
337  SCJbSetUint(js, "tcpack", TCP_GET_RAW_ACK(tcph));
338  SCJbSetUint(js, "tcpwin", TCP_GET_RAW_WINDOW(tcph));
339  SCJbSetBool(js, "syn", TCP_ISSET_FLAG_RAW_SYN(tcph));
340  SCJbSetBool(js, "ack", TCP_ISSET_FLAG_RAW_ACK(tcph));
341  SCJbSetBool(js, "psh", TCP_ISSET_FLAG_RAW_PUSH(tcph));
342  SCJbSetBool(js, "rst", TCP_ISSET_FLAG_RAW_RST(tcph));
343  SCJbSetBool(js, "urg", TCP_ISSET_FLAG_RAW_URG(tcph));
344  SCJbSetBool(js, "fin", TCP_ISSET_FLAG_RAW_FIN(tcph));
345  SCJbSetUint(js, "tcpres", TCP_GET_RAW_X2(tcph));
346  SCJbSetUint(js, "tcpurgp", TCP_GET_RAW_URG_POINTER(tcph));
347 
348  SCJbOpenArray(js, "flags");
350  SCJbAppendString(js, "retransmission");
352  SCJbAppendString(js, "spurious_retransmission");
354  SCJbAppendString(js, "keepalive");
356  SCJbAppendString(js, "keepalive_ack");
358  SCJbAppendString(js, "window_update");
359 
361  SCJbAppendString(js, "event_set");
363  SCJbAppendString(js, "state_update");
365  SCJbAppendString(js, "dup_ack");
367  SCJbAppendString(js, "dsack");
369  SCJbAppendString(js, "ack_unseen_data");
371  SCJbAppendString(js, "tcp_session_reuse");
373  SCJbAppendString(js, "zero_window_probe");
375  SCJbAppendString(js, "zero_window_probe_ack");
376  SCJbClose(js);
377  }
378  SCJbClose(js);
379 
380  SCJbOpenObject(js, "session");
381  if (p->flow != NULL && p->flow->protoctx != NULL) {
382  const TcpSession *ssn = p->flow->protoctx;
383  const char *tcp_state = StreamTcpStateAsString(ssn->state);
384  if (tcp_state != NULL)
385  SCJbSetString(js, "state", tcp_state);
387  const char *tcp_pstate = StreamTcpStateAsString(ssn->pstate);
388  if (tcp_pstate != NULL)
389  SCJbSetString(js, "pstate", tcp_pstate);
390  }
391  EveAddFlowTcpFlags(ssn, "flags", js);
392 
393  SCJbOpenObject(js, "client");
394  LogStream(&ssn->client, js);
395  SCJbClose(js);
396  SCJbOpenObject(js, "server");
397  LogStream(&ssn->server, js);
398  SCJbClose(js);
399  }
400  SCJbClose(js);
401 
403  SCJbOpenArray(js, "events");
404  for (int i = 0; i < p->events.cnt; i++) {
405  uint8_t event_code = p->events.events[i];
406  bool is_decode = EVENT_IS_DECODER_PACKET_ERROR(event_code);
407  if (is_decode)
408  continue;
409  if (event_code >= DECODE_EVENT_MAX)
410  continue;
411  const char *event = DEvents[event_code].event_name;
412  if (event == NULL)
413  continue;
414  SCJbAppendString(js, event);
415  }
416  SCJbClose(js);
417  }
418 
419  if (p->drop_reason != 0) {
420  const char *str = PacketDropReasonToString(p->drop_reason);
421  SCJbSetString(js, "reason", str);
422  }
423 
424  /* Close stream. */
425  SCJbClose(js);
426 
427  OutputJsonBuilderBuffer(tv, p, p->flow, js, td->ctx);
428  SCJbFree(js);
429 
430  return TM_ECODE_OK;
431 }
432 
433 /**
434  * \brief Check if we need to log this packet
435  *
436  * \param tv Pointer the current thread variables
437  * \param p Pointer the packet which is tested
438  *
439  * \retval bool true or false
440  */
441 static bool EveStreamLogCondition(ThreadVars *tv, void *data, const Packet *p)
442 {
443  EveStreamLogThread *td = data;
445 
446  return (p->proto == IPPROTO_TCP &&
447  (ctx->trigger_flags == 0xffff ||
448  (p->l4.vars.tcp.stream_pkt_flags & ctx->trigger_flags) != 0));
449 }
450 
452 {
453  OutputPacketLoggerFunctions output_logger_functions = {
454  .LogFunc = EveStreamLogger,
455  .ConditionFunc = EveStreamLogCondition,
456  .ThreadInitFunc = EveStreamLogThreadInit,
457  .ThreadDeinitFunc = EveStreamLogThreadDeinit,
458  .ThreadExitPrintStatsFunc = NULL,
459  };
460 
461  OutputRegisterPacketSubModule(LOGGER_JSON_STREAM, "eve-log", MODULE_NAME, "eve-log.stream",
462  EveStreamLogInitCtxSub, &output_logger_functions);
463 }
SCJsonBuilder
struct SCJsonBuilder SCJsonBuilder
Definition: detect-engine-helper.h:83
TCP_GET_RAW_SEQ
#define TCP_GET_RAW_SEQ(tcph)
Definition: decode-tcp.h:80
tm-threads.h
Packet_::proto
uint8_t proto
Definition: decode.h:538
IPV4_GET_RAW_IPID
#define IPV4_GET_RAW_IPID(ip4h)
Definition: decode-ipv4.h:99
TcpStream_
Definition: stream-tcp-private.h:106
TcpSession_::pstate
uint8_t pstate
Definition: stream-tcp-private.h:286
STREAMTCP_FLAG_CLIENT_SACKOK
#define STREAMTCP_FLAG_CLIENT_SACKOK
Definition: stream-tcp-private.h:190
SCConfValIsTrue
int SCConfValIsTrue(const char *val)
Check if a value is true.
Definition: conf.c:577
TCP_GET_RAW_X2
#define TCP_GET_RAW_X2(tcph)
Definition: decode-tcp.h:73
detect-engine.h
TcpStream_::isn
uint32_t isn
Definition: stream-tcp-private.h:113
IPV6_GET_RAW_PLEN
#define IPV6_GET_RAW_PLEN(ip6h)
Definition: decode-ipv6.h:66
IPV6_GET_RAW_HLIM
#define IPV6_GET_RAW_HLIM(ip6h)
Definition: decode-ipv6.h:67
STREAMTCP_FLAG_DETECTION_EVASION_ATTEMPT
#define STREAMTCP_FLAG_DETECTION_EVASION_ATTEMPT
Definition: stream-tcp-private.h:188
EveStreamOutputCtx_::trigger_flags
uint16_t trigger_flags
Definition: output-eve-stream.c:59
stream-tcp.h
unlikely
#define unlikely(expr)
Definition: util-optimize.h:35
PacketDropReasonToString
const char * PacketDropReasonToString(enum PacketDropReason r)
Definition: decode.c:942
PacketEngineEvents_::events
uint8_t events[PACKET_ENGINE_EVENT_MAX]
Definition: decode.h:311
TcpStream_::seg_tree
struct TCPSEG seg_tree
Definition: stream-tcp-private.h:136
SCLogDebug
#define SCLogDebug(...)
Definition: util-debug.h:282
MODULE_NAME
#define MODULE_NAME
Definition: output-eve-stream.c:56
output-eve-stream.h
name
const char * name
Definition: detect-engine-proto.c:47
FreeEveThreadCtx
void FreeEveThreadCtx(OutputJsonThreadCtx *ctx)
Definition: output-json-common.c:58
STREAM_PKT_FLAG_DUP_ACK
#define STREAM_PKT_FLAG_DUP_ACK
Definition: stream-tcp-private.h:319
action-globals.h
CreateEveHeader
SCJsonBuilder * CreateEveHeader(const Packet *p, enum SCOutputJsonLogDirection dir, const char *event_type, JsonAddrInfo *addr, OutputJsonCtx *eve_ctx)
Definition: output-json.c:816
STREAM_PKT_FLAG_KEEPALIVEACK
#define STREAM_PKT_FLAG_KEEPALIVEACK
Definition: stream-tcp-private.h:316
ssn
TcpSession ssn
Definition: fuzz_dataset.c:31
threads.h
OutputJsonCtx_
Definition: output-json.h:77
STREAM_PKT_FLAG_DSACK
#define STREAM_PKT_FLAG_DSACK
Definition: stream-tcp-private.h:320
IPV6_GET_RAW_CLASS
#define IPV6_GET_RAW_CLASS(ip6h)
Definition: decode-ipv6.h:63
JsonAddrInfoInit
void JsonAddrInfoInit(const Packet *p, enum SCOutputJsonLogDirection dir, JsonAddrInfo *addr, OutputJsonCommonSettings *cfg)
Definition: output-json.c:464
ctx
struct Thresholds ctx
CreateEveThreadCtx
OutputJsonThreadCtx * CreateEveThreadCtx(ThreadVars *t, OutputJsonCtx *ctx)
Definition: output-json-common.c:29
STREAM_PKT_FLAG_RETRANSMISSION
#define STREAM_PKT_FLAG_RETRANSMISSION
Definition: stream-tcp-private.h:312
json_addr_info_zero
const JsonAddrInfo json_addr_info_zero
Definition: output-json.c:78
FLOW_PKT_TOSERVER
#define FLOW_PKT_TOSERVER
Definition: flow.h:236
STREAMTCP_FLAG_MIDSTREAM_ESTABLISHED
#define STREAMTCP_FLAG_MIDSTREAM_ESTABLISHED
Definition: stream-tcp-private.h:172
util-privs.h
TcpStream_::flags
uint16_t flags
Definition: stream-tcp-private.h:107
p
Packet * p
Definition: fuzz_dataset.c:30
STREAMTCP_STREAM_FLAG_KEEPALIVE
#define STREAMTCP_STREAM_FLAG_KEEPALIVE
Definition: stream-tcp-private.h:221
OutputJsonBuilderBuffer
void OutputJsonBuilderBuffer(ThreadVars *tv, const Packet *p, Flow *f, SCJsonBuilder *js, OutputJsonThreadCtx *ctx)
Definition: output-json.c:1018
SCConfNodeLookupChildValue
const char * SCConfNodeLookupChildValue(const SCConfNode *node, const char *name)
Lookup the value of a child configuration node by name.
Definition: conf.c:877
Packet_::flowflags
uint8_t flowflags
Definition: decode.h:547
TM_ECODE_FAILED
@ TM_ECODE_FAILED
Definition: tm-threads-common.h:82
Flow_::protoctx
void * protoctx
Definition: flow.h:438
TCP_GET_RAW_WINDOW
#define TCP_GET_RAW_WINDOW(tcph)
Definition: decode-tcp.h:83
STREAMTCP_STREAM_FLAG_DEPTH_REACHED
#define STREAMTCP_STREAM_FLAG_DEPTH_REACHED
Definition: stream-tcp-private.h:223
Packet_::events
PacketEngineEvents events
Definition: decode.h:643
util-unittest-helper.h
OutputCtx_::data
void * data
Definition: tm-modules.h:91
TM_ECODE_OK
@ TM_ECODE_OK
Definition: tm-threads-common.h:81
STREAMTCP_FLAG_TFO_DATA_IGNORED
#define STREAMTCP_FLAG_TFO_DATA_IGNORED
Definition: stream-tcp-private.h:207
OutputCtx_
Definition: tm-modules.h:88
STREAMTCP_FLAG_MIDSTREAM
#define STREAMTCP_FLAG_MIDSTREAM
Definition: stream-tcp-private.h:170
TcpSession_::flags
uint32_t flags
Definition: stream-tcp-private.h:294
OutputJsonThreadCtx_
Definition: output-json.h:85
detect-reference.h
TcpStream_::last_ack
uint32_t last_ack
Definition: stream-tcp-private.h:115
util-debug.h
output-json-flow.h
StreamingBufferRegion_::buf_size
uint32_t buf_size
Definition: util-streaming-buffer.h:86
IPV4_GET_RAW_IPTOS
#define IPV4_GET_RAW_IPTOS(ip4h)
Definition: decode-ipv4.h:97
OutputInitResult_::ctx
OutputCtx * ctx
Definition: output.h:47
DEvents
const struct DecodeEvents_ DEvents[]
Definition: decode-events.c:29
STREAMTCP_FLAG_BYPASS
#define STREAMTCP_FLAG_BYPASS
Definition: stream-tcp-private.h:203
output-json.h
TCP_ISSET_FLAG_RAW_ACK
#define TCP_ISSET_FLAG_RAW_ACK(tcph)
Definition: decode-tcp.h:123
TCP_ISSET_FLAG_RAW_RST
#define TCP_ISSET_FLAG_RAW_RST(tcph)
Definition: decode-tcp.h:121
EveStreamLogThread
struct EveStreamLogThread_ EveStreamLogThread
STREAMTCP_STREAM_FLAG_RST_RECV
#define STREAMTCP_STREAM_FLAG_RST_RECV
Definition: stream-tcp-private.h:240
util-print.h
detect-engine-mpm.h
detect.h
ThreadVars_
Per thread variable structure.
Definition: threadvars.h:57
PacketL4::L4Vars::tcp
TCPVars tcp
Definition: decode.h:491
TcpSession_::state
uint8_t state
Definition: stream-tcp-private.h:285
TcpStream_::segs_right_edge
uint32_t segs_right_edge
Definition: stream-tcp-private.h:137
OutputInitResult_::ok
bool ok
Definition: output.h:48
STREAM_PKT_FLAG_TCP_ZERO_WIN_PROBE_ACK
#define STREAM_PKT_FLAG_TCP_ZERO_WIN_PROBE_ACK
Definition: stream-tcp-private.h:324
SCLogWarning
#define SCLogWarning(...)
Macro used to log WARNING messages.
Definition: util-debug.h:262
STREAM_PKT_FLAG_STATE_UPDATE
#define STREAM_PKT_FLAG_STATE_UPDATE
Definition: stream-tcp-private.h:314
STREAMTCP_STREAM_FLAG_TIMESTAMP
#define STREAMTCP_STREAM_FLAG_TIMESTAMP
Definition: stream-tcp-private.h:228
TcpStream_::next_win
uint32_t next_win
Definition: stream-tcp-private.h:116
RB_FOREACH
#define RB_FOREACH(x, name, head)
Definition: tree.h:781
JsonAddrInfo_
Definition: output-json.h:41
TcpSegment
Definition: stream-tcp-private.h:72
IPV6Hdr_
Definition: decode-ipv6.h:32
Packet_
Definition: decode.h:516
STREAMTCP_STREAM_FLAG_APPPROTO_DETECTION_SKIPPED
#define STREAMTCP_STREAM_FLAG_APPPROTO_DETECTION_SKIPPED
Definition: stream-tcp-private.h:234
IPV4_GET_RAW_IPTTL
#define IPV4_GET_RAW_IPTTL(ip4h)
Definition: decode-ipv4.h:102
TCPVars_::stream_pkt_flags
uint16_t stream_pkt_flags
Definition: decode-tcp.h:175
conf.h
Packet_::l4
struct PacketL4 l4
Definition: decode.h:616
TCP_ISSET_FLAG_RAW_FIN
#define TCP_ISSET_FLAG_RAW_FIN(tcph)
Definition: decode-tcp.h:119
TcpStream_::window
uint32_t window
Definition: stream-tcp-private.h:117
STREAMTCP_STREAM_FLAG_HAS_GAP
#define STREAMTCP_STREAM_FLAG_HAS_GAP
Definition: stream-tcp-private.h:217
TmEcode
TmEcode
Definition: tm-threads-common.h:80
STREAM_PKT_FLAG_TCP_SESSION_REUSE
#define STREAM_PKT_FLAG_TCP_SESSION_REUSE
Definition: stream-tcp-private.h:322
EveAddFlowTcpStreamFlags
void EveAddFlowTcpStreamFlags(const TcpStream *stream, const char *name, SCJsonBuilder *jb)
Definition: output-eve-stream.c:175
EveStreamLogRegister
void EveStreamLogRegister(void)
Definition: output-eve-stream.c:451
STREAM_PKT_FLAG_KEEPALIVE
#define STREAM_PKT_FLAG_KEEPALIVE
Definition: stream-tcp-private.h:315
util-proto-name.h
EveStreamLogThread_::stream_ctx
EveStreamOutputCtx * stream_ctx
Definition: output-eve-stream.c:64
DecodeEvents_::event_name
const char * event_name
Definition: decode-events.h:344
EveStreamOutputCtx_::eve_ctx
OutputJsonCtx * eve_ctx
Definition: output-eve-stream.c:60
StreamingBuffer_
Definition: util-streaming-buffer.h:108
IPV4Hdr_
Definition: decode-ipv4.h:72
decode-ipv4.h
OutputInitResult_
Definition: output.h:46
STREAMTCP_FLAG_CLOSED_BY_RST
#define STREAMTCP_FLAG_CLOSED_BY_RST
Definition: stream-tcp-private.h:180
Packet_::flow
struct Flow_ * flow
Definition: decode.h:564
STREAMTCP_FLAG_TIMESTAMP
#define STREAMTCP_FLAG_TIMESTAMP
Definition: stream-tcp-private.h:176
STREAM_PKT_FLAG_EVENTSET
#define STREAM_PKT_FLAG_EVENTSET
Definition: stream-tcp-private.h:318
STREAM_PKT_FLAG_TCP_ZERO_WIN_PROBE
#define STREAM_PKT_FLAG_TCP_ZERO_WIN_PROBE
Definition: stream-tcp-private.h:323
suricata-common.h
OutputCtx_::DeInit
void(* DeInit)(struct OutputCtx_ *)
Definition: tm-modules.h:94
TcpStream_::base_seq
uint32_t base_seq
Definition: stream-tcp-private.h:124
packet.h
TcpStream_::sb
StreamingBuffer sb
Definition: stream-tcp-private.h:135
OutputPacketLoggerFunctions_::LogFunc
PacketLogger LogFunc
Definition: output.h:87
IPV6_GET_RAW_FLOW
#define IPV6_GET_RAW_FLOW(ip6h)
Definition: decode-ipv6.h:64
util-classification-config.h
STREAMTCP_STREAM_FLAG_NEW_RAW_DISABLED
#define STREAMTCP_STREAM_FLAG_NEW_RAW_DISABLED
Definition: stream-tcp-private.h:236
STREAMTCP_FLAG_MIDSTREAM_SYNACK
#define STREAMTCP_FLAG_MIDSTREAM_SYNACK
Definition: stream-tcp-private.h:174
TcpSession_::client
TcpStream client
Definition: stream-tcp-private.h:297
DECODE_EVENT_MAX
@ DECODE_EVENT_MAX
Definition: decode-events.h:335
OutputRegisterPacketSubModule
void OutputRegisterPacketSubModule(LoggerId id, const char *parent_name, const char *name, const char *conf_name, OutputInitSubFunc InitFunc, OutputPacketLoggerFunctions *output_logger_functions)
Register a packet output sub-module.
Definition: output.c:230
tv
ThreadVars * tv
Definition: fuzz_decodepcapfile.c:34
TcpStream_::next_seq
uint32_t next_seq
Definition: stream-tcp-private.h:114
threadvars.h
TcpSession_::server
TcpStream server
Definition: stream-tcp-private.h:296
str
#define str(s)
Definition: suricata-common.h:313
STREAM_PKT_FLAG_ACK_UNSEEN_DATA
#define STREAM_PKT_FLAG_ACK_UNSEEN_DATA
Definition: stream-tcp-private.h:321
SCFree
#define SCFree(p)
Definition: util-mem.h:61
EveStreamLogThread_::ctx
OutputJsonThreadCtx * ctx
Definition: output-eve-stream.c:65
util-logopenfile.h
STREAM_PKT_FLAG_SPURIOUS_RETRANSMISSION
#define STREAM_PKT_FLAG_SPURIOUS_RETRANSMISSION
Definition: stream-tcp-private.h:313
detect-parse.h
util-buffer.h
STREAMTCP_STREAM_FLAG_ZERO_TIMESTAMP
#define STREAMTCP_STREAM_FLAG_ZERO_TIMESTAMP
Definition: stream-tcp-private.h:230
STREAMTCP_FLAG_APP_LAYER_DISABLED
#define STREAMTCP_FLAG_APP_LAYER_DISABLED
Definition: stream-tcp-private.h:201
STREAMTCP_STREAM_FLAG_NOREASSEMBLY
#define STREAMTCP_STREAM_FLAG_NOREASSEMBLY
Definition: stream-tcp-private.h:219
Packet_::drop_reason
uint8_t drop_reason
Definition: decode.h:660
StreamTcpStateAsString
const char * StreamTcpStateAsString(const enum TcpState state)
Definition: stream-tcp.c:7312
STREAMTCP_FLAG_3WHS_CONFIRMED
#define STREAMTCP_FLAG_3WHS_CONFIRMED
Definition: stream-tcp-private.h:199
LOG_DIR_PACKET
@ LOG_DIR_PACKET
Definition: output-eve-bindgen.h:34
EveStreamOutputCtx_
Definition: output-eve-stream.c:58
IPV4_GET_RAW_IPLEN
#define IPV4_GET_RAW_IPLEN(ip4h)
Definition: decode-ipv4.h:98
TCP_ISSET_FLAG_RAW_SYN
#define TCP_ISSET_FLAG_RAW_SYN(tcph)
Definition: decode-tcp.h:120
STREAMTCP_STREAM_FLAG_DISABLE_RAW
#define STREAMTCP_STREAM_FLAG_DISABLE_RAW
Definition: stream-tcp-private.h:238
STREAMTCP_FLAG_4WHS
#define STREAMTCP_FLAG_4WHS
Definition: stream-tcp-private.h:185
EveStreamOutputCtx
struct EveStreamOutputCtx_ EveStreamOutputCtx
TcpSession_
Definition: stream-tcp-private.h:283
TCP_GET_RAW_URG_POINTER
#define TCP_GET_RAW_URG_POINTER(tcph)
Definition: decode-tcp.h:84
flow.h
StreamingBuffer_::region
StreamingBufferRegion region
Definition: util-streaming-buffer.h:109
SCCalloc
#define SCCalloc(nm, sz)
Definition: util-mem.h:53
STREAMTCP_STREAM_FLAG_TRIGGER_RAW
#define STREAMTCP_STREAM_FLAG_TRIGGER_RAW
Definition: stream-tcp-private.h:225
TCP_GET_RAW_ACK
#define TCP_GET_RAW_ACK(tcph)
Definition: decode-tcp.h:81
LOGGER_JSON_STREAM
@ LOGGER_JSON_STREAM
Definition: suricata-common.h:514
SCConfNode_
Definition: conf.h:37
EveStreamLogThread_
Definition: output-eve-stream.c:63
OutputPacketLoggerFunctions_
Definition: output.h:86
TCP_ISSET_FLAG_RAW_URG
#define TCP_ISSET_FLAG_RAW_URG(tcph)
Definition: decode-tcp.h:124
STREAM_PKT_FLAG_WINDOWUPDATE
#define STREAM_PKT_FLAG_WINDOWUPDATE
Definition: stream-tcp-private.h:317
TCPHdr_
Definition: decode-tcp.h:149
PacketL4::vars
union PacketL4::L4Vars vars
STREAMTCP_FLAG_TCP_FAST_OPEN
#define STREAMTCP_FLAG_TCP_FAST_OPEN
Definition: stream-tcp-private.h:205
TcpStream_::wscale
uint16_t wscale
Definition: stream-tcp-private.h:109
EveAddFlowTcpFlags
void EveAddFlowTcpFlags(const TcpSession *ssn, const char *name, SCJsonBuilder *jb)
Definition: output-eve-stream.c:205
output.h
STREAMTCP_STREAM_FLAG_APPPROTO_DETECTION_COMPLETED
#define STREAMTCP_STREAM_FLAG_APPPROTO_DETECTION_COMPLETED
Definition: stream-tcp-private.h:232
OutputDropLoggerDisable
void OutputDropLoggerDisable(void)
Definition: output.c:686
TCP_ISSET_FLAG_RAW_PUSH
#define TCP_ISSET_FLAG_RAW_PUSH(tcph)
Definition: decode-tcp.h:122
STREAMTCP_FLAG_SERVER_WSCALE
#define STREAMTCP_FLAG_SERVER_WSCALE
Definition: stream-tcp-private.h:178
PacketEngineEvents_::cnt
uint8_t cnt
Definition: decode.h:310
EVENT_IS_DECODER_PACKET_ERROR
#define EVENT_IS_DECODER_PACKET_ERROR(e)
Definition: decode-events.h:338