Commit 11dd74b3 authored by Roopa Prabhu's avatar Roopa Prabhu Committed by David S. Miller

net: ipv6: new arg skip_notify to ip6_rt_del

Used in subsequent work to skip route delete
notifications on nexthop deletes.
Suggested-by: default avatarDavid Ahern <dsahern@gmail.com>
Signed-off-by: default avatarRoopa Prabhu <roopa@cumulusnetworks.com>
Reviewed-by: default avatarDavid Ahern <dsahern@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2ac757e4
...@@ -123,7 +123,7 @@ int ipv6_route_ioctl(struct net *net, unsigned int cmd, void __user *arg); ...@@ -123,7 +123,7 @@ int ipv6_route_ioctl(struct net *net, unsigned int cmd, void __user *arg);
int ip6_route_add(struct fib6_config *cfg, gfp_t gfp_flags, int ip6_route_add(struct fib6_config *cfg, gfp_t gfp_flags,
struct netlink_ext_ack *extack); struct netlink_ext_ack *extack);
int ip6_ins_rt(struct net *net, struct fib6_info *f6i); int ip6_ins_rt(struct net *net, struct fib6_info *f6i);
int ip6_del_rt(struct net *net, struct fib6_info *f6i); int ip6_del_rt(struct net *net, struct fib6_info *f6i, bool skip_notify);
void rt6_flush_exceptions(struct fib6_info *f6i); void rt6_flush_exceptions(struct fib6_info *f6i);
void rt6_age_exceptions(struct fib6_info *f6i, struct fib6_gc_args *gc_args, void rt6_age_exceptions(struct fib6_info *f6i, struct fib6_gc_args *gc_args,
......
...@@ -48,7 +48,7 @@ struct ipv6_stub { ...@@ -48,7 +48,7 @@ struct ipv6_stub {
struct netlink_ext_ack *extack); struct netlink_ext_ack *extack);
void (*fib6_nh_release)(struct fib6_nh *fib6_nh); void (*fib6_nh_release)(struct fib6_nh *fib6_nh);
void (*fib6_update_sernum)(struct net *net, struct fib6_info *rt); void (*fib6_update_sernum)(struct net *net, struct fib6_info *rt);
int (*ip6_del_rt)(struct net *net, struct fib6_info *rt); int (*ip6_del_rt)(struct net *net, struct fib6_info *rt, bool skip_notify);
void (*fib6_rt_update)(struct net *net, struct fib6_info *rt, void (*fib6_rt_update)(struct net *net, struct fib6_info *rt,
struct nl_info *info); struct nl_info *info);
......
...@@ -784,7 +784,7 @@ static void __remove_nexthop_fib(struct net *net, struct nexthop *nh) ...@@ -784,7 +784,7 @@ static void __remove_nexthop_fib(struct net *net, struct nexthop *nh)
list_for_each_entry_safe(f6i, tmp, &nh->f6i_list, nh_list) { list_for_each_entry_safe(f6i, tmp, &nh->f6i_list, nh_list) {
/* __ip6_del_rt does a release, so do a hold here */ /* __ip6_del_rt does a release, so do a hold here */
fib6_info_hold(f6i); fib6_info_hold(f6i);
ipv6_stub->ip6_del_rt(net, f6i); ipv6_stub->ip6_del_rt(net, f6i, false);
} }
} }
......
...@@ -1238,7 +1238,7 @@ cleanup_prefix_route(struct inet6_ifaddr *ifp, unsigned long expires, ...@@ -1238,7 +1238,7 @@ cleanup_prefix_route(struct inet6_ifaddr *ifp, unsigned long expires,
ifp->idev->dev, 0, RTF_DEFAULT, true); ifp->idev->dev, 0, RTF_DEFAULT, true);
if (f6i) { if (f6i) {
if (del_rt) if (del_rt)
ip6_del_rt(dev_net(ifp->idev->dev), f6i); ip6_del_rt(dev_net(ifp->idev->dev), f6i, false);
else { else {
if (!(f6i->fib6_flags & RTF_EXPIRES)) if (!(f6i->fib6_flags & RTF_EXPIRES))
fib6_set_expires(f6i, expires); fib6_set_expires(f6i, expires);
...@@ -2718,7 +2718,7 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len, bool sllao) ...@@ -2718,7 +2718,7 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len, bool sllao)
if (rt) { if (rt) {
/* Autoconf prefix route */ /* Autoconf prefix route */
if (valid_lft == 0) { if (valid_lft == 0) {
ip6_del_rt(net, rt); ip6_del_rt(net, rt, false);
rt = NULL; rt = NULL;
} else if (addrconf_finite_timeout(rt_expires)) { } else if (addrconf_finite_timeout(rt_expires)) {
/* not infinity */ /* not infinity */
...@@ -3813,7 +3813,7 @@ static int addrconf_ifdown(struct net_device *dev, int how) ...@@ -3813,7 +3813,7 @@ static int addrconf_ifdown(struct net_device *dev, int how)
spin_unlock_bh(&ifa->lock); spin_unlock_bh(&ifa->lock);
if (rt) if (rt)
ip6_del_rt(net, rt); ip6_del_rt(net, rt, false);
if (state != INET6_IFADDR_STATE_DEAD) { if (state != INET6_IFADDR_STATE_DEAD) {
__ipv6_ifa_notify(RTM_DELADDR, ifa); __ipv6_ifa_notify(RTM_DELADDR, ifa);
...@@ -4652,7 +4652,7 @@ static int modify_prefix_route(struct inet6_ifaddr *ifp, ...@@ -4652,7 +4652,7 @@ static int modify_prefix_route(struct inet6_ifaddr *ifp,
prio = ifp->rt_priority ? : IP6_RT_PRIO_ADDRCONF; prio = ifp->rt_priority ? : IP6_RT_PRIO_ADDRCONF;
if (f6i->fib6_metric != prio) { if (f6i->fib6_metric != prio) {
/* delete old one */ /* delete old one */
ip6_del_rt(dev_net(ifp->idev->dev), f6i); ip6_del_rt(dev_net(ifp->idev->dev), f6i, false);
/* add new one */ /* add new one */
addrconf_prefix_route(modify_peer ? &ifp->peer_addr : &ifp->addr, addrconf_prefix_route(modify_peer ? &ifp->peer_addr : &ifp->addr,
...@@ -6073,10 +6073,10 @@ static void __ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp) ...@@ -6073,10 +6073,10 @@ static void __ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp)
ifp->idev->dev, 0, 0, ifp->idev->dev, 0, 0,
false); false);
if (rt) if (rt)
ip6_del_rt(net, rt); ip6_del_rt(net, rt, false);
} }
if (ifp->rt) { if (ifp->rt) {
ip6_del_rt(net, ifp->rt); ip6_del_rt(net, ifp->rt, false);
ifp->rt = NULL; ifp->rt = NULL;
} }
rt_genid_bump_ipv6(net); rt_genid_bump_ipv6(net);
......
...@@ -185,7 +185,8 @@ static int eafnosupport_fib6_nh_init(struct net *net, struct fib6_nh *fib6_nh, ...@@ -185,7 +185,8 @@ static int eafnosupport_fib6_nh_init(struct net *net, struct fib6_nh *fib6_nh,
return -EAFNOSUPPORT; return -EAFNOSUPPORT;
} }
static int eafnosupport_ip6_del_rt(struct net *net, struct fib6_info *rt) static int eafnosupport_ip6_del_rt(struct net *net, struct fib6_info *rt,
bool skip_notify)
{ {
return -EAFNOSUPPORT; return -EAFNOSUPPORT;
} }
......
...@@ -364,7 +364,7 @@ int __ipv6_dev_ac_dec(struct inet6_dev *idev, const struct in6_addr *addr) ...@@ -364,7 +364,7 @@ int __ipv6_dev_ac_dec(struct inet6_dev *idev, const struct in6_addr *addr)
ipv6_del_acaddr_hash(aca); ipv6_del_acaddr_hash(aca);
addrconf_leave_solict(idev, &aca->aca_addr); addrconf_leave_solict(idev, &aca->aca_addr);
ip6_del_rt(dev_net(idev->dev), aca->aca_rt); ip6_del_rt(dev_net(idev->dev), aca->aca_rt, false);
aca_put(aca); aca_put(aca);
return 0; return 0;
...@@ -393,7 +393,7 @@ void ipv6_ac_destroy_dev(struct inet6_dev *idev) ...@@ -393,7 +393,7 @@ void ipv6_ac_destroy_dev(struct inet6_dev *idev)
addrconf_leave_solict(idev, &aca->aca_addr); addrconf_leave_solict(idev, &aca->aca_addr);
ip6_del_rt(dev_net(idev->dev), aca->aca_rt); ip6_del_rt(dev_net(idev->dev), aca->aca_rt, false);
aca_put(aca); aca_put(aca);
......
...@@ -1302,7 +1302,7 @@ static void ndisc_router_discovery(struct sk_buff *skb) ...@@ -1302,7 +1302,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
} }
} }
if (rt && lifetime == 0) { if (rt && lifetime == 0) {
ip6_del_rt(net, rt); ip6_del_rt(net, rt, false);
rt = NULL; rt = NULL;
} }
......
...@@ -984,7 +984,7 @@ int rt6_route_rcv(struct net_device *dev, u8 *opt, int len, ...@@ -984,7 +984,7 @@ int rt6_route_rcv(struct net_device *dev, u8 *opt, int len,
gwaddr, dev); gwaddr, dev);
if (rt && !lifetime) { if (rt && !lifetime) {
ip6_del_rt(net, rt); ip6_del_rt(net, rt, false);
rt = NULL; rt = NULL;
} }
...@@ -3729,9 +3729,12 @@ static int __ip6_del_rt(struct fib6_info *rt, struct nl_info *info) ...@@ -3729,9 +3729,12 @@ static int __ip6_del_rt(struct fib6_info *rt, struct nl_info *info)
return err; return err;
} }
int ip6_del_rt(struct net *net, struct fib6_info *rt) int ip6_del_rt(struct net *net, struct fib6_info *rt, bool skip_notify)
{ {
struct nl_info info = { .nl_net = net }; struct nl_info info = {
.nl_net = net,
.skip_notify = skip_notify
};
return __ip6_del_rt(rt, &info); return __ip6_del_rt(rt, &info);
} }
...@@ -4252,7 +4255,7 @@ static void __rt6_purge_dflt_routers(struct net *net, ...@@ -4252,7 +4255,7 @@ static void __rt6_purge_dflt_routers(struct net *net,
(!idev || idev->cnf.accept_ra != 2) && (!idev || idev->cnf.accept_ra != 2) &&
fib6_info_hold_safe(rt)) { fib6_info_hold_safe(rt)) {
rcu_read_unlock(); rcu_read_unlock();
ip6_del_rt(net, rt); ip6_del_rt(net, rt, false);
goto restart; goto restart;
} }
} }
......
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