netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Ahern <dsahern@kernel.org>
To: Florian Westphal <fw@strlen.de>, Guillaume Nault <gnault@redhat.com>
Cc: netdev@vger.kernel.org, Jakub Kicinski <kuba@kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>,
	netfilter-devel@vger.kernel.org, Phil Sutter <phil@nwl.cc>
Subject: Re: [PATCH 1/1] netfilter: nft_fib: Fix for rpath check with VRF devices
Date: Thu, 29 Sep 2022 11:54:42 -0600	[thread overview]
Message-ID: <d8adea18-2e1c-6c99-f334-bf6c19373baa@kernel.org> (raw)
In-Reply-To: <20220929162129.GA10152@breakpoint.cc>

On 9/29/22 9:21 AM, Florian Westphal wrote:
> Guillaume Nault <gnault@redhat.com> wrote:
> 
> [ CC David Ahern ]
> 
>> On Wed, Sep 28, 2022 at 01:39:08PM +0200, Florian Westphal wrote:
>>> From: Phil Sutter <phil@nwl.cc>
>>>
>>> Analogous to commit b575b24b8eee3 ("netfilter: Fix rpfilter
>>> dropping vrf packets by mistake") but for nftables fib expression:
>>> Add special treatment of VRF devices so that typical reverse path
>>> filtering via 'fib saddr . iif oif' expression works as expected.
>>>
>>> Fixes: f6d0cbcf09c50 ("netfilter: nf_tables: add fib expression")
>>> Signed-off-by: Phil Sutter <phil@nwl.cc>
>>> Signed-off-by: Florian Westphal <fw@strlen.de>
>>> ---
>>>  net/ipv4/netfilter/nft_fib_ipv4.c | 3 +++
>>>  net/ipv6/netfilter/nft_fib_ipv6.c | 6 +++++-
>>>  2 files changed, 8 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/net/ipv4/netfilter/nft_fib_ipv4.c b/net/ipv4/netfilter/nft_fib_ipv4.c
>>> index b75cac69bd7e..7ade04ff972d 100644
>>> --- a/net/ipv4/netfilter/nft_fib_ipv4.c
>>> +++ b/net/ipv4/netfilter/nft_fib_ipv4.c
>>> @@ -83,6 +83,9 @@ void nft_fib4_eval(const struct nft_expr *expr, struct nft_regs *regs,
>>>  	else
>>>  		oif = NULL;
>>>  
>>> +	if (priv->flags & NFTA_FIB_F_IIF)
>>> +		fl4.flowi4_oif = l3mdev_master_ifindex_rcu(oif);
>>> +
>>
>> Shouldn't we set .flowi4_l3mdev instead of .flowi4_oif?
> 
> No idea.
> db53cd3d88dc328dea2e968c9c8d3b4294a8a674 sets both.
> rp_filter modules in iptables only set flowi(6)_oif.
> 
> David, can you give advice on what the correct fix is?
> 
> Then we could change all users in netfilter at once rather than the
> current collection of random-looking guesses...

Old usage is setting flow oif and it gets converted to the L3 device if
there is one. The new usage is flow l3mdev, but I only updated places I
new I was testing.

ie.., use l3mdev in the flow struct if you have a VRF test case for it.

  reply	other threads:[~2022-09-29 17:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-28 11:39 [PATCH net-next 0/1] netfilter fix for net-next Florian Westphal
2022-09-28 11:39 ` [PATCH 1/1] netfilter: nft_fib: Fix for rpath check with VRF devices Florian Westphal
2022-09-28 17:40   ` patchwork-bot+netdevbpf
2022-09-29 16:10   ` Guillaume Nault
2022-09-29 16:21     ` Florian Westphal
2022-09-29 17:54       ` David Ahern [this message]
2022-09-30 14:10   ` Guillaume Nault
2022-09-30 14:47     ` Florian Westphal
2022-09-30 15:08       ` Guillaume Nault

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d8adea18-2e1c-6c99-f334-bf6c19373baa@kernel.org \
    --to=dsahern@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=fw@strlen.de \
    --cc=gnault@redhat.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=phil@nwl.cc \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).