From: Florian Westphal Date: Tue, 1 Feb 2022 16:48:50 +0000 (+0100) Subject: netfilter: nft_compat: suppress comment match X-Git-Tag: v6.1-rc5~1746^2~390^2~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c828414ac935bd3df96a8f7028d9d06a3db441e8;p=platform%2Fkernel%2Flinux-starfive.git netfilter: nft_compat: suppress comment match No need to have the datapath call the always-true comment match stub. Signed-off-by: Florian Westphal Signed-off-by: Pablo Neira Ayuso --- diff --git a/net/netfilter/nft_compat.c b/net/netfilter/nft_compat.c index f69cc73..5a46d82 100644 --- a/net/netfilter/nft_compat.c +++ b/net/netfilter/nft_compat.c @@ -731,6 +731,14 @@ static const struct nfnetlink_subsystem nfnl_compat_subsys = { static struct nft_expr_type nft_match_type; +static bool nft_match_reduce(struct nft_regs_track *track, + const struct nft_expr *expr) +{ + const struct xt_match *match = expr->ops->data; + + return strcmp(match->name, "comment") == 0; +} + static const struct nft_expr_ops * nft_match_select_ops(const struct nft_ctx *ctx, const struct nlattr * const tb[]) @@ -773,6 +781,7 @@ nft_match_select_ops(const struct nft_ctx *ctx, ops->dump = nft_match_dump; ops->validate = nft_match_validate; ops->data = match; + ops->reduce = nft_match_reduce; matchsize = NFT_EXPR_SIZE(XT_ALIGN(match->matchsize)); if (matchsize > NFT_MATCH_LARGE_THRESH) {