From: Ritaro Takenaka <ritarot634@gmail.com>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH] nf_flowtable: ensure dst.dev is not blackhole
Date: Tue, 26 Apr 2022 21:28:13 +0900 [thread overview]
Message-ID: <04e2c223-7936-481d-0032-0a55a21dca7a@gmail.com> (raw)
In-Reply-To: <YmfVpecE2UuiP6p8@salvia>
Thanks for your reply.
> In 5.4, this check is only enabled for xfrm.
Packet loss occurs with xmit (xfrm is not confirmed).
I also experienced packet loss with 5.10, which runs dst_check periodically.
Route GC and flowtable GC are not synchronized, so it is
necessary to check each packet.
> dst_check() should deal with this.
When dst_check is used, the performance degradation is not negligible.
From 900 Mbps to 700 Mbps with QCA9563 simple firewall.
I am sorry if you have received this mail twice.
On 2022/04/26 20:21, Pablo Neira Ayuso wrote:
> Hi,
>
> On Mon, Apr 25, 2022 at 05:08:38PM +0900, Ritaro Takenaka wrote:
>> Fixes sporadic IPv6 packet loss when flow offloading is enabled.
>> IPv6 route GC calls dst_dev_put() which makes dst.dev blackhole_netdev
>> even if dst is cached in flow offload. If a packet passes through this
>> invalid flow, packet loss will occur.
>> This is from Commit 227e1e4d0d6c (netfilter: nf_flowtable: skip device
>> lookup from interface index), as outdev was cached independently before.
>> Packet loss is reported on OpenWrt with Linux 5.4 and later.
>
> dst_check() should deal with this.
>
> In 5.4, this check is only enabled for xfrm.
>
>> Signed-off-by: Ritaro Takenaka <ritarot634@gmail.com>
>> ---
>> net/netfilter/nf_flow_table_ip.c | 5 +++++
>> 1 file changed, 5 insertions(+)
>>
>> diff --git a/net/netfilter/nf_flow_table_ip.c b/net/netfilter/nf_flow_table_ip.c
>> index 32c0eb1b4..12f81661d 100644
>> --- a/net/netfilter/nf_flow_table_ip.c
>> +++ b/net/netfilter/nf_flow_table_ip.c
>> @@ -624,6 +624,11 @@ nf_flow_offload_ipv6_hook(void *priv, struct sk_buff *skb,
>> if (nf_flow_state_check(flow, ip6h->nexthdr, skb, thoff))
>> return NF_ACCEPT;
>>
>> + if (unlikely(tuplehash->tuple.dst_cache->dev == blackhole_netdev)) {
>> + flow_offload_teardown(flow);
>> + return NF_ACCEPT;
>> + }
>> +
>> if (skb_try_make_writable(skb, thoff + hdrsize))
>> return NF_DROP;
>>
>> --
>> 2.25.1
>>
next prev parent reply other threads:[~2022-04-26 12:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-25 8:08 [PATCH] nf_flowtable: ensure dst.dev is not blackhole Ritaro Takenaka
2022-04-26 11:21 ` Pablo Neira Ayuso
2022-04-26 11:55 ` りたろう
2022-04-26 12:28 ` Ritaro Takenaka [this message]
2022-04-27 15:10 ` Pablo Neira Ayuso
2022-04-30 17:23 ` Ritaro Takenaka
2022-05-09 6:32 ` Pablo Neira Ayuso
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=04e2c223-7936-481d-0032-0a55a21dca7a@gmail.com \
--to=ritarot634@gmail.com \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
/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).