expr: queue: add NFTA_QUEUE_SREG_QNUM attr support
PATCH v2 1/1 expr: queue: add NFTA_QUEUE_SREG_QNUM attr support
From: Liping Zhang <[email protected]>
After adding _SREG_QNUM attr, queuenum is not must option anymore, so we must test NFTNL_EXPR_QUEUE_NUM first before dumpping queue num in snprintf_default. Also add a tailing space in snprintf_default, this is consistent with other expressions.
Signed-off-by Liping Zhang <[email protected]>
---
V2: adjust two sreg to one sreg, keep consistent with the kernel
include/buffer.h | 1 + include/libnftnl/expr.h | 1 + include/linux/netfilter/nf_tables.h | 2 ++ src/expr/queue.c | 57 ++++++++++++++++++++++++++++++++----- 4 files changed, 54 insertions(+), 7 deletions(-)
include/buffer.h +1 -0
@@ -77,6 +77,7 @@ int nftnl_buf_reg(struct nftnl_buf *b, int type, union nftnl_data_reg *reg,#define SREG_PROTO_MIN "sreg_proto_min"#define SREG_KEY "sreg_key"#define SREG_DATA "sreg_data" +#define SREG_QNUM "sreg_qnum"#define SREG "sreg"#define TABLE "table"#define TOTAL "total"
include/libnftnl/expr.h +1 -0
@@ -176,6 +176,7 @@ enum {NFTNL_EXPR_QUEUE_NUM =NFTNL_EXPR_BASE ,NFTNL_EXPR_QUEUE_TOTAL ,NFTNL_EXPR_QUEUE_FLAGS , + NFTNL_EXPR_QUEUE_SREG_QNUM, }; enum {
include/linux/netfilter/nf_tables.h +2 -0
@@ -888,12 +888,14 @@ enum nft_log_attributes {* @NFTA_QUEUE_NUM: netlink queue to send messages to (NLA_U16) * @NFTA_QUEUE_TOTAL: number of queues to load balance packets on (NLA_U16) * @NFTA_QUEUE_FLAGS: various flags (NLA_U16) +* @NFTA_QUEUE_SREG_QNUM: source register of queue number (NLA_U32: nft_registers) */ enum nft_queue_attributes {NFTA_QUEUE_UNSPEC ,NFTA_QUEUE_NUM ,NFTA_QUEUE_TOTAL ,NFTA_QUEUE_FLAGS , +NFTA_QUEUE_SREG_QNUM , __NFTA_QUEUE_MAX };#define NFTA_QUEUE_MAX (__NFTA_QUEUE_MAX - 1)
src/expr/queue.c +50 -7
145 lines not on this page · raw message
Signature · 1 line
2.5.5