All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Florian Westphal <fw@strlen.de>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH v3 2/2] netfilter: xt_addrtype: ipv6 support
Date: Wed, 16 Mar 2011 14:54:54 +0100	[thread overview]
Message-ID: <4D80C12E.4010107@trash.net> (raw)
In-Reply-To: <1300214971-20345-2-git-send-email-fw@strlen.de>

On 15.03.2011 19:49, Florian Westphal wrote:
> +static bool match_type6(struct net *net, const struct net_device *dev,
> +				const struct in6_addr *addr, u16 mask)
> +{
> +	int addr_type = ipv6_addr_type(addr);
> +
> +	if ((mask & XT_ADDRTYPE_MULTICAST) &&
> +	    !(addr_type & IPV6_ADDR_MULTICAST))
> +		return false;
> +	if ((mask & XT_ADDRTYPE_UNICAST) && !(addr_type & IPV6_ADDR_UNICAST))
> +		return false;
> +	if ((mask & XT_ADDRTYPE_UNSPEC) && addr_type != IPV6_ADDR_ANY)
> +		return false;
> +
> +	if ((XT_ADDRTYPE_LOCAL | XT_ADDRTYPE_ANYCAST |
> +	     XT_ADDRTYPE_UNREACHABLE) & mask) {
> +		struct rt6_info *rt;
> +		u32 type;
> +		int ifindex = dev ? dev->ifindex : 0;
> +
> +		rt = rt6_lookup(net, addr, NULL, ifindex, !!dev);

Florian, I just noticed that this will pull in the IPv6 module just
by loading the xt_addrtype module. Can we convert this to use
nf_ip6_afinfo->route() instead?

> +
> +		type = xt_addrtype_rt6_to_type(rt);
> +
> +		dst_release(&rt->dst);
> +		return !!(mask & type);
> +	}
> +	return true;
> +}

  parent reply	other threads:[~2011-03-16 13:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-15 18:49 [PATCH v3 1/2] netfilter: ipt_addrtype: rename to xt_addrtype Florian Westphal
2011-03-15 18:49 ` [PATCH v3 2/2] netfilter: xt_addrtype: ipv6 support Florian Westphal
2011-03-15 19:41   ` Patrick McHardy
2011-03-16 13:54   ` Patrick McHardy [this message]
2011-03-16 14:19     ` Florian Westphal
2011-03-16 15:59       ` Florian Westphal
2011-03-16 16:03         ` Patrick McHardy
2011-03-18 23:26     ` Florian Westphal
2011-03-20 14:39       ` Patrick McHardy
2011-03-15 19:41 ` [PATCH v3 1/2] netfilter: ipt_addrtype: rename to xt_addrtype Patrick McHardy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D80C12E.4010107@trash.net \
    --to=kaber@trash.net \
    --cc=fw@strlen.de \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.