[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZL+CarW9SMFYsx/d@shredder>
Date: Tue, 25 Jul 2023 11:06:02 +0300
From: Ido Schimmel <idosch@...sch.org>
To: Hangbin Liu <liuhangbin@...il.com>
Cc: netdev@...r.kernel.org, "David S . Miller" <davem@...emloft.net>,
David Ahern <dsahern@...nel.org>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Thomas Haller <thaller@...hat.com>
Subject: Re: [PATCHv3 net] ipv6: do not match device when remove source route
On Mon, Jul 24, 2023 at 05:42:34PM +0800, Hangbin Liu wrote:
> On Sun, Jul 23, 2023 at 11:13:36AM +0300, Ido Schimmel wrote:
> > > BTW, to fix it, how about check if the IPv6 addr still exist. e.g.
> > >
> > > --- a/net/ipv6/route.c
> > > +++ b/net/ipv6/route.c
> > > @@ -4590,10 +4590,11 @@ static int fib6_remove_prefsrc(struct fib6_info *rt, void *arg)
> > > struct net_device *dev = ((struct arg_dev_net_ip *)arg)->dev;
> > > struct net *net = ((struct arg_dev_net_ip *)arg)->net;
> > > struct in6_addr *addr = ((struct arg_dev_net_ip *)arg)->addr;
> > > + u32 tb6_id = l3mdev_fib_table(dev) ? : RT_TABLE_MAIN;
> > >
> > > - if (!rt->nh &&
> > > - ((void *)rt->fib6_nh->fib_nh_dev == dev || !dev) &&
> > > - rt != net->ipv6.fib6_null_entry &&
> > > + if (rt != net->ipv6.fib6_null_entry &&
> > > + rt->fib6_table->tb6_id == tb6_id &&
> > > + !ipv6_chk_addr_and_flags(net, addr, NULL, true, 0, IFA_F_TENTATIVE) &&
> > > ipv6_addr_equal(addr, &rt->fib6_prefsrc.addr)) {
> >
> > ipv6_chk_addr_and_flags() is more expensive than ipv6_addr_equal() so
> > better to first check that route indeed uses the address as the
> > preferred source address and only then check if it exists.
>
> OK.
> >
> > Maybe you can even do it in rt6_remove_prefsrc(). That would be similar
> > to what IPv4 is doing.
>
> Do you mean call ipv6_chk_addr_and_flags() in rt6_remove_prefsrc()?
Yes.
Powered by blists - more mailing lists