Article View: linux.kernel.netdev
Article #8263Re: [PATCH net] net: vrf: Set L3MDEV OIF flag for outbound lookups
From: David Ahern
Date: Wed, 28 Oct 2026 14:35
Date: Wed, 28 Oct 2026 14:35
93 lines
11144 bytes
11144 bytes
[ cc author of referenced Fixes commit ]
On 10/28/26 7:57 AM, Gabriel Goller wrote:
> On 27.10.2026 01:47, Haon KIM wrote:
>> The IPv4 and IPv6 outbound processing paths in the VRF driver
>> set the L3 master device index in the flow structure before
>> performing route lookups, but do not set
>> FLOWI_FLAG_L3MDEV_OIF.
>>
>> Both the IPv4 and IPv6 outbound processing paths contain
>> the comment "needed to match OIF rule", indicating that
>> the L3 master device index is needed to match OIF rules.
>> However, FIB rule matching requires both
>> FLOWI_FLAG_L3MDEV_OIF and a matching flowi_l3mdev index
>> to match a rule specifying the VRF master as the output
>> interface.
>>
>> The matching logic introduced by commit 2d300ce0b783
>> ("net: fib_rules: Fix iif / oif matching on L3 master device")
>> requires FLOWI_FLAG_L3MDEV_OIF to be set for OIF rules to
>> match the VRF master. The existing outbound processing paths
>> set the L3 master device index directly, so
>> l3mdev_update_flow() does not set this flag.
>>
>> Consequently, OIF rules specifying the VRF master may fail
>> to match these flows.
>>
>> Set FLOWI_FLAG_L3MDEV_OIF in both outbound processing paths
>> so that FIB rules can correctly match the VRF master as the
>> output interface.
>>
>> The issue was identified by code inspection. Runtime testing
>> has not been performed.
Please do not do that; do some testing before sending patches.
>>
>> Fixes: 2d300ce0b783 ("net: fib_rules: Fix iif / oif matching on L3 master device")
>
> I think this should be:
>
> Fixes: 40867d74c374 ("net: Add l3mdev index to flow struct and avoid oif reset for port devices")
No, the Fixes above is correct if there is a bug; the
FLOWI_FLAG_L3MDEV_OIF flag was introduced by 2d300ce0b783 and was not
present for 40867d74c374.
That said, unless I am misremembering something the flag does not need
to be set in this outbound path.
>
>> Signed-off-by: Haon KIM <akrn112@naver.com>
>> ---
>> drivers/net/vrf.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
>> index 79d433f49f80..f22ac91fefd4 100644
>> --- a/drivers/net/vrf.c
>> +++ b/drivers/net/vrf.c
>> @@ -432,6 +432,7 @@ static netdev_tx_t vrf_process_v6_outbound(struct sk_buff *skb,
>> fl6.flowlabel = ip6_flowinfo(iph);
>> fl6.flowi6_mark = skb->mark;
>> fl6.flowi6_proto = iph->nexthdr;
>> + fl6.flowi6_flags = FLOWI_FLAG_L3MDEV_OIF;
>>
>> dst = ip6_dst_lookup_flow(net, NULL, &fl6, NULL);
>> if (IS_ERR(dst) || dst == dst_null)
>> @@ -506,7 +507,7 @@ static netdev_tx_t vrf_process_v4_outbound(struct sk_buff *skb,
>> fl4.flowi4_l3mdev = vrf_dev->ifindex;
>> fl4.flowi4_iif = LOOPBACK_IFINDEX;
>> fl4.flowi4_dscp = ip4h_dscp(ip4h);
>> - fl4.flowi4_flags = FLOWI_FLAG_ANYSRC;
>> + fl4.flowi4_flags = FLOWI_FLAG_ANYSRC | FLOWI_FLAG_L3MDEV_OIF;
>> fl4.flowi4_proto = ip4h->protocol;
>> fl4.daddr = ip4h->daddr;
>> fl4.saddr = ip4h->saddr;
>
> Also this is a breaking change, before the patch, this rule matched:
>
> ip rule add iif vrf0 table 100
>
> After the patch, this one matches (and the iif rule above no longer does):
>
> ip rule add oif vrf0 table 100
>
> A selftest would also be nice.
See commit message in cited Fixes commit. Have you checked
fib_rule_tests.sh? If not, try the commands in 2d300ce0b783 and if they
are broken, there is a problem. If not, let's get them added to the
selftest.
Technical Details
Message-ID:
<a3e50c6f-0da2-4e77-80b5-2ae371676280@kernel.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-352888-linux-kernel-netdev=dewy.ruReferences:
<20261026164702.1415-1-akrn112@naver.com> <auH8PdGEPaf2GI73@luna.proxmox.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-352888-linux-kernel-netdev=dewy.ru From: dsahern@kernel.org (David Ahern) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net] net: vrf: Set L3MDEV OIF flag for outbound lookups Date: Wed, 28 Oct 2026 08:35:48 -0600 Organization: Usenet Network Message-ID: <a3e50c6f-0da2-4e77-80b5-2ae371676280@kernel.org> References: <20261026164702.1415-1-akrn112@naver.com> <auH8PdGEPaf2GI73@luna.proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Injection-Info: usenet.network; logging-data="1789086"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:KoIKhkEJ5vGNtrmN7y+AuqpiHik= sha256:/TrKmttWInk9uTfcGVkyx634RCxWqXQBKRWNwycXNHM= sha1:2ESEWRsGon/fiApByL7O2mbU5jI= sha256:32S/ov0JFsr66xxCZBUokhnT1lvfQ1UchKjhZhfEQwA= Content-Language: en-US List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 2AEAE125C37; Wed, 28 Oct 2026 17:37:27 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lHUjn7TtcBzl; Wed, 28 Oct 2026 17:37:24 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-352888-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 5D2D4125C36; Wed, 28 Oct 2026 17:37:14 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id 7D21A292DE; Wed, 28 Oct 2026 14:35:53 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1793198151; b=x4DjpteECDdt3gtEwTfrl0xUR19sHsctnV9oE66ldRwnlqNZ+vOha+ElQQzfKHUYoyNB tRwF/lPAB+eFlTuTsMOmPb1LP6MPEnhZSTswesX064UuK7pJkXANiDC/FHJHgyy9NAjTF MjxzKh7TLdCDhuhoiPEjixEFZVouXLdPtJg2+ZYngQMMS8uXBfH3NfRFZgnXRfvs8kaD+ n3QsZEhLKbdXo3bR+Rcu8E1Swa0Duf64ytElFpLK2yB1H/340bgHixsoxpMf6qgdxVuZ6 2SUELf4UWKp4Nve283lq5sHx9AgDGkCwg4+HLAXx+2vkw2aatldLOzuedBOmjNpCc6A== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793198151; h=X-Original-To:Received:Received:DKIM-Signature:Message-ID:Date: X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version:User-Agent: Subject:Content-Language:To:Cc:References:From:In-Reply-To: Content-Type:Content-Transfer-Encoding; bh=sTv72HXLS642hKtRKZu2ty/aYX7p7GlGK+o3A+/U4nU=; b=gHtRP8rBaXKdmpoNBj/YP1/ZtlBwO18udr+YPNPsDBlFVkgdck25SPiBWJ0Tb9NneaW3 /u8q2MrDpkXLKCNVe22ZMPjCNv9AcDgYh9UDWeVuyUmj1SRppaEZXuUo3fMc8jRlaUPnJ wMKXsDmEncXClWcF4Xej5G+XxHJIlzb2jyExc0ZQw4Tk0PL0IugKiFRnNT7btzISn10/T 5u/d/xnV/3p++z7FXwhBLqZ1kuQCfJ0vPABpr9CmSAQfvHLPVzPeGbYaA67L+w+nIZne6 eoufKIOmkRJWCP8DHw3HFnZaN88GCMd/Sd8pOPml3PuBlYJ6DWySffLfnN101XJtfGw== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Qs6OO7h2; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4C66E606A31C; Wed, 28 Oct 2026 14:35:51 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Qs6OO7h2 X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793198150; b=UWWdfSVlSUmY5+/QmOdedRxF/rXv+gqmSada7SRzUlUbqcSs74rpTpxBiNxdYRBNxwDo 03azLF4DxVlWTygNXfZLav4qLkUsrcwMNy1M+b0lGdGB58HO8reybkZHSlAMIKmitJBwC Nr9ixZ1WWMYMI2A2toLX3G+y/na28dg8Fzf3G9ul5vGOGohak9YFMLSvDfeG6LzlGLhLa RDF0QI2T2nv4lG1X2BQRSgOzwo/2iyUq9xHyv6Aq1XU4vXQRpD6LMgUX3DThVdNcghZiE ByPNsa9/OFDxYoTHdJiDWe8qZYS+VU8jwD5pfu2lVvddVtwOMevAN/5EJCXosSqHS+A== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793198150; h=Received:DKIM-Signature:Message-ID:Date:MIME-Version:User-Agent: Subject:Content-Language:To:Cc:References:From:In-Reply-To: Content-Type:Content-Transfer-Encoding; bh=sTv72HXLS642hKtRKZu2ty/aYX7p7GlGK+o3A+/U4nU=; b=eeDkbPdftrlTOPT1a6t+pm8g3vQtMGGL0BiCFvLd8wCmznA6WMUAnOvK/amtQeeUNToT MjDfvsvg9PuCaL8JgLAMV8+NT8g1tdihfLA1sAzuIWeZOR2JEUGsHmNIuFIx0hnjo2dcK alU7KHsUEAYlSQ0p5PIGsdS2avb+70wmso6Sp7exNfA8LDpuoCGzxr2MW4gx4Ua12UAjW VlgRnG1dZHdMXtOW1guzx+lpt6B65yuhpIFBONpXW5eFj3VTX/QlSuILdt2HK/lNHsYMy lGSAeaTZCQkENZbp09hYGO9EMvGYoubzrKGtsk1jlFtdbPV18T89A3WB5nn/6Og2Hfw== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Qs6OO7h2; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3106A606A32D for <netdev@vger.kernel.org>; Wed, 28 Oct 2026 14:35:50 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id CE80A1F01829; Wed, 28 Oct 2026 14:35:49 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1793198150; bh=sTv72HXLS642hKtRKZu2ty/aYX7p7GlGK+o3A+/U4nU=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=Qs6OO7h2KpnuMZniQ3yYLQSDSUI74XKlKqCQm8mCF5K1mYmnyr/jHuNW/GSuIMdmo sulhdIvrz5xZanU496QWJWXh2KWYp78oPrDA9GxjCbBmvDor1+/bXiUP3+DhlaR4aj YDBAN7zlhD8PkjDeU75dBKZkAYiSPhiejMEZE5S60Beg21IiYIzZOCi7zVJEtBjOXR bQbCajAziWl/rtKZsRpBEekCmCu0lK4WTvZOr7yLlQXOebB0/GyYoA/rEGxNCksvfR Ojg3WzIv488v27LYs1AITaMCFbeZPmPe5MRA0nCJlSQ8oAyWINKlk6OvrStxV6HMvx mWJzyBfmJraxQ== X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-User-Agent: Mozilla Thunderbird X-Cc: netdev@vger.kernel.org X-In-Reply-To: <auH8PdGEPaf2GI73@luna.proxmox.com>