]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
ipv6: Fix redirect with VRF
authorDavid Ahern <dsahern@gmail.com>
Wed, 22 May 2019 22:12:18 +0000 (15:12 -0700)
committerStefan Bader <stefan.bader@canonical.com>
Tue, 13 Aug 2019 12:11:36 +0000 (14:11 +0200)
BugLink: https://bugs.launchpad.net/bugs/1837518
[ Upstream commit 31680ac265802397937d75461a2809a067b9fb93 ]

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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
net/ipv6/route.c

index b471afce13304609c3d547a577f92dc725fe29bf..457a27016e74cdc1a8cb4706527fd0d591e6df3f 100644 (file)
@@ -2448,6 +2448,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.
         *