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