I need to do some additional testing next week (taking PTO the next 2
days), but this should fix your problem. Can you confirm? This is
better than a sysctl to handle the known use cases, but it does not
handle a combination of the 2 known use cases (e.g., throw your use
case into a VRF).

diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c
index b644a23c3db0..41f5b504a782 100644
--- a/net/ipv4/xfrm4_policy.c
+++ b/net/ipv4/xfrm4_policy.c
@@ -29,7 +29,7 @@ static struct dst_entry *__xfrm4_dst_lookup(struct
net *net, struct flowi4 *fl4,
        memset(fl4, 0, sizeof(*fl4));
        fl4->daddr = daddr->a4;
        fl4->flowi4_tos = tos;
-       fl4->flowi4_oif = oif;
+       fl4->flowi4_oif = l3mdev_master_ifindex_by_index(net, oif);
        if (saddr)
                fl4->saddr = saddr->a4;

Thanks David. This works for me on 4.4 (along with commit 1a8524794fc7c70f44ac28e3a6e8fd637bc41f14 ('net: l3mdev: Add master device lookup by index')). Let me know if you have some other approach in mind or if this needs to be sent as an official patch.

--
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project

Reply via email to