On 07/30/2015 12:51 PM, Jason Wang wrote:
On 07/29/2015 06:51 PM, Yang Hongyang wrote:
Capture packets that will be sent.
Signed-off-by: Yang Hongyang <yan...@cn.fujitsu.com>
---
include/net/filter.h | 16 +++++++++++++
net/net.c | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 80 insertions(+), 1 deletion(-)
diff --git a/include/net/filter.h b/include/net/filter.h
index 1dd86cf..5292563 100644
--- a/include/net/filter.h
+++ b/include/net/filter.h
@@ -12,11 +12,27 @@
#include "qemu/typedefs.h"
typedef void (FilterCleanup) (NetFilterState *);
+/*
+ * Return:
+ * 0: finished handling the packet, we should continue
+ * size: filter stolen this packet, we stop pass this packet further
+ */
+typedef ssize_t (FilterReceive)(NetFilterState *, NetClientState *sender,
+ unsigned flags, const uint8_t *, size_t);
Looks like there's no need for this. Just add a wrapper and pretend a
single iov should be ok?
Yes, should be ok, will also make concrete filter implement simpler, only
implement receive_iov is enough.
.
--
Thanks,
Yang.