From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34237) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z9xCo-0004Li-1g for qemu-devel@nongnu.org; Tue, 30 Jun 2015 11:12:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z9xCk-0007eB-O5 for qemu-devel@nongnu.org; Tue, 30 Jun 2015 11:12:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37107) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z9xCk-0007dr-Ii for qemu-devel@nongnu.org; Tue, 30 Jun 2015 11:12:10 -0400 Date: Tue, 30 Jun 2015 16:12:08 +0100 From: Stefan Hajnoczi Message-ID: <20150630151208.GE31899@stefanha-thinkpad.redhat.com> References: <1435161381-31521-1-git-send-email-thuth@redhat.com> <1435161381-31521-5-git-send-email-thuth@redhat.com> <20150626094459.GG15457@stefanha-thinkpad.redhat.com> <20150629115715.40500711@thh440s> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="a+b56+3nqLzpiR9O" Content-Disposition: inline In-Reply-To: <20150629115715.40500711@thh440s> Subject: Re: [Qemu-devel] [PATCH 4/5] net/dump: Add dump option for netdev devices List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Thomas Huth Cc: Stefan Hajnoczi , Jason Wang , qemu-devel@nongnu.org, Markus Armbruster --a+b56+3nqLzpiR9O Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jun 29, 2015 at 11:57:15AM +0200, Thomas Huth wrote: > On Fri, 26 Jun 2015 10:44:59 +0100 > Stefan Hajnoczi wrote: >=20 > > On Wed, Jun 24, 2015 at 05:56:20PM +0200, Thomas Huth wrote: > > > diff --git a/net/net.c b/net/net.c > > > index cc36c7b..8871b77 100644 > > > --- a/net/net.c > > > +++ b/net/net.c > > > @@ -568,6 +568,12 @@ ssize_t qemu_deliver_packet(NetClientState *send= er, > > > return 0; > > > } > > > =20 > > > + if (nc->netdev_dump_enabled) { > > > + net_dump_receive(nc, data, size); > > > + } else if (sender->netdev_dump_enabled) { > > > + net_dump_receive(sender, data, size); > > > + } > >=20 > > Why "else if"? If two interfaces have packet capture enabled then both > > should get the full traffic log: > >=20 > > if (nc->netdev_dump_enabled) { > > net_dump_receive(nc, data, size); > > } > > if (sender->netdev_dump_enabled) { > > net_dump_receive(sender, data, size); > > } >=20 > I think I assumed that only the interfaces that are created with > "-netdev" can get a dump option. So it's either the receiver or the > sender that dumps. If both interfaces would have the dump flag set, > that would mean that two interfaces created with "-netdev" are talking > to each other - and this can not happen, can it? qemu_deliver_packet() doesn't know about -netdev vs -device. It just knows about NetClientState and peers. Avoiding the 2nd memory load probably isn't worth baking the assumption into this code. --a+b56+3nqLzpiR9O Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJVkrHIAAoJEJykq7OBq3PIeVQIAJ9Ai+HJpf0fMEvs3lzirire ubcTODoSKoGxTGC+8A+2/Vr7cgU7rj6bQutPw+kvsC3ODz/nvW35H1H7Nx0WYmUv sMl8gBosGY7ppcQ/QaQms6et+f8Ka5iXLq6EcV6TNWrIE9C+aFO39jqPZ5KyADwn Qy/vW57u0qGjabBrsS5IHXISurLHb2UAzUIZuasQ8TCJFFLB+jwP8gbrX99VQECi a3enyEqqv09OEd/F5hElxzxUzTUQsiSMrYMdiAiEZzIQ/QQppqzvn2VGhvCgroCr tEtrcNgjUytbgqXmCYEPaKX44fBl4fw8fmnd+DUKHmqJ5UIpbFeUjpJYsmjcB4M= =1L/y -----END PGP SIGNATURE----- --a+b56+3nqLzpiR9O--