From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40571) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZK1OA-00043m-79 for qemu-devel@nongnu.org; Tue, 28 Jul 2015 05:41:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZK1O5-0008Jz-TM for qemu-devel@nongnu.org; Tue, 28 Jul 2015 05:41:34 -0400 Received: from [59.151.112.132] (port=7957 helo=heian.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZK1O5-0008Ju-IC for qemu-devel@nongnu.org; Tue, 28 Jul 2015 05:41:29 -0400 Message-ID: <55B74E3B.7090705@cn.fujitsu.com> Date: Tue, 28 Jul 2015 17:41:15 +0800 From: Yang Hongyang MIME-Version: 1.0 References: <55AF75E6.6070909@cn.fujitsu.com> <1437562536-20414-1-git-send-email-yanghy@cn.fujitsu.com> <55B082BE.2020703@redhat.com> <55B5C14F.5030808@cn.fujitsu.com> <55B5D214.5030506@redhat.com> <55B5D727.8010806@cn.fujitsu.com> <55B5DE34.9050409@redhat.com> <55B5E1A4.9010100@cn.fujitsu.com> <55B5E543.8050505@redhat.com> <55B5EE5F.4050003@cn.fujitsu.com> <55B5F706.3030808@redhat.com> <55B60209.6050401@cn.fujitsu.com> <55B6F6ED.5090900@redhat.com> <55B6FE61.80109@cn.fujitsu.com> <55B74905.5040404@cn.fujitsu.com> <55B74BC3.9060708@redhat.com> In-Reply-To: <55B74BC3.9060708@redhat.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] RFC/net: Add a net filter List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jason Wang , qemu-devel@nongnu.org Cc: thuth@redhat.com, stefanha@redhat.com On 07/28/2015 05:30 PM, Jason Wang wrote: > On 07/28/2015 05:19 PM, Yang Hongyang wrote: >> On 07/28/2015 12:00 PM, Yang Hongyang wrote: >>> On 07/28/2015 11:28 AM, Jason Wang wrote: >>>> On 07/27/2015 06:03 PM, Yang Hongyang wrote: >>>>> On 07/27/2015 05:16 PM, Jason Wang wrote: >>>>> [...] >>>>>>>>>>> I think this won't work for the buffer case? If we want the >>>>>>>>>>> buffer >>>>>>>>>>> case >>>>>>>>>>> to work under this, we should modify the generic netdev layer >>>>>>>>>>> code, to >>>>>>>>>>> check the return value of the filter function call. >>>>>>>>>> >>>>>>>>>> But checking return value is rather simpler than a new netdev >>>>>>>>>> type, >>>>>>>>>> isn't it? >>>>>>>>> >>>>>>>>> But how to implement a plugin which suppose to do the actual >>>>>>>>> work on >>>>>>>>> the packets? >>>>>>>> >>>>>>>> Well, the filter get the packets, so it can do everything it wants. >>>>>>>> >>>>>>>>> how to configure params related to the plugin? different >>>>>>>>> plugins may need different params, implement as another netdev? >>>>>>>> >>>>>>>> I belive qmp can do this? something like -filter >>>>>>>> dump,id=f0,len=10000? >>>>>>> >>>>>>> So you mean implement another object filter? >>>>>> >>>>>> Yes. >>>>>> >>>>>>> and the structure is like netdev? >>>>>> >>>>>> No, it is embedded in netdev. >>>>> >>>>> Ah, I see what you mean, thank you for the patience... >>>>> does the command line looks like: >>>>> -filter dump,id=f0,len=10000 >>>>> -netdev tap,XXX,filter=dump >>>>> >>>>> If I need both dump and packets buffering, how will the qmp be? >>>>> -filter dump,id=f0,len=10000 >>>>> -filter buffer,XXX >>>>> -netdev tap,XXX,filter=dump:buffer:XXX ? >>>> >>>> This is ok but we have several choices, e.g you may want to have a next >>>> field like: >>>> >>>> - filter buffer,id=f0 >>>> - filter dump,id=f1,len=1000,next=f0 >>>> - netdev tap,XXX,filter_root=f1 >>> >>> This seems better, thank you! >> >> Sorry, when try to implement it, I found this qmp is not that good >> when it >> comes to dynamically add/remove filters, can I use below instead: >> -netdev tap,id=bn0 >> -netfilter dump,id=f0,netdev=bn0 >> -netfilter buffer,id=f1,netdev=bn0 >> >> by this, I can introduce a QTAILQ of filters to NetClentState and >> netdev_{add|del}_filter to dynamically add/remove filters. > > This looks good. Thank you. > > Thanks > . > -- Thanks, Yang.