From b1d191b478bf6d90ae4971fd30fbe14a63dd036a Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Sat, 11 Jun 2016 16:12:26 +0200 Subject: [PATCH] netmap: fix enabling promisc mode on FreeBSD In FreeBSD setting the IFF_PROMISC flag has no effect. Instead we need to set the IFF_PPROMISC flag. --- src/source-netmap.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/source-netmap.c b/src/source-netmap.c index b9ce7a843f..738da5af13 100644 --- a/src/source-netmap.c +++ b/src/source-netmap.c @@ -133,6 +133,11 @@ TmEcode NoNetmapSupportExit(ThreadVars *tv, void *initdata, void **data) #if defined(__linux__) #define POLL_EVENTS (POLLHUP|POLLRDHUP|POLLERR|POLLNVAL) + +#ifndef IFF_PPROMISC +#define IFF_PPROMISC IFF_PROMISC +#endif + #else #define POLL_EVENTS (POLLHUP|POLLERR|POLLNVAL) #endif @@ -438,8 +443,9 @@ static int NetmapOpen(char *ifname, int promisc, NetmapDevice **pdevice, int ver close(if_fd); goto error_fd; } - if (promisc) { - if_flags |= IFF_PROMISC; + /* if needed, try to set iface in promisc mode */ + if (promisc && (if_flags & (IFF_PROMISC|IFF_PPROMISC)) == 0) { + if_flags |= IFF_PPROMISC; NetmapSetIfaceFlags(if_fd, ifname, if_flags); } -- 2.47.3