Skip to content

Commit

Permalink
tipc: set ub->ifindex for local ipv6 address
Browse files Browse the repository at this point in the history
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>
Acked-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Xin Long authored and David S. Miller committed Aug 5, 2020
1 parent 81f6cb3 commit 5a6f6f5
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions net/tipc/udp_media.c
Original file line number Diff line number Diff line change
Expand Up @@ -738,13 +738,21 @@ 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;
if (rmcast)
udp_conf.local_ip6 = in6addr_any;
else
udp_conf.local_ip6 = local.ipv6;
ub->ifindex = dev->ifindex;
b->mtu = 1280;
#endif
} else {
Expand Down

0 comments on commit 5a6f6f5

Please sign in to comment.