suricata
output-json-drop.c
Go to the documentation of this file.
1 /* Copyright (C) 2007-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  * \author Tom DeCanio <td@npulsetech.com>
22  *
23  * JSON Drop log module to log the dropped packet information
24  *
25  */
26 
27 #include "suricata-common.h"
28 #include "packet.h"
29 #include "detect.h"
30 #include "flow.h"
31 #include "conf.h"
32 
33 #include "threads.h"
34 #include "tm-threads.h"
35 #include "threadvars.h"
36 #include "util-debug.h"
37 
38 #include "decode-ipv4.h"
39 #include "detect-parse.h"
40 #include "detect-engine.h"
41 #include "detect-engine-mpm.h"
42 #include "detect-reference.h"
43 
44 #include "output.h"
45 #include "output-json.h"
46 #include "output-json-alert.h"
47 #include "output-json-drop.h"
48 
49 #include "util-unittest-helper.h"
51 #include "util-privs.h"
52 #include "util-print.h"
53 #include "util-proto-name.h"
54 #include "util-logopenfile.h"
55 #include "util-buffer.h"
56 
57 #include "action-globals.h"
58 
59 #define MODULE_NAME "JsonDropLog"
60 
61 #define LOG_DROP_ALERTS BIT_U8(1)
62 #define LOG_DROP_VERDICT BIT_U8(2)
63 
64 typedef struct JsonDropOutputCtx_ {
65  uint8_t flags;
68 
69 typedef struct JsonDropLogThread_ {
73 
74 /* default to true as this has been the default behavior for a long time */
75 static int g_droplog_flows_start = 1;
76 
77 /**
78  * \brief Log the dropped packets in netfilter format when engine is running
79  * in inline mode
80  *
81  * \param tv Pointer the current thread variables
82  * \param p Pointer the packet which is being logged
83  *
84  * \return return TM_ECODE_OK on success
85  */
86 static int DropLogJSON(ThreadVars *tv, JsonDropLogThread *aft, const Packet *p)
87 {
88  JsonDropOutputCtx *drop_ctx = aft->drop_ctx;
89 
91  JsonAddrInfoInit(p, LOG_DIR_PACKET, &addr, &drop_ctx->eve_ctx->cfg);
92 
93  SCJsonBuilder *js = CreateEveHeader(p, LOG_DIR_PACKET, "drop", &addr, drop_ctx->eve_ctx);
94  if (unlikely(js == NULL))
95  return TM_ECODE_OK;
96 
97  if (p->flow != NULL) {
98  if (p->flowflags & FLOW_PKT_TOSERVER) {
99  SCJbSetString(js, "direction", "to_server");
100  } else {
101  SCJbSetString(js, "direction", "to_client");
102  }
103  }
104 
105  SCJbOpenObject(js, "drop");
106 
107  uint16_t proto = 0;
108  if (PacketIsIPv4(p)) {
109  const IPV4Hdr *ip4h = PacketGetIPv4(p);
110  SCJbSetUint(js, "len", IPV4_GET_RAW_IPLEN(ip4h));
111  SCJbSetUint(js, "tos", IPV4_GET_RAW_IPTOS(ip4h));
112  SCJbSetUint(js, "ttl", IPV4_GET_RAW_IPTTL(ip4h));
113  SCJbSetUint(js, "ipid", IPV4_GET_RAW_IPID(ip4h));
114  proto = IPV4_GET_RAW_IPPROTO(ip4h);
115  } else if (PacketIsIPv6(p)) {
116  const IPV6Hdr *ip6h = PacketGetIPv6(p);
117  SCJbSetUint(js, "len", IPV6_GET_RAW_PLEN(ip6h));
118  SCJbSetUint(js, "tc", IPV6_GET_RAW_CLASS(ip6h));
119  SCJbSetUint(js, "hoplimit", IPV6_GET_RAW_HLIM(ip6h));
120  SCJbSetUint(js, "flowlbl", IPV6_GET_RAW_FLOW(ip6h));
122  }
123  switch (proto) {
124  case IPPROTO_TCP:
125  if (PacketIsTCP(p)) {
126  const TCPHdr *tcph = PacketGetTCP(p);
127  SCJbSetUint(js, "tcpseq", TCP_GET_RAW_SEQ(tcph));
128  SCJbSetUint(js, "tcpack", TCP_GET_RAW_ACK(tcph));
129  SCJbSetUint(js, "tcpwin", TCP_GET_RAW_WINDOW(tcph));
130  SCJbSetBool(js, "syn", TCP_ISSET_FLAG_RAW_SYN(tcph));
131  SCJbSetBool(js, "ack", TCP_ISSET_FLAG_RAW_ACK(tcph));
132  SCJbSetBool(js, "psh", TCP_ISSET_FLAG_RAW_PUSH(tcph));
133  SCJbSetBool(js, "rst", TCP_ISSET_FLAG_RAW_RST(tcph));
134  SCJbSetBool(js, "urg", TCP_ISSET_FLAG_RAW_URG(tcph));
135  SCJbSetBool(js, "fin", TCP_ISSET_FLAG_RAW_FIN(tcph));
136  SCJbSetUint(js, "tcpres", TCP_GET_RAW_X2(tcph));
137  SCJbSetUint(js, "tcpurgp", TCP_GET_RAW_URG_POINTER(tcph));
138  }
139  break;
140  case IPPROTO_UDP:
141  if (PacketIsUDP(p)) {
142  const UDPHdr *udph = PacketGetUDP(p);
143  SCJbSetUint(js, "udplen", UDP_GET_RAW_LEN(udph));
144  }
145  break;
146  case IPPROTO_ICMP:
147  if (PacketIsICMPv4(p)) {
148  SCJbSetUint(js, "icmp_id", ICMPV4_GET_ID(p));
149  SCJbSetUint(js, "icmp_seq", ICMPV4_GET_SEQ(p));
150  } else if (PacketIsICMPv6(p)) {
151  SCJbSetUint(js, "icmp_id", ICMPV6_GET_ID(p));
152  SCJbSetUint(js, "icmp_seq", ICMPV6_GET_SEQ(p));
153  }
154  break;
155  }
156  if (p->drop_reason != 0) {
157  const char *str = PacketDropReasonToString(p->drop_reason);
158  SCJbSetString(js, "reason", str);
159  }
160 
161  /* Close drop. */
162  SCJbClose(js);
163 
164  if (aft->drop_ctx->flags & LOG_DROP_VERDICT) {
165  EveAddVerdict(js, p, 0);
166  }
167 
168  if (aft->drop_ctx->flags & LOG_DROP_ALERTS) {
169  bool logged = false;
170  for (int i = 0; i < p->alerts.cnt; i++) {
171  const PacketAlert *pa = &p->alerts.alerts[i];
172  if (unlikely(pa->s == NULL)) {
173  continue;
174  }
176  ((pa->action & ACTION_DROP) && EngineModeIsIPS()))
177  {
178  AlertJsonHeader(p, pa, js, 0, &addr, NULL);
179  logged = true;
180  break;
181  }
182  }
183  if (!logged && p->alerts.drop.action != 0) {
184  const PacketAlert *pa = &p->alerts.drop;
185  AlertJsonHeader(p, pa, js, 0, &addr, NULL);
186  }
187  }
188 
189  OutputJsonBuilderBuffer(tv, p, p->flow, js, aft->ctx);
190  SCJbFree(js);
191 
192  return TM_ECODE_OK;
193 }
194 
195 static TmEcode JsonDropLogThreadInit(ThreadVars *t, const void *initdata, void **data)
196 {
197  JsonDropLogThread *aft = SCCalloc(1, sizeof(JsonDropLogThread));
198  if (unlikely(aft == NULL))
199  return TM_ECODE_FAILED;
200 
201  if(initdata == NULL)
202  {
203  SCLogDebug("Error getting context for EveLogDrop. \"initdata\" argument NULL");
204  goto error_exit;
205  }
206 
207  /** Use the Output Context (file pointer and mutex) */
208  aft->drop_ctx = ((OutputCtx *)initdata)->data;
209  aft->ctx = CreateEveThreadCtx(t, aft->drop_ctx->eve_ctx);
210  if (!aft->ctx) {
211  goto error_exit;
212  }
213 
214  *data = (void *)aft;
215  return TM_ECODE_OK;
216 
217 error_exit:
218  SCFree(aft);
219  return TM_ECODE_FAILED;
220 }
221 
222 static TmEcode JsonDropLogThreadDeinit(ThreadVars *t, void *data)
223 {
224  JsonDropLogThread *aft = (JsonDropLogThread *)data;
225  if (aft == NULL) {
226  return TM_ECODE_OK;
227  }
228 
229  FreeEveThreadCtx(aft->ctx);
230 
231  /* clear memory */
232  memset(aft, 0, sizeof(*aft));
233 
234  SCFree(aft);
235  return TM_ECODE_OK;
236 }
237 
238 static void JsonDropOutputCtxFree(JsonDropOutputCtx *drop_ctx)
239 {
240  if (drop_ctx != NULL) {
241  SCFree(drop_ctx);
242  }
243 }
244 
245 static void JsonDropLogDeInitCtxSub(OutputCtx *output_ctx)
246 {
248 
249  JsonDropOutputCtx *drop_ctx = output_ctx->data;
250  SCFree(drop_ctx);
251  SCLogDebug("cleaning up sub output_ctx %p", output_ctx);
252  SCFree(output_ctx);
253 }
254 
255 static OutputInitResult JsonDropLogInitCtxSub(SCConfNode *conf, OutputCtx *parent_ctx)
256 {
257  OutputInitResult result = { NULL, false };
258  if (OutputDropLoggerEnable() != 0) {
259  SCLogError("only one 'drop' logger "
260  "can be enabled");
261  return result;
262  }
263 
264  OutputJsonCtx *ajt = parent_ctx->data;
265 
266  JsonDropOutputCtx *drop_ctx = SCCalloc(1, sizeof(*drop_ctx));
267  if (drop_ctx == NULL)
268  return result;
269 
270  OutputCtx *output_ctx = SCCalloc(1, sizeof(OutputCtx));
271  if (unlikely(output_ctx == NULL)) {
272  JsonDropOutputCtxFree(drop_ctx);
273  return result;
274  }
275 
276  if (conf) {
277  const char *extended = SCConfNodeLookupChildValue(conf, "alerts");
278  if (extended != NULL) {
279  if (SCConfValIsTrue(extended)) {
280  drop_ctx->flags |= LOG_DROP_ALERTS;
281  }
282  }
283  extended = SCConfNodeLookupChildValue(conf, "flows");
284  if (extended != NULL) {
285  if (strcasecmp(extended, "start") == 0) {
286  g_droplog_flows_start = 1;
287  } else if (strcasecmp(extended, "all") == 0) {
288  g_droplog_flows_start = 0;
289  } else {
290  SCLogWarning("valid options for "
291  "'flow' are 'start' and 'all'");
292  }
293  }
294 
295  extended = SCConfNodeLookupChildValue(conf, "verdict");
296 
297  if (EngineModeIsFirewall()) {
298  drop_ctx->flags |= LOG_DROP_VERDICT;
299  } else if (extended != NULL) {
300  if (SCConfValIsTrue(extended)) {
301  drop_ctx->flags |= LOG_DROP_VERDICT;
302  }
303  }
304  }
305 
306  drop_ctx->eve_ctx = ajt;
307 
308  output_ctx->data = drop_ctx;
309  output_ctx->DeInit = JsonDropLogDeInitCtxSub;
310 
311  result.ctx = output_ctx;
312  result.ok = true;
313  return result;
314 }
315 
316 /**
317  * \brief Log the dropped packets when engine is running in inline mode
318  *
319  * \param tv Pointer the current thread variables
320  * \param data Pointer to the droplog struct
321  * \param p Pointer the packet which is being logged
322  *
323  * \retval 0 on success
324  */
325 static int JsonDropLogger(ThreadVars *tv, void *thread_data, const Packet *p)
326 {
327  JsonDropLogThread *td = thread_data;
328  int r = DropLogJSON(tv, td, p);
329  if (r < 0)
330  return -1;
331 
332  if (!g_droplog_flows_start)
333  return 0;
334 
335  if (p->flow) {
336  if (p->flow->flags & FLOW_ACTION_DROP) {
341  }
342  }
343  return 0;
344 }
345 
346 /**
347  * \brief Check if we need to drop-log this packet
348  *
349  * \param tv Pointer the current thread variables
350  * \param p Pointer the packet which is tested
351  *
352  * \retval bool true or false
353  */
354 static bool JsonDropLogCondition(ThreadVars *tv, void *data, const Packet *p)
355 {
356  if (!EngineModeIsIPS()) {
357  SCLogDebug("engine is not running in inline mode, so returning");
358  return false;
359  }
360  if (PKT_IS_PSEUDOPKT(p)) {
361  SCLogDebug("drop log doesn't log pseudo packets");
362  return false;
363  }
364 
365  if (!(PacketCheckAction(p, ACTION_DROP))) {
366  return false;
367  }
368 
369  if (g_droplog_flows_start && p->flow != NULL) {
370  bool ret = false;
371 
372  /* for a flow that will be dropped fully, log just once per direction */
373  if (p->flow->flags & FLOW_ACTION_DROP) {
375  ret = true;
377  ret = true;
378  }
379 
380  /* if drop is caused by signature, log anyway */
381  if (p->alerts.drop.action != 0)
382  ret = true;
383 
384  return ret;
385  }
386 
387  return true;
388 }
389 
391 {
392  OutputPacketLoggerFunctions output_logger_functions = {
393  .LogFunc = JsonDropLogger,
394  .ConditionFunc = JsonDropLogCondition,
395  .ThreadInitFunc = JsonDropLogThreadInit,
396  .ThreadDeinitFunc = JsonDropLogThreadDeinit,
397  .ThreadExitPrintStatsFunc = NULL,
398  };
399 
400  OutputRegisterPacketSubModule(LOGGER_JSON_DROP, "eve-log", MODULE_NAME, "eve-log.drop",
401  JsonDropLogInitCtxSub, &output_logger_functions);
402 }
PKT_IS_TOCLIENT
#define PKT_IS_TOCLIENT(p)
Definition: decode.h:240
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
PacketCheckAction
bool PacketCheckAction(const Packet *p, const uint8_t a)
Definition: packet.c:50
tm-threads.h
IPV4_GET_RAW_IPID
#define IPV4_GET_RAW_IPID(ip4h)
Definition: decode-ipv4.h:99
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
OutputDropLoggerEnable
int OutputDropLoggerEnable(void)
Definition: output.c:678
IPV6_GET_RAW_PLEN
#define IPV6_GET_RAW_PLEN(ip6h)
Definition: decode-ipv6.h:66
PacketAlert_::s
const struct Signature_ * s
Definition: decode.h:254
Flow_::flags
uint64_t flags
Definition: flow.h:408
JsonDropLogThread_::drop_ctx
JsonDropOutputCtx * drop_ctx
Definition: output-json-drop.c:70
IPV6_GET_RAW_HLIM
#define IPV6_GET_RAW_HLIM(ip6h)
Definition: decode-ipv6.h:67
IPV4_GET_RAW_IPPROTO
#define IPV4_GET_RAW_IPPROTO(ip4h)
Definition: decode-ipv4.h:103
PKT_IS_PSEUDOPKT
#define PKT_IS_PSEUDOPKT(p)
return 1 if the packet is a pseudo packet
Definition: decode.h:1364
OutputJsonCtx_::cfg
OutputJsonCommonSettings cfg
Definition: output-json.h:80
unlikely
#define unlikely(expr)
Definition: util-optimize.h:35
ACTION_REJECT
#define ACTION_REJECT
Definition: action-globals.h:31
JsonDropLogThread_
Definition: output-json-drop.c:69
PacketDropReasonToString
const char * PacketDropReasonToString(enum PacketDropReason r)
Definition: decode.c:942
SCLogDebug
#define SCLogDebug(...)
Definition: util-debug.h:282
FreeEveThreadCtx
void FreeEveThreadCtx(OutputJsonThreadCtx *ctx)
Definition: output-json-common.c:58
PacketAlerts_::cnt
uint16_t cnt
Definition: decode.h:289
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
threads.h
OutputJsonCtx_
Definition: output-json.h:77
ICMPV6_GET_SEQ
#define ICMPV6_GET_SEQ(p)
Definition: decode-icmpv6.h:109
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
logged
int logged
Definition: app-layer-htp.h:1
JsonDropOutputCtx
struct JsonDropOutputCtx_ JsonDropOutputCtx
AlertJsonHeader
void AlertJsonHeader(const Packet *p, const PacketAlert *pa, SCJsonBuilder *js, uint16_t flags, JsonAddrInfo *addr, char *xff_buffer)
Definition: output-json-alert.c:209
PacketAlerts_::alerts
PacketAlert * alerts
Definition: decode.h:293
CreateEveThreadCtx
OutputJsonThreadCtx * CreateEveThreadCtx(ThreadVars *t, OutputJsonCtx *ctx)
Definition: output-json-common.c:29
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
IPV6_GET_L4PROTO
#define IPV6_GET_L4PROTO(p)
Definition: decode-ipv6.h:75
ICMPV6_GET_ID
#define ICMPV6_GET_ID(p)
Definition: decode-icmpv6.h:107
PacketAlerts_::drop
PacketAlert drop
Definition: decode.h:296
util-privs.h
FLOW_ACTION_DROP
#define FLOW_ACTION_DROP
Definition: flow.h:69
p
Packet * p
Definition: fuzz_dataset.c:30
OutputJsonBuilderBuffer
void OutputJsonBuilderBuffer(ThreadVars *tv, const Packet *p, Flow *f, SCJsonBuilder *js, OutputJsonThreadCtx *ctx)
Definition: output-json.c:1018
FLOW_TOSERVER_DROP_LOGGED
#define FLOW_TOSERVER_DROP_LOGGED
Definition: flow.h:77
proto
uint8_t proto
Definition: decode-template.h:0
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
EngineModeIsFirewall
bool EngineModeIsFirewall(void)
Definition: suricata.c:240
TM_ECODE_FAILED
@ TM_ECODE_FAILED
Definition: tm-threads-common.h:82
TCP_GET_RAW_WINDOW
#define TCP_GET_RAW_WINDOW(tcph)
Definition: decode-tcp.h:83
Packet_::alerts
PacketAlerts alerts
Definition: decode.h:637
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
OutputCtx_
Definition: tm-modules.h:88
PacketAlert_::action
uint8_t action
Definition: decode.h:251
OutputJsonThreadCtx_
Definition: output-json.h:85
detect-reference.h
ICMPV4_GET_SEQ
#define ICMPV4_GET_SEQ(p)
Definition: decode-icmpv4.h:238
ACTION_REJECT_DST
#define ACTION_REJECT_DST
Definition: action-globals.h:32
util-debug.h
UDP_GET_RAW_LEN
#define UDP_GET_RAW_LEN(udph)
Definition: decode-udp.h:30
LOG_DROP_ALERTS
#define LOG_DROP_ALERTS
Definition: output-json-drop.c:61
IPV4_GET_RAW_IPTOS
#define IPV4_GET_RAW_IPTOS(ip4h)
Definition: decode-ipv4.h:97
PKT_IS_TOSERVER
#define PKT_IS_TOSERVER(p)
Definition: decode.h:239
OutputInitResult_::ctx
OutputCtx * ctx
Definition: output.h:47
output-json.h
TCP_ISSET_FLAG_RAW_ACK
#define TCP_ISSET_FLAG_RAW_ACK(tcph)
Definition: decode-tcp.h:123
JsonDropLogThread_::ctx
OutputJsonThreadCtx * ctx
Definition: output-json-drop.c:71
TCP_ISSET_FLAG_RAW_RST
#define TCP_ISSET_FLAG_RAW_RST(tcph)
Definition: decode-tcp.h:121
util-print.h
detect-engine-mpm.h
detect.h
ThreadVars_
Per thread variable structure.
Definition: threadvars.h:57
OutputInitResult_::ok
bool ok
Definition: output.h:48
SCLogWarning
#define SCLogWarning(...)
Macro used to log WARNING messages.
Definition: util-debug.h:262
LOG_DROP_VERDICT
#define LOG_DROP_VERDICT
Definition: output-json-drop.c:62
JsonAddrInfo_
Definition: output-json.h:41
IPV6Hdr_
Definition: decode-ipv6.h:32
Packet_
Definition: decode.h:516
IPV4_GET_RAW_IPTTL
#define IPV4_GET_RAW_IPTTL(ip4h)
Definition: decode-ipv4.h:102
conf.h
TCP_ISSET_FLAG_RAW_FIN
#define TCP_ISSET_FLAG_RAW_FIN(tcph)
Definition: decode-tcp.h:119
TmEcode
TmEcode
Definition: tm-threads-common.h:80
util-proto-name.h
JsonDropOutputCtx_::flags
uint8_t flags
Definition: output-json-drop.c:65
IPV4Hdr_
Definition: decode-ipv4.h:72
ACTION_REJECT_BOTH
#define ACTION_REJECT_BOTH
Definition: action-globals.h:33
decode-ipv4.h
ICMPV4_GET_ID
#define ICMPV4_GET_ID(p)
Definition: decode-icmpv4.h:236
OutputInitResult_
Definition: output.h:46
Packet_::flow
struct Flow_ * flow
Definition: decode.h:564
suricata-common.h
OutputCtx_::DeInit
void(* DeInit)(struct OutputCtx_ *)
Definition: tm-modules.h:94
MODULE_NAME
#define MODULE_NAME
Definition: output-json-drop.c:59
packet.h
ACTION_DROP
#define ACTION_DROP
Definition: action-globals.h:30
LOGGER_JSON_DROP
@ LOGGER_JSON_DROP
Definition: suricata-common.h:503
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
UDPHdr_
Definition: decode-udp.h:42
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
output-json-alert.h
threadvars.h
EveAddVerdict
void EveAddVerdict(SCJsonBuilder *jb, const Packet *p, const uint8_t alert_action)
Build verdict object.
Definition: output-json-alert.c:549
str
#define str(s)
Definition: suricata-common.h:313
SCLogError
#define SCLogError(...)
Macro used to log ERROR messages.
Definition: util-debug.h:274
JsonDropLogThread
struct JsonDropLogThread_ JsonDropLogThread
SCFree
#define SCFree(p)
Definition: util-mem.h:61
util-logopenfile.h
JsonDropOutputCtx_
Definition: output-json-drop.c:64
JsonDropLogRegister
void JsonDropLogRegister(void)
Definition: output-json-drop.c:390
detect-parse.h
util-buffer.h
FLOW_TOCLIENT_DROP_LOGGED
#define FLOW_TOCLIENT_DROP_LOGGED
Definition: flow.h:79
EngineModeIsIPS
int EngineModeIsIPS(void)
Definition: suricata.c:247
Packet_::drop_reason
uint8_t drop_reason
Definition: decode.h:660
PacketAlert_
Definition: decode.h:249
LOG_DIR_PACKET
@ LOG_DIR_PACKET
Definition: output-eve-bindgen.h:34
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
TCP_GET_RAW_URG_POINTER
#define TCP_GET_RAW_URG_POINTER(tcph)
Definition: decode-tcp.h:84
flow.h
SCCalloc
#define SCCalloc(nm, sz)
Definition: util-mem.h:53
TCP_GET_RAW_ACK
#define TCP_GET_RAW_ACK(tcph)
Definition: decode-tcp.h:81
SCConfNode_
Definition: conf.h:37
OutputPacketLoggerFunctions_
Definition: output.h:86
TCP_ISSET_FLAG_RAW_URG
#define TCP_ISSET_FLAG_RAW_URG(tcph)
Definition: decode-tcp.h:124
TCPHdr_
Definition: decode-tcp.h:149
JsonDropOutputCtx_::eve_ctx
OutputJsonCtx * eve_ctx
Definition: output-json-drop.c:66
output.h
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
output-json-drop.h