ipv6: remove unnecessary call rt6_clean_expires
Subsystems (3)
PATCH v2 1/1 ipv6: remove unnecessary call rt6_clean_expires
From: Li RongQing <[email protected]>
the from of dst_entry and rt6i_flags of rt6_info have been zeroed out in ip6_blackhole_route or after calling ip6_dst_alloc, so it is unnecessary to call rt6_clean_expires again.
--- net/ipv6/route.c | 9 ++------- 1 files changed, 2 insertions(+), 7 deletions(-)
net/ipv6/route.c +2 -7
@@ -996,8 +996,7 @@ struct dst_entry *ip6_blackhole_route(struct net *net, struct dst_entry *dst_oriin6_dev_hold (rt->rt6i_idev); rt->rt6i_gateway = ort->rt6i_gateway; - rt->rt6i_flags = ort->rt6i_flags; -rt6_clean_expires (rt); + rt->rt6i_flags = ort->rt6i_flags & ~RTF_EXPIRES ; rt->rt6i_metric =0 ;memcpy (&rt->rt6i_dst, &ort->rt6i_dst,sizeof (struct rt6key ));
@@ -1393,8 +1392,6 @@ int ip6_route_add(struct fib6_config *cfg)if (cfg->fc_flags &RTF_EXPIRES )rt6_set_expires (rt, jiffies +clock_t_to_jiffies (cfg->fc_expires)); -else -rt6_clean_expires (rt);if (cfg->fc_protocol ==RTPROT_UNSPEC ) cfg->fc_protocol =RTPROT_BOOT ;
@@ -1803,12 +1800,10 @@ static struct rt6_info *ip6_rt_copy(struct rt6_info *ort, rt->dst.lastuse = jiffies; rt->rt6i_gateway = ort->rt6i_gateway; - rt->rt6i_flags = ort->rt6i_flags; + rt->rt6i_flags = ort->rt6i_flags & ~RTF_EXPIRES ;if ((ort->rt6i_flags & (RTF_DEFAULT |RTF_ADDRCONF )) == (RTF_DEFAULT |RTF_ADDRCONF ))rt6_set_from (rt, ort); -else -rt6_clean_expires (rt); rt->rt6i_metric =0 ;#ifdef CONFIG_IPV6_SUBTREES
Signature · 1 line
1.7.4.1
David Miller
maintainerFrom: [email protected]
Date: Thu, 20 Sep 2012 13:31:58 +0800
Quoted 8 lines
From: Li RongQing <[email protected]>
the from of
dst_entryandrt6i_flagsofrt6_infohave been zeroed out inip6_blackhole_routeor after callingip6_dst_alloc, so it is unnecessary to callrt6_clean_expiresagain.Cc Gao feng <[email protected]>Signed-off-by Li RongQing <[email protected]>
I still don't like this change.
The rt6_clean_expires() calls actually do some work (clear the RTF_EXPIRES) bit in two of the cases you are changing.
And more importantly, having the rt6_clean_expires() call makes it easier to audit and make sure this is handled in all the necessary situations.
The whole point of having an abstracted helper function is so that we don't have code directly manipulating RTF_EXPIRES.
I'm not applying this patch, sorry.