From: Florian Westphal <fw@strlen.de>
To: Phil Sutter <phil@nwl.cc>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>,
Miaohe Lin <linmiaohe@huawei.com>,
netfilter-devel@vger.kernel.org
Subject: Re: [nf PATCH] netfilter: nft_fib: Fix for rpath check with VRF devices
Date: Wed, 21 Sep 2022 00:48:27 +0200 [thread overview]
Message-ID: <YypDOwT2QaHEgXfS@strlen.de> (raw)
In-Reply-To: <20220920212432.4168-1-phil@nwl.cc>
Phil Sutter <phil@nwl.cc> wrote:
> 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>
> ---
> net/ipv4/netfilter/nft_fib_ipv4.c | 3 +++
> net/ipv6/netfilter/nft_fib_ipv6.c | 7 ++++++-
> 2 files changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/net/ipv4/netfilter/nft_fib_ipv4.c b/net/ipv4/netfilter/nft_fib_ipv4.c
> index b75cac69bd7e6..7ade04ff972d7 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);
> +
> if (nft_hook(pkt) == NF_INET_PRE_ROUTING &&
> nft_fib_is_loopback(pkt->skb, nft_in(pkt))) {
> nft_fib_store_result(dest, priv, nft_in(pkt));
> diff --git a/net/ipv6/netfilter/nft_fib_ipv6.c b/net/ipv6/netfilter/nft_fib_ipv6.c
> index 8970d0b4faeb4..3f860e331580d 100644
> --- a/net/ipv6/netfilter/nft_fib_ipv6.c
> +++ b/net/ipv6/netfilter/nft_fib_ipv6.c
> @@ -170,6 +170,10 @@ void nft_fib6_eval(const struct nft_expr *expr, struct nft_regs *regs,
> else if (priv->flags & NFTA_FIB_F_OIF)
> oif = nft_out(pkt);
>
> + if ((priv->flags & NFTA_FIB_F_IIF) &&
> + (netif_is_l3_master(oif) || netif_is_l3_slave(oif)))
> + fl6.flowi6_oif = oif->ifindex;
> +
I was about to apply this, but this initialisation comes before
nft_fib6_flowi_init(), should this be *after*, or part of
nft_fib6_flowi_init() function instead?
next prev parent reply other threads:[~2022-09-20 22:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-20 21:24 [nf PATCH] netfilter: nft_fib: Fix for rpath check with VRF devices Phil Sutter
2022-09-20 22:48 ` Florian Westphal [this message]
2022-09-20 23:24 ` Phil Sutter
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=YypDOwT2QaHEgXfS@strlen.de \
--to=fw@strlen.de \
--cc=linmiaohe@huawei.com \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.