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