* [PATCH] nf_conntrack_proto_udp: do not accept packets with IPS_NAT_CLASH
@ 2024-09-30 8:53 Hannes Reinecke
2024-09-30 9:29 ` Florian Westphal
0 siblings, 1 reply; 5+ messages in thread
From: Hannes Reinecke @ 2024-09-30 8:53 UTC (permalink / raw)
To: Pablo Neira Ayuso
Cc: Jozsef Kadlecsik, netfilter-devel, Michal Kubecek,
Hannes Reinecke
Commit c46172147ebb changed the logic when to move to ASSURED if
a NAT CLASH is detected. In particular, it moved to ASSURED even
if a NAT CLASH had been detected, with the idea that they will
time out soon (and then the state will be cleared).
However, under high load this caused the timeout to happen too
slow causing an IPVS malfunction.
This patch revert part of that patch, as for NAT CLASH we
should not move to ASSURED at all.
Fixes: c46172147ebb ("netfilter: conntrack: do not auto-delete clash entries on reply")
Signed-off-by: Hannes Reinecke <hare@kernel.org>
---
net/netfilter/nf_conntrack_proto_udp.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/net/netfilter/nf_conntrack_proto_udp.c b/net/netfilter/nf_conntrack_proto_udp.c
index 0030fbe8885c..def3e06430eb 100644
--- a/net/netfilter/nf_conntrack_proto_udp.c
+++ b/net/netfilter/nf_conntrack_proto_udp.c
@@ -116,10 +116,6 @@ int nf_conntrack_udp_packet(struct nf_conn *ct,
nf_ct_refresh_acct(ct, ctinfo, skb, extra);
- /* never set ASSURED for IPS_NAT_CLASH, they time out soon */
- if (unlikely((status & IPS_NAT_CLASH)))
- return NF_ACCEPT;
-
/* Also, more likely to be important, and not a probe */
if (stream && !test_and_set_bit(IPS_ASSURED_BIT, &ct->status))
nf_conntrack_event_cache(IPCT_ASSURED, ct);
--
2.35.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] nf_conntrack_proto_udp: do not accept packets with IPS_NAT_CLASH
2024-09-30 8:53 [PATCH] nf_conntrack_proto_udp: do not accept packets with IPS_NAT_CLASH Hannes Reinecke
@ 2024-09-30 9:29 ` Florian Westphal
2024-10-08 16:27 ` Yadan Fan
0 siblings, 1 reply; 5+ messages in thread
From: Florian Westphal @ 2024-09-30 9:29 UTC (permalink / raw)
To: Hannes Reinecke
Cc: Pablo Neira Ayuso, Jozsef Kadlecsik, netfilter-devel,
Michal Kubecek
Hannes Reinecke <hare@kernel.org> wrote:
> Commit c46172147ebb changed the logic when to move to ASSURED if
> a NAT CLASH is detected. In particular, it moved to ASSURED even
> if a NAT CLASH had been detected,
I'm not following. The code you are removing returns early
for nat clash case.
Where does it move to assured if nat clash is detected?
> However, under high load this caused the timeout to happen too
> slow causing an IPVS malfunction.
Can you elaborate?
> This patch revert part of that patch, as for NAT CLASH we
> should not move to ASSURED at all.
> nf_ct_refresh_acct(ct, ctinfo, skb, extra);
>
> - /* never set ASSURED for IPS_NAT_CLASH, they time out soon */
> - if (unlikely((status & IPS_NAT_CLASH)))
> - return NF_ACCEPT;
> -
> /* Also, more likely to be important, and not a probe */
> if (stream && !test_and_set_bit(IPS_ASSURED_BIT, &ct->status))
> nf_conntrack_event_cache(IPCT_ASSURED, ct);
AFAICS with this patch we now do move to assured unconditionally?
The changelog and patch seem contradictory to me.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] nf_conntrack_proto_udp: do not accept packets with IPS_NAT_CLASH
2024-09-30 9:29 ` Florian Westphal
@ 2024-10-08 16:27 ` Yadan Fan
2024-10-08 16:45 ` Florian Westphal
0 siblings, 1 reply; 5+ messages in thread
From: Yadan Fan @ 2024-10-08 16:27 UTC (permalink / raw)
To: Florian Westphal, Hannes Reinecke
Cc: Pablo Neira Ayuso, Jozsef Kadlecsik, netfilter-devel,
Michal Kubecek
On 9/30/24 17:29, Florian Westphal wrote:
> Hannes Reinecke <hare@kernel.org> wrote:
>> Commit c46172147ebb changed the logic when to move to ASSURED if
>> a NAT CLASH is detected. In particular, it moved to ASSURED even
>> if a NAT CLASH had been detected,
>
> I'm not following. The code you are removing returns early
> for nat clash case.
>
> Where does it move to assured if nat clash is detected?
>
>> However, under high load this caused the timeout to happen too
>> slow causing an IPVS malfunction.
>
> Can you elaborate?
Hi Florian,
We have a customer who encountered an issue that UDP packets kept in
UNREPLIED in conntrack table when there is large number of UDP packets
sent from their application, the application send packets through
multiple threads,
it caused NAT clash because the same SNATs were used for multiple
connections setup,
so that initial packets will be flagged with IPS_NAT_CLASH, and this
snippet of codes
just makes IPS_NAT_CLASH flagged packets never be marked as ASSURED,
which caused
all subsequent UDP packets got dropped.
Issue just disappeared after deleting this portion.
Yadan,
SUSE L3
>
>> This patch revert part of that patch, as for NAT CLASH we
>> should not move to ASSURED at all.
>
>> nf_ct_refresh_acct(ct, ctinfo, skb, extra);
>>
>> - /* never set ASSURED for IPS_NAT_CLASH, they time out soon */
>> - if (unlikely((status & IPS_NAT_CLASH)))
>> - return NF_ACCEPT;
>> -
>> /* Also, more likely to be important, and not a probe */
>> if (stream && !test_and_set_bit(IPS_ASSURED_BIT, &ct->status))
>> nf_conntrack_event_cache(IPCT_ASSURED, ct);
>
> AFAICS with this patch we now do move to assured unconditionally?
>
> The changelog and patch seem contradictory to me.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] nf_conntrack_proto_udp: do not accept packets with IPS_NAT_CLASH
2024-10-08 16:27 ` Yadan Fan
@ 2024-10-08 16:45 ` Florian Westphal
2024-10-10 11:11 ` Yadan Fan
0 siblings, 1 reply; 5+ messages in thread
From: Florian Westphal @ 2024-10-08 16:45 UTC (permalink / raw)
To: Yadan Fan
Cc: Florian Westphal, Hannes Reinecke, Pablo Neira Ayuso,
Jozsef Kadlecsik, netfilter-devel, Michal Kubecek
Yadan Fan <ydfan@suse.com> wrote:
> On 9/30/24 17:29, Florian Westphal wrote:
> > Hannes Reinecke <hare@kernel.org> wrote:
> > > Commit c46172147ebb changed the logic when to move to ASSURED if
> > > a NAT CLASH is detected. In particular, it moved to ASSURED even
> > > if a NAT CLASH had been detected,
> >
> > I'm not following. The code you are removing returns early
> > for nat clash case.
> >
> > Where does it move to assured if nat clash is detected?
> >
> > > However, under high load this caused the timeout to happen too
> > > slow causing an IPVS malfunction.
> >
> > Can you elaborate?
>
> Hi Florian,
>
> We have a customer who encountered an issue that UDP packets kept in
> UNREPLIED in conntrack table when there is large number of UDP packets
> sent from their application, the application send packets through multiple
> threads,
> it caused NAT clash because the same SNATs were used for multiple
> connections setup,
> so that initial packets will be flagged with IPS_NAT_CLASH, and this snippet
> of codes
> just makes IPS_NAT_CLASH flagged packets never be marked as ASSURED, which
> caused
> all subsequent UDP packets got dropped.
I think the only thing remaining is to rewrite the commit message to
say that not setting assured will drop NAT_CLASH replies in case server
is very busy and early_drop logic kicks in.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] nf_conntrack_proto_udp: do not accept packets with IPS_NAT_CLASH
2024-10-08 16:45 ` Florian Westphal
@ 2024-10-10 11:11 ` Yadan Fan
0 siblings, 0 replies; 5+ messages in thread
From: Yadan Fan @ 2024-10-10 11:11 UTC (permalink / raw)
To: Florian Westphal
Cc: Hannes Reinecke, Pablo Neira Ayuso, Jozsef Kadlecsik,
netfilter-devel, Michal Kubecek
On 10/9/24 00:45, Florian Westphal wrote:
> Yadan Fan <ydfan@suse.com> wrote:
>> On 9/30/24 17:29, Florian Westphal wrote:
>>> Hannes Reinecke <hare@kernel.org> wrote:
>>>> Commit c46172147ebb changed the logic when to move to ASSURED if
>>>> a NAT CLASH is detected. In particular, it moved to ASSURED even
>>>> if a NAT CLASH had been detected,
>>>
>>> I'm not following. The code you are removing returns early
>>> for nat clash case.
>>>
>>> Where does it move to assured if nat clash is detected?
>>>
>>>> However, under high load this caused the timeout to happen too
>>>> slow causing an IPVS malfunction.
>>>
>>> Can you elaborate?
>>
>> Hi Florian,
>>
>> We have a customer who encountered an issue that UDP packets kept in
>> UNREPLIED in conntrack table when there is large number of UDP packets
>> sent from their application, the application send packets through multiple
>> threads,
>> it caused NAT clash because the same SNATs were used for multiple
>> connections setup,
>> so that initial packets will be flagged with IPS_NAT_CLASH, and this snippet
>> of codes
>> just makes IPS_NAT_CLASH flagged packets never be marked as ASSURED, which
>> caused
>> all subsequent UDP packets got dropped.
>
> I think the only thing remaining is to rewrite the commit message to
> say that not setting assured will drop NAT_CLASH replies in case server
> is very busy and early_drop logic kicks in.
Thanks, I will submit a new patch with the new commit message
continuing the work from Hannes.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-10-10 11:11 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-30 8:53 [PATCH] nf_conntrack_proto_udp: do not accept packets with IPS_NAT_CLASH Hannes Reinecke
2024-09-30 9:29 ` Florian Westphal
2024-10-08 16:27 ` Yadan Fan
2024-10-08 16:45 ` Florian Westphal
2024-10-10 11:11 ` Yadan Fan
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).