🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #8245

Re: [PATCH net] net: vrf: Set L3MDEV OIF flag for outbound lookups

#8245
From: Gabriel Goller
Date: Wed, 28 Oct 2026 13:57
77 lines
9888 bytes
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.
> 
> 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")

> 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.

Thanks,
Gabriel
Technical Details
Message-ID: <auH8PdGEPaf2GI73@luna.proxmox.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-352869-linux-kernel-netdev=dewy.ru
References: <20261026164702.1415-1-akrn112@naver.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-352869-linux-kernel-netdev=dewy.ru
From: g.goller@proxmox.com (Gabriel Goller)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net] net: vrf: Set L3MDEV OIF flag for outbound lookups
Date: Wed, 28 Oct 2026 14:57:45 +0100
Organization: Usenet Network
Message-ID: <auH8PdGEPaf2GI73@luna.proxmox.com>
References: <20261026164702.1415-1-akrn112@naver.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Injection-Info: usenet.network;
	logging-data="1782321"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:oKbmgfr3BwKSUXOfacs5gkIjDPc= sha256:oAtwSOdXkzoVICcgAh8bnWxCLyq2ovymhn7uWK/jPwk=
	sha1:EaZYaIabVoKyMmWuEMewhwxATIk= sha256:luhLmILhp74pLdH+KCLoKlIo7kCpetvUi4zVgJmq2YA=
Content-Disposition: inline
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 28716125C32; Wed, 28 Oct 2026 16:58:07 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.05
X-Spam-Status: No, score=-3.05 tagged_above=-9999 required=6.31
	tests=[HEADER_FROM_DIFFERENT_DOMAINS=0.25, 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-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 man8jTDddD4l;
	Wed, 28 Oct 2026 16:58:00 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-352869-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=proxmox.com
X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id BE623125C33; Wed, 28 Oct 2026 16:57:56 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sto.lore.kernel.org (Postfix) with ESMTP id D1C296013EA; Wed, 28 Oct 2026 13:57: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=1793195873;
	b=5kjobBPVdELDy7NJ6hSb7nZ3EDyFDLxYT1CeMQWaJ0IB2uDoc1ZJdAS/VyYUTEMmg1oc
	 ycYdokyyEMsRg7F+iOTTmD2jLYDGZLnabQnR0b3EgeppO2WxZCw4xChbahl0W7BVqzgG4
	 oI2vUZCaf72VcVC6u6RNyIskt1n822bGj8eeadbfjU3TQrZORK8y2hizvj1q9Ru761PrT
	 gX5KnlCH7MLg8Fanj8QL6cnyjUrZUUrmQOKjlo1wi4hnNj4oM9hF1xwUb0QaWADtsI5qF
	 5K/9ONBtA3tH4hS3jQyzauOOg21clvS9PgnMLtiKFIz18TjgYuu4lOnSv5tz4K3yNKA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793195873;
	h=X-Original-To:Received:DMARC-Filter:Received:Date:From:To:Cc:Subject:
	 Message-ID:References:X-Mailing-List:List-Id:List-Post:List-Help:
	 List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 Content-Type:Content-Disposition:In-Reply-To:User-Agent:
	 X-Bm-Milter-Handled:X-Bm-Transport-Timestamp;
	bh=lFYSuTNU9Aha5dVkLgHFVvkfK+0CVs2/tZ42CwPSaCY=;
	b=BfLaJFlb15mebk3zsLTG5/wBkib+96o0gSnvgdZsPY2Wgry2xMb3YXzL9LdXIA1Nr3jy
	 1OKAvE1ezaUNEugyEi3qyvY2xbajbx4poKkVsZrm2mtf8jaJ/B/Bj/IkjQs6XwnAI4byb
	 smQXkqV7Rqu7GKIaUAKGnaeUqNOc2MfN0pI/K8zx/1e9+89PexPI5yyzmnRsqI3M+in60
	 3dveb68Rs2b/zBXJs8W+UVkhU9zCnzFVVCAKIH90P3UbHFu8o4Lwo152Ok+eB2PhRyjlV
	 SwF1R5fBwID1P2cvJ0C7U/pkvvA+5baAQCD/LFIJBxIAatkwGr6+ooDi5C3qXFpiZ4g==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dmarc=none header.from=proxmox.com;
	spf=pass smtp.mailfrom=proxmox.com;
	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 107D9606A329;
	Wed, 28 Oct 2026 13:57:53 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=94.136.29.106
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793195872;
	b=yIlfxUtBm1LMwxo9auOvITiuQZ89CYH1iV4DgCjHq4Db1OrHPAYLen3BY1V79mMjo3kH
	 lIWzdLRcLw3E61uSFotKHpIADkARJ9USplc+8pIWjuaH9Yy9y2r51vxRYNCTFA8DC3v3L
	 lhe4aVM9KLIqJ+CVazaoFLjf7DTht7RdB2LHJRxfjdJtidrXPqgDewWyfet6f0k+Dx6SH
	 5nfBV+nKfBQOOKtJLnh4ZNFP2F/DCqp4tr8LzWXMF5lNrsuvbL0EJB/QnuoI1IHJDEZqu
	 oMmFDk/gxEF0mz/sxQGUQaeXYqNGALUPeaA43vnB9U5Y7ds4hNh6EX0V5EQTtUV7f4A==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793195872;
	h=DMARC-Filter:Received:Date:From:To:Cc:Subject:Message-ID:References:
	 MIME-Version:Content-Type:Content-Disposition:In-Reply-To:User-Agent:
	 X-Bm-Milter-Handled:X-Bm-Transport-Timestamp;
	bh=lFYSuTNU9Aha5dVkLgHFVvkfK+0CVs2/tZ42CwPSaCY=;
	b=TJZCR9+MAQQGUi+OZnurhuSJxC3vxZmsB020kxSfMGMzfNt+ESDO+518JD15Os4z2r+S
	 0WbYi6pTVZ9sG6KQ+htySn4hhqEQFbIL0yWCTvYlYlXanHioJ//SVkW25/vVOOVwyKzg1
	 gHHsV5IuLbnttOYLerwvSZRzVJKRU6jHHewWvANS7BvoUJvZp3iuEhZ038T8LnJbtebVS
	 ciB85cE4WUDiSMdaw/T3sQfOyaPXmfOx1e1WsaIRylCdVWS7hPG4nvbW6rTnOf4MqOAXn
	 dKFptU83xX/IWshAUjRLklaBPcrkbdVOEJx/vP1xIJmYvOuCfvCuTfungcgPDVDv4tw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=none header.from=proxmox.com;
	spf=pass smtp.mailfrom=proxmox.com;
	arc=none smtp.remote-ip=94.136.29.106
X-Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 29901606A320
	for <netdev@vger.kernel.org>; Wed, 28 Oct 2026 13:57:49 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 29901606A320
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=proxmox.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=proxmox.com
X-Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
	by proxmox-new.maurer-it.com (Proxmox) with ESMTP id EA2C24383A;
	Wed, 28 Oct 2026 14:57:47 +0100 (CET)
X-Cc: dsahern@kernel.org, netdev@vger.kernel.org
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-In-Reply-To: <20261026164702.1415-1-akrn112@naver.com>
X-User-Agent: NeoMutt/20260504
X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2
X-Bm-Transport-Timestamp: 1793195866865