mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-30 10:00:03 -04:00
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:
committed by
Florian Westphal
parent
5efbced92e
commit
68fc6c6470
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user