Skip to contentSkip to conversation

ipv4: Restore flowi4_oif update before call to xfrm_lookup_route

PATCH In review David Ahern 2 participants 2 messages Oct 9, 2020 – Oct 10, 2020

Subsystems (3)
lore
Share & tools
lore

David Ahern

author maintainer
#0 lore raw

PATCH 1/1 ipv4: Restore flowi4_oif update before call to xfrm_lookup_route

Tobias reported regressions in IPsec tests following the patch referenced by the Fixes tag below. The root cause is dropping the reset of the flowi4_oif after the fib_lookup. Apparently it is needed for xfrm cases, so restore the oif update to ip_route_output_flow right before the call to xfrm_lookup_route.

Fixes 2fbc6e89b2f1 ("ipv4: Update exception handling for multipath routes via same device")
---
 net/ipv4/route.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
net/ipv4/route.c +3 -1
index 58642b29a499..9bd30fd4de4b 100644
@@ -2769,10 +2769,12 @@ struct rtable *ip_route_output_flow(struct net *net, struct flowi4 *flp4,
 	if (IS_ERR(rt))
 		return rt;
 
-	if (flp4->flowi4_proto)
+	if (flp4->flowi4_proto) {
+		flp4->flowi4_oif = rt->dst.dev->ifindex;
 		rt = (struct rtable *)xfrm_lookup_route(net, &rt->dst,
 							flowi4_to_flowi(flp4),
 							sk, 0);
+	}
 
 	return rt;
 }
Signature · 1 line
2.24.3 (Apple Git-128)
maintainer
#1 lore raw
Quoted 9 lines · On Fri, 9 Oct 2020 11:01:01 -0700 David Ahern wrote:

Tobias reported regressions in IPsec tests following the patch referenced by the Fixes tag below. The root cause is dropping the reset of the flowi4_oif after the fib_lookup. Apparently it is needed for xfrm cases, so restore the oif update to ip_route_output_flow right before the call to xfrm_lookup_route.

Fixes 2fbc6e89b2f1 ("ipv4: Update exception handling for multipath routes via same device")

Applied and queued for stable, thank you!