Commit 5e7d695a authored by Florian Westphal's avatar Florian Westphal Committed by Pablo Neira Ayuso

netfilter: exthdr: split netlink dump function

so eval and uncoming eval_set versions can reuse a common helper.
Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent a1817700
...@@ -180,12 +180,8 @@ static int nft_exthdr_init(const struct nft_ctx *ctx, ...@@ -180,12 +180,8 @@ static int nft_exthdr_init(const struct nft_ctx *ctx,
NFT_DATA_VALUE, priv->len); NFT_DATA_VALUE, priv->len);
} }
static int nft_exthdr_dump(struct sk_buff *skb, const struct nft_expr *expr) static int nft_exthdr_dump_common(struct sk_buff *skb, const struct nft_exthdr *priv)
{ {
const struct nft_exthdr *priv = nft_expr_priv(expr);
if (nft_dump_register(skb, NFTA_EXTHDR_DREG, priv->dreg))
goto nla_put_failure;
if (nla_put_u8(skb, NFTA_EXTHDR_TYPE, priv->type)) if (nla_put_u8(skb, NFTA_EXTHDR_TYPE, priv->type))
goto nla_put_failure; goto nla_put_failure;
if (nla_put_be32(skb, NFTA_EXTHDR_OFFSET, htonl(priv->offset))) if (nla_put_be32(skb, NFTA_EXTHDR_OFFSET, htonl(priv->offset)))
...@@ -202,6 +198,16 @@ static int nft_exthdr_dump(struct sk_buff *skb, const struct nft_expr *expr) ...@@ -202,6 +198,16 @@ static int nft_exthdr_dump(struct sk_buff *skb, const struct nft_expr *expr)
return -1; return -1;
} }
static int nft_exthdr_dump(struct sk_buff *skb, const struct nft_expr *expr)
{
const struct nft_exthdr *priv = nft_expr_priv(expr);
if (nft_dump_register(skb, NFTA_EXTHDR_DREG, priv->dreg))
return -1;
return nft_exthdr_dump_common(skb, priv);
}
static struct nft_expr_type nft_exthdr_type; static struct nft_expr_type nft_exthdr_type;
static const struct nft_expr_ops nft_exthdr_ipv6_ops = { static const struct nft_expr_ops nft_exthdr_ipv6_ops = {
.type = &nft_exthdr_type, .type = &nft_exthdr_type,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment