Skip to content

Commit 5e7d695

Browse files
Florian Westphalummakynes
authored andcommitted
netfilter: exthdr: split netlink dump function
so eval and uncoming eval_set versions can reuse a common helper. Signed-off-by: Florian Westphal <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent a181770 commit 5e7d695

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

net/netfilter/nft_exthdr.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,12 +180,8 @@ static int nft_exthdr_init(const struct nft_ctx *ctx,
180180
NFT_DATA_VALUE, priv->len);
181181
}
182182

183-
static int nft_exthdr_dump(struct sk_buff *skb, const struct nft_expr *expr)
183+
static int nft_exthdr_dump_common(struct sk_buff *skb, const struct nft_exthdr *priv)
184184
{
185-
const struct nft_exthdr *priv = nft_expr_priv(expr);
186-
187-
if (nft_dump_register(skb, NFTA_EXTHDR_DREG, priv->dreg))
188-
goto nla_put_failure;
189185
if (nla_put_u8(skb, NFTA_EXTHDR_TYPE, priv->type))
190186
goto nla_put_failure;
191187
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)
202198
return -1;
203199
}
204200

201+
static int nft_exthdr_dump(struct sk_buff *skb, const struct nft_expr *expr)
202+
{
203+
const struct nft_exthdr *priv = nft_expr_priv(expr);
204+
205+
if (nft_dump_register(skb, NFTA_EXTHDR_DREG, priv->dreg))
206+
return -1;
207+
208+
return nft_exthdr_dump_common(skb, priv);
209+
}
210+
205211
static struct nft_expr_type nft_exthdr_type;
206212
static const struct nft_expr_ops nft_exthdr_ipv6_ops = {
207213
.type = &nft_exthdr_type,

0 commit comments

Comments
 (0)