#include "action-globals.h"
#include "respond-reject.h"
#include "respond-reject-libnet11.h"
+#include "util-device.h"
#ifdef HAVE_LIBNET11
#include <libnet.h>
+extern uint8_t host_mode;
typedef struct Libnet11Packet_ {
uint32_t ack, seq;
libnet_t *c; /* libnet context */
char ebuf[LIBNET_ERRBUF_SIZE];
int result;
+ char *devname = NULL;
/* fill in struct defaults */
lpacket.ttl = 0;
lpacket.flow = 0;
lpacket.class = 0;
- if ((c = libnet_init(LIBNET_RAW4, NULL, ebuf)) == NULL) {
+ if (IS_SURI_HOST_MODE_SNIFFER_ONLY(host_mode) && (p->livedev)) {
+ devname = p->livedev->dev;
+ SCLogDebug("Will emit reject packet on dev %s", devname);
+ }
+ if ((c = libnet_init(LIBNET_RAW4, devname, ebuf)) == NULL) {
SCLogError(SC_ERR_LIBNET_INIT,"libnet_inint failed: %s", ebuf);
return 1;
}
libnet_t *c; /* libnet context */
char ebuf[LIBNET_ERRBUF_SIZE];
int result;
+ char *devname = NULL;
/* fill in struct defaults */
lpacket.ttl = 0;
lpacket.class = 0;
lpacket.len = (IPV4_GET_HLEN(p) + p->payload_len);
- if ((c = libnet_init(LIBNET_RAW4, NULL, ebuf)) == NULL) {
+
+ if (IS_SURI_HOST_MODE_SNIFFER_ONLY(host_mode) && (p->livedev)) {
+ devname = p->livedev->dev;
+ }
+ if ((c = libnet_init(LIBNET_RAW4, devname, ebuf)) == NULL) {
SCLogError(SC_ERR_LIBNET_INIT,"libnet_inint failed: %s", ebuf);
return 1;
}
# it is a pure sniffing setup, set it to 'sniffer-only'.
# If set to auto, the variable is internally switch to 'router' in IPS mode
# and 'sniffer-only' in IDS mode.
+# This feature is currently only used by the reject* keywords.
host-mode: auto
# Run suricata as user and group.