From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MOBvZ-00025L-3W for qemu-devel@nongnu.org; Tue, 07 Jul 2009 10:45:49 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MOBvU-000252-60 for qemu-devel@nongnu.org; Tue, 07 Jul 2009 10:45:48 -0400 Received: from [199.232.76.173] (port=58743 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MOBvU-00024x-30 for qemu-devel@nongnu.org; Tue, 07 Jul 2009 10:45:44 -0400 Received: from fwil.voltaire.com ([193.47.165.2]:10980 helo=exil.voltaire.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MOBvT-0001gp-Ea for qemu-devel@nongnu.org; Tue, 07 Jul 2009 10:45:43 -0400 Message-ID: <4A535F93.7090305@Voltaire.com> Date: Tue, 07 Jul 2009 17:45:39 +0300 From: Or Gerlitz MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] net: add raw backend References: <20090702154354.GA27022@redhat.com> In-Reply-To: <20090702154354.GA27022@redhat.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: Herbert Xu , qemu-devel@nongnu.org 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"? >> @@ -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 >> + "-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.