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 typedef struct EveStreamOutputCtx_ {
61  uint16_t trigger_flags; /**< presence of flags in packet trigger logging. 0xffff for all. */
64 
65 typedef struct EveStreamLogThread_ {
69 
70 static TmEcode EveStreamLogThreadInit(ThreadVars *t, const void *initdata, void **data)
71 {
73  if (unlikely(aft == NULL))
74  return TM_ECODE_FAILED;
75 
76  if (initdata == NULL) {
77  SCLogDebug("Error getting context for EveLogDrop. \"initdata\" argument NULL");
78  goto error_exit;
79  }
80 
81  /** Use the Output Context (file pointer and mutex) */
82  aft->stream_ctx = ((OutputCtx *)initdata)->data;
83  aft->ctx = CreateEveThreadCtx(t, aft->stream_ctx->eve_ctx);
84  if (!aft->ctx) {
85  goto error_exit;
86  }
87 
88  *data = (void *)aft;
89  return TM_ECODE_OK;
90 
91 error_exit:
92  SCFree(aft);
93  return TM_ECODE_FAILED;
94 }
95 
96 static TmEcode EveStreamLogThreadDeinit(ThreadVars *t, void *data)
97 {
99  if (aft == NULL) {
100  return TM_ECODE_OK;
101  }
102 
103  FreeEveThreadCtx(aft->ctx);
104 
105  /* clear memory */
106  memset(aft, 0, sizeof(*aft));
107 
108  SCFree(aft);
109  return TM_ECODE_OK;
110 }
111 
112 static void EveStreamOutputCtxFree(EveStreamOutputCtx *ctx)
113 {
114  if (ctx != NULL) {
115  SCFree(ctx);
116  }
117 }
118 
119 static void EveStreamLogDeInitCtxSub(OutputCtx *output_ctx)
120 {
122 
123  EveStreamOutputCtx *ctx = output_ctx->data;
124  SCFree(ctx);
125  SCLogDebug("cleaning up sub output_ctx %p", output_ctx);
126  SCFree(output_ctx);
127 }
128 
129 static uint16_t SetFlag(ConfNode *conf, const char *opt, const uint16_t inflag)
130 {
131  const char *v = ConfNodeLookupChildValue(conf, opt);
132  if (v != NULL && ConfValIsTrue(v)) {
133  return inflag;
134  }
135  return 0;
136 }
137 
138 static OutputInitResult EveStreamLogInitCtxSub(ConfNode *conf, OutputCtx *parent_ctx)
139 {
140  OutputInitResult result = { NULL, false };
141  OutputJsonCtx *ajt = parent_ctx->data;
142 
143  EveStreamOutputCtx *ctx = SCCalloc(1, sizeof(*ctx));
144  if (ctx == NULL)
145  return result;
146 
147  OutputCtx *output_ctx = SCCalloc(1, sizeof(OutputCtx));
148  if (unlikely(output_ctx == NULL)) {
149  EveStreamOutputCtxFree(ctx);
150  return result;
151  }
152 
153  if (conf) {
154  // TODO add all flags
155 
156  ctx->trigger_flags |= SetFlag(conf, "event-set", STREAM_PKT_FLAG_EVENTSET);
157  ctx->trigger_flags |= SetFlag(conf, "state-update", STREAM_PKT_FLAG_STATE_UPDATE);
158  ctx->trigger_flags |=
159  SetFlag(conf, "spurious-retransmission", STREAM_PKT_FLAG_SPURIOUS_RETRANSMISSION);
160 
161  ctx->trigger_flags |= SetFlag(conf, "all", 0xFFFF);
162  SCLogDebug("trigger_flags %04x", ctx->trigger_flags);
163  }
164  ctx->eve_ctx = ajt;
165 
166  output_ctx->data = ctx;
167  output_ctx->DeInit = EveStreamLogDeInitCtxSub;
168 
169  result.ctx = output_ctx;
170  result.ok = true;
171 
172  SCLogWarning("eve.stream facility is EXPERIMENTAL and can change w/o notice");
173  return result;
174 }
175 
176 void EveAddFlowTcpStreamFlags(const TcpStream *stream, const char *name, JsonBuilder *jb)
177 {
178  jb_open_array(jb, name);
179  if (stream->flags & STREAMTCP_STREAM_FLAG_HAS_GAP)
180  jb_append_string(jb, "has_gap");
182  jb_append_string(jb, "noreassembly");
184  jb_append_string(jb, "keepalive");
186  jb_append_string(jb, "depth_reached");
188  jb_append_string(jb, "trigger_raw");
190  jb_append_string(jb, "timestamp");
192  jb_append_string(jb, "zero_timestamp");
194  jb_append_string(jb, "appproto_detection_completed");
196  jb_append_string(jb, "appproto_detection_skipped");
198  jb_append_string(jb, "new_raw_disabled");
200  jb_append_string(jb, "disable_raw");
202  jb_append_string(jb, "rst_recv");
203  jb_close(jb);
204 }
205 
206 void EveAddFlowTcpFlags(const TcpSession *ssn, const char *name, JsonBuilder *jb)
207 {
208  jb_open_object(jb, "flags");
209 
210  jb_open_array(jb, name);
211  if (ssn->flags & STREAMTCP_FLAG_MIDSTREAM) {
212  jb_append_string(jb, "midstream");
213  }
215  jb_append_string(jb, "midstream_established");
216  }
218  jb_append_string(jb, "midstream_synack");
219  }
220  if (ssn->flags & STREAMTCP_FLAG_TIMESTAMP) {
221  jb_append_string(jb, "timestamp");
222  }
223  if (ssn->flags & STREAMTCP_FLAG_SERVER_WSCALE) {
224  jb_append_string(jb, "server_wscale");
225  }
226  if (ssn->flags & STREAMTCP_FLAG_CLOSED_BY_RST) {
227  jb_append_string(jb, "closed_by_rst");
228  }
229  if (ssn->flags & STREAMTCP_FLAG_4WHS) {
230  jb_append_string(jb, "4whs");
231  }
233  jb_append_string(jb, "detect_evasion_attempt");
234  }
235  if (ssn->flags & STREAMTCP_FLAG_CLIENT_SACKOK) {
236  jb_append_string(jb, "client_sackok");
237  }
238  if (ssn->flags & STREAMTCP_FLAG_CLIENT_SACKOK) {
239  jb_append_string(jb, "sackok");
240  }
242  jb_append_string(jb, "3whs_confirmed");
243  }
245  jb_append_string(jb, "app_layer_disabled");
246  }
247  if (ssn->flags & STREAMTCP_FLAG_BYPASS) {
248  jb_append_string(jb, "bypass");
249  }
250  if (ssn->flags & STREAMTCP_FLAG_TCP_FAST_OPEN) {
251  jb_append_string(jb, "tcp_fast_open");
252  }
254  jb_append_string(jb, "tfo_data_ignored");
255  }
256  jb_close(jb);
257  jb_close(jb);
258 }
259 
260 static void LogStreamSB(const StreamingBuffer *sb, JsonBuilder *js)
261 {
262  jb_set_uint(js, "sb_region_size", sb->region.buf_size);
263 }
264 
265 static void LogStream(const TcpStream *stream, JsonBuilder *js)
266 {
267  jb_set_uint(js, "isn", stream->isn);
268  jb_set_uint(js, "next_seq", stream->next_seq);
269  jb_set_uint(js, "last_ack", stream->last_ack);
270  jb_set_uint(js, "next_win", stream->next_win);
271  if (!(stream->flags & STREAMTCP_STREAM_FLAG_NOREASSEMBLY)) {
272  jb_set_uint(js, "base_seq", stream->base_seq);
273  jb_set_uint(js, "segs_right_edge", stream->segs_right_edge);
274  }
275  jb_set_uint(js, "window", stream->window);
276  jb_set_uint(js, "wscale", stream->wscale);
277 
278  EveAddFlowTcpStreamFlags(stream, "flags", js);
279 
280  TcpSegment *s;
281  uint32_t segs = 0;
282  RB_FOREACH(s, TCPSEG, (struct TCPSEG *)&stream->seg_tree)
283  {
284  segs++;
285  }
286  jb_set_uint(js, "seg_cnt", segs);
287  LogStreamSB(&stream->sb, js);
288 }
289 
290 /**
291  * \brief Log the stream packets
292  *
293  * \param tv Pointer the current thread variables
294  * \param data Pointer to the EveStreamLogThread struct
295  * \param p Pointer the packet which is being logged
296  *
297  * \retval 0 on success
298  */
299 static int EveStreamLogger(ThreadVars *tv, void *thread_data, const Packet *p)
300 {
301  EveStreamLogThread *td = thread_data;
302  EveStreamOutputCtx *ctx = td->stream_ctx;
303 
305  JsonAddrInfoInit(p, LOG_DIR_PACKET, &addr);
306 
307  JsonBuilder *js = CreateEveHeader(p, LOG_DIR_PACKET, "stream_tcp", &addr, ctx->eve_ctx);
308  if (unlikely(js == NULL))
309  return TM_ECODE_OK;
310 
311  if (p->flow != NULL) {
312  if (p->flowflags & FLOW_PKT_TOSERVER) {
313  jb_set_string(js, "direction", "to_server");
314  } else {
315  jb_set_string(js, "direction", "to_client");
316  }
317  }
318 
319  jb_open_object(js, "stream_tcp");
320  jb_open_object(js, "packet");
321 
322  if (PacketIsIPv4(p)) {
323  const IPV4Hdr *ip4h = PacketGetIPv4(p);
324  jb_set_uint(js, "len", IPV4_GET_RAW_IPLEN(ip4h));
325  jb_set_uint(js, "tos", IPV4_GET_RAW_IPTOS(ip4h));
326  jb_set_uint(js, "ttl", IPV4_GET_RAW_IPTTL(ip4h));
327  jb_set_uint(js, "ipid", IPV4_GET_RAW_IPID(ip4h));
328  } else if (PacketIsIPv6(p)) {
329  const IPV6Hdr *ip6h = PacketGetIPv6(p);
330  jb_set_uint(js, "len", IPV6_GET_RAW_PLEN(ip6h));
331  jb_set_uint(js, "tc", IPV6_GET_RAW_CLASS(ip6h));
332  jb_set_uint(js, "hoplimit", IPV6_GET_RAW_HLIM(ip6h));
333  jb_set_uint(js, "flowlbl", IPV6_GET_RAW_FLOW(ip6h));
334  }
335  if (PacketIsTCP(p)) {
336  const TCPHdr *tcph = PacketGetTCP(p);
337  jb_set_uint(js, "tcpseq", TCP_GET_RAW_SEQ(tcph));
338  jb_set_uint(js, "tcpack", TCP_GET_RAW_ACK(tcph));
339  jb_set_uint(js, "tcpwin", TCP_GET_RAW_WINDOW(tcph));
340  jb_set_bool(js, "syn", TCP_ISSET_FLAG_RAW_SYN(tcph) ? true : false);
341  jb_set_bool(js, "ack", TCP_ISSET_FLAG_RAW_ACK(tcph) ? true : false);
342  jb_set_bool(js, "psh", TCP_ISSET_FLAG_RAW_PUSH(tcph) ? true : false);
343  jb_set_bool(js, "rst", TCP_ISSET_FLAG_RAW_RST(tcph) ? true : false);
344  jb_set_bool(js, "urg", TCP_ISSET_FLAG_RAW_URG(tcph) ? true : false);
345  jb_set_bool(js, "fin", TCP_ISSET_FLAG_RAW_FIN(tcph) ? true : false);
346  jb_set_uint(js, "tcpres", TCP_GET_RAW_X2(tcph));
347  jb_set_uint(js, "tcpurgp", TCP_GET_RAW_URG_POINTER(tcph));
348 
349  jb_open_array(js, "flags");
351  jb_append_string(js, "retransmission");
353  jb_append_string(js, "spurious_retransmission");
355  jb_append_string(js, "keepalive");
357  jb_append_string(js, "keepalive_ack");
359  jb_append_string(js, "window_update");
360 
362  jb_append_string(js, "event_set");
364  jb_append_string(js, "state_update");
366  jb_append_string(js, "dup_ack");
368  jb_append_string(js, "dsack");
370  jb_append_string(js, "ack_unseen_data");
372  jb_append_string(js, "tcp_port_reuse");
374  jb_append_string(js, "zero_window_probe");
376  jb_append_string(js, "zero_window_probe_ack");
377  jb_close(js);
378  }
379  jb_close(js);
380 
381  jb_open_object(js, "session");
382  if (p->flow != NULL && p->flow->protoctx != NULL) {
383  const TcpSession *ssn = p->flow->protoctx;
384  const char *tcp_state = StreamTcpStateAsString(ssn->state);
385  if (tcp_state != NULL)
386  jb_set_string(js, "state", tcp_state);
388  const char *tcp_pstate = StreamTcpStateAsString(ssn->pstate);
389  if (tcp_pstate != NULL)
390  jb_set_string(js, "pstate", tcp_pstate);
391  }
392  EveAddFlowTcpFlags(ssn, "flags", js);
393 
394  jb_open_object(js, "client");
395  LogStream(&ssn->client, js);
396  jb_close(js);
397  jb_open_object(js, "server");
398  LogStream(&ssn->server, js);
399  jb_close(js);
400  }
401  jb_close(js);
402 
404  jb_open_array(js, "events");
405  for (int i = 0; i < p->events.cnt; i++) {
406  uint8_t event_code = p->events.events[i];
407  bool is_decode = EVENT_IS_DECODER_PACKET_ERROR(event_code);
408  if (is_decode)
409  continue;
410  if (event_code >= DECODE_EVENT_MAX)
411  continue;
412  const char *event = DEvents[event_code].event_name;
413  if (event == NULL)
414  continue;
415  jb_append_string(js, event);
416  }
417  jb_close(js);
418  }
419 
420  if (p->drop_reason != 0) {
421  const char *str = PacketDropReasonToString(p->drop_reason);
422  jb_set_string(js, "reason", str);
423  }
424 
425  /* Close stream. */
426  jb_close(js);
427 
428  OutputJsonBuilderBuffer(js, td->ctx);
429  jb_free(js);
430 
431  return TM_ECODE_OK;
432 }
433 
434 /**
435  * \brief Check if we need to log this packet
436  *
437  * \param tv Pointer the current thread variables
438  * \param p Pointer the packet which is tested
439  *
440  * \retval bool true or false
441  */
442 static bool EveStreamLogCondition(ThreadVars *tv, void *data, const Packet *p)
443 {
444  EveStreamLogThread *td = data;
445  EveStreamOutputCtx *ctx = td->stream_ctx;
446 
447  return (p->proto == IPPROTO_TCP &&
448  (ctx->trigger_flags == 0xffff ||
449  (p->l4.vars.tcp.stream_pkt_flags & ctx->trigger_flags) != 0));
450 }
451 
453 {
454  OutputRegisterPacketSubModule(LOGGER_JSON_STREAM, "eve-log", MODULE_NAME, "eve-log.stream",
455  EveStreamLogInitCtxSub, EveStreamLogger, EveStreamLogCondition, EveStreamLogThreadInit,
456  EveStreamLogThreadDeinit, NULL);
457 }
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:504
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
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:61
stream-tcp.h
unlikely
#define unlikely(expr)
Definition: util-optimize.h:35
PacketDropReasonToString
const char * PacketDropReasonToString(enum PacketDropReason r)
Definition: decode.c:871
PacketEngineEvents_::events
uint8_t events[PACKET_ENGINE_EVENT_MAX]
Definition: decode.h:294
TcpStream_::seg_tree
struct TCPSEG seg_tree
Definition: stream-tcp-private.h:136
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
IPV6_GET_RAW_CLASS
#define IPV6_GET_RAW_CLASS(ip6h)
Definition: decode-ipv6.h:63
OutputJsonBuilderBuffer
int OutputJsonBuilderBuffer(JsonBuilder *js, OutputJsonThreadCtx *ctx)
Definition: output-json.c:931
EveAddFlowTcpStreamFlags
void EveAddFlowTcpStreamFlags(const TcpStream *stream, const char *name, JsonBuilder *jb)
Definition: output-eve-stream.c:176
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:80
FLOW_PKT_TOSERVER
#define FLOW_PKT_TOSERVER
Definition: flow.h:228
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_::flowflags
uint8_t flowflags
Definition: decode.h:513
TM_ECODE_FAILED
@ TM_ECODE_FAILED
Definition: tm-threads-common.h:85
Flow_::protoctx
void * protoctx
Definition: flow.h:446
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:613
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:88
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:85
STREAMTCP_FLAG_MIDSTREAM
#define STREAMTCP_FLAG_MIDSTREAM
Definition: stream-tcp-private.h:170
TcpSession_::flags
uint32_t flags
Definition: stream-tcp-private.h:292
OutputJsonThreadCtx_
Definition: output-json.h:89
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
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:780
STREAMTCP_STREAM_FLAG_RST_RECV
#define STREAMTCP_STREAM_FLAG_RST_RECV
Definition: stream-tcp-private.h:240
util-print.h
detect-engine-mpm.h
TCP_ISSET_FLAG_RAW_URG
#define TCP_ISSET_FLAG_RAW_URG(p)
Definition: decode-tcp.h:124
detect.h
ThreadVars_
Per thread variable structure.
Definition: threadvars.h:57
PacketL4::L4Vars::tcp
TCPVars tcp
Definition: decode.h:459
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
STREAMTCP_STREAM_FLAG_TIMESTAMP
#define STREAMTCP_STREAM_FLAG_TIMESTAMP
Definition: stream-tcp-private.h:228
TCP_ISSET_FLAG_RAW_ACK
#define TCP_ISSET_FLAG_RAW_ACK(p)
Definition: decode-tcp.h:123
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:47
TcpSegment
Definition: stream-tcp-private.h:72
IPV6Hdr_
Definition: decode-ipv6.h:32
Packet_
Definition: decode.h:482
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:584
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
TCP_ISSET_FLAG_RAW_FIN
#define TCP_ISSET_FLAG_RAW_FIN(p)
Definition: decode-tcp.h:119
EveStreamLogRegister
void EveStreamLogRegister(void)
Definition: output-eve-stream.c:452
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:66
DecodeEvents_::event_name
const char * event_name
Definition: decode-events.h:319
EveStreamOutputCtx_::eve_ctx
OutputJsonCtx * eve_ctx
Definition: output-eve-stream.c:62
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:521
STREAMTCP_FLAG_TIMESTAMP
#define STREAMTCP_FLAG_TIMESTAMP
Definition: stream-tcp-private.h:176
LOG_DIR_PACKET
@ LOG_DIR_PACKET
Definition: output-json.h:37
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:91
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:210
TcpStream_::base_seq
uint32_t base_seq
Definition: stream-tcp-private.h:124
packet.h
TCP_ISSET_FLAG_RAW_PUSH
#define TCP_ISSET_FLAG_RAW_PUSH(p)
Definition: decode-tcp.h:122
TcpStream_::sb
StreamingBuffer sb
Definition: stream-tcp-private.h:135
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:295
tv
ThreadVars * tv
Definition: fuzz_decodepcapfile.c:32
TcpStream_::next_seq
uint32_t next_seq
Definition: stream-tcp-private.h:114
threadvars.h
TcpSession_::server
TcpStream server
Definition: stream-tcp-private.h:294
str
#define str(s)
Definition: suricata-common.h:291
STREAM_PKT_FLAG_ACK_UNSEEN_DATA
#define STREAM_PKT_FLAG_ACK_UNSEEN_DATA
Definition: stream-tcp-private.h:319
SCFree
#define SCFree(p)
Definition: util-mem.h:61
EveStreamLogThread_::ctx
OutputJsonThreadCtx * ctx
Definition: output-eve-stream.c:67
EveAddFlowTcpFlags
void EveAddFlowTcpFlags(const TcpSession *ssn, const char *name, JsonBuilder *jb)
Definition: output-eve-stream.c:206
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
detect-parse.h
util-buffer.h
TCP_ISSET_FLAG_RAW_SYN
#define TCP_ISSET_FLAG_RAW_SYN(p)
Definition: decode-tcp.h:120
TCP_ISSET_FLAG_RAW_RST
#define TCP_ISSET_FLAG_RAW_RST(p)
Definition: decode-tcp.h:121
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:630
StreamTcpStateAsString
const char * StreamTcpStateAsString(const enum TcpState state)
Definition: stream-tcp.c:7076
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:468
EveStreamOutputCtx_
Definition: output-eve-stream.c:60
IPV4_GET_RAW_IPLEN
#define IPV4_GET_RAW_IPLEN(ip4h)
Definition: decode-ipv4.h:98
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:492
EveStreamLogThread_
Definition: output-eve-stream.c:65
STREAM_PKT_FLAG_WINDOWUPDATE
#define STREAM_PKT_FLAG_WINDOWUPDATE
Definition: stream-tcp-private.h:315
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
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:695
DECODE_EVENT_MAX
@ DECODE_EVENT_MAX
Definition: decode-events.h:310
STREAMTCP_FLAG_SERVER_WSCALE
#define STREAMTCP_FLAG_SERVER_WSCALE
Definition: stream-tcp-private.h:178
PacketEngineEvents_::cnt
uint8_t cnt
Definition: decode.h:293
EVENT_IS_DECODER_PACKET_ERROR
#define EVENT_IS_DECODER_PACKET_ERROR(e)
Definition: decode-events.h:313
ConfNodeLookupChildValue
const char * ConfNodeLookupChildValue(const ConfNode *node, const char *name)
Lookup the value of a child configuration node by name.
Definition: conf.c:814