Merge tag 'dlm-3.4' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/linux-dlm
[cascardo/linux.git] / net / ipv6 / ip6_fib.c
index b82bcde..5b27fbc 100644 (file)
@@ -1552,11 +1552,20 @@ static int fib6_age(struct rt6_info *rt, void *arg)
                    time_after_eq(now, rt->dst.lastuse + gc_args.timeout)) {
                        RT6_TRACE("aging clone %p\n", rt);
                        return -1;
-               } else if ((rt->rt6i_flags & RTF_GATEWAY) &&
-                          (!(dst_get_neighbour_noref_raw(&rt->dst)->flags & NTF_ROUTER))) {
-                       RT6_TRACE("purging route %p via non-router but gateway\n",
-                                 rt);
-                       return -1;
+               } else if (rt->rt6i_flags & RTF_GATEWAY) {
+                       struct neighbour *neigh;
+                       __u8 neigh_flags = 0;
+
+                       neigh = dst_neigh_lookup(&rt->dst, &rt->rt6i_gateway);
+                       if (neigh) {
+                               neigh_flags = neigh->flags;
+                               neigh_release(neigh);
+                       }
+                       if (neigh_flags & NTF_ROUTER) {
+                               RT6_TRACE("purging route %p via non-router but gateway\n",
+                                         rt);
+                               return -1;
+                       }
                }
                gc_args.more++;
        }