Unverified Commit f699943b authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files
parents 2b977914 f3228075
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -96,11 +96,32 @@ static bool u32_mt(const struct sk_buff *skb, struct xt_action_param *par)
	return ret ^ data->invert;
}

static int u32_mt_checkentry(const struct xt_mtchk_param *par)
{
	const struct xt_u32 *data = par->matchinfo;
	const struct xt_u32_test *ct;
	unsigned int i;

	if (data->ntests > ARRAY_SIZE(data->tests))
		return -EINVAL;

	for (i = 0; i < data->ntests; ++i) {
		ct = &data->tests[i];

		if (ct->nnums > ARRAY_SIZE(ct->location) ||
		    ct->nvalues > ARRAY_SIZE(ct->value))
			return -EINVAL;
	}

	return 0;
}

static struct xt_match xt_u32_mt_reg __read_mostly = {
	.name       = "u32",
	.revision   = 0,
	.family     = NFPROTO_UNSPEC,
	.match      = u32_mt,
	.checkentry = u32_mt_checkentry,
	.matchsize  = sizeof(struct xt_u32),
	.me         = THIS_MODULE,
};