From patchwork Fri Apr 1 01:53:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Ahern X-Patchwork-Id: 12797840 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20CC6C433F5 for ; Fri, 1 Apr 2022 01:53:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243869AbiDABzb (ORCPT ); Thu, 31 Mar 2022 21:55:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233627AbiDABza (ORCPT ); Thu, 31 Mar 2022 21:55:30 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9DC52190B4D for ; Thu, 31 Mar 2022 18:53:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9AA76B82330 for ; Fri, 1 Apr 2022 01:53:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B8F6DC340F0; Fri, 1 Apr 2022 01:53:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1648778018; bh=SwLUjluPBxgTPt6SbAvhhtI+EBfSOUIjsKZh4LXqAiA=; h=From:To:Cc:Subject:Date:From; b=CWvRPB9G0QVmzxFpXBxhopEhFRO9+TSV3FuEu6lzTz6/HpQwbJt8gtmfNsfkgzwnj csl48xO1WkniZAjAKmGIINkPmNouvS0ajiNylzIdqNrRgm/eXwqDFPMugbhZKB4DJe U88xkgK7L6Q1PBcA/No7uTmgpCu3PoWsxHohtud8iStam0KVEv009NNFIrJqS6v1YL hEKYh1GtdnwInGugZOCxh8oF8VzfSX0Bj/sT0K/BgBxbA5qEEnKeYNXtw9PQJ1mrjt eL+DwfU0doUQ8+/H/Fcm1ajRlLd3Q0gKJCcMzzy+VWmsBirCc4YPa/rmp+KR846Iw+ BRgCvx6404Z7A== From: David Ahern To: netdev@vger.kernel.org, kuba@kernel.org, davem@davemloft.net, pabeni@redhat.com Cc: oliver.sang@intel.com, David Ahern Subject: [PATCH net] xfrm: Pass flowi_oif or l3mdev as oif to xfrm_dst_lookup Date: Thu, 31 Mar 2022 19:53:34 -0600 Message-Id: <20220401015334.40252-1-dsahern@kernel.org> X-Mailer: git-send-email 2.24.3 (Apple Git-128) MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The commit referenced in the Fixes tag no longer changes the flow oif to the l3mdev ifindex. A xfrm use case was expecting the flowi_oif to be the VRF if relevant and the change broke that test. Update xfrm_bundle_create to pass oif if set and any potential flowi_l3mdev if oif is not set. Fixes: 40867d74c374 ("net: Add l3mdev index to flow struct and avoid oif reset for port devices") Reported-by: kernel test robot Signed-off-by: David Ahern --- net/xfrm/xfrm_policy.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 19aa994f5d2c..00bd0ecff5a1 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c @@ -2593,12 +2593,14 @@ static struct dst_entry *xfrm_bundle_create(struct xfrm_policy *policy, if (xfrm[i]->props.mode != XFRM_MODE_TRANSPORT) { __u32 mark = 0; + int oif; if (xfrm[i]->props.smark.v || xfrm[i]->props.smark.m) mark = xfrm_smark_get(fl->flowi_mark, xfrm[i]); family = xfrm[i]->props.family; - dst = xfrm_dst_lookup(xfrm[i], tos, fl->flowi_oif, + oif = fl->flowi_oif ? : fl->flowi_l3mdev; + dst = xfrm_dst_lookup(xfrm[i], tos, oif, &saddr, &daddr, family, mark); err = PTR_ERR(dst); if (IS_ERR(dst))