From: Xin Long <lucien.xin@gmail.com>
To: David Ahern <dsahern@gmail.com>, Ying Xue <ying.xue@windriver.com>
Cc: Hideaki Yoshifuji <hideaki.yoshifuji@miraclelinux.com>,
network dev <netdev@vger.kernel.org>, davem <davem@davemloft.net>,
Jon Maloy <jon.maloy@ericsson.com>,
tipc-discussion@lists.sourceforge.net,
Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
Subject: Re: [PATCH net 1/2] ipv6: add ipv6_dev_find()
Date: Fri, 7 Aug 2020 15:30:58 +0800 [thread overview]
Message-ID: <CADvbK_f+NK9Zf+t-7xfzA7T8Xftw+CdoEW6jy=V6TDqT6PQ_AA@mail.gmail.com> (raw)
In-Reply-To: <1f510387-b612-6cb4-8ee6-ff52f6ff6796@gmail.com>
On Thu, Aug 6, 2020 at 10:03 PM David Ahern <dsahern@gmail.com> wrote:
>
> On 8/6/20 2:55 AM, Xin Long wrote:
> > On Thu, Aug 6, 2020 at 10:50 AM Hideaki Yoshifuji
> > <hideaki.yoshifuji@miraclelinux.com> wrote:
> >>
> >> Hi,
> >>
> >> 2020年8月4日(火) 0:35 Xin Long <lucien.xin@gmail.com>:
> >>>
> >>> This is to add an ip_dev_find like function for ipv6, used to find
> >>> the dev by saddr.
> >>>
> >>> It will be used by TIPC protocol. So also export it.
> >>>
> >>> Signed-off-by: Xin Long <lucien.xin@gmail.com>
> >>> ---
> >>> include/net/addrconf.h | 2 ++
> >>> net/ipv6/addrconf.c | 39 +++++++++++++++++++++++++++++++++++++++
> >>> 2 files changed, 41 insertions(+)
> >>>
> >>> diff --git a/include/net/addrconf.h b/include/net/addrconf.h
> >>> index 8418b7d..ba3f6c15 100644
> >>> --- a/include/net/addrconf.h
> >>> +++ b/include/net/addrconf.h
> >>> @@ -97,6 +97,8 @@ bool ipv6_chk_custom_prefix(const struct in6_addr *addr,
> >>>
> >>> int ipv6_chk_prefix(const struct in6_addr *addr, struct net_device *dev);
> >>>
> >>> +struct net_device *ipv6_dev_find(struct net *net, const struct in6_addr *addr);
> >>> +
> >>
> >> How do we handle link-local addresses?
> > This is what "if (!result)" branch meant to do:
> >
> > + if (!result) {
> > + struct rt6_info *rt;
> > +
> > + rt = rt6_lookup(net, addr, NULL, 0, NULL, 0);
> > + if (rt) {
> > + dev = rt->dst.dev;
> > + ip6_rt_put(rt);
> > + }
> > + } else {
> > + dev = result->idev->dev;
> > + }
> >
>
> the stated purpose of this function is to find the netdevice to which an
> address is attached. A route lookup should not be needed. Walking the
> address hash list finds the address and hence the netdev or it does not.
Hi, David,
Sorry. it does. I misunderstood the code in __ip_dev_find().
I will delete the rt6_lookup() part from ipv6_dev_find().
Also for the compatibility, tipc part should change to:
@@ -741,10 +741,8 @@ static int tipc_udp_enable(struct net *net,
struct tipc_bearer *b,
struct net_device *dev;
dev = ipv6_dev_find(net, &local.ipv6);
if (!dev)
ub->ifindex = dev->ifindex;
as when dev is not found from the hash list, it should fall back to
the old tipc code.
Ying, what do you think?
next prev parent reply other threads:[~2020-08-07 7:19 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-03 15:34 [PATCH net 0/2] net: fix a mcast issue for tipc udp media Xin Long
2020-08-03 15:34 ` [PATCH net 1/2] ipv6: add ipv6_dev_find() Xin Long
2020-08-03 15:34 ` [PATCH net 2/2] tipc: set ub->ifindex for local ipv6 address Xin Long
2020-08-05 11:03 ` Ying Xue
2020-08-05 11:03 ` [PATCH net 1/2] ipv6: add ipv6_dev_find() Ying Xue
2020-08-05 16:31 ` David Ahern
2020-08-06 2:49 ` Hideaki Yoshifuji
2020-08-06 8:55 ` Xin Long
2020-08-06 14:03 ` David Ahern
2020-08-07 7:30 ` Xin Long [this message]
2020-08-07 9:25 ` Hideaki Yoshifuji
2020-08-09 11:04 ` Xin Long
2020-08-11 2:25 ` Hideaki Yoshifuji
2020-08-13 16:25 ` Xin Long
2020-08-05 19:20 ` [PATCH net 0/2] net: fix a mcast issue for tipc udp media David Miller
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='CADvbK_f+NK9Zf+t-7xfzA7T8Xftw+CdoEW6jy=V6TDqT6PQ_AA@mail.gmail.com' \
--to=lucien.xin@gmail.com \
--cc=davem@davemloft.net \
--cc=dsahern@gmail.com \
--cc=hideaki.yoshifuji@miraclelinux.com \
--cc=jon.maloy@ericsson.com \
--cc=kuznet@ms2.inr.ac.ru \
--cc=netdev@vger.kernel.org \
--cc=tipc-discussion@lists.sourceforge.net \
--cc=ying.xue@windriver.com \
--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;
as well as URLs for NNTP newsgroup(s).