All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] ipv6: Fix redirect with VRF
@ 2019-05-22 22:12 David Ahern
  2019-05-23  0:59 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: David Ahern @ 2019-05-22 22:12 UTC (permalink / raw)
  To: davem; +Cc: netdev, David Ahern

From: David Ahern <dsahern@gmail.com>

IPv6 redirect is broken for VRF. __ip6_route_redirect walks the FIB
entries looking for an exact match on ifindex. With VRF the flowi6_oif
is updated by l3mdev_update_flow to the l3mdev index and the
FLOWI_FLAG_SKIP_NH_OIF set in the flags to tell the lookup to skip the
device match. For redirects the device match is requires so use that
flag to know when the oif needs to be reset to the skb device index.

Fixes: ca254490c8df ("net: Add VRF support to IPv6 stack")
Signed-off-by: David Ahern <dsahern@gmail.com>
---
 net/ipv6/route.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 7a014ca877ed..848e944f07df 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -2512,6 +2512,12 @@ static struct rt6_info *__ip6_route_redirect(struct net *net,
 	struct fib6_info *rt;
 	struct fib6_node *fn;
 
+	/* l3mdev_update_flow overrides oif if the device is enslaved; in
+	 * this case we must match on the real ingress device, so reset it
+	 */
+	if (fl6->flowi6_flags & FLOWI_FLAG_SKIP_NH_OIF)
+		fl6->flowi6_oif = skb->dev->ifindex;
+
 	/* Get the "current" route for this destination and
 	 * check if the redirect has come from appropriate router.
 	 *
-- 
2.11.0


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

* Re: [PATCH net] ipv6: Fix redirect with VRF
  2019-05-22 22:12 [PATCH net] ipv6: Fix redirect with VRF David Ahern
@ 2019-05-23  0:59 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2019-05-23  0:59 UTC (permalink / raw)
  To: dsahern; +Cc: netdev, dsahern

From: David Ahern <dsahern@kernel.org>
Date: Wed, 22 May 2019 15:12:18 -0700

> From: David Ahern <dsahern@gmail.com>
> 
> IPv6 redirect is broken for VRF. __ip6_route_redirect walks the FIB
> entries looking for an exact match on ifindex. With VRF the flowi6_oif
> is updated by l3mdev_update_flow to the l3mdev index and the
> FLOWI_FLAG_SKIP_NH_OIF set in the flags to tell the lookup to skip the
> device match. For redirects the device match is requires so use that
> flag to know when the oif needs to be reset to the skb device index.
> 
> Fixes: ca254490c8df ("net: Add VRF support to IPv6 stack")
> Signed-off-by: David Ahern <dsahern@gmail.com>

Applied and queued up for -stable.

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

end of thread, other threads:[~2019-05-23  0:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-22 22:12 [PATCH net] ipv6: Fix redirect with VRF David Ahern
2019-05-23  0:59 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.