aboutgitcodebugslistschat
path: root/pcap.h
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2023-01-06 11:43:06 +1100
committerStefano Brivio <sbrivio@redhat.com>2023-01-23 18:54:27 +0100
commitd3089eb0eab412e34bd91f7853e3e72429912edb (patch)
treea44132cb653fba3312a6c699f85de04cd32a34e0 /pcap.h
parentcb3c1ce30760aff10a4952a1c3b85f61a6eeacfd (diff)
downloadpasst-d3089eb0eab412e34bd91f7853e3e72429912edb.tar
passt-d3089eb0eab412e34bd91f7853e3e72429912edb.tar.gz
passt-d3089eb0eab412e34bd91f7853e3e72429912edb.tar.bz2
passt-d3089eb0eab412e34bd91f7853e3e72429912edb.tar.lz
passt-d3089eb0eab412e34bd91f7853e3e72429912edb.tar.xz
passt-d3089eb0eab412e34bd91f7853e3e72429912edb.tar.zst
passt-d3089eb0eab412e34bd91f7853e3e72429912edb.zip
pcap: Replace pcapm() with pcap_multiple()
pcapm() captures multiple frames from a msghdr, however the only thing it cares about in the msghdr is the list of buffers, where it assumes there is one frame to capture per buffer. That's what we want for its single caller but it's not the only obvious choice here (one frame per msghdr would arguably make more sense in isolation). In addition pcapm() has logic that only makes sense in the context of the passt specific path its called from: it skips the first 4 bytes of each buffer, because those have the qemu vnet_len rather than the frame proper. Make this clearer by replacing pcapm() with pcap_multiple() which more explicitly takes one struct iovec per frame, and parameterizes how much of each buffer to skip (i.e. the offset of the frame within the buffer). Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'pcap.h')
-rw-r--r--pcap.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/pcap.h b/pcap.h
index 9e1736c..eafc89b 100644
--- a/pcap.h
+++ b/pcap.h
@@ -7,7 +7,7 @@
#define PCAP_H
void pcap(const char *pkt, size_t len);
-void pcapm(const struct msghdr *mh);
+void pcap_multiple(const struct iovec *iov, unsigned int n, size_t offset);
void pcapmm(const struct mmsghdr *mmh, unsigned int vlen);
void pcap_init(struct ctx *c);