diff mbox

ipv6: drop the judgement in rt6_alloc_cow()

Message ID 5278837D.7030207@cn.fujitsu.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Duan Jiong Nov. 5, 2013, 5:34 a.m. UTC
Now rt6_alloc_cow() is only called by ip6_pol_route() when
rt->rt6i_flags doesn't contain both RTF_NONEXTHOP and RTF_GATEWAY,
and rt->rt6i_flags hasn't been changed in ip6_rt_copy().
So there is no neccessary to judge whether rt->rt6i_flags contains
RTF_GATEWAY or not.

Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
---
 net/ipv6/route.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Comments

Hannes Frederic Sowa Nov. 5, 2013, 9:23 p.m. UTC | #1
On Tue, Nov 05, 2013 at 01:34:53PM +0800, Duan Jiong wrote:
> 
> Now rt6_alloc_cow() is only called by ip6_pol_route() when
> rt->rt6i_flags doesn't contain both RTF_NONEXTHOP and RTF_GATEWAY,
> and rt->rt6i_flags hasn't been changed in ip6_rt_copy().
> So there is no neccessary to judge whether rt->rt6i_flags contains
> RTF_GATEWAY or not.

This is ok.

Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>

Thanks,

  Hannes

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller Nov. 6, 2013, 3:17 a.m. UTC | #2
From: Hannes Frederic Sowa <hannes@stressinduktion.org>
Date: Tue, 5 Nov 2013 22:23:44 +0100

> On Tue, Nov 05, 2013 at 01:34:53PM +0800, Duan Jiong wrote:
>> 
>> Now rt6_alloc_cow() is only called by ip6_pol_route() when
>> rt->rt6i_flags doesn't contain both RTF_NONEXTHOP and RTF_GATEWAY,
>> and rt->rt6i_flags hasn't been changed in ip6_rt_copy().
>> So there is no neccessary to judge whether rt->rt6i_flags contains
>> RTF_GATEWAY or not.
> 
> This is ok.
> 
> Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>

Applied, thanks everyone.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index fd399ac..c28cdda 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -871,11 +871,9 @@  static struct rt6_info *rt6_alloc_cow(struct rt6_info *ort,
 	rt = ip6_rt_copy(ort, daddr);
 
 	if (rt) {
-		if (!(rt->rt6i_flags & RTF_GATEWAY)) {
-			if (ort->rt6i_dst.plen != 128 &&
-			    ipv6_addr_equal(&ort->rt6i_dst.addr, daddr))
-				rt->rt6i_flags |= RTF_ANYCAST;
-		}
+		if (ort->rt6i_dst.plen != 128 &&
+		    ipv6_addr_equal(&ort->rt6i_dst.addr, daddr))
+			rt->rt6i_flags |= RTF_ANYCAST;
 
 		rt->rt6i_flags |= RTF_CACHE;