Received: from eggs.gnu.org ([2001:4830:134:3::10]:47220) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z9Vox-0008Jm-S2 for qemu-devel@nongnu.org; Mon, 29 Jun 2015 05:57:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z9Vot-0004S3-S9 for qemu-devel@nongnu.org; Mon, 29 Jun 2015 05:57:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45940) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z9Vot-0004Ry-L8 for qemu-devel@nongnu.org; Mon, 29 Jun 2015 05:57:43 -0400 Date: Mon, 29 Jun 2015 11:57:15 +0200 From: Thomas Huth Message-ID: <20150629115715.40500711@thh440s> In-Reply-To: <20150626094459.GG15457@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> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; boundary="Sig_/s=+w0kk+syINfGcW6rKafU7"; protocol="application/pgp-signature" 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: Stefan Hajnoczi Cc: Jason Wang , qemu-devel@nongnu.org, Stefan Hajnoczi , Markus Armbruster --Sig_/s=+w0kk+syINfGcW6rKafU7 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Fri, 26 Jun 2015 10:44:59 +0100 Stefan Hajnoczi wrote: > 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 *sender, > > 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); > } 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? > Perhaps dumping should happen after ->receive() has returned size. If > ->receive() returns -1 the packet is discarded, and if it returns 0 the > packet is queued (not delivered yet). >=20 > If you dump unconditionally before ->receive() you will see queued > packets dumped multiple times (each time the queue gets flushed). Good point, thanks, I'll move the code accordingly. Thomas --Sig_/s=+w0kk+syINfGcW6rKafU7 Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBAgAGBQJVkRaBAAoJEC7Z13T+cC217DkP/2GpzJM5HMut6z2sYcLyhoU9 C/idxIFfIv1FNF/0d29tmcMfVGB8mBQ1cvYHof8kfuLQC5nSSOHx0zp/s/M1h82W VFyW8l53OXygDi8gaX5iXIjyEZNtAEbI6bArlFvwg1iOqJe9jdvT7IGhNSHtqqtX RSrYty4R/e1oe+nBh9aqdMkfhO0QQRdHPeRyG+3sOIk4WubSwkhfJY4mnrNSolcQ 8KRnAaEq6iq0loHCbs3uz4Yf6n9OhyqFqEgbGui90WnlN6YLOx9xNqZNKrxUfGFS sT3whVv77g29SIKsEjDtiqoPFm4cO8z9teNdd9fkstzba6ZbDkoSIbajPzip0TZj TTUAciHHUiOE3zygzryS4ZDiQFk6ViIJdfIqOotp2LvnbT9/+xW+ko5KC+u+phvd XDySLq5CvBavJe1HqopzvIFJb4UD1bWr7O0vyd/IQ+cOJCBuEf9Rd7GQ0KJY3u6K gYKYuGv2Adn2BATv8sWcqIComGKO4whmskUUvN9gXSFVPbXUGfxfwy5ud+8JYycm aQxHGfVcIKBgkjxgqv4PeDbzASxLGnn6AqkEm3wExgk4grzl8bHcDsGigTqCmKXC F82d4PDhU4jvOnCVw4m310blYIIbggh6JQoT1v4DuHn94yRJULjAXyoJF8mHFjQ7 +FujPn1GF9m5J+zssmbn =fiNF -----END PGP SIGNATURE----- --Sig_/s=+w0kk+syINfGcW6rKafU7--