netfilter: xt_tcpmss: add checkentry for parameter validation

Add tcpmss_mt_check() that validates mss_min <= mss_max and
invert <= 1.

Signed-off-by: Feng Wu <wufengwufengwufeng@gmail.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
This commit is contained in:
Feng Wu
2026-06-25 04:44:26 -04:00
committed by Florian Westphal
parent 5efbced92e
commit 68fc6c6470

View File

@@ -78,10 +78,23 @@ tcpmss_mt(const struct sk_buff *skb, struct xt_action_param *par)
return false;
}
static int tcpmss_mt_check(const struct xt_mtchk_param *par)
{
const struct xt_tcpmss_match_info *info = par->matchinfo;
if (info->mss_min > info->mss_max)
return -EINVAL;
if (info->invert > 1)
return -EINVAL;
return 0;
}
static struct xt_match tcpmss_mt_reg[] __read_mostly = {
{
.name = "tcpmss",
.family = NFPROTO_IPV4,
.checkentry = tcpmss_mt_check,
.match = tcpmss_mt,
.matchsize = sizeof(struct xt_tcpmss_match_info),
.proto = IPPROTO_TCP,