From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202408 header.b=NUSqQWIF; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 422185A004E for ; Wed, 25 Sep 2024 03:21:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202408; t=1727227272; bh=7qrke2GjQPrMZLt5LQQHzGt8I1FC791nrw0Q33nm+2o=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=NUSqQWIFYOYvNKhH6nDTWo1eDj4MerADFepOkJM7WEdpkIs8DY+vZzTlyt/0cHe6e vOsZWl9RQiacb093GfkrnHf2xLmef9tonhIDukIKTr6HUHCHtjnUERZ+VgtBzRiZJN 61nptjPA3VulViYcrtlhYvxinE6mhRjac+d8cobPJSEgBKGbwbegSwYNHytXa0GoIL i7r6JpZ44plVxVTWqrbAbw9UgJrbtHFpCYWmUgFFFv7ZJnheh8+rn3GSEI94b6s7oN g9aHmr4EzO6/7HKb8FeBFnJJC3AUKvKEBSHqresWkVEktzyye0cy0lXerUPZCGXu/I 9JsmgP8chcbsw== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4XCzT45h0Rz4xPX; Wed, 25 Sep 2024 11:21:12 +1000 (AEST) Date: Wed, 25 Sep 2024 11:21:04 +1000 From: David Gibson To: Laurent Vivier Subject: Re: [PATCH 2/4] pcap: Add an offset argument in pcap_iov() Message-ID: References: <20240924154642.182857-1-lvivier@redhat.com> <20240924154642.182857-3-lvivier@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="S5Gn6TzkO1344em2" Content-Disposition: inline In-Reply-To: <20240924154642.182857-3-lvivier@redhat.com> Message-ID-Hash: CYV3Z2ZVZDGO4BLQS7DY5BVX3IQDMRTK X-Message-ID-Hash: CYV3Z2ZVZDGO4BLQS7DY5BVX3IQDMRTK X-MailFrom: dgibson@gandalf.ozlabs.org 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: passt-dev@passt.top 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: --S5Gn6TzkO1344em2 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Sep 24, 2024 at 05:46:40PM +0200, Laurent Vivier wrote: > The offset is passed directly to pcap_frame() and allows > any headers that are not part of the frame to > capture to be skipped. >=20 > Signed-off-by: Laurent Vivier Reviewed-by: David Gibson > --- > pcap.c | 5 +++-- > pcap.h | 2 +- > 2 files changed, 4 insertions(+), 3 deletions(-) >=20 > diff --git a/pcap.c b/pcap.c > index e6b5ced4a9f8..6ee6cdfd261a 100644 > --- a/pcap.c > +++ b/pcap.c > @@ -138,9 +138,10 @@ void pcap_multiple(const struct iovec *iov, size_t f= rame_parts, unsigned int n, > * @iov: Pointer to the array of struct iovec describing the I/O vector > * containing packet data to write, including L2 header > * @iovcnt: Number of buffers (@iov entries) > + * @offset: Offset of the L2 frame within the full data length > */ > /* cppcheck-suppress unusedFunction */ > -void pcap_iov(const struct iovec *iov, size_t iovcnt) > +void pcap_iov(const struct iovec *iov, size_t iovcnt, size_t offset) > { > struct timespec now; > =20 > @@ -148,7 +149,7 @@ void pcap_iov(const struct iovec *iov, size_t iovcnt) > return; > =20 > clock_gettime(CLOCK_REALTIME, &now); > - pcap_frame(iov, iovcnt, 0, &now); > + pcap_frame(iov, iovcnt, offset, &now); > } > =20 > /** > diff --git a/pcap.h b/pcap.h > index 533923749222..9795f2e8adc5 100644 > --- a/pcap.h > +++ b/pcap.h > @@ -9,7 +9,7 @@ > void pcap(const char *pkt, size_t l2len); > void pcap_multiple(const struct iovec *iov, size_t frame_parts, unsigned= int n, > size_t offset); > -void pcap_iov(const struct iovec *iov, size_t iovcnt); > +void pcap_iov(const struct iovec *iov, size_t iovcnt, size_t offset); > void pcap_init(struct ctx *c); > =20 > #endif /* PCAP_H */ --=20 David Gibson (he or they) | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you, not the other way | around. http://www.ozlabs.org/~dgibson --S5Gn6TzkO1344em2 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmbzZX8ACgkQzQJF27ox 2Gekvg/+OPHUykOPlFBoWdS5HotNYYSK1npehRvePLIwGr6JpzhSa15Y5MJKc/Sc hPWur8ZNrde835as+glcGhCGbgzKgYl90m/OyuxAvEXHwB2N40akFmhd5ZuBGqdv iDW4bAinmwmL5Y3TyZ9t5oGyfnq+QIv+wtl8cuawEWH0LJcQRlmkbuyf1cWAZBKB H7JxqabgU44UzfK9XFbRofCSWDV4Fn4LtcDUuJWYin+/CWWKzIRw5pMDpwmJ8Mfl MUBPAJYeBR43z8g3Uei92xWKDRnHF/ybp8YKBlMnEBn1QAZbdVWQT52HQfTv8AXr fQynBbrhkK5Sqb+7KIwsKBF1wwS+e6goOrDLtdOaFDrAwQ2/Y/JPC58VHAgX/69S IHbO9fYNXHS0ekp8ZvJyL01wEWlrE7yTv/sfepXaOEr2wuoGPPxFz6cGBqwvkyGZ hV/xnW6djUTX+KgcZ/ZFkxdoS9qJ9MWP6r+ebYltWNK8nCDu7AVlzRcM/Ty8ySxK pHFBAr7HX4TdbQHp7CB8zlDIBeM/KM5WuRRlbGUF5754EYZl2jLgHLY+T8/W9ICk VyTq+F60zUMn+b+XIOJkFafTEu48Vw+52fezKNxxVon6b30FE9QViSATdSezvwQi stZOiefBX9Fa0zwt9+3Rg2AIh5zd+092mVTTbSB5cTSe6ACBgQQ= =MSe5 -----END PGP SIGNATURE----- --S5Gn6TzkO1344em2--