aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/route.c
diff options
context:
space:
mode:
authorIdo Schimmel <idosch@mellanox.com>2018-01-07 12:45:03 +0200
committerDavid S. Miller <davem@davemloft.net>2018-01-07 21:29:39 -0500
commit2127d95aef6c795c3bd8b805722c5c46e8fe45dd (patch)
tree58c813e1f7f40d6b06b2522adaf35077077f7790 /net/ipv6/route.c
parentipv6: Mark dead nexthops with appropriate flags (diff)
downloadlinux-dev-2127d95aef6c795c3bd8b805722c5c46e8fe45dd.tar.xz
linux-dev-2127d95aef6c795c3bd8b805722c5c46e8fe45dd.zip
ipv6: Clear nexthop flags upon netdev up
Previous patch marked nexthops with the 'dead' and 'linkdown' flags. Clear these flags when the netdev comes back up. Signed-off-by: Ido Schimmel <idosch@mellanox.com> Acked-by: David Ahern <dsahern@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to '')
-rw-r--r--net/ipv6/route.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index f5eda0aeab55..4796d87e0b93 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -3459,6 +3459,35 @@ void rt6_clean_tohost(struct net *net, struct in6_addr *gateway)
fib6_clean_all(net, fib6_clean_tohost, gateway);
}
+struct arg_netdev_event {
+ const struct net_device *dev;
+ unsigned int nh_flags;
+};
+
+static int fib6_ifup(struct rt6_info *rt, void *p_arg)
+{
+ const struct arg_netdev_event *arg = p_arg;
+ const struct net *net = dev_net(arg->dev);
+
+ if (rt != net->ipv6.ip6_null_entry && rt->dst.dev == arg->dev)
+ rt->rt6i_nh_flags &= ~arg->nh_flags;
+
+ return 0;
+}
+
+void rt6_sync_up(struct net_device *dev, unsigned int nh_flags)
+{
+ struct arg_netdev_event arg = {
+ .dev = dev,
+ .nh_flags = nh_flags,
+ };
+
+ if (nh_flags & RTNH_F_DEAD && netif_carrier_ok(dev))
+ arg.nh_flags |= RTNH_F_LINKDOWN;
+
+ fib6_clean_all(dev_net(dev), fib6_ifup, &arg);
+}
+
struct arg_dev_net {
struct net_device *dev;
struct net *net;