aboutgitcodebugslistschat
path: root/pcap.c
diff options
context:
space:
mode:
authorLaurent Vivier <lvivier@redhat.com>2024-10-03 16:51:05 +0200
committerStefano Brivio <sbrivio@redhat.com>2024-10-04 14:51:02 +0200
commitfd8334b25dfa0cf4a93bb7fad6728f3bd0e31c6d (patch)
tree31285442095f8bb07f28ea3b91919ba636a4f88c /pcap.c
parent72e7d3024b037afe2cb00c772eea0807286633bd (diff)
downloadpasst-fd8334b25dfa0cf4a93bb7fad6728f3bd0e31c6d.tar
passt-fd8334b25dfa0cf4a93bb7fad6728f3bd0e31c6d.tar.gz
passt-fd8334b25dfa0cf4a93bb7fad6728f3bd0e31c6d.tar.bz2
passt-fd8334b25dfa0cf4a93bb7fad6728f3bd0e31c6d.tar.lz
passt-fd8334b25dfa0cf4a93bb7fad6728f3bd0e31c6d.tar.xz
passt-fd8334b25dfa0cf4a93bb7fad6728f3bd0e31c6d.tar.zst
passt-fd8334b25dfa0cf4a93bb7fad6728f3bd0e31c6d.zip
pcap: Add an offset argument in pcap_iov()
The offset is passed directly to pcap_frame() and allows any headers that are not part of the frame to capture to be skipped. Signed-off-by: Laurent Vivier <lvivier@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'pcap.c')
-rw-r--r--pcap.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/pcap.c b/pcap.c
index e6b5ced..6ee6cdf 100644
--- a/pcap.c
+++ b/pcap.c
@@ -138,9 +138,10 @@ void pcap_multiple(const struct iovec *iov, size_t frame_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;
@@ -148,7 +149,7 @@ void pcap_iov(const struct iovec *iov, size_t iovcnt)
return;
clock_gettime(CLOCK_REALTIME, &now);
- pcap_frame(iov, iovcnt, 0, &now);
+ pcap_frame(iov, iovcnt, offset, &now);
}
/**