From: Florian Westphal <fw@strlen.de>
To: linmiaohe <linmiaohe@huawei.com>
Cc: pablo@netfilter.org, kadlec@blackhole.kfki.hu, dsahern@gmail.com,
davem@davemloft.net, yoshfuji@linux-ipv6.org,
netfilter-devel@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org,
Mingfangsen <mingfangsen@huawei.com>
Subject: Re: [PATCH] net: netfilter: Fix ipv6 rp_filter dropping vrf packets by mistake
Date: Wed, 24 Apr 2019 10:02:14 +0200 [thread overview]
Message-ID: <20190424080214.vadrfiufcv6xa3cm@breakpoint.cc> (raw)
In-Reply-To: <094b7376-f796-71b6-7a81-28866b0f882b@huawei.com>
linmiaohe <linmiaohe@huawei.com> wrote:
[ CC dsa, dropped some CCs ]
> When firewall is enabled with rp_filter, vrf ipv6 packets
> will be dropped because in device is vrf but out device
> is an enslaved device. So rt->rt6i_idev->dev != dev and
> maybe return false in func rpfilter_lookup_reverse6.
>
> Here is the out message when I ping the peer:
> ip vrf exec vrf1 ping 2013::2 -c 1
> 1 packets transmitted, 0 received, 100% packet loss, time 0ms
>
> The drop info in /var/log/message:
> Apr 24 14:59:45 localhost kernel: [81316.158259] rpfilter_DROP: IN=vrf1
> OUT= MAC=52:54:00:9e:dd:c1:52:54:00:4f:81:38:86:dd
> SRC=2013:0000:0000:0000:0000:0000:0000:0002
> DST=2013:0000:0000:0000:0000:0000:0000:0001 LEN=104 TC=0 HOPLIMIT=64
> FLOWLBL=1032942 PROTO=ICMPv6 TYPE=129 CODE=0 ID=14943 SEQ=1
>
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
> ---
> net/ipv6/netfilter/ip6t_rpfilter.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/net/ipv6/netfilter/ip6t_rpfilter.c b/net/ipv6/netfilter/ip6t_rpfilter.c
> index c3c6b09acdc4..5cbc91f53736 100644
> --- a/net/ipv6/netfilter/ip6t_rpfilter.c
> +++ b/net/ipv6/netfilter/ip6t_rpfilter.c
> @@ -73,6 +73,12 @@ static bool rpfilter_lookup_reverse6(struct net *net, const struct sk_buff *skb,
> goto out;
> }
>
> + if (netif_is_l3_master(dev)) {
> + dev = __dev_get_by_index(dev_net(dev), IP6CB(skb)->iif);
> + if (!dev)
> + goto out;
I suspect this should be 'dev_get_by_index_rcu'.
next prev parent reply other threads:[~2019-04-24 8:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-24 7:27 linmiaohe
2019-04-24 8:02 ` Florian Westphal [this message]
2019-04-24 9:11 ` linmiaohe
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=20190424080214.vadrfiufcv6xa3cm@breakpoint.cc \
--to=fw@strlen.de \
--cc=davem@davemloft.net \
--cc=dsahern@gmail.com \
--cc=kadlec@blackhole.kfki.hu \
--cc=linmiaohe@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingfangsen@huawei.com \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
--cc=yoshfuji@linux-ipv6.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®