Skip to contentSkip to conversation

libnetfilter_queue: Implement API to set per-queue flags

PATCH In review Krishna Kumar 2 participants 2 messages Jun 6, 2012 – Jul 14, 2012 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libnetfilter_queue: Implement API to set per-queue flags

Implement API to set per-queue flags. This is initially used to implement fail-open support in NFQUEUE.

---
 include/libnetfilter_queue/libnetfilter_queue.h    |    3 
 include/libnetfilter_queue/linux_nfnetlink_queue.h |    5 +
 src/libnetfilter_queue.c                           |   42 +++++++++++
 3 files changed, 50 insertions(+)
include/libnetfilter_queue/libnetfilter_queue.h +3 -0
diff -ruNp org/include/libnetfilter_queue/libnetfilter_queue.h new/include/libnetfilter_queue/libnetfilter_queue.h
@@ -56,6 +56,9 @@ extern int nfq_set_mode(struct nfq_q_han
 int nfq_set_queue_maxlen(struct nfq_q_handle *qh,
 			u_int32_t queuelen);
 
+extern int nfq_set_queue_flags(struct nfq_q_handle *qh,
+			       uint32_t mask, uint32_t flags);
+
 extern int nfq_set_verdict(struct nfq_q_handle *qh,
 			     u_int32_t id,
 			     u_int32_t verdict,
include/libnetfilter_queue/linux_nfnetlink_queue.h +5 -0
diff -ruNp org/include/libnetfilter_queue/linux_nfnetlink_queue.h new/include/libnetfilter_queue/linux_nfnetlink_queue.h
@@ -87,8 +87,13 @@ enum nfqnl_attr_config {
 	NFQA_CFG_CMD,			/* nfqnl_msg_config_cmd */
 	NFQA_CFG_PARAMS,		/* nfqnl_msg_config_params */
 	NFQA_CFG_QUEUE_MAXLEN,		/* u_int32_t */
+	NFQA_CFG_MASK,			/* identify which flags to change */
+	NFQA_CFG_FLAGS,			/* value of these flags (__u32) */
 	__NFQA_CFG_MAX
 };
 #define NFQA_CFG_MAX (__NFQA_CFG_MAX-1)
 
+/* Flags/options for NFQA_CFG_FLAGS */
+#define NFQA_CFG_F_FAIL_OPEN		(1 << 0)
+
 #endif /* _NFNETLINK_QUEUE_H */
src/libnetfilter_queue.c +42 -0

48 lines not on this page · raw message

#1 lore raw
Quoted 2 lines · Krishna Kumar

Implement API to set per-queue flags. This is initially used to implement fail-open support in NFQUEUE.

Applied with minor spots (see below), thanks.

Quoted 25 lines
---
 include/libnetfilter_queue/libnetfilter_queue.h    |    3 
 include/libnetfilter_queue/linux_nfnetlink_queue.h |    5 +
 src/libnetfilter_queue.c                           |   42 +++++++++++
 3 files changed, 50 insertions(+)

diff -ruNp org/include/libnetfilter_queue/libnetfilter_queue.h new/include/libnetfilter_queue/libnetfilter_queue.h

include/libnetfilter_queue/libnetfilter_queue.h +3 -0
@@ -56,6 +56,9 @@ extern int nfq_set_mode(struct nfq_q_han
 int nfq_set_queue_maxlen(struct nfq_q_handle *qh,
 			u_int32_t queuelen);
 
+extern int nfq_set_queue_flags(struct nfq_q_handle *qh,
+			       uint32_t mask, uint32_t flags);
+
 extern int nfq_set_verdict(struct nfq_q_handle *qh,
 			     u_int32_t id,
 			     u_int32_t verdict,

diff -ruNp org/include/libnetfilter_queue/linux_nfnetlink_queue.h new/include/libnetfilter_queue/linux_nfnetlink_queue.h

include/libnetfilter_queue/linux_nfnetlink_queue.h +0 -0
@@ -87,8 +87,13 @@ enum nfqnl_attr_config {
 	NFQA_CFG_CMD,			/* nfqnl_msg_config_cmd */

include/libnetfilter_queue/linux_nfnetlink_queue.h enum nfqnl_attr_config { · line 97

Quoted 10 lines
include/libnetfilter_queue/linux_nfnetlink_queue.h +4 -0
 	NFQA_CFG_PARAMS,		/* nfqnl_msg_config_params */
 	NFQA_CFG_QUEUE_MAXLEN,		/* u_int32_t */
+	NFQA_CFG_MASK,			/* identify which flags to change */
+	NFQA_CFG_FLAGS,			/* value of these flags (__u32) */
 	__NFQA_CFG_MAX
 };
 #define NFQA_CFG_MAX (__NFQA_CFG_MAX-1)
 
+/* Flags/options for NFQA_CFG_FLAGS */
+#define NFQA_CFG_F_FAIL_OPEN		(1 << 0)

added NFQA_CFG_F_CONNTRACK and _MAX.

I've also bumped LIBVERSION.