mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: linmiaohe <linmiaohe@huawei.com>
To: <davem@davemloft.net>, <christian@brauner.io>,
	<roopa@cumulusnetworks.com>, <dsahern@gmail.com>,
	<Jason@zx2c4.com>, <netdev@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Cc: mousuanming <mousuanming@huawei.com>,
	Mingfangsen <mingfangsen@huawei.com>
Subject: Re: [PATCH] net: route: Fix vrf dst_entry ref count false increasing
Date: Sat, 4 May 2019 19:33:51 +0800	[thread overview]
Message-ID: <9f599716-eef7-a224-0bda-2f4e7c2f58b4@huawei.com> (raw)
In-Reply-To: <76551ed7-47ef-7442-69de-6fb42fff4708@huawei.com>



On 2019/5/4 16:03, linmiaohe wrote:
> From: Suanming.Mou <mousuanming@huawei.com>
> 
> When config ip in default vrf same as the ip in specified
> vrf, fib_lookup will return the route from table local
> even if the in device is an enslaved l3mdev. Then the
> dst_entry will hold the vrf device rather than loopback
> device in local_input of function ip_route_input_slow.
> So vrf dst_entry is false increased by route from table
> local.
> 
> Here is reproduce step:
> 1.enslave enp4s0 to vrf2, and config ip address:
> ip link add vrf2 type vrf table 1
> ip link set vrf2 up
> ip link set enp4s0 master vrf2
> ip addr ad 125.1.1.1/16 dev enp4s0
> 
> 2.config same ip in default vrf:
> ip addr ad 125.1.1.1/16 dev enp6s0
> 
> 3.config peer and ping:
> ip vrf exec vrf2 ping 125.1.1.2 -c 3
> 
> 4.del vrf2 link:
> ip link del vrf2
> 
> And "unregister_netdevice: waiting for vrf2 to become free.
> Usage count = 1" will occur.
> 
> Signed-off-by: Suanming.Mou <mousuanming@huawei.com>
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
> ---
>  net/core/fib_rules.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
> index ffbb827723a2..1a2c11ed1585 100644
> --- a/net/core/fib_rules.c
> +++ b/net/core/fib_rules.c
> @@ -263,6 +263,11 @@ static int fib_rule_match(struct fib_rule *rule, struct fib_rules_ops *ops,
>  	if (rule->tun_id && (rule->tun_id != fl->flowi_tun_key.tun_id))
>  		goto out;
> 
> +	if (!rule->l3mdev &&
> +	    (netif_index_is_l3_master(rule->fr_net, fl->flowi_iif) ||
> +	     netif_index_is_l3_master(rule->fr_net, fl->flowi_oif)))
> +		goto out;
> +
>  	if (rule->l3mdev && !l3mdev_fib_rule_match(rule->fr_net, fl, arg))
>  		goto out;
> 

I'am sorry, but I think this fix looks bad because this patch make vrf
working with other ip rule impossible. I will send anothor patch to fix
this. Thanks.


      reply	other threads:[~2019-05-04 11:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-04  8:03 linmiaohe
2019-05-04 11:33 ` linmiaohe [this message]

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=9f599716-eef7-a224-0bda-2f4e7c2f58b4@huawei.com \
    --to=linmiaohe@huawei.com \
    --cc=Jason@zx2c4.com \
    --cc=christian@brauner.io \
    --cc=davem@davemloft.net \
    --cc=dsahern@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingfangsen@huawei.com \
    --cc=mousuanming@huawei.com \
    --cc=netdev@vger.kernel.org \
    --cc=roopa@cumulusnetworks.com \
    /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

Powered by JetHome