On Mon, 29 Apr 2024 17:09:31 +1000
David Gibson <david(a)gibson.dropbear.id.au> wrote:
Recent changes to the TCP code (reworking of the
buffer handling) have
meant that it now (again) deals explicitly with the MODE_PASST specific
vnet_len field, instead of using the (partial) abstractions provided by the
tap layer.
The abstractions we had don't work for the new TCP structure, so make some
new ones that do: tap_hdr_iov() which constructs an iovec suitable for
containing (just) the TAP specific header and tap_hdr_update() which
updates it as necessary per-packet.
Signed-off-by: David Gibson <david(a)gibson.dropbear.id.au>
---
tap.h | 27 +++++++++++++++++++++++++++
tcp.c | 40 +++++++++++++++-------------------------
2 files changed, 42 insertions(+), 25 deletions(-)
diff --git a/tap.h b/tap.h
index dbc23b31..75aa3f03 100644
--- a/tap.h
+++ b/tap.h
@@ -16,6 +16,33 @@ struct tap_hdr {
uint32_t vnet_len;
} __attribute__((packed));
+/**
+ * tap_hdr_iov() - struct iovec for a tap header
+ * @c: Execution context
+ * @taph: Pointer to tap specific header buffer
+ *
+ * Returns: A struct iovec covering the correct portion of @taph to use as the
+ * TAP specific header in the current configuration.
Nit: s/TAP/tap/ (not an acronym).
Fixed, thanks.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!