net: ipv6: Refactor in rt6_age_examine_exception
authorXu Jia <xujia39@huawei.com>
Thu, 1 Apr 2021 03:22:23 +0000 (11:22 +0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 1 Apr 2021 22:45:26 +0000 (15:45 -0700)
The logic in rt6_age_examine_exception is confusing. The commit is
to refactor the code.

Signed-off-by: Xu Jia <xujia39@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv6/route.c

index d99dd4d362520ff0142f93153654c186d12d141c..28801ae8054805102c6c2fd98872d36008108721 100644 (file)
@@ -2085,13 +2085,10 @@ static void rt6_age_examine_exception(struct rt6_exception_bucket *bucket,
 
        if (rt->rt6i_flags & RTF_GATEWAY) {
                struct neighbour *neigh;
-               __u8 neigh_flags = 0;
 
                neigh = __ipv6_neigh_lookup_noref(rt->dst.dev, &rt->rt6i_gateway);
-               if (neigh)
-                       neigh_flags = neigh->flags;
 
-               if (!(neigh_flags & NTF_ROUTER)) {
+               if (!(neigh && (neigh->flags & NTF_ROUTER))) {
                        RT6_TRACE("purging route %p via non-router but gateway\n",
                                  rt);
                        rt6_remove_exception(bucket, rt6_ex);