Commit ce12f7dd authored by David S. Miller's avatar David S. Miller

Merge branch 'mlxsw-extack'

David Ahern says:

====================
mlxsw: spectrum_router: Add extack messages for RIF and VRF overflow

Currently, exceeding the number of VRF instances or the number of router
interfaces either fails with a non-intuitive EBUSY:
    $ ip li set swp1s1.6 vrf vrf-1s1-6 up
    RTNETLINK answers: Device or resource busy

or fails silently (IPv6) since the checks are done in a work queue. This
set adds support for the address validator notifier to spectrum which
allows ext-ack based messages to be returned on failure.

To make that happen the IPv6 version needs to be converted from atomic
to blocking (patch 2), and then support for extack needs to be added
to the notifier (patch 3). Patch 1 reworks the locking in ipv6_add_addr
to work better in the atomic and non-atomic code paths. Patches 4 and 5
add the validator notifier to spectrum and then plumb the extack argument
through spectrum_router.

With this set, VRF overflows fail with:
   $ ip li set swp1s1.6 vrf vrf-1s1-6 up
   Error: spectrum: Exceeded number of supported VRF.

and RIF overflows fail with:
   $ ip addr add dev swp1s2.191 10.12.191.1/24
   Error: spectrum: Exceeded number of supported router interfaces.

v2 -> v3
- fix surround context of patch 4 which was altered by c30f5d01

v1 -> v2
- fix error path in ipv6_add_addr: reset rt to NULL (Ido comment) and
  add in6_dev_put on ifa once the hold has been done

RFC -> v1
- addressed various comments from Ido
- refactored ipv6_add_addr to allow ifa's to be allocated with
  GFP_KERNEL as requested by DaveM
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 6b1f8eda f8fa9b4e
...@@ -4521,9 +4521,16 @@ static int mlxsw_sp_netdevice_event(struct notifier_block *nb, ...@@ -4521,9 +4521,16 @@ static int mlxsw_sp_netdevice_event(struct notifier_block *nb,
return notifier_from_errno(err); return notifier_from_errno(err);
} }
static struct notifier_block mlxsw_sp_inetaddr_valid_nb __read_mostly = {
.notifier_call = mlxsw_sp_inetaddr_valid_event,
};
static struct notifier_block mlxsw_sp_inetaddr_nb __read_mostly = { static struct notifier_block mlxsw_sp_inetaddr_nb __read_mostly = {
.notifier_call = mlxsw_sp_inetaddr_event, .notifier_call = mlxsw_sp_inetaddr_event,
.priority = 10, /* Must be called before FIB notifier block */ };
static struct notifier_block mlxsw_sp_inet6addr_valid_nb __read_mostly = {
.notifier_call = mlxsw_sp_inet6addr_valid_event,
}; };
static struct notifier_block mlxsw_sp_inet6addr_nb __read_mostly = { static struct notifier_block mlxsw_sp_inet6addr_nb __read_mostly = {
...@@ -4548,7 +4555,9 @@ static int __init mlxsw_sp_module_init(void) ...@@ -4548,7 +4555,9 @@ static int __init mlxsw_sp_module_init(void)
{ {
int err; int err;
register_inetaddr_validator_notifier(&mlxsw_sp_inetaddr_valid_nb);
register_inetaddr_notifier(&mlxsw_sp_inetaddr_nb); register_inetaddr_notifier(&mlxsw_sp_inetaddr_nb);
register_inet6addr_validator_notifier(&mlxsw_sp_inet6addr_valid_nb);
register_inet6addr_notifier(&mlxsw_sp_inet6addr_nb); register_inet6addr_notifier(&mlxsw_sp_inet6addr_nb);
register_netevent_notifier(&mlxsw_sp_router_netevent_nb); register_netevent_notifier(&mlxsw_sp_router_netevent_nb);
...@@ -4567,7 +4576,9 @@ static int __init mlxsw_sp_module_init(void) ...@@ -4567,7 +4576,9 @@ static int __init mlxsw_sp_module_init(void)
err_core_driver_register: err_core_driver_register:
unregister_netevent_notifier(&mlxsw_sp_router_netevent_nb); unregister_netevent_notifier(&mlxsw_sp_router_netevent_nb);
unregister_inet6addr_notifier(&mlxsw_sp_inet6addr_nb); unregister_inet6addr_notifier(&mlxsw_sp_inet6addr_nb);
unregister_inet6addr_validator_notifier(&mlxsw_sp_inet6addr_valid_nb);
unregister_inetaddr_notifier(&mlxsw_sp_inetaddr_nb); unregister_inetaddr_notifier(&mlxsw_sp_inetaddr_nb);
unregister_inetaddr_validator_notifier(&mlxsw_sp_inetaddr_valid_nb);
return err; return err;
} }
...@@ -4577,7 +4588,9 @@ static void __exit mlxsw_sp_module_exit(void) ...@@ -4577,7 +4588,9 @@ static void __exit mlxsw_sp_module_exit(void)
mlxsw_core_driver_unregister(&mlxsw_sp_driver); mlxsw_core_driver_unregister(&mlxsw_sp_driver);
unregister_netevent_notifier(&mlxsw_sp_router_netevent_nb); unregister_netevent_notifier(&mlxsw_sp_router_netevent_nb);
unregister_inet6addr_notifier(&mlxsw_sp_inet6addr_nb); unregister_inet6addr_notifier(&mlxsw_sp_inet6addr_nb);
unregister_inet6addr_validator_notifier(&mlxsw_sp_inet6addr_valid_nb);
unregister_inetaddr_notifier(&mlxsw_sp_inetaddr_nb); unregister_inetaddr_notifier(&mlxsw_sp_inetaddr_nb);
unregister_inetaddr_validator_notifier(&mlxsw_sp_inetaddr_valid_nb);
} }
module_init(mlxsw_sp_module_init); module_init(mlxsw_sp_module_init);
......
...@@ -391,8 +391,12 @@ int mlxsw_sp_router_netevent_event(struct notifier_block *unused, ...@@ -391,8 +391,12 @@ int mlxsw_sp_router_netevent_event(struct notifier_block *unused,
int mlxsw_sp_netdevice_router_port_event(struct net_device *dev); int mlxsw_sp_netdevice_router_port_event(struct net_device *dev);
int mlxsw_sp_inetaddr_event(struct notifier_block *unused, int mlxsw_sp_inetaddr_event(struct notifier_block *unused,
unsigned long event, void *ptr); unsigned long event, void *ptr);
int mlxsw_sp_inetaddr_valid_event(struct notifier_block *unused,
unsigned long event, void *ptr);
int mlxsw_sp_inet6addr_event(struct notifier_block *unused, int mlxsw_sp_inet6addr_event(struct notifier_block *unused,
unsigned long event, void *ptr); unsigned long event, void *ptr);
int mlxsw_sp_inet6addr_valid_event(struct notifier_block *unused,
unsigned long event, void *ptr);
int mlxsw_sp_netdevice_vrf_event(struct net_device *l3_dev, unsigned long event, int mlxsw_sp_netdevice_vrf_event(struct net_device *l3_dev, unsigned long event,
struct netdev_notifier_changeupper_info *info); struct netdev_notifier_changeupper_info *info);
bool mlxsw_sp_netdev_is_ipip(const struct mlxsw_sp *mlxsw_sp, bool mlxsw_sp_netdev_is_ipip(const struct mlxsw_sp *mlxsw_sp,
......
...@@ -808,10 +808,6 @@ static int ipvlan_addr6_event(struct notifier_block *unused, ...@@ -808,10 +808,6 @@ static int ipvlan_addr6_event(struct notifier_block *unused,
struct net_device *dev = (struct net_device *)if6->idev->dev; struct net_device *dev = (struct net_device *)if6->idev->dev;
struct ipvl_dev *ipvlan = netdev_priv(dev); struct ipvl_dev *ipvlan = netdev_priv(dev);
/* FIXME IPv6 autoconf calls us from bh without RTNL */
if (in_softirq())
return NOTIFY_DONE;
if (!netif_is_ipvlan(dev)) if (!netif_is_ipvlan(dev))
return NOTIFY_DONE; return NOTIFY_DONE;
...@@ -851,8 +847,11 @@ static int ipvlan_addr6_validator_event(struct notifier_block *unused, ...@@ -851,8 +847,11 @@ static int ipvlan_addr6_validator_event(struct notifier_block *unused,
switch (event) { switch (event) {
case NETDEV_UP: case NETDEV_UP:
if (ipvlan_addr_busy(ipvlan->port, &i6vi->i6vi_addr, true)) if (ipvlan_addr_busy(ipvlan->port, &i6vi->i6vi_addr, true)) {
NL_SET_ERR_MSG(i6vi->extack,
"Address already assigned to an ipvlan device");
return notifier_from_errno(-EADDRINUSE); return notifier_from_errno(-EADDRINUSE);
}
break; break;
} }
...@@ -921,8 +920,11 @@ static int ipvlan_addr4_validator_event(struct notifier_block *unused, ...@@ -921,8 +920,11 @@ static int ipvlan_addr4_validator_event(struct notifier_block *unused,
switch (event) { switch (event) {
case NETDEV_UP: case NETDEV_UP:
if (ipvlan_addr_busy(ipvlan->port, &ivi->ivi_addr, false)) if (ipvlan_addr_busy(ipvlan->port, &ivi->ivi_addr, false)) {
NL_SET_ERR_MSG(ivi->extack,
"Address already assigned to an ipvlan device");
return notifier_from_errno(-EADDRINUSE); return notifier_from_errno(-EADDRINUSE);
}
break; break;
} }
......
...@@ -154,6 +154,7 @@ struct in_ifaddr { ...@@ -154,6 +154,7 @@ struct in_ifaddr {
struct in_validator_info { struct in_validator_info {
__be32 ivi_addr; __be32 ivi_addr;
struct in_device *ivi_dev; struct in_device *ivi_dev;
struct netlink_ext_ack *extack;
}; };
int register_inetaddr_notifier(struct notifier_block *nb); int register_inetaddr_notifier(struct notifier_block *nb);
......
...@@ -55,6 +55,7 @@ struct prefix_info { ...@@ -55,6 +55,7 @@ struct prefix_info {
struct in6_validator_info { struct in6_validator_info {
struct in6_addr i6vi_addr; struct in6_addr i6vi_addr;
struct inet6_dev *i6vi_dev; struct inet6_dev *i6vi_dev;
struct netlink_ext_ack *extack;
}; };
#define IN6_ADDR_HSIZE_SHIFT 4 #define IN6_ADDR_HSIZE_SHIFT 4
......
...@@ -444,7 +444,7 @@ static void check_lifetime(struct work_struct *work); ...@@ -444,7 +444,7 @@ static void check_lifetime(struct work_struct *work);
static DECLARE_DELAYED_WORK(check_lifetime_work, check_lifetime); static DECLARE_DELAYED_WORK(check_lifetime_work, check_lifetime);
static int __inet_insert_ifa(struct in_ifaddr *ifa, struct nlmsghdr *nlh, static int __inet_insert_ifa(struct in_ifaddr *ifa, struct nlmsghdr *nlh,
u32 portid) u32 portid, struct netlink_ext_ack *extack)
{ {
struct in_device *in_dev = ifa->ifa_dev; struct in_device *in_dev = ifa->ifa_dev;
struct in_ifaddr *ifa1, **ifap, **last_primary; struct in_ifaddr *ifa1, **ifap, **last_primary;
...@@ -489,6 +489,7 @@ static int __inet_insert_ifa(struct in_ifaddr *ifa, struct nlmsghdr *nlh, ...@@ -489,6 +489,7 @@ static int __inet_insert_ifa(struct in_ifaddr *ifa, struct nlmsghdr *nlh,
*/ */
ivi.ivi_addr = ifa->ifa_address; ivi.ivi_addr = ifa->ifa_address;
ivi.ivi_dev = ifa->ifa_dev; ivi.ivi_dev = ifa->ifa_dev;
ivi.extack = extack;
ret = blocking_notifier_call_chain(&inetaddr_validator_chain, ret = blocking_notifier_call_chain(&inetaddr_validator_chain,
NETDEV_UP, &ivi); NETDEV_UP, &ivi);
ret = notifier_to_errno(ret); ret = notifier_to_errno(ret);
...@@ -521,7 +522,7 @@ static int __inet_insert_ifa(struct in_ifaddr *ifa, struct nlmsghdr *nlh, ...@@ -521,7 +522,7 @@ static int __inet_insert_ifa(struct in_ifaddr *ifa, struct nlmsghdr *nlh,
static int inet_insert_ifa(struct in_ifaddr *ifa) static int inet_insert_ifa(struct in_ifaddr *ifa)
{ {
return __inet_insert_ifa(ifa, NULL, 0); return __inet_insert_ifa(ifa, NULL, 0, NULL);
} }
static int inet_set_ifa(struct net_device *dev, struct in_ifaddr *ifa) static int inet_set_ifa(struct net_device *dev, struct in_ifaddr *ifa)
...@@ -902,7 +903,8 @@ static int inet_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, ...@@ -902,7 +903,8 @@ static int inet_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh,
return ret; return ret;
} }
} }
return __inet_insert_ifa(ifa, nlh, NETLINK_CB(skb).portid); return __inet_insert_ifa(ifa, nlh, NETLINK_CB(skb).portid,
extack);
} else { } else {
inet_free_ifa(ifa); inet_free_ifa(ifa);
......
...@@ -957,18 +957,42 @@ static u32 inet6_addr_hash(const struct in6_addr *addr) ...@@ -957,18 +957,42 @@ 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 int ipv6_add_addr_hash(struct net_device *dev, struct inet6_ifaddr *ifa)
{
unsigned int hash;
int err = 0;
spin_lock(&addrconf_hash_lock);
/* Ignore adding duplicate addresses on an interface */
if (ipv6_chk_same_addr(dev_net(dev), &ifa->addr, dev)) {
ADBG("ipv6_add_addr: already assigned\n");
err = -EEXIST;
goto out;
}
/* Add to big hash table */
hash = inet6_addr_hash(&ifa->addr);
hlist_add_head_rcu(&ifa->addr_lst, &inet6_addr_lst[hash]);
out:
spin_unlock(&addrconf_hash_lock);
return err;
}
/* On success it returns ifp with increased reference count */ /* On success it returns ifp with increased reference count */
static struct inet6_ifaddr * static struct inet6_ifaddr *
ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr, ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr,
const struct in6_addr *peer_addr, int pfxlen, const struct in6_addr *peer_addr, int pfxlen,
int scope, u32 flags, u32 valid_lft, u32 prefered_lft) int scope, u32 flags, u32 valid_lft, u32 prefered_lft,
bool can_block, struct netlink_ext_ack *extack)
{ {
gfp_t gfp_flags = can_block ? GFP_KERNEL : GFP_ATOMIC;
struct net *net = dev_net(idev->dev); struct net *net = dev_net(idev->dev);
struct inet6_ifaddr *ifa = NULL; struct inet6_ifaddr *ifa = NULL;
struct rt6_info *rt; struct rt6_info *rt = NULL;
struct in6_validator_info i6vi;
unsigned int hash;
int err = 0; int err = 0;
int addr_type = ipv6_addr_type(addr); int addr_type = ipv6_addr_type(addr);
...@@ -978,42 +1002,33 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr, ...@@ -978,42 +1002,33 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr,
addr_type & IPV6_ADDR_LOOPBACK)) addr_type & IPV6_ADDR_LOOPBACK))
return ERR_PTR(-EADDRNOTAVAIL); return ERR_PTR(-EADDRNOTAVAIL);
rcu_read_lock_bh();
in6_dev_hold(idev);
if (idev->dead) { if (idev->dead) {
err = -ENODEV; /*XXX*/ err = -ENODEV; /*XXX*/
goto out2; goto out;
} }
if (idev->cnf.disable_ipv6) { if (idev->cnf.disable_ipv6) {
err = -EACCES; err = -EACCES;
goto out2;
}
i6vi.i6vi_addr = *addr;
i6vi.i6vi_dev = idev;
rcu_read_unlock_bh();
err = inet6addr_validator_notifier_call_chain(NETDEV_UP, &i6vi);
rcu_read_lock_bh();
err = notifier_to_errno(err);
if (err)
goto out2;
spin_lock(&addrconf_hash_lock);
/* Ignore adding duplicate addresses on an interface */
if (ipv6_chk_same_addr(dev_net(idev->dev), addr, idev->dev)) {
ADBG("ipv6_add_addr: already assigned\n");
err = -EEXIST;
goto out; goto out;
} }
ifa = kzalloc(sizeof(struct inet6_ifaddr), GFP_ATOMIC); /* validator notifier needs to be blocking;
* do not call in atomic context
*/
if (can_block) {
struct in6_validator_info i6vi = {
.i6vi_addr = *addr,
.i6vi_dev = idev,
.extack = extack,
};
err = inet6addr_validator_notifier_call_chain(NETDEV_UP, &i6vi);
err = notifier_to_errno(err);
if (err < 0)
goto out;
}
ifa = kzalloc(sizeof(*ifa), gfp_flags);
if (!ifa) { if (!ifa) {
ADBG("ipv6_add_addr: malloc failed\n"); ADBG("ipv6_add_addr: malloc failed\n");
err = -ENOBUFS; err = -ENOBUFS;
...@@ -1023,6 +1038,7 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr, ...@@ -1023,6 +1038,7 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr,
rt = addrconf_dst_alloc(idev, addr, false); rt = addrconf_dst_alloc(idev, addr, false);
if (IS_ERR(rt)) { if (IS_ERR(rt)) {
err = PTR_ERR(rt); err = PTR_ERR(rt);
rt = NULL;
goto out; goto out;
} }
...@@ -1053,16 +1069,21 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr, ...@@ -1053,16 +1069,21 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr,
ifa->rt = rt; ifa->rt = rt;
ifa->idev = idev; ifa->idev = idev;
in6_dev_hold(idev);
/* For caller */ /* For caller */
refcount_set(&ifa->refcnt, 1); refcount_set(&ifa->refcnt, 1);
/* Add to big hash table */ rcu_read_lock_bh();
hash = inet6_addr_hash(addr);
hlist_add_head_rcu(&ifa->addr_lst, &inet6_addr_lst[hash]); err = ipv6_add_addr_hash(idev->dev, ifa);
spin_unlock(&addrconf_hash_lock); if (err < 0) {
rcu_read_unlock_bh();
goto out;
}
write_lock(&idev->lock); write_lock(&idev->lock);
/* Add to inet6_dev unicast addr list. */ /* Add to inet6_dev unicast addr list. */
ipv6_link_dev_addr(idev, ifa); ipv6_link_dev_addr(idev, ifa);
...@@ -1073,21 +1094,23 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr, ...@@ -1073,21 +1094,23 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr,
in6_ifa_hold(ifa); in6_ifa_hold(ifa);
write_unlock(&idev->lock); write_unlock(&idev->lock);
out2:
rcu_read_unlock_bh(); rcu_read_unlock_bh();
if (likely(err == 0)) inet6addr_notifier_call_chain(NETDEV_UP, ifa);
inet6addr_notifier_call_chain(NETDEV_UP, ifa); out:
else { if (unlikely(err < 0)) {
kfree(ifa); if (rt)
in6_dev_put(idev); ip6_rt_put(rt);
if (ifa) {
if (ifa->idev)
in6_dev_put(ifa->idev);
kfree(ifa);
}
ifa = ERR_PTR(err); ifa = ERR_PTR(err);
} }
return ifa; return ifa;
out:
spin_unlock(&addrconf_hash_lock);
goto out2;
} }
enum cleanup_prefix_rt_t { enum cleanup_prefix_rt_t {
...@@ -1334,7 +1357,7 @@ static int ipv6_create_tempaddr(struct inet6_ifaddr *ifp, struct inet6_ifaddr *i ...@@ -1334,7 +1357,7 @@ static int ipv6_create_tempaddr(struct inet6_ifaddr *ifp, struct inet6_ifaddr *i
ift = ipv6_add_addr(idev, &addr, NULL, tmp_plen, ift = ipv6_add_addr(idev, &addr, NULL, tmp_plen,
ipv6_addr_scope(&addr), addr_flags, ipv6_addr_scope(&addr), addr_flags,
tmp_valid_lft, tmp_prefered_lft); tmp_valid_lft, tmp_prefered_lft, true, NULL);
if (IS_ERR(ift)) { if (IS_ERR(ift)) {
in6_ifa_put(ifp); in6_ifa_put(ifp);
in6_dev_put(idev); in6_dev_put(idev);
...@@ -2018,7 +2041,7 @@ void addrconf_dad_failure(struct inet6_ifaddr *ifp) ...@@ -2018,7 +2041,7 @@ void addrconf_dad_failure(struct inet6_ifaddr *ifp)
ifp2 = ipv6_add_addr(idev, &new_addr, NULL, pfxlen, ifp2 = ipv6_add_addr(idev, &new_addr, NULL, pfxlen,
scope, flags, valid_lft, scope, flags, valid_lft,
preferred_lft); preferred_lft, false, NULL);
if (IS_ERR(ifp2)) if (IS_ERR(ifp2))
goto lock_errdad; goto lock_errdad;
...@@ -2476,7 +2499,7 @@ int addrconf_prefix_rcv_add_addr(struct net *net, struct net_device *dev, ...@@ -2476,7 +2499,7 @@ int addrconf_prefix_rcv_add_addr(struct net *net, struct net_device *dev,
pinfo->prefix_len, pinfo->prefix_len,
addr_type&IPV6_ADDR_SCOPE_MASK, addr_type&IPV6_ADDR_SCOPE_MASK,
addr_flags, valid_lft, addr_flags, valid_lft,
prefered_lft); prefered_lft, false, NULL);
if (IS_ERR_OR_NULL(ifp)) if (IS_ERR_OR_NULL(ifp))
return -1; return -1;
...@@ -2786,7 +2809,8 @@ static int inet6_addr_add(struct net *net, int ifindex, ...@@ -2786,7 +2809,8 @@ static int inet6_addr_add(struct net *net, int ifindex,
const struct in6_addr *pfx, const struct in6_addr *pfx,
const struct in6_addr *peer_pfx, const struct in6_addr *peer_pfx,
unsigned int plen, __u32 ifa_flags, unsigned int plen, __u32 ifa_flags,
__u32 prefered_lft, __u32 valid_lft) __u32 prefered_lft, __u32 valid_lft,
struct netlink_ext_ack *extack)
{ {
struct inet6_ifaddr *ifp; struct inet6_ifaddr *ifp;
struct inet6_dev *idev; struct inet6_dev *idev;
...@@ -2845,7 +2869,7 @@ static int inet6_addr_add(struct net *net, int ifindex, ...@@ -2845,7 +2869,7 @@ static int inet6_addr_add(struct net *net, int ifindex,
} }
ifp = ipv6_add_addr(idev, pfx, peer_pfx, plen, scope, ifa_flags, ifp = ipv6_add_addr(idev, pfx, peer_pfx, plen, scope, ifa_flags,
valid_lft, prefered_lft); valid_lft, prefered_lft, true, extack);
if (!IS_ERR(ifp)) { if (!IS_ERR(ifp)) {
if (!(ifa_flags & IFA_F_NOPREFIXROUTE)) { if (!(ifa_flags & IFA_F_NOPREFIXROUTE)) {
...@@ -2930,7 +2954,7 @@ int addrconf_add_ifaddr(struct net *net, void __user *arg) ...@@ -2930,7 +2954,7 @@ int addrconf_add_ifaddr(struct net *net, void __user *arg)
rtnl_lock(); rtnl_lock();
err = inet6_addr_add(net, ireq.ifr6_ifindex, &ireq.ifr6_addr, NULL, err = inet6_addr_add(net, ireq.ifr6_ifindex, &ireq.ifr6_addr, NULL,
ireq.ifr6_prefixlen, IFA_F_PERMANENT, ireq.ifr6_prefixlen, IFA_F_PERMANENT,
INFINITY_LIFE_TIME, INFINITY_LIFE_TIME); INFINITY_LIFE_TIME, INFINITY_LIFE_TIME, NULL);
rtnl_unlock(); rtnl_unlock();
return err; return err;
} }
...@@ -2960,7 +2984,8 @@ static void add_addr(struct inet6_dev *idev, const struct in6_addr *addr, ...@@ -2960,7 +2984,8 @@ static void add_addr(struct inet6_dev *idev, const struct in6_addr *addr,
ifp = ipv6_add_addr(idev, addr, NULL, plen, ifp = ipv6_add_addr(idev, addr, NULL, plen,
scope, IFA_F_PERMANENT, scope, IFA_F_PERMANENT,
INFINITY_LIFE_TIME, INFINITY_LIFE_TIME); INFINITY_LIFE_TIME, INFINITY_LIFE_TIME,
true, NULL);
if (!IS_ERR(ifp)) { if (!IS_ERR(ifp)) {
spin_lock_bh(&ifp->lock); spin_lock_bh(&ifp->lock);
ifp->flags &= ~IFA_F_TENTATIVE; ifp->flags &= ~IFA_F_TENTATIVE;
...@@ -3060,7 +3085,7 @@ void addrconf_add_linklocal(struct inet6_dev *idev, ...@@ -3060,7 +3085,7 @@ void addrconf_add_linklocal(struct inet6_dev *idev,
#endif #endif
ifp = ipv6_add_addr(idev, addr, NULL, 64, IFA_LINK, addr_flags, ifp = ipv6_add_addr(idev, addr, NULL, 64, IFA_LINK, addr_flags,
INFINITY_LIFE_TIME, INFINITY_LIFE_TIME); INFINITY_LIFE_TIME, INFINITY_LIFE_TIME, true, NULL);
if (!IS_ERR(ifp)) { if (!IS_ERR(ifp)) {
addrconf_prefix_route(&ifp->addr, ifp->prefix_len, idev->dev, 0, 0); addrconf_prefix_route(&ifp->addr, ifp->prefix_len, idev->dev, 0, 0);
addrconf_dad_start(ifp); addrconf_dad_start(ifp);
...@@ -4563,7 +4588,7 @@ inet6_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, ...@@ -4563,7 +4588,7 @@ inet6_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh,
*/ */
return inet6_addr_add(net, ifm->ifa_index, pfx, peer_pfx, return inet6_addr_add(net, ifm->ifa_index, pfx, peer_pfx,
ifm->ifa_prefixlen, ifa_flags, ifm->ifa_prefixlen, ifa_flags,
preferred_lft, valid_lft); preferred_lft, valid_lft, extack);
} }
if (nlh->nlmsg_flags & NLM_F_EXCL || if (nlh->nlmsg_flags & NLM_F_EXCL ||
......
...@@ -88,7 +88,7 @@ int __ipv6_addr_type(const struct in6_addr *addr) ...@@ -88,7 +88,7 @@ int __ipv6_addr_type(const struct in6_addr *addr)
EXPORT_SYMBOL(__ipv6_addr_type); EXPORT_SYMBOL(__ipv6_addr_type);
static ATOMIC_NOTIFIER_HEAD(inet6addr_chain); static ATOMIC_NOTIFIER_HEAD(inet6addr_chain);
static ATOMIC_NOTIFIER_HEAD(inet6addr_validator_chain); static BLOCKING_NOTIFIER_HEAD(inet6addr_validator_chain);
int register_inet6addr_notifier(struct notifier_block *nb) int register_inet6addr_notifier(struct notifier_block *nb)
{ {
...@@ -110,19 +110,20 @@ EXPORT_SYMBOL(inet6addr_notifier_call_chain); ...@@ -110,19 +110,20 @@ EXPORT_SYMBOL(inet6addr_notifier_call_chain);
int register_inet6addr_validator_notifier(struct notifier_block *nb) int register_inet6addr_validator_notifier(struct notifier_block *nb)
{ {
return atomic_notifier_chain_register(&inet6addr_validator_chain, nb); return blocking_notifier_chain_register(&inet6addr_validator_chain, nb);
} }
EXPORT_SYMBOL(register_inet6addr_validator_notifier); EXPORT_SYMBOL(register_inet6addr_validator_notifier);
int unregister_inet6addr_validator_notifier(struct notifier_block *nb) int unregister_inet6addr_validator_notifier(struct notifier_block *nb)
{ {
return atomic_notifier_chain_unregister(&inet6addr_validator_chain, nb); return blocking_notifier_chain_unregister(&inet6addr_validator_chain,
nb);
} }
EXPORT_SYMBOL(unregister_inet6addr_validator_notifier); EXPORT_SYMBOL(unregister_inet6addr_validator_notifier);
int inet6addr_validator_notifier_call_chain(unsigned long val, void *v) int inet6addr_validator_notifier_call_chain(unsigned long val, void *v)
{ {
return atomic_notifier_call_chain(&inet6addr_validator_chain, val, v); return blocking_notifier_call_chain(&inet6addr_validator_chain, val, v);
} }
EXPORT_SYMBOL(inet6addr_validator_notifier_call_chain); EXPORT_SYMBOL(inet6addr_validator_notifier_call_chain);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment