ipv6: trival improvements
Subsystems (3)
PATCH 1/1 ipv6: trival improvements
From: Li RongQing <[email protected]>
1. remove the unnecessary setting rt.rt6i_metric to 0 since memset() has clear them.
2. call ip6_rt_put to release rt only when rt is not null in addrconf_prefix_rcv.
--- net/ipv6/addrconf.c | 3 ++- net/ipv6/route.c | 2 -- 2 files changed, 2 insertions(+), 3 deletions(-)
net/ipv6/addrconf.c +2 -1
@@ -2167,6 +2167,8 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len, bool sllao) }else {rt6_clean_expires (rt); } + +ip6_rt_put (rt); }else if (valid_lft) {clock_t expires =0 ;int flags =RTF_ADDRCONF |RTF_PREFIX_RT ;
@@ -2178,7 +2180,6 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len, bool sllao)addrconf_prefix_route (&pinfo->prefix, pinfo->prefix_len, dev, expires, flags); } -ip6_rt_put (rt); }/* Try to figure out our local address for this prefix */
net/ipv6/route.c +0 -2
@@ -1060,7 +1060,6 @@ struct dst_entry *ip6_blackhole_route(struct net *net, struct dst_entry *dst_ori rt->rt6i_gateway = ort->rt6i_gateway; rt->rt6i_flags = ort->rt6i_flags; - rt->rt6i_metric =0 ;memcpy (&rt->rt6i_dst, &ort->rt6i_dst,sizeof (struct rt6key ));#ifdef CONFIG_IPV6_SUBTREES
@@ -1912,7 +1911,6 @@ static struct rt6_info *ip6_rt_copy(struct rt6_info *ort,if ((ort->rt6i_flags & (RTF_DEFAULT |RTF_ADDRCONF )) == (RTF_DEFAULT |RTF_ADDRCONF ))rt6_set_from (rt, ort); - rt->rt6i_metric =0 ;#ifdef CONFIG_IPV6_SUBTREES memcpy (&rt->rt6i_src, &ort->rt6i_src,sizeof (struct rt6key ));
Signature · 1 line
1.7.10.4
David Miller
maintainerFrom: [email protected]
Date: Thu, 19 Dec 2013 14:18:52 +0800
Quoted 7 lines
From: Li RongQing <[email protected]>
1. remove the unnecessary setting rt.rt6i_metric to 0 since
memset()has clear them.
2. callip6_rt_putto release rt only when rt is not null inaddrconf_prefix_rcv.Signed-off-by Li RongQing <[email protected]>
ip6_rt_put() transparently handles NULL just fine, don't special case it like this.
Quoted 5 lines · David Miller
From: [email protected]
Date: Thu, 19 Dec 2013 14:18:52 +0800Quoted 2 lines
From: Li RongQing <[email protected]>
Quoted 8 lines
Quoted 5 lines
1. remove the unnecessary setting rt.rt6i_metric to 0 since
memset()has clear them.
2. callip6_rt_putto release rt only when rt is not null inaddrconf_prefix_rcv.Signed-off-by Li RongQing <[email protected]>
ip6_rt_put()transparently handles NULL just fine, don't special case it like this.
Yes, ip6_rt_put() can handles NULL, but this change can free cpu to do judgement one time if rt is NULL.
Thanks
-Roy