+
+ try_v6:
+ if (!v6)
+ continue;
+#if IS_ENABLED(CONFIG_IPV6)
+ in6_dev = __in6_dev_get(dev);
+ if (!in6_dev) {
+ if (!in_dev)
+ CWARN("lnet: Interface %s has no IP status.\n",
+ dev->name);
+ continue;
+ }
+
+ list_for_each_entry_rcu(ifa6, &in6_dev->addr_list, if_list) {
+ if (ifa6->flags & IFA_F_TEMPORARY)
+ continue;
+ if (nip >= nalloc) {
+ struct lnet_inetdev *tmp;
+
+ nalloc += LNET_INTERFACES_NUM;
+ tmp = krealloc(ifaces, nalloc * sizeof(*tmp),
+ GFP_KERNEL);
+ if (!tmp) {
+ kfree(ifaces);
+ ifaces = NULL;
+ nip = -ENOMEM;
+ goto unlock_rtnl;
+ }
+ ifaces = tmp;
+ }
+
+ ifaces[nip].li_cpt = cpt;
+ ifaces[nip].li_iff_master = !!(flags & IFF_MASTER);
+ ifaces[nip].li_ipv6 = true;
+ ifaces[nip].li_index = dev->ifindex;
+ memcpy(ifaces[nip].li_ipv6addr,
+ &ifa6->addr, sizeof(struct in6_addr));
+ strlcpy(ifaces[nip].li_name, dev->name,
+ sizeof(ifaces[nip].li_name));
+ nip++;
+ /* As different IPv6 addresses don't have unique
+ * labels, it is safest just to use the first
+ * and ignore the rest.
+ */
+ break;
+ }
+#endif /* IS_ENABLED(CONFIG_IPV6) */
+