summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFeng Wu <wufengwufengwufeng@gmail.com>2026-06-25 04:44:26 -0400
committerFlorian Westphal <fw@strlen.de>2026-07-02 12:17:14 +0200
commit68fc6c6470d653fcfa7655f4f2b36ff444cb72b3 (patch)
treeee8bcbb03c14bc282cd9499a878ed786277fa691
parent5efbced92ec19514528ce6b18ae8e1b755cc4552 (diff)
downloadlinux-68fc6c6470d653fcfa7655f4f2b36ff444cb72b3.tar.gz
linux-68fc6c6470d653fcfa7655f4f2b36ff444cb72b3.zip
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>
-rw-r--r--net/netfilter/xt_tcpmss.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/net/netfilter/xt_tcpmss.c b/net/netfilter/xt_tcpmss.c
index b9da8269161d..b08b077d7f0a 100644
--- a/net/netfilter/xt_tcpmss.c
+++ b/net/netfilter/xt_tcpmss.c
@@ -78,10 +78,23 @@ dropit:
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,