netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net/ipv6: fix incorrect fib6 gateway info after do redirect
@ 2018-09-06 12:57 Hangbin Liu
  2018-09-06 14:35 ` David Ahern
  0 siblings, 1 reply; 2+ messages in thread
From: Hangbin Liu @ 2018-09-06 12:57 UTC (permalink / raw)
  To: netdev; +Cc: David Ahern, David S. Miller, Hangbin Liu

When receive a redirect message and call rt6_do_redirect(), we allocate
a new rt6_info and set new flags and gateway info, but not update these
info to fib6_info.

Then if a user try to get the route info via `ip route get`, he will still
get the old default gateway, because inet6_rtm_getroute() get gateway info
from fib6_info.

Fixes: 23fb93a4d3f11 ("net/ipv6: Cleanup exception and cache route handling")
Reported-by: Jianlin Shi <jishi@redhat.com>
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
---
 net/ipv6/route.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 18e00ce..3d367c9 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -3446,6 +3446,10 @@ static void rt6_do_redirect(struct dst_entry *dst, struct sock *sk, struct sk_bu
 		goto out;
 	}
 
+	/* Update fib6_info from rt6_info */
+	from->fib6_flags = rt->rt6i_flags;
+	from->fib6_nh.nh_gw = rt->rt6i_gateway;
+
 	netevent.old = &rt->dst;
 	netevent.new = &nrt->dst;
 	netevent.daddr = &msg->dest;
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-09-06 19:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-06 12:57 [PATCH net] net/ipv6: fix incorrect fib6 gateway info after do redirect Hangbin Liu
2018-09-06 14:35 ` David Ahern

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).