From: Aleksey Katargin Date: Thu, 16 Jul 2015 13:51:03 +0000 (+0500) Subject: netmap: strict check for zero copy mode X-Git-Tag: suricata-3.0RC1~251 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=823167bde2d805b7a089c3ea0c69ee0bc2ff4d64;p=thirdparty%2Fsuricata.git netmap: strict check for zero copy mode Netmap does not guarantees that mmap'ed regions for different interfaces would be the same. --- diff --git a/src/source-netmap.c b/src/source-netmap.c index 7d56e623b9..b00dd43b75 100644 --- a/src/source-netmap.c +++ b/src/source-netmap.c @@ -578,8 +578,15 @@ static TmEcode ReceiveNetmapThreadInit(ThreadVars *tv, void *initdata, void **da char const *active_runmode = RunmodeGetActive(); if (active_runmode && !strcmp("workers", active_runmode)) { - ntv->flags |= NETMAP_FLAG_ZERO_COPY; - SCLogInfo("Enabling zero copy mode"); + if (likely(ntv->ifsrc->mem == ntv->ifdst->mem)) { + ntv->flags |= NETMAP_FLAG_ZERO_COPY; + SCLogInfo("Enabling zero copy mode for %s->%s", + aconf->iface, aconf->out_iface); + } else { + SCLogInfo("Unable to set zero copy mode for %s->%s", + aconf->iface, aconf->out_iface); + } + } if (aconf->bpf_filter) {