From: Xin Long <lucien.xin@gmail.com>
To: network dev <netdev@vger.kernel.org>
Cc: davem@davemloft.net, Jon Maloy <jon.maloy@ericsson.com>,
Ying Xue <ying.xue@windriver.com>,
tipc-discussion@lists.sourceforge.net,
Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
Subject: [PATCH net 2/2] tipc: set ub->ifindex for local ipv6 address
Date: Mon, 3 Aug 2020 23:34:47 +0800 [thread overview]
Message-ID: <1806063a61881feadcbf4372f2683114c61b526a.1596468610.git.lucien.xin@gmail.com> (raw)
In-Reply-To: <7ba2ca17347249b980731e7a76ba3e24a9e37720.1596468610.git.lucien.xin@gmail.com>
In-Reply-To: <cover.1596468610.git.lucien.xin@gmail.com>
Without ub->ifindex set for ipv6 address in tipc_udp_enable(),
ipv6_sock_mc_join() may make the wrong dev join the multicast
address in enable_mcast(). This causes that tipc links would
never be created.
So fix it by getting the right netdev and setting ub->ifindex,
as it does for ipv4 address.
Reported-by: Shuang Li <shuali@redhat.com>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
net/tipc/udp_media.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/net/tipc/udp_media.c b/net/tipc/udp_media.c
index 28a283f..9dec596 100644
--- a/net/tipc/udp_media.c
+++ b/net/tipc/udp_media.c
@@ -738,6 +738,13 @@ static int tipc_udp_enable(struct net *net, struct tipc_bearer *b,
b->mtu = b->media->mtu;
#if IS_ENABLED(CONFIG_IPV6)
} else if (local.proto == htons(ETH_P_IPV6)) {
+ struct net_device *dev;
+
+ dev = ipv6_dev_find(net, &local.ipv6);
+ if (!dev) {
+ err = -ENODEV;
+ goto err;
+ }
udp_conf.family = AF_INET6;
udp_conf.use_udp6_tx_checksums = true;
udp_conf.use_udp6_rx_checksums = true;
@@ -745,6 +752,7 @@ static int tipc_udp_enable(struct net *net, struct tipc_bearer *b,
udp_conf.local_ip6 = in6addr_any;
else
udp_conf.local_ip6 = local.ipv6;
+ ub->ifindex = dev->ifindex;
b->mtu = 1280;
#endif
} else {
--
2.1.0
next prev parent reply other threads:[~2020-08-03 15:35 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 ` Xin Long [this message]
2020-08-05 11:03 ` [PATCH net 2/2] tipc: set ub->ifindex for local ipv6 address 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
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=1806063a61881feadcbf4372f2683114c61b526a.1596468610.git.lucien.xin@gmail.com \
--to=lucien.xin@gmail.com \
--cc=davem@davemloft.net \
--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).