From: Florian Westphal <fw@strlen.de>
To: Liping Zhang <zlpnobody@163.com>
Cc: pablo@netfilter.org, netfilter-devel@vger.kernel.org,
fw@strlen.de, Liping Zhang <zlpnobody@gmail.com>
Subject: Re: [PATCH nf-next] netfilter: nft_fib: store loopback interface to dreg when rt is local
Date: Mon, 28 Nov 2016 13:25:07 +0100 [thread overview]
Message-ID: <20161128122507.GB28510@breakpoint.cc> (raw)
In-Reply-To: <1479994128-16654-1-git-send-email-zlpnobody@163.com>
Liping Zhang <zlpnobody@163.com> wrote:
> From: Liping Zhang <zlpnobody@gmail.com>
>
> In general, we haven't do routing lookup in PREROUTING hook, so it's
> very likely that fib4/6_is_local will not be met. Then the *dest will
> be set to 0 because we do nothing when the fib result is RTN_LOCAL.
>
> So if the user want to drop all packets which cannot be routed,
> and input the following nft rule:
> # nft add rule filter prerouting fib daddr oif eq 0 drop
>
> Then all the packets which destinate to local will be dropped
> incorrectly.
>
> Fixes: f6d0cbcf09c5 ("netfilter: nf_tables: add fib expression")
> Signed-off-by: Liping Zhang <zlpnobody@gmail.com>
> ---
> net/ipv4/netfilter/nft_fib_ipv4.c | 3 ++-
> net/ipv6/netfilter/nft_fib_ipv6.c | 8 ++++++--
> 2 files changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/net/ipv4/netfilter/nft_fib_ipv4.c b/net/ipv4/netfilter/nft_fib_ipv4.c
> index 2581363..2107775 100644
> --- a/net/ipv4/netfilter/nft_fib_ipv4.c
> +++ b/net/ipv4/netfilter/nft_fib_ipv4.c
> @@ -130,7 +130,8 @@ void nft_fib4_eval(const struct nft_expr *expr, struct nft_regs *regs,
> switch (res.type) {
> case RTN_UNICAST:
> break;
> - case RTN_LOCAL: /* should not appear here, see fib4_is_local() above */
> + case RTN_LOCAL:
> + nft_fib_store_result(dest, priv->result, pkt, LOOPBACK_IFINDEX);
Liping, what about doing:
case RTN_LOCAL:
if (priv->flags & NFTA_FIB_F_DADDR)
nft_fib_store_result(dest, priv->result, pkt, LOOPBACK_IFINDEX);
AFAICS this will make above rule work while the saddr test will
still appear to not have a route at all.
What do you think?
next prev parent reply other threads:[~2016-11-28 12:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-24 13:28 [PATCH nf-next] netfilter: nft_fib: store loopback interface to dreg when rt is local Liping Zhang
2016-11-24 13:50 ` Florian Westphal
2016-11-24 14:31 ` Liping Zhang
2016-11-24 14:48 ` Florian Westphal
2016-11-25 13:47 ` Liping Zhang
2016-11-28 12:25 ` Florian Westphal [this message]
2016-11-30 10:18 ` Liping Zhang
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=20161128122507.GB28510@breakpoint.cc \
--to=fw@strlen.de \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
--cc=zlpnobody@163.com \
--cc=zlpnobody@gmail.com \
/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).