From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38909) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOjTC-0002VP-Qo for qemu-devel@nongnu.org; Thu, 28 Jan 2016 05:06:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aOjT9-0007sw-3Z for qemu-devel@nongnu.org; Thu, 28 Jan 2016 05:06:30 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48278) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOjT8-0007sT-Rw for qemu-devel@nongnu.org; Thu, 28 Jan 2016 05:06:27 -0500 References: <1453862428-25570-1-git-send-email-zhangchen.fnst@cn.fujitsu.com> <56A9AAC8.4010803@redhat.com> <56A9C6E4.2050309@cn.fujitsu.com> <56A9D349.6090809@redhat.com> <56A9E4C8.4050203@cn.fujitsu.com> From: Jason Wang Message-ID: <56A9E815.1050205@redhat.com> Date: Thu, 28 Jan 2016 18:06:13 +0800 MIME-Version: 1.0 In-Reply-To: <56A9E4C8.4050203@cn.fujitsu.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH V2] net/traffic-mirror:Add traffic-mirror List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Zhang Chen , qemu devel Cc: zhanghailiang , Li Zhijian , Gui jianfeng , "eddie.dong" , "Dr. David Alan Gilbert" , Yang Hongyang On 01/28/2016 05:52 PM, Zhang Chen wrote: > > > On 01/28/2016 04:37 PM, Jason Wang wrote: >> >> On 01/28/2016 03:44 PM, Zhang Chen wrote: >>> >>> On 01/28/2016 01:44 PM, Jason Wang wrote: >>>> On 01/27/2016 10:40 AM, Zhang Chen wrote: >>>>> From: ZhangChen >>>>> >>>>> Traffic-mirror is a netfilter plugin. >>>>> It gives qemu the ability to copy and mirror guest's >>>>> net packet. we output packet to chardev. >>>>> >>>>> usage: >>>>> >>>>> -netdev tap,id=hn0 >>>>> -chardev socket,id=mirror0,host=ip_primary,port=X,server,nowait >>>>> -traffic-mirror,id=m0,netdev=hn0,queue=tx/rx/all,outdev=mirror0 >>>>> >>>>> Signed-off-by: ZhangChen >>>>> Signed-off-by: Wen Congyang >>>>> Reviewed-by: Yang Hongyang >>>> Thanks for the patch. Several questions: >>>> >>>> - I'm curious about how the patch was tested? Simple setup e.g: >>>> >>>> -netdev tap,id=hn0 -device virtio-net-pci,netdev=hn0 -chardev >>>> socket,id=c0,host=localhost,port=4444,server,nowait -object >>>> traffic-mirror,netdev=hn0,outdev=c0,id=f0 -netdev >>>> socket,id=s0,connect=127.0.0.1:4444 -device e1000,netdev=s0 >>>> >>>> does not works for me. >>> I test it in this way. >>> primary: >>> -netdev tap,id=hn0 -device e1000,netdev=hn0 -chardev >>> socket,id=mirror0,host=3.3.3.3,port=9003,server,nowait >>> -object traffic-mirror,id=f0,netdev=hn0,queue=tx,outdev=mirror0 >>> >>> secondary: >>> -netdev tap,id=hn0 -device e1000,netdev=hn0 -chardev >>> socket,id=mirror0,host=3.3.3.3,port=9003 -object >>> traffic-reader,id=f1,netdev=hn0,queue=rx,indev=mirror0 >>> >>> I write a traffic-reader demo to read chardev socket and print it in >>> monitor. >> Ok, but maybe you can try socket backend. I think the protocol should be >> at least compatible with it. > > Yes,I will try it. > >>> >>>> - Is a reliable mirroring (e.g no packet drops during mirroring) is >>>> needed for COLO? If yes, this patch seems could not guarantee this. >>> I will fix it in V3 >>> >>>> - Please consider to write a unit test for this patch. >>> write a unit test like tests/test-netfilter.c ? >> Even more for its basic function to work. E.g, start qemu with: >> >> -netdev socket,id=s0,listen=localhost:X -chardev >> socket,id=c0,host=localhost,pory=Y,server,nowait -object >> filter-mirror,netdev=hn0,outdev=c0 >> >> Then you can inject packet from the socket connected to s0 and see if >> you can read it from socket that connected from c0 (or your traffic >> reader). > > I got it~ will add test in next version. Thanks and make it a separate patch on top.