Re: [PATCH 2/3] netfilter: nft_meta: split nft_meta_init() into two functions for get/set

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

 



On Mon, Mar 31, 2014 at 03:37:43PM +0300, Tomasz Bursztyka wrote:
> Hi Patrick,
> 
> >diff --git a/net/netfilter/nft_meta.c b/net/netfilter/nft_meta.c
> >index 425cf39..6d0b8cc2 100644
> >--- a/net/netfilter/nft_meta.c
> >+++ b/net/netfilter/nft_meta.c
> >@@ -170,21 +170,15 @@ static const struct nla_policy nft_meta_policy[NFTA_META_MAX + 1] = {
> >  	[NFTA_META_SREG]	= { .type = NLA_U32 },
> >  };
> >-static int nft_meta_init_validate_set(uint32_t key)
> >+static int nft_meta_get_init(const struct nft_ctx *ctx,
> >+			     const struct nft_expr *expr,
> >+			     const struct nlattr * const tb[])
> >  {
> >-	switch (key) {
> >-	case NFT_META_MARK:
> >-	case NFT_META_PRIORITY:
> >-	case NFT_META_NFTRACE:
> >-		return 0;
> >-	default:
> >-		return -EOPNOTSUPP;
> >-	}
> >-}
> >+	struct nft_meta *priv = nft_expr_priv(expr);
> >+	int err;
> >-static int nft_meta_init_validate_get(uint32_t key)
> >-{
> >-	switch (key) {
> 
> With the disappearance of nft_meta_init_validate_get(), I will need to add
> an #ifdef/#endif clause for bridge key support. Or I would copy and adapt
> this new nft_meta_get_init() in nft_meta_bridge.c.
> 
> Don't you think nft_meta_validate_get() could be kept?

Why don't you add a bridge specific init function and invoke
nft_meta_get_init() for unknown keys?

It could be kept by passing a unsigned int *size for returning the size
of the key, but I would prefer to solve this differently.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux