From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by passt.top (Postfix) with ESMTP id EFE795A026F for ; Thu, 7 Mar 2024 12:26:07 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709810766; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BdGgpFp16MKOSsn+aot9MOSw6PtWVrgXq8KXOHrq5MQ=; b=YqsdHgdfzEi9kR8T/VigLRfHHJqcGaH03f95V6yaUdzpkPAUTGNcj94nt1APn+hyy4U6fI SgGCAumkoqn8N8OC0zWRyvcZm1poMO+kaiHq1Ux/kVMjp3VY8ZHP5A2bw3jN4NqdRHH6zQ 26AViFFRm+HunolKUBioUfYxMzAN70A= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-156-XUboGCfFOzW3ArrCgEb7jg-1; Thu, 07 Mar 2024 06:26:04 -0500 X-MC-Unique: XUboGCfFOzW3ArrCgEb7jg-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EFCFC186E12A; Thu, 7 Mar 2024 11:26:03 +0000 (UTC) Received: from virtlab218.virt.lab.eng.bos.redhat.com (virtlab218.virt.lab.eng.bos.redhat.com [10.19.152.190]) by smtp.corp.redhat.com (Postfix) with ESMTP id 78CCD492BCD; Thu, 7 Mar 2024 11:26:03 +0000 (UTC) From: Laurent Vivier To: passt-dev@passt.top Subject: [PATCH] tap: Capture only packets that are actually sent Date: Thu, 7 Mar 2024 12:26:02 +0100 Message-ID: <20240307112602.1279441-1-lvivier@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true Message-ID-Hash: KNL4RSSAGON5J3BQXRDXBDZDSLKB327O X-Message-ID-Hash: KNL4RSSAGON5J3BQXRDXBDZDSLKB327O X-MailFrom: lvivier@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Laurent Vivier , david@gibson.dropbear.id.au X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: In tap_send_frames(), if we failed to send all the frames, we must only log the frames that have been sent, not all the frames we wanted to send. Fixes: dda7945ca9c9 ("pcap: Handle short writes in pcap_frame()") Cc: david@gibson.dropbear.id.au Signed-off-by: Laurent Vivier --- Notes: David, I don't understand why you changed the 'm' by an 'n' in your commit. tap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tap.c b/tap.c index c7b9372668ec..f4051cecab84 100644 --- a/tap.c +++ b/tap.c @@ -413,7 +413,7 @@ size_t tap_send_frames(const struct ctx *c, const struct iovec *iov, size_t n) if (m < n) debug("tap: failed to send %zu frames of %zu", n - m, n); - pcap_multiple(iov, 1, n, c->mode == MODE_PASST ? sizeof(uint32_t) : 0); + pcap_multiple(iov, 1, m, c->mode == MODE_PASST ? sizeof(uint32_t) : 0); return m; } -- 2.42.0