From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56540) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZKfoW-0005Ns-HT for qemu-devel@nongnu.org; Thu, 30 Jul 2015 00:51:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZKfoR-0006RK-TR for qemu-devel@nongnu.org; Thu, 30 Jul 2015 00:51:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36831) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZKfoR-0006RE-OC for qemu-devel@nongnu.org; Thu, 30 Jul 2015 00:51:23 -0400 Message-ID: <55B9AD45.40103@redhat.com> Date: Thu, 30 Jul 2015 12:51:17 +0800 From: Jason Wang MIME-Version: 1.0 References: <1438167116-29270-1-git-send-email-yanghy@cn.fujitsu.com> <1438167116-29270-6-git-send-email-yanghy@cn.fujitsu.com> In-Reply-To: <1438167116-29270-6-git-send-email-yanghy@cn.fujitsu.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 05/12] netfilter: hook packets before receive List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Yang Hongyang , qemu-devel@nongnu.org Cc: thuth@redhat.com, mrhines@linux.vnet.ibm.com, stefanha@redhat.com, zhang.zhanghailiang@huawei.com On 07/29/2015 06:51 PM, Yang Hongyang wrote: > Capture packets that will be sent. > > Signed-off-by: Yang Hongyang > --- > include/net/filter.h | 16 +++++++++++++ > net/net.c | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++- > 2 files changed, 80 insertions(+), 1 deletion(-) > > diff --git a/include/net/filter.h b/include/net/filter.h > index 1dd86cf..5292563 100644 > --- a/include/net/filter.h > +++ b/include/net/filter.h > @@ -12,11 +12,27 @@ > #include "qemu/typedefs.h" > > typedef void (FilterCleanup) (NetFilterState *); > +/* > + * Return: > + * 0: finished handling the packet, we should continue > + * size: filter stolen this packet, we stop pass this packet further > + */ > +typedef ssize_t (FilterReceive)(NetFilterState *, NetClientState *sender, > + unsigned flags, const uint8_t *, size_t); Looks like there's no need for this. Just add a wrapper and pretend a single iov should be ok?