Skip to contentSkip to conversation

nfq: NFQNL_MSG_VERDICT_BATCH support

PATCH In review Florian Westphal 2 participants 2 messages Sep 5, 2011 – Sep 6, 2011 netfilter

lore
Share & tools
lore

Florian Westphal

author maintainer
#0 lore raw

PATCH 1/1 nfq: NFQNL_MSG_VERDICT_BATCH support

add nfq_set_verdict_batch() and nfq_set_verdict_batch2 (to also set the nfmark of all packets).

verdicts sent by the _batch variant will affect all queued skbs whose id is smaller or equal to the given id.

This facility is available from Linux 3.1 onwards.

While at it, add notes on use of NF_STOLEN and NF_REPEAT verdicts.

---
 include/libnetfilter_queue/libnetfilter_queue.h    |    9 +++
 include/libnetfilter_queue/linux_nfnetlink_queue.h |    1 +
 src/libnetfilter_queue.c                           |   57 +++++++++++++++++---
 3 files changed, 60 insertions(+), 7 deletions(-)
include/libnetfilter_queue/libnetfilter_queue.h +9 -0
index 295de66..28bf2b1 100644
@@ -69,6 +69,15 @@ extern int nfq_set_verdict2(struct nfq_q_handle *qh,
 			    u_int32_t datalen,
 			    const unsigned char *buf);
 
+extern int nfq_set_verdict_batch(struct nfq_q_handle *qh,
+			    u_int32_t id,
+			    u_int32_t verdict);
+
+extern int nfq_set_verdict_batch2(struct nfq_q_handle *qh,
+			    u_int32_t id,
+			    u_int32_t verdict,
+			    u_int32_t mark);
+
 extern __attribute__((deprecated))
 int nfq_set_verdict_mark(struct nfq_q_handle *qh, 
 			 u_int32_t id,
include/libnetfilter_queue/linux_nfnetlink_queue.h +1 -0
index 191b094..6b4f86d 100644
@@ -11,6 +11,7 @@ enum nfqnl_msg_types {
 	NFQNL_MSG_PACKET,		/* packet from kernel to userspace */
 	NFQNL_MSG_VERDICT,		/* verdict from userspace to kernel */
 	NFQNL_MSG_CONFIG,		/* connect to a particular queue */
+	NFQNL_MSG_VERDICT_BATCH,	/* batch verdict from userspace to kernel */
 
 	NFQNL_MSG_MAX
 };
src/libnetfilter_queue.c +50 -7

104 lines not on this page · raw message

Signature · 1 line
1.7.3.4
#1 lore raw
Quoted 7 lines · Florian Westphal

add nfq_set_verdict_batch() and nfq_set_verdict_batch2 (to also set the nfmark of all packets).

verdicts sent by the _batch variant will affect all queued skbs whose id is smaller or equal to the given id.

This facility is available from Linux 3.1 onwards.

Thanks Florian.

Quoted 1 line

While at it, add notes on use of NF_STOLEN and NF_REPEAT verdicts.

I'm going to split this patch into two chunks. This doesn't really belong here.