[PATCH 3.8 156/166] ipv6: always set the new created dst's from in ip6_rt_copy

From: Kamal Mostafa
Date: Wed Jan 15 2014 - 16:59:39 EST


3.8.13.16 -stable review patch. If anyone has any objections, please let me know.

------------------

From: Li RongQing <roy.qing.li@xxxxxxxxx>

[ Upstream commit 24f5b855e17df7e355eacd6c4a12cc4d6a6c9ff0 ]

ip6_rt_copy only sets dst.from if ort has flag RTF_ADDRCONF and RTF_DEFAULT.
but the prefix routes which did get installed by hand locally can have an
expiration, and no any flag combination which can ensure a potential from
does never expire, so we should always set the new created dst's from.

This also fixes the new created dst is always expired since the ort, which
is created by RA, maybe has RTF_EXPIRES and RTF_ADDRCONF, but no RTF_DEFAULT.

Suggested-by: Hannes Frederic Sowa <hannes@xxxxxxxxxxxxxxxxxxx>
CC: Gao feng <gaofeng@xxxxxxxxxxxxxx>
Signed-off-by: Li RongQing <roy.qing.li@xxxxxxxxx>
Acked-by: Hannes Frederic Sowa <hannes@xxxxxxxxxxxxxxxxxxx>
Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
[ kamal: backport to 3.8 (context) ]
Signed-off-by: Kamal Mostafa <kamal@xxxxxxxxxxxxx>
---
net/ipv6/route.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 7352014..d8ba7c5 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1867,9 +1867,7 @@ static struct rt6_info *ip6_rt_copy(struct rt6_info *ort,

rt->rt6i_gateway = ort->rt6i_gateway;
rt->rt6i_flags = ort->rt6i_flags;
- if ((ort->rt6i_flags & (RTF_DEFAULT | RTF_ADDRCONF)) ==
- (RTF_DEFAULT | RTF_ADDRCONF))
- rt6_set_from(rt, ort);
+ rt6_set_from(rt, ort);
rt->rt6i_metric = 0;

#ifdef CONFIG_IPV6_SUBTREES
--
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/