mbox series

[net-next,v6,0/7] Allow offloading of UDP NEW connections via act_ct

Message ID 20230201163100.1001180-1-vladbu@nvidia.com (mailing list archive)
Headers show
Series Allow offloading of UDP NEW connections via act_ct | expand

Message

Vlad Buslov Feb. 1, 2023, 4:30 p.m. UTC
Currently only bidirectional established connections can be offloaded
via act_ct. Such approach allows to hardcode a lot of assumptions into
act_ct, flow_table and flow_offload intermediate layer codes. In order
to enabled offloading of unidirectional UDP NEW connections start with
incrementally changing the following assumptions:

- Drivers assume that only established connections are offloaded and
  don't support updating existing connections. Extract ctinfo from meta
  action cookie and refuse offloading of new connections in the drivers.

- Fix flow_table offload fixup algorithm to calculate flow timeout
  according to current connection state instead of hardcoded
  "established" value.

- Add new flow_table flow flag that designates bidirectional connections
  instead of assuming it and hardcoding hardware offload of every flow
  in both directions.

- Add new flow_table flow flag that designates connections that are
  offloaded to hardware as "established" instead of assuming it. This
  allows some optimizations in act_ct and prevents spamming the
  flow_table workqueue with redundant tasks.

With all the necessary infrastructure in place modify act_ct to offload
UDP NEW as unidirectional connection. Pass reply direction traffic to CT
and promote connection to bidirectional when UDP connection state
changes to "assured". Rely on refresh mechanism to propagate connection
state change to supporting drivers.

Note that early drop algorithm that is designed to free up some space in
connection tracking table when it becomes full (by randomly deleting up
to 5% of non-established connections) currently ignores connections
marked as "offloaded". Now, with UDP NEW connections becoming
"offloaded" it could allow malicious user to perform DoS attack by
filling the table with non-droppable UDP NEW connections by sending just
one packet in single direction. To prevent such scenario change early
drop algorithm to also consider "offloaded" connections for deletion.

Vlad Buslov (7):
  net: flow_offload: provision conntrack info in ct_metadata
  netfilter: flowtable: fixup UDP timeout depending on ct state
  netfilter: flowtable: allow unidirectional rules
  netfilter: flowtable: cache info of last offload
  net/sched: act_ct: set ctinfo in meta action depending on ct state
  net/sched: act_ct: offload UDP NEW connections
  netfilter: nf_conntrack: allow early drop of offloaded UDP conns

 .../ethernet/mellanox/mlx5/core/en/tc_ct.c    |  4 ++
 .../ethernet/netronome/nfp/flower/conntrack.c | 24 +++++++
 include/net/netfilter/nf_flow_table.h         |  8 ++-
 net/netfilter/nf_conntrack_core.c             | 11 ++--
 net/netfilter/nf_flow_table_core.c            |  5 +-
 net/netfilter/nf_flow_table_inet.c            |  2 +-
 net/netfilter/nf_flow_table_offload.c         | 18 +++--
 net/sched/act_ct.c                            | 65 ++++++++++++++-----
 8 files changed, 103 insertions(+), 34 deletions(-)

Comments

patchwork-bot+netdevbpf@kernel.org Feb. 3, 2023, 9:40 a.m. UTC | #1
Hello:

This series was applied to netdev/net-next.git (master)
by David S. Miller <davem@davemloft.net>:

On Wed, 1 Feb 2023 17:30:53 +0100 you wrote:
> Currently only bidirectional established connections can be offloaded
> via act_ct. Such approach allows to hardcode a lot of assumptions into
> act_ct, flow_table and flow_offload intermediate layer codes. In order
> to enabled offloading of unidirectional UDP NEW connections start with
> incrementally changing the following assumptions:
> 
> - Drivers assume that only established connections are offloaded and
>   don't support updating existing connections. Extract ctinfo from meta
>   action cookie and refuse offloading of new connections in the drivers.
> 
> [...]

Here is the summary with links:
  - [net-next,v6,1/7] net: flow_offload: provision conntrack info in ct_metadata
    https://git.kernel.org/netdev/net-next/c/29744a10c59e
  - [net-next,v6,2/7] netfilter: flowtable: fixup UDP timeout depending on ct state
    https://git.kernel.org/netdev/net-next/c/0eb5acb16418
  - [net-next,v6,3/7] netfilter: flowtable: allow unidirectional rules
    https://git.kernel.org/netdev/net-next/c/8f84780b84d6
  - [net-next,v6,4/7] netfilter: flowtable: cache info of last offload
    https://git.kernel.org/netdev/net-next/c/1a441a9b8be8
  - [net-next,v6,5/7] net/sched: act_ct: set ctinfo in meta action depending on ct state
    https://git.kernel.org/netdev/net-next/c/d5774cb6c55c
  - [net-next,v6,6/7] net/sched: act_ct: offload UDP NEW connections
    https://git.kernel.org/netdev/net-next/c/6a9bad0069cf
  - [net-next,v6,7/7] netfilter: nf_conntrack: allow early drop of offloaded UDP conns
    https://git.kernel.org/netdev/net-next/c/df25455e5a48

You are awesome, thank you!