From: Ido Schimmel <idosch@idosch.org>
To: Hangbin Liu <liuhangbin@gmail.com>
Cc: netdev@vger.kernel.org, "David S . Miller" <davem@davemloft.net>,
David Ahern <dsahern@kernel.org>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Thomas Haller <thaller@redhat.com>
Subject: Re: [PATCHv3 net] ipv6: do not match device when remove source route
Date: Tue, 25 Jul 2023 11:06:02 +0300 [thread overview]
Message-ID: <ZL+CarW9SMFYsx/d@shredder> (raw)
In-Reply-To: <ZL5HijWsqLgVMHav@Laptop-X1>
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.
prev parent reply other threads:[~2023-07-25 8:06 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-20 6:59 [PATCHv3 net] ipv6: do not match device when remove source route Hangbin Liu
2023-07-20 13:22 ` Ido Schimmel
2023-07-20 14:49 ` Ido Schimmel
2023-07-21 8:59 ` Hangbin Liu
2023-07-23 8:13 ` Ido Schimmel
2023-07-23 18:12 ` David Ahern
2023-07-25 10:06 ` Ido Schimmel
2023-07-25 22:37 ` David Ahern
2023-07-26 9:46 ` Hangbin Liu
2023-07-24 9:42 ` Hangbin Liu
2023-07-25 8:06 ` Ido Schimmel [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=ZL+CarW9SMFYsx/d@shredder \
--to=idosch@idosch.org \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=liuhangbin@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=thaller@redhat.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