Commit a6db4494d218c ("net: ipv4: Consider failed nexthops in multipath
routes") added support for checking neighbor state when selecting a path
for multipath route lookups. It works but incurs a delay waiting for
the neighbor entry to timeout. Improve the path selection by flushing
non-permanent neighbor entries when carrier is off.

Signed-off-by: Satish Ashok <sas...@cumulusnetworks.com>
Signed-off-by: David Ahern <dsah...@gmail.com>
---
 net/ipv4/fib_frontend.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index f02819134ba2..aa8fea74858f 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -1226,10 +1226,13 @@ static int fib_netdev_event(struct notifier_block 
*this, unsigned long event, vo
                break;
        case NETDEV_CHANGE:
                flags = dev_get_flags(dev);
-               if (flags & (IFF_RUNNING | IFF_LOWER_UP))
+               if (flags & (IFF_RUNNING | IFF_LOWER_UP)) {
                        fib_sync_up(dev, RTNH_F_LINKDOWN);
-               else
+               } else {
                        fib_sync_down_dev(dev, event, false);
+                       if (IN_DEV_IGNORE_ROUTES_WITH_LINKDOWN(in_dev))
+                               neigh_carrier_down(&arp_tbl, dev);
+               }
                /* fall through */
        case NETDEV_CHANGEMTU:
                rt_cache_flush(net);
-- 
2.1.4

Reply via email to