Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 110d99ed authored by Jan Engelhardt's avatar Jan Engelhardt
Browse files

netfilter: xtables: remove xt_multiport revision 0



Superseded by xt_multiport revision 1 (introduction already predates
linux.git).

Signed-off-by: default avatarJan Engelhardt <jengelh@medozas.de>
parent 779dd630
Loading
Loading
Loading
Loading
+0 −77
Original line number Diff line number Diff line
@@ -26,23 +26,6 @@ MODULE_DESCRIPTION("Xtables: multiple port matching for TCP, UDP, UDP-Lite, SCTP
MODULE_ALIAS("ipt_multiport");
MODULE_ALIAS("ip6t_multiport");

/* Returns 1 if the port is matched by the test, 0 otherwise. */
static inline bool
ports_match_v0(const u_int16_t *portlist, enum xt_multiport_flags flags,
	       u_int8_t count, u_int16_t src, u_int16_t dst)
{
	unsigned int i;
	for (i = 0; i < count; i++) {
		if (flags != XT_MULTIPORT_DESTINATION && portlist[i] == src)
			return true;

		if (flags != XT_MULTIPORT_SOURCE && portlist[i] == dst)
			return true;
	}

	return false;
}

/* Returns 1 if the port is matched by the test, 0 otherwise. */
static inline bool
ports_match_v1(const struct xt_multiport_v1 *minfo,
@@ -88,30 +71,6 @@ ports_match_v1(const struct xt_multiport_v1 *minfo,
	return minfo->invert;
}

static bool
multiport_mt_v0(const struct sk_buff *skb, const struct xt_match_param *par)
{
	const __be16 *pptr;
	__be16 _ports[2];
	const struct xt_multiport *multiinfo = par->matchinfo;

	if (par->fragoff != 0)
		return false;

	pptr = skb_header_pointer(skb, par->thoff, sizeof(_ports), _ports);
	if (pptr == NULL) {
		/* We've been asked to examine this packet, and we
		 * can't.  Hence, no choice but to drop.
		 */
		pr_debug("Dropping evil offset=0 tinygram.\n");
		*par->hotdrop = true;
		return false;
	}

	return ports_match_v0(multiinfo->ports, multiinfo->flags,
	       multiinfo->count, ntohs(pptr[0]), ntohs(pptr[1]));
}

static bool
multiport_mt(const struct sk_buff *skb, const struct xt_match_param *par)
{
@@ -152,15 +111,6 @@ check(u_int16_t proto,
		&& count <= XT_MULTI_PORTS;
}

static int multiport_mt_check_v0(const struct xt_mtchk_param *par)
{
	const struct ipt_ip *ip = par->entryinfo;
	const struct xt_multiport *multiinfo = par->matchinfo;

	return check(ip->proto, ip->invflags, multiinfo->flags,
		     multiinfo->count);
}

static int multiport_mt_check(const struct xt_mtchk_param *par)
{
	const struct ipt_ip *ip = par->entryinfo;
@@ -170,15 +120,6 @@ static int multiport_mt_check(const struct xt_mtchk_param *par)
		     multiinfo->count);
}

static int multiport_mt6_check_v0(const struct xt_mtchk_param *par)
{
	const struct ip6t_ip6 *ip = par->entryinfo;
	const struct xt_multiport *multiinfo = par->matchinfo;

	return check(ip->proto, ip->invflags, multiinfo->flags,
		     multiinfo->count);
}

static int multiport_mt6_check(const struct xt_mtchk_param *par)
{
	const struct ip6t_ip6 *ip = par->entryinfo;
@@ -189,15 +130,6 @@ static int multiport_mt6_check(const struct xt_mtchk_param *par)
}

static struct xt_match multiport_mt_reg[] __read_mostly = {
	{
		.name		= "multiport",
		.family		= NFPROTO_IPV4,
		.revision	= 0,
		.checkentry	= multiport_mt_check_v0,
		.match		= multiport_mt_v0,
		.matchsize	= sizeof(struct xt_multiport),
		.me		= THIS_MODULE,
	},
	{
		.name		= "multiport",
		.family		= NFPROTO_IPV4,
@@ -207,15 +139,6 @@ static struct xt_match multiport_mt_reg[] __read_mostly = {
		.matchsize	= sizeof(struct xt_multiport_v1),
		.me		= THIS_MODULE,
	},
	{
		.name		= "multiport",
		.family		= NFPROTO_IPV6,
		.revision	= 0,
		.checkentry	= multiport_mt6_check_v0,
		.match		= multiport_mt_v0,
		.matchsize	= sizeof(struct xt_multiport),
		.me		= THIS_MODULE,
	},
	{
		.name		= "multiport",
		.family		= NFPROTO_IPV6,