From 823167bde2d805b7a089c3ea0c69ee0bc2ff4d64 Mon Sep 17 00:00:00 2001 From: Aleksey Katargin Date: Thu, 16 Jul 2015 18:51:03 +0500 Subject: [PATCH] netmap: strict check for zero copy mode Netmap does not guarantees that mmap'ed regions for different interfaces would be the same. --- src/source-netmap.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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) { -- 2.47.2