Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
@@ -1521,16 +1521,31 @@ static int ipv6_count_addresses(struct inet6_dev *idev)
|
||||
|
||||
int ipv6_chk_addr(struct net *net, const struct in6_addr *addr,
|
||||
const struct net_device *dev, int strict)
|
||||
{
|
||||
return ipv6_chk_addr_and_flags(net, addr, dev, strict, IFA_F_TENTATIVE);
|
||||
}
|
||||
EXPORT_SYMBOL(ipv6_chk_addr);
|
||||
|
||||
int ipv6_chk_addr_and_flags(struct net *net, const struct in6_addr *addr,
|
||||
const struct net_device *dev, int strict,
|
||||
u32 banned_flags)
|
||||
{
|
||||
struct inet6_ifaddr *ifp;
|
||||
unsigned int hash = inet6_addr_hash(addr);
|
||||
u32 ifp_flags;
|
||||
|
||||
rcu_read_lock_bh();
|
||||
hlist_for_each_entry_rcu(ifp, &inet6_addr_lst[hash], addr_lst) {
|
||||
if (!net_eq(dev_net(ifp->idev->dev), net))
|
||||
continue;
|
||||
/* Decouple optimistic from tentative for evaluation here.
|
||||
* Ban optimistic addresses explicitly, when required.
|
||||
*/
|
||||
ifp_flags = (ifp->flags&IFA_F_OPTIMISTIC)
|
||||
? (ifp->flags&~IFA_F_TENTATIVE)
|
||||
: ifp->flags;
|
||||
if (ipv6_addr_equal(&ifp->addr, addr) &&
|
||||
!(ifp->flags&IFA_F_TENTATIVE) &&
|
||||
!(ifp_flags&banned_flags) &&
|
||||
(dev == NULL || ifp->idev->dev == dev ||
|
||||
!(ifp->scope&(IFA_LINK|IFA_HOST) || strict))) {
|
||||
rcu_read_unlock_bh();
|
||||
@@ -1541,7 +1556,7 @@ int ipv6_chk_addr(struct net *net, const struct in6_addr *addr,
|
||||
rcu_read_unlock_bh();
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(ipv6_chk_addr);
|
||||
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)
|
||||
@@ -4579,6 +4594,22 @@ static int inet6_set_iftoken(struct inet6_dev *idev, struct in6_addr *token)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct nla_policy inet6_af_policy[IFLA_INET6_MAX + 1] = {
|
||||
[IFLA_INET6_ADDR_GEN_MODE] = { .type = NLA_U8 },
|
||||
[IFLA_INET6_TOKEN] = { .len = sizeof(struct in6_addr) },
|
||||
};
|
||||
|
||||
static int inet6_validate_link_af(const struct net_device *dev,
|
||||
const struct nlattr *nla)
|
||||
{
|
||||
struct nlattr *tb[IFLA_INET6_MAX + 1];
|
||||
|
||||
if (dev && !__in6_dev_get(dev))
|
||||
return -EAFNOSUPPORT;
|
||||
|
||||
return nla_parse_nested(tb, IFLA_INET6_MAX, nla, inet6_af_policy);
|
||||
}
|
||||
|
||||
static int inet6_set_link_af(struct net_device *dev, const struct nlattr *nla)
|
||||
{
|
||||
int err = -EINVAL;
|
||||
@@ -5409,6 +5440,7 @@ static struct rtnl_af_ops inet6_ops __read_mostly = {
|
||||
.family = AF_INET6,
|
||||
.fill_link_af = inet6_fill_link_af,
|
||||
.get_link_af_size = inet6_get_link_af_size,
|
||||
.validate_link_af = inet6_validate_link_af,
|
||||
.set_link_af = inet6_set_link_af,
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user