From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MOBzx-0003E5-Vw for qemu-devel@nongnu.org; Tue, 07 Jul 2009 10:50:22 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MOBzs-0003Cy-Oc for qemu-devel@nongnu.org; Tue, 07 Jul 2009 10:50:21 -0400 Received: from [199.232.76.173] (port=54299 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MOBzs-0003Cv-Kt for qemu-devel@nongnu.org; Tue, 07 Jul 2009 10:50:16 -0400 Received: from mx2.redhat.com ([66.187.237.31]:34207) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MOBzs-00039Q-1p for qemu-devel@nongnu.org; Tue, 07 Jul 2009 10:50:16 -0400 Date: Tue, 7 Jul 2009 17:49:32 +0300 From: "Michael S. Tsirkin" Subject: Re: [Qemu-devel] [PATCH] net: add raw backend Message-ID: <20090707144932.GA8153@redhat.com> References: <20090702154354.GA27022@redhat.com> <4A535F93.7090305@Voltaire.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4A535F93.7090305@Voltaire.com> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Or Gerlitz Cc: Herbert Xu , qemu-devel@nongnu.org On Tue, Jul 07, 2009 at 05:45:39PM +0300, Or Gerlitz wrote: > Michael S. Tsirkin wrote: > >> +static void raw_send(void *opaque) > >> + do { > >> + size = recv(s->fd, s->buf, sizeof(s->buf), MSG_TRUNC); > >> + if (size <= 0) > >> + break; > > > A couple of improvement suggestions here: > > - You might get size > sizeof(s->buf). Should not happen, but you might want to > > check for this condition and report it + discard the packet. > > okay, will do > > > - It might be a good idea to request aux data and verify that checksum is set, > > calculate it if not. this will make it possible to bind to a local device as well. > > thanks for the heads up, I am still not sure to follow the documentation/logic wrt to checksum reporting of the af_packet kernel code. I'll look on this. What do you mean by "this will make it possible to bind to a local device as well"? See comment in qemu-kvm about dhclient as an example. > >> @@ -2348,6 +2500,41 @@ int net_client_init(Monitor *mon, const char *device, const char *p) > >> + if (!strcmp(device, "raw")) { > >> + int promisc = 1; > > > promisc = 0 might be a safer default > > I can do that, but I am not sure why its safer, e.g bridge always set all interfaces to promisc Think of what happens if someone does kill -9 on qemu This can not happen with bridge. > >> + "-net raw[,vlan=n][,name=str],ifname=name[,promisc=m]\n" > >> + " bound the host network interface to VLAN 'n' in a raw manner:\n" > > > in a raw manner -> using a raw packet socket > > okay > > >> + " packets received on the interface are delivered to the vlan and\n" > >> + " packets delivered on the vlan are sent to the interface\n" > > > document promisc option? > > sure > > > Or.