Skip to content

Commit 5a6f6f5

Browse files
lxindavem330
authored andcommitted
tipc: set ub->ifindex for local ipv6 address
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 <[email protected]> Signed-off-by: Xin Long <[email protected]> Acked-by: Ying Xue <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 81f6cb3 commit 5a6f6f5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

net/tipc/udp_media.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,13 +738,21 @@ static int tipc_udp_enable(struct net *net, struct tipc_bearer *b,
738738
b->mtu = b->media->mtu;
739739
#if IS_ENABLED(CONFIG_IPV6)
740740
} else if (local.proto == htons(ETH_P_IPV6)) {
741+
struct net_device *dev;
742+
743+
dev = ipv6_dev_find(net, &local.ipv6);
744+
if (!dev) {
745+
err = -ENODEV;
746+
goto err;
747+
}
741748
udp_conf.family = AF_INET6;
742749
udp_conf.use_udp6_tx_checksums = true;
743750
udp_conf.use_udp6_rx_checksums = true;
744751
if (rmcast)
745752
udp_conf.local_ip6 = in6addr_any;
746753
else
747754
udp_conf.local_ip6 = local.ipv6;
755+
ub->ifindex = dev->ifindex;
748756
b->mtu = 1280;
749757
#endif
750758
} else {

0 commit comments

Comments
 (0)