ipv6: addrconf: move ipv6_chk_same_addr() to avoid forward declaration
ipv6_chk_same_addr() is only used by ipv6_add_addr_hash(), so moving it avoids a forward declaration. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
fa6e23e2b2
commit
56fc709b7a
|
@ -192,8 +192,6 @@ static void ipv6_ifa_notify(int event, struct inet6_ifaddr *ifa);
|
||||||
|
|
||||||
static void inet6_prefix_notify(int event, struct inet6_dev *idev,
|
static void inet6_prefix_notify(int event, struct inet6_dev *idev,
|
||||||
struct prefix_info *pinfo);
|
struct prefix_info *pinfo);
|
||||||
static bool ipv6_chk_same_addr(struct net *net, const struct in6_addr *addr,
|
|
||||||
struct net_device *dev);
|
|
||||||
|
|
||||||
static struct ipv6_devconf ipv6_devconf __read_mostly = {
|
static struct ipv6_devconf ipv6_devconf __read_mostly = {
|
||||||
.forwarding = 0,
|
.forwarding = 0,
|
||||||
|
@ -957,6 +955,23 @@ static u32 inet6_addr_hash(const struct in6_addr *addr)
|
||||||
return hash_32(ipv6_addr_hash(addr), IN6_ADDR_HSIZE_SHIFT);
|
return hash_32(ipv6_addr_hash(addr), IN6_ADDR_HSIZE_SHIFT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool ipv6_chk_same_addr(struct net *net, const struct in6_addr *addr,
|
||||||
|
struct net_device *dev)
|
||||||
|
{
|
||||||
|
unsigned int hash = inet6_addr_hash(addr);
|
||||||
|
struct inet6_ifaddr *ifp;
|
||||||
|
|
||||||
|
hlist_for_each_entry(ifp, &inet6_addr_lst[hash], addr_lst) {
|
||||||
|
if (!net_eq(dev_net(ifp->idev->dev), net))
|
||||||
|
continue;
|
||||||
|
if (ipv6_addr_equal(&ifp->addr, addr)) {
|
||||||
|
if (!dev || ifp->idev->dev == dev)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
static int ipv6_add_addr_hash(struct net_device *dev, struct inet6_ifaddr *ifa)
|
static int ipv6_add_addr_hash(struct net_device *dev, struct inet6_ifaddr *ifa)
|
||||||
{
|
{
|
||||||
unsigned int hash;
|
unsigned int hash;
|
||||||
|
@ -1856,22 +1871,6 @@ int ipv6_chk_addr_and_flags(struct net *net, const struct in6_addr *addr,
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(ipv6_chk_addr_and_flags);
|
EXPORT_SYMBOL(ipv6_chk_addr_and_flags);
|
||||||
|
|
||||||
static bool ipv6_chk_same_addr(struct net *net, const struct in6_addr *addr,
|
|
||||||
struct net_device *dev)
|
|
||||||
{
|
|
||||||
unsigned int hash = inet6_addr_hash(addr);
|
|
||||||
struct inet6_ifaddr *ifp;
|
|
||||||
|
|
||||||
hlist_for_each_entry(ifp, &inet6_addr_lst[hash], addr_lst) {
|
|
||||||
if (!net_eq(dev_net(ifp->idev->dev), net))
|
|
||||||
continue;
|
|
||||||
if (ipv6_addr_equal(&ifp->addr, addr)) {
|
|
||||||
if (!dev || ifp->idev->dev == dev)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Compares an address/prefix_len with addresses on device @dev.
|
/* Compares an address/prefix_len with addresses on device @dev.
|
||||||
* If one is found it returns true.
|
* If one is found it returns true.
|
||||||
|
|
Loading…
Reference in a new issue