Merge tag 'rtc-v4.2-1' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni...
[firefly-linux-kernel-4.4.55.git] / net / ipv4 / fib_trie.c
index 6c666a9f1bd52d491e845b89f698726b28abbf4c..15d32612e3c6f134a533034aa4d7f74fa52da51b 100644 (file)
@@ -1412,9 +1412,15 @@ found:
                        continue;
                for (nhsel = 0; nhsel < fi->fib_nhs; nhsel++) {
                        const struct fib_nh *nh = &fi->fib_nh[nhsel];
+                       struct in_device *in_dev = __in_dev_get_rcu(nh->nh_dev);
 
                        if (nh->nh_flags & RTNH_F_DEAD)
                                continue;
+                       if (in_dev &&
+                           IN_DEV_IGNORE_ROUTES_WITH_LINKDOWN(in_dev) &&
+                           nh->nh_flags & RTNH_F_LINKDOWN &&
+                           !(fib_flags & FIB_LOOKUP_IGNORE_LINKSTATE))
+                               continue;
                        if (flp->flowi4_oif && flp->flowi4_oif != nh->nh_oif)
                                continue;