Merge branch 'net-handle-the-exp-removal-problem-with-ovs-upcall-properly'
authorPaolo Abeni <pabeni@redhat.com>
Thu, 20 Jul 2023 08:06:38 +0000 (10:06 +0200)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 20 Jul 2023 08:06:38 +0000 (10:06 +0200)
commit2d6d7d6ce257e3ea00e1524fdb138a3201df46ed
treedc860b3eaedc3dc4851872eb5663e99fd0e3c459
parent03b123debcbc8db987bda17ed8412cc011064c22
parent8c8b733208058702da451b7d60a12c0ff90b6879
Merge branch 'net-handle-the-exp-removal-problem-with-ovs-upcall-properly'

Xin Long says:

====================
net: handle the exp removal problem with ovs upcall properly

With the OVS upcall, the original ct in the skb will be dropped, and when
the skb comes back from userspace it has to create a new ct again through
nf_conntrack_in() in either OVS __ovs_ct_lookup() or TC tcf_ct_act().

However, the new ct will not be able to have the exp as the original ct
has taken it away from the hash table in nf_ct_find_expectation(). This
will cause some flow never to be matched, like:

  'ip,ct_state=-trk,in_port=1 actions=ct(zone=1)'
  'ip,ct_state=+trk+new+rel,in_port=1 actions=ct(commit,zone=1)'
  'ip,ct_state=+trk+new+rel,in_port=1 actions=ct(commit,zone=2),normal'

if the 2nd flow triggers the OVS upcall, the 3rd flow will never get
matched.

OVS conntrack works around this by adding its own exp lookup function to
not remove the exp from the hash table and saving the exp and its master
info to the flow keys instead of create a real ct. But this way doesn't
work for TC act_ct.

The patch 1/3 allows nf_ct_find_expectation() not to remove the exp from
the hash table if tmpl is set with IPS_CONFIRMED when doing lookup. This
allows both OVS conntrack and TC act_ct to have a simple and clear fix
for this problem in the patch 2/3 and 3/3.
====================

Link: https://lore.kernel.org/r/cover.1689541664.git.lucien.xin@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>