From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60908) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z9svU-00020U-2p for qemu-devel@nongnu.org; Tue, 30 Jun 2015 06:38:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z9svQ-0006Bf-Rd for qemu-devel@nongnu.org; Tue, 30 Jun 2015 06:38:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34989) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z9svQ-0006BX-KW for qemu-devel@nongnu.org; Tue, 30 Jun 2015 06:38:00 -0400 Date: Tue, 30 Jun 2015 12:37:46 +0200 From: Thomas Huth Message-ID: <20150630123746.5e8626df@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_/UYKsBzebXUVSmuI4i4E0Mpz"; 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_/UYKsBzebXUVSmuI4i4E0Mpz 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); > > + } ... > 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). I've now tried this, but then I suddenly get the packets in the wrong order in the dump file (when using slirp networking), e.g.: 1 0.000000 10.0.2.2 -> 255.255.255.255 DHCP 590 DHCP Offer 2 0.000012 0.0.0.0 -> 255.255.255.255 DHCP 342 DHCP Discover instead of: 1 0.000000 0.0.0.0 -> 255.255.255.255 DHCP 342 DHCP Discover 2 0.000035 10.0.2.2 -> 255.255.255.255 DHCP 590 DHCP Offer Looks like with slirp, the answer is already sent before the initial receive() function returns? Any idea how to avoid that issue? If not, I think I'll simply keep the dump hooks before calling the receive functions. Thomas --Sig_/UYKsBzebXUVSmuI4i4E0Mpz Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBAgAGBQJVknF6AAoJEC7Z13T+cC216BQQAJixKmiinNS67+8oFJhUyWqM IFlkNzfK2vbct+r/AEz3oTZzFAhFmlTb3ZK5VD3RDQAUp6z7VRNh2S61v0i62yU4 SLzgzDKrjS5xIHzlIMVmvQJv8LNZdFGlEPf0VKzvE7F2r/8LhbQ6JMBqNFsQLMZQ SjmgVFbTXvJbMsHv9YXsTerP7IGInmwBDUH14qmT04DpU17sPJiyodSYx2xOYEy8 c7+5JqkwU3Zlax8VF7YCEWo4zJG4wML/p+02N5M2lBSy5E/44quhLr9m4u+MujxS VrWLFW8o1G0ExDoJOQfJaS98tWKVq3eR9alxav+TWQMMVOOuDB7pHAWDoFXfRGVB u8qnjntUFxE9q7U4P2ly5JVag9SOoMqA4zZhHdv+A6IRTwVXo3ngAn1c4/2E7LD0 NauJxTiNlaA1EPpBhDfgc8zqdXug5whkhbVwgUtqFxhktHyLSw4uKwcj6clTreyb nFg8Py7M0AACWPoLx32+VlJIWVWbIV6mrwBpXebQNMSbAXHDlA3t/tk/C4XLfBiB Mov3HYIRLR8w11xlWpLrqRiEBNH9rZN55oKfw2RuHz3436Qrmks2brERqufjj3j9 k76CzN7pOt8ArAJfROvPpCtPDtZXccEKruWG5oRSRL+ih2V+vKlhGWzm9SBCqKCg S1nwvXuuAm42ILOoCj8B =n74h -----END PGP SIGNATURE----- --Sig_/UYKsBzebXUVSmuI4i4E0Mpz--