Skip to contentSkip to conversation

expr: add new nft_tee expression

PATCH New Pablo Neira Ayuso 1 participant 1 message Jun 19, 2015 netfilter

lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/1 expr: add new nft_tee expression

From: Arturo Borrero <[email protected]>

This patch gives support in libnftnl to the new nft_tee expression.

---
 include/libnftnl/expr.h             |    5 +
 include/linux/netfilter/nf_tables.h |   14 +++
 src/Makefile.am                     |    1 +
 src/expr/tee.c                      |  234 +++++++++++++++++++++++++++++++++++
 src/expr_ops.c                      |    2 +
 5 files changed, 256 insertions(+)
 create mode 100644 src/expr/tee.c
include/libnftnl/expr.h +5 -0
index 94ff125..39c2f0e 100644
@@ -174,6 +174,11 @@ enum {
 	NFT_EXPR_REDIR_FLAGS,
 };
 
+enum {
+	NFT_EXPR_TEE_SREG_GW		= NFT_RULE_EXPR_ATTR_BASE,
+	NFT_EXPR_TEE_OIFNAME,
+};
+
 #ifdef __cplusplus
 } /* extern "C" */
 #endif
include/linux/netfilter/nf_tables.h +14 -0
index fa05fbe..22af138 100644
@@ -950,6 +950,20 @@ enum nft_redir_attributes {
 #define NFTA_REDIR_MAX		(__NFTA_REDIR_MAX - 1)
 
 /**
+ * enum nft_tee_attributes - nf_tables tee expression netlink attributes
+ *
+ * @NFTA_TEE_SREG_GW: source register of gateway address (NLA_NESTED: nft_data_attributes)
+ * @NFTA_TEE_OIFNAME: output interface name (NLA_STRING)
+ */
+enum nft_tee_attributes {
+	NFTA_TEE_UNSPEC,
+	NFTA_TEE_SREG_GW,
+	NFTA_TEE_OIFNAME,
+	__NFTA_TEE_MAX
+};
+#define NFTA_TEE_MAX		(__NFTA_TEE_MAX - 1)
+
+/**
  * enum nft_gen_attributes - nf_tables ruleset generation attributes
  *
  * @NFTA_GEN_ID: Ruleset generation ID (NLA_U32)
src/Makefile.am +1 -0
index dd87240..7c3a25e 100644
@@ -41,4 +41,5 @@ libnftnl_la_SOURCES = utils.c		\
 		      expr/target.c	\
 		      expr/masq.c	\
 		      expr/redir.c	\
+		      expr/tee.c	\
 		      libnftnl.map
src/expr/tee.c new file +234 -0

234 lines not on this page · raw message

src/expr_ops.c +2 -0
index 2de5805..3fea180 100644
@@ -23,6 +23,7 @@ extern struct expr_ops expr_ops_redir;
 extern struct expr_ops expr_ops_reject;
 extern struct expr_ops expr_ops_queue;
 extern struct expr_ops expr_ops_target;
+extern struct expr_ops expr_ops_tee;
 extern struct expr_ops expr_ops_dynset;
 
 static struct expr_ops *expr_ops[] = {
@@ -45,6 +46,7 @@ static struct expr_ops *expr_ops[] = {
 	&expr_ops_reject,
 	&expr_ops_queue,
 	&expr_ops_target,
+	&expr_ops_tee,
 	&expr_ops_dynset,
 	NULL,
 };
Signature · 1 line
1.7.10.4