[PATCH nf-next 1/7] netfilter: nft_objref: rename NFTA_OBJREF_IMM_TYPE to NFTA_OBJREF_TYPE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Prepare this netlink attribute to be used from maps too.

Signed-off-by: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx>
---
 include/uapi/linux/netfilter/nf_tables.h |  5 +++--
 net/netfilter/nft_objref.c               | 10 +++++-----
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/include/uapi/linux/netfilter/nf_tables.h b/include/uapi/linux/netfilter/nf_tables.h
index bb9b049310df..100261902b1b 100644
--- a/include/uapi/linux/netfilter/nf_tables.h
+++ b/include/uapi/linux/netfilter/nf_tables.h
@@ -1376,7 +1376,7 @@ enum nft_fwd_attributes {
 /**
  * enum nft_objref_attributes - nf_tables stateful object expression netlink attributes
  *
- * @NFTA_OBJREF_IMM_TYPE: object type for immediate reference (NLA_U32: nft_register)
+ * @NFTA_OBJREF_TYPE: object type for set reference (NLA_U32: nft_register)
  * @NFTA_OBJREF_IMM_NAME: object name for immediate reference (NLA_STRING)
  * @NFTA_OBJREF_SET_SREG: source register of the data to look for (NLA_U32: nft_registers)
  * @NFTA_OBJREF_SET_NAME: name of the set where to look for (NLA_STRING)
@@ -1384,7 +1384,8 @@ enum nft_fwd_attributes {
  */
 enum nft_objref_attributes {
 	NFTA_OBJREF_UNSPEC,
-	NFTA_OBJREF_IMM_TYPE,
+	NFTA_OBJREF_TYPE,
+#define NFTA_OBJREF_IMM_TYPE	NFTA_OBJREF_TYPE
 	NFTA_OBJREF_IMM_NAME,
 	NFTA_OBJREF_SET_SREG,
 	NFTA_OBJREF_SET_NAME,
diff --git a/net/netfilter/nft_objref.c b/net/netfilter/nft_objref.c
index bfd18d2b65a2..984f5b1810be 100644
--- a/net/netfilter/nft_objref.c
+++ b/net/netfilter/nft_objref.c
@@ -31,10 +31,10 @@ static int nft_objref_init(const struct nft_ctx *ctx,
 	u32 objtype;
 
 	if (!tb[NFTA_OBJREF_IMM_NAME] ||
-	    !tb[NFTA_OBJREF_IMM_TYPE])
+	    !tb[NFTA_OBJREF_TYPE])
 		return -EINVAL;
 
-	objtype = ntohl(nla_get_be32(tb[NFTA_OBJREF_IMM_TYPE]));
+	objtype = ntohl(nla_get_be32(tb[NFTA_OBJREF_TYPE]));
 	obj = nft_obj_lookup(ctx->net, ctx->table,
 			     tb[NFTA_OBJREF_IMM_NAME], objtype,
 			     genmask);
@@ -52,7 +52,7 @@ static int nft_objref_dump(struct sk_buff *skb, const struct nft_expr *expr)
 	const struct nft_object *obj = nft_objref_priv(expr);
 
 	if (nla_put_string(skb, NFTA_OBJREF_IMM_NAME, obj->key.name) ||
-	    nla_put_be32(skb, NFTA_OBJREF_IMM_TYPE,
+	    nla_put_be32(skb, NFTA_OBJREF_TYPE,
 			 htonl(obj->ops->type->type)))
 		goto nla_put_failure;
 
@@ -212,7 +212,7 @@ nft_objref_select_ops(const struct nft_ctx *ctx,
 	     tb[NFTA_OBJREF_SET_ID]))
 		return &nft_objref_map_ops;
 	else if (tb[NFTA_OBJREF_IMM_NAME] &&
-		 tb[NFTA_OBJREF_IMM_TYPE])
+		 tb[NFTA_OBJREF_TYPE])
 		return &nft_objref_ops;
 
 	return ERR_PTR(-EOPNOTSUPP);
@@ -221,7 +221,7 @@ nft_objref_select_ops(const struct nft_ctx *ctx,
 static const struct nla_policy nft_objref_policy[NFTA_OBJREF_MAX + 1] = {
 	[NFTA_OBJREF_IMM_NAME]	= { .type = NLA_STRING,
 				    .len = NFT_OBJ_MAXNAMELEN - 1 },
-	[NFTA_OBJREF_IMM_TYPE]	= { .type = NLA_U32 },
+	[NFTA_OBJREF_TYPE]	= { .type = NLA_U32 },
 	[NFTA_OBJREF_SET_SREG]	= { .type = NLA_U32 },
 	[NFTA_OBJREF_SET_NAME]	= { .type = NLA_STRING,
 				    .len = NFT_SET_MAXNAMELEN - 1 },
-- 
2.11.0




[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux