suricata
decode.c
Go to the documentation of this file.
1 /* Copyright (C) 2007-2019 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  * \defgroup decode Packet decoding
20  *
21  * \brief Code in charge of protocol decoding
22  *
23  * The task of decoding packets is made in different files and
24  * as Suricata is supporting encapsulation there is a potential
25  * recursivity in the call.
26  *
27  * For each protocol a DecodePROTO function is provided. For
28  * example we have DecodeIPV4() for IPv4 and DecodePPP() for
29  * PPP.
30  *
31  * These functions have all a pkt and a len argument which
32  * are respectively a pointer to the protocol data and the length
33  * of this protocol data.
34  *
35  * \attention The pkt parameter must point to the effective data because
36  * it will be used later to set per protocol pointer like Packet::tcph
37  *
38  * @{
39  */
40 
41 
42 /**
43  * \file
44  *
45  * \author Victor Julien <victor@inliniac.net>
46  *
47  * Decode the raw packet
48  */
49 
50 #include "suricata-common.h"
51 #include "suricata.h"
52 #include "conf.h"
53 #include "decode.h"
54 #include "decode-teredo.h"
55 #include "util-debug.h"
56 #include "util-mem.h"
57 #include "app-layer-detect-proto.h"
58 #include "app-layer.h"
59 #include "tm-threads.h"
60 #include "util-error.h"
61 #include "util-print.h"
62 #include "tmqh-packetpool.h"
63 #include "util-profiling.h"
64 #include "pkt-var.h"
65 #include "util-mpm-ac.h"
66 #include "util-hash-string.h"
67 #include "output.h"
68 #include "output-flow.h"
69 #include "flow-storage.h"
70 
71 uint32_t default_packet_size = 0;
72 extern bool stats_decoder_events;
73 extern const char *stats_decoder_events_prefix;
74 extern bool stats_stream_events;
76 
77 static int DecodeTunnel(ThreadVars *, DecodeThreadVars *, Packet *, const uint8_t *, uint32_t,
79 
80 static int DecodeTunnel(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, const uint8_t *pkt,
81  uint32_t len, enum DecodeTunnelProto proto)
82 {
83  switch (proto) {
84  case DECODE_TUNNEL_PPP:
85  return DecodePPP(tv, dtv, p, pkt, len);
86  case DECODE_TUNNEL_IPV4:
87  return DecodeIPV4(tv, dtv, p, pkt, len);
88  case DECODE_TUNNEL_IPV6:
90  return DecodeIPV6(tv, dtv, p, pkt, len);
91  case DECODE_TUNNEL_VLAN:
92  return DecodeVLAN(tv, dtv, p, pkt, len);
94  return DecodeEthernet(tv, dtv, p, pkt, len);
96  return DecodeERSPAN(tv, dtv, p, pkt, len);
98  return DecodeERSPANTypeI(tv, dtv, p, pkt, len);
99  case DECODE_TUNNEL_NSH:
100  return DecodeNSH(tv, dtv, p, pkt, len);
101  default:
102  SCLogDebug("FIXME: DecodeTunnel: protocol %" PRIu32 " not supported.", proto);
103  break;
104  }
105  return TM_ECODE_OK;
106 }
107 
108 /**
109  * \brief Return a malloced packet.
110  */
112 {
114  SCFree(p);
115 }
116 
117 /**
118  * \brief Finalize decoding of a packet
119  *
120  * This function needs to be call at the end of decode
121  * functions when decoding has been successful.
122  *
123  */
125 {
126  if (p->flags & PKT_IS_INVALID) {
128  }
129 }
130 
133 {
134  for (uint8_t i = 0; i < p->events.cnt; i++) {
135  const uint8_t e = p->events.events[i];
136 
138  continue;
140  continue;
142  }
143 }
144 
145 /**
146  * \brief Get a malloced packet.
147  *
148  * \retval p packet, NULL on error
149  */
151 {
153  if (unlikely(p == NULL)) {
154  return NULL;
155  }
156 
157  memset(p, 0, SIZE_OF_PACKET);
160  p->flags |= PKT_ALLOC;
161 
162  SCLogDebug("allocated a new packet only using alloc...");
163 
165  return p;
166 }
167 
168 /**
169  * \brief Return a packet to where it was allocated.
170  */
172 {
173  if (p->flags & PKT_ALLOC)
174  PacketFree(p);
175  else
177 }
178 
179 /**
180  * \brief Get a packet. We try to get a packet from the packetpool first, but
181  * if that is empty we alloc a packet that is free'd again after
182  * processing.
183  *
184  * \retval p packet, NULL on error
185  */
187 {
188  /* try the pool first */
190 
191  if (p == NULL) {
192  /* non fatal, we're just not processing a packet then */
193  p = PacketGetFromAlloc();
194  } else {
196  }
197 
198  return p;
199 }
200 
201 inline int PacketCallocExtPkt(Packet *p, int datalen)
202 {
203  if (! p->ext_pkt) {
204  p->ext_pkt = SCCalloc(1, datalen);
205  if (unlikely(p->ext_pkt == NULL)) {
206  SET_PKT_LEN(p, 0);
207  return -1;
208  }
209  }
210  return 0;
211 }
212 
213 /**
214  * \brief Copy data to Packet payload at given offset
215  *
216  * This function copies data/payload to a Packet. It uses the
217  * space allocated at Packet creation (pointed by Packet::pkt)
218  * or allocate some memory (pointed by Packet::ext_pkt) if the
219  * data size is to big to fit in initial space (of size
220  * default_packet_size).
221  *
222  * \param Pointer to the Packet to modify
223  * \param Offset of the copy relatively to payload of Packet
224  * \param Pointer to the data to copy
225  * \param Length of the data to copy
226  */
227 inline int PacketCopyDataOffset(Packet *p, uint32_t offset, const uint8_t *data, uint32_t datalen)
228 {
229  if (unlikely(offset + datalen > MAX_PAYLOAD_SIZE)) {
230  /* too big */
231  SET_PKT_LEN(p, 0);
232  return -1;
233  }
234 
235  /* Do we have already an packet with allocated data */
236  if (! p->ext_pkt) {
237  uint32_t newsize = offset + datalen;
238  // check overflow
239  if (newsize < offset)
240  return -1;
241  if (newsize <= default_packet_size) {
242  /* data will fit in memory allocated with packet */
243  memcpy(GET_PKT_DIRECT_DATA(p) + offset, data, datalen);
244  } else {
245  /* here we need a dynamic allocation */
247  if (unlikely(p->ext_pkt == NULL)) {
248  SET_PKT_LEN(p, 0);
249  return -1;
250  }
251  /* copy initial data */
253  /* copy data as asked */
254  memcpy(p->ext_pkt + offset, data, datalen);
255  }
256  } else {
257  memcpy(p->ext_pkt + offset, data, datalen);
258  }
259  return 0;
260 }
261 
262 /**
263  * \brief Copy data to Packet payload and set packet length
264  *
265  * \param Pointer to the Packet to modify
266  * \param Pointer to the data to copy
267  * \param Length of the data to copy
268  */
269 inline int PacketCopyData(Packet *p, const uint8_t *pktdata, uint32_t pktlen)
270 {
271  SET_PKT_LEN(p, (size_t)pktlen);
272  return PacketCopyDataOffset(p, 0, pktdata, pktlen);
273 }
274 
275 /**
276  * \brief Setup a pseudo packet (tunnel)
277  *
278  * \param parent parent packet for this pseudo pkt
279  * \param pkt raw packet data
280  * \param len packet data length
281  * \param proto protocol of the tunneled packet
282  *
283  * \retval p the pseudo packet or NULL if out of memory
284  */
286  const uint8_t *pkt, uint32_t len, enum DecodeTunnelProto proto)
287 {
288  int ret;
289 
290  SCEnter();
291 
292  /* get us a packet */
294  if (unlikely(p == NULL)) {
295  SCReturnPtr(NULL, "Packet");
296  }
297 
298  /* copy packet and set length, proto */
299  PacketCopyData(p, pkt, len);
300  p->recursion_level = parent->recursion_level + 1;
301  p->ts.tv_sec = parent->ts.tv_sec;
302  p->ts.tv_usec = parent->ts.tv_usec;
303  p->datalink = DLT_RAW;
304  p->tenant_id = parent->tenant_id;
305  p->livedev = parent->livedev;
306 
307  /* set the root ptr to the lowest layer */
308  if (parent->root != NULL)
309  p->root = parent->root;
310  else
311  p->root = parent;
312 
313  /* tell new packet it's part of a tunnel */
314  SET_TUNNEL_PKT(p);
315 
316  ret = DecodeTunnel(tv, dtv, p, GET_PKT_DATA(p),
317  GET_PKT_LEN(p), proto);
318 
319  if (unlikely(ret != TM_ECODE_OK) ||
321  {
322  /* Not a (valid) tunnel packet */
323  SCLogDebug("tunnel packet is invalid");
324 
325  p->root = NULL;
326  UNSET_TUNNEL_PKT(p);
328  SCReturnPtr(NULL, "Packet");
329  }
330 
331 
332  /* tell parent packet it's part of a tunnel */
333  SET_TUNNEL_PKT(parent);
334 
335  /* increment tunnel packet refcnt in the root packet */
337 
338  /* disable payload (not packet) inspection on the parent, as the payload
339  * is the packet we will now run through the system separately. We do
340  * check it against the ip/port/other header checks though */
342  SCReturnPtr(p, "Packet");
343 }
344 
345 /**
346  * \brief Setup a pseudo packet (reassembled frags)
347  *
348  * Difference with PacketPseudoPktSetup is that this func doesn't increment
349  * the recursion level. It needs to be on the same level as the frags because
350  * we run the flow engine against this and we need to get the same flow.
351  *
352  * \param parent parent packet for this pseudo pkt
353  * \param pkt raw packet data
354  * \param len packet data length
355  * \param proto protocol of the tunneled packet
356  *
357  * \retval p the pseudo packet or NULL if out of memory
358  */
359 Packet *PacketDefragPktSetup(Packet *parent, const uint8_t *pkt, uint32_t len, uint8_t proto)
360 {
361  SCEnter();
362 
363  /* get us a packet */
365  if (unlikely(p == NULL)) {
366  SCReturnPtr(NULL, "Packet");
367  }
368 
369  /* set the root ptr to the lowest layer */
370  if (parent->root != NULL)
371  p->root = parent->root;
372  else
373  p->root = parent;
374 
375  /* copy packet and set lenght, proto */
376  if (pkt && len) {
377  PacketCopyData(p, pkt, len);
378  }
379  p->recursion_level = parent->recursion_level; /* NOT incremented */
380  p->ts.tv_sec = parent->ts.tv_sec;
381  p->ts.tv_usec = parent->ts.tv_usec;
382  p->datalink = DLT_RAW;
383  p->tenant_id = parent->tenant_id;
384  /* tell new packet it's part of a tunnel */
385  SET_TUNNEL_PKT(p);
386  p->vlan_id[0] = parent->vlan_id[0];
387  p->vlan_id[1] = parent->vlan_id[1];
388  p->vlan_idx = parent->vlan_idx;
389  p->livedev = parent->livedev;
390 
391  SCReturnPtr(p, "Packet");
392 }
393 
394 /**
395  * \brief inform defrag "parent" that a pseudo packet is
396  * now associated to it.
397  */
399 {
400  /* tell parent packet it's part of a tunnel */
401  SET_TUNNEL_PKT(parent);
402 
403  /* increment tunnel packet refcnt in the root packet */
404  TUNNEL_INCR_PKT_TPR(parent);
405 
406  /* disable payload (not packet) inspection on the parent, as the payload
407  * is the packet we will now run through the system separately. We do
408  * check it against the ip/port/other header checks though */
410 }
411 
412 /**
413  * \note if p->flow is set, the flow is locked
414  */
416 {
417  if (PKT_IS_PSEUDOPKT(p))
418  return;
419 
420 #ifdef CAPTURE_OFFLOAD
421  /* Don't try to bypass if flow is already out or
422  * if we have failed to do it once */
423  if (p->flow) {
424  int state = p->flow->flow_state;
425  if ((state == FLOW_STATE_LOCAL_BYPASSED) ||
426  (state == FLOW_STATE_CAPTURE_BYPASSED)) {
427  return;
428  }
429  FlowBypassInfo *fc = SCCalloc(sizeof(FlowBypassInfo), 1);
430  if (fc) {
432  } else {
433  return;
434  }
435  }
436  if (p->BypassPacketsFlow && p->BypassPacketsFlow(p)) {
437  if (p->flow) {
438  FlowUpdateState(p->flow, FLOW_STATE_CAPTURE_BYPASSED);
439  }
440  } else {
441  if (p->flow) {
443  }
444  }
445 #else /* CAPTURE_OFFLOAD */
446  if (p->flow) {
447  int state = p->flow->flow_state;
448  if (state == FLOW_STATE_LOCAL_BYPASSED)
449  return;
451  }
452 #endif
453 }
454 
455 /** \brief switch direction of a packet */
457 {
458  if (PKT_IS_TOSERVER(p)) {
461 
465  }
466  } else {
469 
473  }
474  }
475 }
476 
477 /* counter name store */
478 static HashTable *g_counter_table = NULL;
479 static SCMutex g_counter_table_mutex = SCMUTEX_INITIALIZER;
480 
482 {
483  SCMutexLock(&g_counter_table_mutex);
484  if (g_counter_table) {
485  HashTableFree(g_counter_table);
486  g_counter_table = NULL;
487  }
488  SCMutexUnlock(&g_counter_table_mutex);
489 }
490 
492 {
493  /* register counters */
494  dtv->counter_pkts = StatsRegisterCounter("decoder.pkts", tv);
495  dtv->counter_bytes = StatsRegisterCounter("decoder.bytes", tv);
496  dtv->counter_invalid = StatsRegisterCounter("decoder.invalid", tv);
497  dtv->counter_ipv4 = StatsRegisterCounter("decoder.ipv4", tv);
498  dtv->counter_ipv6 = StatsRegisterCounter("decoder.ipv6", tv);
499  dtv->counter_eth = StatsRegisterCounter("decoder.ethernet", tv);
500  dtv->counter_chdlc = StatsRegisterCounter("decoder.chdlc", tv);
501  dtv->counter_raw = StatsRegisterCounter("decoder.raw", tv);
502  dtv->counter_null = StatsRegisterCounter("decoder.null", tv);
503  dtv->counter_sll = StatsRegisterCounter("decoder.sll", tv);
504  dtv->counter_tcp = StatsRegisterCounter("decoder.tcp", tv);
505  dtv->counter_udp = StatsRegisterCounter("decoder.udp", tv);
506  dtv->counter_sctp = StatsRegisterCounter("decoder.sctp", tv);
507  dtv->counter_esp = StatsRegisterCounter("decoder.esp", tv);
508  dtv->counter_icmpv4 = StatsRegisterCounter("decoder.icmpv4", tv);
509  dtv->counter_icmpv6 = StatsRegisterCounter("decoder.icmpv6", tv);
510  dtv->counter_ppp = StatsRegisterCounter("decoder.ppp", tv);
511  dtv->counter_pppoe = StatsRegisterCounter("decoder.pppoe", tv);
512  dtv->counter_geneve = StatsRegisterCounter("decoder.geneve", tv);
513  dtv->counter_gre = StatsRegisterCounter("decoder.gre", tv);
514  dtv->counter_vlan = StatsRegisterCounter("decoder.vlan", tv);
515  dtv->counter_vlan_qinq = StatsRegisterCounter("decoder.vlan_qinq", tv);
516  dtv->counter_vxlan = StatsRegisterCounter("decoder.vxlan", tv);
517  dtv->counter_ieee8021ah = StatsRegisterCounter("decoder.ieee8021ah", tv);
518  dtv->counter_teredo = StatsRegisterCounter("decoder.teredo", tv);
519  dtv->counter_ipv4inipv6 = StatsRegisterCounter("decoder.ipv4_in_ipv6", tv);
520  dtv->counter_ipv6inipv6 = StatsRegisterCounter("decoder.ipv6_in_ipv6", tv);
521  dtv->counter_mpls = StatsRegisterCounter("decoder.mpls", tv);
522  dtv->counter_avg_pkt_size = StatsRegisterAvgCounter("decoder.avg_pkt_size", tv);
523  dtv->counter_max_pkt_size = StatsRegisterMaxCounter("decoder.max_pkt_size", tv);
524  dtv->counter_max_mac_addrs_src = StatsRegisterMaxCounter("decoder.max_mac_addrs_src", tv);
525  dtv->counter_max_mac_addrs_dst = StatsRegisterMaxCounter("decoder.max_mac_addrs_dst", tv);
526  dtv->counter_erspan = StatsRegisterMaxCounter("decoder.erspan", tv);
527  dtv->counter_nsh = StatsRegisterMaxCounter("decoder.nsh", tv);
528  dtv->counter_flow_memcap = StatsRegisterCounter("flow.memcap", tv);
529 
532  dtv->counter_flow_icmp4 = StatsRegisterCounter("flow.icmpv4", tv);
533  dtv->counter_flow_icmp6 = StatsRegisterCounter("flow.icmpv6", tv);
534  dtv->counter_flow_tcp_reuse = StatsRegisterCounter("flow.tcp_reuse", tv);
535  dtv->counter_flow_get_used = StatsRegisterCounter("flow.get_used", tv);
536  dtv->counter_flow_get_used_eval = StatsRegisterCounter("flow.get_used_eval", tv);
537  dtv->counter_flow_get_used_eval_reject = StatsRegisterCounter("flow.get_used_eval_reject", tv);
538  dtv->counter_flow_get_used_eval_busy = StatsRegisterCounter("flow.get_used_eval_busy", tv);
539  dtv->counter_flow_get_used_failed = StatsRegisterCounter("flow.get_used_failed", tv);
540 
541  dtv->counter_flow_spare_sync_avg = StatsRegisterAvgCounter("flow.wrk.spare_sync_avg", tv);
542  dtv->counter_flow_spare_sync = StatsRegisterCounter("flow.wrk.spare_sync", tv);
543  dtv->counter_flow_spare_sync_incomplete = StatsRegisterCounter("flow.wrk.spare_sync_incomplete", tv);
544  dtv->counter_flow_spare_sync_empty = StatsRegisterCounter("flow.wrk.spare_sync_empty", tv);
545 
547  StatsRegisterCounter("defrag.ipv4.fragments", tv);
549  StatsRegisterCounter("defrag.ipv4.reassembled", tv);
551  StatsRegisterCounter("defrag.ipv4.timeouts", tv);
553  StatsRegisterCounter("defrag.ipv6.fragments", tv);
555  StatsRegisterCounter("defrag.ipv6.reassembled", tv);
557  StatsRegisterCounter("defrag.ipv6.timeouts", tv);
559  StatsRegisterCounter("defrag.max_frag_hits", tv);
560 
561  for (int i = 0; i < DECODE_EVENT_MAX; i++) {
562  BUG_ON(i != (int)DEvents[i].code);
563 
565  continue;
567  continue;
568 
569  if (i < DECODE_EVENT_PACKET_MAX &&
570  strncmp(DEvents[i].event_name, "decoder.", 8) == 0)
571  {
572  SCMutexLock(&g_counter_table_mutex);
573  if (g_counter_table == NULL) {
574  g_counter_table = HashTableInit(256, StringHashFunc,
577  if (g_counter_table == NULL) {
578  FatalError(SC_ERR_INITIALIZATION, "decoder counter hash "
579  "table init failed");
580  }
581  }
582 
583  char name[256];
584  char *dot = strchr(DEvents[i].event_name, '.');
585  BUG_ON(!dot);
586  snprintf(name, sizeof(name), "%s.%s",
588 
589  const char *found = HashTableLookup(g_counter_table, name, 0);
590  if (!found) {
591  char *add = SCStrdup(name);
592  if (add == NULL)
593  FatalError(SC_ERR_INITIALIZATION, "decoder counter hash "
594  "table name init failed");
595  int r = HashTableAdd(g_counter_table, add, 0);
596  if (r != 0)
597  FatalError(SC_ERR_INITIALIZATION, "decoder counter hash "
598  "table name add failed");
599  found = add;
600  }
602  found, tv);
603 
604  SCMutexUnlock(&g_counter_table_mutex);
605  } else {
607  DEvents[i].event_name, tv);
608  }
609  }
610 
611  return;
612 }
613 
615  const DecodeThreadVars *dtv, const Packet *p)
616 {
618  //StatsIncr(tv, dtv->counter_pkts_per_sec);
622 }
623 
624 /**
625  * \brief Debug print function for printing addresses
626  *
627  * \param Address object
628  *
629  * \todo IPv6
630  */
632 {
633  if (a == NULL)
634  return;
635 
636  switch (a->family) {
637  case AF_INET:
638  {
639  char s[16];
640  PrintInet(AF_INET, (const void *)&a->addr_data32[0], s, sizeof(s));
641  SCLogDebug("%s", s);
642  break;
643  }
644  }
645 }
646 
647 /** \brief Alloc and setup DecodeThreadVars */
649 {
650  DecodeThreadVars *dtv = NULL;
651 
652  if ( (dtv = SCMalloc(sizeof(DecodeThreadVars))) == NULL)
653  return NULL;
654  memset(dtv, 0, sizeof(DecodeThreadVars));
655 
657 
659  SCLogError(SC_ERR_THREAD_INIT, "initializing flow log API for thread failed");
661  return NULL;
662  }
663 
664  return dtv;
665 }
666 
668 {
669  if (dtv != NULL) {
670  if (dtv->app_tctx != NULL)
672 
673  if (dtv->output_flow_thread_data != NULL)
675 
676  SCFree(dtv);
677  }
678 }
679 
680 /**
681  * \brief Set data for Packet and set length when zero copy is used
682  *
683  * \param Pointer to the Packet to modify
684  * \param Pointer to the data
685  * \param Length of the data
686  */
687 inline int PacketSetData(Packet *p, const uint8_t *pktdata, uint32_t pktlen)
688 {
689  SET_PKT_LEN(p, (size_t)pktlen);
690  if (unlikely(!pktdata)) {
691  return -1;
692  }
693  // ext_pkt cannot be const (because we sometimes copy)
694  p->ext_pkt = (uint8_t *) pktdata;
695  p->flags |= PKT_ZERO_COPY;
696 
697  return 0;
698 }
699 
700 const char *PktSrcToString(enum PktSrcEnum pkt_src)
701 {
702  const char *pkt_src_str = "<unknown>";
703  switch (pkt_src) {
704  case PKT_SRC_WIRE:
705  pkt_src_str = "wire/pcap";
706  break;
707  case PKT_SRC_DECODER_GRE:
708  pkt_src_str = "gre tunnel";
709  break;
711  pkt_src_str = "ipv4 tunnel";
712  break;
714  pkt_src_str = "ipv6 tunnel";
715  break;
717  pkt_src_str = "teredo tunnel";
718  break;
719  case PKT_SRC_DEFRAG:
720  pkt_src_str = "defrag";
721  break;
723  pkt_src_str = "stream (detect/log)";
724  break;
725  case PKT_SRC_FFR:
726  pkt_src_str = "stream (flow timeout)";
727  break;
729  pkt_src_str = "geneve encapsulation";
730  break;
732  pkt_src_str = "vxlan encapsulation";
733  break;
735  pkt_src_str = "detect reload flush";
736  break;
738  pkt_src_str = "capture timeout flush";
739  break;
740  }
741  return pkt_src_str;
742 }
743 
745 {
748  } else if (unlikely(PACKET_TEST_ACTION(p, ACTION_DROP))) {
750  } else if (unlikely(p->flags & PKT_STREAM_MODIFIED)) {
752  } else {
754  }
755 }
756 
758 {
759  s->counter_ips_accepted = StatsRegisterCounter("ips.accepted", tv);
760  s->counter_ips_blocked = StatsRegisterCounter("ips.blocked", tv);
761  s->counter_ips_rejected = StatsRegisterCounter("ips.rejected", tv);
762  s->counter_ips_replaced = StatsRegisterCounter("ips.replaced", tv);
763 }
764 
766 {
771  intmax_t value = 0;
772  if (ConfGetInt("decoder.max-layers", &value) == 1) {
773  if (value < 0 || value > UINT8_MAX) {
774  SCLogWarning(SC_ERR_INVALID_VALUE, "Invalid value for decoder.max-layers");
775  } else {
776  decoder_max_layers = value;
777  }
778  }
779 }
780 
781 /**
782  * @}
783  */
DecodeThreadVars_::counter_flow_get_used_eval_busy
uint16_t counter_flow_get_used_eval_busy
Definition: decode.h:701
tm-threads.h
ConfGetInt
int ConfGetInt(const char *name, intmax_t *val)
Retrieve a configuration value as an integer.
Definition: conf.c:436
DecodeThreadVars_::counter_defrag_ipv4_reassembled
uint16_t counter_defrag_ipv4_reassembled
Definition: decode.h:684
util-hash-string.h
DecodeThreadVars_::counter_flow_udp
uint16_t counter_flow_udp
Definition: decode.h:694
len
uint8_t len
Definition: app-layer-dnp3.h:2
DecodeThreadVars_::counter_bytes
uint16_t counter_bytes
Definition: decode.h:645
DECODE_TUNNEL_IPV6
@ DECODE_TUNNEL_IPV6
Definition: decode.h:923
CaptureStats_::counter_ips_blocked
uint16_t counter_ips_blocked
Definition: decode.h:720
DecodeThreadVars_::counter_eth
uint16_t counter_eth
Definition: decode.h:653
StatsIncr
void StatsIncr(ThreadVars *tv, uint16_t id)
Increments the local counter.
Definition: counters.c:169
offset
uint64_t offset
Definition: util-streaming-buffer.h:0
DecodeERSPAN
int DecodeERSPAN(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, const uint8_t *pkt, uint32_t len)
ERSPAN Type II.
Definition: decode-erspan.c:75
PacketFreeOrRelease
void PacketFreeOrRelease(Packet *p)
Return a packet to where it was allocated.
Definition: decode.c:171
SC_ERR_INVALID_VALUE
@ SC_ERR_INVALID_VALUE
Definition: util-error.h:160
DecodeThreadVars_::counter_flow_icmp4
uint16_t counter_flow_icmp4
Definition: decode.h:695
DecodeThreadVars_::counter_vxlan
uint16_t counter_vxlan
Definition: decode.h:672
DecodeThreadVars_::counter_max_pkt_size
uint16_t counter_max_pkt_size
Definition: decode.h:647
DecodePPP
int DecodePPP(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, const uint8_t *pkt, uint32_t len)
Definition: decode-ppp.c:43
PacketCopyData
int PacketCopyData(Packet *p, const uint8_t *pktdata, uint32_t pktlen)
Copy data to Packet payload and set packet length.
Definition: decode.c:269
Packet_::vlan_id
uint16_t vlan_id[2]
Definition: decode.h:442
PacketBypassCallback
void PacketBypassCallback(Packet *p)
Definition: decode.c:415
PKT_IS_PSEUDOPKT
#define PKT_IS_PSEUDOPKT(p)
return 1 if the packet is a pseudo packet
Definition: decode.h:1164
DecodeThreadVars_::counter_avg_pkt_size
uint16_t counter_avg_pkt_size
Definition: decode.h:646
DecodeERSPANConfig
void DecodeERSPANConfig(void)
Functions to decode ERSPAN Type I and II packets.
Definition: decode-erspan.c:51
PacketPoolReturnPacket
void PacketPoolReturnPacket(Packet *p)
Return packet to Packet pool.
Definition: tmqh-packetpool.c:225
FlowBypassInfo_
Definition: flow.h:523
unlikely
#define unlikely(expr)
Definition: util-optimize.h:35
DecodeNSH
int DecodeNSH(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, const uint8_t *pkt, uint32_t len)
Function to decode NSH packets.
Definition: decode-nsh.c:45
ACTION_REJECT
#define ACTION_REJECT
Definition: action-globals.h:31
DecodeTeredoConfig
void DecodeTeredoConfig(void)
Definition: decode-teredo.c:101
PacketEngineEvents_::events
uint8_t events[PACKET_ENGINE_EVENT_MAX]
Definition: decode.h:314
CaptureStats_
Definition: decode.h:717
PKT_STREAM_MODIFIED
#define PKT_STREAM_MODIFIED
Definition: decode.h:1128
DECODE_TUNNEL_IPV6_TEREDO
@ DECODE_TUNNEL_IPV6_TEREDO
Definition: decode.h:924
SCLogDebug
#define SCLogDebug(...)
Definition: util-debug.h:298
AddressDebugPrint
void AddressDebugPrint(Address *a)
Debug print function for printing addresses.
Definition: decode.c:631
PKT_SRC_DECODER_IPV4
@ PKT_SRC_DECODER_IPV4
Definition: decode.h:53
DecodeThreadVars_::counter_flow_spare_sync_avg
uint16_t counter_flow_spare_sync_avg
Definition: decode.h:707
PacketDefragPktSetup
Packet * PacketDefragPktSetup(Packet *parent, const uint8_t *pkt, uint32_t len, uint8_t proto)
Setup a pseudo packet (reassembled frags)
Definition: decode.c:359
stats_stream_events
bool stats_stream_events
Definition: counters.c:106
PKT_ZERO_COPY
#define PKT_ZERO_COPY
Definition: decode.h:1136
PKT_SRC_CAPTURE_TIMEOUT
@ PKT_SRC_CAPTURE_TIMEOUT
Definition: decode.h:61
Packet_::flags
uint32_t flags
Definition: decode.h:450
Packet_::vlan_idx
uint8_t vlan_idx
Definition: decode.h:443
DecodeThreadVars_::counter_flow_get_used_eval
uint16_t counter_flow_get_used_eval
Definition: decode.h:699
StatsSetUI64
void StatsSetUI64(ThreadVars *tv, uint16_t id, uint64_t x)
Sets a value of type double to the local counter.
Definition: counters.c:191
DECODE_TUNNEL_ERSPANI
@ DECODE_TUNNEL_ERSPANI
Definition: decode.h:920
DecodeThreadVars_::counter_teredo
uint16_t counter_teredo
Definition: decode.h:675
DecodeThreadVars_::counter_erspan
uint16_t counter_erspan
Definition: decode.h:679
PacketCopyDataOffset
int PacketCopyDataOffset(Packet *p, uint32_t offset, const uint8_t *data, uint32_t datalen)
Copy data to Packet payload at given offset.
Definition: decode.c:227
DecodeThreadVars_::counter_raw
uint16_t counter_raw
Definition: decode.h:663
SCMutexLock
#define SCMutexLock(mut)
Definition: threads-debug.h:117
FLOW_PKT_TOSERVER
#define FLOW_PKT_TOSERVER
Definition: flow.h:219
HashTable_
Definition: util-hash.h:35
PACKET_INITIALIZE
#define PACKET_INITIALIZE(p)
Initialize a packet structure for use.
Definition: decode.h:754
Address_
Definition: decode.h:118
DecodeThreadVars_::counter_flow_tcp
uint16_t counter_flow_tcp
Definition: decode.h:693
SCMUTEX_INITIALIZER
#define SCMUTEX_INITIALIZER
Definition: threads-debug.h:121
PacketDecodeFinalize
void PacketDecodeFinalize(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p)
Finalize decoding of a packet.
Definition: decode.c:124
proto
uint8_t proto
Definition: decode-template.h:0
decoder_max_layers
uint8_t decoder_max_layers
Definition: decode.c:75
SET_TUNNEL_PKT
#define SET_TUNNEL_PKT(p)
Definition: decode.h:910
Packet_::flowflags
uint8_t flowflags
Definition: decode.h:446
StringHashCompareFunc
char StringHashCompareFunc(void *data1, uint16_t datalen1, void *data2, uint16_t datalen2)
Definition: util-hash-string.c:35
Packet_::BypassPacketsFlow
int(* BypassPacketsFlow)(struct Packet_ *)
Definition: decode.h:497
TmqhOutputPacketpool
void TmqhOutputPacketpool(ThreadVars *t, Packet *p)
Definition: tmqh-packetpool.c:375
DecodeVXLANConfig
void DecodeVXLANConfig(void)
Definition: decode-vxlan.c:101
DecodeThreadVars_::counter_max_mac_addrs_src
uint16_t counter_max_mac_addrs_src
Definition: decode.h:648
DecodeUnregisterCounters
void DecodeUnregisterCounters(void)
Definition: decode.c:481
GET_PKT_DIRECT_MAX_SIZE
#define GET_PKT_DIRECT_MAX_SIZE(p)
Definition: decode.h:234
DecodeThreadVars_::counter_flow_get_used
uint16_t counter_flow_get_used
Definition: decode.h:698
tmqh-packetpool.h
StringHashFunc
uint32_t StringHashFunc(HashTable *ht, void *data, uint16_t datalen)
Definition: util-hash-string.c:22
Packet_::events
PacketEngineEvents events
Definition: decode.h:577
PKT_ALLOC
#define PKT_ALLOC
Definition: decode.h:1121
TM_ECODE_OK
@ TM_ECODE_OK
Definition: tm-threads-common.h:80
HashTableFree
void HashTableFree(HashTable *ht)
Definition: util-hash.c:79
DecodeThreadVars_::counter_flow_spare_sync_empty
uint16_t counter_flow_spare_sync_empty
Definition: decode.h:705
Flow_::flow_state
FlowStateType flow_state
Definition: flow.h:416
DecodeThreadVars_::counter_flow_tcp_reuse
uint16_t counter_flow_tcp_reuse
Definition: decode.h:697
DECODE_TUNNEL_NSH
@ DECODE_TUNNEL_NSH
Definition: decode.h:926
Packet_::datalink
int datalink
Definition: decode.h:586
PKT_DEFAULT_MAX_DECODED_LAYERS
#define PKT_DEFAULT_MAX_DECODED_LAYERS
Definition: decode.h:1169
stats_decoder_events_prefix
const char * stats_decoder_events_prefix
Definition: counters.c:104
ACTION_REJECT_DST
#define ACTION_REJECT_DST
Definition: action-globals.h:32
SC_ERR_THREAD_INIT
@ SC_ERR_THREAD_INIT
Definition: util-error.h:79
DecodeRegisterPerfCounters
void DecodeRegisterPerfCounters(DecodeThreadVars *dtv, ThreadVars *tv)
Definition: decode.c:491
DecodeThreadVars_::counter_flow_spare_sync
uint16_t counter_flow_spare_sync
Definition: decode.h:704
DECODE_TUNNEL_ERSPANII
@ DECODE_TUNNEL_ERSPANII
Definition: decode.h:919
SET_PKT_LEN
#define SET_PKT_LEN(p, len)
Definition: decode.h:236
DecodeThreadVars_::counter_ipv6inipv6
uint16_t counter_ipv6inipv6
Definition: decode.h:678
app-layer-detect-proto.h
StatsRegisterMaxCounter
uint16_t StatsRegisterMaxCounter(const char *name, struct ThreadVars_ *tv)
Registers a counter, whose value holds the maximum of all the values assigned to it.
Definition: counters.c:979
FLOW_STATE_LOCAL_BYPASSED
@ FLOW_STATE_LOCAL_BYPASSED
Definition: flow.h:506
decode.h
util-debug.h
DecodeThreadVars_::counter_flow_get_used_failed
uint16_t counter_flow_get_used_failed
Definition: decode.h:702
PKT_SRC_WIRE
@ PKT_SRC_WIRE
Definition: decode.h:51
CaptureStats_::counter_ips_rejected
uint16_t counter_ips_rejected
Definition: decode.h:721
util-error.h
PKT_IS_TOSERVER
#define PKT_IS_TOSERVER(p)
Definition: decode.h:264
DecodeThreadVars_::counter_icmpv4
uint16_t counter_icmpv4
Definition: decode.h:659
DecodeThreadVars_::counter_ppp
uint16_t counter_ppp
Definition: decode.h:667
DecodeERSPANTypeI
int DecodeERSPANTypeI(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, const uint8_t *pkt, uint32_t len)
ERSPAN Type I.
Definition: decode-erspan.c:64
DEvents
const struct DecodeEvents_ DEvents[]
Definition: decode-events.c:29
OutputFlowLogThreadInit
TmEcode OutputFlowLogThreadInit(ThreadVars *tv, void *initdata, void **data)
thread init for the flow logger This will run the thread init functions for the individual registered...
Definition: output-flow.c:131
SCMutexUnlock
#define SCMutexUnlock(mut)
Definition: threads-debug.h:119
PacketSwap
void PacketSwap(Packet *p)
switch direction of a packet
Definition: decode.c:456
DecodeSetNoPayloadInspectionFlag
#define DecodeSetNoPayloadInspectionFlag(p)
Set the No payload inspection Flag for the packet.
Definition: decode.h:1000
PktSrcEnum
PktSrcEnum
Definition: decode.h:50
DecodeTunnelProto
DecodeTunnelProto
Definition: decode.h:917
util-print.h
CaptureStatsSetup
void CaptureStatsSetup(ThreadVars *tv, CaptureStats *s)
Definition: decode.c:757
PKT_SRC_DECODER_TEREDO
@ PKT_SRC_DECODER_TEREDO
Definition: decode.h:55
AppLayerGetCtxThread
AppLayerThreadCtx * AppLayerGetCtxThread(ThreadVars *tv)
Creates a new app layer thread context.
Definition: app-layer.c:866
SCEnter
#define SCEnter(...)
Definition: util-debug.h:300
GET_PKT_DATA
#define GET_PKT_DATA(p)
Definition: decode.h:232
HashTableLookup
void * HashTableLookup(HashTable *ht, void *data, uint16_t datalen)
Definition: util-hash.c:193
UNSET_TUNNEL_PKT
#define UNSET_TUNNEL_PKT(p)
Definition: decode.h:911
ThreadVars_
Per thread variable structure.
Definition: threadvars.h:58
PrintInet
const char * PrintInet(int af, const void *src, char *dst, socklen_t size)
Definition: util-print.c:271
pkt-var.h
DECODE_TUNNEL_PPP
@ DECODE_TUNNEL_PPP
Definition: decode.h:925
FLOW_PKT_TOCLIENT_FIRST
#define FLOW_PKT_TOCLIENT_FIRST
Definition: flow.h:225
PacketFree
void PacketFree(Packet *p)
Return a malloced packet.
Definition: decode.c:111
PktSrcToString
const char * PktSrcToString(enum PktSrcEnum pkt_src)
Definition: decode.c:700
DecodeThreadVars_::counter_vlan_qinq
uint16_t counter_vlan_qinq
Definition: decode.h:671
HashTableAdd
int HashTableAdd(HashTable *ht, void *data, uint16_t datalen)
Definition: util-hash.c:113
SIZE_OF_PACKET
#define SIZE_OF_PACKET
Definition: decode.h:635
StringHashFreeFunc
void StringHashFreeFunc(void *data)
Definition: util-hash-string.c:48
BUG_ON
#define BUG_ON(x)
Definition: suricata-common.h:277
DecodeThreadVars_::counter_defrag_ipv6_timeouts
uint16_t counter_defrag_ipv6_timeouts
Definition: decode.h:688
util-profiling.h
PacketCallocExtPkt
int PacketCallocExtPkt(Packet *p, int datalen)
Definition: decode.c:201
PKT_SRC_STREAM_TCP_DETECTLOG_FLUSH
@ PKT_SRC_STREAM_TCP_DETECTLOG_FLUSH
Definition: decode.h:58
DECODE_TUNNEL_VLAN
@ DECODE_TUNNEL_VLAN
Definition: decode.h:921
PKT_SRC_DECODER_IPV6
@ PKT_SRC_DECODER_IPV6
Definition: decode.h:54
CaptureStats_::counter_ips_accepted
uint16_t counter_ips_accepted
Definition: decode.h:719
DECODE_EVENT_MAX
@ DECODE_EVENT_MAX
Definition: decode-events.h:285
Packet_
Definition: decode.h:415
DecodeThreadVars_::counter_nsh
uint16_t counter_nsh
Definition: decode.h:680
DecodeIPV6
int DecodeIPV6(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, const uint8_t *pkt, uint16_t len)
Definition: decode-ipv6.c:564
DECODE_TUNNEL_IPV4
@ DECODE_TUNNEL_IPV4
Definition: decode.h:922
GET_PKT_LEN
#define GET_PKT_LEN(p)
Definition: decode.h:231
DecodeThreadVars_::app_tctx
AppLayerThreadCtx * app_tctx
Definition: decode.h:641
DecodeThreadVars_::counter_defrag_ipv4_timeouts
uint16_t counter_defrag_ipv4_timeouts
Definition: decode.h:685
decode-teredo.h
conf.h
DecodeThreadVars_::counter_sll
uint16_t counter_sll
Definition: decode.h:662
DecodeThreadVars_::counter_sctp
uint16_t counter_sctp
Definition: decode.h:665
Packet_::livedev
struct LiveDevice_ * livedev
Definition: decode.h:565
DecodeThreadVars_::counter_invalid
uint16_t counter_invalid
Definition: decode.h:651
DecodeThreadVars_::counter_ieee8021ah
uint16_t counter_ieee8021ah
Definition: decode.h:673
SCReturnPtr
#define SCReturnPtr(x, type)
Definition: util-debug.h:316
output-flow.h
DecodeThreadVars_::counter_ipv4inipv6
uint16_t counter_ipv4inipv6
Definition: decode.h:677
util-mpm-ac.h
FLOW_PKT_TOCLIENT
#define FLOW_PKT_TOCLIENT
Definition: flow.h:220
FlowSetStorageById
int FlowSetStorageById(Flow *f, int id, void *ptr)
Definition: flow-storage.c:44
DecodeThreadVars_::counter_vlan
uint16_t counter_vlan
Definition: decode.h:670
DECODE_TUNNEL_ETHERNET
@ DECODE_TUNNEL_ETHERNET
Definition: decode.h:918
DecodeThreadVars_::counter_tcp
uint16_t counter_tcp
Definition: decode.h:657
DecodeThreadVars_::counter_pkts
uint16_t counter_pkts
Definition: decode.h:644
FlowUpdateState
void FlowUpdateState(Flow *f, const enum FlowState s)
Definition: flow.c:1135
dtv
DecodeThreadVars * dtv
Definition: fuzz_decodepcapfile.c:30
default_packet_size
uint32_t default_packet_size
Definition: decode.c:71
PKT_SRC_DECODER_GENEVE
@ PKT_SRC_DECODER_GENEVE
Definition: decode.h:62
ACTION_REJECT_BOTH
#define ACTION_REJECT_BOTH
Definition: action-globals.h:33
util-mem.h
DecodeThreadVars_::counter_chdlc
uint16_t counter_chdlc
Definition: decode.h:654
Packet_::ReleasePacket
void(* ReleasePacket)(struct Packet_ *)
Definition: decode.h:494
flow-storage.h
Packet_::flow
struct Flow_ * flow
Definition: decode.h:452
Packet_::tenant_id
uint32_t tenant_id
Definition: decode.h:606
DecodeThreadVarsFree
void DecodeThreadVarsFree(ThreadVars *tv, DecodeThreadVars *dtv)
Definition: decode.c:667
DecodeThreadVars_::counter_flow_spare_sync_incomplete
uint16_t counter_flow_spare_sync_incomplete
Definition: decode.h:706
Packet_::ts
struct timeval ts
Definition: decode.h:458
DecodeGlobalConfig
void DecodeGlobalConfig(void)
Definition: decode.c:765
suricata-common.h
PKT_SRC_FFR
@ PKT_SRC_FFR
Definition: decode.h:57
DecodeThreadVars_::counter_flow_icmp6
uint16_t counter_flow_icmp6
Definition: decode.h:696
DecodeThreadVars_::counter_ipv6
uint16_t counter_ipv6
Definition: decode.h:656
CaptureStats_::counter_ips_replaced
uint16_t counter_ips_replaced
Definition: decode.h:722
DecodeThreadVars_::counter_gre
uint16_t counter_gre
Definition: decode.h:669
ACTION_DROP
#define ACTION_DROP
Definition: action-globals.h:30
DecodeThreadVars_::counter_esp
uint16_t counter_esp
Definition: decode.h:666
Packet_::ext_pkt
uint8_t * ext_pkt
Definition: decode.h:562
SCLogError
#define SCLogError(err_code,...)
Macro used to log ERROR messages.
Definition: util-debug.h:257
DecodeThreadVars_::counter_defrag_ipv6_reassembled
uint16_t counter_defrag_ipv6_reassembled
Definition: decode.h:687
DecodeThreadVars_::counter_udp
uint16_t counter_udp
Definition: decode.h:658
PacketUpdateEngineEventCounters
void PacketUpdateEngineEventCounters(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p)
Definition: decode.c:131
SCStrdup
#define SCStrdup(s)
Definition: util-mem.h:56
FatalError
#define FatalError(x,...)
Definition: util-debug.h:532
CaptureStatsUpdate
void CaptureStatsUpdate(ThreadVars *tv, CaptureStats *s, const Packet *p)
Definition: decode.c:744
PKT_SRC_DEFRAG
@ PKT_SRC_DEFRAG
Definition: decode.h:56
tv
ThreadVars * tv
Definition: fuzz_decodepcapfile.c:29
DecodeThreadVars_::counter_ipv4
uint16_t counter_ipv4
Definition: decode.h:655
PACKET_PROFILING_START
#define PACKET_PROFILING_START(p)
Definition: util-profiling.h:92
PacketGetFromAlloc
Packet * PacketGetFromAlloc(void)
Get a malloced packet.
Definition: decode.c:150
PKT_SRC_DECODER_VXLAN
@ PKT_SRC_DECODER_VXLAN
Definition: decode.h:59
StatsAddUI64
void StatsAddUI64(ThreadVars *tv, uint16_t id, uint64_t x)
Adds a value of type uint64_t to the local counter.
Definition: counters.c:148
SCMalloc
#define SCMalloc(sz)
Definition: util-mem.h:47
Packet_::root
struct Packet_ * root
Definition: decode.h:589
DecodeThreadVars_::counter_pppoe
uint16_t counter_pppoe
Definition: decode.h:674
DecodeThreadVars_::counter_mpls
uint16_t counter_mpls
Definition: decode.h:676
OutputFlowLogThreadDeinit
TmEcode OutputFlowLogThreadDeinit(ThreadVars *tv, void *thread_data)
Definition: output-flow.c:173
SCLogWarning
#define SCLogWarning(err_code,...)
Macro used to log WARNING messages.
Definition: util-debug.h:244
PKT_SRC_DETECT_RELOAD_FLUSH
@ PKT_SRC_DETECT_RELOAD_FLUSH
Definition: decode.h:60
SCFree
#define SCFree(p)
Definition: util-mem.h:61
DecodeThreadVars_
Structure to hold thread specific data for all decode modules.
Definition: decode.h:639
MAX_PAYLOAD_SIZE
#define MAX_PAYLOAD_SIZE
Definition: decode.h:633
AppLayerDestroyCtxThread
void AppLayerDestroyCtxThread(AppLayerThreadCtx *app_tctx)
Destroys the context created by AppLayeGetCtxThread().
Definition: app-layer.c:888
Packet_::recursion_level
uint8_t recursion_level
Definition: decode.h:440
DecodeThreadVars_::output_flow_thread_data
void * output_flow_thread_data
Definition: decode.h:713
DecodeThreadVars_::counter_geneve
uint16_t counter_geneve
Definition: decode.h:668
DecodeThreadVars_::counter_max_mac_addrs_dst
uint16_t counter_max_mac_addrs_dst
Definition: decode.h:649
DecodeThreadVarsAlloc
DecodeThreadVars * DecodeThreadVarsAlloc(ThreadVars *tv)
Alloc and setup DecodeThreadVars.
Definition: decode.c:648
DecodeThreadVars_::counter_defrag_max_hit
uint16_t counter_defrag_max_hit
Definition: decode.h:689
HashTableInit
HashTable * HashTableInit(uint32_t size, uint32_t(*Hash)(struct HashTable_ *, void *, uint16_t), char(*Compare)(void *, uint16_t, void *, uint16_t), void(*Free)(void *))
Definition: util-hash.c:34
PacketSetData
int PacketSetData(Packet *p, const uint8_t *pktdata, uint32_t pktlen)
Set data for Packet and set length when zero copy is used.
Definition: decode.c:687
PacketPoolGetPacket
Packet * PacketPoolGetPacket(void)
Get a new packet from the packet pool.
Definition: tmqh-packetpool.c:185
GET_PKT_DIRECT_DATA
#define GET_PKT_DIRECT_DATA(p)
Definition: decode.h:233
TUNNEL_INCR_PKT_TPR
#define TUNNEL_INCR_PKT_TPR(p)
Definition: decode.h:900
DecodeThreadVars_::counter_null
uint16_t counter_null
Definition: decode.h:664
DecodeThreadVars_::counter_icmpv6
uint16_t counter_icmpv6
Definition: decode.h:660
suricata.h
Address_::family
char family
Definition: decode.h:119
PKT_SRC_DECODER_GRE
@ PKT_SRC_DECODER_GRE
Definition: decode.h:52
DecodeGeneveConfig
void DecodeGeneveConfig(void)
Definition: decode-geneve.c:127
DecodeThreadVars_::counter_flow_memcap
uint16_t counter_flow_memcap
Definition: decode.h:691
DecodeThreadVars_::counter_defrag_ipv6_fragments
uint16_t counter_defrag_ipv6_fragments
Definition: decode.h:686
StatsRegisterAvgCounter
uint16_t StatsRegisterAvgCounter(const char *name, struct ThreadVars_ *tv)
Registers a counter, whose value holds the average of all the values assigned to it.
Definition: counters.c:959
SC_ERR_INITIALIZATION
@ SC_ERR_INITIALIZATION
Definition: util-error.h:75
PacketDefragPktSetupParent
void PacketDefragPktSetupParent(Packet *parent)
inform defrag "parent" that a pseudo packet is now associated to it.
Definition: decode.c:398
PacketTunnelPktSetup
Packet * PacketTunnelPktSetup(ThreadVars *tv, DecodeThreadVars *dtv, Packet *parent, const uint8_t *pkt, uint32_t len, enum DecodeTunnelProto proto)
Setup a pseudo packet (tunnel)
Definition: decode.c:285
stats_decoder_events
bool stats_decoder_events
Definition: counters.c:103
DecodeIPV4
int DecodeIPV4(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, const uint8_t *pkt, uint16_t len)
Definition: decode-ipv4.c:517
GetFlowBypassInfoID
int GetFlowBypassInfoID(void)
Definition: flow-util.c:220
StatsRegisterCounter
uint16_t StatsRegisterCounter(const char *name, struct ThreadVars_ *tv)
Registers a normal, unqualified counter.
Definition: counters.c:939
SCCalloc
#define SCCalloc(nm, sz)
Definition: util-mem.h:53
DecodeThreadVars_::counter_flow_get_used_eval_reject
uint16_t counter_flow_get_used_eval_reject
Definition: decode.h:700
DecodeVLAN
int DecodeVLAN(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, const uint8_t *pkt, uint32_t len)
Definition: decode-vlan.c:59
code
uint8_t code
Definition: decode-icmpv4.h:1
FLOW_PKT_TOSERVER_FIRST
#define FLOW_PKT_TOSERVER_FIRST
Definition: flow.h:224
SCMutex
#define SCMutex
Definition: threads-debug.h:114
PacketGetFromQueueOrAlloc
Packet * PacketGetFromQueueOrAlloc(void)
Get a packet. We try to get a packet from the packetpool first, but if that is empty we alloc a packe...
Definition: decode.c:186
DecodeEthernet
int DecodeEthernet(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, const uint8_t *pkt, uint32_t len)
Definition: decode-ethernet.c:41
PACKET_DESTRUCTOR
#define PACKET_DESTRUCTOR(p)
Cleanup a packet so that we can free it. No memset needed..
Definition: decode.h:850
WARN_UNUSED
#define WARN_UNUSED
Definition: suricata-common.h:384
PKT_IS_INVALID
#define PKT_IS_INVALID
Definition: decode.h:1142
DecodeUpdatePacketCounters
void DecodeUpdatePacketCounters(ThreadVars *tv, const DecodeThreadVars *dtv, const Packet *p)
Definition: decode.c:614
DecodeThreadVars_::counter_engine_events
uint16_t counter_engine_events[DECODE_EVENT_MAX]
Definition: decode.h:709
output.h
DECODE_EVENT_PACKET_MAX
@ DECODE_EVENT_PACKET_MAX
Definition: decode-events.h:218
PACKET_TEST_ACTION
#define PACKET_TEST_ACTION(p, a)
Definition: decode.h:885
app-layer.h
DecodeThreadVars_::counter_defrag_ipv4_fragments
uint16_t counter_defrag_ipv4_fragments
Definition: decode.h:683
PacketEngineEvents_::cnt
uint8_t cnt
Definition: decode.h:313