aboutgitcodebugslistschat
path: root/tap.h
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2023-01-06 11:43:19 +1100
committerStefano Brivio <sbrivio@redhat.com>2023-01-23 18:54:57 +0100
commit0fb7b2b9080afd6dc97d2909015a1a6f3e721a73 (patch)
tree16da0d2a9fba56e99b712d47f5ce4918b9d35391 /tap.h
parent2416310a17e37c61787a8d4366d09255cd784266 (diff)
downloadpasst-0fb7b2b9080afd6dc97d2909015a1a6f3e721a73.tar
passt-0fb7b2b9080afd6dc97d2909015a1a6f3e721a73.tar.gz
passt-0fb7b2b9080afd6dc97d2909015a1a6f3e721a73.tar.bz2
passt-0fb7b2b9080afd6dc97d2909015a1a6f3e721a73.tar.lz
passt-0fb7b2b9080afd6dc97d2909015a1a6f3e721a73.tar.xz
passt-0fb7b2b9080afd6dc97d2909015a1a6f3e721a73.tar.zst
passt-0fb7b2b9080afd6dc97d2909015a1a6f3e721a73.zip
tap: Use different io vector bases depending on tap type
Currently tap_send_frames() expects the frames it is given to include the vnet_len field, even in pasta mode which doesn't use it (although it need not be initialized in that case). To match, tap_iov_base() and tap_iov_len() construct the frame in that way. This will inconvenience future changes, so alter things to set the buffers to include just the frame needed by the tap backend type. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'tap.h')
-rw-r--r--tap.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/tap.h b/tap.h
index 8fe460a..40cf480 100644
--- a/tap.h
+++ b/tap.h
@@ -20,8 +20,10 @@ struct tap_hdr {
static inline size_t tap_hdr_len_(const struct ctx *c)
{
- (void)c;
- return sizeof(struct tap_hdr);
+ if (c->mode == MODE_PASST)
+ return sizeof(struct tap_hdr);
+ else
+ return sizeof(struct ethhdr);
}
/**