suricata
respond-reject-libnet11.c
Go to the documentation of this file.
1 /* Copyright (C) 2007-2020 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 Victor Julien <victor@inliniac.net>
22  * \author William Metcalf <william.metcalf@gmail.com>
23  *
24  * RespondRejectLibnet11 used to send out libnet based
25  * TCP resets and ICMP unreachables.
26  *
27  * \todo calculate TTL base on average from stream tracking
28  * \todo come up with a way for users to specify icmp unreachable type
29  * \todo Possibly default to port unreachable for UDP traffic this seems
30  * to be the default in flexresp and iptables
31  * \todo implement ipv6 resets
32  * \todo implement pre-alloc resets for speed
33  */
34 
35 #include "suricata-common.h"
36 #include "suricata.h"
37 
38 #include "decode.h"
39 #include "decode-ipv4.h"
40 #include "decode-tcp.h"
41 #include "decode-sctp.h"
42 #include "decode-udp.h"
43 #include "packet-queue.h"
44 #include "threads.h"
45 #include "threadvars.h"
46 #include "tm-queuehandlers.h"
47 #include "tm-threads.h"
48 #include "action-globals.h"
49 #include "respond-reject.h"
51 #include "util-device.h"
52 
53 #ifdef HAVE_LIBNET11
54 
55 #ifndef HAVE_LIBNET_INIT_CONST
56 #define LIBNET_INIT_CAST (char *)
57 #else
58 #define LIBNET_INIT_CAST
59 #endif
60 
61 /* Globally configured device to use for sending resets in IDS mode. */
62 const char *g_reject_dev = NULL;
63 uint16_t g_reject_dev_mtu = 0;
64 
65 /** set to true in main if we're setting caps. We need it here if we're using
66  * reject rules as libnet 1.1 is not compatible with caps. */
67 extern int sc_set_caps;
68 
69 #include <libnet.h>
70 
71 thread_local libnet_t *t_c = NULL;
72 thread_local int t_inject_mode = -1;
73 
74 typedef struct Libnet11Packet_ {
75  uint32_t ack, seq;
76  uint16_t window, dsize;
77  uint8_t ttl;
78  uint16_t id;
79  uint32_t flow;
80  uint8_t class;
81  struct libnet_in6_addr src6, dst6;
82  uint32_t src4, dst4;
83  uint16_t sp, dp;
84  uint16_t len;
85  uint8_t *smac, *dmac;
86 } Libnet11Packet;
87 
88 static inline libnet_t *GetCtx(const Packet *p, int injection_type)
89 {
90  /* fast path: use cache ctx */
91  if (t_c)
92  return t_c;
93 
94  /* slow path: setup a new ctx */
95  bool store_ctx = false;
96  const char *devname = NULL;
97  extern uint8_t host_mode;
99  if (g_reject_dev != NULL) {
100  if (p->datalink == LINKTYPE_ETHERNET)
101  injection_type = t_inject_mode = LIBNET_LINK;
102  devname = g_reject_dev;
103  store_ctx = true;
104  } else {
105  devname = p->livedev ? p->livedev->dev : NULL;
106  }
107  }
108 
109  char ebuf[LIBNET_ERRBUF_SIZE];
110  libnet_t *c = libnet_init(injection_type, LIBNET_INIT_CAST devname, ebuf);
111  if (c == NULL) {
112  SCLogError("libnet_init failed: %s", ebuf);
113  }
114  if (store_ctx) {
115  t_c = c;
116  }
117  return c;
118 }
119 
120 static inline void ClearCtx(libnet_t *c)
121 {
122  if (t_c == c)
123  libnet_clear_packet(c);
124  else
125  libnet_destroy(c);
126 }
127 
128 void FreeCachedCtx(void)
129 {
130  if (t_c) {
131  libnet_destroy(t_c);
132  t_c = NULL;
133  }
134 }
135 
136 static inline void SetupTCP(Packet *p, Libnet11Packet *lpacket, enum RejectDirection dir)
137 {
138  switch (dir) {
139  case REJECT_DIR_SRC:
140  SCLogDebug("sending a tcp reset to src");
141  /* We follow http://tools.ietf.org/html/rfc793#section-3.4 :
142  * If packet has no ACK, the seq number is 0 and the ACK is built
143  * the normal way. If packet has a ACK, the seq of the RST packet
144  * is equal to the ACK of incoming packet and the ACK is build
145  * using packet sequence number and size of the data. */
146  if (TCP_GET_ACK(p) == 0) {
147  lpacket->seq = 0;
148  lpacket->ack = TCP_GET_SEQ(p) + lpacket->dsize + 1;
149  } else {
150  lpacket->seq = TCP_GET_ACK(p);
151  lpacket->ack = TCP_GET_SEQ(p) + lpacket->dsize;
152  }
153 
154  lpacket->sp = TCP_GET_DST_PORT(p);
155  lpacket->dp = TCP_GET_SRC_PORT(p);
156  break;
157  case REJECT_DIR_DST:
158  default:
159  SCLogDebug("sending a tcp reset to dst");
160  lpacket->seq = TCP_GET_SEQ(p);
161  lpacket->ack = TCP_GET_ACK(p);
162 
163  lpacket->sp = TCP_GET_SRC_PORT(p);
164  lpacket->dp = TCP_GET_DST_PORT(p);
165  break;
166  }
167  lpacket->window = TCP_GET_WINDOW(p);
168  //lpacket.seq += lpacket.dsize;
169 }
170 
171 static inline int BuildTCP(libnet_t *c, Libnet11Packet *lpacket)
172 {
173  /* build the package */
174  if ((libnet_build_tcp(
175  lpacket->sp, /* source port */
176  lpacket->dp, /* dst port */
177  lpacket->seq, /* seq number */
178  lpacket->ack, /* ack number */
179  TH_RST|TH_ACK, /* flags */
180  lpacket->window, /* window size */
181  0, /* checksum */
182  0, /* urgent flag */
183  LIBNET_TCP_H, /* header length */
184  NULL, /* payload */
185  0, /* payload length */
186  c, /* libnet context */
187  0)) < 0) /* libnet ptag */
188  {
189  SCLogError("libnet_build_tcp %s", libnet_geterror(c));
190  return -1;
191  }
192  return 0;
193 }
194 
195 static inline int BuildIPv4(libnet_t *c, Libnet11Packet *lpacket, const uint8_t proto)
196 {
197  if ((libnet_build_ipv4(
198  lpacket->len, /* entire packet length */
199  0, /* tos */
200  lpacket->id, /* ID */
201  0, /* fragmentation flags and offset */
202  lpacket->ttl, /* TTL */
203  proto, /* protocol */
204  0, /* checksum */
205  lpacket->src4, /* source address */
206  lpacket->dst4, /* destination address */
207  NULL, /* pointer to packet data (or NULL) */
208  0, /* payload length */
209  c, /* libnet context pointer */
210  0)) < 0) /* packet id */
211  {
212  SCLogError("libnet_build_ipv4 %s", libnet_geterror(c));
213  return -1;
214  }
215  return 0;
216 }
217 
218 static inline int BuildIPv6(libnet_t *c, Libnet11Packet *lpacket, const uint8_t proto)
219 {
220  if ((libnet_build_ipv6(
221  lpacket->class, /* traffic class */
222  lpacket->flow, /* Flow label */
223  lpacket->len, /* payload length */
224  proto, /* next header */
225  lpacket->ttl, /* TTL */
226  lpacket->src6, /* source address */
227  lpacket->dst6, /* destination address */
228  NULL, /* pointer to packet data (or NULL) */
229  0, /* payload length */
230  c, /* libnet context pointer */
231  0)) < 0) /* packet id */
232  {
233  SCLogError("libnet_build_ipv6 %s", libnet_geterror(c));
234  return -1;
235  }
236  return 0;
237 }
238 
239 static inline void SetupEthernet(Packet *p, Libnet11Packet *lpacket, enum RejectDirection dir)
240 {
241  switch (dir) {
242  case REJECT_DIR_SRC:
243  lpacket->smac = p->ethh->eth_dst;
244  lpacket->dmac = p->ethh->eth_src;
245  break;
246  case REJECT_DIR_DST:
247  default:
248  lpacket->smac = p->ethh->eth_src;
249  lpacket->dmac = p->ethh->eth_dst;
250  break;
251  }
252 }
253 
254 static inline int BuildEthernet(libnet_t *c, Libnet11Packet *lpacket, uint16_t proto)
255 {
256  if ((libnet_build_ethernet(lpacket->dmac,lpacket->smac, proto , NULL, 0, c, 0)) < 0) {
257  SCLogError("libnet_build_ethernet %s", libnet_geterror(c));
258  return -1;
259  }
260  return 0;
261 }
262 
263 static inline int BuildEthernetVLAN(libnet_t *c, Libnet11Packet *lpacket, uint16_t proto, uint16_t vlan_id)
264 {
265  if (libnet_build_802_1q(
266  lpacket->dmac, lpacket->smac, ETHERTYPE_VLAN,
267  0x000, 0x000, vlan_id, proto,
268  NULL, /* payload */
269  0, /* payload size */
270  c, /* libnet handle */
271  0) < 0)
272  {
273  SCLogError("libnet_build_802_1q %s", libnet_geterror(c));
274  return -1;
275  }
276  return 0;
277 }
278 
279 int RejectSendLibnet11IPv4TCP(ThreadVars *tv, Packet *p, void *data, enum RejectDirection dir)
280 {
281  Libnet11Packet lpacket;
282  int result;
283 
284  /* fill in struct defaults */
285  lpacket.ttl = 0;
286  lpacket.id = 0;
287  lpacket.flow = 0;
288  lpacket.class = 0;
289 
290  if (p->tcph == NULL)
291  return 1;
292 
293  libnet_t *c = GetCtx(p, LIBNET_RAW4);
294  if (c == NULL)
295  return 1;
296 
297  lpacket.len = LIBNET_IPV4_H + LIBNET_TCP_H;
298  lpacket.dsize = p->payload_len;
299 
300  switch (dir) {
301  case REJECT_DIR_SRC:
302  lpacket.src4 = GET_IPV4_DST_ADDR_U32(p);
303  lpacket.dst4 = GET_IPV4_SRC_ADDR_U32(p);
304  break;
305  case REJECT_DIR_DST:
306  default:
307  lpacket.src4 = GET_IPV4_SRC_ADDR_U32(p);
308  lpacket.dst4 = GET_IPV4_DST_ADDR_U32(p);
309  break;
310  }
311  /* TODO come up with ttl calc function */
312  lpacket.ttl = 64;
313 
314  SetupTCP(p, &lpacket, dir);
315 
316  if (BuildTCP(c, &lpacket) < 0)
317  goto cleanup;
318 
319  if (BuildIPv4(c, &lpacket, IPPROTO_TCP) < 0)
320  goto cleanup;
321 
322  if (t_inject_mode == LIBNET_LINK) {
323  SetupEthernet(p, &lpacket, dir);
324 
325  if (p->vlan_idx == 1) {
326  if (BuildEthernetVLAN(c, &lpacket, ETHERNET_TYPE_IP, p->vlan_id[0]) < 0)
327  goto cleanup;
328  } else {
329  if (BuildEthernet(c, &lpacket, ETHERNET_TYPE_IP) < 0)
330  goto cleanup;
331  }
332  }
333 
334  result = libnet_write(c);
335  if (result == -1) {
336  SCLogError("libnet_write failed: %s", libnet_geterror(c));
337  goto cleanup;
338  }
339 
340 cleanup:
341  ClearCtx(c);
342  return 0;
343 }
344 
345 int RejectSendLibnet11IPv4ICMP(ThreadVars *tv, Packet *p, void *data, enum RejectDirection dir)
346 {
347  Libnet11Packet lpacket;
348  int result;
349 
350  /* fill in struct defaults */
351  lpacket.ttl = 0;
352  lpacket.id = 0;
353  lpacket.flow = 0;
354  lpacket.class = 0;
355  const uint16_t iplen = IPV4_GET_IPLEN(p);
356  if (g_reject_dev_mtu >= ETHERNET_HEADER_LEN + LIBNET_IPV4_H + 8) {
357  lpacket.len = MIN(g_reject_dev_mtu - ETHERNET_HEADER_LEN, (LIBNET_IPV4_H + iplen));
358  } else {
359  lpacket.len = LIBNET_IPV4_H + MIN(8,iplen); // 8 bytes is the minimum we have to attach
360  }
361  lpacket.dsize = lpacket.len - (LIBNET_IPV4_H + LIBNET_ICMPV4_H);
362 
363  libnet_t *c = GetCtx(p, LIBNET_RAW4);
364  if (c == NULL)
365  return 1;
366 
367  switch (dir) {
368  case REJECT_DIR_SRC:
369  lpacket.src4 = GET_IPV4_DST_ADDR_U32(p);
370  lpacket.dst4 = GET_IPV4_SRC_ADDR_U32(p);
371  break;
372  case REJECT_DIR_DST:
373  default:
374  lpacket.src4 = GET_IPV4_SRC_ADDR_U32(p);
375  lpacket.dst4 = GET_IPV4_DST_ADDR_U32(p);
376  break;
377  }
378 
379  /* TODO come up with ttl calc function */
380  lpacket.ttl = 64;
381 
382  /* build the package */
383  if ((libnet_build_icmpv4_unreach(
384  ICMP_DEST_UNREACH, /* type */
385  ICMP_HOST_ANO, /* code */
386  0, /* checksum */
387  (uint8_t *)p->ip4h, /* payload */
388  lpacket.dsize, /* payload length */
389  c, /* libnet context */
390  0)) < 0) /* libnet ptag */
391  {
392  SCLogError("libnet_build_icmpv4_unreach %s", libnet_geterror(c));
393  goto cleanup;
394  }
395 
396  if (BuildIPv4(c, &lpacket, IPPROTO_ICMP) < 0)
397  goto cleanup;
398 
399  if (t_inject_mode == LIBNET_LINK) {
400  SetupEthernet(p, &lpacket, dir);
401 
402  if (p->vlan_idx == 1) {
403  if (BuildEthernetVLAN(c, &lpacket, ETHERNET_TYPE_IP, p->vlan_id[0]) < 0)
404  goto cleanup;
405  } else {
406  if (BuildEthernet(c, &lpacket, ETHERNET_TYPE_IP) < 0)
407  goto cleanup;
408  }
409  }
410 
411  result = libnet_write(c);
412  if (result == -1) {
413  SCLogError("libnet_write_raw_ipv4 failed: %s", libnet_geterror(c));
414  goto cleanup;
415  }
416 
417 cleanup:
418  ClearCtx(c);
419  return 0;
420 }
421 
422 int RejectSendLibnet11IPv6TCP(ThreadVars *tv, Packet *p, void *data, enum RejectDirection dir)
423 {
424  Libnet11Packet lpacket;
425  int result;
426 
427  /* fill in struct defaults */
428  lpacket.ttl = 0;
429  lpacket.id = 0;
430  lpacket.flow = 0;
431  lpacket.class = 0;
432 
433  if (p->tcph == NULL)
434  return 1;
435 
436  libnet_t *c = GetCtx(p, LIBNET_RAW6);
437  if (c == NULL)
438  return 1;
439 
440  lpacket.len = LIBNET_IPV6_H + LIBNET_TCP_H;
441  lpacket.dsize = p->payload_len;
442 
443  switch (dir) {
444  case REJECT_DIR_SRC:
445  memcpy(lpacket.src6.libnet_s6_addr, GET_IPV6_DST_ADDR(p), 16);
446  memcpy(lpacket.dst6.libnet_s6_addr, GET_IPV6_SRC_ADDR(p), 16);
447  break;
448  case REJECT_DIR_DST:
449  default:
450  memcpy(lpacket.src6.libnet_s6_addr, GET_IPV6_SRC_ADDR(p), 16);
451  memcpy(lpacket.dst6.libnet_s6_addr, GET_IPV6_DST_ADDR(p), 16);
452  break;
453  }
454  /* TODO come up with ttl calc function */
455  lpacket.ttl = 64;
456 
457  SetupTCP(p, &lpacket, dir);
458 
459  BuildTCP(c, &lpacket);
460 
461  if (BuildIPv6(c, &lpacket, IPPROTO_ICMP) < 0)
462  goto cleanup;
463 
464  if (t_inject_mode == LIBNET_LINK) {
465  SetupEthernet(p, &lpacket, dir);
466  if (p->vlan_idx == 1) {
467  if (BuildEthernetVLAN(c, &lpacket, ETHERNET_TYPE_IPV6, p->vlan_id[0]) < 0)
468  goto cleanup;
469  } else {
470  if (BuildEthernet(c, &lpacket, ETHERNET_TYPE_IPV6) < 0)
471  goto cleanup;
472  }
473  }
474 
475  result = libnet_write(c);
476  if (result == -1) {
477  SCLogError("libnet_write failed: %s", libnet_geterror(c));
478  goto cleanup;
479  }
480 
481 cleanup:
482  ClearCtx(c);
483  return 0;
484 }
485 
486 #ifdef HAVE_LIBNET_ICMPV6_UNREACH
487 int RejectSendLibnet11IPv6ICMP(ThreadVars *tv, Packet *p, void *data, enum RejectDirection dir)
488 {
489  Libnet11Packet lpacket;
490  int result;
491 
492  /* fill in struct defaults */
493  lpacket.ttl = 0;
494  lpacket.id = 0;
495  lpacket.flow = 0;
496  lpacket.class = 0;
497  const uint16_t iplen = IPV6_GET_PLEN(p);
498  if (g_reject_dev_mtu >= ETHERNET_HEADER_LEN + IPV6_HEADER_LEN + 8) {
499  lpacket.len = IPV6_HEADER_LEN + MIN(g_reject_dev_mtu - ETHERNET_HEADER_LEN, iplen);
500  } else {
501  lpacket.len = IPV6_HEADER_LEN + MIN(8, iplen);
502  }
503  lpacket.dsize = lpacket.len - LIBNET_ICMPV6_H;
504 
505  libnet_t *c = GetCtx(p, LIBNET_RAW6);
506  if (c == NULL)
507  return 1;
508 
509  switch (dir) {
510  case REJECT_DIR_SRC:
511  memcpy(lpacket.src6.libnet_s6_addr, GET_IPV6_DST_ADDR(p), 16);
512  memcpy(lpacket.dst6.libnet_s6_addr, GET_IPV6_SRC_ADDR(p), 16);
513  break;
514  case REJECT_DIR_DST:
515  default:
516  memcpy(lpacket.src6.libnet_s6_addr, GET_IPV6_SRC_ADDR(p), 16);
517  memcpy(lpacket.dst6.libnet_s6_addr, GET_IPV6_DST_ADDR(p), 16);
518  break;
519  }
520 
521  /* TODO come up with ttl calc function */
522  lpacket.ttl = 64;
523 
524  /* build the package */
525  if ((libnet_build_icmpv6_unreach(
526  ICMP6_DST_UNREACH, /* type */
527  ICMP6_DST_UNREACH_ADMIN, /* code */
528  0, /* checksum */
529  (uint8_t *)p->ip6h, /* payload */
530  lpacket.dsize, /* payload length */
531  c, /* libnet context */
532  0)) < 0) /* libnet ptag */
533  {
534  SCLogError("libnet_build_icmpv6_unreach %s", libnet_geterror(c));
535  goto cleanup;
536  }
537 
538  if (BuildIPv6(c, &lpacket, IPPROTO_ICMPV6) < 0)
539  goto cleanup;
540 
541  if (t_inject_mode == LIBNET_LINK) {
542  SetupEthernet(p, &lpacket, dir);
543  if (p->vlan_idx == 1) {
544  if (BuildEthernetVLAN(c, &lpacket, ETHERNET_TYPE_IPV6, p->vlan_id[0]) < 0)
545  goto cleanup;
546  } else {
547  if (BuildEthernet(c, &lpacket, ETHERNET_TYPE_IPV6) < 0)
548  goto cleanup;
549  }
550  }
551 
552  result = libnet_write(c);
553  if (result == -1) {
554  SCLogError("libnet_write_raw_ipv6 failed: %s", libnet_geterror(c));
555  goto cleanup;
556  }
557 
558 cleanup:
559  ClearCtx(c);
560  return 0;
561 }
562 
563 #else /* HAVE_LIBNET_ICMPV6_UNREACH */
564 
565 int RejectSendLibnet11IPv6ICMP(ThreadVars *tv, Packet *p, void *data, enum RejectDirection dir)
566 {
567  SCLogError("Libnet ICMPv6 based rejects are disabled."
568  "Usually this means that you don't have a patched libnet installed,"
569  " or configure couldn't find it.");
570  return 0;
571 }
572 #endif /* HAVE_LIBNET_ICMPV6_UNREACH */
573 
574 
575 #else
576 
578 {
579  SCLogError("Libnet based rejects are disabled."
580  "Usually this means that you don't have libnet installed,"
581  " or configure couldn't find it.");
582  return 0;
583 }
584 
586 {
587  SCLogError("Libnet based rejects are disabled."
588  "Usually this means that you don't have libnet installed,"
589  " or configure couldn't find it.");
590  return 0;
591 }
592 
594 {
595  SCLogError("Libnet based rejects are disabled."
596  "Usually this means that you don't have libnet installed,"
597  " or configure couldn't find it.");
598  return 0;
599 }
600 
602 {
603  SCLogError("Libnet based rejects are disabled."
604  "Usually this means that you don't have libnet installed,"
605  " or configure couldn't find it.");
606  return 0;
607 }
608 
609 void FreeCachedCtx(void)
610 {
611  SCLogDebug("no libhnet support");
612 }
613 
614 #endif /* HAVE_LIBNET11 */
tm-threads.h
decode-tcp.h
len
uint8_t len
Definition: app-layer-dnp3.h:2
Packet_::vlan_id
uint16_t vlan_id[2]
Definition: decode.h:455
SCLogDebug
#define SCLogDebug(...)
Definition: util-debug.h:269
RejectSendLibnet11IPv6TCP
int RejectSendLibnet11IPv6TCP(ThreadVars *tv, Packet *p, void *data, enum RejectDirection dir)
Definition: respond-reject-libnet11.c:593
seq
uint32_t seq
Definition: stream-tcp-private.h:2
ETHERNET_TYPE_IPV6
#define ETHERNET_TYPE_IPV6
Definition: decode-ethernet.h:39
action-globals.h
decode-udp.h
threads.h
TH_RST
#define TH_RST
Definition: decode-tcp.h:36
Packet_::vlan_idx
uint8_t vlan_idx
Definition: decode.h:456
packet-queue.h
REJECT_DIR_DST
@ REJECT_DIR_DST
Definition: respond-reject.h:30
TCP_GET_DST_PORT
#define TCP_GET_DST_PORT(p)
Definition: decode-tcp.h:113
MIN
#define MIN(x, y)
Definition: suricata-common.h:380
proto
uint8_t proto
Definition: decode-template.h:0
Packet_::payload_len
uint16_t payload_len
Definition: decode.h:574
GET_IPV6_DST_ADDR
#define GET_IPV6_DST_ADDR(p)
Definition: decode.h:214
host_mode
uint8_t host_mode
Definition: suricata.c:175
REJECT_DIR_SRC
@ REJECT_DIR_SRC
Definition: respond-reject.h:29
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
Packet_::datalink
int datalink
Definition: decode.h:607
decode.h
util-device.h
TCP_GET_SRC_PORT
#define TCP_GET_SRC_PORT(p)
Definition: decode-tcp.h:112
Packet_::ethh
EthernetHdr * ethh
Definition: decode.h:524
ThreadVars_
Per thread variable structure.
Definition: threadvars.h:57
IPV4_GET_IPLEN
#define IPV4_GET_IPLEN(p)
Definition: decode-ipv4.h:127
TH_ACK
#define TH_ACK
Definition: decode-tcp.h:38
LiveDevice_::dev
char * dev
Definition: util-device.h:40
TCP_GET_SEQ
#define TCP_GET_SEQ(p)
Definition: decode-tcp.h:114
ICMP6_DST_UNREACH
#define ICMP6_DST_UNREACH
Definition: decode-icmpv6.h:36
RejectSendLibnet11IPv4TCP
int RejectSendLibnet11IPv4TCP(ThreadVars *tv, Packet *p, void *data, enum RejectDirection dir)
Definition: respond-reject-libnet11.c:577
RejectDirection
RejectDirection
Definition: respond-reject.h:28
Packet_
Definition: decode.h:428
FreeCachedCtx
void FreeCachedCtx(void)
Definition: respond-reject-libnet11.c:609
ETHERNET_HEADER_LEN
#define ETHERNET_HEADER_LEN
Definition: decode-ethernet.h:27
Packet_::ip4h
IPV4Hdr * ip4h
Definition: decode.h:531
Packet_::livedev
struct LiveDevice_ * livedev
Definition: decode.h:586
tm-queuehandlers.h
decode-ipv4.h
suricata-common.h
respond-reject-libnet11.h
Packet_::tcph
TCPHdr * tcph
Definition: decode.h:553
decode-sctp.h
tv
ThreadVars * tv
Definition: fuzz_decodepcapfile.c:32
RejectSendLibnet11IPv6ICMP
int RejectSendLibnet11IPv6ICMP(ThreadVars *tv, Packet *p, void *data, enum RejectDirection dir)
Definition: respond-reject-libnet11.c:601
threadvars.h
IS_SURI_HOST_MODE_SNIFFER_ONLY
#define IS_SURI_HOST_MODE_SNIFFER_ONLY(host_mode)
Definition: suricata.h:117
SCLogError
#define SCLogError(...)
Macro used to log ERROR messages.
Definition: util-debug.h:261
GET_IPV6_SRC_ADDR
#define GET_IPV6_SRC_ADDR(p)
Definition: decode.h:213
RejectSendLibnet11IPv4ICMP
int RejectSendLibnet11IPv4ICMP(ThreadVars *tv, Packet *p, void *data, enum RejectDirection dir)
Definition: respond-reject-libnet11.c:585
ICMP_DEST_UNREACH
#define ICMP_DEST_UNREACH
Definition: decode-icmpv4.h:36
ICMP_HOST_ANO
#define ICMP_HOST_ANO
Definition: decode-icmpv4.h:114
suricata.h
IPV6_HEADER_LEN
#define IPV6_HEADER_LEN
Definition: decode-ipv6.h:27
sc_set_caps
int sc_set_caps
Definition: suricata.c:184
TCP_GET_ACK
#define TCP_GET_ACK(p)
Definition: decode-tcp.h:115
GET_IPV4_SRC_ADDR_U32
#define GET_IPV4_SRC_ADDR_U32(p)
Definition: decode.h:206
Packet_::ip6h
IPV6Hdr * ip6h
Definition: decode.h:533
GET_IPV4_DST_ADDR_U32
#define GET_IPV4_DST_ADDR_U32(p)
Definition: decode.h:207
respond-reject.h
ICMP6_DST_UNREACH_ADMIN
#define ICMP6_DST_UNREACH_ADMIN
Definition: decode-icmpv6.h:81
ETHERNET_TYPE_IP
#define ETHERNET_TYPE_IP
Definition: decode-ethernet.h:34
LINKTYPE_ETHERNET
#define LINKTYPE_ETHERNET
Definition: decode.h:972