--- zzzz-none-000/linux-4.4.60/net/ipv6/addrconf.c 2017-04-08 07:53:53.000000000 +0000 +++ dragonfly-4020-701/linux-4.4.60/net/ipv6/addrconf.c 2018-11-08 13:36:17.000000000 +0000 @@ -1768,6 +1768,35 @@ return result; } +/* ipv6_dev_find() + * Find (and hold) net device that has the given address. + * Or NULL on failure. + */ +struct net_device *ipv6_dev_find(struct net *net, struct in6_addr *addr, + int strict) +{ + struct inet6_ifaddr *ifp; + struct net_device *dev; + + ifp = ipv6_get_ifaddr(net, addr, NULL, strict); + if (!ifp) + return NULL; + + if (!ifp->idev) { + in6_ifa_put(ifp); + return NULL; + } + + dev = ifp->idev->dev; + if (dev) + dev_hold(dev); + + in6_ifa_put(ifp); + + return dev; +} +EXPORT_SYMBOL(ipv6_dev_find); + /* Gets referenced address, destroys ifaddr */ static void addrconf_dad_stop(struct inet6_ifaddr *ifp, int dad_failed)