suricata
output-eve-stream.c
Go to the documentation of this file.
1 /* Copyright (C) 2023 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.h"
47 #include "util-unittest-helper.h"
49 #include "util-privs.h"
50 #include "util-print.h"
51 #include "util-proto-name.h"
52 #include "util-logopenfile.h"
53 #include "util-time.h"
54 #include "util-buffer.h"
55 
56 #include "action-globals.h"
57 
58 #define MODULE_NAME "EveStreamLog"
59 
60 #define LOG_DROP_ALERTS 1
61 
62 typedef struct EveStreamOutputCtx_ {
63  uint16_t trigger_flags; /**< presence of flags in packet trigger logging. 0xffff for all. */
66 
67 typedef struct EveStreamLogThread_ {
71 
72 static TmEcode EveStreamLogThreadInit(ThreadVars *t, const void *initdata, void **data)
73 {
75  if (unlikely(aft == NULL))
76  return TM_ECODE_FAILED;
77 
78  if (initdata == NULL) {
79  SCLogDebug("Error getting context for EveLogDrop. \"initdata\" argument NULL");
80  goto error_exit;
81  }
82 
83  /** Use the Output Context (file pointer and mutex) */
84  aft->stream_ctx = ((OutputCtx *)initdata)->data;
85  aft->ctx = CreateEveThreadCtx(t, aft->stream_ctx->eve_ctx);
86  if (!aft->ctx) {
87  goto error_exit;
88  }
89 
90  *data = (void *)aft;
91  return TM_ECODE_OK;
92 
93 error_exit:
94  SCFree(aft);
95  return TM_ECODE_FAILED;
96 }
97 
98 static TmEcode EveStreamLogThreadDeinit(ThreadVars *t, void *data)
99 {
100  EveStreamLogThread *aft = (EveStreamLogThread *)data;
101  if (aft == NULL) {
102  return TM_ECODE_OK;
103  }
104 
105  FreeEveThreadCtx(aft->ctx);
106 
107  /* clear memory */
108  memset(aft, 0, sizeof(*aft));
109 
110  SCFree(aft);
111  return TM_ECODE_OK;
112 }
113 
114 static void EveStreamOutputCtxFree(EveStreamOutputCtx *ctx)
115 {
116  if (ctx != NULL) {
117  SCFree(ctx);
118  }
119 }
120 
121 static void EveStreamLogDeInitCtxSub(OutputCtx *output_ctx)
122 {
124 
125  EveStreamOutputCtx *ctx = output_ctx->data;
126  SCFree(ctx);
127  SCLogDebug("cleaning up sub output_ctx %p", output_ctx);
128  SCFree(output_ctx);
129 }
130 
131 static uint16_t SetFlag(ConfNode *conf, const char *opt, const uint16_t inflag)
132 {
133  const char *v = ConfNodeLookupChildValue(conf, opt);
134  if (v != NULL && ConfValIsTrue(v)) {
135  return inflag;
136  }
137  return 0;
138 }
139 
140 static OutputInitResult EveStreamLogInitCtxSub(ConfNode *conf, OutputCtx *parent_ctx)
141 {
142  OutputInitResult result = { NULL, false };
143  OutputJsonCtx *ajt = parent_ctx->data;
144 
145  EveStreamOutputCtx *ctx = SCCalloc(1, sizeof(*ctx));
146  if (ctx == NULL)
147  return result;
148 
149  OutputCtx *output_ctx = SCCalloc(1, sizeof(OutputCtx));
150  if (unlikely(output_ctx == NULL)) {
151  EveStreamOutputCtxFree(ctx);
152  return result;
153  }
154 
155  if (conf) {
156  // TODO add all flags
157 
158  ctx->trigger_flags |= SetFlag(conf, "event-set", STREAM_PKT_FLAG_EVENTSET);
159  ctx->trigger_flags |= SetFlag(conf, "state-update", STREAM_PKT_FLAG_STATE_UPDATE);
160  ctx->trigger_flags |=
161  SetFlag(conf, "spurious-retransmission", STREAM_PKT_FLAG_SPURIOUS_RETRANSMISSION);
162 
163  ctx->trigger_flags |= SetFlag(conf, "all", 0xFFFF);
164  SCLogDebug("trigger_flags %04x", ctx->trigger_flags);
165  }
166  ctx->eve_ctx = ajt;
167 
168  output_ctx->data = ctx;
169  output_ctx->DeInit = EveStreamLogDeInitCtxSub;
170 
171  result.ctx = output_ctx;
172  result.ok = true;
173 
174  SCLogWarning("eve.stream facility is EXPERIMENTAL and can change w/o notice");
175  return result;
176 }
177 
178 void EveAddFlowTcpStreamFlags(const TcpStream *stream, const char *name, JsonBuilder *jb)
179 {
180  jb_open_array(jb, name);
181  if (stream->flags & STREAMTCP_STREAM_FLAG_HAS_GAP)
182  jb_append_string(jb, "has_gap");
184  jb_append_string(jb, "noreassembly");
186  jb_append_string(jb, "keepalive");
188  jb_append_string(jb, "depth_reached");
190  jb_append_string(jb, "trigger_raw");
192  jb_append_string(jb, "timestamp");
194  jb_append_string(jb, "zero_timestamp");
196  jb_append_string(jb, "appproto_detection_completed");
198  jb_append_string(jb, "appproto_detection_skipped");
200  jb_append_string(jb, "new_raw_disabled");
202  jb_append_string(jb, "disable_raw");
204  jb_append_string(jb, "rst_recv");
205  jb_close(jb);
206 }
207 
208 void EveAddFlowTcpFlags(const TcpSession *ssn, const char *name, JsonBuilder *jb)
209 {
210  jb_open_object(jb, "flags");
211 
212  jb_open_array(jb, name);
213  if (ssn->flags & STREAMTCP_FLAG_MIDSTREAM) {
214  jb_append_string(jb, "midstream");
215  }
217  jb_append_string(jb, "midstream_established");
218  }
220  jb_append_string(jb, "midstream_synack");
221  }
222  if (ssn->flags & STREAMTCP_FLAG_TIMESTAMP) {
223  jb_append_string(jb, "timestamp");
224  }
225  if (ssn->flags & STREAMTCP_FLAG_SERVER_WSCALE) {
226  jb_append_string(jb, "server_wscale");
227  }
228  if (ssn->flags & STREAMTCP_FLAG_CLOSED_BY_RST) {
229  jb_append_string(jb, "closed_by_rst");
230  }
231  if (ssn->flags & STREAMTCP_FLAG_4WHS) {
232  jb_append_string(jb, "4whs");
233  }
235  jb_append_string(jb, "detect_evasion_attempt");
236  }
237  if (ssn->flags & STREAMTCP_FLAG_CLIENT_SACKOK) {
238  jb_append_string(jb, "client_sackok");
239  }
240  if (ssn->flags & STREAMTCP_FLAG_CLIENT_SACKOK) {
241  jb_append_string(jb, "sackok");
242  }
244  jb_append_string(jb, "3whs_confirmed");
245  }
247  jb_append_string(jb, "app_layer_disabled");
248  }
249  if (ssn->flags & STREAMTCP_FLAG_BYPASS) {
250  jb_append_string(jb, "bypass");
251  }
252  if (ssn->flags & STREAMTCP_FLAG_TCP_FAST_OPEN) {
253  jb_append_string(jb, "tcp_fast_open");
254  }
256  jb_append_string(jb, "tfo_data_ignored");
257  }
258  jb_close(jb);
259  jb_close(jb);
260 }
261 
262 static void LogStream(const TcpStream *stream, JsonBuilder *js)
263 {
264  jb_set_uint(js, "isn", stream->isn);
265  jb_set_uint(js, "next_seq", stream->next_seq);
266  jb_set_uint(js, "last_ack", stream->last_ack);
267  jb_set_uint(js, "next_win", stream->next_win);
268  if (!(stream->flags & STREAMTCP_STREAM_FLAG_NOREASSEMBLY)) {
269  jb_set_uint(js, "base_seq", stream->base_seq);
270  jb_set_uint(js, "segs_right_edge", stream->segs_right_edge);
271  }
272  jb_set_uint(js, "window", stream->window);
273  jb_set_uint(js, "wscale", stream->wscale);
274 
275  EveAddFlowTcpStreamFlags(stream, "flags", js);
276 }
277 
278 /**
279  * \brief Log the stream packets
280  *
281  * \param tv Pointer the current thread variables
282  * \param data Pointer to the EveStreamLogThread struct
283  * \param p Pointer the packet which is being logged
284  *
285  * \retval 0 on succes
286  */
287 static int EveStreamLogger(ThreadVars *tv, void *thread_data, const Packet *p)
288 {
289  EveStreamLogThread *td = thread_data;
290  EveStreamOutputCtx *ctx = td->stream_ctx;
291 
293  JsonAddrInfoInit(p, LOG_DIR_PACKET, &addr);
294 
295  JsonBuilder *js = CreateEveHeader(p, LOG_DIR_PACKET, "stream_tcp", &addr, ctx->eve_ctx);
296  if (unlikely(js == NULL))
297  return TM_ECODE_OK;
298 
299  if (p->flow != NULL) {
300  if (p->flowflags & FLOW_PKT_TOSERVER) {
301  jb_set_string(js, "direction", "to_server");
302  } else {
303  jb_set_string(js, "direction", "to_client");
304  }
305  }
306 
307  jb_open_object(js, "stream_tcp");
308  jb_open_object(js, "packet");
309 
310  if (PKT_IS_IPV4(p)) {
311  jb_set_uint(js, "len", IPV4_GET_IPLEN(p));
312  jb_set_uint(js, "tos", IPV4_GET_IPTOS(p));
313  jb_set_uint(js, "ttl", IPV4_GET_IPTTL(p));
314  jb_set_uint(js, "ipid", IPV4_GET_IPID(p));
315  } else if (PKT_IS_IPV6(p)) {
316  jb_set_uint(js, "len", IPV6_GET_PLEN(p));
317  jb_set_uint(js, "tc", IPV6_GET_CLASS(p));
318  jb_set_uint(js, "hoplimit", IPV6_GET_HLIM(p));
319  jb_set_uint(js, "flowlbl", IPV6_GET_FLOW(p));
320  }
321  if (PKT_IS_TCP(p)) {
322  jb_set_uint(js, "tcpseq", TCP_GET_SEQ(p));
323  jb_set_uint(js, "tcpack", TCP_GET_ACK(p));
324  jb_set_uint(js, "tcpwin", TCP_GET_WINDOW(p));
325  jb_set_bool(js, "syn", TCP_ISSET_FLAG_SYN(p) ? true : false);
326  jb_set_bool(js, "ack", TCP_ISSET_FLAG_ACK(p) ? true : false);
327  jb_set_bool(js, "psh", TCP_ISSET_FLAG_PUSH(p) ? true : false);
328  jb_set_bool(js, "rst", TCP_ISSET_FLAG_RST(p) ? true : false);
329  jb_set_bool(js, "urg", TCP_ISSET_FLAG_URG(p) ? true : false);
330  jb_set_bool(js, "fin", TCP_ISSET_FLAG_FIN(p) ? true : false);
331  jb_set_uint(js, "tcpres", TCP_GET_RAW_X2(p->tcph));
332  jb_set_uint(js, "tcpurgp", TCP_GET_URG_POINTER(p));
333 
334  jb_open_array(js, "flags");
336  jb_append_string(js, "retransmission");
338  jb_append_string(js, "spurious_retransmission");
340  jb_append_string(js, "keepalive");
342  jb_append_string(js, "keepalive_ack");
344  jb_append_string(js, "window_update");
345 
347  jb_append_string(js, "event_set");
349  jb_append_string(js, "state_update");
351  jb_append_string(js, "dup_ack");
353  jb_append_string(js, "dsack");
355  jb_append_string(js, "ack_unseen_data");
357  jb_append_string(js, "tcp_port_reuse");
359  jb_append_string(js, "zero_window_probe");
361  jb_append_string(js, "zero_window_probe_ack");
362  jb_close(js);
363  }
364  jb_close(js);
365 
366  jb_open_object(js, "session");
367  if (p->flow != NULL && p->flow->protoctx != NULL) {
368  const TcpSession *ssn = p->flow->protoctx;
369  const char *tcp_state = StreamTcpStateAsString(ssn->state);
370  if (tcp_state != NULL)
371  jb_set_string(js, "state", tcp_state);
373  const char *tcp_pstate = StreamTcpStateAsString(ssn->pstate);
374  if (tcp_pstate != NULL)
375  jb_set_string(js, "pstate", tcp_pstate);
376  }
377  EveAddFlowTcpFlags(ssn, "flags", js);
378 
379  jb_open_object(js, "client");
380  LogStream(&ssn->client, js);
381  jb_close(js);
382  jb_open_object(js, "server");
383  LogStream(&ssn->server, js);
384  jb_close(js);
385  }
386  jb_close(js);
387 
389  jb_open_array(js, "events");
390  for (int i = 0; i < p->events.cnt; i++) {
391  uint8_t event_code = p->events.events[i];
392  bool is_decode = EVENT_IS_DECODER_PACKET_ERROR(event_code);
393  if (is_decode)
394  continue;
395  if (event_code >= DECODE_EVENT_MAX)
396  continue;
397  const char *event = DEvents[event_code].event_name;
398  if (event == NULL)
399  continue;
400  jb_append_string(js, event);
401  }
402  jb_close(js);
403  }
404 
405  if (p->drop_reason != 0) {
406  const char *str = PacketDropReasonToString(p->drop_reason);
407  jb_set_string(js, "reason", str);
408  }
409 
410  /* Close stream. */
411  jb_close(js);
412 
413  OutputJsonBuilderBuffer(js, td->ctx);
414  jb_free(js);
415 
416  return TM_ECODE_OK;
417 }
418 
419 /**
420  * \brief Check if we need to log this packet
421  *
422  * \param tv Pointer the current thread variables
423  * \param p Pointer the packet which is tested
424  *
425  * \retval bool TRUE or FALSE
426  */
427 static int EveStreamLogCondition(ThreadVars *tv, void *data, const Packet *p)
428 {
429  EveStreamLogThread *td = data;
430  EveStreamOutputCtx *ctx = td->stream_ctx;
431 
432  return (p->proto == IPPROTO_TCP &&
433  (ctx->trigger_flags == 0xffff ||
434  (p->tcpvars.stream_pkt_flags & ctx->trigger_flags) != 0));
435 }
436 
438 {
439  OutputRegisterPacketSubModule(LOGGER_JSON_STREAM, "eve-log", MODULE_NAME, "eve-log.stream",
440  EveStreamLogInitCtxSub, EveStreamLogger, EveStreamLogCondition, EveStreamLogThreadInit,
441  EveStreamLogThreadDeinit, NULL);
442 }
tm-threads.h
Packet_::proto
uint8_t proto
Definition: decode.h:452
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
TCP_GET_RAW_X2
#define TCP_GET_RAW_X2(tcph)
Definition: decode-tcp.h:72
detect-engine.h
TcpStream_::isn
uint32_t isn
Definition: stream-tcp-private.h:113
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:63
PKT_IS_IPV6
#define PKT_IS_IPV6(p)
Definition: decode.h:246
stream-tcp.h
unlikely
#define unlikely(expr)
Definition: util-optimize.h:35
PacketDropReasonToString
const char * PacketDropReasonToString(enum PacketDropReason r)
Definition: decode.c:788
PacketEngineEvents_::events
uint8_t events[PACKET_ENGINE_EVENT_MAX]
Definition: decode.h:309
SCLogDebug
#define SCLogDebug(...)
Definition: util-debug.h:269
MODULE_NAME
#define MODULE_NAME
Definition: output-eve-stream.c:58
output-eve-stream.h
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:317
action-globals.h
STREAM_PKT_FLAG_KEEPALIVEACK
#define STREAM_PKT_FLAG_KEEPALIVEACK
Definition: stream-tcp-private.h:314
threads.h
OutputJsonCtx_
Definition: output-json.h:81
STREAM_PKT_FLAG_DSACK
#define STREAM_PKT_FLAG_DSACK
Definition: stream-tcp-private.h:318
OutputJsonBuilderBuffer
int OutputJsonBuilderBuffer(JsonBuilder *js, OutputJsonThreadCtx *ctx)
Definition: output-json.c:927
EveAddFlowTcpStreamFlags
void EveAddFlowTcpStreamFlags(const TcpStream *stream, const char *name, JsonBuilder *jb)
Definition: output-eve-stream.c:178
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:310
json_addr_info_zero
const JsonAddrInfo json_addr_info_zero
Definition: output-json.c:89
FLOW_PKT_TOSERVER
#define FLOW_PKT_TOSERVER
Definition: flow.h:221
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
STREAMTCP_STREAM_FLAG_KEEPALIVE
#define STREAMTCP_STREAM_FLAG_KEEPALIVE
Definition: stream-tcp-private.h:221
Packet_::tcpvars
TCPVars tcpvars
Definition: decode.h:549
Packet_::flowflags
uint8_t flowflags
Definition: decode.h:461
TM_ECODE_FAILED
@ TM_ECODE_FAILED
Definition: tm-threads-common.h:85
Flow_::protoctx
void * protoctx
Definition: flow.h:437
STREAMTCP_STREAM_FLAG_DEPTH_REACHED
#define STREAMTCP_STREAM_FLAG_DEPTH_REACHED
Definition: stream-tcp-private.h:223
Packet_::events
PacketEngineEvents events
Definition: decode.h:602
util-unittest.h
ConfValIsTrue
int ConfValIsTrue(const char *val)
Check if a value is true.
Definition: conf.c:537
util-unittest-helper.h
OutputCtx_::data
void * data
Definition: tm-modules.h:87
TM_ECODE_OK
@ TM_ECODE_OK
Definition: tm-threads-common.h:84
STREAMTCP_FLAG_TFO_DATA_IGNORED
#define STREAMTCP_FLAG_TFO_DATA_IGNORED
Definition: stream-tcp-private.h:207
OutputCtx_
Definition: tm-modules.h:84
STREAMTCP_FLAG_MIDSTREAM
#define STREAMTCP_FLAG_MIDSTREAM
Definition: stream-tcp-private.h:170
IPV6_GET_PLEN
#define IPV6_GET_PLEN(p)
Definition: decode-ipv6.h:88
TCP_GET_WINDOW
#define TCP_GET_WINDOW(p)
Definition: decode-tcp.h:116
TcpSession_::flags
uint32_t flags
Definition: stream-tcp-private.h:292
OutputJsonThreadCtx_
Definition: output-json.h:89
detect-reference.h
TCP_ISSET_FLAG_SYN
#define TCP_ISSET_FLAG_SYN(p)
Definition: decode-tcp.h:122
TcpStream_::last_ack
uint32_t last_ack
Definition: stream-tcp-private.h:115
PKT_IS_TCP
#define PKT_IS_TCP(p)
Definition: decode.h:247
util-debug.h
output-json-flow.h
STREAM_PKT_FLAG_TCP_PORT_REUSE
#define STREAM_PKT_FLAG_TCP_PORT_REUSE
Definition: stream-tcp-private.h:320
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
EveStreamLogThread
struct EveStreamLogThread_ EveStreamLogThread
CreateEveHeader
JsonBuilder * CreateEveHeader(const Packet *p, enum OutputJsonLogDirection dir, const char *event_type, JsonAddrInfo *addr, OutputJsonCtx *eve_ctx)
Definition: output-json.c:786
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
IPV4_GET_IPLEN
#define IPV4_GET_IPLEN(p)
Definition: decode-ipv4.h:127
TCP_ISSET_FLAG_URG
#define TCP_ISSET_FLAG_URG(p)
Definition: decode-tcp.h:126
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
util-time.h
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:322
SCLogWarning
#define SCLogWarning(...)
Macro used to log WARNING messages.
Definition: util-debug.h:249
STREAM_PKT_FLAG_STATE_UPDATE
#define STREAM_PKT_FLAG_STATE_UPDATE
Definition: stream-tcp-private.h:312
IPV4_GET_IPID
#define IPV4_GET_IPID(p)
Definition: decode-ipv4.h:129
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
TCP_GET_SEQ
#define TCP_GET_SEQ(p)
Definition: decode-tcp.h:114
JsonAddrInfo_
Definition: output-json.h:49
Packet_
Definition: decode.h:430
STREAMTCP_STREAM_FLAG_APPPROTO_DETECTION_SKIPPED
#define STREAMTCP_STREAM_FLAG_APPPROTO_DETECTION_SKIPPED
Definition: stream-tcp-private.h:234
TCPVars_::stream_pkt_flags
uint16_t stream_pkt_flags
Definition: decode-tcp.h:162
conf.h
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:83
EveStreamLogRegister
void EveStreamLogRegister(void)
Definition: output-eve-stream.c:437
STREAM_PKT_FLAG_KEEPALIVE
#define STREAM_PKT_FLAG_KEEPALIVE
Definition: stream-tcp-private.h:313
util-proto-name.h
EveStreamLogThread_::stream_ctx
EveStreamOutputCtx * stream_ctx
Definition: output-eve-stream.c:68
DecodeEvents_::event_name
const char * event_name
Definition: decode-events.h:310
EveStreamOutputCtx_::eve_ctx
OutputJsonCtx * eve_ctx
Definition: output-eve-stream.c:64
decode-ipv4.h
IPV6_GET_FLOW
#define IPV6_GET_FLOW(p)
Definition: decode-ipv6.h:84
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:469
STREAMTCP_FLAG_TIMESTAMP
#define STREAMTCP_FLAG_TIMESTAMP
Definition: stream-tcp-private.h:176
LOG_DIR_PACKET
@ LOG_DIR_PACKET
Definition: output-json.h:39
IPV6_GET_CLASS
#define IPV6_GET_CLASS(p)
Definition: decode-ipv6.h:82
STREAM_PKT_FLAG_EVENTSET
#define STREAM_PKT_FLAG_EVENTSET
Definition: stream-tcp-private.h:316
STREAM_PKT_FLAG_TCP_ZERO_WIN_PROBE
#define STREAM_PKT_FLAG_TCP_ZERO_WIN_PROBE
Definition: stream-tcp-private.h:321
suricata-common.h
OutputCtx_::DeInit
void(* DeInit)(struct OutputCtx_ *)
Definition: tm-modules.h:90
OutputRegisterPacketSubModule
void OutputRegisterPacketSubModule(LoggerId id, const char *parent_name, const char *name, const char *conf_name, OutputInitSubFunc InitFunc, PacketLogger PacketLogFunc, PacketLogCondition PacketConditionFunc, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
Register a packet output sub-module.
Definition: output.c:216
Packet_::tcph
TCPHdr * tcph
Definition: decode.h:557
TcpStream_::base_seq
uint32_t base_seq
Definition: stream-tcp-private.h:124
packet.h
TCP_ISSET_FLAG_ACK
#define TCP_ISSET_FLAG_ACK(p)
Definition: decode-tcp.h:125
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:295
tv
ThreadVars * tv
Definition: fuzz_decodepcapfile.c:32
TcpStream_::next_seq
uint32_t next_seq
Definition: stream-tcp-private.h:114
threadvars.h
TCP_ISSET_FLAG_RST
#define TCP_ISSET_FLAG_RST(p)
Definition: decode-tcp.h:123
TcpSession_::server
TcpStream server
Definition: stream-tcp-private.h:294
str
#define str(s)
Definition: suricata-common.h:286
STREAM_PKT_FLAG_ACK_UNSEEN_DATA
#define STREAM_PKT_FLAG_ACK_UNSEEN_DATA
Definition: stream-tcp-private.h:319
IPV4_GET_IPTOS
#define IPV4_GET_IPTOS(p)
Definition: decode-ipv4.h:125
SCFree
#define SCFree(p)
Definition: util-mem.h:61
EveStreamLogThread_::ctx
OutputJsonThreadCtx * ctx
Definition: output-eve-stream.c:69
EveAddFlowTcpFlags
void EveAddFlowTcpFlags(const TcpSession *ssn, const char *name, JsonBuilder *jb)
Definition: output-eve-stream.c:208
ConfNode_
Definition: conf.h:32
util-logopenfile.h
STREAM_PKT_FLAG_SPURIOUS_RETRANSMISSION
#define STREAM_PKT_FLAG_SPURIOUS_RETRANSMISSION
Definition: stream-tcp-private.h:311
TCP_ISSET_FLAG_FIN
#define TCP_ISSET_FLAG_FIN(p)
Definition: decode-tcp.h:121
detect-parse.h
util-buffer.h
IPV6_GET_HLIM
#define IPV6_GET_HLIM(p)
Definition: decode-ipv6.h:90
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:619
TCP_GET_URG_POINTER
#define TCP_GET_URG_POINTER(p)
Definition: decode-tcp.h:117
StreamTcpStateAsString
const char * StreamTcpStateAsString(const enum TcpState state)
Definition: stream-tcp.c:6869
STREAMTCP_FLAG_3WHS_CONFIRMED
#define STREAMTCP_FLAG_3WHS_CONFIRMED
Definition: stream-tcp-private.h:199
JsonAddrInfoInit
void JsonAddrInfoInit(const Packet *p, enum OutputJsonLogDirection dir, JsonAddrInfo *addr)
Definition: output-json.c:476
EveStreamOutputCtx_
Definition: output-eve-stream.c:62
STREAMTCP_STREAM_FLAG_DISABLE_RAW
#define STREAMTCP_STREAM_FLAG_DISABLE_RAW
Definition: stream-tcp-private.h:238
TCP_GET_ACK
#define TCP_GET_ACK(p)
Definition: decode-tcp.h:115
STREAMTCP_FLAG_4WHS
#define STREAMTCP_FLAG_4WHS
Definition: stream-tcp-private.h:185
EveStreamOutputCtx
struct EveStreamOutputCtx_ EveStreamOutputCtx
TcpSession_
Definition: stream-tcp-private.h:283
flow.h
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
LOGGER_JSON_STREAM
@ LOGGER_JSON_STREAM
Definition: suricata-common.h:487
EveStreamLogThread_
Definition: output-eve-stream.c:67
PKT_IS_IPV4
#define PKT_IS_IPV4(p)
Definition: decode.h:245
STREAM_PKT_FLAG_WINDOWUPDATE
#define STREAM_PKT_FLAG_WINDOWUPDATE
Definition: stream-tcp-private.h:315
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
output.h
STREAMTCP_STREAM_FLAG_APPPROTO_DETECTION_COMPLETED
#define STREAMTCP_STREAM_FLAG_APPPROTO_DETECTION_COMPLETED
Definition: stream-tcp-private.h:232
IPV4_GET_IPTTL
#define IPV4_GET_IPTTL(p)
Definition: decode-ipv4.h:146
OutputDropLoggerDisable
void OutputDropLoggerDisable(void)
Definition: output.c:820
TCP_ISSET_FLAG_PUSH
#define TCP_ISSET_FLAG_PUSH(p)
Definition: decode-tcp.h:124
DECODE_EVENT_MAX
@ DECODE_EVENT_MAX
Definition: decode-events.h:301
STREAMTCP_FLAG_SERVER_WSCALE
#define STREAMTCP_FLAG_SERVER_WSCALE
Definition: stream-tcp-private.h:178
PacketEngineEvents_::cnt
uint8_t cnt
Definition: decode.h:308
EVENT_IS_DECODER_PACKET_ERROR
#define EVENT_IS_DECODER_PACKET_ERROR(e)
Definition: decode-events.h:304
ConfNodeLookupChildValue
const char * ConfNodeLookupChildValue(const ConfNode *node, const char *name)
Lookup the value of a child configuration node by name.
Definition: conf.c:814